本文整理汇总了C++中Events::read方法的典型用法代码示例。如果您正苦于以下问题:C++ Events::read方法的具体用法?C++ Events::read怎么用?C++ Events::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events::read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: plotHistos_Wen
void plotHistos_Wen() {
gROOT->LoadMacro("tdrstyle.C");
gROOT->ProcessLine("setTDRStyle()");
TH1::SetDefaultSumw2(1);
//gROOT->SetBatch(1);
TString plotdir = "plots/";
if (gSystem->AccessPathName(plotdir))
gSystem->mkdir(plotdir);
////////////////////////////////////////////////////////////////////////////
// Task 1 (a) //
// - please comment out other tasks //
////////////////////////////////////////////////////////////////////////////
/*
// Read from ntuples
Events * ev = new Events();
TCut cutmc_all = "Vtype==0"; // change this to your channel
TCut cutdata_all = "Vtype==0"; // change this to your channel
TString process = "VH"; // can try other processes: VH, WJ, ZJ, TT
ev->read(cutmc_all, cutdata_all, process);
TString var = "HCSV_mass"; // the variable to plot
TCut cut = "V_pt>120"; // the selection cut
TString title = ";m(jj) [GeV]"; // the title of the histogram
TString plotname = process + "_Hmass"; // the name of the image file
int nbinsx = 15; // number of bins
double xlow = 30.0; // the low edge of x-axis
double xup = 255.0; // the upper edge of x-axis
TString options = "!plotLog:!plotNorm"; // use "plotLog" to plot on log-y scale,
// use "!plotLog" to plot on linear scale;
// use "plotNorm" to plot normalized plots,
// use "!plotNorm" otherwise.
// Use "ev->ZH" for ZH, or "ev->WjLF", "ev->WjHF", "ev->ZjLF", "ev->ZjHF", "ev->TT" for other processes
MakePlot(ev->ZH, var, cut, title, nbinsx, xlow, xup, plotname, plotdir, options);
// You can put in the parameters directly as in the following commented out line:
//MakePlot(ev->ZH, "HCSV_pt", cut, "; p_{T}(jj) [GeV]", 16, 0, 240., process + "_Hpt", plotdir, options);
*/
////////////////////////////////////////////////////////////////////////////
// Task 1 (b) //
// - please comment out other tasks //
////////////////////////////////////////////////////////////////////////////
/*
// Read from ntuples
Events * ev = new Events();
TCut cutmc_all = "Vtype==0"; // change this to your channel
TCut cutdata_all = "Vtype==0"; // change this to your channel
ev->read(cutmc_all, cutdata_all, "VH:ZJ"); // read both VH and ZJ processes
TString var = "HCSV_mass";
TCut cut = "V_pt>120";
//TCut cut = "V_pt>120 && Jet_pt[hJCidx[0]]>30 && Jet_pt[hJCidx[1]]>30"; // for Wln, Znn, change to tighter cut
TString title = ";m(jj) [GeV]";
TString plotname = "ZH_vs_ZJ_Hmass";
int nbinsx = 15;
double xlow = 30.0;
double xup = 255.0;
TString options = "!plotLog:plotNorm";
// Using "ev->ZH" for ZH and "ev->ZjHF" for Z+HF
MakePlot2(ev->ZH, ev->ZjHF, var, cut, title, nbinsx, xlow, xup, plotname, plotdir, options);
*/
////////////////////////////////////////////////////////////////////////////
// Task 2 //
// - please comment out other tasks //
////////////////////////////////////////////////////////////////////////////
// Zmm______________________________________________________________________
//TString channel = "Zmm";
//Loose cuts for this channel
//TCut cutmc_all = "Vtype==0 && V_pt>100 && met_pt<60"; // V related
//cutmc_all += "75<V_mass && V_mass<105"; //Z mass window
//cutmc_all += "Jet_pt[hJCidx[0]]>20 && Jet_pt[hJCidx[1]]>20 && abs(Jet_eta[hJCidx[0]])<2.4 && abs(Jet_eta[hJCidx[1]])<2.4";// H jets
//cutmc_all += "min(Jet_btagCSV[hJCidx[0]], Jet_btagCSV[hJCidx[1]])>0.4"; //loose b-tag
//cutmc_all += "Sum$(Jet_pt > 20 & abs(Jet_eta) < 2.4) < 3"; //no additional jets
//TCut met_cleaning = "Flag_hbheFilterNew &&Flag_hbheIsoFilter && Flag_goodVertices &&Flag_eeBadScFilter &&Flag_CSCTightHaloFilter";
//TCut mc_trigger = "HLT_ZmmHbbAll==1";
//TCut data_trigger = "HLT_BIT_HLT_IsoMu18_v==1";
//TCut cutdata_all = cutmc_all;
//cutdata_all += data_trigger;
//cutmc_all += mc_trigger;
// Scale factors in order of: WjLF, WjHF, ZjLF, ZjHF, TT
// NOTE: WjLF, WjHF are not needed for Zll
//double scalefactors[5] = {1.00, 1.00, 1.00, 1.00, 1.00};
// Zee______________________________________________________________________
//TString channel = "Zee";
//.........这里部分代码省略.........
示例2: plotHistos_Znn_13TeV_BDT
void plotHistos_Znn_13TeV_BDT() {
gROOT->LoadMacro("tdrstyle.C");
gROOT->ProcessLine("setTDRStyle()");
TH1::SetDefaultSumw2(1);
//gROOT->SetBatch(1);
TString plotdir = "plots/";
if (gSystem->AccessPathName(plotdir))
gSystem->mkdir(plotdir);
////////////////////////////////////////////////////////////////////////////
// Task 1 (a) //
// - please comment out other tasks //
////////////////////////////////////////////////////////////////////////////
// Read from ntuples
Events * ev = new Events();
// TCut cutmc_all = "Vtype==4 && Sum$(hJets_btagCSV>0.9)>0 && H_mass<250 && Jet_pt[hJidx[1]] > 30";
// change this to your channel
// TCut cutdata_all = "Vtype==4 && Sum$(hJets_btagCSV>0.9)>0 && H_mass<250 && Jet_pt[hJidx[1]] > 30"; // change this to your channel
// TCut cutmc_all = " Vtype==4 && Sum$(hJets_btagCSV>0.7)>0 && H_mass<250 && Jet_pt[hJidx[1]] > 30 && met_pt>200 && H_pt>150 && min(hJets_btagCSV[0], hJets_btagCSV[1])>0.7 && Jet_pt[hJidx[0]]>100 && Jet_pt[hJidx[1]]>80 && deltaR_jj<1.3 && Sum$(Jet_pt>30 && abs(Jet_eta)<2.5)== 2";
// TCut cutmc_all = "Vtype==4 && Jet_btagCSV[hJCidx[0]]>0.9 && Jet_btagCSV[hJCidx[1]]>0.8 && HCSV_mass<250 && met_pt>200 && HCSV_pt>0 && Jet_pt[hJCidx[0]]>80 && Jet_pt[hJCidx[1]]>30 && deltaR( Jet_eta[hJCidx[0]], Jet_eta[hJCidx[1]], Jet_phi[hJCidx[0]], Jet_phi[hJCidx[1]] )<1.3 && Sum$(Jet_pt>30 && abs(Jet_eta)<2.5)<=3" ;
// TCut cutmc_all = "Vtype==4 && MinIf$(abs(deltaPhi(met_phi,Jet_phi)) , Jet_pt>25 && abs(Jet_eta)<4.5 && Jet_puId==1)>1.5 && Jet_btagCSV[hJCidx[0]]>0.423 && Jet_btagCSV[hJCidx[1]]>0.423 && HCSV_mass<250 && met_pt>170 && HCSV_pt>130 && ( (Jet_pt[hJCidx[0]]>80 && Jet_pt[hJCidx[1]]>30)||(Jet_pt[hJCidx[1]]>80 && Jet_pt[hJCidx[0]]>30 )) && Sum$(aLeptons_pt>5 && aLeptons_relIso03<1. && ( deltaR(Jet_eta[hJCidx[0]], aLeptons_eta, Jet_phi[hJCidx[0]], aLeptons_phi)>0.4 && deltaR(Jet_eta[hJCidx[1]], aLeptons_eta, Jet_phi[hJCidx[1]], aLeptons_phi)>0.4))==0 && Sum$(Jet_pt>30 && abs(Jet_eta)<4.5 && Jet_puId==1)<=99 && abs(deltaPhi(HCSV_phi, met_phi))>2.5";
// TCut cutmc_all = "";
TCut weightmc = "(efflumi * 2. * weightTrig * sign(genWeight))";
// TCut cutmc_all = "Vtype==4 && Jet_btagCSV[hJCidx[0]]>0.814 && Jet_btagCSV[hJCidx[1]]>0.423 && HCSV_mass<250 && met_pt>170 && HCSV_pt>130 && ( (Jet_pt[hJCidx[0]]>80 && Jet_pt[hJCidx[1]]>30) || (Jet_pt[hJCidx[1]]>80 && Jet_pt[hJCidx[0]]>30 )) && Sum$(Jet_pt>30 && abs(Jet_eta)<4.5 && Jet_puId==1)<=99";
// TCut cutmc_all = "Vtype==4 && MinIf$(abs(deltaPhi(met_phi,Jet_phi)) , Jet_pt>25 && abs(Jet_eta)<4.5 && Jet_puId==1)>1.5 && max(Jet_btagCSV[hJCidx[0]], Jet_btagCSV[hJCidx[1]])>0.97 && min(Jet_btagCSV[hJCidx[0]], Jet_btagCSV[hJCidx[1]])>0.605 && met_pt>200 && HCSV_pt>170 && ( (Jet_pt[hJCidx[0]]>80 && Jet_pt[hJCidx[1]]>30) || (Jet_pt[hJCidx[1]]>80 && Jet_pt[hJCidx[0]]>30 )) && Sum$(aLeptons_pt>10 && aLeptons_relIso03<1. && ( deltaR(Jet_eta[hJCidx[0]], aLeptons_eta, Jet_phi[hJCidx[0]], aLeptons_phi)>0.4 && deltaR( Jet_eta[hJCidx[1]], aLeptons_eta, Jet_phi[hJCidx[1]], aLeptons_phi)>0.4))>=0";
// TCut cutmc_all = "MinIf$(abs(deltaPhi(met_phi,Jet_phi)) , Jet_pt>25 && abs(Jet_eta)<4.5 && Jet_puId==1)>1.5";
TCut cutmc_all = "Vtype==4 && MinIf$(abs(deltaPhi(met_phi,Jet_phi)) , Jet_pt>25 && abs(Jet_eta)<4.5 && Jet_puId==1)>1.5 && Jet_btagCSV[hJCidx[0]]>0.423 && Jet_btagCSV[hJCidx[1]]>0.423 && HCSV_mass<250 && met_pt>170 && HCSV_pt>130 && ( (Jet_pt[hJCidx[0]]>80 && Jet_pt[hJCidx[1]]>30)||(Jet_pt[hJCidx[1]]>80 && Jet_pt[hJCidx[0]]>30 )) && Sum$(aLeptons_pt>5 && aLeptons_relIso03<1. && ( deltaR(Jet_eta[hJCidx[0]], aLeptons_eta, Jet_phi[hJCidx[0]], aLeptons_phi)>0.4 && deltaR(Jet_eta[hJCidx[1]], aLeptons_eta, Jet_phi[hJCidx[1]], aLeptons_phi)>0.4))>=0 && Sum$(Jet_pt>30 && abs(Jet_eta)<4.5 && Jet_puId==1)<=99 && abs(deltaPhi(HCSV_phi, met_phi))>2.5";
//TCut cutmc_all = "Vtype==4 && t[hJCidx[0]]>30 )) && Sum$(aLeptons_pt>5 && aLeptons_relIso03<1. && ( deltaR(Jet_eta[hJCidx[0]], aLeptons_eta, Jet_phi[hJCidx[0]], aLeptons_phi)>0.4 && deltaR(Jet_eta[hJCidx[1]], aLeptons_eta, Jet_phi[hJCidx[1]], aLeptons_phi)>0.4))>=0 && Sum$(Jet_pt>30 && abs(Jet_eta)<4.5 && Jet_puId==1)<=99 && abs(deltaPhi(HCSV_phi, met_phi))>2.5";
TCut cutdata_all = cutmc_all;
TString channel = "ZnnHighPt";
ev->read( cutmc_all , cutmc_all, "" , "tree_ZnunuHighPt_test");
TString var = "HCSV_mass"; // the variable to plot
TCut cut = ""; // the selection cut
TString title = ";Hmass [GeV]"; // the title of the histogram
TString plotname = "mass"; // the name of the image file
int nbinsx = 10; // number of bins
double xlow = 0; // the low edge of x-axis
double xup = 250; // the upper edge of x-axis
TString options = "printStat:plotSig:!plotData:!plotLog:!plotNorm:!plotMonoH"; // use "!plotLog" to plot on log-y scale,
MakePlots(ev, var, cut * weightmc , cut , title, nbinsx, xlow, xup, plotname, plotdir, options);
var = "HCSV_mass"; // the variable to plot
cut = ""; // the selection cut
title = ";Hmass [GeV]"; // the title of the histogram
plotname = "massNorm"; // the name of the image file
nbinsx = 10; // number of bins
xlow = 0; // the low edge of x-axis
xup = 250; // the upper edge of x-axis
options = "printStat:plotSig:!plotData:plotLog:plotNorm:!plotMonoH"; // use "!plotLog" to plot on log-y scale,
MakePlots(ev, var, cut * weightmc , cut , title, nbinsx, xlow, xup, plotname, plotdir, options);
options = "printStat:plotSig:!plotData:!plotLog:plotNorm:!plotMonoH"; // use "!plotLog" to plot on log-y scale,
plotname = "massNormZHvsTT"; // the name of the image file
// Using "ev->ZH" for ZH and "ev->ZjHF" for Z+HF
MakePlot2(ev->ZH, ev->TT, var, cut * weightmc, title, nbinsx, xlow, xup, plotname, plotdir, options);
var = "MaxIf$(Jet_pt, Jet_pt != Jet_pt[hJCidx[0]] && Jet_pt != Jet_pt[hJCidx[1]] && abs(deltaPhi(Jet_phi, evalHMETPhi(0. , met_pt, met_phi, 0., HCSV_mass, HCSV_pt, HCSV_phi, 0.))) < 3.14159265358979323846 -0.3 && evalHMETPt(0. , met_pt, met_phi, 0., HCSV_mass, HCSV_pt, HCSV_phi, 0.) > 40. && Jet_puId>0 && Jet_pt>30)"; // the variable to plot
cut = ""; // the selection cut
title = ";isrpt [GeV]"; // the title of the histogram
plotname = "isrptNorm"; // the name of the image file
nbinsx = 10; // number of bins
xlow = 0; // the low edge of x-axis
xup = 300; // the upper edge of x-axis
options = "printStat:plotSig:!plotData:plotLog:plotNorm:!plotMonoH"; // use "!plotLog" to plot on log-y scale,
MakePlots(ev, var, cut * weightmc , cut , title, nbinsx, xlow, xup, plotname, plotdir, options);
//.........这里部分代码省略.........