本文整理汇总了C++中TStopwatch::Stop方法的典型用法代码示例。如果您正苦于以下问题:C++ TStopwatch::Stop方法的具体用法?C++ TStopwatch::Stop怎么用?C++ TStopwatch::Stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TStopwatch
的用法示例。
在下文中一共展示了TStopwatch::Stop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read_tree
Float_t read_tree(const char *filename = "data.root", Double_t bytes = 10000000)
{
printf("Reading events from a root tree \n");
TFile *filein = new TFile(filename,"READ");
if ( filein->IsZombie() ) {
printf("Cannot open file \n");
return 0.0;
}
Int_t nbgamma; Int_t e[1000]; // up to 1000 energies ..should be ok
TTree *treein;
treein = (TTree *)filein->Get("TEST");
if ( treein == NULL ) return 0;
else {
treein->SetBranchAddress("mult",&nbgamma);
treein->SetBranchAddress("e",&e);
}
// write events and compute the needed time
TStopwatch watch;
watch.Start();
treein->Draw("e","","goff");
watch.Stop();
cout << " --> Reading rate " << bytes / (1024*1024*watch.RealTime()) << " MB/s"<< endl ;
filein->Close(); delete filein; return bytes / (1024*1024*watch.RealTime()) ;
}
示例2: write
void write(int n) {
TRandom R;
TStopwatch timer;
TFile f1("mathcoreVectorIO_F.root","RECREATE");
// create tree
TTree t1("t1","Tree with new Float LorentzVector");
XYZTVectorF *v1 = new XYZTVectorF();
t1.Branch("LV branch","ROOT::Math::XYZTVectorF",&v1);
timer.Start();
for (int i = 0; i < n; ++i) {
double Px = R.Gaus(0,10);
double Py = R.Gaus(0,10);
double Pz = R.Gaus(0,10);
double E = R.Gaus(100,10);
v1->SetCoordinates(Px,Py,Pz,E);
t1.Fill();
}
f1.Write();
timer.Stop();
std::cout << " Time for new Float Vector " << timer.RealTime() << " " << timer.CpuTime() << std::endl;
t1.Print();
}
示例3: rec
void rec() {
// AliLog::SetGlobalDebugLevel(10);
AliCDBManager * man = AliCDBManager::Instance();
man->SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-10-Release/Residual/");
man->SetSpecificStorage("EMCAL/*","local://DB");
AliReconstruction reco;
AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., AliMagFMaps::k5kG);
AliTracker::SetFieldMap(field,kTRUE);
reco.SetUniformFieldTracking(kFALSE);
reco.SetWriteESDfriend();
reco.SetWriteAlignmentData();
AliTPCRecoParam * tpcRecoParam = AliTPCRecoParam::GetLowFluxParam();
AliTPCReconstructor::SetRecoParam(tpcRecoParam);
AliTPCReconstructor::SetStreamLevel(0);
reco.SetRunReconstruction("ITS TPC TRD TOF HMPID PHOS EMCAL MUON T0 VZERO FMD PMD ZDC");
//reco.SetInput("raw.root") ;
//AliPHOSRecoParam* recEmc = new AliPHOSRecoParamEmc();
// recEmc->SetSubtractPedestals(kFALSE);
// AliPHOSReconstructor::SetRecoParamEmc(recEmc);
reco.SetRunQA(kFALSE) ;
TStopwatch timer;
timer.Start();
reco.Run();
timer.Stop();
timer.Print();
}
示例4: run
void run(int nEvents = 100000) {
TChain* fChain = new TChain("T");
ifstream sourceFiles("input.txt");
char line[128];
int count = 0;
while (sourceFiles >> line) {
fChain->Add(line);
++count;
}
cout << count << " files added!" << endl;
sourceFiles.close();
TStopwatch timer;
timer.Start();
fChain->Process("adcAnalyzer.C+", "", 8*nEvents, 0);
timer.Stop();
cout << "\n\nDone!" << endl;
cout << "CPU Time : " << timer.CpuTime() << " s (total), " << timer.CpuTime()/nEvents << " s (per event)" << endl;
cout << "RealTime : " << timer.RealTime() << " s (total), " << timer.RealTime()/nEvents << " s (per event)" << endl;
cout << "\n";
}
示例5: sim
void sim(Int_t nev=100) {
if (gSystem->Getenv("EVENT"))
nev = atoi(gSystem->Getenv("EVENT")) ;
AliSimulation simulator;
simulator.SetMakeSDigits("TRD TOF PHOS HMPID EMCAL MUON FMD ZDC PMD T0 VZERO");
simulator.SetMakeDigitsFromHits("ITS TPC");
// simulator.SetWriteRawData("ALL","raw.root",kTRUE);
simulator.SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-15-Release/Ideal");
// simulator.SetDefaultStorage("local://$ALICE_ROOT/OCDB");
simulator.SetSpecificStorage("GRP/GRP/Data",
Form("local://%s",gSystem->pwd()));
simulator.SetRunQA(":") ;
// simulator.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ;
//
// for (Int_t det = 0 ; det < AliQA::kNDET ; det++) {
// simulator.SetQACycles(det, nev+1) ;
// }
TStopwatch timer;
timer.Start();
simulator.Run(nev);
timer.Stop();
timer.Print();
}
示例6: ana_Main_MC_arg_winscan
void ana_Main_MC_arg_winscan(string which_MC_to_use, string MCFileLocation) {
gSystem->Load("libSusyEvent.so");
// Look ../jec/JetMETObjects/README
gSystem->Load("../jec/lib/libJetMETObjects.so");
// Printing utility for ntuple variables
gROOT->LoadMacro("SusyEventPrinter.cc+");
// Main analysis code
gROOT->LoadMacro("SusyMainAna_MC_arg_windowscan.cc+");
// chain of inputs
TChain* chain = new TChain("susyTree");
//////////////// MC files /////////////////
//MCpoint* thisMCpoint = setupMCpoint(which_MC_to_use);
chain->Add(MCFileLocation.data());
//chain->Add(thisMCpoint->filepath.c_str());
//chain->Add("../susyEvents_AB_1M_ho200_v2.root");
//chain->Add("../susyEvents_newNatural.root"); //last used!!
//chain->Add("/eos/uscms/store/user/abarker/MC/newNat350_225/MC_AB_2500k_NEWnaturalHiggsinoNLSPout_mst_350_M3_5025_mu_225.root");//same thing as ../susyEvents_newNatural.root
//chain->Add("/eos/uscms/store/user/abarker/MC/st_250_ho_150/MC_AB_2500k_st_250_ho_150.root");
//chain->Add("/eos/uscms/store/user/abarker/MC/st_250_ho_200/MC_AB_2500k_st_250_ho_200.root");
//chain->Add("/eos/uscms/store/user/abarker/MC/st_350_ho_200/MC_AB_2500k_mst_350_mu_200.root");
//chain->Add("/eos/uscms/store/user/abarker/MC/ho_140/MC_AB_2500k_ho_140.root");
//chain->Add("/eos/uscms/store/user/abarker/MC/ho_200/MC_AB_2500k_ho_200.root");
//chain->Add("../susyEvents_newNatural.root");
//chain->Add("dcache:/pnfs/cms/WAX/resilient/abarker/MC/MC_AB_2500k_NEWnaturalHiggsinoNLSPout_mst_350_M3_5025_mu_225.root");
//chain->Add("dcache:/pnfs/cms/WAX/resilient/abarker/MC/MC_AB_2500k_st_250_ho_150.root");
//chain->Add("dcache:/pnfs/cms/WAX/resilient/abarker/MC/MC_AB_2500k_st_250_ho_200.root");
//chain->Add("dcache:/pnfs/cms/WAX/resilient/abarker/MC/MC_AB_2500k_mst_350_mu_200.root");
//chain->Add("dcache:/pnfs/cms/WAX/resilient/abarker/MC/MC_AB_2500k_ho_140.root");
//chain->Add("dcache:/pnfs/cms/WAX/resilient/abarker/MC/MC_AB_2500k_ho_200.root");
SusyMainAna_MC_arg_windowscan* sea = new SusyMainAna_MC_arg_windowscan(chain);
// configuration parameters
// any values given here will replace the default values
sea->SetDataset("ttbar_relval"); // dataset name
sea->SetPrintInterval(1e4); // print frequency
sea->SetPrintLevel(0); // print level for event contents
sea->SetUseTrigger(false);
sea->SetFilter(false); // filter events passing final cuts
sea->SetProcessNEvents(-1); // number of events to be processed
TStopwatch ts;
ts.Start();
sea->Loop(which_MC_to_use);
ts.Stop();
std::cout << "RealTime : " << ts.RealTime()/60.0 << " minutes" << std::endl;
std::cout << "CPUTime : " << ts.CpuTime()/60.0 << " minutes" << std::endl;
}
示例7: read
void read() {
TRandom R;
TStopwatch timer;
TFile f1("mathcoreVectorIO_F.root");
// create tree
TTree *t1 = (TTree*)f1.Get("t1");
XYZTVectorF *v1 = 0;
t1->SetBranchAddress("LV branch",&v1);
timer.Start();
int n = (int) t1->GetEntries();
std::cout << " Tree Entries " << n << std::endl;
double etot=0;
for (int i = 0; i < n; ++i) {
t1->GetEntry(i);
etot += v1->E();
}
timer.Stop();
std::cout << " Time for new Float Vector " << timer.RealTime() << " " << timer.CpuTime() << std::endl;
std::cout << " E average" << n<< " " << etot << " " << etot/double(n) << endl;
}
示例8: write_tree
Float_t write_tree(const char *filename = "data.root", Int_t nbevents = 10000000, Int_t compression = 0)
{
printf("Writing %d events in a root tree with compression level %d \n",nbevents,compression);
TFile *fileout = new TFile(filename,"recreate");
if ( fileout->IsZombie() ) {
printf("Cannot open file \n");
return 0.0;
}
fileout->SetCompressionLevel(compression);
Double_t wbytes = 0.0;
Int_t nbgamma; Int_t e[1000];
for (Int_t i = 1; i < 1000; i++) e[i] = 200*i;
TTree *treeout;
treeout = new TTree("TEST","TEST");
treeout->Branch("mult",&nbgamma,"nbgamma/I"); treeout->Branch("e",e,"e[nbgamma]/I");
// write events and compute the needed time
TStopwatch watch;
watch.Start();
for (int i = 0; i < nbevents; i++ ) {
nbgamma = 2 + i % 5; wbytes += 4.0; wbytes += nbgamma * 4.0;
treeout->Fill();
}
watch.Stop();
printf(" --> Writing rate %f MB/s [%f] \n",wbytes/(1024*1024*watch.RealTime()),wbytes/(1024*1024));
fileout->Close(); delete fileout;
return wbytes;
}
示例9: run
void run(TString runNumber)
{
TStopwatch timer;
timer.Start();
TString dirIn1 = "/Volumes/Data/kresan/s438/data/";
TString dirIn2 = "/Volumes/Data/kresan/s438/tcal/";
TString dirOut = "/Volumes/Data/kresan/s438/digi/";
TString tdiffParName = "tdiff_" + runNumber + ".dat";
TString inputFileName1 = dirIn2 + runNumber + "_tcal.root"; // name of input file
TString parFileName = dirIn1 + "params_" + runNumber + "_raw.root"; // name of parameter file
TString outputFileName = dirOut + runNumber + "_digi.root"; // name of output file
// Create analysis run -------------------------------------------------------
FairRunAna* run = new FairRunAna();
run->SetInputFile(inputFileName1.Data());
run->SetOutputFile(outputFileName.Data());
// ---------------------------------------------------------------------------
// ----- Runtime DataBase info -----------------------------------------------
FairRuntimeDb* rtdb = run->GetRuntimeDb();
FairParRootFileIo* parIo1 = new FairParRootFileIo();
parIo1->open(parFileName);
rtdb->setFirstInput(parIo1);
rtdb->setOutput(parIo1);
rtdb->saveOutput();
// ---------------------------------------------------------------------------
// Tdiff calibration ---------------------------------------------------------
R3BLandTdiff* landTdiff = new R3BLandTdiff("LandTdiff", 1);
landTdiff->SetTdiffParName(tdiffParName.Data());
run->AddTask(landTdiff);
// ---------------------------------------------------------------------------
// Analysis ------------------------------------------------------------------
R3BLandAna* landAna = new R3BLandAna("LandAna", 1);
landAna->SetNofBars(100);
run->AddTask(landAna);
// ---------------------------------------------------------------------------
// Initialize ----------------------------------------------------------------
run->Init();
FairLogger::GetLogger()->SetLogScreenLevel("INFO");
// ---------------------------------------------------------------------------
// Run -----------------------------------------------------------------------
run->Run();
// ---------------------------------------------------------------------------
timer.Stop();
Double_t rtime = timer.RealTime();
Double_t ctime = timer.CpuTime();
cout << endl << endl;
cout << "Macro finished succesfully." << endl;
cout << "Output file is " << outputFileName << endl;
cout << "Parameter file is " << parFileName << endl;
cout << "Real time " << rtime << " s, CPU time " << ctime << "s" << endl << endl;
}
示例10: sim
void sim(Int_t nev=50) {
if (gSystem->Getenv("SIM_EVENTS"))
nev = atoi(gSystem->Getenv("SIM_EVENTS"));
printf("GENERATE << %d >> events \n",nev);
gROOT->LoadMacro("IpPion.C++") ;
AliSimulation simulator;
simulator.SetMakeSDigits("PHOS");
simulator.SetMakeDigits("PHOS");
//
// Ideal OCDB
// simulator.SetDefaultStorage("local://$ALICE_ROOT/OCDB");
simulator.SetDefaultStorage("local://./OCDB");
// simulator.SetSpecificStorage("GRP/GRP/Data",
// Form("local://%s",gSystem->pwd()));
// simulator.SetDefaultStorage("alien://Folder=/alice/simulation/2008/v4-15-Release/Ideal/");
//simulator.SetSpecificStorage("GRP/Calib/MeanVertexSPD", "alien://folder=/alice/data/2010/OCDB");
//PHOS bad map from RAW OCDB
simulator.SetSpecificStorage("PHOS/*/*/","local://./OCDB");
// simulator.SetSpecificStorage("PHOS/Calib/EmcBadChannels/","local://./OCDB");
// simulator.SetSpecificStorage("PHOS/Calib/EmcGainPedestals/","local://./OCDB");
simulator.SetRunHLT("");
//
simulator.SetSpecificStorage("GRP/GRP/Data", "alien://Folder=/alice/data/2010/OCDB");
AliPHOSSimParam *simParam = AliPHOSSimParam::GetInstance() ;
simParam->SetAPDNoise(0.000001) ;
simParam->SetCellNonLineairyA(0.001) ;
// simParam->SetCellNonLineairyA(0.1) ; //Default
simParam->SetCellNonLineairyB(0.2) ;
// simParam->SetCellNonLineairyC(0.989) ; //Jan4
// simParam->SetCellNonLineairyC(0.995) ; //Jan5 - 2GeV
simParam->SetCellNonLineairyC(1.031) ; //no NL
// Vertex and Mag.field from OCDB
// simulator.UseVertexFromCDB();
simulator.UseMagFieldFromGRP();
simulator.SetRunQA(":") ;
//
// The rest
TStopwatch timer;
timer.Start();
simulator.Run(nev);
timer.Stop();
timer.Print();
}
示例11: testIntegPerf
void testIntegPerf(double x1, double x2, int n = 100000){
std::cout << "\n\n***************************************************************\n";
std::cout << "Test integration performances in interval [ " << x1 << " , " << x2 << " ]\n\n";
TStopwatch timer;
double dx = (x2-x1)/double(n);
//ROOT::Math::Functor1D<ROOT::Math::IGenFunction> f1(& TMath::BreitWigner);
ROOT::Math::WrappedFunction<> f1(func);
timer.Start();
ROOT::Math::Integrator ig(f1 );
double s1 = 0.0;
nc = 0;
for (int i = 0; i < n; ++i) {
double x = x1 + dx*i;
s1+= ig.Integral(x1,x);
}
timer.Stop();
std::cout << "Time using ROOT::Math::Integrator :\t" << timer.RealTime() << std::endl;
std::cout << "Number of function calls = " << nc/n << std::endl;
int pr = std::cout.precision(18); std::cout << s1 << std::endl; std::cout.precision(pr);
//TF1 *fBW = new TF1("fBW","TMath::BreitWigner(x)",x1, x2); // this is faster but cannot measure number of function calls
TF1 *fBW = new TF1("fBW",func2,x1, x2,0);
timer.Start();
nc = 0;
double s2 = 0;
for (int i = 0; i < n; ++i) {
double x = x1 + dx*i;
s2+= fBW->Integral(x1,x );
}
timer.Stop();
std::cout << "Time using TF1::Integral :\t\t\t" << timer.RealTime() << std::endl;
std::cout << "Number of function calls = " << nc/n << std::endl;
pr = std::cout.precision(18); std::cout << s1 << std::endl; std::cout.precision(pr);
}
示例12: testStringAPI
// test using UNURAN string interface
void testStringAPI() {
TH1D * h1 = new TH1D("h1G","gaussian distribution from Unuran",100,-10,10);
TH1D * h2 = new TH1D("h2G","gaussian distribution from TRandom",100,-10,10);
cout << "\nTest using UNURAN string API \n\n";
TUnuran unr;
if (! unr.Init( "normal()", "method=arou") ) {
cout << "Error initializing unuran" << endl;
return;
}
int n = NGEN;
TStopwatch w;
w.Start();
for (int i = 0; i < n; ++i) {
double x = unr.Sample();
h1->Fill( x );
}
w.Stop();
cout << "Time using Unuran method " << unr.MethodName() << "\t=\t " << w.CpuTime() << endl;
// use TRandom::Gaus
w.Start();
for (int i = 0; i < n; ++i) {
double x = gRandom->Gaus(0,1);
h2->Fill( x );
}
w.Stop();
cout << "Time using TRandom::Gaus \t=\t " << w.CpuTime() << endl;
assert(c1 != 0);
c1->cd(++izone);
h1->Draw();
c1->cd(++izone);
h2->Draw();
}
示例13: dmesondecaylength
void dmesondecaylength()
{
//gStyle->SetOptStat("nemruoi");
gStyle->SetTitleSize(.04,"S");
gStyle->SetOptTitle(1);
gStyle->SetTitleOffset(1.0,"X");
gStyle->SetTitleOffset(.88,"Y");
gStyle->SetTitleSize(.04,"X");
gStyle->SetTitleSize(.04,"Y");
gStyle->SetLabelSize(.035,"X");
gStyle->SetLabelSize(.035,"Y");
gStyle->SetHistLineWidth(2);
gStyle->SetOptFit(1);
gStyle->SetOptStat(0);
// ----- Timer --------------------------------------------------------
TStopwatch timer;
timer.Start();
// ------------------------------------------------------------------------
double c= 3* std::pow(10.,8.);
double mt= 1040*std::pow(10.,-15.); // mean decay time
double mass= 1.869; // rest mass in GeV/c^2
//TCanvas* can = new TCanvas("can","Radiation Length for start detector",0,0,100,100);
TCanvas *c1 = new TCanvas("c1", "c1",0,52,1191,692);
TH1D* h = new TH1D("hist","D-meson, D-meson decay length",24,0,24);
h->SetTitle("D^{+} meson decay length = c#tau#sqrt{(#gamma_{D^{+}}^{2}-1)};Momentum (GeV/c); Decay length (mm)");
Int_t ci; // for color index setting
ci = TColor::GetColor("#000099");
for (int p=1; p<=24; p++)
{
double E = p*p + mass*mass;
E= std:: sqrt(E);
double gamma = E/mass;
double decaylength = c* std::sqrt(gamma*gamma -1)*mt*1000;
std:: cout<<" Decay length=" <<decaylength<<std::endl;
h->SetLineColor(ci);
h->GetXaxis()->CenterTitle(true);
h->GetYaxis()->CenterTitle(true);
h->SetMarkerColor(2);
h->SetMarkerStyle(20);
h->SetBinContent(p,decaylength);
h->Draw("E2-text");
}
// ----- Finish -------------------------------------------------------
timer.Stop();
Double_t rtime = timer.RealTime();
Double_t ctime = timer.CpuTime();
cout << endl << endl;
cout << "Macro finished succesfully." << endl;
cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl;
cout << endl;
// ------------------------------------------------------------------------
}
示例14: runTOFCalibTaskOnProof
void runTOFCalibTaskOnProof() {
TStopwatch timer;
timer.Start();
printf("*** Open PROOF ***");
gEnv->SetValue("XSec.GSI.DelegProxy","2");
TProof::Open("alicecaf");
gProof->UploadPackage("STEERBase.par");
gProof->EnablePackage("STEERBase");
gProof->UploadPackage("ESD.par");
gProof->EnablePackage("ESD");
gProof->UploadPackage("AOD.par");
gProof->EnablePackage("AOD");
gProof->UploadPackage("ANALYSIS.par");
gProof->EnablePackage("ANALYSIS");
gProof->UploadPackage("ANALYSISalice.par");
gProof->EnablePackage("ANALYSISalice");
gProof->Load("AliTOFArray.cxx++g");
gProof->Load("AliTOFCalibTask.cxx++g");
gROOT->LoadMacro("AddTaskTOFCalib.C");
cout << "Loaded AddTaskTOFCalib macro "<< endl;
gProof->ShowEnabledPackages();
//ANALYSIS PART
//____________________________________________//
// Make the analysis manager
AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
AliESDInputHandler* esdH = new AliESDInputHandler;
esdH->SetInactiveBranches("FMD CaloCluster");
mgr->SetInputEventHandler(esdH);
Bool_t domc = kFALSE;
if (domc) {
AliMCEventHandler *mcH = new AliMCEventHandler;
mgr->SetMCtruthEventHandler(mcH);
}
//____________________________________________//
// 1st TOFCalib task
AliTOFCalibTask *taskTOFCalib = AddTaskTOFCalib();
if (!mgr->InitAnalysis()) return;
mgr->PrintStatus();
mgr->StartAnalysis("proof","/COMMON/COMMON/LHC08c11_10TeV_0.5T",1000);
timer.Stop();
timer.Print();
}
示例15: TestFitG
void TestFitG(TGraph *gr, TF1*f, Int_t n){
TStopwatch timer;
printf("%s\n",f->GetTitle());
timer.Start();
for (Int_t i=0;i<n;i++){
gr->Fit(f,"q");
}
timer.Stop();
timer.Print();
//f->Print();
}