本文整理汇总了C++中TBenchmark::GetRealTime方法的典型用法代码示例。如果您正苦于以下问题:C++ TBenchmark::GetRealTime方法的具体用法?C++ TBenchmark::GetRealTime怎么用?C++ TBenchmark::GetRealTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBenchmark
的用法示例。
在下文中一共展示了TBenchmark::GetRealTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AuxFchTemplateFitsData_SIHIH
void AuxFchTemplateFitsData_SIHIH(TString strChannel, TString strVGamma)
{
TBenchmark time;
time.Start("time");
std::cout<<"CPU time = "<<time.GetCpuTime("time")<<", Real time = "<<time.GetRealTime("time")<<std::endl;
FullChain fch;
TConfiguration::AnalysisParameters anPars;
fch.SetDefaultFullChainParameters(anPars,"phoEt");
TConfiguration conf;
int channel;
int vgamma;
if (strChannel=="MUON") anPars.channel=conf.MUON;
if (strChannel=="ELECTRON") anPars.channel=conf.ELECTRON;
if (strVGamma=="WGamma") anPars.vgamma=conf.W_GAMMA;
if (strVGamma=="ZGamma") anPars.vgamma=conf.Z_GAMMA;
anPars.templFits=conf.TEMPL_SIHIH;
AuxTemplates(anPars,0);
time.Stop("time");
std::cout<<"CPU time = "<<time.GetCpuTime("time")<<", Real time = "<<time.GetRealTime("time")<<std::endl;
}
示例2: benchmarkBinIndex
void testJetCorrectorParameters::benchmarkBinIndex(bool is3D) {
float oldCPU = 0, newCPU = 0, oldReal = 0, newReal = 0;
unsigned int ntests = (is3D) ? 100000 : 1000000;
if(is3D) fX = {5.0,50.0,100.0};
else fX = {5.0};
setupCorrector(is3D);
cout << endl << "testJetCorrectorParameters::benchmarkBinIndex NTests = " << ntests << endl;
cout << "testJetCorrectorParameters::benchmarkBinIndex benchmarking binIndex with file " << filename << " ... " << flush;
m_benchmark->Reset();
m_benchmark->Start("event");
for(unsigned int i=0; i<ntests; i++) {
L1JetPar->binIndex(fX);
}
m_benchmark->Stop("event");
cout << "DONE" << endl << "testJetCorrectorParameters::benchmarkBinIndex" << endl
<< "\tCPU time = " << m_benchmark->GetCpuTime("event")/double(ntests) << " s" << endl
<< "\tReal time = " << m_benchmark->GetRealTime("event")/double(ntests) << " s" << endl;
oldCPU = m_benchmark->GetCpuTime("event")/double(ntests);
oldReal = m_benchmark->GetRealTime("event")/double(ntests);
cout << "testJetCorrectorParameters::benchmarkBinIndex benchmarking binIndexN with file " << filename << " ... " << flush;
m_benchmark->Reset();
m_benchmark->Start("event");
for(unsigned int i=0; i<ntests; i++) {
L1JetPar->binIndexN(fX);
}
m_benchmark->Stop("event");
cout << "DONE" << endl << "testJetCorrectorParameters::benchmarkBinIndex" << endl
<< "\tCPU time = " << m_benchmark->GetCpuTime("event")/double(ntests) << " s" << endl
<< "\tReal time = " << m_benchmark->GetRealTime("event")/double(ntests) << " s" << endl;
newCPU = m_benchmark->GetCpuTime("event")/double(ntests);
newReal = m_benchmark->GetRealTime("event")/double(ntests);
cout << "testJetCorrectorParameters::benchmarkBinIndex" << endl
<< "\tCPU speedup = " << oldCPU/newCPU << endl
<< "\tReal speedup = " << oldReal/newReal << endl;
CPPUNIT_ASSERT(oldCPU/newCPU >= 1.0);
//CPPUNIT_ASSERT(oldReal/newReal >= 1.0); //this might fail not due to longer L1JetPar->binIndexN(fX) execution
if (oldReal/newReal >= 1.0)
cout << "newReal value increased oldReal, which might be due to system load" << endl;
destroyCorrector();
}
示例3: AuxFchBkgEtoGamma_NoWMtCut
void AuxFchBkgEtoGamma_NoWMtCut()
{
TBenchmark time;
time.Start("time");
std::cout<<"CPU time = "<<time.GetCpuTime("time")<<", Real time = "<<time.GetRealTime("time")<<std::endl;
TConfiguration conf;
FullChain fch;
TConfiguration::AnalysisParameters anPars;
fch.SetDefaultFullChainParameters(anPars,"phoEt");
anPars.channel=conf.ELECTRON;
anPars.vgamma=conf.W_GAMMA;
TEtoGamma etg(anPars,conf.PRELIMINARY_FOR_E_TO_GAMMA_WITH_PSV_NO_WMT_CUT,0);
etg.ComputePlotSave();
time.Stop("time");
std::cout<<"CPU time = "<<time.GetCpuTime("time")<<", Real time = "<<time.GetRealTime("time")<<std::endl;
}
示例4: mergeHadoopFiles
void mergeHadoopFiles(const TString& indir, const TString& outpath) {
// Benchmark
TBenchmark *bmark = new TBenchmark();
bmark->Start("benchmark");
//gSystem->Load("../libMiniFWLite.so");
TChain *chain = new TChain("Events");
chain->SetMaxTreeSize(5000000000LL); //default is 100000000000LL
std::cout << "Merging files from dir: " << indir << std::endl
<< "Ouputting to: " << outpath << std::endl;
chain->Add(indir + "/*.root");
chain->Merge(outpath, "fast");
std::cout << "Total events merged: " << chain->GetEntries() << std::endl;
bmark->Stop("benchmark");
cout << "------------------------------" << endl;
cout << "CPU Time: " << Form( "%.01f s", bmark->GetCpuTime("benchmark") ) << endl;
cout << "Real Time: " << Form( "%.01f s", bmark->GetRealTime("benchmark") ) << endl;
cout << endl;
delete bmark;
}
示例5: ScanChain
//.........这里部分代码省略.........
histos["NB0_MyMuPt_"+skimFilePrefix]->Fill(mu[0].p4.Pt(),weight);
histos["NB0_MyMuEta_"+skimFilePrefix]->Fill(mu[0].p4.Eta(),weight);
histos["NB0_MyMuPhi_"+skimFilePrefix]->Fill(mu[0].p4.Phi(),weight);
histos["NB0_MyMuCharge_"+skimFilePrefix]->Fill(mucharge,weight);
} else {
histos["NBge1_MT_"+skimFilePrefix]->Fill(mu[0].mt,weight);
histos["NBge1_MyMuPt_"+skimFilePrefix]->Fill(mu[0].p4.Pt(),weight);
histos["NBge1_MyMuEta_"+skimFilePrefix]->Fill(mu[0].p4.Eta(),weight);
histos["NBge1_MyMuPhi_"+skimFilePrefix]->Fill(mu[0].p4.Phi(),weight);
histos["NBge1_MyMuCharge_"+skimFilePrefix]->Fill(mucharge,weight);
} if(HT>100.){
histos["HTge100_MT_"+skimFilePrefix]->Fill(mu[0].mt,weight);
histos["HTge100_MyMuPt_"+skimFilePrefix]->Fill(mu[0].p4.Pt(),weight);
histos["HTge100_MyMuEta_"+skimFilePrefix]->Fill(mu[0].p4.Eta(),weight);
histos["HTge100_MyMuPhi_"+skimFilePrefix]->Fill(mu[0].p4.Phi(),weight);
histos["HTge100_MyMuCharge_"+skimFilePrefix]->Fill(mucharge,weight);
} if(HT>150.){
histos["HTge150_MT_"+skimFilePrefix]->Fill(mu[0].mt,weight);
histos["HTge150_MyMuPt_"+skimFilePrefix]->Fill(mu[0].p4.Pt(),weight);
histos["HTge150_MyMuEta_"+skimFilePrefix]->Fill(mu[0].p4.Eta(),weight);
histos["HTge150_MyMuPhi_"+skimFilePrefix]->Fill(mu[0].p4.Phi(),weight);
histos["HTge150_MyMuCharge_"+skimFilePrefix]->Fill(mucharge,weight);
} if(p.evt_pfmet>50.){
histos["METge50_MT_"+skimFilePrefix]->Fill(mu[0].mt,weight);
histos["METge50_MyMuPt_"+skimFilePrefix]->Fill(mu[0].p4.Pt(),weight);
histos["METge50_MyMuEta_"+skimFilePrefix]->Fill(mu[0].p4.Eta(),weight);
histos["METge50_MyMuPhi_"+skimFilePrefix]->Fill(mu[0].p4.Phi(),weight);
histos["METge50_MyMuCharge_"+skimFilePrefix]->Fill(mucharge,weight);
} if(p.evt_pfmet>25.){
histos["METge25_MT_"+skimFilePrefix]->Fill(mu[0].mt,weight);
histos["METge25_MyMuPt_"+skimFilePrefix]->Fill(mu[0].p4.Pt(),weight);
histos["METge25_MyMuEta_"+skimFilePrefix]->Fill(mu[0].p4.Eta(),weight);
histos["METge25_MyMuPhi_"+skimFilePrefix]->Fill(mu[0].p4.Phi(),weight);
histos["METge25_MyMuCharge_"+skimFilePrefix]->Fill(mucharge,weight);
}
}
}
}
if(!sameEvent(p,c)){
//finally start new event.
if(abs(p.id)==13&&p.passes_POG_tightID&&p.miniisoDB<0.2&&fabs(p.dZ)<0.1&&fabs(p.dxyPV)<0.02&&p.dilep_mass>75.&&p.dilep_mass<105&&p.p4.Pt()>20&&fabs(p.p4.Eta())<2.1) {
if((p.evt_isRealData&&(p.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ || p.HLT_Mu17_TrkIsoVVL_TkMu8_TrkIsoVVL_DZ || p.HLT_IsoMu24_eta2p1 || p.HLT_IsoTkMu24_eta2p1 || p.HLT_IsoMu27 || p.HLT_IsoTkMu27 || p.HLT_IsoMu20 || p.HLT_IsoMu20))||(!p.evt_isRealData)){
histos["Z_Pt_"+skimFilePrefix]->Fill(p.dilep_p4.Pt(),weight);
}
}
mu.clear();
nleps = 1;
}
if(currentrun!=c.evt_run) { cout << "This is run " << c.evt_run << endl; currentrun = c.evt_run; }
bool skip = false;
//if(c.evt_run!=251244&&c.evt_run!=251251&&c.evt_run!=251252) skip = true;
if(abs(c.id)!=13) skip = true;
else if(c.p4.Pt()<20.) skip = true;
else if(fabs(c.p4.Eta())>2.1) skip = true;
else if(!c.passes_POG_looseID) skip = true;
//else if(fabs(c.dZ)>0.5) skip = true;
//else if(fabs(c.dxyPV)>0.2) skip = true;
//else if(c.miniisoDB>0.5) skip = true;
if(!skip) { mu.push_back(c); }
p = c;
resetEvent(c);
}
// Clean Up
delete tree;
file->Close();
delete file;
}
if ( nEventsChain != nEventsTotal ) {
cout << Form( "ERROR: number of events from files (%d) is not equal to total number of events (%d)", nEventsChain, nEventsTotal ) << endl;
}
// Example Histograms
for(map<string,TH1F*>::iterator h=histos.begin(); h!=histos.end();++h){
h->second->SetBinContent(h->second->GetNbinsX(), h->second->GetBinContent(h->second->GetNbinsX() )+ h->second->GetBinContent(h->second->GetNbinsX()+1) );
h->second->SetBinError(h->second->GetNbinsX(), sqrt(pow(h->second->GetBinError(h->second->GetNbinsX() ),2)+pow(h->second->GetBinError(h->second->GetNbinsX()+1),2) ) );
}
for(map<string,TH1F*>::iterator h=histos.begin(); h!=histos.end();++h){
h->second->SetBinContent(1, h->second->GetBinContent(1 )+ h->second->GetBinContent(0) );
h->second->SetBinError(1, sqrt(pow(h->second->GetBinError(1 ),2)+pow(h->second->GetBinError(0),2) ) );
}
//string filename = "rootfiles/test/Histos_"+skimFilePrefix+".root";
string filename = "rootfiles/first_20150727/Histos3_"+skimFilePrefix+".root";
if(DCSonly) filename = "rootfiles/first_20150727/Histos3DCS_"+skimFilePrefix+".root";
TFile *f = new TFile(filename.c_str(),"RECREATE");
f->cd();
for(map<string,TH1F*>::iterator h= histos.begin(); h!= histos.end();++h) h->second->Write();
f->Close();
cout << "Saved histos in " << f->GetName() << endl;
// return
bmark->Stop("benchmark");
cout << endl;
cout << nEventsTotal << " Events Processed" << endl;
cout << "------------------------------" << endl;
cout << "CPU Time: " << Form( "%.01f", bmark->GetCpuTime("benchmark") ) << endl;
cout << "Real Time: " << Form( "%.01f", bmark->GetRealTime("benchmark") ) << endl;
cout << endl;
delete bmark;
return 0;
}
示例6: looperCR2lep
//.........这里部分代码省略.........
// If any negative yields were found in any decay mode, recalculate the total yield
if( j==0 && negsFound ) {
double newYield, newErr;
newYield = h_bkgtype[i][0]->IntegralAndError( 0, -1, newErr );
h_yields->SetBinContent(i+1, newYield);
h_yields->SetBinError(i+1, newErr);
}
// Add zeroed histograms to total histograms
h_bkgtype_sum[i][j]->Add( h_bkgtype[i][j] );
h_evttype_sum[i][j]->Add( h_evttype[i][j] );
}
}
h_yields_sum->Add( h_yields );
} // End loop over files in the chain
cout << "Cutflow yields: (yield) (gen evts)" << endl;
printf("Total number of events: %10.2f %9i\n", yield_total , yGen_total );
if( mySample->IsData() ) {
printf("Events passing duplicate removal: %10.2f %9i\n", yield_unique , yGen_unique );
printf("Events passing filters and trigger: %10.2f %9i\n", yield_filter , yGen_filter );
}
printf("Events with 1st vertex good: %10.2f %9i\n", yield_vtx , yGen_vtx );
printf("Events with at least 1 good lepton: %10.2f %9i\n", yield_1goodlep , yGen_1goodlep );
printf("Events passing lepton selection: %10.2f %9i\n", yield_lepSel , yGen_lepSel );
printf("\nEvents passing 2-lep requirement: %10.2f %9i\n", yield_2lepCR , yGen_2lepCR );
printf(" Events with veto lepton: %10.2f %9i\n", yield_2lepveto , yGen_2lepveto );
printf(" Events with isolated track: %10.2f %9i\n", yield_trkVeto , yGen_trkVeto );
printf(" Events with identified tau: %10.2f %9i\n\n", yield_tauVeto , yGen_tauVeto );
printf("Events with at least 2 jets: %10.2f %9i\n", yield_njets , yGen_njets );
printf("Events with at least 1 b-tag: %10.2f %9i\n", yield_1bjet , yGen_1bjet );
printf("Events with MET > 250 GeV: %10.2f %9i\n", yield_METcut , yGen_METcut );
printf("Events with MT > 150 GeV: %10.2f %9i\n", yield_MTcut , yGen_MTcut );
printf("Events with min dPhi > 0.5: %10.2f %9i\n", yield_dPhi , yGen_dPhi );
// printf("Events with chi2 < 10: %10.2f %9i\n", yield_chi2 , yGen_chi2 );
printf("Yield after preselection: %10.2f %9i\n", yield_chi2 , yGen_chi2 );
if ( nEventsChain != nEventsTotal ) {
cout << Form( "ERROR: number of events from files (%d) is not equal to total number of events (%d)", nEventsChain, nEventsTotal ) << endl;
}
///////////////////////////////////////////////////////////////////////////////
// Store histograms and clean them up
TFile* plotfile = new TFile( myAnalysis->GetPlotFileName(), "READ");
TFile* systfile = new TFile( myAnalysis->GetSystFileName(), "READ");
TFile* sourcefile;
// Certain histograms are cumulative across multiple samples. For those histograms, add what the
// looper has just collected to the cumulative version stored in our output files
for( int j=0; j<=nVariations; j++ ) {
if( j==0 ) sourcefile = plotfile;
else sourcefile = systfile;
for( int i=0; i<nSigRegs; i++ ) {
// Build up cumulative histo of SUSY scan yields
TH2D* hTemp2 = (TH2D*)sourcefile->Get( h_sigyields[i][j]->GetName() );
if( hTemp2 != 0 ) h_sigyields[i][j]->Add( hTemp2 );
// Build up cumulative histo of yields by signal/background type
TH1D* hTemp = (TH1D*)sourcefile->Get( h_evttype_sum[i][j]->GetName() );
if( hTemp != 0 ) h_evttype_sum[i][j]->Add( hTemp );
}
}
delete plotfile;
delete systfile;
// Take all histograms in histdir and write them to plotfile
plotfile = new TFile( myAnalysis->GetPlotFileName(), "UPDATE");
plotfile->cd();
histdir->GetList()->Write( "", TObject::kOverwrite );
delete plotfile;
// Take all histograms in systdir and write them to systfile
systfile = new TFile( myAnalysis->GetSystFileName(), "UPDATE");
systfile->cd();
systdir->GetList()->Write( "", TObject::kOverwrite );
delete systfile;
// Cleanup
zerodir->Close();
histdir->Close();
systdir->Close();
// return
bmark->Stop("benchmark");
cout << endl;
cout << nEventsTotal << " Events Processed" << endl;
cout << "------------------------------" << endl;
cout << "CPU Time: " << Form( "%.01f", bmark->GetCpuTime("benchmark") ) << endl;
cout << "Real Time: " << Form( "%.01f", bmark->GetRealTime("benchmark") ) << endl;
cout << endl;
delete bmark;
return 0;
}
示例7: bfcMixer_pp2006
//.........这里部分代码省略.........
chain3->Load();
chain3->Instantiate();
//............. begin of EMC embedding makers................
//.............. Add BEmc stuff here ....................
StMcEventMaker* mcEventMaker = new StMcEventMaker();
StEmcSimulatorMaker *bemcSim = new StEmcSimulatorMaker();
StEmcMixerMaker *bemcMixer = new StEmcMixerMaker();
chain3->AddAfter("emcRaw",bemcMixer);
chain3->AddAfter("emcRaw",bemcSim);
chain3->AddAfter("emcRaw",mcEventMaker);
bemcMixer->SetDebug(0); // set it to 1 for more printouts
// note, Barrel slow sim is always ON, said Adam
//........... Add EEmc Stuff ( Simu, and Mixer) here ..............
StEEmcFastMaker *eemcFastSim = new StEEmcFastMaker();
StEEmcMixerMaker *eemcMixer = new StEEmcMixerMaker();
/* position B+E EMC makers in the chain
(order is reverse because 'After' is used - looks funny but is right)
*/
chain3->AddAfter("emcRaw",eemcMixer);
chain3->AddAfter("emcRaw",eemcFastSim);
eemcFastSim->SetEmbeddingMode();
// eemcFastSim->SetDebug();
// eemcMixer->SetDebug();
if(useEndcapSlowSim) { // turn Endcap slow simu On/Off
StEEmcSlowMaker *slowSim=new StEEmcSlowMaker();
chain3->AddAfter("EEmcFastSim",slowSim);
slowSim->setEmbeddingMode();
}
//............. end of EMC embedding makers................
St_geant_Maker *geantMk = (St_geant_Maker *) chain->GetMaker("geant");
geantMk->SetActive(kTRUE);
StMaker *tpcdaqMk = chain3->GetMaker("tpc_raw");
if(!tpcdaqMk ) {
cout <<" Error: no tpc daq maker. End. "<<endl;
return;
}
tpcdaqMk->SetMode(1); // Trs
tpcdaqMk->SetInput("Event","MixerEvent");
saveMk->cd(); {
TDatime t;
printf ("QAInfo:Run is started at Date/Time%i/%i\n",t.GetDate(),t.GetTime());
}
printf ("QAInfo:Run on %s in %s\n",
gSystem->HostName(),
gSystem->WorkingDirectory());
printf ("QAInfo: with %s\n", chain->GetCVS());
// Init the chain and all its makers
if (Nevents >= 0) {
Int_t iInit = chain->Init();
chain->ls(5); // list the final chain
}
// chain->SetDEBUG();
treeMk = chain->GetMaker("tree");
TBenchmark evnt;
Int_t iMake = 0, i = 1, iBad = 0;
StIOMaker *inpMk = (StIOMaker *)chain1->GetMaker("inputStream");
Int_t ncols, eventnumber, mult, skip=0, oldskip = 0, skiptest=0;
cout <<"BFC - Entering Event Loop"<<endl;
EventLoop: if (i <= Nevents && iMake != kStEOF && iMake != kStFatal) {
evnt.Reset();
evnt.Start("QAInfo:");
chain->Clear();
iMake = chain->Make(i);
if (treeMk && iMake == kStErr) {treeMk->Make(i); iBad++;}
StEvtHddr *fEvtHddr = (StEvtHddr*)chain->GetDataSet("EvtHddr");
StEvtHddr *fEvtHddrDaq = (StEvtHddr*)chain1->GetDataSet("EvtHddr");
*fEvtHddr = *fEvtHddrDaq;
// gSystem->Exec("ps ux");
evnt.Stop("QAInfo:");
// evnt->Show("QAInfo:");
printf ("QAInfo: Done with Event [no. %d/run %d/evt. %d/Date.Time%d.%d/sta %d] Real Time = %10.2f seconds Cpu Time = %10.2f seconds \n", i,chain->GetRunNumber(),chain->GetEventNumber(),chain->GetDate(), chain->GetTime(),
iMake,evnt.GetRealTime("QAInfo:"),evnt.GetCpuTime("QAInfo:"));
i++;
goto EventLoop;
}
fflush(stdout);
printf ("QAInfo:Run completed ");
gSystem->Exec("date");
}
示例8: ScanChain
int ScanChain( TChain* chain, bool fast = true, int nEvents = -1, string skimFilePrefix = "test") {
// Benchmark
TBenchmark *bmark = new TBenchmark();
bmark->Start("benchmark");
// Example Histograms
TDirectory *rootdir = gDirectory->GetDirectory("Rint:");
TH1F *samplehisto = new TH1F("samplehisto", "Example histogram", 200,0,200);
samplehisto->SetDirectory(rootdir);
// Loop over events to Analyze
unsigned int nEventsTotal = 0;
unsigned int nEventsChain = chain->GetEntries();
if( nEvents >= 0 ) nEventsChain = nEvents;
TObjArray *listOfFiles = chain->GetListOfFiles();
TIter fileIter(listOfFiles);
TFile *currentFile = 0;
// File Loop
while ( (currentFile = (TFile*)fileIter.Next()) ) {
// Get File Content
TFile *file = new TFile( currentFile->GetTitle() );
TTree *tree = (TTree*)file->Get("t");
if(fast) TTreeCache::SetLearnEntries(10);
if(fast) tree->SetCacheSize(128*1024*1024);
cms3.Init(tree);
// Loop over Events in current file
if( nEventsTotal >= nEventsChain ) continue;
unsigned int nEventsTree = tree->GetEntriesFast();
for( unsigned int event = 0; event < nEventsTree; ++event) {
// Get Event Content
if( nEventsTotal >= nEventsChain ) continue;
if(fast) tree->LoadTree(event);
cms3.GetEntry(event);
++nEventsTotal;
// Progress
StopBabies10012015::progress( nEventsTotal, nEventsChain );
// Analysis Code
}
// Clean Up
delete tree;
file->Close();
delete file;
}
if ( nEventsChain != nEventsTotal ) {
cout << Form( "ERROR: number of events from files (%d) is not equal to total number of events (%d)", nEventsChain, nEventsTotal ) << endl;
}
// Example Histograms
samplehisto->Draw();
// return
bmark->Stop("benchmark");
cout << endl;
cout << nEventsTotal << " Events Processed" << endl;
cout << "------------------------------" << endl;
cout << "CPU Time: " << Form( "%.01f", bmark->GetCpuTime("benchmark") ) << endl;
cout << "Real Time: " << Form( "%.01f", bmark->GetRealTime("benchmark") ) << endl;
cout << endl;
delete bmark;
return 0;
}
示例9: ScanChain
//.........这里部分代码省略.........
file_d << mt2_150_counter << endl;
file_d << mt2_160_counter << endl;
file_d << mt2_170_counter << endl;
file_d << mt2_180_counter << endl;
file_d << mt2_190_counter << endl;
file_d << mt2_200_counter << endl;
file_d << mt2_G200_counter << endl;
file_d << "^^^ MT2 > 200: " << endl;
}
}
else if (file_count == 3){
ofstream file_w(Form("/home/users/sanil/single/%shists/lep30wjets_mt2_bin.txt",date));
if(!file_w.is_open()){return 0;}
if( file_w.is_open()){
file_w << "total W+Jets events: " << totalEvents << endl;
file_w << "starts with 0 < MT2 <= 10, and goes on increments of 10 geV; " << endl;
file_w << mt2_0_counter *scale_1fb()*5.2 << endl;
file_w << mt2_10_counter *scale_1fb()*5.2 << endl;
file_w << mt2_20_counter *scale_1fb()*5.2 << endl;
file_w << mt2_30_counter *scale_1fb()*5.2 << endl;
file_w << mt2_40_counter *scale_1fb()*5.2 << endl;
file_w << mt2_50_counter *scale_1fb()*5.2 << endl;
file_w << mt2_60_counter *scale_1fb()*5.2 << endl;
file_w << mt2_70_counter *scale_1fb()*5.2 << endl;
file_w << mt2_80_counter *scale_1fb()*5.2 << endl;
file_w << mt2_90_counter *scale_1fb()*5.2 << endl;
file_w << mt2_100_counter *scale_1fb()*5.2 << endl;
file_w << mt2_110_counter *scale_1fb()*5.2 << endl;
file_w << mt2_120_counter *scale_1fb()*5.2 << endl;
file_w << mt2_130_counter *scale_1fb()*5.2 << endl;
file_w << mt2_140_counter *scale_1fb()*5.2 << endl;
file_w << mt2_150_counter *scale_1fb()*5.2 << endl;
file_w << mt2_160_counter *scale_1fb()*5.2 << endl;
file_w << mt2_170_counter *scale_1fb()*5.2 << endl;
file_w << mt2_180_counter *scale_1fb()*5.2 << endl;
file_w << mt2_190_counter *scale_1fb()*5.2 << endl;
file_w << mt2_200_counter *scale_1fb()*5.2 << endl;
file_w << mt2_G200_counter*scale_1fb()*5.2 << endl;
file_w << "^^^ MT2 > 200 ^^^" << endl;
}
}
else if (file_count == 2){
ofstream file_t(Form("/home/users/sanil/single/%shists/lep30ttbar_mt2_bin.txt",date));
if(!file_t.is_open()){return 0;}
if( file_t.is_open()){
file_d << "total tt~ events: " << totalEvents << endl;
file_t << "starts with 0 < MT2 <= 10, and goes on increments of 10 geV; " << endl;
file_t << mt2_0_counter *scale_1fb()*5.2 << endl;
file_t << mt2_10_counter *scale_1fb()*5.2 << endl;
file_t << mt2_20_counter *scale_1fb()*5.2 << endl;
file_t << mt2_30_counter *scale_1fb()*5.2 << endl;
file_t << mt2_40_counter *scale_1fb()*5.2 << endl;
file_t << mt2_50_counter *scale_1fb()*5.2 << endl;
file_t << mt2_60_counter *scale_1fb()*5.2 << endl;
file_t << mt2_70_counter *scale_1fb()*5.2 << endl;
file_t << mt2_80_counter *scale_1fb()*5.2 << endl;
file_t << mt2_90_counter *scale_1fb()*5.2 << endl;
file_t << mt2_100_counter*scale_1fb()*5.2 << endl;
file_t << mt2_110_counter*scale_1fb()*5.2 << endl;
file_t << mt2_120_counter*scale_1fb()*5.2 << endl;
file_t << mt2_130_counter*scale_1fb()*5.2 << endl;
file_t << mt2_140_counter*scale_1fb()*5.2 << endl;
file_t << mt2_150_counter*scale_1fb()*5.2 << endl;
file_t << mt2_160_counter*scale_1fb()*5.2 << endl;
file_t << mt2_170_counter*scale_1fb()*5.2 << endl;
file_t << mt2_180_counter*scale_1fb()*5.2 << endl;
file_t << mt2_190_counter*scale_1fb()*5.2 << endl;
file_t << mt2_200_counter*scale_1fb()*5.2 << endl;
file_t << mt2_G200_counter*scale_1fb()*5.2 << endl;
file_t << "^^^ MT2 > 200 ^^^" << endl;
}
///txt output end///
}
//MT2 count writing END//
// Clean Up
delete tree;
file->Close();
delete file;
file_count++;
} //file_loop
fake_wpt_h->Draw();
if ( nEventsChain != nEventsTotal ) {
cout << Form( "ERROR: number of events from files (%d) is not equal to total number of events (%d)", nEventsChain, nEventsTotal ) << endl;
}
// return
bmark->Stop("benchmark");
cout << endl;
cout << nEventsTotal << " Events Processed" << endl;
cout << "------------------------------" << endl;
cout << "CPU Time: " << Form( "%.01f", bmark->GetCpuTime("benchmark") ) << endl;
cout << "Real Time: " << Form( "%.01f", bmark->GetRealTime("benchmark") ) << endl;
cout << endl;
delete bmark;
return 0;
}
示例10: ScanChain
//.........这里部分代码省略.........
if(fast) tree->LoadTree(event);
cms3.GetEntry(event);
++nEventsTotal;
// Progress
CMS3::progress( nEventsTotal, nEventsChain );
float weight = cms3.scale1fb()*2.26;
if(event==0) cout << "weight " << weight << " nEvents " << cms3.nEvents() << " filename " << currentFile->GetTitle() << endl;
//ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<float> > metlv;
//metlv.SetPxPyPzE(pfmet()*TMath::Cos(pfmet_phi()),pfmet()*TMath::Sin(pfmet_phi()),0.,pfmet());
int NSLeps = 0;
int NAddVetoLeps = 0;
if(lep1_is_mu()){
if(lep1_pt()>20&&fabs(lep1_eta())<2.4) {++NSLeps;}
} else if (lep1_is_el()){
if(lep1_pt()>20&&fabs(lep1_eta())<1.4442) {++NSLeps; }
} if(lep2_is_mu()){
if(lep2_pt()>20&&fabs(lep2_eta())<2.4) {++NSLeps;}
} else if (lep2_is_el()){
if(lep2_pt()>20&&fabs(lep2_eta())<1.4442) {++NSLeps; }
}
if(lep2_is_mu()){
if(lep2_pt()>10&&fabs(lep2_eta())<2.4) {++NAddVetoLeps;}
} else if (lep2_is_el()){
if(lep2_pt()>10&&fabs(lep2_eta())<2.4) {++NAddVetoLeps; }
}
if(nvtxs()<0) continue;
if(ngoodleps()!=1) continue;
if(nvetoleps()!=1) continue;
if(!PassTrackVeto_v3()) continue;
if(!PassTauVeto()) continue;
if(ngoodjets()<2) continue;
if(ngoodbtags()<1) continue;
if(pfmet()<100) continue;
if(mt_met_lep()< 50) continue;
//if(pfmet()<250) continue;
//if(mt_met_lep()<150) continue;
//if(mindphi_met_j1_j2()<0.8) continue;
string samplename = skimFilePrefix;
if(skimFilePrefix=="TTbar"){
if(is2lep() ) samplename = "TTbar2l";
else if(is1lepFromTop() ) samplename = "TTbar1l";
else continue;
}
if(ngoodjets()>=2 && mindphi_met_j1_j2()>0.8 && pfmet()>250) histos["MT_"+samplename]->Fill(mt_met_lep(),weight);
if(ngoodjets()>=2 && mindphi_met_j1_j2()>0.8 && pfmet()>350) histos["MT_harder_"+samplename]->Fill(mt_met_lep(),weight);
if(ngoodjets()>=3 && mindphi_met_j1_j2()>0.8 && pfmet()>250 && mt_met_lep()>150) histos["MT2W_"+samplename]->Fill(MT2W(),weight);
if(ngoodjets()>=4 && mindphi_met_j1_j2()>0.8 && pfmet()>250 && mt_met_lep()>150) histos["MT2W_4j_"+samplename]->Fill(MT2W(),weight);
if(ngoodjets()>=2 && mindphi_met_j1_j2()>0.8 && mt_met_lep()>150) histos["MET_"+samplename]->Fill(pfmet(),weight);
if(ngoodjets()>=3 && mindphi_met_j1_j2()>0.8 && mt_met_lep()>150) histos["MET_3j_"+samplename]->Fill(pfmet(),weight);
if(ngoodjets()>=4 && mindphi_met_j1_j2()>0.8 && mt_met_lep()>150) histos["MET_4j_"+samplename]->Fill(pfmet(),weight);
if(ngoodjets()>=3 && mindphi_met_j1_j2()>0.8 && mt_met_lep()>150 && MT2W()>200) histos["MET_hMT2W_"+samplename]->Fill(pfmet(),weight);
if(ngoodjets()>=4 && mindphi_met_j1_j2()>0.8 && mt_met_lep()>150 && MT2W()>200) histos["MET_hMT2W_4j_"+samplename]->Fill(pfmet(),weight);
if(ngoodjets()>=2 && pfmet()>250 && mt_met_lep()>150) histos["MinDPhi_"+samplename]->Fill(mindphi_met_j1_j2(),weight);
if(ngoodjets()>=2 && pfmet()>350 && mt_met_lep()>150) histos["MinDPhi_harder_"+samplename]->Fill(mindphi_met_j1_j2(),weight);
if(ngoodjets()>=3 && pfmet()>250 && mt_met_lep()>150) histos["MinDPhi_3j_"+samplename]->Fill(mindphi_met_j1_j2(),weight);
if(ngoodjets()>=4 && pfmet()>250 && mt_met_lep()>150) histos["MinDPhi_4j_"+samplename]->Fill(mindphi_met_j1_j2(),weight);
if(ngoodjets()>=2 && mindphi_met_j1_j2()>0.8 && pfmet()>250 && mt_met_lep()>150) histos["NJets_"+samplename]->Fill(ngoodjets(),weight);
if(ngoodjets()==2 && mindphi_met_j1_j2()>0.8 && pfmet()>250 && mt_met_lep()>150 && topnessMod()>6.4) histos["NJets_hard_"+samplename]->Fill(ngoodjets(),weight);
if(ngoodjets()>=3 && mindphi_met_j1_j2()>0.8 && pfmet()>250 && mt_met_lep()>150 && MT2W()>200) histos["NJets_hard_"+samplename]->Fill(ngoodjets(),weight);
if(ngoodjets()==2 && mindphi_met_j1_j2()>0.8 && pfmet()>350 && mt_met_lep()>150 && topnessMod()>6.4) histos["NJets_harder_"+samplename]->Fill(ngoodjets(),weight);
if(ngoodjets()>=3 && mindphi_met_j1_j2()>0.8 && pfmet()>350 && mt_met_lep()>150 && MT2W()>200) histos["NJets_harder_"+samplename]->Fill(ngoodjets(),weight);
if(ngoodjets()>=2 && mindphi_met_j1_j2()>0.8 && pfmet()>250 && mt_met_lep()>150) histos["tMod_"+samplename]->Fill(topnessMod(),weight);
if(ngoodjets()==2 && mindphi_met_j1_j2()>0.8 && pfmet()>250 && mt_met_lep()>150) histos["tMod_2j_"+samplename]->Fill(topnessMod(),weight);
}//event loop
// Clean Up
delete tree;
file->Close();
delete file;
}//file loop
if ( nEventsChain != nEventsTotal ) {
cout << Form( "ERROR: number of events from files (%d) is not equal to total number of events (%d)", nEventsChain, nEventsTotal ) << endl;
}
string filename = "rootfiles/PASfigure.root";
TFile *f = new TFile(filename.c_str(),"update");
f->cd();
for(map<string,TH1F*>::iterator h= histos.begin(); h!= histos.end();++h) h->second->Write();
f->Close();
cout << "Saved histos in " << f->GetName() << endl;
delete f;
// return
bmark->Stop("benchmark");
cout << endl;
cout << nEventsTotal << " Events Processed" << endl;
cout << "------------------------------" << endl;
cout << "CPU Time: " << Form( "%.01f", bmark->GetCpuTime("benchmark") ) << endl;
cout << "Real Time: " << Form( "%.01f", bmark->GetRealTime("benchmark") ) << endl;
cout << endl;
delete bmark;
return 0;
}
示例11: ScanChain
//.........这里部分代码省略.........
// Progress
lepfilter::progress( nEventsTotal, nEventsChain );
// Analysis Code
float weight = ss.scale1fb()*10.0;
if(ss.scale1fb() > 100000.) continue; //excludes 5to10 and 10to20 EM Enriched
bool jetptcut = false;
int jetidx = 0;
while( (jetidx < ss.jets().size()) && !jetptcut) //check to see if at least one jet w/ pt > 40
{
if( ss.jets()[jetidx].pt() > 40. )
{jetptcut = true;}
jetidx++;
}
if( !(jetptcut && ss.met() < 20. && ss.mt() < 20) )
{continue;}
// if(ss.nFOs() != 1) //if more than 1 FO in event
// {continue;}
int nbtags = 0;
for(int i = 0; i < ss.jets().size(); i++){
if(ss.jets_disc()[i] > 0.814) nbtags++;
}
if (nbtags > 2.) nbtags = 2;
if(ss.p4().pt() > 100. || ss.p4().pt() < 10. || fabs(ss.p4().eta()) > 2.4) //What do we want here?
{continue;}
//------------------------------------------------------------------------------------------
//---------------------------------Find e = f(Pt,eta)---------------------------------------
//------------------------------------------------------------------------------------------
//Find ratio of nonprompt leps passing tight to nonprompt leps passing at least loose. This is the fake rate
// Use lep_passes_id to see if num. Use FO to see if Fakable Object (denom)
//Calculate e=Nt/(Nl) where l->loose (as opposed to loose-not-tight).
//Using gen level info to see if prompt -> no prompt contamination in measurement region
//everything else is RECO (p4, id, passes_id, FO, etc.)
if( ss.motherID() != 1 && (doBonly==0 || ss.motherID() == -1) && (doConly==0 || ss.motherID() == -2) && (doLightonly==0 || ss.motherID() == 0) ) //if el is nonprompt (GEN info)
{
if( abs( ss.id() ) == 11 ) // it's an el
{
if(ss.FO_NoIso()) pTrelvsIso_histo_el->Fill( ss.iso(), ss.ptrelv1() );
}
if( abs( ss.id() ) == 13 ) // it's a mu
{
if(ss.FO_NoIso()) pTrelvsIso_histo_mu->Fill( ss.iso(), ss.ptrelv1() );
}
}
//---------------------------------------------------------------------------------------------------------------------------
}//end event loop
// Clean Up
delete tree;
file->Close();
delete file;
}
if ( nEventsChain != nEventsTotal ) {
cout << Form( "ERROR: number of events from files (%d) is not equal to total number of events (%d)", nEventsChain, nEventsTotal ) << endl;
}
pTrelvsIso_histo_el->GetXaxis()->SetTitle("Iso");
pTrelvsIso_histo_el->GetYaxis()->SetTitle("pTrel");
pTrelvsIso_histo_mu->GetXaxis()->SetTitle("Iso");
pTrelvsIso_histo_mu->GetYaxis()->SetTitle("pTrel");
gStyle->SetOptStat(0);
gStyle->SetPaintTextFormat("1.3f");
TCanvas *c9=new TCanvas("c9","B pTrel vs Iso (el)",800,800);
pTrelvsIso_histo_el->Draw("colz,texte");
TCanvas *c10=new TCanvas("c10","B pTrel vs Iso (mu)",800,800);
pTrelvsIso_histo_mu->Draw("colz,texte");
//---save histos-------//
TFile *OutputFile = new TFile(outfile,"recreate");
pTrelvsIso_histo_el->Write();
pTrelvsIso_histo_mu->Write();
OutputFile->Close();
// return
bmark->Stop("benchmark");
cout << endl;
cout << nEventsTotal << " Events Processed" << endl;
cout << "------------------------------" << endl;
cout << "CPU Time: " << Form( "%.01f", bmark->GetCpuTime("benchmark") ) << endl;
cout << "Real Time: " << Form( "%.01f", bmark->GetRealTime("benchmark") ) << endl;
cout << endl;
delete bmark;
return 0;
}
示例12: ScanChain
//.........这里部分代码省略.........
}
if(version==13){
if(mlb){
if(met>350) mybin = 6; else if(met>300) mybin = 5; else mybin = 4;
}
else if(met>425) mybin = 3; else if(met>325) mybin = 2; else mybin = 1;
}
if(version==14){
if(m2w){
if(met>500) mybin = 8; else if(met>400) mybin = 7; else if(met>350) mybin = 6; else if(met>300) mybin = 5; else mybin = 4;
}
else if(met>350) mybin = 3; else if(met>300) mybin = 2; else mybin = 1;
}
if(version==15){
if(met>500) mybin = 5; else if(met>400) mybin = 4; else if(met>350) mybin = 3; else if(met>300) mybin = 2; else mybin = 1;
}
//cout << __LINE__ << " mybin " << mybin << " " << samplename << endl;
//cout << "SRyield_" + samplename << endl;
histos["SRyield_" + samplename]->Fill(mybin,weight);
}
// Clean Up
delete tree;
file->Close();
delete file;
}
if ( nEventsChain != nEventsTotal ) {
cout << Form( "ERROR: number of events from files (%d) is not equal to total number of events (%d)", nEventsChain, nEventsTotal ) << endl;
}
//do all postrunning modifications here - maybe need some additional code if running over additional types of babies
//i.e.if we have additional babies, run extra, hadd files and do further modifications (note you might need to store additional histos)
for(unsigned int b = 0; b<2; ++b){
string samplename = skimFilePrefix;
TString helper = TString(samplename);
if(skimFilePrefix!="TTbar"&&b>0) continue;
if(skimFilePrefix=="TTbar"&&b==0) samplename = "TTbar1l";
if(skimFilePrefix=="TTbar"&&b==1) samplename = "TTbar2l";
if(skimFilePrefix=="TTbar"&&b==2) samplename = "TTbarH";
string mapname;
for(int i = 1; i<=histos["SRyield_"+samplename]->GetNbinsX();++i){
if(histos["SRyield_"+samplename]->Integral()>0) {
if(histos["SRyield_"+samplename]->GetBinContent(i)>0){
histos["StatUnc_"+samplename]->SetBinContent(i, histos["SRyield_"+samplename]->GetBinError(i)/histos["SRyield_"+samplename]->GetBinContent(i));
}
else histos["StatUnc_"+samplename]->SetBinContent(i, -999);
histos["SystUnc_"+samplename]->SetBinContent(i, 0.3);
}
}
}
//save all relevant histograms into some rootfiles
for(unsigned int b = 0; b<2; ++b){
string samplename = skimFilePrefix;
TString helper = TString(samplename);
if(skimFilePrefix!="TTbar"&&b>0) continue;
if(skimFilePrefix=="TTbar"&&b==0) samplename = "TTbar1l";
if(skimFilePrefix=="TTbar"&&b==1) samplename = "TTbar2l";
if(skimFilePrefix=="TTbar"&&b==2) continue;
string filename = "inputfiles/"+samplename+".root";
if(version== 1) filename = "inputfiles/v1/"+samplename+".root";
if(version== 2) filename = "inputfiles/v2/"+samplename+".root";
if(version== 3) filename = "inputfiles/v3/"+samplename+".root";
if(version== 4) filename = "inputfiles/v4/"+samplename+".root";
if(version== 5) filename = "inputfiles/v5/"+samplename+".root";
if(version== 6) filename = "inputfiles/v6/"+samplename+".root";
if(version== 7) filename = "inputfiles/v7/"+samplename+".root";
if(version== 8) filename = "inputfiles/v8/"+samplename+".root";
if(version== 9) filename = "inputfiles/v9/"+samplename+".root";
if(version==10) filename = "inputfiles/v10/"+samplename+".root";
if(version==11) filename = "inputfiles/v11/"+samplename+".root";
if(version==12) filename = "inputfiles/v12/"+samplename+".root";
if(version==13) filename = "inputfiles/v13/"+samplename+".root";
if(version==14) filename = "inputfiles/v14/"+samplename+".root";
if(version==15) filename = "inputfiles/v15/"+samplename+".root";
if(version==16) filename = "inputfiles/v16/"+samplename+".root";
if(version==17) filename = "inputfiles/v17/"+samplename+".root";
TFile *f = new TFile(filename.c_str(),"RECREATE");
f->cd();
string mapname;
for(unsigned int i = 0; i<histonames.size();++i){
mapname = histonames[i] + "_" + samplename;
if(storeh) histos[mapname]->Write();
}
f->Close();
cout << "Saved histos in " << f->GetName() << endl;
}
// return
bmark->Stop("benchmark");
cout << endl;
cout << nEventsTotal << " Events Processed" << endl;
cout << "------------------------------" << endl;
cout << "CPU Time: " << Form( "%.01f", bmark->GetCpuTime("benchmark") ) << endl;
cout << "Real Time: " << Form( "%.01f", bmark->GetRealTime("benchmark") ) << endl;
cout << endl;
delete bmark;
return 0;
}
示例13: looper
//.........这里部分代码省略.........
h2_BTaggingEff_csv_tight_Num_b->Fill( std::min(pt,pt_max), std::min(fabs(eta),eta_max) );
h2_BTaggingEff_csv_fineBinning_tight_Num_b->Fill( std::min(pt,pt_max_fine), std::min(fabs(eta),eta_max_fine) );
}
} // end if b-jet
// c-jets
if( abs(flav) == 4 ){
h2_BTaggingEff_csv_Denom_c->Fill( std::min(pt,pt_max), std::min(fabs(eta),eta_max) );
h2_BTaggingEff_csv_fineBinning_Denom_c->Fill( std::min(pt,pt_max_fine), std::min(fabs(eta),eta_max_fine) );
if( csv > csv_wp_loose ){
h2_BTaggingEff_csv_loose_Num_c->Fill( std::min(pt,pt_max), std::min(fabs(eta),eta_max) );
h2_BTaggingEff_csv_fineBinning_loose_Num_c->Fill( std::min(pt,pt_max_fine), std::min(fabs(eta),eta_max_fine) );
}
if( csv > csv_wp_med ){
h2_BTaggingEff_csv_med_Num_c->Fill( std::min(pt,pt_max), std::min(fabs(eta),eta_max) );
h2_BTaggingEff_csv_fineBinning_med_Num_c->Fill( std::min(pt,pt_max_fine), std::min(fabs(eta),eta_max_fine) );
}
if( csv > csv_wp_tight ){
h2_BTaggingEff_csv_tight_Num_c->Fill( std::min(pt,pt_max), std::min(fabs(eta),eta_max) );
h2_BTaggingEff_csv_fineBinning_tight_Num_c->Fill( std::min(pt,pt_max_fine), std::min(fabs(eta),eta_max_fine) );
}
} // end if c-jet
// udsg-jets
if( abs(flav) == 3 ||
abs(flav) == 2 ||
abs(flav) == 1 ||
abs(flav) == 0 ||
abs(flav) == 21 ){
h2_BTaggingEff_csv_Denom_udsg->Fill( std::min(pt,pt_max), std::min(fabs(eta),eta_max) );
h2_BTaggingEff_csv_fineBinning_Denom_udsg->Fill( std::min(pt,pt_max_fine), std::min(fabs(eta),eta_max_fine) );
if( csv > csv_wp_loose ){
h2_BTaggingEff_csv_loose_Num_udsg->Fill( std::min(pt,pt_max), std::min(fabs(eta),eta_max) );
h2_BTaggingEff_csv_fineBinning_loose_Num_udsg->Fill( std::min(pt,pt_max_fine), std::min(fabs(eta),eta_max_fine) );
}
if( csv > csv_wp_med ){
h2_BTaggingEff_csv_med_Num_udsg->Fill( std::min(pt,pt_max), std::min(fabs(eta),eta_max) );
h2_BTaggingEff_csv_fineBinning_med_Num_udsg->Fill( std::min(pt,pt_max_fine), std::min(fabs(eta),eta_max_fine) );
}
if( csv > csv_wp_tight ){
h2_BTaggingEff_csv_tight_Num_udsg->Fill( std::min(pt,pt_max), std::min(fabs(eta),eta_max) );
h2_BTaggingEff_csv_fineBinning_tight_Num_udsg->Fill( std::min(pt,pt_max_fine), std::min(fabs(eta),eta_max_fine) );
}
} // end if udsg-jet
} // end loop over jets
}//close event loop
//
// Close input file
//
file->Close();
delete file;
}//close file loop
//
// Write and Close baby file
//
BTagEffFile->cd();
BTagEffFile->Write();
BTagEffFile->Close();
//
// Benchmarking
//
bmark->Stop("benchmark");
//
// Print Skim Cutflow
//
cout << endl;
cout << "Wrote babies into file " << BTagEffFile->GetName() << endl;
cout << "-----------------------------" << endl;
cout << "Events Processed " << nEvents_processed << endl;
cout << "-----------------------------" << endl;
cout << "CPU Time: " << Form( "%.01f", bmark->GetCpuTime("benchmark") ) << endl;
cout << "Real Time: " << Form( "%.01f", bmark->GetRealTime("benchmark") ) << endl;
cout << endl;
delete bmark;
return 0;
}
示例14: ScanChain
//.........这里部分代码省略.........
histos["SR_Xsecup"]->Fill(mStop,mLSP,SR,weight*XSup);
histos["SR_Xsecdown"]->Fill(mStop,mLSP,SR,weight*XSdown);
histos["SR_PUup"]->Fill(mStop,mLSP,SR,weight*PUup);
histos["SR_PUdown"]->Fill(mStop,mLSP,SR,weight*PUdown);
histos["SR_Bup_HF"]->Fill(mStop,mLSP,SR,weight*BSFHup);
histos["SR_Bup_LF"]->Fill(mStop,mLSP,SR,weight*BSFLup);
histos["SR_Bdown_HF"]->Fill(mStop,mLSP,SR,weight*BSFHdown);
histos["SR_Bdown_LF"]->Fill(mStop,mLSP,SR,weight*BSFLdown);
histos["SR_LepEffup"]->Fill(mStop,mLSP,SR,weight*lEffup);
histos["SR_LepEffdown"]->Fill(mStop,mLSP,SR,weight*lEffdown);
histos["SR_LepEffFSup"]->Fill(mStop,mLSP,SR,weight*lEffFSup);
histos["SR_LepEffFSdown"]->Fill(mStop,mLSP,SR,weight*lEffFSdown);
histos["SR_muRFup"]->Fill(mStop,mLSP,SR,weight*muRFup);
histos["SR_muRFdown"]->Fill(mStop,mLSP,SR,weight*muRFdown);
}
if(compressedSR>0){
if(compressedSR<=6) cout << __LINE__ << " " << compressedSR << endl;
//compressedSR is defined to not overlap with SR - can use same histogram!
histos["SRyield"]->Fill(mStop,mLSP,compressedSR,weight);
histos["SR_ISRup"]->Fill(mStop,mLSP,compressedSR,weight*ISRup);
histos["SR_ISRdown"]->Fill(mStop,mLSP,compressedSR,weight*ISRdown);
histos["SR_Xsecup"]->Fill(mStop,mLSP,compressedSR,weight*XSup);
histos["SR_Xsecdown"]->Fill(mStop,mLSP,compressedSR,weight*XSdown);
histos["SR_PUup"]->Fill(mStop,mLSP,compressedSR,weight*PUup);
histos["SR_PUdown"]->Fill(mStop,mLSP,compressedSR,weight*PUdown);
histos["SR_Bup_HF"]->Fill(mStop,mLSP,compressedSR,weight*BSFHup);
histos["SR_Bup_LF"]->Fill(mStop,mLSP,compressedSR,weight*BSFLup);
histos["SR_Bdown_HF"]->Fill(mStop,mLSP,compressedSR,weight*BSFHdown);
histos["SR_Bdown_LF"]->Fill(mStop,mLSP,compressedSR,weight*BSFLdown);
histos["SR_LepEffup"]->Fill(mStop,mLSP,compressedSR,weight*lEffup);
histos["SR_LepEffdown"]->Fill(mStop,mLSP,compressedSR,weight*lEffdown);
histos["SR_LepEffFSup"]->Fill(mStop,mLSP,compressedSR,weight*lEffFSup);
histos["SR_LepEffFSdown"]->Fill(mStop,mLSP,compressedSR,weight*lEffFSdown);
histos["SR_muRFup"]->Fill(mStop,mLSP,compressedSR,weight*muRFup);
histos["SR_muRFdown"]->Fill(mStop,mLSP,compressedSR,weight*muRFdown);
}
}//event loop
// Clean Up
delete tree;
file->Close();
delete file;
}//file loop
if ( nEventsChain != nEventsTotal ) {
cout << Form( "ERROR: number of events from files (%d) is not equal to total number of events (%d)", nEventsChain, nEventsTotal ) << endl;
}
// Example Histograms
// samplehisto->Draw();
/*
for(map<string,TH3D*>::iterator h=histos.begin(); h!=histos.end();++h){
//add overflow
//h->second->SetBinContent(h->second->GetNbinsX(), h->second->GetBinContent(h->second->GetNbinsX() )+ h->second->GetBinContent(h->second->GetNbinsX()+1) );
//h->second->SetBinError(h->second->GetNbinsX(), sqrt(pow(h->second->GetBinError(h->second->GetNbinsX() ),2)+pow(h->second->GetBinError(h->second->GetNbinsX()+1),2) ) );
//add underfloe
//h->second->SetBinContent(1, h->second->GetBinContent(1)+ h->second->GetBinContent(0) );
//h->second->SetBinError(1, sqrt(pow(h->second->GetBinError(1),2)+pow(h->second->GetBinError(0),2) ) );
}
*/
string filename = "rootfiles/signalyields/Histos_"+skimFilePrefix+".root";
TFile *f = new TFile(filename.c_str(),"RECREATE");
f->cd();
for(map<string,TH3D*>::iterator h= histos.begin(); h!= histos.end();++h) h->second->Write();
f->Close();
cout << "Saved histos in " << f->GetName() << endl;
f_el_SF->Close();
f_mu_SF_id->Close();
f_mu_SF_iso->Close();
f_mu_SF_veto_id->Close();
f_mu_SF_veto_iso->Close();
f_vetoLep_eff->Close();
f_el_FS_ID->Close();
f_el_FS_Iso->Close();
f_mu_FS_ID->Close();
f_mu_FS_Iso->Close();
// return
bmark->Stop("benchmark");
cout << endl;
cout << nEventsTotal << " Events Processed" << endl;
cout << "------------------------------" << endl;
cout << "CPU Time: " << Form( "%.01f", bmark->GetCpuTime("benchmark") ) << endl;
cout << "Real Time: " << Form( "%.01f", bmark->GetRealTime("benchmark") ) << endl;
cout << endl;
delete bmark;
delete fPU;//delete PU file
delete f_el_SF;
delete f_mu_SF_id;
delete f_mu_SF_iso;
delete f_mu_SF_veto_id;
delete f_mu_SF_veto_iso;
delete f_vetoLep_eff;
delete f_el_FS_ID;
delete f_el_FS_Iso;
delete f_mu_FS_ID;
delete f_mu_FS_Iso;
return 0;
}
示例15: looper
//.........这里部分代码省略.........
h_gen_ttbarPt_incl[iHisto]->Fill( ttbarPt, weight );
if( nGoodJets<4 ) h_gen_ttbarPt_lt4j[iHisto]->Fill( ttbarPt, weight );
if( nGoodJets>=4 ) h_gen_ttbarPt_ge4j[iHisto]->Fill( ttbarPt, weight );
}
// Gen 2nd Lep ID
if( !sample.isData && is2lep() && gen2ndLep__idx>=0 ) {
h_gen_lep2_id_incl[iHisto]->Fill( fill_bin_genLep2ID, weight );
if( ngoodjets()<4 ) h_gen_lep2_id_lt4j[iHisto]->Fill( fill_bin_genLep2ID, weight );
if( ngoodjets()>=4 ) h_gen_lep2_id_ge4j[iHisto]->Fill( fill_bin_genLep2ID, weight );
}
} // end loop over mass points (1 if not signal scan)
} // End filling of non-yield histograms
} // End loop over genClassy's
} // End loop over systematics
} // End loop over analyzers
} // End loop over events in tree
//
// Clean Up
//
delete tree;
file->Close();
delete file;
} // end loop over file list
//
// Output Sanitation
//
if ( nEventsChain != nEventsTotal ) {
cout << Form( "ERROR: number of events from files (%d) is not equal to total number of events (%d)", nEventsChain, nEventsTotal ) << endl;
}
//
// Print Selection Cutflow
//
cout << "====================================================" << endl;
cout << endl;
for(int iAna=0; iAna<nAnalyzers; iAna++) {
cout << " " << analyzers.at(iAna)->GetLabel() << " Cutflow: " << endl;
for(int iCut=1; iCut<=(int)h_cutflow[iAna]->GetNbinsX(); iCut++) {
cout << " nEvents pass " << h_cutflow[iAna]->GetXaxis()->GetBinLabel(iCut) << " = " << h_cutflow[iAna]->GetBinContent(iCut) << endl;
}
cout << endl;
cout << endl;
}
cout << "====================================================" << endl;
//
// Clean stopCORE objects
//
wgtInfo.cleanUp();
//
// Close Output File
//
f_output->Write();
f_output->Close();
//
// Clean input chain
//
chain->~TChain();
if( sample.isData ) duplicate_removal::clear_list();
//
// Benchmark Reporting
//
bmark->Stop("benchmark");
cout << endl;
cout << nEventsTotal << " Events Processed" << endl;
cout << "------------------------------" << endl;
cout << "CPU Time: " << Form( "%.01f", bmark->GetCpuTime("benchmark") ) << endl;
cout << "Real Time: " << Form( "%.01f", bmark->GetRealTime("benchmark") ) << endl;
cout << endl;
delete bmark;
cout << "====================================================" << endl;
//fclose(f_evtList);
//
// Return!
//
return 0;
} // End of function "looper"