本文整理汇总了C++中AnalysisEnvironmentLoader::LoadSSDiLeptonSelection方法的典型用法代码示例。如果您正苦于以下问题:C++ AnalysisEnvironmentLoader::LoadSSDiLeptonSelection方法的具体用法?C++ AnalysisEnvironmentLoader::LoadSSDiLeptonSelection怎么用?C++ AnalysisEnvironmentLoader::LoadSSDiLeptonSelection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnalysisEnvironmentLoader
的用法示例。
在下文中一共展示了AnalysisEnvironmentLoader::LoadSSDiLeptonSelection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (int argc, char *argv[])
{
cout << "#########################" << endl;
cout << "Beginning of the program" << endl;
cout << "#########################" << endl;
//////////////////////
//Global variables
//////////////////////
vector < Dataset > datasets;
SSDiLeptonSelection sel;
float Luminosity = 0;
float LumiError = 0.;
// 0: MC - 1: Data - 2 Data & MC
int DataType = 0;
int verbosity = -1;
int AnaStep = 6;//which defines the cuts that the events should pass to be considered as selected
float Nobs_mumu = 0.;
//////////////////////
//////////////////////
// Initialisation
//////////////////////
string xmlFileName;
cout<<"argc "<<argc<<" "<<argv[0]<<endl;
if (argc>1 ) xmlFileName = string(argv[1]);
else xmlFileName = string ("../../config/RPVAnalysis.xml");
AnalysisEnvironmentLoader anaEL (xmlFileName);
anaEL.LoadSamples (datasets); // now the list of datasets written in the xml file is known
anaEL.LoadSSDiLeptonSelection (sel); // now the parameters for the selection are given to the selection
anaEL.LoadGeneralInfo (DataType, Luminosity, LumiError, verbosity);
int flagOriginal=sel.GetFlagb();
int methodOriginal=sel.GetMethodb();
int systOriginal= sel.GetSystb();
std::cout << " For btag : flag " << flagOriginal << ", method " << methodOriginal << ", syst " << systOriginal << std::endl;
IPHCTree::NTEvent * event = 0;
//Selection table
SelectionTable selTable_allChannels (sel.GetCutList (), datasets, string ("*"));
SelectionTable selTable_ee (sel.GetCutList (), datasets, string ("ee"));
SelectionTable selTable_emu (sel.GetCutList (), datasets, string ("emu"));
SelectionTable selTable_mumu (sel.GetCutList (), datasets, string ("mumu"));
//Book keeping of standard histos
bool doHistoManager = true;
SSDiLepAnaHistoManager histoManager;
if(doHistoManager){
histoManager.LoadDatasets (datasets);
histoManager.LoadSelectionSteps (sel.GetCutList ());
histoManager.LoadChannels (sel.GetChannelList ());
histoManager.CreateHistos ();
}
//////////////////////
cout << "The verbosity mode is " << verbosity << endl;
cout << "The luminosity is equal to " << Luminosity << endl;
cout << "The DataType is ";
switch (DataType) {
case 0:
cout << "MC" << endl;
break;
case 1:
cout << "Data" << endl;
break;
case 2:
cout << "Data & MC" << endl;
break;
default:
cout << " unknown" << endl;
break;
}
//////////////////////
//////////////////////
//LOOP OVER THE DATASETS
//////////////////////
if (verbosity > 0) {
cout << "#########################" << endl;
cout << " Loop over the datasets " << endl;
cout << "#########################" << endl;
}
for (unsigned int d = 0; d < datasets.size (); d++)
{
if(verbosity>2) cout<<"RPVAnalysis> Dataset: "<<datasets[d].Name()<<endl;
datasets[d].eventTree ()->SetBranchAddress ("NTEvent", &event);
unsigned int nEvents = static_cast<unsigned int>(datasets[d].eventTree ()->GetEntries ());
cout << "RPVAnalysis> NEvents = " << nEvents << endl;
cout << "RPVAnalysis> NEvents to run over = "<<datasets[d].NofEvtsToRunOver()<<endl;
//LOOP OVER THE EVENTS
for (unsigned int ievt = 0; ievt < datasets[d].NofEvtsToRunOver(); ievt++)
//.........这里部分代码省略.........
示例2: main
int main (int argc, char *argv[])
{
cout << "#########################" << endl;
cout << "Beginning of the program" << endl;
cout << "#########################" << endl;
//////////////////////
//Global variables
//////////////////////
vector < Dataset > datasets;
SSDiLeptonSelection sel;
float Luminosity = 0;
float LumiError = 0.;
// 0: MC - 1: Data - 2 Data & MC
int DataType = 0;
int verbosity = -1;
int AnaStep = 6;//which defines the cuts that the events should pass to be considered as selected
float Nobs_mumu = 0.;
//////////////////////
//////////////////////
// Initialisation
//////////////////////
string xmlFileName;
cout<<"argc "<<argc<<" "<<argv[0]<<endl;
if (argc>1 ) xmlFileName = string(argv[1]);
else xmlFileName = string ("../../config/TTbarMETAnalysis.xml");
AnalysisEnvironmentLoader anaEL (xmlFileName);
anaEL.LoadSamples (datasets); // now the list of datasets written in the xml file is known
anaEL.LoadSSDiLeptonSelection (sel); // now the parameters for the selection are given to the selection
anaEL.LoadGeneralInfo (DataType, Luminosity, LumiError, verbosity);
int flagOriginal=sel.GetFlagb();
int methodOriginal=sel.GetMethodb();
int systOriginal= sel.GetSystb();
std::cout << " For btag : flag " << flagOriginal << ", method " << methodOriginal << ", syst " << systOriginal << std::endl;
IPHCTree::NTEvent * event = 0;
//Selection table
SelectionTable selTable_allChannels (sel.GetCutList (), datasets, string ("*"));
SelectionTable selTable_ee (sel.GetCutList (), datasets, string ("ee"));
SelectionTable selTable_emu (sel.GetCutList (), datasets, string ("emu"));
SelectionTable selTable_mumu (sel.GetCutList (), datasets, string ("mumu"));
/*
//Book keeping of standard histos
bool doHistoManager = true;
SSDiLepAnaHistoManager histoManager;
if(doHistoManager){
histoManager.LoadDatasets (datasets);
histoManager.LoadSelectionSteps (sel.GetCutList ());
histoManager.LoadChannels (sel.GetChannelList ());
histoManager.CreateHistos ();
}
*/
TH1F* h_mult_lep_0 = new TH1F("h_mult_lep_0", "# of leptons (bf cuts)", 5,0.0,5.0);
TH1F* h_mult_jet_0 = new TH1F("h_mult_jet_0", "# of jets (bf cuts)", 10,0.0,10.0);
TH1F* h_mult_bjet_0 = new TH1F("h_mult_bjet_0", "# of b-jets (bf cuts)", 5,0.0,5.0);
TH1F* h_pt_lep1_0 = new TH1F("h_pt_lep1_0", "PT of leading lepton (bf cuts)",60,0.0,300.0);
TH1F* h_eta_lep1_0 = new TH1F("h_eta_lep1_0", "Eta of leading lepton (bf cuts)",66,-3.3,3.3);
TH1F* h_pt_jet1_0 = new TH1F("h_pt_jet1_0", "PT of leading jet (bf cuts)",60,0.0,300.0);
TH1F* h_pt_jet2_0 = new TH1F("h_pt_jet2_0", "PT of jet 2 (bf cuts)",60,0.0,300.0);
TH1F* h_pt_jet3_0 = new TH1F("h_pt_jet3_0", "PT of jet 3 (bf cuts)",60,0.0,300.0);
TH1F* h_pt_jet4_0 = new TH1F("h_pt_jet4_0", "PT of jet 4 (bf cuts)",60,0.0,300.0);
TH1F* h_met_0 = new TH1F("h_met_0", "MET (bf cuts)",40,0.0,400.0);
TH1F* h_mt_0 = new TH1F("h_mt_0", "MT(invisible+lepton) (bf cuts)",100,0.0,1000.0);
TH1F* h_mt_0_2 = new TH1F("h_mt_0_2", "MT(invisible+lepton) (bf cuts)",20,0.0,1000.0);
TH1F* h_ht_0 = new TH1F("h_ht_0", "HT (bf cuts)",100,0.0,500.0);
TH1F* h_m3_0 = new TH1F("h_m3_0", "M3 (bf cuts)",100,0.0,1000.0);
TH1F* h_mult_jet_1 = new TH1F("h_mult_jet_1", "# of jets (af cuts)", 10,0.0,10.0);
TH1F* h_met_1 = new TH1F("h_met_1", "MET (af cuts)",40,0.0,400.0);
TH1F* h_met_1_2 = new TH1F("h_met_1_2", "MET (af cuts)",10,0.0,400.0);
TH1F* h_mt_1 = new TH1F("h_mt_1", "MT(invisible+lepton) (af cuts)",100,0.0,1000.0);
TH1F* h_mt_1_2 = new TH1F("h_mt_1_2", "MT(invisible+lepton) (af cuts)",20,0.0,1000.0);
TH1F* h_pt_lep1_1 = new TH1F("h_pt_lep1_1", "PT of leading lepton (af cuts)",60,0.0,300.0);
TH1F* h_eta_lep1_1 = new TH1F("h_eta_lep1_1", "Eta of leading lepton (af cuts)",66,-3.3,3.3);
TH1F* h_pt_jet1_1 = new TH1F("h_pt_jet1_1", "PT of leading jet (af cuts)",60,0.0,300.0);
TH1F* h_pt_jet2_1 = new TH1F("h_pt_jet2_1", "PT of jet 2 (af cuts)",60,0.0,300.0);
TH1F* h_pt_jet3_1 = new TH1F("h_pt_jet3_1", "PT of jet 3 (af cuts)",60,0.0,300.0);
TH1F* h_pt_jet4_1 = new TH1F("h_pt_jet4_1", "PT of jet 4 (af cuts)",60,0.0,300.0);
TH1F* h_ht_1 = new TH1F("h_ht_1", "HT (af cuts)",100,0.0,500.0);
TH1F* h_m3_1 = new TH1F("h_m3_1", "M3 (af cuts)",100,0.0,1000.0);
TH1F* h_mult_bjet_1 = new TH1F("h_mult_bjet_1", "# of b-jets (af cuts)", 5,0.0,5.0);
TH1F* h_pt_bjet1_2 = new TH1F("h_pt_bjet1_2", "PT of leading b-jet (af cuts)",60,0.0,300.0);
TH1F* h_tophad_pt_1 = new TH1F("h_tophad_pt_1", "PT of top1 (af cuts)",100,0.,1000.);
TH1F* h_toplep_pt_1 = new TH1F("h_toplep_pt_1", "PT of top2 (af cuts)",100,0.,1000.);
TH1F* h_wlep_pt_1 = new TH1F("h_wlep_pt_1", "PT of w2 (af cuts)",100,0.,1000.);
TH1F* h_toplep_m_1 = new TH1F("h_toplep_m_1", "M of top2 (af cuts)",100,0.,1000.);
TH1F* h_dphi_l_mis_1 = new TH1F("h_dphi_l_mis_1", "Dphi(l,MET) (af cuts)",30,-1.*pi,pi);
TH1F* h_dphi_l_jet4th_1 = new TH1F("h_dphi_l_jet4th_1", "Dphi(l,jet4th) (af cuts)",30,-1.*pi,pi);
TH1F* h_dphi_2top_1 = new TH1F("h_dphi_2top_1", "Dphi(top1,top2) (af cuts)",30,-1.*pi,pi);
TH1F* h_deta_l_tophad_1 = new TH1F("h_deta_l_tophad_1", "Deta(l,top1) (af cuts)",50,0.,5.);
TH1F* h_deta_l_jet4th_1 = new TH1F("h_deta_l_jet4th_1", "Deta(l,jet4th) (af cuts)",50,0.,5.);
TH1F* h_tophad_pt_2 = new TH1F("h_tophad_pt_2", "PT of top1 (af cuts)",100,0.,1000.);
TH1F* h_toplep_pt_2 = new TH1F("h_toplep_pt_2", "PT of top2 (af cuts)",100,0.,1000.);
TH1F* h_wlep_pt_2 = new TH1F("h_wlep_pt_2", "PT of w2 (af cuts)",100,0.,1000.);
//.........这里部分代码省略.........
示例3: MatrixMethod
void MatrixMethod (string xmlFileName, bool mc=true, string channel="") // MuMu or EE for data, do both for MC
{
cout<<"#########################"<<endl;
cout<<"Beginning of the program"<<endl;
cout<<"#########################"<<endl;
//////////////////////
// Initialisation
//////////////////////
float Luminosity = 0;
float LumiError = 0;
string PUWeightFileName;
int DataType = 0;
AnalysisEnvironmentLoader anaEL (xmlFileName);
vector < Dataset > datasets;
anaEL.LoadSamples (datasets); // now the list of datasets written in the xml file is known
int verbosity = -1;
// Matrix Method
int MMselStepCut = 3;
float looseIsoMM = 0.8; float tightIsoMMmu = 0.2; float tightIsoMMe = 0.17;
unsigned int nbinsMM = 11; float lowEdgeMM = -0.5; float highEdgeMM = 10.5; // Histo nb events en fonction #jets
MMEstimation MMestEE(datasets, looseIsoMM, tightIsoMMe, nbinsMM, lowEdgeMM, highEdgeMM, "EE");
MMEstimation MMestMuMu(datasets,looseIsoMM, tightIsoMMmu, nbinsMM, lowEdgeMM, highEdgeMM, "MuMu");
SSDiLeptonSelection sel;
anaEL.LoadSSDiLeptonSelection (sel); // now the parameters for the selection are given to the selection
anaEL.LoadGeneralInfo(DataType, Luminosity, LumiError, PUWeightFileName, verbosity );
//Load for PU:
if(mc) sel.GeneratePUWeight(PUWeightFileName);
IPHCTree::NTEvent * event = 0;
/*PUWeighting thePUReweighter;
TFile* file1 = new TFile(PUWeightFileName.c_str(),"READ");
TH1D * hPUData = 0;
hPUData = (TH1D*)file1->Get("pileup");
TH1F * hPUMC = new TH1F("pileup_MC", "pileup_MC", hPUData->GetXaxis()->GetNbins(), hPUData->GetXaxis()->GetXmin(), hPUData->GetXaxis()->GetXmax() );
TFile* file2 = new TFile( "../data/CrossSection_pileup.root" ,"READ");
hPUMC = (TH1F*)file2->Get("pileup_TTbarSig");
// histo in data, histo in Mc, use out-of-time pu in the reweighting
cout << "get MC histo " << endl;
thePUReweighter.setPUHisto( hPUData, hPUMC);
cout << "set MC histo in thePUReweighter " << endl;
thePUReweighter.setUseOutOfTimePU(false); // set to true to use out-of-time PU
*/
//////////////////////
//LOOP OVER THE DATASETS
//////////////////////
cout<<"#########################"<<endl;
cout<<" Loop over the datasets "<<endl;
cout<<"#########################"<<endl;
for (unsigned int d = 0; d < datasets.size (); d++) {
datasets[d].eventTree ()->SetBranchAddress ("NTEvent",&event);
cout << "dataset = " << datasets[d].Name() << endl;
unsigned int nEvents = (int) (datasets[d].eventTree ()->GetEntries ());
cout << "NEvents = " << nEvents << endl;
float weight_init;
weight_init = datasets[d].NormFactor()*Luminosity;
cout << "weight_init = " << weight_init << endl;
//LOOP OVER THE EVENTS
for (unsigned int ievt = 0; ievt < nEvents; ievt++) {
datasets[d].eventTree ()->GetEntry (ievt);
IPHCTree::NTTransient::InitializeAfterReading(event); // Important line to read new format files
//Load event for the selection
sel.LoadEvent(event);
if(ievt%10000 == 0) cout << "number of processed events " << ievt << endl;
float weight = 1;
if(mc){
//Manage DY samples to avoid overlaps
double dileptInvMass = 0;
if( (event->mc.zAndDecays).size() > 0){
TLorentzVector dilept = (event->mc.zAndDecays)[0].p4_Lep1_gen + (event->mc.zAndDecays)[0].p4_Lep2_gen;
dileptInvMass = dilept.M();
}
if(datasets[d].Name()=="Zjets" && dileptInvMass < 50) continue;
if(datasets[d].Name()=="DYToMuMu_M-20" && (dileptInvMass > 50 || dileptInvMass < 20) ) continue;
if(datasets[d].Name()=="DYToEE_M-20" && (dileptInvMass > 50 || dileptInvMass < 20) ) continue;
if(datasets[d].Name()=="DYToTauTau_M-20" && (dileptInvMass > 50 || dileptInvMass < 20) ) continue;
if(datasets[d].Name()=="DYToMuMu_M-10To20" && dileptInvMass > 20) continue;
if(datasets[d].Name()=="DYToEE_M-10To20" && dileptInvMass > 20) continue;
if(datasets[d].Name()=="DYToTauTau_M-10To20" && dileptInvMass > 20) continue;
weight = weight_init;
//float weight = weight_init*sel.GetPUWeight();
/*if(thePUReweighter.getUseOutOfTimePU()){
weight = weight_init*thePUReweighter.weight(event->pileup.intime_npu, event->general.runNb);
}else{
weight = weight_init*thePUReweighter.weight(event->pileup.intime_npu);
}*/
}
if(mc || (!mc && channel=="EE")) MMestEE.CountNSel(sel, datasets[d], "ee_ss", weight, MMselStepCut, &(event->mc));
//.........这里部分代码省略.........