本文整理汇总了C++中TBenchmark::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ TBenchmark::Reset方法的具体用法?C++ TBenchmark::Reset怎么用?C++ TBenchmark::Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBenchmark
的用法示例。
在下文中一共展示了TBenchmark::Reset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: EmbeddingReco
//.........这里部分代码省略.........
#if 0
// Turn on debugging of DB maker
St_db_Maker *db = (St_db_Maker *)chain1->GetMaker("db");
db->SetDebug(2);
#endif
//--------------------------------------------------------------------------
TString trgfile = gSystem->BaseName(fzdFile.c_str());
trgfile.ReplaceAll(".fzd", ".trig.root");
TFile *ofile = TFile::Open(trgfile, "recreate");
assert(ofile);
TH2F *hBarrelHighTowerSimu = new TH2F("hBarrelHighTowerSimu", "BEMC high tower simu;trigger patch;high tower", 300, 0, 300, 64, 0, 64);
TH2F *hBarrelPatchSumSimu = new TH2F("hBarrelPatchSumSimu", "BEMC patch sum simu;trigger patch;patch sum", 300, 0, 300, 64, 0, 64);
TH2F *hEndcapHighTowerSimu = new TH2F("hEndcapHighTowerSimu", "EEMC high tower simu;trigger patch;high tower", 90, 0, 90, 64, 0, 64);
TH2F *hEndcapPatchSumSimu = new TH2F("hEndcapPatchSumSimu", "EEMC patch sum simu;trigger patch;patch sum", 90, 0, 90, 64, 0, 64);
TH2F *hBarrelJetPatchSimu = new TH2F("hBarrelJetPatchSimu", "BEMC jet patch;jet patch;adc", 18, 0, 18, 160, 0, 160);
TH2F *hEndcapJetPatchSimu = new TH2F("hEndcapJetPatchSimu", "EEMC jet patch;jet patch;adc", 6, 0, 6, 160, 0, 160);
TH2F *hOverlapJetPatchSimu = new TH2F("hOverlapJetPatchSimu", "BEMC-EEMC-overlap;jet patch;adc", 6, 0, 6, 160, 0, 160);
}
//--------------------------------------------------------------------------
// Initialize chain
Chain->Init();
PrintTimer(Chain);
puts("Order of makers in BFCMIXER:");
StMaker::lsMakers(Chain);
// Event loop
int mNTotal = 0;
int mNFailed = 0;
TBenchmark evnt;
StIOMaker *inputStream = (StIOMaker *)chain1->GetMaker("inputStream");
for (int iEvent = 1; iEvent <= nEvents; ++iEvent) {
evnt.Reset();
evnt.Start("QAInfo:");
Chain->Clear();
int iMake = Chain->Make(iEvent);
if (iMake == kStErr) ++mNFailed;
if (inputStream->GetMakeReturn() % 10 == kStEOF) {
inputStream->Rewind();
--iEvent;
continue;
}
//if (iMake == kStSkip) continue;
if (iMake % 10 == kStEOF || iMake % 10 == kStFatal) break;
++mNTotal;
PrintTimer(Chain);
//--------------------------------------------------------------------------
if (flag == "Jet") {
// BEMC high towers and trigger patches
for (int triggerpatch = 0; triggerpatch < 300; ++triggerpatch) {
hBarrelHighTowerSimu->Fill(triggerpatch, trgsim->bemc->getBEMC_FEE_HT_ADC()[triggerpatch]);
hBarrelPatchSumSimu->Fill(triggerpatch, trgsim->bemc->getBEMC_FEE_TP_ADC()[triggerpatch]);
} // for triggerpatch
// BEMC jet patches
for (int jetpatch = 0; jetpatch < 18; ++jetpatch) {
hBarrelJetPatchSimu->Fill(jetpatch, trgsim->bemc->barrelJetPatchAdc(jetpatch));
} // for jetpatch
// EEMC high towers and trigger patches
示例3: 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");
}
示例4: bfcZ
//_____________________________________________________________________
void bfcZ(const Int_t First,
const Int_t Last,
const Char_t *Chain="gstar Cy2b tfs -NoHits TpcHitFilter",
const Char_t *infile=0,
const Double_t zmin=-200, const Double_t zmax=-100,
const Char_t *outfile=0,
const Char_t *TreeFile=0){
gROOT->LoadMacro("bfc.C");
bfc(-1,Chain,infile,outfile,TreeFile);
if (chain->GetOption("TpcHitFilter")) {
StTpcHitFilterMaker *filtMk = (StTpcHitFilterMaker *) chain->GetMaker("tpc_hit_filter");
if (filtMk) {
// St_tcl_Maker *tclMk= (St_tcl_Maker *) chain->GetMaker("tpc_hits");
if (zmin < 0 && zmax < 0) filtMk->WestOff();
if (zmin > 0 && zmax > 0) filtMk->EastOff();
filtMk->SetZrange(zmin,zmax);
}
}
{
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
Int_t iTotal = 0, iBad = 0;
St_XDFFile *xdf_out = 0;
TBenchmark evnt;
Int_t iMake = 0, i = First;
if (Last >= 0) {
Int_t iInit = chain->Init();
if (iInit >= kStEOF) {
chain->Fatal(iInit,"on init");
goto END;
}
StEvtHddr *hd = (StEvtHddr*)chain->GetDataSet("EvtHddr");
if (hd) hd->SetRunNumber(-2); // to be sure that InitRun calls at least once
// skip if any
if (First > 1) {
if (chain->GetOption("fzin")) {
geant = (St_geant_Maker *) chain->GetMaker("geant");
if (geant) {
if (geant->IsActive()) geant->Skip(First-1);
}
}
else {
StIOMaker *inpMk = (StIOMaker *) chain->GetMaker("inputStream");
if (inpMk) {printf ("Skip %i Events\n",First-1);inpMk->Skip(First-1);}
}
}
}
xdf_out = chain->GetXdfOut();
if (chain->GetOption("Event")) evMk = (StEventMaker *) chain->GetMaker("StEventMaker");
treeMk = chain->GetMaker("OutputStream");
EventLoop: if (i <= Last && iMake != kStEOF && iMake != kStFatal) {
evnt.Reset();
evnt.Start("QAInfo:");
chain->Clear();
iMake = chain->Make(i);
if (iMake <kStEOF) {
if (xdf_out){
St_DataSet *dstSet = chain->GetInputDS("dst");
if (dstSet) xdf_out->NextEventPut(dstSet); // xdf output
}
iTotal++;
if (treeMk && iMake == kStErr) {treeMk->Make(i); iBad++;}
// 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;
}
END:
fflush(stdout);
printf ("QAInfo:Run completed ");
gSystem->Exec("date");
if (evMk) Event = (StEvent *) chain->GetInputDS("StEvent");
{
TDatime t;
printf ("\nQAInfo:Run is finished at Date/Time %i/%i; Total events processed :%i and not completed: %i\n",
t.GetDate(),t.GetTime(),iTotal,iBad);
}
}