diff --git a/Root/VLQ_AnalysisTools.cxx b/Root/VLQ_AnalysisTools.cxx index daec394202eed1a0c738ae152b9e11818a251749..34aaa8bad57fe24269e98c483df438ef9b4ba9fe 100644 --- a/Root/VLQ_AnalysisTools.cxx +++ b/Root/VLQ_AnalysisTools.cxx @@ -188,70 +188,70 @@ bool VLQ_AnalysisTools::GetObjectVectors(){ for ( unsigned int iTJet = 0; iTJet < m_ntupData -> d_trkjet_pt -> size(); ++iTJet ) { if(m_opt -> MsgLevel() == Debug::DEBUG){ - std::cout << "==> In the Track Jet builder: pt " << m_ntupData -> d_trkjet_pt -> at(iTJet); - std::cout << " eta " << TMath::Abs(m_ntupData -> d_trkjet_eta -> at(iTJet)) << std::endl; + std::cout << "==> In the Track Jet builder: pt " << m_ntupData -> d_trkjet_pt -> at(iTJet); + std::cout << " eta " << TMath::Abs(m_ntupData -> d_trkjet_eta -> at(iTJet)) << std::endl; } bool isSignalJet = m_ntupData -> d_trkjet_pt -> at(iTJet) >= m_opt->TrkJetsPtCut(); isSignalJet = isSignalJet && TMath::Abs( m_ntupData -> d_trkjet_eta -> at(iTJet) ) < 2.5; if( isSignalJet ){ - AnalysisObject *obj = new AnalysisObject(); - obj -> SetPtEtaPhiM( m_ntupData -> d_trkjet_pt -> at(iTJet), m_ntupData -> d_trkjet_eta -> at(iTJet), m_ntupData -> d_trkjet_phi -> at(iTJet), 0. ); + AnalysisObject *obj = new AnalysisObject(); + obj -> SetPtEtaPhiM( m_ntupData -> d_trkjet_pt -> at(iTJet), m_ntupData -> d_trkjet_eta -> at(iTJet), m_ntupData -> d_trkjet_phi -> at(iTJet), 0. ); - int isB = m_ntupData -> d_trkjet_isb -> at(iTJet); - obj -> SetMoment("isb", isB ); - obj -> SetMoment("btagw", m_ntupData -> d_trkjet_btag_weight -> at(iTJet) ); - - if ( !(m_opt -> IsData() || (m_opt -> StrSampleName().find("QCD") != std::string::npos)) ) { - obj -> SetMoment("truthLabel", m_ntupData -> d_trkjet_truthLabel -> at(iTJet) ); - } - - obj->SetMoment("calomatch",0); //initial default - obj -> SetMoment("bjet",isB); - - double reff = max(0.02,min(0.4,30./obj->Pt())); - obj->SetMoment("reff",reff); - - if( isB == 1 ){ - m_outData -> o_trkbjets -> push_back(obj); - - if( !m_opt->IsData() ){ - if( abs(obj->GetMoment("truthLabel")) == 5 ){ - m_outData -> o_trkbjets_truth_b -> push_back(obj); - } - else if( abs(obj->GetMoment("truthLabel")) == 4 ){ - m_outData -> o_trkbjets_truth_c -> push_back(obj); - } - else if( abs(obj->GetMoment("truthLabel")) == 15 ){ - m_outData -> o_trkbjets_truth_tau -> push_back(obj); - } - else{ - m_outData -> o_trkbjets_truth_lqg -> push_back(obj); - } - - }//MC - - } else { - m_outData -> o_trkljets -> push_back(obj); - } - - m_outData -> o_trkjets -> push_back(obj); - - if( !m_opt->IsData() ){ - if( abs(obj->GetMoment("truthLabel")) == 5 ){ - m_outData -> o_trkjets_truth_b -> push_back(obj); - } - else if( abs(obj->GetMoment("truthLabel")) == 4 ){ - m_outData -> o_trkjets_truth_c -> push_back(obj); - } - else if( abs(obj->GetMoment("truthLabel")) == 15 ){ - m_outData -> o_trkjets_truth_tau -> push_back(obj); - } - else{ - m_outData -> o_trkjets_truth_lqg -> push_back(obj); - } - - }//MC + int isB = m_ntupData -> d_trkjet_isb -> at(iTJet); + obj -> SetMoment("isb", isB ); + obj -> SetMoment("btagw", m_ntupData -> d_trkjet_btag_weight -> at(iTJet) ); + + if ( !(m_opt -> IsData() || (m_opt -> StrSampleName().find("QCD") != std::string::npos)) ) { + obj -> SetMoment("truthLabel", m_ntupData -> d_trkjet_truthLabel -> at(iTJet) ); + } + + obj->SetMoment("calomatch",0); //initial default + obj -> SetMoment("bjet",isB); + + double reff = max(0.02,min(0.4,30./obj->Pt())); + obj->SetMoment("reff",reff); + + if( isB == 1 ){ + m_outData -> o_trkbjets -> push_back(obj); + + if( !m_opt->IsData() ){ + if( abs(obj->GetMoment("truthLabel")) == 5 ){ + m_outData -> o_trkbjets_truth_b -> push_back(obj); + } + else if( abs(obj->GetMoment("truthLabel")) == 4 ){ + m_outData -> o_trkbjets_truth_c -> push_back(obj); + } + else if( abs(obj->GetMoment("truthLabel")) == 15 ){ + m_outData -> o_trkbjets_truth_tau -> push_back(obj); + } + else{ + m_outData -> o_trkbjets_truth_lqg -> push_back(obj); + } + + }//MC + + } else { + m_outData -> o_trkljets -> push_back(obj); + } + + m_outData -> o_trkjets -> push_back(obj); + + if( !m_opt->IsData() ){ + if( abs(obj->GetMoment("truthLabel")) == 5 ){ + m_outData -> o_trkjets_truth_b -> push_back(obj); + } + else if( abs(obj->GetMoment("truthLabel")) == 4 ){ + m_outData -> o_trkjets_truth_c -> push_back(obj); + } + else if( abs(obj->GetMoment("truthLabel")) == 15 ){ + m_outData -> o_trkjets_truth_tau -> push_back(obj); + } + else{ + m_outData -> o_trkjets_truth_lqg -> push_back(obj); + } + + }//MC } @@ -262,33 +262,33 @@ bool VLQ_AnalysisTools::GetObjectVectors(){ //=============== Re-run loop to clean concentric track jets =========== for( std::vector<AnalysisObject*>::iterator tj_i = m_outData->o_trkjets->begin(); - tj_i < (m_outData -> o_trkjets)->end(); ){ + tj_i < (m_outData -> o_trkjets)->end(); ){ double reff_i = (*tj_i)->GetMoment("reff"); bool is_concentric = false; for( std::vector<AnalysisObject*>::iterator tj_j = tj_i+1; - tj_j < (m_outData -> o_trkjets)->end(); ){ + tj_j < (m_outData -> o_trkjets)->end(); ){ - double reff_j = (*tj_j)->GetMoment("reff"); + double reff_j = (*tj_j)->GetMoment("reff"); - double dr = (*tj_i)->DeltaR(*(*tj_j)); - if(dr < min(reff_i,reff_j) ){ - is_concentric = true; - tj_j = (m_outData -> o_trkjets)->erase(tj_j); - m_outData -> o_trkjets_nconcentric++; - } - else{ - tj_j++; - } + double dr = (*tj_i)->DeltaR(*(*tj_j)); + if(dr < min(reff_i,reff_j) ){ + is_concentric = true; + tj_j = (m_outData -> o_trkjets)->erase(tj_j); + m_outData -> o_trkjets_nconcentric++; + } + else{ + tj_j++; + } }//inner loop if(is_concentric){ - tj_i = (m_outData -> o_trkjets)->erase(tj_i); + tj_i = (m_outData -> o_trkjets)->erase(tj_i); } else{ - tj_i++; + tj_i++; } }// @@ -343,63 +343,63 @@ bool VLQ_AnalysisTools::GetObjectVectors(){ int isB = 0; if(m_opt->BtagCollection()== VLQ_Options::CALO){ - if(TMath::Abs(obj->Eta())<2.5){ + if(TMath::Abs(obj->Eta())<2.5){ isB = obj -> GetMoment("isb"); - } + } } else{ - //Match to track b-jets - for(AnalysisObject* trkbjet : *(m_outData->o_trkbjets)){ - if(trkbjet->GetMoment("calomatch")>0) continue; - if(trkbjet->DeltaR(*obj) < 0.4){ - isB = 1; trkbjet->SetMoment("calomatch",1); - break; - } - } + //Match to track b-jets + for(AnalysisObject* trkbjet : *(m_outData->o_trkbjets)){ + if(trkbjet->GetMoment("calomatch")>0) continue; + if(trkbjet->DeltaR(*obj) < 0.4){ + isB = 1; trkbjet->SetMoment("calomatch",1); + break; + } + } } obj -> SetMoment("bjet",isB); if( isB == 1 ){ - m_outData -> o_bjets -> push_back(obj); - - if( !m_opt->IsData() ){ - if( abs(obj->GetMoment("truthLabel")) == 5 ){ - m_outData -> o_bjets_truth_b -> push_back(obj); - } - else if( abs(obj->GetMoment("truthLabel")) == 4 ){ - m_outData -> o_bjets_truth_c -> push_back(obj); - } - else if( abs(obj->GetMoment("truthLabel")) == 15 ){ - m_outData -> o_bjets_truth_tau -> push_back(obj); - } - else{ - m_outData -> o_bjets_truth_lqg -> push_back(obj); - } - - }//MC + m_outData -> o_bjets -> push_back(obj); + + if( !m_opt->IsData() ){ + if( abs(obj->GetMoment("truthLabel")) == 5 ){ + m_outData -> o_bjets_truth_b -> push_back(obj); + } + else if( abs(obj->GetMoment("truthLabel")) == 4 ){ + m_outData -> o_bjets_truth_c -> push_back(obj); + } + else if( abs(obj->GetMoment("truthLabel")) == 15 ){ + m_outData -> o_bjets_truth_tau -> push_back(obj); + } + else{ + m_outData -> o_bjets_truth_lqg -> push_back(obj); + } + + }//MC } else { - m_outData -> o_ljets -> push_back(obj); + m_outData -> o_ljets -> push_back(obj); } m_outData -> o_jets -> push_back(obj); if( !m_opt->IsData() ){ - if( abs(obj->GetMoment("truthLabel")) == 5 ){ - m_outData -> o_jets_truth_b -> push_back(obj); - } - else if( abs(obj->GetMoment("truthLabel")) == 4 ){ - m_outData -> o_jets_truth_c -> push_back(obj); - } - else if( abs(obj->GetMoment("truthLabel")) == 15 ){ - m_outData -> o_jets_truth_tau -> push_back(obj); - } - else{ - m_outData -> o_jets_truth_lqg -> push_back(obj); - } + if( abs(obj->GetMoment("truthLabel")) == 5 ){ + m_outData -> o_jets_truth_b -> push_back(obj); + } + else if( abs(obj->GetMoment("truthLabel")) == 4 ){ + m_outData -> o_jets_truth_c -> push_back(obj); + } + else if( abs(obj->GetMoment("truthLabel")) == 15 ){ + m_outData -> o_jets_truth_tau -> push_back(obj); + } + else{ + m_outData -> o_jets_truth_lqg -> push_back(obj); + } }//MC @@ -496,7 +496,7 @@ bool VLQ_AnalysisTools::GetObjectVectors(){ //Find number of b-tagged jets matched to this jet (//do this inside BTagVariables) AOVector* source_bjets = (m_opt->BtagCollection() == VLQ_Options::TRACK) ? m_outData -> o_trkbjets : m_outData -> o_bjets ; for(AnalysisObject* sbjet : *(source_bjets)){ - if( obj->DeltaR(*sbjet) < 1.0 ) nb_match++; + if( obj->DeltaR(*sbjet) < 1.0 ) nb_match++; } obj -> SetMoment("nbconsts", nb_match); @@ -514,16 +514,30 @@ bool VLQ_AnalysisTools::GetObjectVectors(){ const bool isHOT = obj->M() > 100 && m_ntupData -> d_rcjets_nconsts -> at(iRCJet) >= m_opt->RCNsubjetsCut() && obj -> Pt() > 300; obj -> SetMoment("isRCTTMass", isHOT); // Exclusive top-tagging - bool isTop = obj -> Pt() > 400 && obj->M() > 140;// && obj->M() < 210.; + bool isTop = obj -> Pt() > 400 && obj->M() > 140; + /* // STANDARD CUTS: isTop = isTop && ( obj -> Pt() < 800 ? m_ntupData -> d_rcjets_nconsts -> at(iRCJet) >= 2 : m_ntupData -> d_rcjets_nconsts -> at(iRCJet) >= 1); + */ + isTop = isTop && ( m_ntupData -> d_rcjets_nconsts -> at(iRCJet) == 1 ? obj -> Pt() > 700 : + m_ntupData -> d_rcjets_nconsts -> at(iRCJet) == 2 ? obj -> Pt() > 500 : + m_ntupData -> d_rcjets_nconsts -> at(iRCJet) == 3 ? obj -> Pt() > 450 : + m_ntupData -> d_rcjets_nconsts -> at(iRCJet) >= 4 && obj -> Pt() > 400 ); obj -> SetMoment("isRCMTop", isTop); // Exclusive Higgs tagging - bool isHiggs = obj -> Pt() > 300 && obj->M() > 105 && obj->M() < 140; - isHiggs = isHiggs && ( obj -> Pt() > 500 ? m_ntupData -> d_rcjets_nconsts -> at(iRCJet) <= 2 : m_ntupData -> d_rcjets_nconsts -> at(iRCJet) == 2); + bool isHiggs = obj -> Pt() > 350 && obj->M() > 105 && obj->M() < 140; + /* // STANDARD CUTS: + isHiggs = isHiggs && ( obj -> Pt() < 500 ? m_ntupData -> d_rcjets_nconsts -> at(iRCJet) == 2 : m_ntupData -> d_rcjets_nconsts -> at(iRCJet) <= 2); + */ + isHiggs = isHiggs && ( m_ntupData -> d_rcjets_nconsts -> at(iRCJet) == 2 ? obj -> Pt() > 350 : + m_ntupData -> d_rcjets_nconsts -> at(iRCJet) == 1 && obj -> Pt() > 600 ); obj -> SetMoment("isRCMHiggs", isHiggs); //Exclusive V(W/Z)-tagging - bool isV = obj -> Pt() > 300 && obj->M() > 70 && obj->M() < 105; - isV = isV && ( obj -> Pt() > 400 ? m_ntupData -> d_rcjets_nconsts -> at(iRCJet) <= 2 : m_ntupData -> d_rcjets_nconsts -> at(iRCJet) == 2); + bool isV = obj -> Pt() > 350 && obj->M() > 70 && obj->M() < 105; + /* // STANDARD CUTS: + isV = isV && ( obj -> Pt() < 400 ? m_ntupData -> d_rcjets_nconsts -> at(iRCJet) == 2 : m_ntupData -> d_rcjets_nconsts -> at(iRCJet) <= 2); + */ + isV = isV && ( m_ntupData -> d_rcjets_nconsts -> at(iRCJet) == 2 ? obj -> Pt() > 350 : + m_ntupData -> d_rcjets_nconsts -> at(iRCJet) == 1 && obj -> Pt() > 450 ); obj -> SetMoment("isRCMV", isV); // Very loose HOT jets const bool isLooseHOT = obj->M() > 50 && m_ntupData -> d_rcjets_nconsts -> at(iRCJet) >= 1 && obj -> Pt() > 300; @@ -539,42 +553,42 @@ bool VLQ_AnalysisTools::GetObjectVectors(){ } if( isTop ){ m_outData -> o_taggedjets.at("RCMTop") -> push_back(obj); - if(nb_match == 0) m_outData -> o_taggedjets.at("RCMTop0b") -> push_back(obj); - else if(nb_match == 1) m_outData -> o_taggedjets.at("RCMTop1b") -> push_back(obj); - else if(nb_match >= 2) m_outData -> o_taggedjets.at("RCMTop2bin") -> push_back(obj); + if(nb_match == 0) m_outData -> o_taggedjets.at("RCMTop0b") -> push_back(obj); + else if(nb_match == 1) m_outData -> o_taggedjets.at("RCMTop1b") -> push_back(obj); + else if(nb_match >= 2) m_outData -> o_taggedjets.at("RCMTop2bin") -> push_back(obj); } if( isHiggs ){ m_outData -> o_taggedjets.at("RCMHiggs") -> push_back(obj); - if(nb_match == 0) m_outData -> o_taggedjets.at("RCMHiggs0b") -> push_back(obj); - else if(nb_match == 1) m_outData -> o_taggedjets.at("RCMHiggs1b") -> push_back(obj); - else if(nb_match >= 2) m_outData -> o_taggedjets.at("RCMHiggs2bin") -> push_back(obj); + if(nb_match == 0) m_outData -> o_taggedjets.at("RCMHiggs0b") -> push_back(obj); + else if(nb_match == 1) m_outData -> o_taggedjets.at("RCMHiggs1b") -> push_back(obj); + else if(nb_match >= 2) m_outData -> o_taggedjets.at("RCMHiggs2bin") -> push_back(obj); } if( isV ){ m_outData -> o_taggedjets.at("RCMV") -> push_back(obj); - if(nb_match == 0) m_outData -> o_taggedjets.at("RCMV0b") -> push_back(obj); - else if(nb_match >= 1) m_outData -> o_taggedjets.at("RCMV1bin") -> push_back(obj); + if(nb_match == 0) m_outData -> o_taggedjets.at("RCMV0b") -> push_back(obj); + else if(nb_match >= 1) m_outData -> o_taggedjets.at("RCMV1bin") -> push_back(obj); } if( isLooseHOT ){ - m_outData -> o_taggedjets.at("LooseRCTTMass") -> push_back(obj); + m_outData -> o_taggedjets.at("LooseRCTTMass") -> push_back(obj); } //===== Loop over small-R jet container and set a flag if it is matched to one of the tagged jets ==== if( isTop || isHiggs || isV ){ - for( AnalysisObject* jet : *(m_outData -> o_jets) ){ - if(obj -> DeltaR(*jet) < 1.0) jet->UpdateMoment("RCtag_match", 1); - } + for( AnalysisObject* jet : *(m_outData -> o_jets) ){ + if(obj -> DeltaR(*jet) < 1.0) jet->UpdateMoment("RCtag_match", 1); + } } if(m_outData -> o_selLep){ - obj -> SetMoment ("dPhi_lep", fabs(obj->DeltaPhi( *(m_outData -> o_selLep) )) ); - obj -> SetMoment ("dR_lep", fabs(obj->DeltaR( *(m_outData -> o_selLep) )) ); + obj -> SetMoment ("dPhi_lep", fabs(obj->DeltaPhi( *(m_outData -> o_selLep) )) ); + obj -> SetMoment ("dR_lep", fabs(obj->DeltaR( *(m_outData -> o_selLep) )) ); } /* // TO BE REMOVED else{ - obj -> SetMoment ("dPhi_lep", -100. ); - obj -> SetMoment ("dR_lep", -100. ); + obj -> SetMoment ("dPhi_lep", -100. ); + obj -> SetMoment ("dR_lep", -100. ); } */ obj -> SetMoment ("dPhi_met", fabs(obj->DeltaPhi( *(m_outData -> o_AO_met) )) ); @@ -1020,11 +1034,11 @@ bool VLQ_AnalysisTools::UpdateBTagMoments(){ for( AnalysisObject* tagjet : *(tagcol.second) ){ - double dr_leptop = (m_outData->o_leptop)->DeltaR(*tagjet); - double dr_leptop_b = (m_outData->o_leptop_b)->DeltaR(*tagjet); + double dr_leptop = (m_outData->o_leptop)->DeltaR(*tagjet); + double dr_leptop_b = (m_outData->o_leptop_b)->DeltaR(*tagjet); - if(dr_leptop < drmin_leptop) { drmin_leptop = dr_leptop; } - if(dr_leptop_b < drmin_leptop_b) { drmin_leptop_b = dr_leptop_b; } + if(dr_leptop < drmin_leptop) { drmin_leptop = dr_leptop; } + if(dr_leptop_b < drmin_leptop_b) { drmin_leptop_b = dr_leptop_b; } diff --git a/Root/VLQ_Analysis_Data2015.cxx b/Root/VLQ_Analysis_Data2015.cxx index 507f1c9bf15068e2faee81592c1c699ff6030f0f..d77e1f52dab351aaa913108d6132947cec1f187b 100644 --- a/Root/VLQ_Analysis_Data2015.cxx +++ b/Root/VLQ_Analysis_Data2015.cxx @@ -58,6 +58,7 @@ m_weightMngr(0) { m_channels.clear(); m_topTaggers.clear(); + m_truthRCTypes.clear(); } //____________________________________________________________________________ @@ -139,7 +140,7 @@ bool VLQ_Analysis_Data2015::Begin(){ for(TriggerInfo* trig : m_outData -> o_trigger_list){ std::cout << trig->Name() << " : " << (trig->Type() == VLQ_Enums::TRIGMET) << " : " << (trig->Type() == VLQ_Enums::TRIGELEC) << " : " << (trig->Type() == VLQ_Enums::TRIGMUON) << " : " << (trig->Period() & VLQ_Enums::DATA2015) << " : " << (trig->Period() & VLQ_Enums::DATA2016) - << (trig->Period() & VLQ_Enums::DATA2017) << (trig->Period() & VLQ_Enums::DATA2018) << std::endl; + << (trig->Period() & VLQ_Enums::DATA2017) << (trig->Period() & VLQ_Enums::DATA2018) << std::endl; } std::cout << "==================================================================================" << std::endl; //Adds the triggers in the NtupleReader to read the corresponding branches in @@ -399,10 +400,10 @@ bool VLQ_Analysis_Data2015::Begin(){ if( m_opt->DoTruthAnalysis() ){ //&& (m_opt -> SampleName() == SampleName::VLQ) ){ for ( const std::string truthType : {"VLQ", "VLQ_Ht", "VLQ_Zt", "VLQ_Wb", - "VLQ_Hbdect", "VLQ_Wlepb", "VLQ_Whadb", "VLQ_Zhadt", - "H", "Hbb", "hadtop", "leptop", - "hadZ", "lepZ", "invZ", "hadW", "lepW"} ){ - m_outMngrTree->AddStandardBranch("truth_"+truthType+"_n", "Number of truth " + truthType, &(m_outData->o_truth_partons_n.at(truthType))); + "VLQ_Hbdect", "VLQ_Wlepb", "VLQ_Whadb", "VLQ_Zhadt", + "H", "Hbb", "hadtop", "leptop", + "hadZ", "lepZ", "invZ", "hadW", "lepW"} ){ + m_outMngrTree->AddStandardBranch("truth_"+truthType+"_n", "Number of truth " + truthType, &(m_outData->o_truth_partons_n.at(truthType))); } } @@ -431,6 +432,18 @@ bool VLQ_Analysis_Data2015::Begin(){ m_topTaggers.push_back("RCMV1bin"); m_topTaggers.push_back("RCMTopHiggs"); m_topTaggers.push_back("LooseRCTTMass"); + + m_truthRCTypes.push_back("truthTop"); + m_truthRCTypes.push_back("truthW"); + m_truthRCTypes.push_back("truthZ"); + m_truthRCTypes.push_back("truthHiggs"); + m_truthRCTypes.push_back("truthOther"); + + m_truthRCTypes.push_back("truthTop_inMassWindow"); + m_truthRCTypes.push_back("truthZ_inMassWindow"); + m_truthRCTypes.push_back("truthW_inMassWindow"); + m_truthRCTypes.push_back("truthHiggs_inMassWindow"); + if(m_opt->DumpHistos()){ if(!m_opt->DoOneLeptonAna() && !m_opt->DoZeroLeptonAna()) { @@ -467,14 +480,14 @@ bool VLQ_Analysis_Data2015::Begin(){ m_outMngrHist -> AddStandardTH1( "metsig_obj", 0.5, 0, 50, "; #sigma(E_{T}^{miss}) [#sqrt{GeV}]", false, &(m_outData -> o_metsig_obj) ); /* m_outMngrHist -> AddStandardTH2( "mu", "fwdjets_n", 10, 0, 80, 1, -0.5, 8.5,"<#mu>", "Number of fwd-jets", false, - &(m_outData -> o_pileup_mu),&(m_outData -> o_fwdjets_n) ); + &(m_outData -> o_pileup_mu),&(m_outData -> o_fwdjets_n) ); m_outMngrHist -> AddStandardTH2( "mu", "fwdjets30_n", 10, 0, 80, 1, -0.5, 8.5,"<#mu>", "Number of fwd-jets (p_{T}>30 GeV)", false, - &(m_outData -> o_pileup_mu),&(m_outData -> o_fwdjets30_n) ); + &(m_outData -> o_pileup_mu),&(m_outData -> o_fwdjets30_n) ); m_outMngrHist -> AddStandardTH2( "mu", "fwdjets40_n", 10, 0, 80, 1, -0.5, 8.5,"<#mu>", "Number of fwd-jets (p_{T}>40 GeV)", false, - &(m_outData -> o_pileup_mu),&(m_outData -> o_fwdjets40_n) ); + &(m_outData -> o_pileup_mu),&(m_outData -> o_fwdjets40_n) ); m_outMngrHist -> AddStandardTH2( "meff", "mtbmin", 25, 0, 3000, 25, 0., 500,"m_{eff} [GeV]", "m_{T}^{min}(b,MET)", false, - &(m_outData -> o_meff),&(m_outData -> o_mTbmin) ); + &(m_outData -> o_meff),&(m_outData -> o_mTbmin) ); */ //Leptonic top m_outMngrHist -> AddStandardTH1( "leptop_n", 1, -0.5, 1.5, ";Number of leptonic tops" , false, &(m_outData -> o_leptop_n) ); @@ -500,14 +513,14 @@ bool VLQ_Analysis_Data2015::Begin(){ //Semi-boosted hadronic top for ( int iJet=-1; iJet<=2; ++iJet ) { - std::string str_id = ""; - str_id += std::to_string(iJet); - if(iJet==-1) str_id = "s"; - const bool DrawSyst = (iJet <= 0) && otherVariables; - m_outMngrHist -> AddStandardTH1( "bW_hadtop"+str_id+"_pt", 25, 0, 500, ";bW Hadtop"+str_id+" p_{T} [GeV]", DrawSyst, &(m_outData -> o_bW_hadtop), iJet, "Pt"); - m_outMngrHist -> AddStandardTH1( "bW_hadtop"+str_id+"_eta", 0.2, -3, 3, ";bW Hadtop"+str_id+" #eta", DrawSyst, &(m_outData -> o_bW_hadtop), iJet, "Eta"); - m_outMngrHist -> AddStandardTH1( "bW_hadtop"+str_id+"_m", 10, 100, 300, ";bW Hadtop"+str_id+" mass [GeV]", false, &(m_outData -> o_bW_hadtop), iJet, "M"); - m_outMngrHist -> AddStandardTH1( "bW_hadtop"+str_id+"_dR_bW", 0.1,0,6, ";bW Hadtop"+str_id+" MV2c10", false, &(m_outData -> o_bW_hadtop), iJet, "dR_bW"); + std::string str_id = ""; + str_id += std::to_string(iJet); + if(iJet==-1) str_id = "s"; + const bool DrawSyst = (iJet <= 0) && otherVariables; + m_outMngrHist -> AddStandardTH1( "bW_hadtop"+str_id+"_pt", 25, 0, 500, ";bW Hadtop"+str_id+" p_{T} [GeV]", DrawSyst, &(m_outData -> o_bW_hadtop), iJet, "Pt"); + m_outMngrHist -> AddStandardTH1( "bW_hadtop"+str_id+"_eta", 0.2, -3, 3, ";bW Hadtop"+str_id+" #eta", DrawSyst, &(m_outData -> o_bW_hadtop), iJet, "Eta"); + m_outMngrHist -> AddStandardTH1( "bW_hadtop"+str_id+"_m", 10, 100, 300, ";bW Hadtop"+str_id+" mass [GeV]", false, &(m_outData -> o_bW_hadtop), iJet, "M"); + m_outMngrHist -> AddStandardTH1( "bW_hadtop"+str_id+"_dR_bW", 0.1,0,6, ";bW Hadtop"+str_id+" MV2c10", false, &(m_outData -> o_bW_hadtop), iJet, "dR_bW"); } //Jet variables @@ -528,74 +541,74 @@ bool VLQ_Analysis_Data2015::Begin(){ m_outMngrHist -> AddStandardTH1( "trkbjets_n", 1, -0.5, 8.5, ";Number of track b-jets", otherVariables, &(m_outData -> o_trkbjets_n) ); m_outMngrHist -> AddStandardTH1( "trkljets_n", 1, -0.5, 8.5, ";Number of track light-jets", otherVariables, &(m_outData -> o_trkljets_n) ); m_outMngrHist -> AddStandardTH1( "trkjets_nconcentric", 1, -2.5, 15.5,";Number of concentric track-jets", - otherVariables, &(m_outData -> o_trkjets_nconcentric) ); + otherVariables, &(m_outData -> o_trkjets_nconcentric) ); m_outMngrHist -> AddStandardTH1( "jets_n_truth_b", 1, -2.5, 15.5,";Number of truth b-jets", - otherVariables, &(m_outData -> o_jets_truth_b_n) ); + otherVariables, &(m_outData -> o_jets_truth_b_n) ); m_outMngrHist -> AddStandardTH1( "jets_n_truth_c", 1, -2.5, 15.5,";Number of truth c-jets", - otherVariables, &(m_outData -> o_jets_truth_c_n) ); + otherVariables, &(m_outData -> o_jets_truth_c_n) ); m_outMngrHist -> AddStandardTH1( "jets_n_truth_tau", 1, -2.5, 15.5,";Number of truth #tau-jets", - otherVariables, &(m_outData -> o_jets_truth_tau_n) ); + otherVariables, &(m_outData -> o_jets_truth_tau_n) ); m_outMngrHist -> AddStandardTH1( "jets_n_truth_lqg", 1, -2.5, 15.5,";Number of truth light-jets", - otherVariables, &(m_outData -> o_jets_truth_lqg_n) ); + otherVariables, &(m_outData -> o_jets_truth_lqg_n) ); m_outMngrHist -> AddStandardTH1( "bjets_n_truth_b", 1, -2.5, 15.5,";Number of b-tagged truth b-jets", - otherVariables, &(m_outData -> o_bjets_truth_b_n) ); + otherVariables, &(m_outData -> o_bjets_truth_b_n) ); m_outMngrHist -> AddStandardTH1( "bjets_n_truth_c", 1, -2.5, 15.5,";Number of b-tagged truth c-jets", - otherVariables, &(m_outData -> o_bjets_truth_c_n) ); + otherVariables, &(m_outData -> o_bjets_truth_c_n) ); m_outMngrHist -> AddStandardTH1( "bjets_n_truth_tau", 1, -2.5, 15.5,";Number of b-tagged truth #tau-jets", - otherVariables, &(m_outData -> o_bjets_truth_tau_n) ); + otherVariables, &(m_outData -> o_bjets_truth_tau_n) ); m_outMngrHist -> AddStandardTH1( "bjets_n_truth_lqg", 1, -2.5, 15.5,";Number of b-tagged truth light-jets", - otherVariables, &(m_outData -> o_bjets_truth_lqg_n) ); + otherVariables, &(m_outData -> o_bjets_truth_lqg_n) ); m_outMngrHist -> AddStandardTH1( "trkjets_n_truth_b", 1, -2.5, 15.5,";Number of truth b-trkjets", - otherVariables, &(m_outData -> o_trkjets_truth_b_n) ); + otherVariables, &(m_outData -> o_trkjets_truth_b_n) ); m_outMngrHist -> AddStandardTH1( "trkjets_n_truth_c", 1, -2.5, 15.5,";Number of truth c-trkjets", - otherVariables, &(m_outData -> o_trkjets_truth_c_n) ); + otherVariables, &(m_outData -> o_trkjets_truth_c_n) ); m_outMngrHist -> AddStandardTH1( "trkjets_n_truth_tau", 1, -2.5, 15.5,";Number of truth #tau-trkjets", - otherVariables, &(m_outData -> o_trkjets_truth_tau_n) ); + otherVariables, &(m_outData -> o_trkjets_truth_tau_n) ); m_outMngrHist -> AddStandardTH1( "trkjets_n_truth_lqg", 1, -2.5, 15.5,";Number of truth light-trkjets", - otherVariables, &(m_outData -> o_trkjets_truth_lqg_n) ); + otherVariables, &(m_outData -> o_trkjets_truth_lqg_n) ); m_outMngrHist -> AddStandardTH1( "trkbjets_n_truth_b", 1, -2.5, 15.5,";Number of b-tagged truth b-trkjets", - otherVariables, &(m_outData -> o_trkbjets_truth_b_n) ); + otherVariables, &(m_outData -> o_trkbjets_truth_b_n) ); m_outMngrHist -> AddStandardTH1( "trkbjets_n_truth_c", 1, -2.5, 15.5,";Number of b-tagged truth c-trkjets", - otherVariables, &(m_outData -> o_trkbjets_truth_c_n) ); + otherVariables, &(m_outData -> o_trkbjets_truth_c_n) ); m_outMngrHist -> AddStandardTH1( "trkbjets_n_truth_tau", 1, -2.5, 15.5,";Number of b-tagged truth #tau-trkjets", - otherVariables, &(m_outData -> o_trkbjets_truth_tau_n) ); + otherVariables, &(m_outData -> o_trkbjets_truth_tau_n) ); m_outMngrHist -> AddStandardTH1( "trkbjets_n_truth_lqg", 1, -2.5, 15.5,";Number of b-tagged truth light-trkjets", - otherVariables, &(m_outData -> o_trkbjets_truth_lqg_n) ); + otherVariables, &(m_outData -> o_trkbjets_truth_lqg_n) ); //================ CALO JETS ====================================== for ( int iJet=-1; iJet<=5; ++iJet ) { - std::string str_id = ""; - str_id += std::to_string(iJet); - if(iJet==-1) str_id = "s"; - const bool DrawSyst = (iJet <= 0) && otherVariables; - m_outMngrHist -> AddStandardTH1( "jet"+str_id+"_pt", 10, 0, 1000, ";Jet"+str_id+" p_{T} [GeV]", DrawSyst, - &(m_outData -> o_jets), iJet, "Pt"); - m_outMngrHist -> AddStandardTH1( "jet"+str_id+"_eta", 0.2, -3, 3, ";Jet"+str_id+" #eta", DrawSyst, - &(m_outData -> o_jets), iJet, "Eta"); - m_outMngrHist -> AddStandardTH1( "jet"+str_id+"_phi", 0.2, -3.5, 3.5, ";Jet"+str_id+" #varphi", false, - &(m_outData -> o_jets), iJet, "Phi"); - m_outMngrHist -> AddStandardTH1( "jet"+str_id+"_m", 10, 0, 200, ";Jet"+str_id+" mass [GeV]", false, - &(m_outData -> o_jets), iJet, "M"); - m_outMngrHist -> AddStandardTH1( "jet"+str_id+"_btagw", 0.1,-1.1,1.1, ";Jet"+str_id+" MV2c10", false, - &(m_outData -> o_jets), iJet, "btagw"); - m_outMngrHist -> AddStandardTH1( "jet"+str_id+"_jvt", 0.1,-1.1,1.1, ";Jet"+str_id+" JVT", false, - &(m_outData -> o_jets), iJet, "jvt"); - //for MC - if(!m_opt->IsData() && (iJet <= 0) ){ - m_outMngrHist -> AddStandardTH1( "jet_truth_b"+str_id+"_pt", 10, 0, 1000, ";Truth B-Jet"+str_id+" p_{T} [GeV]", DrawSyst, - &(m_outData -> o_jets_truth_b), iJet, "Pt"); - m_outMngrHist -> AddStandardTH1( "jet_truth_c"+str_id+"_pt", 10, 0, 1000, ";Truth C-Jet"+str_id+" p_{T} [GeV]", DrawSyst, - &(m_outData -> o_jets_truth_c), iJet, "Pt"); - m_outMngrHist -> AddStandardTH1( "jet_truth_tau"+str_id+"_pt", 10, 0, 1000, ";Truth #tau-Jet"+str_id+" p_{T} [GeV]", DrawSyst, - &(m_outData -> o_jets_truth_tau), iJet, "Pt"); - m_outMngrHist -> AddStandardTH1( "jet_truth_lqg"+str_id+"_pt", 10, 0, 1000, ";Truth Light-Jet"+str_id+" p_{T} [GeV]", DrawSyst, - &(m_outData -> o_jets_truth_lqg), iJet, "Pt"); - - } + std::string str_id = ""; + str_id += std::to_string(iJet); + if(iJet==-1) str_id = "s"; + const bool DrawSyst = (iJet <= 0) && otherVariables; + m_outMngrHist -> AddStandardTH1( "jet"+str_id+"_pt", 10, 0, 1000, ";Jet"+str_id+" p_{T} [GeV]", DrawSyst, + &(m_outData -> o_jets), iJet, "Pt"); + m_outMngrHist -> AddStandardTH1( "jet"+str_id+"_eta", 0.2, -3, 3, ";Jet"+str_id+" #eta", DrawSyst, + &(m_outData -> o_jets), iJet, "Eta"); + m_outMngrHist -> AddStandardTH1( "jet"+str_id+"_phi", 0.2, -3.5, 3.5, ";Jet"+str_id+" #varphi", false, + &(m_outData -> o_jets), iJet, "Phi"); + m_outMngrHist -> AddStandardTH1( "jet"+str_id+"_m", 10, 0, 200, ";Jet"+str_id+" mass [GeV]", false, + &(m_outData -> o_jets), iJet, "M"); + m_outMngrHist -> AddStandardTH1( "jet"+str_id+"_btagw", 0.1,-1.1,1.1, ";Jet"+str_id+" MV2c10", false, + &(m_outData -> o_jets), iJet, "btagw"); + m_outMngrHist -> AddStandardTH1( "jet"+str_id+"_jvt", 0.1,-1.1,1.1, ";Jet"+str_id+" JVT", false, + &(m_outData -> o_jets), iJet, "jvt"); + //for MC + if(!m_opt->IsData() && (iJet <= 0) ){ + m_outMngrHist -> AddStandardTH1( "jet_truth_b"+str_id+"_pt", 10, 0, 1000, ";Truth B-Jet"+str_id+" p_{T} [GeV]", DrawSyst, + &(m_outData -> o_jets_truth_b), iJet, "Pt"); + m_outMngrHist -> AddStandardTH1( "jet_truth_c"+str_id+"_pt", 10, 0, 1000, ";Truth C-Jet"+str_id+" p_{T} [GeV]", DrawSyst, + &(m_outData -> o_jets_truth_c), iJet, "Pt"); + m_outMngrHist -> AddStandardTH1( "jet_truth_tau"+str_id+"_pt", 10, 0, 1000, ";Truth #tau-Jet"+str_id+" p_{T} [GeV]", DrawSyst, + &(m_outData -> o_jets_truth_tau), iJet, "Pt"); + m_outMngrHist -> AddStandardTH1( "jet_truth_lqg"+str_id+"_pt", 10, 0, 1000, ";Truth Light-Jet"+str_id+" p_{T} [GeV]", DrawSyst, + &(m_outData -> o_jets_truth_lqg), iJet, "Pt"); + + } } for ( int iFwdJet=-1; iFwdJet<=5; ++iFwdJet ) { @@ -604,11 +617,11 @@ bool VLQ_Analysis_Data2015::Begin(){ if(iFwdJet==-1) str_id = "s"; const bool DrawSyst = (iFwdJet <= 0) && otherVariables; m_outMngrHist -> AddStandardTH1( "fwdjet"+str_id+"_pt", 5, 0, 500, ";Fwd-jet"+str_id+" p_{T} [GeV]", - DrawSyst, &(m_outData -> o_fwdjets), iFwdJet, "Pt"); + DrawSyst, &(m_outData -> o_fwdjets), iFwdJet, "Pt"); m_outMngrHist -> AddStandardTH1( "fwdjet"+str_id+"_eta", 0.2, -5, 5, ";Fwd-jet"+str_id+" #eta", - DrawSyst, &(m_outData -> o_fwdjets), iFwdJet, "Eta"); + DrawSyst, &(m_outData -> o_fwdjets), iFwdJet, "Eta"); m_outMngrHist -> AddStandardTH1( "fwdjet"+str_id+"_phi", 0.2, -3.5, 3.5, ";Fwd-jet"+str_id+" #varphi", - false, &(m_outData -> o_fwdjets), iFwdJet, "Phi"); + false, &(m_outData -> o_fwdjets), iFwdJet, "Phi"); m_outMngrHist -> AddStandardTH1( "fwdjet"+str_id+"_m", 4, 0, 100, ";Fwd-jet"+str_id+" mass [GeV]", false, &(m_outData -> o_fwdjets), iFwdJet, "M"); @@ -652,133 +665,133 @@ bool VLQ_Analysis_Data2015::Begin(){ } for ( int iBJet=-1; iBJet<=3; ++iBJet ) { - std::string str_id = ""; - str_id += std::to_string(iBJet); - if(iBJet==-1) str_id = "s"; - const bool DrawSyst = (iBJet <= 0) && otherVariables; - m_outMngrHist -> AddStandardTH1( "bjet"+str_id+"_pt", 10, 0, 1000, ";b-jet"+str_id+" p_{T} [GeV]", - false, &(m_outData -> o_bjets), iBJet, "Pt" ); - m_outMngrHist -> AddStandardTH1( "bjet"+str_id+"_eta", 0.2, -3, 3, ";b-jet"+str_id+" #eta", - false, &(m_outData -> o_bjets), iBJet, "Eta" ); - m_outMngrHist -> AddStandardTH1( "bjet"+str_id+"_btagw", 0.1,-1.1,1.1, ";b-jet"+str_id+" MV2c10", - false, &(m_outData -> o_bjets), iBJet, "btagw" ); - m_outMngrHist -> AddStandardTH1( "bjet"+str_id+"_jvt", 0.1,-1.1,1.1, ";b-jet"+str_id+" JVT", - false, &(m_outData -> o_bjets), iBJet, "jvt" ); - - //for MC - if(!m_opt->IsData() && (iBJet <= 0) ){ - m_outMngrHist -> AddStandardTH1( "bjet_truth_b"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth B-Jet"+str_id+" p_{T} [GeV]", DrawSyst, - &(m_outData -> o_bjets_truth_b), iBJet, "Pt"); - m_outMngrHist -> AddStandardTH1( "bjet_truth_c"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth C-Jet"+str_id+" p_{T} [GeV]", DrawSyst, - &(m_outData -> o_bjets_truth_c), iBJet, "Pt"); - m_outMngrHist -> AddStandardTH1( "bjet_truth_tau"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth #tau-Jet"+str_id+" p_{T} [GeV]", - DrawSyst, &(m_outData -> o_jets_truth_tau), iBJet, "Pt"); - m_outMngrHist -> AddStandardTH1( "bjet_truth_lqg"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth Light-Jet"+str_id+" p_{T} [GeV]", - DrawSyst, &(m_outData -> o_bjets_truth_lqg), iBJet, "Pt"); - } + std::string str_id = ""; + str_id += std::to_string(iBJet); + if(iBJet==-1) str_id = "s"; + const bool DrawSyst = (iBJet <= 0) && otherVariables; + m_outMngrHist -> AddStandardTH1( "bjet"+str_id+"_pt", 10, 0, 1000, ";b-jet"+str_id+" p_{T} [GeV]", + false, &(m_outData -> o_bjets), iBJet, "Pt" ); + m_outMngrHist -> AddStandardTH1( "bjet"+str_id+"_eta", 0.2, -3, 3, ";b-jet"+str_id+" #eta", + false, &(m_outData -> o_bjets), iBJet, "Eta" ); + m_outMngrHist -> AddStandardTH1( "bjet"+str_id+"_btagw", 0.1,-1.1,1.1, ";b-jet"+str_id+" MV2c10", + false, &(m_outData -> o_bjets), iBJet, "btagw" ); + m_outMngrHist -> AddStandardTH1( "bjet"+str_id+"_jvt", 0.1,-1.1,1.1, ";b-jet"+str_id+" JVT", + false, &(m_outData -> o_bjets), iBJet, "jvt" ); + + //for MC + if(!m_opt->IsData() && (iBJet <= 0) ){ + m_outMngrHist -> AddStandardTH1( "bjet_truth_b"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth B-Jet"+str_id+" p_{T} [GeV]", DrawSyst, + &(m_outData -> o_bjets_truth_b), iBJet, "Pt"); + m_outMngrHist -> AddStandardTH1( "bjet_truth_c"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth C-Jet"+str_id+" p_{T} [GeV]", DrawSyst, + &(m_outData -> o_bjets_truth_c), iBJet, "Pt"); + m_outMngrHist -> AddStandardTH1( "bjet_truth_tau"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth #tau-Jet"+str_id+" p_{T} [GeV]", + DrawSyst, &(m_outData -> o_jets_truth_tau), iBJet, "Pt"); + m_outMngrHist -> AddStandardTH1( "bjet_truth_lqg"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth Light-Jet"+str_id+" p_{T} [GeV]", + DrawSyst, &(m_outData -> o_bjets_truth_lqg), iBJet, "Pt"); + } } for ( int iLJet=-1; iLJet<=4; ++iLJet ) { - std::string str_id = ""; - str_id += std::to_string(iLJet); - if(iLJet==-1) str_id = "s"; - m_outMngrHist -> AddStandardTH1( "ljet"+str_id+"_pt", 10, 0, 500, ";light-jet"+str_id+" p_{T} [GeV]", - false, &(m_outData -> o_ljets), iLJet, "Pt" ); - m_outMngrHist -> AddStandardTH1( "ljet"+str_id+"_eta", 0.2, -3, 3, ";light-jet"+str_id+" #eta", - false, &(m_outData -> o_ljets), iLJet, "Eta" ); - m_outMngrHist -> AddStandardTH1( "ljet"+str_id+"_btagw", 0.1,-1.1,1.1, ";light-jet"+str_id+" MV2c10", - false, &(m_outData -> o_ljets), iLJet, "btagw" ); - m_outMngrHist -> AddStandardTH1( "ljet"+str_id+"_jvt", 0.1,-1.1,1.1, ";light-jet"+str_id+" JVT", - false, &(m_outData -> o_ljets), iLJet, "jvt" ); + std::string str_id = ""; + str_id += std::to_string(iLJet); + if(iLJet==-1) str_id = "s"; + m_outMngrHist -> AddStandardTH1( "ljet"+str_id+"_pt", 10, 0, 500, ";light-jet"+str_id+" p_{T} [GeV]", + false, &(m_outData -> o_ljets), iLJet, "Pt" ); + m_outMngrHist -> AddStandardTH1( "ljet"+str_id+"_eta", 0.2, -3, 3, ";light-jet"+str_id+" #eta", + false, &(m_outData -> o_ljets), iLJet, "Eta" ); + m_outMngrHist -> AddStandardTH1( "ljet"+str_id+"_btagw", 0.1,-1.1,1.1, ";light-jet"+str_id+" MV2c10", + false, &(m_outData -> o_ljets), iLJet, "btagw" ); + m_outMngrHist -> AddStandardTH1( "ljet"+str_id+"_jvt", 0.1,-1.1,1.1, ";light-jet"+str_id+" JVT", + false, &(m_outData -> o_ljets), iLJet, "jvt" ); } //================ TRACK JETS ====================================== if(m_opt->BtagCollection() == VLQ_Options::TRACK){ - for ( int iTrkjet=-1; iTrkjet<=5; ++iTrkjet ) { - std::string str_id = ""; - str_id += std::to_string(iTrkjet); - if(iTrkjet==-1) str_id = "s"; - const bool DrawSyst = (iTrkjet <= 0) && otherVariables; - m_outMngrHist -> AddStandardTH1( "trkjet"+str_id+"_pt", 10, 0, 1000, ";Trkjet"+str_id+" p_{T} [GeV]", DrawSyst, - &(m_outData -> o_trkjets), iTrkjet, "Pt"); - m_outMngrHist -> AddStandardTH1( "trkjet"+str_id+"_eta", 0.2, -3, 3, ";Trkjet"+str_id+" #eta", DrawSyst, - &(m_outData -> o_trkjets), iTrkjet, "Eta"); - m_outMngrHist -> AddStandardTH1( "trkjet"+str_id+"_phi", 0.2, -3.5, 3.5, ";Trkjet"+str_id+" #varphi", false, - &(m_outData -> o_trkjets), iTrkjet, "Phi"); - m_outMngrHist -> AddStandardTH1( "trkjet"+str_id+"_btagw", 0.1,-1.1,1.1, ";Trkjet"+str_id+" MV2c10", false, - &(m_outData -> o_trkjets), iTrkjet, "btagw"); - m_outMngrHist -> AddStandardTH1( "trkjet"+str_id+"_reff", 0.05,0.,1.0, ";Trkjet"+str_id+" R_{eff}", false, - &(m_outData -> o_trkjets), iTrkjet, "reff"); - - //for MC - if(!m_opt->IsData() && (iTrkjet <= 0) ){ - m_outMngrHist -> AddStandardTH1( "trkjet_truth_b"+str_id+"_pt", 10, 0, 1000, ";Truth B-Trkjet"+str_id+" p_{T} [GeV]", DrawSyst, - &(m_outData -> o_trkjets_truth_b), iTrkjet, "Pt"); - m_outMngrHist -> AddStandardTH1( "trkjet_truth_c"+str_id+"_pt", 10, 0, 1000, ";Truth C-Trkjet"+str_id+" p_{T} [GeV]", DrawSyst, - &(m_outData -> o_trkjets_truth_c), iTrkjet, "Pt"); - m_outMngrHist -> AddStandardTH1( "trkjet_truth_tau"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth #tau-Trket"+str_id+" p_{T} [GeV]", - DrawSyst, &(m_outData -> o_trkjets_truth_tau), iTrkjet, "Pt"); - m_outMngrHist -> AddStandardTH1( "trkjet_truth_lqg"+str_id+"_pt", 10, 0, 1000, ";Truth Light-Trkjet"+str_id+" p_{T} [GeV]", DrawSyst, - &(m_outData -> o_trkjets_truth_lqg), iTrkjet, "Pt"); + for ( int iTrkjet=-1; iTrkjet<=5; ++iTrkjet ) { + std::string str_id = ""; + str_id += std::to_string(iTrkjet); + if(iTrkjet==-1) str_id = "s"; + const bool DrawSyst = (iTrkjet <= 0) && otherVariables; + m_outMngrHist -> AddStandardTH1( "trkjet"+str_id+"_pt", 10, 0, 1000, ";Trkjet"+str_id+" p_{T} [GeV]", DrawSyst, + &(m_outData -> o_trkjets), iTrkjet, "Pt"); + m_outMngrHist -> AddStandardTH1( "trkjet"+str_id+"_eta", 0.2, -3, 3, ";Trkjet"+str_id+" #eta", DrawSyst, + &(m_outData -> o_trkjets), iTrkjet, "Eta"); + m_outMngrHist -> AddStandardTH1( "trkjet"+str_id+"_phi", 0.2, -3.5, 3.5, ";Trkjet"+str_id+" #varphi", false, + &(m_outData -> o_trkjets), iTrkjet, "Phi"); + m_outMngrHist -> AddStandardTH1( "trkjet"+str_id+"_btagw", 0.1,-1.1,1.1, ";Trkjet"+str_id+" MV2c10", false, + &(m_outData -> o_trkjets), iTrkjet, "btagw"); + m_outMngrHist -> AddStandardTH1( "trkjet"+str_id+"_reff", 0.05,0.,1.0, ";Trkjet"+str_id+" R_{eff}", false, + &(m_outData -> o_trkjets), iTrkjet, "reff"); + + //for MC + if(!m_opt->IsData() && (iTrkjet <= 0) ){ + m_outMngrHist -> AddStandardTH1( "trkjet_truth_b"+str_id+"_pt", 10, 0, 1000, ";Truth B-Trkjet"+str_id+" p_{T} [GeV]", DrawSyst, + &(m_outData -> o_trkjets_truth_b), iTrkjet, "Pt"); + m_outMngrHist -> AddStandardTH1( "trkjet_truth_c"+str_id+"_pt", 10, 0, 1000, ";Truth C-Trkjet"+str_id+" p_{T} [GeV]", DrawSyst, + &(m_outData -> o_trkjets_truth_c), iTrkjet, "Pt"); + m_outMngrHist -> AddStandardTH1( "trkjet_truth_tau"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth #tau-Trket"+str_id+" p_{T} [GeV]", + DrawSyst, &(m_outData -> o_trkjets_truth_tau), iTrkjet, "Pt"); + m_outMngrHist -> AddStandardTH1( "trkjet_truth_lqg"+str_id+"_pt", 10, 0, 1000, ";Truth Light-Trkjet"+str_id+" p_{T} [GeV]", DrawSyst, + &(m_outData -> o_trkjets_truth_lqg), iTrkjet, "Pt"); - } + } - } + } - for ( int iBTrkjet=-1; iBTrkjet<=3; ++iBTrkjet ) { - std::string str_id = ""; - str_id += std::to_string(iBTrkjet); - if(iBTrkjet==-1) str_id = "s"; - const bool DrawSyst = (iBTrkjet <= 0) && otherVariables; - m_outMngrHist -> AddStandardTH1( "trkbjet"+str_id+"_pt", 10, 0, 1000, ";b-trkjet"+str_id+" p_{T} [GeV]", - false, &(m_outData -> o_trkbjets), iBTrkjet, "Pt" ); - m_outMngrHist -> AddStandardTH1( "trkbjet"+str_id+"_eta", 0.2, -3, 3, ";b-trkjet"+str_id+" #eta", - false, &(m_outData -> o_trkbjets), iBTrkjet, "Eta" ); - m_outMngrHist -> AddStandardTH1( "trkbjet"+str_id+"_btagw", 0.1,-1.1,1.1, ";b-trkjet"+str_id+" MV2c10", - false, &(m_outData -> o_trkbjets), iBTrkjet, "btagw" ); - m_outMngrHist -> AddStandardTH1( "trkbjet"+str_id+"_reff", 0.05,0.,0.4, ";b-trkjet"+str_id+" R_{eff}", false, - &(m_outData -> o_trkjets), iBTrkjet, "reff"); - - //for MC - if(!m_opt->IsData() && (iBTrkjet <= 0) ){ - m_outMngrHist -> AddStandardTH1( "trkbjet_truth_b"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth B-Trkjet"+str_id+" p_{T} [GeV]", - DrawSyst, &(m_outData -> o_trkbjets_truth_b), iBTrkjet, "Pt"); - m_outMngrHist -> AddStandardTH1( "trkbjet_truth_c"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth C-Trkjet"+str_id+" p_{T} [GeV]", - DrawSyst, &(m_outData -> o_trkbjets_truth_c), iBTrkjet, "Pt"); - m_outMngrHist -> AddStandardTH1( "trkbjet_truth_tau"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth #tau-Trket"+str_id+" p_{T} [GeV]", - DrawSyst, &(m_outData -> o_trkbjets_truth_tau), iBTrkjet, "Pt"); - m_outMngrHist -> AddStandardTH1( "trkbjet_truth_lqg"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth Light-Trkjet"+str_id+" p_{T} [GeV]", - DrawSyst, &(m_outData -> o_trkbjets_truth_lqg), iBTrkjet, "Pt"); + for ( int iBTrkjet=-1; iBTrkjet<=3; ++iBTrkjet ) { + std::string str_id = ""; + str_id += std::to_string(iBTrkjet); + if(iBTrkjet==-1) str_id = "s"; + const bool DrawSyst = (iBTrkjet <= 0) && otherVariables; + m_outMngrHist -> AddStandardTH1( "trkbjet"+str_id+"_pt", 10, 0, 1000, ";b-trkjet"+str_id+" p_{T} [GeV]", + false, &(m_outData -> o_trkbjets), iBTrkjet, "Pt" ); + m_outMngrHist -> AddStandardTH1( "trkbjet"+str_id+"_eta", 0.2, -3, 3, ";b-trkjet"+str_id+" #eta", + false, &(m_outData -> o_trkbjets), iBTrkjet, "Eta" ); + m_outMngrHist -> AddStandardTH1( "trkbjet"+str_id+"_btagw", 0.1,-1.1,1.1, ";b-trkjet"+str_id+" MV2c10", + false, &(m_outData -> o_trkbjets), iBTrkjet, "btagw" ); + m_outMngrHist -> AddStandardTH1( "trkbjet"+str_id+"_reff", 0.05,0.,0.4, ";b-trkjet"+str_id+" R_{eff}", false, + &(m_outData -> o_trkjets), iBTrkjet, "reff"); + + //for MC + if(!m_opt->IsData() && (iBTrkjet <= 0) ){ + m_outMngrHist -> AddStandardTH1( "trkbjet_truth_b"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth B-Trkjet"+str_id+" p_{T} [GeV]", + DrawSyst, &(m_outData -> o_trkbjets_truth_b), iBTrkjet, "Pt"); + m_outMngrHist -> AddStandardTH1( "trkbjet_truth_c"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth C-Trkjet"+str_id+" p_{T} [GeV]", + DrawSyst, &(m_outData -> o_trkbjets_truth_c), iBTrkjet, "Pt"); + m_outMngrHist -> AddStandardTH1( "trkbjet_truth_tau"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth #tau-Trket"+str_id+" p_{T} [GeV]", + DrawSyst, &(m_outData -> o_trkbjets_truth_tau), iBTrkjet, "Pt"); + m_outMngrHist -> AddStandardTH1( "trkbjet_truth_lqg"+str_id+"_pt", 10, 0, 1000, ";b-tagged Truth Light-Trkjet"+str_id+" p_{T} [GeV]", + DrawSyst, &(m_outData -> o_trkbjets_truth_lqg), iBTrkjet, "Pt"); - } - } - for ( int iLTrkjet=-1; iLTrkjet<=4; ++iLTrkjet ) { - std::string str_id = ""; - str_id += std::to_string(iLTrkjet); - if(iLTrkjet==-1) str_id = "s"; - m_outMngrHist -> AddStandardTH1( "trkljet"+str_id+"_pt", 10, 0, 500, ";light-trkjet"+str_id+" p_{T} [GeV]", - false, &(m_outData -> o_trkljets), iLTrkjet, "Pt" ); - m_outMngrHist -> AddStandardTH1( "trkljet"+str_id+"_eta", 0.2, -3, 3, ";light-trkjet"+str_id+" #eta", - false, &(m_outData -> o_trkljets), iLTrkjet, "Eta" ); - m_outMngrHist -> AddStandardTH1( "trkljet"+str_id+"_btagw", 0.1,-1.1,1.1, ";light-trkjet"+str_id+" MV2c10", - false, &(m_outData -> o_trkljets), iLTrkjet, "btagw" ); - m_outMngrHist -> AddStandardTH1( "trkljet"+str_id+"_reff", 0.05,0.,0.4, ";light-trkjet"+str_id+" R_{eff}", false, - &(m_outData -> o_trkljets), iLTrkjet, "reff"); - } + } + } + for ( int iLTrkjet=-1; iLTrkjet<=4; ++iLTrkjet ) { + std::string str_id = ""; + str_id += std::to_string(iLTrkjet); + if(iLTrkjet==-1) str_id = "s"; + m_outMngrHist -> AddStandardTH1( "trkljet"+str_id+"_pt", 10, 0, 500, ";light-trkjet"+str_id+" p_{T} [GeV]", + false, &(m_outData -> o_trkljets), iLTrkjet, "Pt" ); + m_outMngrHist -> AddStandardTH1( "trkljet"+str_id+"_eta", 0.2, -3, 3, ";light-trkjet"+str_id+" #eta", + false, &(m_outData -> o_trkljets), iLTrkjet, "Eta" ); + m_outMngrHist -> AddStandardTH1( "trkljet"+str_id+"_btagw", 0.1,-1.1,1.1, ";light-trkjet"+str_id+" MV2c10", + false, &(m_outData -> o_trkljets), iLTrkjet, "btagw" ); + m_outMngrHist -> AddStandardTH1( "trkljet"+str_id+"_reff", 0.05,0.,0.4, ";light-trkjet"+str_id+" R_{eff}", false, + &(m_outData -> o_trkljets), iLTrkjet, "reff"); + } }//TRACK JETS //Large-R jets if( m_opt -> UseLargeRJets() ){ - m_outMngrHist -> AddStandardTH1( "FatJets_n", 1, -0.5, 5.5, ";Number of large-R jets", false, &(m_outData -> o_fjets_n) ); - for ( int iLRJet=-1; iLRJet<=0; ++iLRJet ) { - std::string str_id = ""; - str_id += std::to_string(iLRJet); - if(iLRJet==-1) str_id = "s"; - m_outMngrHist -> AddStandardTH1( "FatJet"+str_id+"_pt", 50, 0, 1000, ";Fat jet"+str_id+" p_{T} [GeV]" , false, &(m_outData -> o_fjets), iLRJet, "Pt"); - m_outMngrHist -> AddStandardTH1( "FatJet"+str_id+"_eta", 0.2, -3, 3, ";Fat jet"+str_id+" #eta" , false, &(m_outData -> o_fjets), iLRJet, "Eta"); - m_outMngrHist -> AddStandardTH1( "FatJet"+str_id+"_m", 10, 0, 400, ";Fat jet"+str_id+" mass [GeV]" , false, &(m_outData -> o_fjets), iLRJet, "M"); - } + m_outMngrHist -> AddStandardTH1( "FatJets_n", 1, -0.5, 5.5, ";Number of large-R jets", false, &(m_outData -> o_fjets_n) ); + for ( int iLRJet=-1; iLRJet<=0; ++iLRJet ) { + std::string str_id = ""; + str_id += std::to_string(iLRJet); + if(iLRJet==-1) str_id = "s"; + m_outMngrHist -> AddStandardTH1( "FatJet"+str_id+"_pt", 50, 0, 1000, ";Fat jet"+str_id+" p_{T} [GeV]" , false, &(m_outData -> o_fjets), iLRJet, "Pt"); + m_outMngrHist -> AddStandardTH1( "FatJet"+str_id+"_eta", 0.2, -3, 3, ";Fat jet"+str_id+" #eta" , false, &(m_outData -> o_fjets), iLRJet, "Eta"); + m_outMngrHist -> AddStandardTH1( "FatJet"+str_id+"_m", 10, 0, 400, ";Fat jet"+str_id+" mass [GeV]" , false, &(m_outData -> o_fjets), iLRJet, "M"); + } } }// DrawReco @@ -792,14 +805,22 @@ bool VLQ_Analysis_Data2015::Begin(){ const bool DrawSyst = (iRCJet == 0) && otherVariables; if(DrawReco){ - m_outMngrHist -> AddStandardTH1( "RCjet"+str_id+"_pt", 50, 0, 1000, ";RC jet"+str_id+" p_{T} [GeV]" , false, &(m_outData -> o_rcjets), iRCJet, "Pt"); - m_outMngrHist -> AddStandardTH1( "RCjet"+str_id+"_eta", 0.2, -3, 3, ";RC jet"+str_id+" #eta" , false, &(m_outData -> o_rcjets), iRCJet, "Eta"); - m_outMngrHist -> AddStandardTH1( "RCjet"+str_id+"_m", 10, 0, 500, ";RC jet"+str_id+" mass [GeV]" , false, &(m_outData -> o_rcjets), iRCJet, "M"); - m_outMngrHist -> AddStandardTH1( "RCjet"+str_id+"_nconsts", 1, -0.5,7.5, ";Number of RC jet"+str_id+" consts" , false, &(m_outData -> o_rcjets), iRCJet, "nconsts"); - m_outMngrHist -> AddStandardTH1( "RCjet"+str_id+"_nbconsts", 1, -0.5,7.5, ";Number of RC jet"+str_id+" b-tagged consts" , - false, &(m_outData -> o_rcjets), iRCJet, "nbconsts"); - m_outMngrHist -> AddStandardTH1( "RCjet"+str_id+"_isRCTTMass", 1, -.5, 1.5, ";Mass Tag" , false, &(m_outData -> o_rcjets), iRCJet, "isRCTTMass"); - + m_outMngrHist -> AddStandardTH1( "RCjet"+str_id+"_pt", 50, 0, 1000, ";RC jet"+str_id+" p_{T} [GeV]" , false, &(m_outData -> o_rcjets), iRCJet, "Pt"); + m_outMngrHist -> AddStandardTH1( "RCjet"+str_id+"_eta", 0.2, -3, 3, ";RC jet"+str_id+" #eta" , false, &(m_outData -> o_rcjets), iRCJet, "Eta"); + m_outMngrHist -> AddStandardTH1( "RCjet"+str_id+"_m", 10, 0, 500, ";RC jet"+str_id+" mass [GeV]" , false, &(m_outData -> o_rcjets), iRCJet, "M"); + m_outMngrHist -> AddStandardTH1( "RCjet"+str_id+"_nconsts", 1, -0.5,5.5, ";Number of RC jet"+str_id+" consts" , false, &(m_outData -> o_rcjets), iRCJet, "nconsts"); + m_outMngrHist -> AddStandardTH1( "RCjet"+str_id+"_nbconsts", 1, -0.5,5.5, ";Number of RC jet"+str_id+" b-tagged consts" , false, &(m_outData -> o_rcjets), iRCJet, "nbconsts"); + m_outMngrHist -> AddStandardTH1( "RCjet"+str_id+"_isRCTTMass", 1, -.5, 1.5, ";Mass Tag" , false, &(m_outData -> o_rcjets), iRCJet, "isRCTTMass"); + + m_outMngrHist -> AddStandardTH2( "RCjet"+str_id+"_pt", "RCjet"+str_id+"_m", 50, 0, 1200, 10, 0, 500 + , "RC jet"+str_id+" p_{T} [GeV]; RC jet"+str_id+" p_{T} [GeV]; RC jet"+str_id+" mass [GeV]", "RC jet"+str_id+" mass [GeV]" + , false, &(m_outData -> o_rcjets), &(m_outData -> o_rcjets), iRCJet, iRCJet, false, "Pt", "M" ); + m_outMngrHist -> AddStandardTH2( "RCjet"+str_id+"_pt", "RCjet"+str_id+"_nconsts", 50, 0, 1200, 1, -0.5, 5.5 + , "RC jet"+str_id+" p_{T} [GeV]; RC jet"+str_id+" p_{T} [GeV]; Number of RC jet"+str_id+" consts", "Number of RC jet"+str_id+" consts" + , false, &(m_outData -> o_rcjets), &(m_outData -> o_rcjets), iRCJet, iRCJet, false, "Pt", "nconsts" ); + m_outMngrHist -> AddStandardTH2( "RCjet"+str_id+"_pt", "RCjet"+str_id+"_nbconsts", 50, 0, 1200, 1, -0.5, 5.5 + , "RC jet"+str_id+" p_{T} [GeV]; RC jet"+str_id+" p_{T} [GeV]; Number of RC jet"+str_id+" b-tagged consts", "Number of RC jet"+str_id+" b-tagged consts" + , false, &(m_outData -> o_rcjets), &(m_outData -> o_rcjets), iRCJet, iRCJet, false, "Pt", "nbconsts" ); } // @@ -807,19 +828,71 @@ bool VLQ_Analysis_Data2015::Begin(){ // if(DrawTruth){ - m_outMngrHist -> AddStandardTH1( "RCjet"+str_id + "_pT_truth", 50.,0.,3000., ";RC jet"+str_id+" p_{T}^{truth}" - , false, &(m_outData -> o_rcjets), iRCJet, "pT_truth"); - m_outMngrHist -> AddStandardTH1( "RCjet"+str_id + "_fpT_truth", 0.1,0.,2., ";RC jet"+str_id+" p_{T}^{reco} / p_{T}^{truth}" - , false, &(m_outData -> o_rcjets), iRCJet, "fpT_reco"); - m_outMngrHist -> AddStandardTH1( "RCjet"+str_id + "_pdgId_truth", 1.,0.,30., ";RC jet"+str_id+" PDGID^{truth}" - , false, &(m_outData -> o_rcjets), iRCJet, "pdgId_truth"); - m_outMngrHist -> AddStandardTH1( "RCjet"+str_id + "_dR_truth", 0.1,0.,6., ";RC jet"+str_id+" #DeltaR^{truth}" - , false, &(m_outData -> o_rcjets), iRCJet, "dR_truth"); - m_outMngrHist -> AddStandardTH1( "RCjet"+str_id + "_nmatch_truth", 1.,0.,3., ";RC jet"+str_id+" N_{match}^{truth}" - , false, &(m_outData -> o_rcjets), iRCJet, "nmatch_truth"); + m_outMngrHist -> AddStandardTH1( "RCjet"+str_id + "_pT_truth", 50.,0.,3000., ";RC jet"+str_id+" p_{T}^{truth}" + , false, &(m_outData -> o_rcjets), iRCJet, "pT_truth"); + m_outMngrHist -> AddStandardTH1( "RCjet"+str_id + "_fpT_truth", 0.1,0.,2., ";RC jet"+str_id+" p_{T}^{reco} / p_{T}^{truth}" + , false, &(m_outData -> o_rcjets), iRCJet, "fpT_reco"); + m_outMngrHist -> AddStandardTH1( "RCjet"+str_id + "_dR_truth", 0.1,0.,6., ";RC jet"+str_id+" #DeltaR^{truth}" + , false, &(m_outData -> o_rcjets), iRCJet, "dR_truth"); + m_outMngrHist -> AddStandardTH1( "RCjet"+str_id + "_nmatch_truth", 1.,0.,3., ";RC jet"+str_id+" N_{match}^{truth}" + , false, &(m_outData -> o_rcjets), iRCJet, "nmatch_truth"); + m_outMngrHist -> AddStandardTH1( "RCjet"+str_id + "_pdgId_truth", 1.,0.,30., ";RC jet"+str_id+" PDGID^{truth}" + , false, &(m_outData -> o_rcjets), iRCJet, "pdgId_truth"); + + // m_outMngrHist -> AddStandardTH2( "RCjet"+str_id+"_pt", "RCjet"+str_id+"_pdgId_truth", 50, 0, 1000, 1, 0., 26. + // , "RC jet"+str_id+" p_{T} [GeV]; RC jet"+str_id+" p_{T} [GeV]; RC jet"+str_id+" PDGID^{truth}", "RC jet"+str_id+" PDGID^{truth}" + // , false, &(m_outData -> o_rcjets), &(m_outData -> o_rcjets), iRCJet, iRCJet, false, "Pt", "pdgId_truth" ); + // m_outMngrHist -> AddStandardTH2( "RCjet"+str_id+"_m", "RCjet"+str_id+"_pdgId_truth", 10, 0, 500, 1, 0., 26. + // , "RC jet"+str_id+" mass [GeV]; RC jet"+str_id+" mass [GeV]; RC jet"+str_id+" PDGID^{truth}", "RC jet"+str_id+" PDGID^{truth}" + // , false, &(m_outData -> o_rcjets), &(m_outData -> o_rcjets), iRCJet, iRCJet, false, "M", "pdgId_truth" ); + // m_outMngrHist -> AddStandardTH2( "RCjet"+str_id+"_nconsts", "RCjet"+str_id+"_pdgId_truth", 1, -0.5, 5.5, 1, 0., 26. + // , "Number of RC jet"+str_id+" consts; Number of RC jet"+str_id+" consts; RC jet"+str_id+" PDGID^{truth}", "RC jet"+str_id+" PDGID^{truth}" + // , false, &(m_outData -> o_rcjets), &(m_outData -> o_rcjets), iRCJet, iRCJet, false, "nconsts", "pdgId_truth" ); + // m_outMngrHist -> AddStandardTH2( "RCjet"+str_id+"_nbconsts", "RCjet"+str_id+"_pdgId_truth", 1, -0.5, 5.5, 1, 0., 26. + // , "Number of RC jet"+str_id+" b-tagged consts; Number of RC jet"+str_id+" b-tagged consts; RC jet"+str_id+" PDGID^{truth}", "RC jet"+str_id+" PDGID^{truth}" + // , false, &(m_outData -> o_rcjets), &(m_outData -> o_rcjets), iRCJet, iRCJet, false, "nbconsts", "pdgId_truth" ); } } + for ( const std::string type : m_truthRCTypes ){ + + std::string tagstring = ""; + if(type=="truthTop"){ tagstring = "top"; } + else if(type=="truthZ"){ tagstring = "Z"; } + else if(type=="truthW"){ tagstring = "W"; } + else if(type=="truthHiggs"){ tagstring = "Higgs"; } + else if(type=="truthOther"){ tagstring = "unmatched"; } + + else if(type=="truthTop_inMassWindow"){ tagstring = "top (in mass window)"; } + else if(type=="truthZ_inMassWindow"){ tagstring = "Z (in mass window)"; } + else if(type=="truthW_inMassWindow"){ tagstring = "W (in mass window)"; } + else if(type=="truthHiggs_inMassWindow"){ tagstring = "Higgs (in mass window)"; } + + for ( int iRCJet =-1; iRCJet <=0; ++iRCJet ) { + std::string str_id = ""; + str_id += std::to_string(iRCJet); + if(iRCJet==-1) str_id = "s"; + + m_outMngrHist -> AddStandardTH2( type+"_RCjet"+str_id+"_pt", type+"_RCjet"+str_id+"_m", 50, 0, 1200, 10, 0, 500 + , "truth "+tagstring+" RC jet"+str_id+" p_{T} [GeV]; truth "+tagstring+" RC jet"+str_id+" p_{T} [GeV]; truth "+tagstring+" RC jet"+str_id+" mass [GeV]", "truth "+tagstring+" RC jet"+str_id+" mass [GeV]" + , false, &(m_outData -> o_rcjets_truthmatched.at(type)), &(m_outData -> o_rcjets_truthmatched.at(type)), iRCJet, iRCJet, false, "Pt", "M" ); + m_outMngrHist -> AddStandardTH2( type+"_RCjet"+str_id+"_pt", type+"_RCjet"+str_id+"_nconsts", 50, 0, 1200, 1, -0.5, 5.5 + , "truth "+tagstring+" RC jet"+str_id+" p_{T} [GeV]; truth "+tagstring+" RC jet"+str_id+" p_{T} [GeV]; Number of truth "+tagstring+" RC jet"+str_id+" consts", "Number of truth "+tagstring+" RC jet"+str_id+" consts" + , false, &(m_outData -> o_rcjets_truthmatched.at(type)), &(m_outData -> o_rcjets_truthmatched.at(type)), iRCJet, iRCJet, false, "Pt", "nconsts" ); + m_outMngrHist -> AddStandardTH2( type+"_RCjet"+str_id+"_pt", type+"_RCjet"+str_id+"_nbconsts", 50, 0, 1200, 1, -0.5, 5.5 + , "truth "+tagstring+" RC jet"+str_id+" p_{T} [GeV]; truth "+tagstring+" RC jet"+str_id+" p_{T} [GeV]; Number of truth "+tagstring+" RC jet"+str_id+" b-tagged consts", "Number of truth "+tagstring+" RC jet"+str_id+" b-tagged consts" + , false, &(m_outData -> o_rcjets_truthmatched.at(type)), &(m_outData -> o_rcjets_truthmatched.at(type)), iRCJet, iRCJet, false, "Pt", "nbconsts" ); + + m_outMngrHist -> AddStandardTH1( type+"_RCjet"+str_id+"_pt", 50, 0, 1200, ";truth "+tagstring+" RC jet"+str_id+" p_{T} [GeV]", false, &(m_outData -> o_rcjets_truthmatched.at(type)), iRCJet, "Pt"); + m_outMngrHist -> AddStandardTH1( type+"_RCjet"+str_id+"_m", 10, 0, 500, ";truth "+tagstring+" RC jet"+str_id+" mass [GeV]", false, &(m_outData -> o_rcjets_truthmatched.at(type)), iRCJet, "M"); + m_outMngrHist -> AddStandardTH1( type+"_RCjet"+str_id+"_nconsts", 1, -0.5, 5.5, ";Number of truth "+tagstring+" RC jet"+str_id+" consts", false, &(m_outData -> o_rcjets_truthmatched.at(type)), iRCJet, "nconsts"); + m_outMngrHist -> AddStandardTH1( type+"_RCjet"+str_id+"_nbconsts", 1, -0.5, 5.5, ";Number of truth "+tagstring+" RC jet"+str_id+" b-tagged consts", false, &(m_outData -> o_rcjets_truthmatched.at(type)), iRCJet, "nbconsts"); + } + + m_outMngrHist -> AddStandardTH1( type+"_RCjets_n", 1, -0.5, 4.5, ";Number of truth "+tagstring+" RC jets" + , false, &(m_outData -> o_rcjets_truthmatched_n.at(type))); + } + for ( const std::string decayType : {"Ht", "Zt", "Wb"} ){ m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ_n", 1, -0.5, 5.5, ";Number of "+decayType+" reco VLQ", otherVariables, &(m_outData -> o_recoVLQ_n.at(decayType)) ); for ( int iTT =-1; iTT <=1; ++iTT ) { @@ -827,40 +900,40 @@ bool VLQ_Analysis_Data2015::Begin(){ str_id += std::to_string(iTT); if(iTT==-1) str_id = "s"; const bool DrawSyst = (iTT == 0) && otherVariables; - if(DrawReco){ - m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_pt", 50, 0, 2500, ";"+decayType+" reco VLQ"+str_id+" p_{T} [GeV]" , - DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "Pt" ); - m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_eta", 0.2, -3, 3, ";"+decayType+" reco VLQ"+str_id+" #eta" , - DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "Eta" ); - m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_m", 25, 0, 2500, ";"+decayType+" reco VLQ"+str_id+" mass [GeV]" , - DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "M" ); + if(DrawReco){ + m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_pt", 50, 0, 5000, ";"+decayType+" reco VLQ"+str_id+" p_{T} [GeV]" , + DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "Pt" ); + m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_eta", 0.2, -3, 3, ";"+decayType+" reco VLQ"+str_id+" #eta" , + DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "Eta" ); + m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_m", 25, 0, 5000, ";"+decayType+" reco VLQ"+str_id+" mass [GeV]" , + true, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "M" ); m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_m1", 10, 0, 500, ";"+decayType+" reco VLQ"+str_id+" m_{1} [GeV]" , DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "m1" ); m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_m2", 10, 0, 500, ";"+decayType+" reco VLQ"+str_id+" m_{2} [GeV]" , DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "m2" ); - m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_redm", 25, 0, 2500, ";"+decayType+" reco VLQ"+str_id+" reduced mass [GeV]" , - DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "redM" ); - m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_dR12", 0.1, 0, 6, ";"+decayType+" reco VLQ"+str_id+" #DeltaR(1,2)" , - DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "dR12" ); - m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_dPhi12", 0.1, 0, 4, ";"+decayType+" reco VLQ"+str_id+" #Delta#phi(1,2)" , - DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "dPhi12" ); - m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_dEta12", 0.1, 0, 6, ";"+decayType+" reco VLQ"+str_id+" #Delta#eta(1,2)" , - DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "dEta12" ); - m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_fpT12", 0.1, 0., 10., ";"+decayType+" reco VLQ"+str_id+" fpT(1,2)" , - DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "fpT12" ); - } - - if(DrawTruth){ - m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ"+str_id + "_pT_truth", 50.,0.,2500., "; "+decayType+" reco VLQ"+str_id+" p_{T}^{truth}" - , false, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "pT_truth"); - m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ"+str_id + "_fpT_truth", 0.1,0.,2., "; "+decayType+" reco VLQ"+str_id+" p_{T}^{reco} / p_{T}^{truth}" - , false, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "fpT_reco"); - m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ"+str_id + "_dR_truth", 0.1,0.,6., "; "+decayType+" reco VLQ"+str_id+" #DeltaR^{truth}" - , false, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "dR_truth"); - m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ"+str_id + "_nmatch_truth", 1.,0.,3., "; "+decayType+" reco VLQ"+str_id+" N_{match}^{truth}" - , false, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "nmatch_truth"); - - } + m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_redm", 25, 0, 4000, ";"+decayType+" reco VLQ"+str_id+" reduced mass [GeV]" , + true, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "redM" ); + m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_dR12", 0.1, 0, 6, ";"+decayType+" reco VLQ"+str_id+" #DeltaR(1,2)" , + DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "dR12" ); + m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_dPhi12", 0.1, 0, 4, ";"+decayType+" reco VLQ"+str_id+" #Delta#phi(1,2)" , + DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "dPhi12" ); + m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_dEta12", 0.1, 0, 6, ";"+decayType+" reco VLQ"+str_id+" #Delta#eta(1,2)" , + DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "dEta12" ); + m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ" + str_id + "_fpT12", 0.1, 0., 10., ";"+decayType+" reco VLQ"+str_id+" fpT(1,2)" , + DrawSyst, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "fpT12" ); + } + + if(DrawTruth){ + m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ"+str_id + "_pT_truth", 50.,0.,3000., "; "+decayType+" reco VLQ"+str_id+" p_{T}^{truth}" + , false, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "pT_truth"); + m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ"+str_id + "_fpT_truth", 0.1,0.,2., "; "+decayType+" reco VLQ"+str_id+" p_{T}^{reco} / p_{T}^{truth}" + , false, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "fpT_reco"); + m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ"+str_id + "_dR_truth", 0.1,0.,6., "; "+decayType+" reco VLQ"+str_id+" #DeltaR^{truth}" + , false, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "dR_truth"); + m_outMngrHist -> AddStandardTH1( decayType + "_recoVLQ"+str_id + "_nmatch_truth", 1.,0.,3., "; "+decayType+" reco VLQ"+str_id+" N_{match}^{truth}" + , false, &(m_outData -> o_recoVLQ.at(decayType)), iTT, "nmatch_truth"); + + } }//index loop @@ -875,11 +948,11 @@ bool VLQ_Analysis_Data2015::Begin(){ m_outMngrHist -> AddStandardTH1( "leptop_pT_truth", 50, 0, 2500, ";Leptonic top p_{T}^{truth} [GeV]" , false, &(m_outData -> o_leptop), -1, "pT_truth"); m_outMngrHist -> AddStandardTH1( "leptop_fpT_truth", 0.1, 0., 2., ";Leptonic top p_{T}^{reco}/p_{T}^{truth}" - , false, &(m_outData -> o_leptop), -1, "fpT_truth"); + , false, &(m_outData -> o_leptop), -1, "fpT_truth"); m_outMngrHist -> AddStandardTH1( "leptop_dR_truth", 0.1, 0., 6., ";Leptonic top #DeltaR^{truth}" - , false, &(m_outData -> o_leptop), -1, "dR_truth"); + , false, &(m_outData -> o_leptop), -1, "dR_truth"); m_outMngrHist -> AddStandardTH1( "leptop_nmatch_truth", 1, 0, 2, ";Leptonic top isTruthMatched" - , false, &(m_outData -> o_leptop), -1, "nmatch_truth"); + , false, &(m_outData -> o_leptop), -1, "nmatch_truth"); m_outMngrHist -> AddStandardTH2( "leptop_pT_truth", "leptop_fpT_truth" ,50, 0, 2500, 0.1, 0., 2. @@ -894,11 +967,11 @@ bool VLQ_Analysis_Data2015::Begin(){ m_outMngrHist -> AddStandardTH1( "lepW_pT_truth", 50, 0, 2500, ";Leptonic W p_{T}^{truth} [GeV]" , false, &(m_outData -> o_lepW), -1, "pT_truth"); m_outMngrHist -> AddStandardTH1( "lepW_fpT_truth", 0.1, 0., 2., ";Leptonic W p_{T}^{reco}/p_{T}^{truth}" - , false, &(m_outData -> o_lepW), -1, "fpT_truth"); + , false, &(m_outData -> o_lepW), -1, "fpT_truth"); m_outMngrHist -> AddStandardTH1( "lepW_dR_truth", 0.1, 0., 6., ";Leptonic W #DeltaR^{truth}" - , false, &(m_outData -> o_lepW), -1, "dR_truth"); + , false, &(m_outData -> o_lepW), -1, "dR_truth"); m_outMngrHist -> AddStandardTH1( "lepW_nmatch_truth", 1, 0, 2, ";Leptonic W isTruthMatched" - , false, &(m_outData -> o_lepW), -1, "nmatch_truth"); + , false, &(m_outData -> o_lepW), -1, "nmatch_truth"); m_outMngrHist -> AddStandardTH2( "lepW_pT_truth", "lepW_fpT_truth" @@ -932,58 +1005,69 @@ bool VLQ_Analysis_Data2015::Begin(){ else if(type=="RCMV1bin"){ tagstring = "W/Z-tagged (#geq1b)"; } if(DrawReco){ - m_outMngrHist -> AddStandardTH1( type + "_jets_n", 1, -0.5, 5.5, ";Number of "+tagstring+" jets", otherVariables, &(m_outData -> o_taggedjets_n.at(type)) ); - m_outMngrHist -> AddStandardTH1( type + "_leptop_dRmin",0.1, 0, 6.,";#DeltaR_{min}(Leptonic top, RC-tagged jet)", - false, &(m_outData -> o_leptop), -1, "dRmin_"+type, hopt_nouflow); - m_outMngrHist -> AddStandardTH1( type + "_leptop_b_dRmin",0.1, 0, 6.,";#DeltaR_{min}(Leptonic top-b, RC-tagged jet)", - false, &(m_outData -> o_leptop), -1, "dRmin_b_"+type, hopt_nouflow); + m_outMngrHist -> AddStandardTH1( type + "_jets_n", 1, -0.5, 5.5, ";Number of "+tagstring+" jets", otherVariables, &(m_outData -> o_taggedjets_n.at(type)) ); + m_outMngrHist -> AddStandardTH1( type + "_leptop_dRmin",0.1, 0, 6.,";#DeltaR_{min}(Leptonic top, RC-tagged jet)", + false, &(m_outData -> o_leptop), -1, "dRmin_"+type, hopt_nouflow); + m_outMngrHist -> AddStandardTH1( type + "_leptop_b_dRmin",0.1, 0, 6.,";#DeltaR_{min}(Leptonic top-b, RC-tagged jet)", + false, &(m_outData -> o_leptop), -1, "dRmin_b_"+type, hopt_nouflow); } for ( int iTT =-1; iTT <=0; ++iTT ) { std::string str_id = ""; str_id += std::to_string(iTT); if(iTT==-1) str_id = "s"; const bool DrawSyst = (iTT == 0) && otherVariables; - if(DrawReco){ - m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_pt", 50, 0, 1000, ";"+tagstring+" jet"+str_id+" p_{T} [GeV]" , - DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "Pt" ); - m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_eta", 0.2, -3, 3, ";"+tagstring+" jet"+str_id+" #eta" , - DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "Eta" ); - m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_m", 10, 0, 500, ";"+tagstring+" jet"+str_id+" mass [GeV]" , - DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "M" ); - m_outMngrHist -> AddStandardTH1( type + "_jet" +str_id+ "_bconsts_n", 1, -0.5, 5.5, ";"+tagstring+" jet"+str_id+" N_{subjets}^{b-tagged}", - DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "nbconsts" ); - if(type=="RCTTMass" || type=="LooseRCTTMass"){ - m_outMngrHist -> AddStandardTH1( type + "_jet" +str_id+ "_consts_n", 1, -0.5, 5.5, ";"+tagstring+" jet"+str_id+" N_{subjets}", - DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "nconsts" ); - } - m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_dR_lep", 0.1, 0., 6., "; #DeltaR("+tagstring+" jet"+str_id+", lep)" , - DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "dR_lep", hopt_nouflow ); - m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_dPhi_lep", 0.1, 0., 3., "; #Delta#Phi("+tagstring+" jet"+str_id+", lep)" , - DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "dPhi_lep", hopt_nouflow ); - m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_dPhi_met", 0.1, 0., 3., "; #Delta#Phi("+tagstring+" jet"+str_id+", met)" , - DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "dPhi_met", hopt_nouflow ); - m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_dPhi_leptop", 0.1, 0., 3., "; #Delta#Phi("+tagstring+" jet"+str_id+", leptop)" , - DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "dPhi_leptop", hopt_nouflow ); - m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_dR_leptop", 0.1, 0., 6., "; #DeltaR("+tagstring+" jet"+str_id+", leptop)" , - DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "dR_leptop", hopt_nouflow ); - - }//DrawReco - - // - // For truth-match studies - // - if(DrawTruth){ - m_outMngrHist -> AddStandardTH1( type + "_jet"+str_id + "_pT_truth", 50.,0.,3000., "; "+tagstring+" jet"+str_id+" p_{T}^{truth}" - , false, &(m_outData -> o_taggedjets.at(type)), iTT, "pT_truth"); - m_outMngrHist -> AddStandardTH1( type + "_jet"+str_id + "_fpT_truth", 0.1,0.,2., "; "+tagstring+" jet"+str_id+" p_{T}^{reco} / p_{T}^{truth}" - , false, &(m_outData -> o_taggedjets.at(type)), iTT, "fpT_truth"); - m_outMngrHist -> AddStandardTH1( type + "_jet"+str_id + "_pdgId_truth", 1.,0.,30., "; "+tagstring+" jet"+str_id+" PDGID^{truth}" - , false, &(m_outData -> o_taggedjets.at(type)), iTT, "pdgId_truth"); - m_outMngrHist -> AddStandardTH1( type + "_jet"+str_id + "_dR_truth", 0.1,0.,6., "; "+tagstring+" jet"+str_id+" #DeltaR^{truth}" - , false, &(m_outData -> o_taggedjets.at(type)), iTT, "dR_truth"); - m_outMngrHist -> AddStandardTH1( type + "_jet"+str_id + "_nmatch_truth", 1.,0.,3., "; "+tagstring+" jet"+str_id+" N_{match}^{truth}" - , false, &(m_outData -> o_taggedjets.at(type)), iTT, "nmatch_truth"); - } + if(DrawReco){ + m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_pt", 50, 0, 1000, ";"+tagstring+" jet"+str_id+" p_{T} [GeV]" , + DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "Pt" ); + m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_eta", 0.2, -3, 3, ";"+tagstring+" jet"+str_id+" #eta" , + DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "Eta" ); + m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_m", 10, 0, 500, ";"+tagstring+" jet"+str_id+" mass [GeV]" , + DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "M" ); + m_outMngrHist -> AddStandardTH1( type + "_jet" +str_id+ "_bconsts_n", 1, -0.5, 5.5, ";"+tagstring+" jet"+str_id+" N_{subjets}^{b-tagged}", + DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "nbconsts" ); + if(type=="RCTTMass" || type=="LooseRCTTMass"){ + m_outMngrHist -> AddStandardTH1( type + "_jet" +str_id+ "_consts_n", 1, -0.5, 5.5, ";"+tagstring+" jet"+str_id+" N_{subjets}", + DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "nconsts" ); + } + m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_dR_lep", 0.1, 0., 6., "; #DeltaR("+tagstring+" jet"+str_id+", lep)" , + DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "dR_lep", hopt_nouflow ); + m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_dPhi_lep", 0.1, 0., 3., "; #Delta#Phi("+tagstring+" jet"+str_id+", lep)" , + DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "dPhi_lep", hopt_nouflow ); + m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_dPhi_met", 0.1, 0., 3., "; #Delta#Phi("+tagstring+" jet"+str_id+", met)" , + DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "dPhi_met", hopt_nouflow ); + m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_dPhi_leptop", 0.1, 0., 3., "; #Delta#Phi("+tagstring+" jet"+str_id+", leptop)" , + DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "dPhi_leptop", hopt_nouflow ); + m_outMngrHist -> AddStandardTH1( type + "_jet" + str_id + "_dR_leptop", 0.1, 0., 6., "; #DeltaR("+tagstring+" jet"+str_id+", leptop)" , + DrawSyst, &(m_outData -> o_taggedjets.at(type)), iTT, "dR_leptop", hopt_nouflow ); + + // 2D variables for boosted object tagging optimization studies + m_outMngrHist -> AddStandardTH2( type + "_jet" + str_id + "_pt", type + "_jet" + str_id + "_m", 50, 0, 1200, 10, 0, 500 + , tagstring+" jet"+str_id+" p_{T} [GeV]; "+tagstring+" jet"+str_id+" p_{T} [GeV]; "+tagstring+" jet"+str_id+" mass [GeV]", tagstring+" jet"+str_id+" mass [GeV]" + , false, &(m_outData -> o_taggedjets.at(type)), &(m_outData -> o_taggedjets.at(type)), iTT, iTT, false, "Pt", "M" ); + m_outMngrHist -> AddStandardTH2( type + "_jet" + str_id + "_pt", type + "_jet" + str_id + "_nconsts", 50, 0, 1200, 1, -0.5, 5.5 + , tagstring+" jet"+str_id+" p_{T} [GeV]; "+tagstring+" jet"+str_id+" p_{T} [GeV]; Number of "+tagstring+" jet"+str_id+" consts", "Number of "+tagstring+" jet"+str_id+" consts" + , false, &(m_outData -> o_taggedjets.at(type)), &(m_outData -> o_taggedjets.at(type)), iTT, iTT, false, "Pt", "nconsts" ); + m_outMngrHist -> AddStandardTH2( type + "_jet" + str_id + "_pt", type + "_jet" + str_id + "_nbconsts", 50, 0, 1200, 1, -0.5, 5.5 + , tagstring+" jet"+str_id+" p_{T} [GeV]; "+tagstring+" jet"+str_id+" p_{T} [GeV]; Number of "+tagstring+" jet"+str_id+" b-tagged consts", "Number of "+tagstring+" jet"+str_id+" b-tagged consts" + , false, &(m_outData -> o_taggedjets.at(type)), &(m_outData -> o_taggedjets.at(type)), iTT, iTT, false, "Pt", "nbconsts" ); + + }//DrawReco + + // + // For truth-match studies + // + if(DrawTruth){ + m_outMngrHist -> AddStandardTH1( type + "_jet"+str_id + "_pT_truth", 50.,0.,3000., "; "+tagstring+" jet"+str_id+" p_{T}^{truth}" + , false, &(m_outData -> o_taggedjets.at(type)), iTT, "pT_truth"); + m_outMngrHist -> AddStandardTH1( type + "_jet"+str_id + "_fpT_truth", 0.1,0.,2., "; "+tagstring+" jet"+str_id+" p_{T}^{reco} / p_{T}^{truth}" + , false, &(m_outData -> o_taggedjets.at(type)), iTT, "fpT_truth"); + m_outMngrHist -> AddStandardTH1( type + "_jet"+str_id + "_dR_truth", 0.1,0.,6., "; "+tagstring+" jet"+str_id+" #DeltaR^{truth}" + , false, &(m_outData -> o_taggedjets.at(type)), iTT, "dR_truth"); + m_outMngrHist -> AddStandardTH1( type + "_jet"+str_id + "_nmatch_truth", 1.,0.,3., "; "+tagstring+" jet"+str_id+" N_{match}^{truth}" + , false, &(m_outData -> o_taggedjets.at(type)), iTT, "nmatch_truth"); + m_outMngrHist -> AddStandardTH1( type + "_jet"+str_id + "_pdgId_truth", 1.,0.,26., "; "+tagstring+" jet"+str_id+" PDGID^{truth}" + , false, &(m_outData -> o_taggedjets.at(type)), iTT, "pdgId_truth"); + } }//index loop } @@ -1037,15 +1121,15 @@ bool VLQ_Analysis_Data2015::Begin(){ if(DrawReco){ m_outMngrHist -> AddStandardTH1( "lep_n", 1, -0.5, 5.5, ";Number of signal leptons", false, &(m_outData -> o_lep_n) ); for ( int iLep=-1; iLep<=0; ++iLep ) { - std::string str_id = ""; - str_id += std::to_string(iLep); - if(iLep==-1) str_id = "s"; - m_outMngrHist -> AddStandardTH1( "lep"+str_id+"_pt", 50, 0, 800, ";Lepton p_{T} [GeV]" , otherVariables, &(m_outData -> o_lep), iLep, "Pt" ); - m_outMngrHist -> AddStandardTH1( "lep"+str_id+"_pt_zoom", 20, 10, 500, ";Lepton p_{T} [GeV]" , otherVariables, &(m_outData -> o_lep), iLep, "Pt" ); - m_outMngrHist -> AddStandardTH1( "lep"+str_id+"_eta", 0.2, -3, 3, ";Lepton #eta" , otherVariables, &(m_outData -> o_lep), iLep, "Eta" ); - m_outMngrHist -> AddStandardTH1( "lep"+str_id+"_phi", 0.2, -4, 4, ";Lepton #phi" , false, &(m_outData -> o_lep), iLep, "Phi" ); - m_outMngrHist -> AddStandardTH1( "lep"+str_id+"_d0sig", 0.1, 0, 5, ";Lepton d_{0}^{sig}" , false, &(m_outData -> o_lep), iLep, "d0sig" ); - m_outMngrHist -> AddStandardTH1( "lep"+str_id+"_z0", 0.025, -0.5, 0.5, ";Lepton z_{0} [mm]" , false, &(m_outData -> o_lep), iLep, "z0" ); + std::string str_id = ""; + str_id += std::to_string(iLep); + if(iLep==-1) str_id = "s"; + m_outMngrHist -> AddStandardTH1( "lep"+str_id+"_pt", 50, 0, 800, ";Lepton p_{T} [GeV]" , otherVariables, &(m_outData -> o_lep), iLep, "Pt" ); + m_outMngrHist -> AddStandardTH1( "lep"+str_id+"_pt_zoom", 20, 10, 500, ";Lepton p_{T} [GeV]" , otherVariables, &(m_outData -> o_lep), iLep, "Pt" ); + m_outMngrHist -> AddStandardTH1( "lep"+str_id+"_eta", 0.2, -3, 3, ";Lepton #eta" , otherVariables, &(m_outData -> o_lep), iLep, "Eta" ); + m_outMngrHist -> AddStandardTH1( "lep"+str_id+"_phi", 0.2, -4, 4, ";Lepton #phi" , false, &(m_outData -> o_lep), iLep, "Phi" ); + m_outMngrHist -> AddStandardTH1( "lep"+str_id+"_d0sig", 0.1, 0, 5, ";Lepton d_{0}^{sig}" , false, &(m_outData -> o_lep), iLep, "d0sig" ); + m_outMngrHist -> AddStandardTH1( "lep"+str_id+"_z0", 0.025, -0.5, 0.5, ";Lepton z_{0} [mm]" , false, &(m_outData -> o_lep), iLep, "z0" ); } //Kinematic variables @@ -1082,15 +1166,15 @@ bool VLQ_Analysis_Data2015::Begin(){ m_outMngrHist->AddStandardTH1("dRaverage_jetjet", 0.25,0,5 ,";#DeltaR_{ave.}(jet,jet)", false, &(m_outData -> o_dRaverage_jetjet) ); if(m_opt->DoLowBRegions()){ - m_outMngrHist -> AddStandardTH1( "mtbmin_lowb_3b", 50, 0, 500, ";m_{T}^{min}(b,MET) (LowB_3b)", false, &(m_outData->o_mTbmin_lowb_3b) ); - m_outMngrHist -> AddStandardTH1( "mtbmin_lowb_3b_zoom", 25, 0, 250, ";m_{T}^{min}(b,MET) (LowB_3b)", otherVariables, &(m_outData->o_mTbmin_lowb_3b) ); - m_outMngrHist -> AddStandardTH1( "mbb_mindR_lowb_3b", 10,0,300, ";m_{bb}^{#DeltaR min} (LowB_3b) [GeV]", otherVariables, &(m_outData -> o_mbb_mindR_lowb_3b) ); - m_outMngrHist -> AddStandardTH1( "dR_bjetbjet_lowb_3b", 0.25,0,5, ";#DeltaR_{min}(b-jet,b-jet) (LowB_3b)", false, &(m_outData -> o_dRmin_bjetbjet_lowb_3b) ); - //--- - m_outMngrHist -> AddStandardTH1( "mtbmin_lowb_4b", 50, 0, 500, ";m_{T}^{min}(b,MET) (LowB_4b)", false, &(m_outData->o_mTbmin_lowb_4b) ); - m_outMngrHist -> AddStandardTH1( "mtbmin_lowb_4b_zoom", 25, 0, 250, ";m_{T}^{min}(b,MET) (LowB_4b)", otherVariables, &(m_outData->o_mTbmin_lowb_4b) ); - m_outMngrHist -> AddStandardTH1( "mbb_mindR_lowb_4b", 10,0,300, ";m_{bb}^{#DeltaR min} (LowB_4b) [GeV]", otherVariables, &(m_outData -> o_mbb_mindR_lowb_4b) ); - m_outMngrHist -> AddStandardTH1( "dR_bjetbjet_lowb_4b", 0.25,0,5, ";#DeltaR_{min}(b-jet,b-jet) (LowB_4b)", false, &(m_outData -> o_dRmin_bjetbjet_lowb_4b) ); + m_outMngrHist -> AddStandardTH1( "mtbmin_lowb_3b", 50, 0, 500, ";m_{T}^{min}(b,MET) (LowB_3b)", false, &(m_outData->o_mTbmin_lowb_3b) ); + m_outMngrHist -> AddStandardTH1( "mtbmin_lowb_3b_zoom", 25, 0, 250, ";m_{T}^{min}(b,MET) (LowB_3b)", otherVariables, &(m_outData->o_mTbmin_lowb_3b) ); + m_outMngrHist -> AddStandardTH1( "mbb_mindR_lowb_3b", 10,0,300, ";m_{bb}^{#DeltaR min} (LowB_3b) [GeV]", otherVariables, &(m_outData -> o_mbb_mindR_lowb_3b) ); + m_outMngrHist -> AddStandardTH1( "dR_bjetbjet_lowb_3b", 0.25,0,5, ";#DeltaR_{min}(b-jet,b-jet) (LowB_3b)", false, &(m_outData -> o_dRmin_bjetbjet_lowb_3b) ); + //--- + m_outMngrHist -> AddStandardTH1( "mtbmin_lowb_4b", 50, 0, 500, ";m_{T}^{min}(b,MET) (LowB_4b)", false, &(m_outData->o_mTbmin_lowb_4b) ); + m_outMngrHist -> AddStandardTH1( "mtbmin_lowb_4b_zoom", 25, 0, 250, ";m_{T}^{min}(b,MET) (LowB_4b)", otherVariables, &(m_outData->o_mTbmin_lowb_4b) ); + m_outMngrHist -> AddStandardTH1( "mbb_mindR_lowb_4b", 10,0,300, ";m_{bb}^{#DeltaR min} (LowB_4b) [GeV]", otherVariables, &(m_outData -> o_mbb_mindR_lowb_4b) ); + m_outMngrHist -> AddStandardTH1( "dR_bjetbjet_lowb_4b", 0.25,0,5, ";#DeltaR_{min}(b-jet,b-jet) (LowB_4b)", false, &(m_outData -> o_dRmin_bjetbjet_lowb_4b) ); } }//DrawReco @@ -1100,25 +1184,25 @@ bool VLQ_Analysis_Data2015::Begin(){ std::vector<std::string> truthTypes = {}; if(m_opt -> SampleName() == SampleName::VLQ ){ - truthTypes = { - "VLQ", "VLQ_Ht", "VLQ_Zt", "VLQ_Wb", - "VLQ_Hbdect", "VLQ_Wlepb", "VLQ_Whadb", "VLQ_Zhadt", - "b1", "b2", - "H", "Hbb", "H_b1", "H_b2", - "hadtop", "hadtop_b", "hadtop_W", "hadtop_q1", "hadtop_q2", - "leptop", "leptop_b", "leptop_W", "leptop_lep", "leptop_nu", - "hadZ", "hadZ_q1", "hadZ_q2", - "lepZ", "lepZ_lep1", "lepZ_lep2", - "invZ", - "hadW", "hadW_q1", "hadW_q2", - "lepW", "lepW_lep", "lepW_nu" - }; + truthTypes = { + "VLQ", "VLQ_Ht", "VLQ_Zt", "VLQ_Wb", + "VLQ_Hbdect", "VLQ_Wlepb", "VLQ_Whadb", "VLQ_Zhadt", + "b1", "b2", + "H", "Hbb", "H_b1", "H_b2", + "hadtop", "hadtop_b", "hadtop_W", "hadtop_q1", "hadtop_q2", + "leptop", "leptop_b", "leptop_W", "leptop_lep", "leptop_nu", + "hadZ", "hadZ_q1", "hadZ_q2", + "lepZ", "lepZ_lep1", "lepZ_lep2", + "invZ", + "hadW", "hadW_q1", "hadW_q2", + "lepW", "lepW_lep", "lepW_nu" + }; } else if( m_outData -> o_is_ttbar ){ - truthTypes = { - "hadtop", "hadtop_b", "hadtop_W", "hadtop_q1", "hadtop_q2", - "leptop", "leptop_b", "leptop_W", "leptop_lep", "leptop_nu" - }; + truthTypes = { + "hadtop", "hadtop_b", "hadtop_W", "hadtop_q1", "hadtop_q2", + "leptop", "leptop_b", "leptop_W", "leptop_lep", "leptop_nu" + }; } @@ -1281,21 +1365,21 @@ bool VLQ_Analysis_Data2015::Begin(){ }//Type of truth m_outMngrHist -> AddStandardTH1( "truth_dRmin_bb", 0.25,0,5, "; truth #DeltaR_min(b,b)" - , false, &(m_outData -> o_truth_dRmin_bb), -1, ""/*, hopt_nouflow*/ ); + , false, &(m_outData -> o_truth_dRmin_bb), -1, ""/*, hopt_nouflow*/ ); m_outMngrHist -> AddStandardTH1( "truth_minv_bb", 10.,0,1000., "; truth m_{inv}(b,b) [GeV]" - , false, &(m_outData -> o_truth_minv_bb) ); + , false, &(m_outData -> o_truth_minv_bb) ); m_outMngrHist -> AddStandardTH1( "truth_dPhiMin_lepmet", 0.1,0,4, "; truth #Delta#phi(lep,MET)" - , false, &(m_outData -> o_truth_dPhiMin_lepmet), -1, ""/*, hopt_nouflow*/ ); + , false, &(m_outData -> o_truth_dPhiMin_lepmet), -1, ""/*, hopt_nouflow*/ ); m_outMngrHist -> AddStandardTH1( "truth_dPhiMin_jetmet", 0.1,0,4, "; truth #Delta#phi_min(jet,MET)" - , false, &(m_outData -> o_truth_dPhiMin_jetmet), -1, ""/*, hopt_nouflow*/ ); + , false, &(m_outData -> o_truth_dPhiMin_jetmet), -1, ""/*, hopt_nouflow*/ ); m_outMngrHist -> AddStandardTH1( "truth_partonMET", 25.,0,2000., "; truth (ME) E_{T}^{miss} [GeV]" - , false, &(m_outData -> o_truth_partonMET), -1, "Pt"/*, hopt_nouflow*/ ); + , false, &(m_outData -> o_truth_partonMET), -1, "Pt"/*, hopt_nouflow*/ ); m_outMngrHist -> AddStandardTH1( "truth_mtw", 25.,0,3000., "; truth m_{T}^{W} [GeV]" - , false, &(m_outData -> o_truth_mtw), -1, ""/*, hopt_nouflow*/ ); + , false, &(m_outData -> o_truth_mtw), -1, ""/*, hopt_nouflow*/ ); m_outMngrHist -> AddStandardTH1( "truth_ptw", 25.,0,5000., "; truth p_{T}^{W} [GeV]" - , false, &(m_outData -> o_truth_ptw), -1, ""/*, hopt_nouflow*/ ); + , false, &(m_outData -> o_truth_ptw), -1, ""/*, hopt_nouflow*/ ); m_outMngrHist -> AddStandardTH1( "truth_mtbmin", 10.,0,1000., "; truth m_{T,b}^{min} [GeV]" - , false, &(m_outData -> o_truth_mtbmin), -1, ""/*, hopt_nouflow*/ ); + , false, &(m_outData -> o_truth_mtbmin), -1, ""/*, hopt_nouflow*/ ); /* //TH2 m_outMngrHist -> AddStandardTH2( "top_pt", "dR_Wb", 20, 0, 800, 0.1, 0., 5.,"Top p_{T} [GeV]", "#DeltaR(W,b)", false, &(m_outData -> o_truth_top_pt), &(m_outData -> o_truth_dR_Wb) ); @@ -1485,13 +1569,13 @@ bool VLQ_Analysis_Data2015::Process(Long64_t entry) if( m_opt -> FilterType() == VLQ_Options::APPLYFILTER ){ if( m_opt -> StrSampleID().find("410470.") != std::string::npos ){ - if( ht_truth > 600 ) return false; + if( ht_truth > 600 ) return false; } else if( m_opt -> StrSampleID().find("407344.") != std::string::npos ){ - if( ht_truth < 600 || ht_truth > 1000 ) return false; + if( ht_truth < 600 || ht_truth > 1000 ) return false; } else if( m_opt -> StrSampleID().find("407343.") != std::string::npos ){ - if( ht_truth < 1000 || ht_truth > 1500 ) return false; + if( ht_truth < 1000 || ht_truth > 1500 ) return false; } else if( m_opt -> StrSampleID().find("407342.") != std::string::npos ){ - if( ht_truth < 1500 ) return false; + if( ht_truth < 1500 ) return false; } }//filter @@ -1720,7 +1804,7 @@ bool VLQ_Analysis_Data2015::Process(Long64_t entry) //########################################################### if( ( m_outData-> o_channel_type == VLQ_Enums::ELECTRON || m_outData-> o_channel_type == VLQ_Enums::MUON ) && ( (m_outData -> o_AO_met->Pt() < m_opt->MinMetCutOneLep()) - || (m_opt->MaxMetCutOneLep() > 0. && m_outData -> o_AO_met->Pt() > m_opt->MaxMetCutOneLep()) ) ){ + || (m_opt->MaxMetCutOneLep() > 0. && m_outData -> o_AO_met->Pt() > m_opt->MaxMetCutOneLep()) ) ){ m_outData -> o_rejectEvent |= 1 << VLQ_Enums::METONELEP_REJECTED; } @@ -1731,7 +1815,7 @@ bool VLQ_Analysis_Data2015::Process(Long64_t entry) //########################################################### if( (m_outData-> o_channel_type == VLQ_Enums::FULLHAD) && ( (m_outData -> o_AO_met->Pt() < m_opt->MinMetCutZeroLep()) - || (m_opt->MaxMetCutZeroLep() > 0. && m_outData -> o_AO_met->Pt() > m_opt->MaxMetCutZeroLep()) ) ){ + || (m_opt->MaxMetCutZeroLep() > 0. && m_outData -> o_AO_met->Pt() > m_opt->MaxMetCutZeroLep()) ) ){ m_outData -> o_rejectEvent |= 1 << VLQ_Enums::METZEROLEP_REJECTED; } @@ -1791,27 +1875,74 @@ bool VLQ_Analysis_Data2015::Process(Long64_t entry) if( m_outData -> o_is_ttbar ){ heavy_list = {"leptop", "hadtop", "hadtop_W"}; } for( const std::string & restype : heavy_list ){ - AOVector* rescol = (m_outData -> o_truth_partons).at(restype); - if(!rescol){ - std::cerr << " WARNING => VLQ_Analysis_Data2015 : could not find parton collection " << restype << std::endl; - continue; - } - for( AnalysisObject* parton : *rescol ){ - m_truthMngr -> MatchPartonToFatJets(*(m_outData -> o_rcjets), parton, 0.75 /*maxDR*/, true /*rcCollection*/, true /*containment*/, 1.0 /*drcontained*/, true /*checkPt*/); - }//each parton in collection + AOVector* rescol = (m_outData -> o_truth_partons).at(restype); + if(!rescol){ + std::cerr << " WARNING => VLQ_Analysis_Data2015 : could not find parton collection " << restype << std::endl; + continue; + } + for( AnalysisObject* parton : *rescol ){ + m_truthMngr -> MatchPartonToFatJets(*(m_outData -> o_rcjets), parton, 0.75 /*maxDR*/, true /*rcCollection*/, false /*tagCollection*/, true /*containment*/, 1.0 /*drcontained*/, true /*checkPt*/); + + //===== Fill truth matched RC jets map ===== + for( AnalysisObject* rcjet : *(m_outData -> o_rcjets) ){ + + bool isTop = rcjet->M() > 140; + bool isHiggs = rcjet->M() > 105 && rcjet->M() < 140; + bool isV = rcjet->M() > 70 && rcjet->M() < 105; + + if( rcjet -> GetMoment("pdgId_truth") == 6 ){ + m_outData -> o_rcjets_truthmatched.at("truthTop") -> push_back(rcjet); + if( isTop ){ + m_outData -> o_rcjets_truthmatched.at("truthTop_inMassWindow") -> push_back(rcjet); + } + } + if( rcjet -> GetMoment("pdgId_truth") == 23 ){ + m_outData -> o_rcjets_truthmatched.at("truthZ") -> push_back(rcjet); + if( isV ){ + m_outData -> o_rcjets_truthmatched.at("truthZ_inMassWindow") -> push_back(rcjet); + } + } + if( rcjet -> GetMoment("pdgId_truth") == 24 ){ + m_outData -> o_rcjets_truthmatched.at("truthW") -> push_back(rcjet); + if( isV ){ + m_outData -> o_rcjets_truthmatched.at("truthW_inMassWindow") -> push_back(rcjet); + } + } + if( rcjet -> GetMoment("pdgId_truth") == 25 ){ + m_outData -> o_rcjets_truthmatched.at("truthHiggs") -> push_back(rcjet); + if( isHiggs ){ + m_outData -> o_rcjets_truthmatched.at("truthHiggs_inMassWindow") -> push_back(rcjet); + } + } + if( rcjet -> GetMoment("pdgId_truth") == 0 ){ + m_outData -> o_rcjets_truthmatched.at("truthOther") -> push_back(rcjet); + } + } + m_outData -> o_rcjets_truthmatched_n.at("truthTop") = m_outData -> o_rcjets_truthmatched.at("truthTop") -> size(); + m_outData -> o_rcjets_truthmatched_n.at("truthZ") = m_outData -> o_rcjets_truthmatched.at("truthZ") -> size(); + m_outData -> o_rcjets_truthmatched_n.at("truthW") = m_outData -> o_rcjets_truthmatched.at("truthW") -> size(); + m_outData -> o_rcjets_truthmatched_n.at("truthHiggs") = m_outData -> o_rcjets_truthmatched.at("truthHiggs") -> size(); + m_outData -> o_rcjets_truthmatched_n.at("truthOther") = m_outData -> o_rcjets_truthmatched.at("truthOther") -> size(); + + m_outData -> o_rcjets_truthmatched_n.at("truthTop_inMassWindow") = m_outData -> o_rcjets_truthmatched.at("truthTop_inMassWindow") -> size(); + m_outData -> o_rcjets_truthmatched_n.at("truthZ_inMassWindow") = m_outData -> o_rcjets_truthmatched.at("truthZ_inMassWindow") -> size(); + m_outData -> o_rcjets_truthmatched_n.at("truthW_inMassWindow") = m_outData -> o_rcjets_truthmatched.at("truthW_inMassWindow") -> size(); + m_outData -> o_rcjets_truthmatched_n.at("truthHiggs_inMassWindow") = m_outData -> o_rcjets_truthmatched.at("truthHiggs_inMassWindow") -> size(); + + }//each parton in collection }//each collection of heavy resonance if( m_opt -> SampleName() == SampleName::VLQ ){ - for ( const std::string decayType : {"Ht", "Zt", "Wb"} ){ + for ( const std::string decayType : {"Ht", "Zt", "Wb"} ){ - AOVector& recoVLQCollection = *(m_outData -> o_recoVLQ.at(decayType)); - for( AnalysisObject* partonVLQ : *(m_outData -> o_truth_partons.at("VLQ_"+decayType)) ){ - m_truthMngr -> MatchPartonToFatJets( recoVLQCollection, partonVLQ, 1. /*maxDR*/, false /*rcCollection*/, false /*containment*/, 1.0 /*drcontained*/, true /*checkPt*/ ); - } + AOVector& recoVLQCollection = *(m_outData -> o_recoVLQ.at(decayType)); + for( AnalysisObject* partonVLQ : *(m_outData -> o_truth_partons.at("VLQ_"+decayType)) ){ + m_truthMngr -> MatchPartonToFatJets( recoVLQCollection, partonVLQ, 1. /*maxDR*/, false /*rcCollection*/, false /*tagCollection*/, false /*containment*/, 1.0 /*drcontained*/, true /*checkPt*/ ); + } - } + } }// VLQ samples @@ -1821,37 +1952,37 @@ bool VLQ_Analysis_Data2015::Process(Long64_t entry) AOVector truth_lepW = {}; truth_lepW.insert( truth_lepW.end(), m_outData -> o_truth_partons.at("leptop_W")->begin(), m_outData -> o_truth_partons.at("leptop_W")->end()); if( m_opt -> SampleName() == SampleName::VLQ ){ - truth_lepW.insert( truth_lepW.end(), m_outData -> o_truth_partons.at("lepW")->begin(), m_outData -> o_truth_partons.at("lepW")->end()); + truth_lepW.insert( truth_lepW.end(), m_outData -> o_truth_partons.at("lepW")->begin(), m_outData -> o_truth_partons.at("lepW")->end()); } for( AnalysisObject* obj : truth_lepW ){ obj -> SetMoment("nmatch_reco", 0); } if( m_outData -> o_lepW ){ - double drmatch_truth_lepW = 100.; //Take all lepW - AnalysisObject* truth_lepW_match = m_varComputer -> GetClosestAO( m_outData->o_lepW, truth_lepW, drmatch_truth_lepW ); - if(truth_lepW_match){ - - double dr_truthreco_lepW = truth_lepW_match->DeltaR( *(m_outData->o_lepW) ); - if(dr_truthreco_lepW < 0.75){ - truth_lepW_match->SetMoment("nmatch_reco",1); - m_outData->o_lepW->SetMoment("nmatch_truth",1); - } - else{ - truth_lepW_match->SetMoment("nmatch_reco",0); - m_outData->o_lepW->SetMoment("nmatch_truth",0); - } + double drmatch_truth_lepW = 100.; //Take all lepW + AnalysisObject* truth_lepW_match = m_varComputer -> GetClosestAO( m_outData->o_lepW, truth_lepW, drmatch_truth_lepW ); + if(truth_lepW_match){ + + double dr_truthreco_lepW = truth_lepW_match->DeltaR( *(m_outData->o_lepW) ); + if(dr_truthreco_lepW < 0.75){ + truth_lepW_match->SetMoment("nmatch_reco",1); + m_outData->o_lepW->SetMoment("nmatch_truth",1); + } + else{ + truth_lepW_match->SetMoment("nmatch_reco",0); + m_outData->o_lepW->SetMoment("nmatch_truth",0); + } - truth_lepW_match->SetMoment("pT_reco", (m_outData->o_lepW)->Pt()); - truth_lepW_match->SetMoment("fpT_reco", (m_outData->o_lepW)->Pt()/truth_lepW_match->Pt()); - truth_lepW_match->SetMoment("m_reco", (m_outData->o_lepW)->M()); - truth_lepW_match->SetMoment("dR_reco", dr_truthreco_lepW); + truth_lepW_match->SetMoment("pT_reco", (m_outData->o_lepW)->Pt()); + truth_lepW_match->SetMoment("fpT_reco", (m_outData->o_lepW)->Pt()/truth_lepW_match->Pt()); + truth_lepW_match->SetMoment("m_reco", (m_outData->o_lepW)->M()); + truth_lepW_match->SetMoment("dR_reco", dr_truthreco_lepW); - m_outData->o_lepW->SetMoment("pT_truth", truth_lepW_match->Pt()); - m_outData->o_lepW->SetMoment("fpT_truth", (m_outData->o_lepW)->Pt()/truth_lepW_match->Pt()); - m_outData->o_lepW->SetMoment("dR_truth", dr_truthreco_lepW); - } - else{ - m_outData->o_lepW->SetMoment("nmatch_truth",0); - } + m_outData->o_lepW->SetMoment("pT_truth", truth_lepW_match->Pt()); + m_outData->o_lepW->SetMoment("fpT_truth", (m_outData->o_lepW)->Pt()/truth_lepW_match->Pt()); + m_outData->o_lepW->SetMoment("dR_truth", dr_truthreco_lepW); + } + else{ + m_outData->o_lepW->SetMoment("nmatch_truth",0); + } } // @@ -1862,35 +1993,35 @@ bool VLQ_Analysis_Data2015::Process(Long64_t entry) obj -> SetMoment("nmatch_reco_leptop", 0); } if( m_outData -> o_leptop ){ - double drmatch_truth_leptop = 100.; //Take all leptop - AnalysisObject* truth_leptop_match = m_varComputer -> - GetClosestAO( m_outData->o_leptop, *(m_outData -> o_truth_partons.at("leptop")), drmatch_truth_leptop ); - if(truth_leptop_match){ - - double dr_truthreco_leptop = truth_leptop_match->DeltaR( *(m_outData->o_leptop) ); - if(dr_truthreco_leptop < 0.75){ - truth_leptop_match->SetMoment("nmatch_reco_leptop",1); - m_outData->o_leptop->SetMoment("nmatch_truth",1); - } - else{ - truth_leptop_match->SetMoment("nmatch_reco_leptop",0); - m_outData->o_leptop->SetMoment("nmatch_truth",0); - } + double drmatch_truth_leptop = 100.; //Take all leptop + AnalysisObject* truth_leptop_match = m_varComputer -> + GetClosestAO( m_outData->o_leptop, *(m_outData -> o_truth_partons.at("leptop")), drmatch_truth_leptop ); + if(truth_leptop_match){ + + double dr_truthreco_leptop = truth_leptop_match->DeltaR( *(m_outData->o_leptop) ); + if(dr_truthreco_leptop < 0.75){ + truth_leptop_match->SetMoment("nmatch_reco_leptop",1); + m_outData->o_leptop->SetMoment("nmatch_truth",1); + } + else{ + truth_leptop_match->SetMoment("nmatch_reco_leptop",0); + m_outData->o_leptop->SetMoment("nmatch_truth",0); + } + + //truth_leptop_match->SetMoment("nmatch_reco_leptop",1); + truth_leptop_match->SetMoment("pT_reco_leptop", (m_outData->o_leptop)->Pt()); + truth_leptop_match->SetMoment("fpT_reco_leptop", (m_outData->o_leptop)->Pt()/truth_leptop_match->Pt()); + truth_leptop_match->SetMoment("m_reco_leptop", (m_outData->o_leptop)->M()); + truth_leptop_match->SetMoment("dR_reco_leptop", dr_truthreco_leptop); - //truth_leptop_match->SetMoment("nmatch_reco_leptop",1); - truth_leptop_match->SetMoment("pT_reco_leptop", (m_outData->o_leptop)->Pt()); - truth_leptop_match->SetMoment("fpT_reco_leptop", (m_outData->o_leptop)->Pt()/truth_leptop_match->Pt()); - truth_leptop_match->SetMoment("m_reco_leptop", (m_outData->o_leptop)->M()); - truth_leptop_match->SetMoment("dR_reco_leptop", dr_truthreco_leptop); - - //m_outData->o_leptop->SetMoment("nmatch_truth",1); - m_outData->o_leptop->SetMoment("pT_truth", truth_leptop_match->Pt()); - m_outData->o_leptop->SetMoment("fpT_truth", (m_outData->o_leptop)->Pt()/truth_leptop_match->Pt()); - m_outData->o_leptop->SetMoment("dR_truth", dr_truthreco_leptop); - } - else{ - m_outData->o_leptop->SetMoment("nmatch_truth",0); - } + //m_outData->o_leptop->SetMoment("nmatch_truth",1); + m_outData->o_leptop->SetMoment("pT_truth", truth_leptop_match->Pt()); + m_outData->o_leptop->SetMoment("fpT_truth", (m_outData->o_leptop)->Pt()/truth_leptop_match->Pt()); + m_outData->o_leptop->SetMoment("dR_truth", dr_truthreco_leptop); + } + else{ + m_outData->o_leptop->SetMoment("nmatch_truth",0); + } } @@ -2100,9 +2231,9 @@ bool VLQ_Analysis_Data2015::Terminate() SumAnalysisRegions(true); for( const std::pair<int, Selection*> &sel : *(m_selector->GetSelectionTree()) ){ - if(sel.second->PassFlagAtBit(VLQ_Selector::PRESEL)){ - m_outMngrHist -> SaveStandardTH1(nameHist, false, AnalysisUtils::ReplaceString(sel.second->Name(),"-","")); - } + if(sel.second->PassFlagAtBit(VLQ_Selector::PRESEL)){ + m_outMngrHist -> SaveStandardTH1(nameHist, false, AnalysisUtils::ReplaceString(sel.second->Name(),"-","")); + } } } @@ -2139,9 +2270,9 @@ bool VLQ_Analysis_Data2015::SumAnalysisRegions(const bool newFile){ void operator()(TH1D* hist, TH1D** target, const std::string& name, double scale = 1.){ if(*target != NULL){ (*target)->Add(hist, scale); } else{ - *target = (TH1D*)(hist->Clone(name.c_str())); - (*target)->SetDirectory(0); - (*target)->Scale(scale); + *target = (TH1D*)(hist->Clone(name.c_str())); + (*target)->SetDirectory(0); + (*target)->Scale(scale); } return; @@ -2156,46 +2287,46 @@ bool VLQ_Analysis_Data2015::SumAnalysisRegions(const bool newFile){ if( m_opt->DoFitRegions() ){ std::vector<std::string> regList_1L_fit = { - "c1lep0Tex0Hex6jin2bex", - "c1lep0Tex0Hex6jin3bex", - "c1lep0Tex0Hex6jin4bin", - "c1lep0Tex1Hex6jin2bex", - "c1lep0Tex1Hex6jin3bex", - "c1lep0Tex1Hex6jin4bin", - "c1lep1Tex0Hex6jin2bex", - "c1lep1Tex0Hex6jin3bex", - "c1lep1Tex0Hex6jin4bin", - "c1lep1Tex1Hex6jin2bex", - "c1lep1Tex1Hex6jin3bex", - "c1lep1Tex1Hex6jin4bin", - "c1lep2Tin0_1Hwin6jin2bex", - "c1lep2Tin0_1Hwin6jin3bex", - "c1lep2Tin0_1Hwin6jin4bin", - "c1lep0Tin2Hin6jin2bex", - "c1lep0Tin2Hin6jin3bex", - "c1lep0Tin2Hin6jin4bin" + "c1lep0Tex0Hex6jin2bex", + "c1lep0Tex0Hex6jin3bex", + "c1lep0Tex0Hex6jin4bin", + "c1lep0Tex1Hex6jin2bex", + "c1lep0Tex1Hex6jin3bex", + "c1lep0Tex1Hex6jin4bin", + "c1lep1Tex0Hex6jin2bex", + "c1lep1Tex0Hex6jin3bex", + "c1lep1Tex0Hex6jin4bin", + "c1lep1Tex1Hex6jin2bex", + "c1lep1Tex1Hex6jin3bex", + "c1lep1Tex1Hex6jin4bin", + "c1lep2Tin0_1Hwin6jin2bex", + "c1lep2Tin0_1Hwin6jin3bex", + "c1lep2Tin0_1Hwin6jin4bin", + "c1lep0Tin2Hin6jin2bex", + "c1lep0Tin2Hin6jin3bex", + "c1lep0Tin2Hin6jin4bin" }; regList.insert(regList.end(), regList_1L_fit.begin(), regList_1L_fit.end()); }//fit if( m_opt->DoValidnRegions() ){ std::vector<std::string> regList_1L_valid = { - "c1lep0Tex0Hex5jex2bex", - "c1lep0Tex0Hex5jex3bex", - "c1lep0Tex0Hex5jex4bin", - "c1lep0Tex1Hex5jex2bex", - "c1lep0Tex1Hex5jex3bex", - "c1lep0Tex1Hex5jex4bin", - "c1lep1Tex0Hex5jex2bex", - "c1lep1Tex0Hex5jex3bex", - "c1lep1Tex0Hex5jex4bin", - "c1lep1Tex1Hex5jex2bex", - "c1lep1Tex1Hex5jex3bex", - "c1lep2Tin0_1Hwin5jex2bex", - "c1lep2Tin0_1Hwin5jex3bex", - "c1lep0Tin2Hin5jex2bex", - "c1lep0Tin2Hin5jex3bex", - "c1lep2THin5jex4bin" + "c1lep0Tex0Hex5jex2bex", + "c1lep0Tex0Hex5jex3bex", + "c1lep0Tex0Hex5jex4bin", + "c1lep0Tex1Hex5jex2bex", + "c1lep0Tex1Hex5jex3bex", + "c1lep0Tex1Hex5jex4bin", + "c1lep1Tex0Hex5jex2bex", + "c1lep1Tex0Hex5jex3bex", + "c1lep1Tex0Hex5jex4bin", + "c1lep1Tex1Hex5jex2bex", + "c1lep1Tex1Hex5jex3bex", + "c1lep2Tin0_1Hwin5jex2bex", + "c1lep2Tin0_1Hwin5jex3bex", + "c1lep0Tin2Hin5jex2bex", + "c1lep0Tin2Hin5jex3bex", + "c1lep2THin5jex4bin" }; regList.insert(regList.end(), regList_1L_valid.begin(), regList_1L_valid.end()); }//valid @@ -2218,67 +2349,67 @@ bool VLQ_Analysis_Data2015::SumAnalysisRegions(const bool newFile){ if( m_opt->DoFitRegions() ){ std::vector<std::string> regList_0L_fit = { - "c0lep0Tex0Hex7jin2bexLowMtbmin", - "c0lep0Tex0Hex7jin2bexHighMtbmin", - "c0lep0Tex1Hex7jin2bexLowMtbmin", - "c0lep0Tex1Hex7jin2bexHighMtbmin", - "c0lep1Tex0Hex7jin2bexLowMtbmin", - "c0lep1Tex0Hex7jin2bexHighMtbmin", - "c0lep2THin7jin2bexLowMtbmin", - "c0lep2THin7jin2bexHighMtbmin", - "c0lep0Tex0Hex7jin3bexLowMtbmin", - "c0lep0Tex0Hex7jin3bexHighMtbmin", - "c0lep0Tex1Hex7jin3bexLowMtbmin", - "c0lep0Tex1Hex7jin3bexHighMtbmin", - "c0lep1Tex0Hex7jin3bexLowMtbmin", - "c0lep1Tex0Hex7jin3bexHighMtbmin", - "c0lep1Tex1Hex7jin3bexLowMtbmin", - "c0lep1Tex1Hex7jin3bexHighMtbmin", - "c0lep2Tin0_1Hwin7jin3bexLowMtbmin", - "c0lep2Tin0_1Hwin7jin3bexHighMtbmin", - "c0lep0Tin2Hin7jin3bex", - "c0lep0Tex0Hex7jin4binLowMtbmin", - "c0lep0Tex0Hex7jin4binHighMtbmin", - "c0lep0Tex1Hex7jin4binLowMtbmin", - "c0lep0Tex1Hex7jin4binHighMtbmin", - "c0lep1Tex0Hex7jin4binLowMtbmin", - "c0lep1Tex0Hex7jin4binHighMtbmin", - "c0lep2THin7jin4bin" + "c0lep0Tex0Hex7jin2bexLowMtbmin", + "c0lep0Tex0Hex7jin2bexHighMtbmin", + "c0lep0Tex1Hex7jin2bexLowMtbmin", + "c0lep0Tex1Hex7jin2bexHighMtbmin", + "c0lep1Tex0Hex7jin2bexLowMtbmin", + "c0lep1Tex0Hex7jin2bexHighMtbmin", + "c0lep2THin7jin2bexLowMtbmin", + "c0lep2THin7jin2bexHighMtbmin", + "c0lep0Tex0Hex7jin3bexLowMtbmin", + "c0lep0Tex0Hex7jin3bexHighMtbmin", + "c0lep0Tex1Hex7jin3bexLowMtbmin", + "c0lep0Tex1Hex7jin3bexHighMtbmin", + "c0lep1Tex0Hex7jin3bexLowMtbmin", + "c0lep1Tex0Hex7jin3bexHighMtbmin", + "c0lep1Tex1Hex7jin3bexLowMtbmin", + "c0lep1Tex1Hex7jin3bexHighMtbmin", + "c0lep2Tin0_1Hwin7jin3bexLowMtbmin", + "c0lep2Tin0_1Hwin7jin3bexHighMtbmin", + "c0lep0Tin2Hin7jin3bex", + "c0lep0Tex0Hex7jin4binLowMtbmin", + "c0lep0Tex0Hex7jin4binHighMtbmin", + "c0lep0Tex1Hex7jin4binLowMtbmin", + "c0lep0Tex1Hex7jin4binHighMtbmin", + "c0lep1Tex0Hex7jin4binLowMtbmin", + "c0lep1Tex0Hex7jin4binHighMtbmin", + "c0lep2THin7jin4bin" }; regList.insert(regList.end(), regList_0L_fit.begin(), regList_0L_fit.end()); }//fit if( m_opt->DoValidnRegions() ){ std::vector<std::string> regList_0L_valid = { - "c0lep0Tex0Hex6jex2bexLowMtbmin", - "c0lep0Tex0Hex6jex2bexHighMtbmin", - "c0lep0Tex1Hex6jex2bexLowMtbmin", - "c0lep0Tex1Hex6jex2bexHighMtbmin", - "c0lep1Tex0Hex6jex2bexLowMtbmin", - "c0lep1Tex0Hex6jex2bexHighMtbmin", - "c0lep2THin6jex2bexLowMtbmin", - "c0lep2THin6jex2bexHighMtbmin", - "c0lep0Tex0Hex6jex3bexLowMtbmin", - "c0lep0Tex0Hex6jex3bexHighMtbmin", - "c0lep0Tex1Hex6jex3bexLowMtbmin", - "c0lep0Tex1Hex6jex3bexHighMtbmin", - "c0lep1Tex0Hex6jex3bexLowMtbmin", - "c0lep1Tex0Hex6jex3bexHighMtbmin", - "c0lep2THin6jex3bex", - "c0lep0Tex0Hex6jex4binLowMtbmin", - "c0lep0Tex0Hex6jex4binHighMtbmin", - "c0lep0Tex1Hex6jex4bin", - "c0lep1Tex0Hex6jex4bin", - "c0lep2THin6jex4bin" + "c0lep0Tex0Hex6jex2bexLowMtbmin", + "c0lep0Tex0Hex6jex2bexHighMtbmin", + "c0lep0Tex1Hex6jex2bexLowMtbmin", + "c0lep0Tex1Hex6jex2bexHighMtbmin", + "c0lep1Tex0Hex6jex2bexLowMtbmin", + "c0lep1Tex0Hex6jex2bexHighMtbmin", + "c0lep2THin6jex2bexLowMtbmin", + "c0lep2THin6jex2bexHighMtbmin", + "c0lep0Tex0Hex6jex3bexLowMtbmin", + "c0lep0Tex0Hex6jex3bexHighMtbmin", + "c0lep0Tex1Hex6jex3bexLowMtbmin", + "c0lep0Tex1Hex6jex3bexHighMtbmin", + "c0lep1Tex0Hex6jex3bexLowMtbmin", + "c0lep1Tex0Hex6jex3bexHighMtbmin", + "c0lep2THin6jex3bex", + "c0lep0Tex0Hex6jex4binLowMtbmin", + "c0lep0Tex0Hex6jex4binHighMtbmin", + "c0lep0Tex1Hex6jex4bin", + "c0lep1Tex0Hex6jex4bin", + "c0lep2THin6jex4bin" }; regList.insert(regList.end(), regList_0L_valid.begin(), regList_0L_valid.end()); }//valid std::map<std::string, std::vector<std::string> > targetPrintList_0L = { - {"sum0lep6jin2bin", {}}, - {"sum0lep7jin2bin", {}}, - {"sum0lep6jin3bin", {}}, - {"sum0lep7jin3bin", {}}, + {"sum0lep6jin2bin", {}}, + {"sum0lep7jin2bin", {}}, + {"sum0lep6jin3bin", {}}, + {"sum0lep7jin3bin", {}}, {"sum0lep1THin7jin2bin", {}} }; @@ -2288,10 +2419,10 @@ bool VLQ_Analysis_Data2015::SumAnalysisRegions(const bool newFile){ }//0-lep /* - {"sum0lep6jin2bin", {}}, - {"sum0lep7jin2bin", {}}, - {"sum0lep6jin3bin", {}}, - {"sum0lep7jin3bin", {}}, + {"sum0lep6jin2bin", {}}, + {"sum0lep7jin2bin", {}}, + {"sum0lep6jin3bin", {}}, + {"sum0lep7jin3bin", {}}, */ //{"sum0lep0Tex0Hex7jin2bin", {}}, //{"sum0lep1THin7jin2bin", {}}, @@ -2357,14 +2488,14 @@ bool VLQ_Analysis_Data2015::SumAnalysisRegions(const bool newFile){ if(region.find("0Tex0Hex") != std::string::npos){ boostcat = "0Tex0Hex"; } else if( (region.find("1Tex0Hex") != std::string::npos) || (region.find("0Tex1Hex") != std::string::npos) ){ boostcat = "1THex"; } else if( (region.find("2THin") != std::string::npos) || (region.find("2Tin0_1Hwin") != std::string::npos) - || (region.find("1Tex1Hex") != std::string::npos) || (region.find("0Tin2Hin") != std::string::npos) ){ boostcat = "2THin"; } + || (region.find("1Tex1Hex") != std::string::npos) || (region.find("0Tin2Hin") != std::string::npos) ){ boostcat = "2THin"; } //else /* if( (region.find("1Tex0Hex") != std::string::npos) || (region.find("0Tex1Hex") != std::string::npos) - || (region.find("2THin") != std::string::npos) || (region.find("2Tin0_1Hwin") != std::string::npos) - || (region.find("1Tex1Hex") != std::string::npos) || (region.find("0Tin2Hin") != std::string::npos) ) + || (region.find("2THin") != std::string::npos) || (region.find("2Tin0_1Hwin") != std::string::npos) + || (region.find("1Tex1Hex") != std::string::npos) || (region.find("0Tin2Hin") != std::string::npos) ) { boostcat = "1THin"; } */ @@ -2386,23 +2517,23 @@ bool VLQ_Analysis_Data2015::SumAnalysisRegions(const bool newFile){ //=========================== Preselections ============================================== targetPrintList.at("sum0lep6jin2bin").push_back(region); if(region.find("7jin") != std::string::npos){ - targetPrintList.at("sum0lep7jin2bin").push_back(region); + targetPrintList.at("sum0lep7jin2bin").push_back(region); } if( (region.find("3bex") != std::string::npos) || (region.find("4bin") != std::string::npos) ){ - targetPrintList.at("sum0lep6jin3bin").push_back(region); + targetPrintList.at("sum0lep6jin3bin").push_back(region); - if(region.find("7jin") != std::string::npos){ - targetPrintList.at("sum0lep7jin3bin").push_back(region); - }//7jin3bin + if(region.find("7jin") != std::string::npos){ + targetPrintList.at("sum0lep7jin3bin").push_back(region); + }//7jin3bin }//3bin //targetPrintList.at("sum0lep"+boostcat+"6jin2bin").push_back(region); if(region.find("7jin") != std::string::npos){ - if( !boostcat.empty() && (boostcat.find("0Tex0Hex") == std::string::npos) ){ - targetPrintList.at("sum0lep1THin7jin2bin").push_back(region); - } + if( !boostcat.empty() && (boostcat.find("0Tex0Hex") == std::string::npos) ){ + targetPrintList.at("sum0lep1THin7jin2bin").push_back(region); + } } //targetPrintList.at("sum0lep"+boostcat+jetcat+bcat).push_back(region); @@ -2412,24 +2543,24 @@ bool VLQ_Analysis_Data2015::SumAnalysisRegions(const bool newFile){ else if(region.find("1lep") != std::string::npos){ targetPrintList.at("sum1lep5jin2bin").push_back(region); if(region.find("6jin") != std::string::npos){ - targetPrintList.at("sum1lep6jin2bin").push_back(region); + targetPrintList.at("sum1lep6jin2bin").push_back(region); } if( (region.find("3bex") != std::string::npos) || (region.find("4bin") != std::string::npos) ){ - targetPrintList.at("sum1lep5jin3bin").push_back(region); + targetPrintList.at("sum1lep5jin3bin").push_back(region); - if(region.find("6jin") != std::string::npos){ - targetPrintList.at("sum1lep6jin3bin").push_back(region); - if( !boostcat.empty() && (boostcat.find("0Tex0Hex") == std::string::npos) ){ - targetPrintList.at("sum1lep1THin6jin3bin").push_back(region); - } - //targetPrintList.at("sum1lep"+boostcat+"6jin3bin").push_back(region); - }//6jin3bin + if(region.find("6jin") != std::string::npos){ + targetPrintList.at("sum1lep6jin3bin").push_back(region); + if( !boostcat.empty() && (boostcat.find("0Tex0Hex") == std::string::npos) ){ + targetPrintList.at("sum1lep1THin6jin3bin").push_back(region); + } + //targetPrintList.at("sum1lep"+boostcat+"6jin3bin").push_back(region); + }//6jin3bin - //targetPrintList.at("sum1lep"+boostcat+jetcat+bcat).push_back(region); + //targetPrintList.at("sum1lep"+boostcat+jetcat+bcat).push_back(region); }//3bin - + }//1L regions } @@ -2439,7 +2570,7 @@ bool VLQ_Analysis_Data2015::SumAnalysisRegions(const bool newFile){ for(std::pair<std::string, std::vector<std::string> > targetPair : targetPrintList){ std::cout << " TARGET REGION : " << targetPair.first << " built from :: " <<std::endl; for(std::string source_reg : targetPair.second){ - std::cout<<source_reg<<std::endl; + std::cout<<source_reg<<std::endl; } std::cout<<std::endl<<std::endl; } @@ -2478,7 +2609,7 @@ bool VLQ_Analysis_Data2015::SumAnalysisRegions(const bool newFile){ DRDSPropagator->WriteAllSystHistograms(false,false); delete DRDSPropagator; } - + std::string fileMode = newFile ? "RECREATE" : "UPDATE"; TFile* outfile = TFile::Open( m_opt->OutputFile().c_str(), fileMode.c_str()); @@ -2491,324 +2622,324 @@ bool VLQ_Analysis_Data2015::SumAnalysisRegions(const bool newFile){ for ( unsigned int i = 0 ; i <= ( ( m_opt -> SampleName() == SampleName::VLQ && m_opt -> SplitVLQDecays() /* && split*/ ) ? 6 : 0 ) ; ++i) { std::string variable = ""; if( i > 0 ){ - variable += "vlq"; - variable += std::to_string(i); - variable += "_"; + variable += "vlq"; + variable += std::to_string(i); + variable += "_"; } variable += variable_base; for(std::pair<std::string, std::vector<std::string> > targetPair : targetPrintList){ - if(is_QCD && targetPair.first.find("0lep") != std::string::npos){continue;} - if(is_QCD0L && targetPair.first.find("1lep") != std::string::npos){continue;} - - for(const std::string& channel : lepchannels){ - - if(!channel.empty() && targetPair.first.find("1lep") == std::string::npos){ continue; } - - //Regular weight systematics - for(std::string sys : wgtList){ - - //std::cout<<"============================ TARGET : "<<targetPair.first<<" ========================="<<std::endl; - TH1D* targethist = NULL; - double sumint = 0.; - for(std::string source_reg : targetPair.second){ - TH1D* sourcehist = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable + sys).c_str() ); - AddHistogramToTarget(sourcehist, &targethist, targetPair.first + channel + "_" + variable + sys); - sumint += sourcehist->GetEntries(); - }//source regions - - outfile->cd(); - if(targethist){ - HistManager::FinaliseTH1Bins(targethist); - targethist->Write(); - delete targethist; - } - //std::cout<<"======================================================================================"<<std::endl; - }//systematics + nominal - - //Region dependent weight systematics, including proxies for normalisation uncertainties - for(std::pair<std::string, std::string> boostcat : boostcat_systs){ - - //============================ V+jets samples =========================================================================== - if(is_Vjets){ - - //only XS uncertainty - TH1D* targethist_Vjets_XS_up = NULL; - TH1D* targethist_Vjets_XS_down = NULL; - for(std::string source_reg : targetPair.second){ - TH1D* sourcehist = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable).c_str() ); - - //If source region is in the boost category of the systematic, then scale it up and down - double sc_up = (source_reg.find(boostcat.second) != std::string::npos) ? 1.3 : 1.; - double sc_down = (source_reg.find(boostcat.second) != std::string::npos) ? 0.7 : 1.; - - AddHistogramToTarget(sourcehist, &targethist_Vjets_XS_up, targetPair.first + channel + "_" + variable + "_weight_Vjets_XS_"+boostcat.first+"_up", sc_up); - AddHistogramToTarget(sourcehist, &targethist_Vjets_XS_down, targetPair.first + channel + "_" + variable + "_weight_Vjets_XS_"+boostcat.first+"_down", sc_down); - }//source regions - - if(is_VjetsHF){ - //only XS uncertainty - TH1D* targethist_VjetsHF_XS_up = NULL; - TH1D* targethist_VjetsHF_XS_down = NULL; - for(std::string source_reg : targetPair.second){ - TH1D* sourcehist = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable).c_str() ); - - //If source region is in the boost category of the systematic, then scale it up and down - double sc_up = (source_reg.find(boostcat.second) != std::string::npos) ? 1.3 : 1.; - double sc_down = (source_reg.find(boostcat.second) != std::string::npos) ? 0.7 : 1.; - - AddHistogramToTarget(sourcehist, &targethist_VjetsHF_XS_up, targetPair.first + channel + "_" + variable + "_weight_VjetsHF_XS_"+boostcat.first+"_up", sc_up); - AddHistogramToTarget(sourcehist, &targethist_VjetsHF_XS_down, targetPair.first + channel + "_" + variable + "_weight_VjetsHF_XS_"+boostcat.first+"_down", sc_down); - }//source regions - - outfile->cd(); - if(targethist_VjetsHF_XS_up){ - HistManager::FinaliseTH1Bins(targethist_VjetsHF_XS_up); - targethist_VjetsHF_XS_up->Write(); - delete targethist_VjetsHF_XS_up; - } - if(targethist_VjetsHF_XS_down){ - HistManager::FinaliseTH1Bins(targethist_VjetsHF_XS_down); - targethist_VjetsHF_XS_down->Write(); - delete targethist_VjetsHF_XS_down; - } - - }//Vjets+HF sample - - outfile->cd(); - if(targethist_Vjets_XS_up){ - HistManager::FinaliseTH1Bins(targethist_Vjets_XS_up); - targethist_Vjets_XS_up->Write(); - delete targethist_Vjets_XS_up; - } - if(targethist_Vjets_XS_down){ - HistManager::FinaliseTH1Bins(targethist_Vjets_XS_down); - targethist_Vjets_XS_down->Write(); - delete targethist_Vjets_XS_down; - } - - }//Vjets sample - //================================================= V+jets samples =========================================================== - - //============================ Diboson samples =========================================================================== - if(is_Diboson){ - - //only XS uncertainty - TH1D* targethist_Diboson_XS_up = NULL; - TH1D* targethist_Diboson_XS_down = NULL; - for(std::string source_reg : targetPair.second){ - TH1D* sourcehist = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable).c_str() ); - - //If source region is in the boost category of the systematic, then scale it up and down - double sc_up = (source_reg.find(boostcat.second) != std::string::npos) ? 1.48 : 1.; - double sc_down = (source_reg.find(boostcat.second) != std::string::npos) ? 0.52 : 1.; - - AddHistogramToTarget(sourcehist, &targethist_Diboson_XS_up, targetPair.first + channel + "_" + variable + "_weight_Dibosons_XS_"+boostcat.first+"_up", sc_up); - AddHistogramToTarget(sourcehist, &targethist_Diboson_XS_down, targetPair.first + channel + "_" + variable + "_weight_Dibosons_XS_"+boostcat.first+"_down", sc_down); - }//source regions - - outfile->cd(); - if(targethist_Diboson_XS_up){ - HistManager::FinaliseTH1Bins(targethist_Diboson_XS_up); - targethist_Diboson_XS_up->Write(); - delete targethist_Diboson_XS_up; - } - if(targethist_Diboson_XS_down){ - HistManager::FinaliseTH1Bins(targethist_Diboson_XS_down); - targethist_Diboson_XS_down->Write(); - delete targethist_Diboson_XS_down; - } - - }//Diboson sample - //================================================= Diboson samples =========================================================== - - //============================ Single top samples =========================================================================== - if(is_singletop){ - - std::vector<std::string> mtblist{}; - if(targetPair.first.find("0lep") != std::string::npos){ - mtblist = {"","LowMtbmin","HighMtbmin"}; - } - else{ - mtblist = {""}; - } - - for(const std::string& mtbcat : mtblist){ - - std::string mtbsuffix = (mtbcat.empty()) ? mtbcat : "_"+mtbcat; - double sc_const = (mtbcat == "HighMtbmin") ? 0.25 : 0.20; - //XS uncertainty - TH1D* targethist_Singletop_XS_up = NULL; - TH1D* targethist_Singletop_DRDS_up = NULL; - TH1D* targethist_Singletop_XS_down = NULL; - - //std::cout << std::endl <<" STARTING Target region: " << targetPair.first << " BOOSTCAT : " << boostcat.second << std::endl; - - for(std::string source_reg : targetPair.second){ - TH1D* sourcehist = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable).c_str() ); - - bool is_regmatch = ( (source_reg.find(boostcat.second) != std::string::npos) - && ( (mtbcat.empty() && (source_reg.find("Mtbmin") == std::string::npos)) - || (!mtbcat.empty() && (source_reg.find(mtbcat) != std::string::npos)) ) ); - - //If source region is in the boost category of the systematic, then scale it up and down - //also add DRDS variation - double sc_up = 1.; - double sc_down = 1.; - if(is_regmatch){ - sc_up = 1.+sc_const; - sc_down = 1.-sc_const; - TH1D* sourcehist_DRDS = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable + "_SingletopDRDS").c_str() ); - if(sourcehist_DRDS){ - //std::cout<<" DRDS Source region : "<<source_reg<<" --> "<<sourcehist_DRDS->Integral() << std::endl; - AddHistogramToTarget(sourcehist_DRDS, &targethist_Singletop_DRDS_up - , targetPair.first + channel + "_" + variable + "_SingletopDRDS_"+boostcat.first+mtbsuffix); - } - } - else{ - //std::cout<<" Source region : "<<source_reg<<" --> "<<sourcehist->Integral() << std::endl; - AddHistogramToTarget(sourcehist, &targethist_Singletop_DRDS_up - , targetPair.first + channel + "_" + variable + "_SingletopDRDS_"+boostcat.first+mtbsuffix); - } + if(is_QCD && targetPair.first.find("0lep") != std::string::npos){continue;} + if(is_QCD0L && targetPair.first.find("1lep") != std::string::npos){continue;} + + for(const std::string& channel : lepchannels){ + + if(!channel.empty() && targetPair.first.find("1lep") == std::string::npos){ continue; } + + //Regular weight systematics + for(std::string sys : wgtList){ + + //std::cout<<"============================ TARGET : "<<targetPair.first<<" ========================="<<std::endl; + TH1D* targethist = NULL; + double sumint = 0.; + for(std::string source_reg : targetPair.second){ + TH1D* sourcehist = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable + sys).c_str() ); + AddHistogramToTarget(sourcehist, &targethist, targetPair.first + channel + "_" + variable + sys); + sumint += sourcehist->GetEntries(); + }//source regions + + outfile->cd(); + if(targethist){ + HistManager::FinaliseTH1Bins(targethist); + targethist->Write(); + delete targethist; + } + //std::cout<<"======================================================================================"<<std::endl; + }//systematics + nominal + + //Region dependent weight systematics, including proxies for normalisation uncertainties + for(std::pair<std::string, std::string> boostcat : boostcat_systs){ + + //============================ V+jets samples =========================================================================== + if(is_Vjets){ + + //only XS uncertainty + TH1D* targethist_Vjets_XS_up = NULL; + TH1D* targethist_Vjets_XS_down = NULL; + for(std::string source_reg : targetPair.second){ + TH1D* sourcehist = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable).c_str() ); + + //If source region is in the boost category of the systematic, then scale it up and down + double sc_up = (source_reg.find(boostcat.second) != std::string::npos) ? 1.3 : 1.; + double sc_down = (source_reg.find(boostcat.second) != std::string::npos) ? 0.7 : 1.; + + AddHistogramToTarget(sourcehist, &targethist_Vjets_XS_up, targetPair.first + channel + "_" + variable + "_weight_Vjets_XS_"+boostcat.first+"_up", sc_up); + AddHistogramToTarget(sourcehist, &targethist_Vjets_XS_down, targetPair.first + channel + "_" + variable + "_weight_Vjets_XS_"+boostcat.first+"_down", sc_down); + }//source regions + + if(is_VjetsHF){ + //only XS uncertainty + TH1D* targethist_VjetsHF_XS_up = NULL; + TH1D* targethist_VjetsHF_XS_down = NULL; + for(std::string source_reg : targetPair.second){ + TH1D* sourcehist = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable).c_str() ); + + //If source region is in the boost category of the systematic, then scale it up and down + double sc_up = (source_reg.find(boostcat.second) != std::string::npos) ? 1.3 : 1.; + double sc_down = (source_reg.find(boostcat.second) != std::string::npos) ? 0.7 : 1.; + + AddHistogramToTarget(sourcehist, &targethist_VjetsHF_XS_up, targetPair.first + channel + "_" + variable + "_weight_VjetsHF_XS_"+boostcat.first+"_up", sc_up); + AddHistogramToTarget(sourcehist, &targethist_VjetsHF_XS_down, targetPair.first + channel + "_" + variable + "_weight_VjetsHF_XS_"+boostcat.first+"_down", sc_down); + }//source regions + + outfile->cd(); + if(targethist_VjetsHF_XS_up){ + HistManager::FinaliseTH1Bins(targethist_VjetsHF_XS_up); + targethist_VjetsHF_XS_up->Write(); + delete targethist_VjetsHF_XS_up; + } + if(targethist_VjetsHF_XS_down){ + HistManager::FinaliseTH1Bins(targethist_VjetsHF_XS_down); + targethist_VjetsHF_XS_down->Write(); + delete targethist_VjetsHF_XS_down; + } + + }//Vjets+HF sample + + outfile->cd(); + if(targethist_Vjets_XS_up){ + HistManager::FinaliseTH1Bins(targethist_Vjets_XS_up); + targethist_Vjets_XS_up->Write(); + delete targethist_Vjets_XS_up; + } + if(targethist_Vjets_XS_down){ + HistManager::FinaliseTH1Bins(targethist_Vjets_XS_down); + targethist_Vjets_XS_down->Write(); + delete targethist_Vjets_XS_down; + } + + }//Vjets sample + //================================================= V+jets samples =========================================================== + + //============================ Diboson samples =========================================================================== + if(is_Diboson){ + + //only XS uncertainty + TH1D* targethist_Diboson_XS_up = NULL; + TH1D* targethist_Diboson_XS_down = NULL; + for(std::string source_reg : targetPair.second){ + TH1D* sourcehist = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable).c_str() ); + + //If source region is in the boost category of the systematic, then scale it up and down + double sc_up = (source_reg.find(boostcat.second) != std::string::npos) ? 1.48 : 1.; + double sc_down = (source_reg.find(boostcat.second) != std::string::npos) ? 0.52 : 1.; + + AddHistogramToTarget(sourcehist, &targethist_Diboson_XS_up, targetPair.first + channel + "_" + variable + "_weight_Dibosons_XS_"+boostcat.first+"_up", sc_up); + AddHistogramToTarget(sourcehist, &targethist_Diboson_XS_down, targetPair.first + channel + "_" + variable + "_weight_Dibosons_XS_"+boostcat.first+"_down", sc_down); + }//source regions + + outfile->cd(); + if(targethist_Diboson_XS_up){ + HistManager::FinaliseTH1Bins(targethist_Diboson_XS_up); + targethist_Diboson_XS_up->Write(); + delete targethist_Diboson_XS_up; + } + if(targethist_Diboson_XS_down){ + HistManager::FinaliseTH1Bins(targethist_Diboson_XS_down); + targethist_Diboson_XS_down->Write(); + delete targethist_Diboson_XS_down; + } + + }//Diboson sample + //================================================= Diboson samples =========================================================== + + //============================ Single top samples =========================================================================== + if(is_singletop){ + + std::vector<std::string> mtblist{}; + if(targetPair.first.find("0lep") != std::string::npos){ + mtblist = {"","LowMtbmin","HighMtbmin"}; + } + else{ + mtblist = {""}; + } + + for(const std::string& mtbcat : mtblist){ + + std::string mtbsuffix = (mtbcat.empty()) ? mtbcat : "_"+mtbcat; + double sc_const = (mtbcat == "HighMtbmin") ? 0.25 : 0.20; + //XS uncertainty + TH1D* targethist_Singletop_XS_up = NULL; + TH1D* targethist_Singletop_DRDS_up = NULL; + TH1D* targethist_Singletop_XS_down = NULL; + + //std::cout << std::endl <<" STARTING Target region: " << targetPair.first << " BOOSTCAT : " << boostcat.second << std::endl; + + for(std::string source_reg : targetPair.second){ + TH1D* sourcehist = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable).c_str() ); + + bool is_regmatch = ( (source_reg.find(boostcat.second) != std::string::npos) + && ( (mtbcat.empty() && (source_reg.find("Mtbmin") == std::string::npos)) + || (!mtbcat.empty() && (source_reg.find(mtbcat) != std::string::npos)) ) ); + + //If source region is in the boost category of the systematic, then scale it up and down + //also add DRDS variation + double sc_up = 1.; + double sc_down = 1.; + if(is_regmatch){ + sc_up = 1.+sc_const; + sc_down = 1.-sc_const; + TH1D* sourcehist_DRDS = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable + "_SingletopDRDS").c_str() ); + if(sourcehist_DRDS){ + //std::cout<<" DRDS Source region : "<<source_reg<<" --> "<<sourcehist_DRDS->Integral() << std::endl; + AddHistogramToTarget(sourcehist_DRDS, &targethist_Singletop_DRDS_up + , targetPair.first + channel + "_" + variable + "_SingletopDRDS_"+boostcat.first+mtbsuffix); + } + } + else{ + //std::cout<<" Source region : "<<source_reg<<" --> "<<sourcehist->Integral() << std::endl; + AddHistogramToTarget(sourcehist, &targethist_Singletop_DRDS_up + , targetPair.first + channel + "_" + variable + "_SingletopDRDS_"+boostcat.first+mtbsuffix); + } - AddHistogramToTarget(sourcehist, &targethist_Singletop_XS_up, - targetPair.first + channel + "_" + variable + "_weight_Singletop_XS_"+boostcat.first+mtbsuffix+"_up", sc_up); - AddHistogramToTarget(sourcehist, &targethist_Singletop_XS_down, - targetPair.first + channel + "_" + variable + "_weight_Singletop_XS_"+boostcat.first+mtbsuffix+"_down", sc_down); - }//source regions - - outfile->cd(); - if(targethist_Singletop_XS_up){ - HistManager::FinaliseTH1Bins(targethist_Singletop_XS_up); - targethist_Singletop_XS_up->Write(); - delete targethist_Singletop_XS_up; - } - if(targethist_Singletop_XS_down){ - HistManager::FinaliseTH1Bins(targethist_Singletop_XS_down); - targethist_Singletop_XS_down->Write(); - delete targethist_Singletop_XS_down; - } - if(targethist_Singletop_DRDS_up){ - //std::cout<<" Target region: " << targetPair.first << " --> " << targethist_Singletop_DRDS_up->Integral() << std::endl; - HistManager::FinaliseTH1Bins(targethist_Singletop_DRDS_up); - targethist_Singletop_DRDS_up->Write(); - delete targethist_Singletop_DRDS_up; - } - - }//mtbmin categories - - }//single top samples - - //================================================= Single top samples =========================================================== - - - //============================ QCD samples =========================================================================== - if(is_QCD0L){ - std::vector<std::string> mtblist = {"","LowMtbmin","HighMtbmin"}; - - for(const std::string& mtbcat : mtblist){ - - //XS uncertainty - TH1D* targethist_QCD0L_XS_up = NULL; - TH1D* targethist_QCD0L_XS_down = NULL; - for(std::string source_reg : targetPair.second){ - TH1D* sourcehist = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable).c_str() ); - - bool is_regmatch = ( (source_reg.find(boostcat.second) != std::string::npos) - && ( (mtbcat.empty() && (source_reg.find("Mtbmin") == std::string::npos)) - || (!mtbcat.empty() && (source_reg.find(mtbcat) != std::string::npos)) ) ); + AddHistogramToTarget(sourcehist, &targethist_Singletop_XS_up, + targetPair.first + channel + "_" + variable + "_weight_Singletop_XS_"+boostcat.first+mtbsuffix+"_up", sc_up); + AddHistogramToTarget(sourcehist, &targethist_Singletop_XS_down, + targetPair.first + channel + "_" + variable + "_weight_Singletop_XS_"+boostcat.first+mtbsuffix+"_down", sc_down); + }//source regions + + outfile->cd(); + if(targethist_Singletop_XS_up){ + HistManager::FinaliseTH1Bins(targethist_Singletop_XS_up); + targethist_Singletop_XS_up->Write(); + delete targethist_Singletop_XS_up; + } + if(targethist_Singletop_XS_down){ + HistManager::FinaliseTH1Bins(targethist_Singletop_XS_down); + targethist_Singletop_XS_down->Write(); + delete targethist_Singletop_XS_down; + } + if(targethist_Singletop_DRDS_up){ + //std::cout<<" Target region: " << targetPair.first << " --> " << targethist_Singletop_DRDS_up->Integral() << std::endl; + HistManager::FinaliseTH1Bins(targethist_Singletop_DRDS_up); + targethist_Singletop_DRDS_up->Write(); + delete targethist_Singletop_DRDS_up; + } + + }//mtbmin categories + + }//single top samples + + //================================================= Single top samples =========================================================== + + + //============================ QCD samples =========================================================================== + if(is_QCD0L){ + std::vector<std::string> mtblist = {"","LowMtbmin","HighMtbmin"}; + + for(const std::string& mtbcat : mtblist){ + + //XS uncertainty + TH1D* targethist_QCD0L_XS_up = NULL; + TH1D* targethist_QCD0L_XS_down = NULL; + for(std::string source_reg : targetPair.second){ + TH1D* sourcehist = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable).c_str() ); + + bool is_regmatch = ( (source_reg.find(boostcat.second) != std::string::npos) + && ( (mtbcat.empty() && (source_reg.find("Mtbmin") == std::string::npos)) + || (!mtbcat.empty() && (source_reg.find(mtbcat) != std::string::npos)) ) ); - //If source region is in the boost category of the systematic, then scale it up and down - double sc_up = is_regmatch ? 2. : 1.; - double sc_down = is_regmatch ? 0. : 1.; - /* - if(is_regmatch){ - std::cout << " is_regmatch = " << is_regmatch << " source_reg = "<<source_reg - << " mtbcat = " << mtbcat << " boostcat = " << boostcat.second - << " sc_up " << sc_up << std::endl; - } - */ - std::string mtbsuffix = (mtbcat.empty()) ? mtbcat : "_"+mtbcat; - AddHistogramToTarget(sourcehist, &targethist_QCD0L_XS_up, targetPair.first + channel + "_" + variable + "_weight_QCD0L_XS_"+boostcat.first+mtbsuffix+"_up", sc_up); - AddHistogramToTarget(sourcehist, &targethist_QCD0L_XS_down, targetPair.first + channel + "_" + variable + "_weight_QCD0L_XS_"+boostcat.first+mtbsuffix+"_down", sc_down); - }//source regions - - //DR/DS uncertainty (TO DO) - - outfile->cd(); - if(targethist_QCD0L_XS_up){ - HistManager::FinaliseTH1Bins(targethist_QCD0L_XS_up); - targethist_QCD0L_XS_up->Write(); - delete targethist_QCD0L_XS_up; - } - if(targethist_QCD0L_XS_down){ - HistManager::FinaliseTH1Bins(targethist_QCD0L_XS_down); - targethist_QCD0L_XS_down->Write(); - delete targethist_QCD0L_XS_down; - } - - }//mtbmin categories - - }//QCD0L samples - - - if(is_QCD){ - - //weight uncertainty - TH1D* targethist_QCD_el_up = NULL; - TH1D* targethist_QCD_mu_up = NULL; - - for(std::string source_reg : targetPair.second){ - - if(source_reg.find(boostcat.second) != std::string::npos){ - //If source region is in the boost category of the systematic, add the systematically varied histograms - TH1D* sourcehist_el_up = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable + "_weight_qcd_el_up").c_str() ); - //TH1D* sourcehist_el_down = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable + "_weight_qcd_el_down").c_str() ); - TH1D* sourcehist_mu_up = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable + "_weight_qcd_mu_up").c_str() ); - //TH1D* sourcehist_mu_down = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable + "_weight_qcd_mu_down").c_str() ); - - AddHistogramToTarget(sourcehist_el_up, &targethist_QCD_el_up, targetPair.first + channel + "_" + variable + "_weight_qcd_el_"+boostcat.first+"_up"); - //AddHistogramToTarget(sourcehist_el_down, &targethist_QCD_el_down, targetPair.first + channel + "_" + variable + "_weight_qcd_el_"+boostcat.first+"_down"); - AddHistogramToTarget(sourcehist_mu_up, &targethist_QCD_mu_up, targetPair.first + channel + "_" + variable + "_weight_qcd_mu_"+boostcat.first+"_up"); - //AddHistogramToTarget(sourcehist_mu_down, &targethist_QCD_mu_down, targetPair.first + channel + "_" + variable + "_weight_qcd_mu_"+boostcat.first+"_down"); - } - else{ - TH1D* sourcehist = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable).c_str() ); - AddHistogramToTarget(sourcehist, &targethist_QCD_el_up, targetPair.first + channel + "_" + variable + "_weight_qcd_el_"+boostcat.first+"_up"); - //AddHistogramToTarget(sourcehist, &targethist_QCD_el_down, targetPair.first + channel + "_" + variable + "_weight_qcd_el_"+boostcat.first+"_down"); - AddHistogramToTarget(sourcehist, &targethist_QCD_mu_up, targetPair.first + channel + "_" + variable + "_weight_qcd_mu_"+boostcat.first+"_up"); - //AddHistogramToTarget(sourcehist, &targethist_QCD_mu_down, targetPair.first + channel + "_" + variable + "_weight_qcd_mu_"+boostcat.first+"_down"); - } - }//source regions - - outfile->cd(); - if(targethist_QCD_el_up){ - HistManager::FinaliseTH1Bins(targethist_QCD_el_up); - targethist_QCD_el_up->Write(); - delete targethist_QCD_el_up; - } - /* if(targethist_QCD_el_down){ - targethist_QCD_el_down->Write(); - delete targethist_QCD_el_down; - }*/ - if(targethist_QCD_mu_up){ - HistManager::FinaliseTH1Bins(targethist_QCD_mu_up); - targethist_QCD_mu_up->Write(); - delete targethist_QCD_mu_up; - } - /*if(targethist_QCD_mu_down){ - targethist_QCD_mu_down->Write(); - delete targethist_QCD_mu_down; - }*/ - - }//QCD samples - - //================================================= QCD samples =========================================================== - - }//Boosted categories + //If source region is in the boost category of the systematic, then scale it up and down + double sc_up = is_regmatch ? 2. : 1.; + double sc_down = is_regmatch ? 0. : 1.; + /* + if(is_regmatch){ + std::cout << " is_regmatch = " << is_regmatch << " source_reg = "<<source_reg + << " mtbcat = " << mtbcat << " boostcat = " << boostcat.second + << " sc_up " << sc_up << std::endl; + } + */ + std::string mtbsuffix = (mtbcat.empty()) ? mtbcat : "_"+mtbcat; + AddHistogramToTarget(sourcehist, &targethist_QCD0L_XS_up, targetPair.first + channel + "_" + variable + "_weight_QCD0L_XS_"+boostcat.first+mtbsuffix+"_up", sc_up); + AddHistogramToTarget(sourcehist, &targethist_QCD0L_XS_down, targetPair.first + channel + "_" + variable + "_weight_QCD0L_XS_"+boostcat.first+mtbsuffix+"_down", sc_down); + }//source regions + + //DR/DS uncertainty (TO DO) + + outfile->cd(); + if(targethist_QCD0L_XS_up){ + HistManager::FinaliseTH1Bins(targethist_QCD0L_XS_up); + targethist_QCD0L_XS_up->Write(); + delete targethist_QCD0L_XS_up; + } + if(targethist_QCD0L_XS_down){ + HistManager::FinaliseTH1Bins(targethist_QCD0L_XS_down); + targethist_QCD0L_XS_down->Write(); + delete targethist_QCD0L_XS_down; + } + + }//mtbmin categories + + }//QCD0L samples + + + if(is_QCD){ + + //weight uncertainty + TH1D* targethist_QCD_el_up = NULL; + TH1D* targethist_QCD_mu_up = NULL; + + for(std::string source_reg : targetPair.second){ + + if(source_reg.find(boostcat.second) != std::string::npos){ + //If source region is in the boost category of the systematic, add the systematically varied histograms + TH1D* sourcehist_el_up = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable + "_weight_qcd_el_up").c_str() ); + //TH1D* sourcehist_el_down = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable + "_weight_qcd_el_down").c_str() ); + TH1D* sourcehist_mu_up = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable + "_weight_qcd_mu_up").c_str() ); + //TH1D* sourcehist_mu_down = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable + "_weight_qcd_mu_down").c_str() ); + + AddHistogramToTarget(sourcehist_el_up, &targethist_QCD_el_up, targetPair.first + channel + "_" + variable + "_weight_qcd_el_"+boostcat.first+"_up"); + //AddHistogramToTarget(sourcehist_el_down, &targethist_QCD_el_down, targetPair.first + channel + "_" + variable + "_weight_qcd_el_"+boostcat.first+"_down"); + AddHistogramToTarget(sourcehist_mu_up, &targethist_QCD_mu_up, targetPair.first + channel + "_" + variable + "_weight_qcd_mu_"+boostcat.first+"_up"); + //AddHistogramToTarget(sourcehist_mu_down, &targethist_QCD_mu_down, targetPair.first + channel + "_" + variable + "_weight_qcd_mu_"+boostcat.first+"_down"); + } + else{ + TH1D* sourcehist = m_outMngrHist->HistMngr()->GetTH1D( (source_reg + channel + "_" + variable).c_str() ); + AddHistogramToTarget(sourcehist, &targethist_QCD_el_up, targetPair.first + channel + "_" + variable + "_weight_qcd_el_"+boostcat.first+"_up"); + //AddHistogramToTarget(sourcehist, &targethist_QCD_el_down, targetPair.first + channel + "_" + variable + "_weight_qcd_el_"+boostcat.first+"_down"); + AddHistogramToTarget(sourcehist, &targethist_QCD_mu_up, targetPair.first + channel + "_" + variable + "_weight_qcd_mu_"+boostcat.first+"_up"); + //AddHistogramToTarget(sourcehist, &targethist_QCD_mu_down, targetPair.first + channel + "_" + variable + "_weight_qcd_mu_"+boostcat.first+"_down"); + } + }//source regions + + outfile->cd(); + if(targethist_QCD_el_up){ + HistManager::FinaliseTH1Bins(targethist_QCD_el_up); + targethist_QCD_el_up->Write(); + delete targethist_QCD_el_up; + } + /* if(targethist_QCD_el_down){ + targethist_QCD_el_down->Write(); + delete targethist_QCD_el_down; + }*/ + if(targethist_QCD_mu_up){ + HistManager::FinaliseTH1Bins(targethist_QCD_mu_up); + targethist_QCD_mu_up->Write(); + delete targethist_QCD_mu_up; + } + /*if(targethist_QCD_mu_down){ + targethist_QCD_mu_down->Write(); + delete targethist_QCD_mu_down; + }*/ + + }//QCD samples + + //================================================= QCD samples =========================================================== + + }//Boosted categories - }//lepton channels + }//lepton channels }//target regions diff --git a/Root/VLQ_OutputData.cxx b/Root/VLQ_OutputData.cxx index 61f437edbedbc987f3d719ca51348798a0d4ceb9..d2ddb7ddb5ce55fda1124bb626ea7a756f9f713b 100644 --- a/Root/VLQ_OutputData.cxx +++ b/Root/VLQ_OutputData.cxx @@ -153,6 +153,26 @@ o_is_ttbar(false) } jetTaggedType.clear(); + o_rcjets_truthmatched_n.clear(); + o_rcjets_truthmatched.clear(); + + std::vector < std::string > rcjetTruthType; + rcjetTruthType.push_back("truthTop"); + rcjetTruthType.push_back("truthZ"); + rcjetTruthType.push_back("truthW"); + rcjetTruthType.push_back("truthHiggs"); + rcjetTruthType.push_back("truthOther"); + + rcjetTruthType.push_back("truthTop_inMassWindow"); + rcjetTruthType.push_back("truthZ_inMassWindow"); + rcjetTruthType.push_back("truthW_inMassWindow"); + rcjetTruthType.push_back("truthHiggs_inMassWindow"); + for ( const std::string type : rcjetTruthType ){ + o_rcjets_truthmatched.insert( std::pair<std::string, AOVector*>( type, new AOVector() ) ); + o_rcjets_truthmatched_n.insert( std::pair<std::string, int>( type, 0 ) ); + } + rcjetTruthType.clear(); + o_el = new AOVector(); o_mu = new AOVector(); o_lep = new AOVector(); @@ -255,6 +275,7 @@ VLQ_OutputData::~VLQ_OutputData() ClearOutputData(); o_taggedjets_n.clear(); + o_rcjets_truthmatched_n.clear(); for(TriggerInfo* trig : o_trigger_list){ delete trig; } o_trigger_list.clear(); @@ -592,6 +613,13 @@ void VLQ_OutputData::ClearOutputData() obj_pair.second->clear(); } + for ( std::pair < std::string, int > component : o_rcjets_truthmatched_n ){ + o_rcjets_truthmatched_n.at(component.first) = 0; + } + + for(std::pair<std::string, AOVector*> obj_pair : o_rcjets_truthmatched){ + obj_pair.second->clear(); + } for ( std::pair < std::string, int > component : o_recoVLQ_n ){ o_recoVLQ_n.at(component.first) = 0; diff --git a/Root/VLQ_Selector.cxx b/Root/VLQ_Selector.cxx index e3e6c94a0475657e105ef9f086584d64ddde1410..cba4804c1b1eaa3bf4c6c584b08f3c0983276a05 100644 --- a/Root/VLQ_Selector.cxx +++ b/Root/VLQ_Selector.cxx @@ -120,7 +120,7 @@ bool VLQ_Selector::Init(){ m_sel_fwdjet_prop = new std::vector<SelProp>({ MakeSelProp("0fjex",c_0fjex), MakeSelProp("0fjin",c_0fjin), MakeSelProp("1fjex", c_1fjex), - MakeSelProp("1fjin", c_1fjin), MakeSelProp("2fjin", c_2fjin) }); + MakeSelProp("1fjin", c_1fjin), MakeSelProp("2fjin", c_2fjin) }); m_sel_bjet_prop = new std::vector<SelProp>({ MakeSelProp("0bex", c_0bex, ""), MakeSelProp("0bin", c_0bin, ""), MakeSelProp("1bin", c_1bin, "") @@ -133,7 +133,7 @@ bool VLQ_Selector::Init(){ m_sel_J_prop = new std::vector<SelProp>({ MakeSelProp("0Jex",c_0Jex), MakeSelProp("1Jex", c_1Jex), MakeSelProp("1Jin", c_1Jin), - MakeSelProp("2Jex", c_2Jex), MakeSelProp("2Jin", c_2Jin), MakeSelProp("3Jin", c_3Jin) }); + MakeSelProp("2Jex", c_2Jex), MakeSelProp("2Jin", c_2Jin), MakeSelProp("3Jin", c_3Jin) }); m_sel_M_prop = new std::vector<SelProp>({ MakeSelProp("0Mex",c_0Mex), MakeSelProp("1Mex", c_1Mex), MakeSelProp("1Min", c_1Min), MakeSelProp("2Min", c_2Min) }); @@ -148,7 +148,7 @@ bool VLQ_Selector::Init(){ MakeSelProp("0Hex",c_0Hex), MakeSelProp("1Hex", c_1Hex), MakeSelProp("1Hin", c_1Hin), MakeSelProp("2Hin", c_2Hin), MakeSelProp("0_1Hwin", c_0_1Hwin) }); m_sel_V_prop = new std::vector<SelProp>({ - MakeSelProp("0Vex",c_0Vex), MakeSelProp("1Vex", c_1Vex), MakeSelProp("1Vin", c_1Vin), MakeSelProp("2Vin", c_2Vin), MakeSelProp("1VTin", c_1VTin), MakeSelProp("2VTin", c_2VTin), MakeSelProp("1VLTin", c_1VLTin) }); + MakeSelProp("0Vex",c_0Vex), MakeSelProp("1Vex", c_1Vex), MakeSelProp("1Vin", c_1Vin), MakeSelProp("2Vin", c_2Vin) }); m_sel_TH_prop = new std::vector<SelProp>({ MakeSelProp("0THex",c_0THex), MakeSelProp("1THex", c_1THex), MakeSelProp("1THin", c_1THin), MakeSelProp("2THex", c_2THex), MakeSelProp("2THin", c_2THin), MakeSelProp("3THin", c_3THin) }); @@ -216,18 +216,18 @@ bool VLQ_Selector::Init(){ } for(const std::string& jet : v_jet_presel_svlq){ for(const std::string& bjet : v_bjet_presel_slvq){ - //if(!(jet=="6jin" && bjet=="1bin") && !(jet=="3_5jwin" && bjet=="2bin") && !(jet=="3jin" && bjet=="2bin")){ + if(!(jet=="6jin" && bjet=="1bin") && !(jet=="3_5jwin" && bjet=="2bin") && !(jet=="3jin" && bjet=="2bin")){ AddVLQSelection("c-1lep-"+jet+"-"+bjet, do_runop, do_syst, PRESEL); if(m_opt->DoSplitEMu()){ AddVLQSelection("c-1lep-"+jet+"-"+bjet+"_el", do_runop, do_syst, PRESEL); AddVLQSelection("c-1lep-"+jet+"-"+bjet+"_mu", do_runop, do_syst, PRESEL); }//split el/mu - //} + } }//bjet }//jet if(m_opt->DoExtendedPreselection()){ - std::vector<std::string> v_supr_svlq = {"0fjex", "1fjin", "1fjin-0Hex-0Vex", "1Hin-1LTin", "1Vin-1LTin"}; + std::vector<std::string> v_supr_svlq = {"0fjex", "1fjin", "1fjin-0Hex-0Vex"}; for(const std::string& supr : v_supr_svlq){ AddVLQSelection("c-1lep-3_5jwin-1bin-"+supr, do_runop, do_syst, PRESEL); AddVLQSelection("c-1lep-6jin-2bin-"+supr, do_runop, do_syst, PRESEL); @@ -304,6 +304,7 @@ bool VLQ_Selector::Init(){ */ // Signal regions + AddVLQSelection("c-1lep-3_5jwin-1_2bwin-1fjin-0Tex-0Hex-1Vin", do_runop, do_syst, SINGLEVLQ); //SR1 AddVLQSelection("c-1lep-3_5jwin-1_2bwin-1fjin-0LTex-0Hex-1Vin", do_runop, do_syst, SINGLEVLQ); //SR1-a AddVLQSelection("c-1lep-3_5jwin-1_2bwin-1fjin-0Tex-1Lin-0Hex-1Vin", do_runop, do_syst, SINGLEVLQ); //SR1-b ORIG @@ -326,7 +327,7 @@ bool VLQ_Selector::Init(){ AddVLQSelection("c-1lep-3_5jwin-4bin-1fjin-0Tex-1Hin-0Vex", do_runop, do_syst, SINGLEVLQ); //SR2 AddVLQSelection("c-1lep-3_5jwin-4bin-1fjin-0LTex-1Hin-0Vex", do_runop, do_syst, SINGLEVLQ); //SR2-a - AddVLQSelection("c-1lep-3_5jwin-4bin-1fjin-0Tex-1Lin-1Hin-0Vex", do_runop, do_syst, SINGLEVLQ); //SR2-b ORIG + AddVLQSelection("c-1lep-3_5jwin-4bin-1fjin-0Tex-1Lin-1Hin-0Vex", do_runop, do_syst, SINGLEVLQ); //SR2-b ORIG AddVLQSelection("c-1lep-6jin-1bex-1fjin-1LTin-0Hex-1Vin", do_runop, do_syst, SINGLEVLQ); //SR3 ORIG AddVLQSelection("c-1lep-6jin-1bex-1fjin-1Lex-0Tex-0Hex-1Vin", do_runop, do_syst, SINGLEVLQ); //SR3-a @@ -465,7 +466,7 @@ bool VLQ_Selector::Init(){ if(m_opt->DoNewSuperMergeBoost()){ std::vector<std::string> boostlist_supermerge = { - "0Tex-0Hex", "1THex", "2THin"//, "3THin" + "0Tex-0Hex", "1THex", "2THin"//, "3THin" }; if(m_opt->DoZeroLeptonAna()){ @@ -482,46 +483,46 @@ bool VLQ_Selector::Init(){ if(m_opt->DoNewMergeBoost()){ std::vector<std::string> boostlist_highstat = { - "2Tin-0_1Hwin", - "1Tex-1Hex", "1Tex-0Hex", - "0Tex-1Hex", "0Tex-0Hex", - "0Tin-2Hin" + "2Tin-0_1Hwin", + "1Tex-1Hex", "1Tex-0Hex", + "0Tex-1Hex", "0Tex-0Hex", + "0Tin-2Hin" }; std::vector<std::string> boostlist_lowstat = { - "2THin", "1Tex-0Hex", - "0Tex-1Hex", "0Tex-0Hex" + "2THin", "1Tex-0Hex", + "0Tex-1Hex", "0Tex-0Hex" }; if(m_opt->DoZeroLeptonAna()){ - /* + /* std::vector<std::string> boostlist_super_merge = { "3THin", "2THex", "1THex", "0THex" }; boostlist_0L_lowb.insert(boostlist_0L_lowb.end(), boostlist_super_merge.begin(), boostlist_super_merge.end()); boostlist_0L_highb.insert(boostlist_0L_highb.end(), boostlist_super_merge.begin(), boostlist_super_merge.end()); - */ + */ boostlist_0L_lowb.insert(boostlist_0L_lowb.end(), boostlist_highstat.begin(), boostlist_highstat.end()); boostlist_0L_valid_lowb.insert(boostlist_0L_valid_lowb.end(), boostlist_highstat.begin(), boostlist_highstat.end()); - boostlist_0L_valid_lowb.push_back("2THin"); + boostlist_0L_valid_lowb.push_back("2THin"); boostlist_0L_highb.insert(boostlist_0L_highb.end(), boostlist_lowstat.begin(), boostlist_lowstat.end()); } if(m_opt->DoOneLeptonAna()){ - /* - std::vector<std::string> boostlist_1L_merge = { - "2Tin-0_1Hwin", - "1Tex-1Hex", "1Tex-0Hex", - "0Tex-1Hex", "0Tex-0Hex", - "0Tin-2Hin" - }; + /* + std::vector<std::string> boostlist_1L_merge = { + "2Tin-0_1Hwin", + "1Tex-1Hex", "1Tex-0Hex", + "0Tex-1Hex", "0Tex-0Hex", + "0Tin-2Hin" + }; std::vector<std::string> boostlist_1L_merge_valid_4b = { "2THin", "1Tex-0Hex", "0Tex-1Hex", "0Tex-0Hex" }; - */ + */ boostlist_1L_default.insert(boostlist_1L_default.end(), boostlist_highstat.begin(), boostlist_highstat.end()); boostlist_1L_valid_4b.insert(boostlist_1L_valid_4b.end(), boostlist_lowstat.begin(), boostlist_lowstat.end()); } @@ -560,27 +561,27 @@ bool VLQ_Selector::Init(){ for( const std::string& bjet : bjet_analist ){ const std::set<std::string>* boostset_0L = NULL; - /* + /* if( (bjet == "2bex") || (reg_type == FIT && bjet == "3bex") ){ boostset_0L = &boostset_0L_lowb; } else if( (reg_type == VALIDATION && bjet == "3bex") || (bjet == "4bin") ) { boostset_0L = &boostset_0L_highb; } - */ - if(bjet=="2bex"){ boostset_0L = &boostset_0L_valid_lowb; } - else if( (bjet=="3bex") && (reg_type == FIT) ){ boostset_0L = &boostset_0L_lowb; } - else if( (bjet=="4bin") || ((reg_type == VALIDATION) && (bjet == "3bex")) ){ boostset_0L = &boostset_0L_highb; } - /* + */ + if(bjet=="2bex"){ boostset_0L = &boostset_0L_valid_lowb; } + else if( (bjet=="3bex") && (reg_type == FIT) ){ boostset_0L = &boostset_0L_lowb; } + else if( (bjet=="4bin") || ((reg_type == VALIDATION) && (bjet == "3bex")) ){ boostset_0L = &boostset_0L_highb; } + /* if( (reg_type == FIT) && (bjet=="2bex" || bjet == "3bex") ){ boostset_0L = &boostset_0L_lowb; } else if( (reg_type == VALIDATION) && (bjet == "2bex") ) { boostset_0L = &boostset_0L_valid_lowb; } - else if( ( (reg_type == VALIDATION) && (bjet == "3bex") ) || (bjet == "4bin") ) { boostset_0L = &boostset_0L_highb; } + else if( ( (reg_type == VALIDATION) && (bjet == "3bex") ) || (bjet == "4bin") ) { boostset_0L = &boostset_0L_highb; } else{ continue; } //FIXME: No low-b analysis regions right now - */ + */ AddVLQSelection("c-0lep-"+jet+"-"+bjet, false/*do_runop*/, false/*do_syst*/, PRESEL); for( const std::string& boost : *boostset_0L ){ for(const std::string& mtb : ch_mtb ){ AddVLQSelection("c-0lep-"+boost+"-"+jet+"-"+bjet+mtb, do_runop, do_syst, reg_type); - if(m_opt->ApplyMetSignificanceCut() && (bjet=="2bex") ){ - AddVLQSelection("c-0lep-"+boost+"-"+jet+"-"+bjet+mtb+"-HighMetSig", do_runop, do_syst, reg_type); - }//metsig + if(m_opt->ApplyMetSignificanceCut() && (bjet=="2bex") ){ + AddVLQSelection("c-0lep-"+boost+"-"+jet+"-"+bjet+mtb+"-HighMetSig", do_runop, do_syst, reg_type); + }//metsig }//mtb split }//boost list @@ -716,8 +717,8 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) //=============== Lepton part ===================== for(SelProp& lepprop : *m_sel_lep_prop){ if(lepprop.name == _parts_){ - sprop_lep = &lepprop; - found = true; n_nodes++; break; + sprop_lep = &lepprop; + found = true; n_nodes++; break; } } if(found) continue; @@ -725,8 +726,8 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) //=============== Jet part ======================== for(SelProp& jetprop : *m_sel_jet_prop){ if(jetprop.name == _parts_){ - sprop_jet = &jetprop; - found = true; n_nodes++; break; + sprop_jet = &jetprop; + found = true; n_nodes++; break; } } if(found) continue; @@ -743,8 +744,8 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) //=============== B-jet part ======================== for(SelProp& bjetprop : *m_sel_bjet_prop){ if(bjetprop.name == _parts_){ - sprop_bjet = &bjetprop; - found = true; n_nodes++; break; + sprop_bjet = &bjetprop; + found = true; n_nodes++; break; } } if(found) continue; @@ -752,8 +753,8 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) //=============== J-tag part ======================== for(SelProp& Jprop : *m_sel_J_prop){ if(Jprop.name == _parts_){ - sprop_J = &Jprop; - found = true; n_nodes++; break; + sprop_J = &Jprop; + found = true; n_nodes++; break; } } if(found) continue; @@ -761,8 +762,8 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) //=============== M-tag part ======================== for(SelProp& Mprop : *m_sel_M_prop){ if(Mprop.name == _parts_){ - sprop_M = &Mprop; - found = true; n_nodes++; break; + sprop_M = &Mprop; + found = true; n_nodes++; break; } } if(found) continue; @@ -770,8 +771,8 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) //=============== T-tag part ======================== for(SelProp& Tprop : *m_sel_T_prop){ if(Tprop.name == _parts_){ - sprop_T = &Tprop; - found = true; n_nodes++; break; + sprop_T = &Tprop; + found = true; n_nodes++; break; } } if(found) continue; @@ -779,8 +780,8 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) //=============== Leptonic T-tag part =============== for(SelProp& Lprop : *m_sel_L_prop){ if(Lprop.name == _parts_){ - sprop_L = &Lprop; - found = true; n_nodes++; break; + sprop_L = &Lprop; + found = true; n_nodes++; break; } } if(found) continue; @@ -788,8 +789,8 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) //=============== H-tag part ======================== for(SelProp& Hprop : *m_sel_H_prop){ if(Hprop.name == _parts_){ - sprop_H = &Hprop; - found = true; n_nodes++; break; + sprop_H = &Hprop; + found = true; n_nodes++; break; } } if(found) continue; @@ -797,18 +798,17 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) //=============== V-tag part ======================== for(SelProp& Vprop : *m_sel_V_prop){ if(Vprop.name == _parts_){ - sprop_V = &Vprop; - found = true; n_nodes++; break; + sprop_V = &Vprop; + found = true; n_nodes++; break; } } if(found) continue; - //=============== TH-tag part ======================== for(SelProp& THprop : *m_sel_TH_prop){ if(THprop.name == _parts_){ - sprop_TH = &THprop; - found = true; n_nodes++; break; + sprop_TH = &THprop; + found = true; n_nodes++; break; } } if(found) continue; @@ -817,8 +817,8 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) //=============== LT-tag part ======================== for(SelProp& LTprop : *m_sel_LT_prop){ if(LTprop.name == _parts_){ - sprop_LT = <prop; - found = true; n_nodes++; break; + sprop_LT = <prop; + found = true; n_nodes++; break; } } if(found) continue; @@ -826,8 +826,8 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) //=============== VT-tag part ======================== for(SelProp& VTprop : *m_sel_VT_prop){ if(VTprop.name == _parts_){ - sprop_VT = &VTprop; - found = true; n_nodes++; break; + sprop_VT = &VTprop; + found = true; n_nodes++; break; } } if(found) continue; @@ -835,19 +835,17 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) //=============== VLT-tag part ======================== for(SelProp& VLTprop : *m_sel_VLT_prop){ if(VLTprop.name == _parts_){ - sprop_VLT = &VLTprop; - found = true; n_nodes++; break; + sprop_VLT = &VLTprop; + found = true; n_nodes++; break; } } if(found) continue; - - //=============== Mbb-split part ======================== for(SelProp& Mbbprop : *m_sel_Mbb_prop){ if(Mbbprop.name == _parts_){ - sprop_Mbb = &Mbbprop; - found = true; n_nodes++; break; + sprop_Mbb = &Mbbprop; + found = true; n_nodes++; break; } } if(found) continue; @@ -855,15 +853,15 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) //=============== Mtb-split part ======================== for(SelProp& Mtbprop : *m_sel_Mtb_prop){ if(Mtbprop.name == _parts_){ - sprop_Mtb = &Mtbprop; - found = true; n_nodes++; break; + sprop_Mtb = &Mtbprop; + found = true; n_nodes++; break; } } //=============== Metsig-split part ======================== for(SelProp& MetSigprop : *m_sel_MetSig_prop){ if(MetSigprop.name == _parts_){ - sprop_MetSig = &MetSigprop; - found = true; n_nodes++; break; + sprop_MetSig = &MetSigprop; + found = true; n_nodes++; break; } } if(found) continue; @@ -908,9 +906,8 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) } }//el/mu channel splitting is done last else{ - if( !(sprop_fwdjet || sprop_bjet || sprop_J || sprop_M || sprop_T || sprop_L || sprop_H || sprop_V - || sprop_TH || sprop_LT || sprop_VT || sprop_VLT - ||sprop_Mbb || sprop_Mtb || sprop_MetSig) ){ + if( !(sprop_fwdjet || sprop_bjet || sprop_J || sprop_M || sprop_T || sprop_L || sprop_H || sprop_V + || sprop_TH || sprop_LT || sprop_VT || sprop_VLT ||sprop_Mbb || sprop_Mtb || sprop_MetSig) ){ if(sprop_jet->primanc_name.empty()){ SelectorBase::AddAncestors(*sel, {sprop_lep->index, sprop_jet->index}, sprop_lep->index); @@ -922,12 +919,11 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) }//Lep + jet else if( !(sprop_fwdjet || sprop_J || sprop_M || sprop_T || sprop_L || sprop_H || sprop_V - || sprop_TH || sprop_LT || sprop_VT || sprop_VLT - || sprop_Mbb || sprop_Mtb || sprop_MetSig) ){ + || sprop_TH || sprop_LT || sprop_VT || sprop_VLT || sprop_Mbb || sprop_Mtb || sprop_MetSig) ){ if(sprop_bjet->primanc_name.empty()){ AddAncestor(*sel, "c-"+sprop_lep->name+"-"+sprop_jet->name, true); - SelectorBase::AddAncestor(*sel, sprop_bjet->index); + SelectorBase::AddAncestor(*sel, sprop_bjet->index); } else{ AddPrimary(*sel, "c-"+sprop_lep->name+"-"+sprop_jet->name+"-"+sprop_bjet->primanc_name); @@ -958,59 +954,59 @@ Selection* VLQ_Selector::MakeSelection(const int index, const std::string& name) if(sprop_TH){s_boost = sprop_TH->name; } else{ - if(sprop_T){ - if(!s_boost.empty()){ s_boost += "-"; } - s_boost += sprop_T->name; - } - - if(sprop_L){ - if(!s_boost.empty()){ s_boost += "-"; } - s_boost += sprop_T->name; - } - - if(sprop_H){ - if(!s_boost.empty()){ s_boost += "-"; } - s_boost += sprop_H->name; - } - - if(sprop_V){ - if(!s_boost.empty()){ s_boost += "-"; } - s_boost += sprop_V->name; - } - - if(sprop_LT){ - if(!s_boost.empty()){ s_boost += "-"; } - s_boost += sprop_LT->name; - } - - if(sprop_VT){ - if(!s_boost.empty()){ s_boost += "-"; } - s_boost += sprop_VT->name; - } - - if(sprop_VLT){ - if(!s_boost.empty()){ s_boost += "-"; } - s_boost += sprop_VLT->name; - } + if(sprop_T){ + if(!s_boost.empty()){ s_boost += "-"; } + s_boost += sprop_T->name; + } + + if(sprop_L){ + if(!s_boost.empty()){ s_boost += "-"; } + s_boost += sprop_T->name; + } + + if(sprop_H){ + if(!s_boost.empty()){ s_boost += "-"; } + s_boost += sprop_H->name; + } + + if(sprop_V){ + if(!s_boost.empty()){ s_boost += "-"; } + s_boost += sprop_V->name; + } + + if(sprop_LT){ + if(!s_boost.empty()){ s_boost += "-"; } + s_boost += sprop_LT->name; + } + + if(sprop_VT){ + if(!s_boost.empty()){ s_boost += "-"; } + s_boost += sprop_VT->name; + } + + if(sprop_VLT){ + if(!s_boost.empty()){ s_boost += "-"; } + s_boost += sprop_VLT->name; + } } if(!sprop_MetSig){ - if(sprop_Mbb){ - AddAncestor(*sel, "c-" + sprop_lep->name + "-" + s_boost + "-" + sprop_jet->name + "-" + sprop_bjet->name, true); - SelectorBase::AddAncestor(*sel, sprop_Mbb->index); - } - else if(sprop_Mtb){ - AddAncestor(*sel, "c-" + sprop_lep->name + "-" + s_boost + "-" + sprop_jet->name + "-" + sprop_bjet->name, true); - SelectorBase::AddAncestor(*sel, sprop_Mtb->index); - //if( m_opt->ApplyMetSignificanceCut() && (sprop_bjet->name == "2bex") && (sprop_Mtb->name == "LowMtbmin") ){ sel->AddCut("met_sig_cut",&(m_outData->o_met_sig), 10.); } - } + if(sprop_Mbb){ + AddAncestor(*sel, "c-" + sprop_lep->name + "-" + s_boost + "-" + sprop_jet->name + "-" + sprop_bjet->name, true); + SelectorBase::AddAncestor(*sel, sprop_Mbb->index); + } + else if(sprop_Mtb){ + AddAncestor(*sel, "c-" + sprop_lep->name + "-" + s_boost + "-" + sprop_jet->name + "-" + sprop_bjet->name, true); + SelectorBase::AddAncestor(*sel, sprop_Mtb->index); + //if( m_opt->ApplyMetSignificanceCut() && (sprop_bjet->name == "2bex") && (sprop_Mtb->name == "LowMtbmin") ){ sel->AddCut("met_sig_cut",&(m_outData->o_met_sig), 10.); } + } }//Lep-jet-bjet-boost-mt[b]b else{ - std::string msplit = ""; - if(sprop_Mbb){ msplit = sprop_Mbb->name; } - else if(sprop_Mtb){ msplit = sprop_Mtb->name; } - AddAncestor(*sel, "c-" + sprop_lep->name + "-" + s_boost + "-" + sprop_jet->name + "-" + sprop_bjet->name + "-" + msplit, true); - SelectorBase::AddAncestor(*sel, sprop_MetSig->index); + std::string msplit = ""; + if(sprop_Mbb){ msplit = sprop_Mbb->name; } + else if(sprop_Mtb){ msplit = sprop_Mtb->name; } + AddAncestor(*sel, "c-" + sprop_lep->name + "-" + s_boost + "-" + sprop_jet->name + "-" + sprop_bjet->name + "-" + msplit, true); + SelectorBase::AddAncestor(*sel, sprop_MetSig->index); }//Lep-jet-bjet-boost-mt[b]b-metsig }//post-boost diff --git a/VLQAnalysis/VLQ_Analysis_Data2015.h b/VLQAnalysis/VLQ_Analysis_Data2015.h index 17722678d6949ea855851360b26b0007df821773..393c76c39e30321832e8569fc3c1891ebe91b0cb 100644 --- a/VLQAnalysis/VLQ_Analysis_Data2015.h +++ b/VLQAnalysis/VLQ_Analysis_Data2015.h @@ -54,6 +54,7 @@ private: VLQ_Selector *m_selector; std::map < std::string, std::vector < std::string > > m_channels; std::vector < std::string > m_topTaggers; + std::vector < std::string > m_truthRCTypes; std::map < int, int > m_map_region_enum_index; };//end of class VLQ_Analysis_Data2015 diff --git a/VLQAnalysis/VLQ_OutputData.h b/VLQAnalysis/VLQ_OutputData.h index e40af9c5c64c6852922938a1dea5cf061b4f5baa..eed0149656d32b4a306427ec70cb8c9a7ac3a083 100644 --- a/VLQAnalysis/VLQ_OutputData.h +++ b/VLQAnalysis/VLQ_OutputData.h @@ -147,6 +147,9 @@ public: std::vector< AnalysisObject* >* o_bjets_lowb_3b; std::vector< AnalysisObject* >* o_bjets_lowb_4b; + std::map< std::string, int > o_rcjets_truthmatched_n; + std::map< std::string, std::vector< AnalysisObject* >* > o_rcjets_truthmatched; + // // Lepton variables // diff --git a/VLQAnalysis/VLQ_Selector.h b/VLQAnalysis/VLQ_Selector.h index 4897ad9e4d27550ab59f8c049060bb27b9a475e2..654e8a603f9470120cc8b36d8d3be55ef2a64ec4 100644 --- a/VLQAnalysis/VLQ_Selector.h +++ b/VLQAnalysis/VLQ_Selector.h @@ -55,10 +55,10 @@ public: c_0THex, c_1THex, c_1THin, c_2THex, c_2THin, c_3THin, /*L+T multiplicities*/ c_0LTex, c_1LTex, c_1LTin, c_2LTin, - /*V+T multiplicities*/ - c_0VTex, c_1VTex, c_1VTin, c_2VTin, - /*V+L+T multiplicities*/ - c_0VLTex, c_1VLTex, c_1VLTin, c_2VLTin, + /*V+T multiplicities*/ + c_0VTex, c_1VTex, c_1VTin, c_2VTin, + /*V+L+T multiplicities*/ + c_0VLTex, c_1VLTex, c_1VLTin, c_2VLTin, /*Kinematic cuts*/ c_LowMtbmin, c_HighMtbmin, c_LowMbb, c_HighMbb, c_HighMetSig, c_LowMetSig, TOPSEL_MAX }; @@ -114,7 +114,6 @@ public: std::vector<SelProp>* m_sel_L_prop; std::vector<SelProp>* m_sel_H_prop; std::vector<SelProp>* m_sel_V_prop; - std::vector<SelProp>* m_sel_TH_prop; std::vector<SelProp>* m_sel_LT_prop; std::vector<SelProp>* m_sel_VT_prop; diff --git a/python/Make2DPlots_IFP.py b/python/Make2DPlots_IFP.py new file mode 100644 index 0000000000000000000000000000000000000000..0a0a7b71b9657d5bb28d83d75537a09ac25712fc --- /dev/null +++ b/python/Make2DPlots_IFP.py @@ -0,0 +1,289 @@ +from ROOT import * +import sys +import subprocess +import re +import os + +samples = map(str, sys.argv[-3].strip('[]').split(',')) +list_key = sys.argv[-2] + +gStyle.SetOptStat(0) +gStyle.SetPalette(kBird) + +noRegionsWithKeys = False#['1lep'] +onlyVariablesWithKeys = ['_vs_'] +noVariablesWithKeys = False +plotTruthVarsTogether = True +plotRCTypesTogether = True + +plotdir = "IFP_PNG/Plots_"+list_key+"/" + +os.system("mkdir -p "+plotdir) + +def GetRegionLabel(region): + legend = "" + if region == "call": + legend = "No selection" + if '1lep' in region: + legend+='1l, ' + elif '0lep' in region: + legend+='0l, ' + if 'jex' in region: + if not region[region.index('jex')-1]=='f': + legend+=region[region.index('jex')-1]+'j' + if 'jin' in region: + if not region[region.index('jin')-1]=='f': + legend+='#geq'+region[region.index('jin')-1]+'j' + if 'jwin' in region: + legend+=region[region.index('jwin')-3]+'-'+region[region.index('jwin')-1]+'j' + if 'bex' in region: + legend+=', '+region[region.index('bex')-1]+'b' + elif 'bin' in region: + legend+=', #geq'+region[region.index('bin')-1]+'b' + elif 'bwin' in region: + legend+=', '+region[region.index('bwin')-3]+'-'+region[region.index('bwin')-1]+'b' + if 'fjex' in region: + legend+=', '+region[region.index('fjex')-1]+'fj' + elif 'fjin' in region: + legend+=', #geq'+region[region.index('fjin')-1]+'fj' + if 'THin' in region: + legend+=', #geq'+region[region.index('THin')-1]+'h-t' + elif 'Hin' in region: + legend+=', #geq'+region[region.index('Hin')-1]+'h' + elif 'Hex' in region: + legend+=', '+region[region.index('Hex')-1]+'h' + if 'Vex' in region: + legend+=', '+region[region.index('Vex')-1]+'v' + elif 'Vin' in region: + legend+=', #geq'+region[region.index('Vin')-1]+'v' + if 'Tin' in region and region[region.index('Tin')-1].isdigit(): + legend+=', #geq'+region[region.index('Tin')-1]+'t' + elif 'Tex' in region and region[region.index('Tex')-1].isdigit(): + legend+=', '+region[region.index('Tex')-1]+'t' + if 'VTin' in region: + legend+=', #geq'+region[region.index('VTin')-1]+'v-t' + if 'LTex' in region: + legend+=', #geq'+region[region.index('LTex')-1]+'lt' + elif 'LTin' in region: + legend+=', #geq'+region[region.index('LTin')-1]+'lt' + if 'LTTin' in region: + legend+=', #geq'+region[region.index('LTTin')-1]+'lt-t' + + if 'fj' in legend: + legend = "#splitline{%s}{%s}"%(legend[:legend.index("fj, ")+3],legend[legend.index("fj, ")+4:]) + + return legend + +def GetLegendLabel(truthType): + if truthType == "truthTop": + return "Top matched" + if truthType == "truthW": + return "W matched" + if truthType == "truthZ": + return "Z matched" + if truthType == "truthHiggs": + return "Higgs matched" + if truthType == "truthOther": + return "Unmatched" + +def GetRegionsAndVariables(file,prunevariables=False,noRegionsWithKeys=False,noVariablesWithKeys=False,onlyVariablesWithKeys=False): + lsrootpath = "/lsroot-00-01-03/bin/lsRoot" + if prunevariables: + proc = subprocess.Popen([".%s /dir %s"%(lsrootpath,file)], stdout=subprocess.PIPE, shell=True) + else: + proc = subprocess.Popen([".%s %s"%(lsrootpath,file)], stdout=subprocess.PIPE, shell=True) + (out, err) = proc.communicate() + contents = out.split() + regions,variables = [],[] + for content in contents: + if prunevariables and inputDir in content: + variables.append([]) + if (len(content) < 9) or (not content.startswith('c')): continue + if (not content.startswith('call') and not content[1].isdigit()): continue + ind = [u.start() for u in re.finditer('_', content)] + splitind = [i for i in ind if not content[i-1].isdigit() and not content[i+1].isdigit()][0] + region = content[:splitind] + variable = content[splitind+1:] + if not region in regions: + regions.append(region) + if prunevariables: + if not variable in variables[-1]: + variables[-1].append(variable) + elif not variable in variables: + variables.append(variable) + if prunevariables: + variables = set.intersection(*map(set,variables)) + + if noVariablesWithKeys: + variables = [variable for variable in variables if not any(key in variable for key in noVariablesWithKeys)] + if onlyVariablesWithKeys: + variables = [variable for variable in variables if all(key in variable for key in onlyVariablesWithKeys)] + if noRegionsWithKeys: + regions = [region for region in regions if not any(key in region for key in noRegionsWithKeys)] + + print "Doing regions:" + for reg in regions: + print reg + print "\nDoing %s variables"%len(variables) + + # regionsvariables = [] + # for region in regions: + # for variable in variables: + # regionsvariables.append(region+"_"+variable) + return regions,variables + +""" + +for sample in samples: + + filename = "Rootfiles_Plots_"+list_key+"/"+sample+".root" + print "\nSample -- %s"%sample + print "File name -- %s\n"%filename + + f = TFile(filename,'read') + + regions,variables = GetRegionsAndVariables(filename,noRegionsWithKeys=noRegionsWithKeys,noVariablesWithKeys=noVariablesWithKeys,onlyVariablesWithKeys=onlyVariablesWithKeys) + + regionsvariables = [] + for region in regions: + for variable in variables: + regionsvariables.append(region+"_"+variable) + + for var in regionsvariables: + print var + h = f.Get(var) + c = TCanvas(h.GetName(),"",0,0,800,600) + # print c.GetName() + h.Draw('colz') + c.Print("IFP_PNG/Plots_"+list_key+"/canv_"+var+"_"+sample+".png") + c.Print("IFP_PDF/Plots_"+list_key+"/canv_"+var+"_"+sample+".pdf") + c.Clear() + +""" + +if plotTruthVarsTogether: + + gStyle.SetPadTopMargin(0.05) + gStyle.SetPadRightMargin(0.21) + gStyle.SetPadBottomMargin(0.12) + gStyle.SetPadLeftMargin(0.08) + gStyle.SetOptStat(0) + gStyle.SetStatStyle(0) + gStyle.SetTitleStyle(0) + gStyle.SetStatStyle(0) + gStyle.SetTitleStyle(0) + gStyle.SetCanvasBorderSize(0) + gStyle.SetFrameBorderSize(0) + gStyle.SetLegendBorderSize(0) + gStyle.SetTitleBorderSize(0) + + print "Plotting truth variables together" + + truthTypes = ['truthOther','truthW','truthZ','truthHiggs','truthTop'] + truthcolors = [kOrange-2,kTeal+9,kOrange+7,kAzure+7,kMagenta-3] + + hdict = {} + for truthType in truthTypes: + hdict[truthType] = {} + + for sample in samples: + + os.system("mkdir -p "+plotdir+sample) + + filename = "Rootfiles_Plots_"+list_key+"/"+sample+".root" + print "\nSample -- %s"%sample + print "File name -- %s\n"%filename + + f = TFile(filename,'read') + + regions,variables = GetRegionsAndVariables(filename,noRegionsWithKeys=noRegionsWithKeys,noVariablesWithKeys=noVariablesWithKeys,onlyVariablesWithKeys=onlyVariablesWithKeys) + + variables_clean = [] + + for region in regions: + + os.system("mkdir -p "+plotdir+sample+"/"+region) + + for truthType in truthTypes: + + if truthType=='truthZ' and not 'Zt' in sample: + continue + if truthType=='truthHiggs' and not 'Ht' in sample: + continue + + hdict[truthType][region] = {} + for variable in variables: + if truthType in variable: + hdict[truthType][region][variable] = f.Get(region+'_'+variable) + variables_clean.append(variable.replace(truthType+'_','TYPE_')) + + variables_clean = list(set(variables_clean)) + + for region in regions: + for variable in variables_clean: + hlist = [] + + c = TCanvas(region+'_'+variable.replace('TYPE_',''),"",0,0,1400,900) + leg = TLegend(0.805,0.5,1.,0.92) + leg.SetHeader(GetRegionLabel(region)) + leg.SetTextSize(0.037) + leg.AddEntry(0,"","") + + for n,truthType in enumerate(truthTypes): + + if truthType=='truthZ' and not 'Zt' in sample: + continue + if truthType=='truthHiggs' and not 'Ht' in sample: + continue + + hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].SetLineColor(truthcolors[n]) + hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].SetLineWidth(3) + hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].SetFillColor(0) + hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].SetTitle("") + + scale = hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].Integral() + try: + hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].Scale(1./scale) + except ZeroDivisionError: + pass + + hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].GetXaxis().SetTitleOffset(1.25) + + xtitle = hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].GetXaxis().GetTitle() + ytitle = hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].GetYaxis().GetTitle() + + xtitle = xtitle.replace("unmatched ","") + ytitle = ytitle.replace("unmatched ","") + + hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].GetXaxis().SetTitle(xtitle) + hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].GetYaxis().SetTitle(ytitle) + + hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].GetXaxis().SetTitleSize(0.04) + hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].GetYaxis().SetTitleSize(0.04) + hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].GetXaxis().SetLabelSize(0.035) + hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].GetYaxis().SetLabelSize(0.035) + + hdict[truthType][region][variable.replace('TYPE_',truthType+'_')].Draw('box same') + leg.AddEntry(hdict[truthType][region][variable.replace('TYPE_',truthType+'_')],GetLegendLabel(truthType),'f') + + leg.Draw() + + printInfo = TLatex() + printInfo.SetNDC() + printInfo.SetTextFont(72) + printInfo.SetTextSize(0.043) + printInfo.DrawLatex(0.12, 0.88, "#scale[0.9]{ATLAS}") + printInfo.SetTextFont(42) + printInfo.DrawLatex(0.21, 0.88, "#scale[0.9]{Internal}") + printInfo.DrawLatex(0.12, 0.82, "#sqrt{s} = 13 TeV, 139 fb^{-1}") + printInfo.SetTextFont(41) + # printInfo.DrawLatex(0.12, 0.77, "%s"%GetRegionLabel(region)) + + c.Print("IFP_PNG/Plots_"+list_key+"/"+sample+"/"+region+"/canv_"+region+'_'+variable.replace('TYPE_','')+".png") + # c.Print("IFP_PDF/Plots_"+list_key+"/canv_"+region+'_'+variable.replace('TYPE_','')+'_'+sample+".pdf") + c.Clear() + + + + + diff --git a/python/ReadTRExFitterResults.py b/python/ReadTRExFitterResults.py new file mode 100644 index 0000000000000000000000000000000000000000..06effd078acc689df9e85953801dc0d566b77d08 --- /dev/null +++ b/python/ReadTRExFitterResults.py @@ -0,0 +1,272 @@ +from ROOT import * + +gStyle.SetPadTopMargin(0.07) +gStyle.SetPadRightMargin(0.01) +gStyle.SetPadBottomMargin(0.12) +gStyle.SetPadLeftMargin(0.095) +gStyle.SetOptStat(0) +gStyle.SetStatStyle(0) +gStyle.SetTitleStyle(0) +gStyle.SetCanvasBorderSize(0) +gStyle.SetFrameBorderSize(0) +gStyle.SetLegendBorderSize(0) +gStyle.SetTitleBorderSize(0) + +drawAllPlots = False +findBestConfigOverall = False +findBestConfigPerSignal = True + +# not currently implemented fully +draw1s = False +draw2s = False + +# base path +# currently configured to expect <base path>_<alg>_<coll>_<var> +resultpath = '/nfs/at3/scratch2/tvdaalen/TRExFitter_WorkArea/SingleVLQ_RCStudies/singleVLQ_RC_studies_configFiles_ref2_' + +# configs to loop over +algs = ['pT_ref_N_stan','pT_stan_N_stan','P2'] +colls = ['RCJ_r10pt05', 'VR_rho450', 'VR_rho500', 'VR_rho550', 'VR_rho600', 'VR_rho650'] +vars=['meff','recoVLQ_m','recoVLQ_redm'] + +# sample names, colors, styles +sampledict = {"T(#rightarrowHt)qb": [['sVLQ_WTHt11K03','sVLQ_WTHt16K05','sVLQ_WTHt20K05'],kGreen+2], + "T(#rightarrowHt)qt":[['sVLQ_ZTHt11K05','sVLQ_ZTHt16K05','sVLQ_ZTHt20K05'],kOrange+7], + "T(#rightarrowZt)qt":[['sVLQ_ZTZt11K05','sVLQ_ZTZt16K05'],kPink-3], + "T(#rightarrowZt)qb":[['sVLQ_WTZt11K03','sVLQ_WTZt16K05','sVLQ_WTZt20K05'],kBlue+1]} +linestyles = [1,2,3,6,9,7,10,5] + +# +# FUNCTIONS +# + +def getSpecificLimit(fn): + f = TFile(fn,'read') + h = f.Get("limit") + return 0.1*h.GetBinContent(1) + +def getLimits(fntemplate=False,samples=False,draw1s=False,draw2s=False): + xs,ys = [],[] + for n,sample in enumerate(samples): + fn = fntemplate.replace('SIGNAL',sample) + f = TFile(fn,'read') + h = f.Get("limit") + limit = 0.1*h.GetBinContent(1) + limitplus1s = 0.1*h.GetBinContent(4) + limitmin1s = 0.1*h.GetBinContent(5) + limitplus2s = 0.1*h.GetBinContent(3) + limitmin2s = 0.1*h.GetBinContent(6) + if n==0: + x = 1100. + elif n==1: + x = 1600. + elif n==2: + x = 2000. + else: + print "wrong" + return + xs.append(x) + ys.append(limit) + if draw1s: + yplus1s.append(limitplus1s) + ymin1s.append(limitmin1s) + if draw2s: + yplus2s.append(limitplus2s) + ymin2s.append(limitmin2s) + out = [xs,ys] + if draw1s: + out.append(yplus1s,ymin1s) + if draw2s: + out.append(yplus2s,ymin2s) + return out + +def getLimitTGraph(x,y): + tlimit=TGraphAsymmErrors(len(x)) + for n in range(len(x)): + tlimit.SetPoint(n,x[n],y[n]) + return tlimit + +def setLimitStyle(TGlimit): + TGlimit.GetXaxis().SetTitle("Mass [GeV]") + TGlimit.GetYaxis().SetTitle("#sigma #times BR [pb]") + TGlimit.GetYaxis().SetTitleOffset(1.05) + TGlimit.GetXaxis().SetTitleOffset(1.2) + TGlimit.GetXaxis().SetTitleSize(0.045) + TGlimit.GetYaxis().SetTitleSize(0.045) + TGlimit.GetXaxis().SetLabelSize(0.035) + TGlimit.GetYaxis().SetLabelSize(0.035) + +def add1sLimits(TGlimit,tlimitplus1s,tlimitmin1s): + TGlimit.Add(tlimitplus1s) + TGlimit.Add(tlimitmin1s) + return TGlimit + +def add2sLimits(TGlimit,tlimitplus2s,tlimitmin2s): + TGlimit.Add(tlimitplus2s) + TGlimit.Add(tlimitmin2s) + return TGlimit + +def printLimitCanvas(resultpath=False,sampledict=False,compare='colls',colls=False,vars=False,algs=False,coll='RCJ_r10pt05',alg='P2',var='meff',draw1s=False,draw2s=False): + linestyles = [1,2,3,6,9,7,10,5] + for sampletype in sampledict.keys(): + c1 = TCanvas("c1",'',10,10,1000,750) + c1.SetGrid() + if sampletype=="T(#rightarrowHt)qb": + leg = TLegend(0.13,0.65,0.43,0.925) + else: + leg = TLegend(0.7,0.65,0.988,0.925) + leg.SetTextSize(0.045) + TGlimit = TMultiGraph() + if compare=='colls': + for i,coll in enumerate(colls): + fntemplate = resultpath+alg+'_'+coll+'_'+var+'/Results/BONLY__SIGNAL__/Limits/BONLY__SIGNAL__.root' + inlist = getLimits(fntemplate=fntemplate,samples=sampledict[sampletype][0]) + tlimitlist = inlist[0:1] + if draw1s and draw2s: + plusmin1s = inlist[2:3] + plusmin2s = inlist[4:5] + elif draw1s: + plusmin1s = inlist[2:3] + elif draw2s: + plusmin2s = inlist[2:3] + + tlimit = getLimitTGraph(*tlimitlist) + tlimit.SetLineColor(sampledict[sampletype][1]) + tlimit.SetLineStyle(linestyles[i]) + tlimit.SetLineWidth(3) + TGlimit.Add(tlimit) + leg.AddEntry(tlimit,coll,"l") + TGlimit.Draw('al3') + TGlimit.SetTitle(sampletype+', alg. = '+alg+', discr. = '+var) + setLimitStyle(TGlimit) + leg.Draw() + c1.Print("Plots_TRExLimits/%s_ref2_limits_comp-colls_%s_%s.png"%(sampledict[sampletype][0][0][5:9],alg,var)) + c1.Print("Plots_TRExLimits/%s_ref2_limits_comp-colls_%s_%s.pdf"%(sampledict[sampletype][0][0][5:9],alg,var)) + c1.Clear() + del c1 + + if compare=='algs': + for i,alg in enumerate(algs): + fntemplate = resultpath+alg+'_'+coll+'_'+var+'/Results/BONLY__SIGNAL__/Limits/BONLY__SIGNAL__.root' + tlimitlist = getLimits(fntemplate=fntemplate,samples=sampledict[sampletype][0]) + tlimit = getLimitTGraph(*tlimitlist) + tlimit.SetLineColor(sampledict[sampletype][1]) + tlimit.SetLineStyle(linestyles[i]) + tlimit.SetLineWidth(3) + TGlimit.Add(tlimit) + leg.AddEntry(tlimit,alg,"l") + TGlimit.Draw('al3') + TGlimit.SetTitle(sampletype+', coll. = '+coll+', discr. = '+var) + setLimitStyle(TGlimit) + leg.Draw() + c1.Print("Plots_TRExLimits/%s_ref2_limits_comp-algs_%s_%s.png"%(sampledict[sampletype][0][0][5:9],coll,var)) + c1.Print("Plots_TRExLimits/%s_ref2_limits_comp-algs_%s_%s.pdf"%(sampledict[sampletype][0][0][5:9],coll,var)) + c1.Clear() + del c1 + + if compare=='vars': + for i,var in enumerate(vars): + fntemplate = resultpath+alg+'_'+coll+'_'+var+'/Results/BONLY__SIGNAL__/Limits/BONLY__SIGNAL__.root' + tlimitlist = getLimits(fntemplate=fntemplate,samples=sampledict[sampletype][0]) + tlimit = getLimitTGraph(*tlimitlist) + tlimit.SetLineColor(sampledict[sampletype][1]) + tlimit.SetLineStyle(linestyles[i]) + tlimit.SetLineWidth(3) + TGlimit.Add(tlimit) + leg.AddEntry(tlimit,var,"l") + TGlimit.Draw('al3') + TGlimit.SetTitle(sampletype+', coll. = '+coll+', alg. = '+alg) + setLimitStyle(TGlimit) + leg.Draw() + c1.Print("Plots_TRExLimits/%s_ref2_limits_comp-vars_%s_%s.png"%(sampledict[sampletype][0][0][5:9],alg,coll)) + c1.Print("Plots_TRExLimits/%s_ref2_limits_comp-vars_%s_%s.pdf"%(sampledict[sampletype][0][0][5:9],alg,coll)) + c1.Clear() + del c1 + +# +# RUN +# + +# +if drawAllPlots: + for alg in algs: + for var in vars: + printLimitCanvas(resultpath=resultpath,sampledict=sampledict,compare='colls',colls=colls,alg=alg,var=var) + + for alg in algs: + for coll in colls: + printLimitCanvas(resultpath=resultpath,sampledict=sampledict,compare='vars',vars=vars,coll=coll,alg=alg) + + for coll in colls: + for var in vars: + printLimitCanvas(resultpath=resultpath,sampledict=sampledict,compare='algs',algs=algs,coll=coll,var=var) + +# +if findBestConfigPerSignal: + + print 'Best: \t\talg: \tvar: \t\tcoll:' + for sampletype in sampledict.keys(): + for signal in sampledict[sampletype][0]: + + lim = 100000. + bestalg,bestvar,bestcoll=0,0,0 + + for alg in algs: + for var in vars: + for coll in colls: + + fntemplate = resultpath+alg+'_'+coll+'_'+var+'/Results/BONLY__SIGNAL__/Limits/BONLY__SIGNAL__.root' + fn = fntemplate.replace('SIGNAL',signal) + thislim = getSpecificLimit(fn) + if thislim < lim: + lim = thislim + bestalg=alg + bestvar=var + bestcoll=coll + + print signal,'\t',bestalg,'\t',bestvar,'\t',bestcoll + +# +if findBestConfigOverall: + + configdict,configdict_no11 = {},{} + for alg in algs: + for var in vars: + for coll in colls: + + configdict[alg+'_'+var+'_'+coll] = 0. + configdict_no11[alg+'_'+var+'_'+coll] = 0. + + for sampletype in sampledict.keys(): + for signal in sampledict[sampletype][0]: + fntemplate = resultpath+alg+'_'+coll+'_'+var+'/Results/BONLY__SIGNAL__/Limits/BONLY__SIGNAL__.root' + fn = fntemplate.replace('SIGNAL',signal) + thislim = getSpecificLimit(fn) + + configdict[alg+'_'+var+'_'+coll] += thislim + if not '11' in signal: + configdict_no11[alg+'_'+var+'_'+coll] += thislim + + lim = 10000 + for key in configdict.keys(): + if configdict[key] < lim: + lim = configdict[key] + bestconfig = key + + lim = 10000 + for key in configdict_no11.keys(): + if configdict_no11[key] < lim: + lim = configdict_no11[key] + bestconfig_no11 = key + + print "Best config (all masses): ",bestconfig + print "Best config (no 1.1 TeV): ",bestconfig_no11 + + + print "\nSorted configs and total limits:" + for key in sorted(configdict, key=configdict.get, reverse=False): + print key, configdict[key] + + print "\nSorted configs and total limits (no 1.1 TeV):" + for key in sorted(configdict_no11, key=configdict_no11.get, reverse=False): + print key, configdict_no11[key] diff --git a/python/VLQ_Samples.py b/python/VLQ_Samples.py index a087c02616830bf001df42df5f66aa12efbb6174..cc878420a15a6cbd85a4c28045ff399b49e84cd0 100644 --- a/python/VLQ_Samples.py +++ b/python/VLQ_Samples.py @@ -493,25 +493,23 @@ def GetSingleVLQSamples( useWeightSyst=False, useObjectSyst=False): Samples = [] Samples += [getSampleUncertainties("sVLQ_WTHt11K03","310778.", ObjectSystematics , WeightSystematics)] - Samples += [getSampleUncertainties("sVLQ_WTHt16K03","311376.", ObjectSystematics , WeightSystematics)] + # Samples += [getSampleUncertainties("sVLQ_WTHt16K03","311376.", ObjectSystematics , WeightSystematics)] Samples += [getSampleUncertainties("sVLQ_WTHt16K05","311377.", ObjectSystematics , WeightSystematics)] Samples += [getSampleUncertainties("sVLQ_WTHt20K05","310777.", ObjectSystematics , WeightSystematics)] - Samples += [getSampleUncertainties("sVLQ_WTHt20K05R20","307018.", ObjectSystematics , WeightSystematics)] + # Samples += [getSampleUncertainties("sVLQ_WTHt20K05R20","307018.", ObjectSystematics , WeightSystematics)] Samples += [getSampleUncertainties("sVLQ_WTZt11K03","310776.", ObjectSystematics , WeightSystematics)] Samples += [getSampleUncertainties("sVLQ_WTZt16K05","306997.", ObjectSystematics , WeightSystematics)] Samples += [getSampleUncertainties("sVLQ_WTZt20K05","310779.", ObjectSystematics , WeightSystematics)] Samples += [getSampleUncertainties("sVLQ_ZTHt11K05","307054.", ObjectSystematics , WeightSystematics)] - Samples += [getSampleUncertainties("sVLQ_ZTHt16K03","311365.", ObjectSystematics , WeightSystematics)] + # Samples += [getSampleUncertainties("sVLQ_ZTHt16K03","311365.", ObjectSystematics , WeightSystematics)] Samples += [getSampleUncertainties("sVLQ_ZTHt16K05","307059.", ObjectSystematics , WeightSystematics)] Samples += [getSampleUncertainties("sVLQ_ZTHt20K05","307061.", ObjectSystematics , WeightSystematics)] Samples += [getSampleUncertainties("sVLQ_ZTZt11K05","307042.", ObjectSystematics , WeightSystematics)] Samples += [getSampleUncertainties("sVLQ_ZTZt16K05","307047.", ObjectSystematics , WeightSystematics)] - - return Samples def GetVLQBSamples( useWeight=False, useObjectSys=False):