Skip to content

Commit

Permalink
Merge pull request #400 from danielwinterbottom/2022_ditau_UROPs
Browse files Browse the repository at this point in the history
2022 ditau uro ps
  • Loading branch information
danielwinterbottom authored Oct 10, 2023
2 parents c5fd06d + 8fc25b2 commit f1acc2f
Show file tree
Hide file tree
Showing 17 changed files with 1,629 additions and 1,503 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
114 changes: 68 additions & 46 deletions Analysis/HiggsTauTauRun2/scripts/HiggsTauTauPlot.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Analysis/HiggsTauTauRun2/scripts/TnP.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ def FitWorkspace(name,infile,outfile,sig_model='DoubleVCorr',bkg_model='Exponent
elif options.era == 'UL_16postVFP': ztt_samples = ['DYJetsToLL-LO']
elif options.era == 'UL_17': ztt_samples = ['DYJetsToLL-LO','DYJetsToLL-LO-ext1']
elif options.era == 'UL_18': ztt_samples = ['DYJetsToLL-LO','DYJetsToLL-LO-ext1']
elif options.era == '22_preEE': ztt_samples = ['DYJetsToLL-LO','DYto2L-4Jets_MLL-50']
elif options.era == '22_preEE': ztt_samples = ['DYJetsToLL_M-50','DYto2L-4Jets_MLL-50']
elif options.era == '22_postEE': ztt_samples = ['DYJetsToLL-LO','DYto2L-4Jets_MLL-50']

#Formula: abs(eta_2),pt_2,m_vis[0,0.1,0.3,0.8,1.0,1.2,1.6,1.8,2.1,2.4],[10,15,17,19,21,23,24,25,26,27,28,31,34,37,40,45,50,60,70,100,1000],(40,70,110) (wt)*((m_vis>50&&m_vis<150&&pt_1>28&&abs(eta_1)<2.1&&iso_1<0.15&&id_tag_1&&trg_tag_1&&os)*(1&&id_probe_1))*(os)*(1)*(!(trg_probe_2))
Expand Down
2 changes: 1 addition & 1 deletion Analysis/HiggsTauTauRun2/scripts/TnP_SF.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
if options.embed and EMB_y_val != 0:
stat_error_embed_sf = ((stat_error_data/data_y_val)**2+(stat_error_EMB/EMB_y_val)**2)**.5*data_y_val/EMB_y_val

if name == 'trg' and data_y_val<0.1:
if name == 'trg' and data_y_val<0.01:
# for the trigger SF we have to remove the low pT SFs where the SFs don;t make sense as the efficiencies are very small.
# at the moment to avoid having to use seperate pT cuts depending on the era/channel/trigger we just zero all SF where the efficiencies are < 10%
# need to be careful with this bit method incase efficiencies are low for another reason!
Expand Down
11 changes: 4 additions & 7 deletions Analysis/HiggsTauTauRun2/scripts/config_2022_postEE.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"file_prefix" : "root://gfe02.grid.hep.ph.ic.ac.uk:1097/store/user/irandreo/July0623_Data_124X_2022-postEE/",
"max_events": -1,
"timings": true,
//"channels": ["mt","et","tt","zmm","zee","em"],
// "channels": ["mt","zmm","tt","et"],
"channels": ["tpzee","tpzmm"],
// "channels": ["tt","mt","et","em","zmm","zee"],
"channels": ["mt","zmm","et","zee"],
"sequences": {
"all": ["default"]
//,"scale_met_high,""scale_met_lo","res_met_high","res_met_lo"]
Expand Down Expand Up @@ -66,7 +63,7 @@
"do_ff_systematics": false,
"do_pdf_wts": false,
"do_qcd_scale_wts": false,
"output_folder" : "/vols/cms/dw515/outputs/MSSM/2022-postEE_061023_v1/",
"output_folder" : "output/",
"svfit_from_grid" : true,
"read_all_svfit_files" : true,
"svfit_folder" : "/vols/cms/dw515/outputs/MSSM/mssm_2018_tres1_v2_svfit/",
Expand All @@ -85,8 +82,8 @@
"hadronic_tau_selector" : 0,
"run_gen_info" : false,
"do_pu_wt" : true,
"data_pu_file" : "input/pileup/2022/pu_2022_postEE.root",
"mc_pu_file" : "input/pileup/2022/pileup_2022_DYJetsToLL-LO_postEE_postEE.root",
"data_pu_file" : "input/pileup/2022/pu_data_2022_postEE.root",
"mc_pu_file" : "input/pileup/2022/pu_mc_2022.root",
"run_trg_filter": false,
"baseline": {
"tau_scale_mode" : true,
Expand Down
11 changes: 4 additions & 7 deletions Analysis/HiggsTauTauRun2/scripts/config_2022_preEE.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"file_prefix" : "root://gfe02.grid.hep.ph.ic.ac.uk:1097/store/user/irandreo/July0623_Data_124X_2022-preEE/",
"max_events": -1,
"timings": true,
//"channels": ["mt","et","tt","zmm","zee","em"],
// "channels": ["mt","zmm","tt","et"],
"channels": ["tpzee","tpzmm"],
// "channels": ["tt","mt","et","em","zmm","zee"],
"channels": ["mt","zmm","et","zee"],
"sequences": {
"all": ["default"]
//,"scale_met_high,""scale_met_lo","res_met_high","res_met_lo"]
Expand Down Expand Up @@ -66,7 +63,7 @@
"do_ff_systematics": false,
"do_pdf_wts": false,
"do_qcd_scale_wts": false,
"output_folder" : "/vols/cms/dw515/outputs/MSSM/2022-preEE_061023_v1/",
"output_folder" : "output/",
"svfit_from_grid" : true,
"read_all_svfit_files" : true,
"svfit_folder" : "/vols/cms/dw515/outputs/MSSM/mssm_2018_tres1_v2_svfit/",
Expand All @@ -85,8 +82,8 @@
"hadronic_tau_selector" : 0,
"run_gen_info" : false,
"do_pu_wt" : true,
"data_pu_file" : "input/pileup/2022/pu_2022_preEE.root",
"mc_pu_file" : "input/pileup/2022/pileup_2022_DYJetsToLL-LO_summer_preEE.root",
"data_pu_file" : "input/pileup/2022/pu_data_2022_preEE.root",
"mc_pu_file" : "input/pileup/2022/pu_mc_2022.root",
"run_trg_filter": false,
"baseline": {
"tau_scale_mode" : true,
Expand Down
4 changes: 2 additions & 2 deletions Analysis/HiggsTauTauRun2/scripts/getEffectiveEvents.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

file_names = {}
channels = ['mt']
years = ['2016','2017','2018']
years = ['2016','2017','2018','2022_preEE','2022_postEE']
for file_name in os.listdir(sys.argv[1]):
if '.root' not in file_name:
continue
Expand All @@ -15,7 +15,7 @@
file_names[key] = file_name

for f in file_names:
if "SingleMuon" in f or "SingleElectron" in f or "EGamma" in f or f in "MuonEG" or\
if "Muon" in f or "SingleElectron" in f or "EGamma" in f or f in "MuonEG" or\
"\bTau" in f:
continue
input_file = ROOT.TFile(sys.argv[1]+'/'+file_names[f])
Expand Down
4 changes: 2 additions & 2 deletions Analysis/HiggsTauTauRun2/scripts/resubmit_jobs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ source /vols/grid/cms/setup.sh' $job
echo $job
(( COUNT++ ))
if [[ $1 != "" ]]; then
#qsub -e /dev/null -o /dev/null -V -q hep.q -l h_rt=0:$1:0 -l h_vmem=24G -cwd $job
qsub -e /dev/null -o /dev/null -V -q hep.q -l h_rt=0:$1:0 -l h_vmem=24G -cwd $job
#qsub -e /dev/null -o /dev/null -V -q hep.q -l h_rt=0:$1:0 -l h_vmem=12G -cwd $job
qsub -e /dev/null -o /dev/null -V -q hep.q -l h_rt=$1:0:0 -l h_vmem=24G -pe hep.pe 2 -cwd $job
#qsub -e /dev/null -o /dev/null -V -q hep.q -l h_rt=$1:0:0 -l h_vmem=24G -pe hep.pe 2 -cwd $job
#qsub -e /dev/null -o /dev/null -V -q hep.q -l h_rt=0:$1:0 -cwd $job
fi
fi;
Expand Down
6 changes: 4 additions & 2 deletions Analysis/HiggsTauTauRun2/scripts/run_TAP_22.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ year=$1
extra=$2

if [[ "$year" == "2022_preEE" ]]; then
dir="/vols/cms/dw515/outputs/MSSM/2022-preEE_031023_v2/"
dir="/vols/cms/dw515/outputs/MSSM/2022-preEE_061023_v1/"
era="22_preEE"
elif [[ "$year" == "2022_postEE" ]]; then
dir="/vols/cms/dw515/outputs/MSSM/2022-postEE_031023_v2/"
dir="/vols/cms/dw515/outputs/MSSM/2022-postEE_061023_v1/"
era="22_postEE"
fi

Expand All @@ -15,6 +15,8 @@ mkdir -p TAP_Run3_v2/${year}/SingleMu
# single electron triggers
python scripts/TnP.py --channel tpzee --outputfolder=TAP_Run3_v2/${year}/SingleE --folder=${dir} --era=${era} --tree_name=tagandprobe ${extra}
python scripts/TnP.py --channel tpzee --outputfolder=TAP_Run3_v2/${year}/SingleE --folder=${dir} --era=${era} --tree_name=tagandprobe ${extra} --tight_tag
python scripts/TnP_SF.py --channel tpzee --input_folder TAP_Run3_v2/${year}/SingleE/


## single muon triggers:
#python scripts/TnP.py --outputfolder=TAP_Run3_v2/${year}/SingleMu --folder=${dir} --era=${era} --tree_name=tagandprobe ${extra}
Expand Down
47 changes: 24 additions & 23 deletions Analysis/HiggsTauTauRun2/src/HTTSequence.cc
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ void HTTSequence::BuildSequence(){
if ((era_type == era::data_2018 || era_type == era::data_2018UL))
data_json = "input/json/Cert_314472-325175_13TeV_Legacy2018_Collisions18_JSON.txt";
if ((era_type == era::data_2022_preEE || era_type == era::data_2022_postEE))
data_json = "input/json/Cert_Collisions2022_355100_362760_Golden_lumicorr.json"; //359571 and 359661 removed https://twiki.cern.ch/twiki/bin/view/CMS/LumiRecommendationsRun3
//data_json = "input/json/Cert_Collisions2022_355100_362760_Golden_lumicorr.json"; //359571 and 359661 removed https://twiki.cern.ch/twiki/bin/view/CMS/LumiRecommendationsRun3
data_json = "input/json/Cert_Collisions2022_355100_362760_Golden.json";

if(js["get_effective"].asBool() && js["make_sync_ntuple"].asBool()){
std::cerr<< "Error: cannot run effective number of event module in make_syncntuple mode"<<std::endl;
Expand Down Expand Up @@ -467,12 +468,12 @@ if(!is_data && js["do_gen_analysis"].asBool()){
httStitching.SetDYInputYields(96055748+101373493, 60368985, 27494377, 20466041, 8885353);
}
if(era_type == era::data_2022_preEE ) {
httStitching.SetDYInputCrossSections(1.0,1.0,1.0,1.0,1.0);
httStitching.SetDYInputYields(27309719,0,0,0,0);
httStitching.SetDYInputCrossSections(5455.0,978.3,315.1,93.7,45.4);
httStitching.SetDYInputYields(74730817,0,14777357,8599338,3267376);
}
if(era_type == era::data_2022_postEE) {
httStitching.SetDYInputCrossSections(1.0,1.0,1.0,1.0,1.0);
httStitching.SetDYInputYields(96294972,0,0,0,0);
httStitching.SetDYInputCrossSections(5455.0,978.3,315.1,93.7,45.4);
httStitching.SetDYInputYields(146338963,50224518,50437675,28833220,9405785);
}


Expand Down Expand Up @@ -780,12 +781,12 @@ if(era_type == era::data_2018UL) {
scalefactor_file_UL = "input/scale_factors/htt_scalefactors_UL_2018.root";
}
if(era_type == era::data_2022_preEE) {
scalefactor_file = "input/scale_factors/htt_scalefactors_2022preEE.root";
scalefactor_file = "input/scale_factors/htt_scalefactors_2022_preEE.root";
scalefactor_file_ggh = "input/ggh_weights/htt_scalefactors_2017_MGggh.root";
scalefactor_file_UL = "";
}
if(era_type == era::data_2022_postEE) {
scalefactor_file = "input/scale_factors/htt_scalefactors_2022postEE.root";
scalefactor_file = "input/scale_factors/htt_scalefactors_2022_postEE.root";
scalefactor_file_ggh = "input/ggh_weights/htt_scalefactors_2017_MGggh.root";
scalefactor_file_UL = "";
}
Expand All @@ -802,7 +803,7 @@ HTTWeights httWeights = HTTWeights("HTTWeights")
.set_channel(channel)
.set_era(era_type)
.set_mc(mc_type)
.set_do_tau_id_weights(!is_data)
.set_do_tau_id_weights(!is_data && !(era_type == era::data_2022_preEE || era_type == era::data_2022_postEE)) // tau ID corrections not derived yet for Run-3
.set_do_em_qcd_weights(true)
.set_ditau_label("ditau")
.set_jets_label(jets_label)
Expand All @@ -817,13 +818,13 @@ httWeights.set_scalefactor_file_UL(scalefactor_file_UL);
httWeights.set_is_embedded(is_embedded);
if (!is_data ) {
httWeights.set_do_trg_weights(true).set_trg_applied_in_mc(js["trg_in_mc"].asBool()).set_do_idiso_weights(true);
if(era_type != era::data_2022_preEE && era_type != era::data_2022_postEE){
httWeights.set_do_tau_id_sf(true);
if(channel == channel::et || channel == channel::mt || channel==channel::tt) {
httWeights.set_do_etau_fakerate(true);
httWeights.set_do_mtau_fakerate(true);
if(era_type != era::data_2022_preEE && era_type != era::data_2022_postEE){ //these weights don't exist yet for Run-3
httWeights.set_do_tau_id_sf(true);
if(channel == channel::et || channel == channel::mt || channel==channel::tt) {
httWeights.set_do_etau_fakerate(true);
httWeights.set_do_mtau_fakerate(true);
}
if(channel == channel::et || channel==channel::em || channel==channel::mt || channel==channel::zmm || channel==channel::zee) httWeights.set_do_tracking_eff(true);
if(channel == channel::et || channel==channel::em || channel==channel::mt || channel==channel::zmm || channel==channel::zee) httWeights.set_do_tracking_eff(true);
}
}
if ((output_name.find("DY") != output_name.npos && output_name.find("JetsToLL-LO") != output_name.npos && !(output_name.find("JetsToLL-LO-10-50") != output_name.npos))){
Expand Down Expand Up @@ -888,12 +889,12 @@ if(channel!=channel::tpzee&&channel!=channel::tpzmm){
httStitching.SetWInputYields(82360950, 47850048, 27411802, 18297679, 9130068);
}
if(era_type == era::data_2022_preEE){
httStitching.SetWInputCrossSections(1.0,1.0,1.0,0.0184,1.0);
httStitching.SetWInputYields(87900584, 0, 0, 8214147, 0);
httStitching.SetWInputCrossSections(55300.,9128.,2922.,861.3,415.4);
httStitching.SetWInputYields(87790626, 0, 0, 8164649, 1460716);
}
if(era_type == era::data_2022_postEE){
httStitching.SetWInputCrossSections(1.0,0.1522,0.0515,1.0,1.0);
httStitching.SetWInputYields(348456687, 42838501, 36384428, 0, 0);
httStitching.SetWInputCrossSections(55300.,9128.,2922.,861.3,415.4);
httStitching.SetWInputYields(347877593, 42788888, 36334573, 0, 4860871);
}
}
if ((output_name.find("DY") != output_name.npos && output_name.find("JetsToLL-LO") != output_name.npos && !(output_name.find("JetsToLL-LO-10-50") != output_name.npos))){
Expand Down Expand Up @@ -927,13 +928,13 @@ if(channel!=channel::tpzee&&channel!=channel::tpzmm){
httStitching.SetDYInputYields(96055748+101373493, 60368985, 27494377, 20466041, 8885353);
}
if(era_type == era::data_2022_preEE ) {
httStitching.SetDYInputCrossSections(1.0,1.0,1.0,1.0,1.0);
httStitching.SetDYInputYields(27309719,0,0,0,0);
httStitching.SetDYInputCrossSections(5455.0,978.3,315.1,93.7,45.4);
httStitching.SetDYInputYields(74730817,0,14777357,8599338,3267376);
}
if(era_type == era::data_2022_postEE) {
httStitching.SetDYInputCrossSections(1.0,1.0,1.0,1.0,1.0);
httStitching.SetDYInputYields(96294972,0,0,0,0);
}
httStitching.SetDYInputCrossSections(5455.0,978.3,315.1,93.7,45.4);
httStitching.SetDYInputYields(146338963,50224518,50437675,28833220,9405785);
}
}

if ((output_name.find("DYJetsToLL-NLO") != output_name.npos || output_name.find("DYJetstoLL-NLO") != output_name.npos || output_name.find("DYJetsToLL_0J-NLO") != output_name.npos|| output_name.find("DYJetsToLL_1J-NLO") != output_name.npos || output_name.find("DYJetsToLL_2J-NLO") != output_name.npos )){
Expand Down
Loading

0 comments on commit f1acc2f

Please sign in to comment.