{ // ----- Load libraries ------------------------------------------------ gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C"); gROOT->LoadMacro("Tools.C"); gSystem->Load("libTime"); // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ // generating time distance between two events // gaus smearing of 2*10^7 events/s bool verbose = false; TH1F *gau = new TH1F("ref","ref",1000,-3,+3); gau->FillRandom("gaus",500000); TCanvas *can = new TCanvas("can1","can1",50,50,1200,500); can -> Divide (2,1); TH1F *distr = new TH1F("distr","distr",500,0,100); // in ns Int_t nEnt = 100000; for(Int_t g = 0 ; g < nEnt ; g++) { distr->Fill( 50 + 5*(gau->GetRandom()) ); } can -> cd(1); distr -> DrawCopy(); std::string inFile = "../../../Mvd_Test_digi.root"; TH1F *time = new TH1F("tof","tof",50000,20,500); TFile* f = new TFile(inFile.c_str()); // the sim file you want to analyse TTree *t=(TTree *) f->Get("cbmsim") ; TClonesArray* digi_array=new TClonesArray("PndTimeDigiStrip"); t->SetBranchAddress("MVDStripDigis",&digi_array);//Branch names Double_t step = 0.,timeTot = 0.; for (Int_t j=0; jGetEntriesFast(); j++) { t->GetEntry(j); step = distr->GetRandom(); timeTot = timeTot + step; if (verbose) cout << timeTot << endl; if (verbose) cout<<"Event No "<GetEntriesFast(); i++) { if (verbose) cout<<"Point No "<At(i); if (verbose) cout << "TOF: " << hit->GetTof() << endl; time->Fill(timeTot + hit->GetTof()); } } can -> cd(2); time -> DrawCopy(); // ----- 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; // ------------------------------------------------------------------------ }