35 gROOT->LoadMacro(
"$VMCWORKDIR/macro/run/bmnloadlibs.C");
39 TH1I *hBetta =
new TH1I(
"hBetta",
"hBetta", 400, -2., 2.);
40 hBetta->GetXaxis()->SetTitle(
"beta ");
41 hBetta->SetMarkerStyle(8);
42 hBetta->SetMarkerColor(2);
44 TH2I *hMomentumBetta =
new TH2I(
"hMomentumBeta",
"hMomentumBeta", 1000, -10., 10., 400, -2., 2.);
45 hMomentumBetta->GetXaxis()->SetTitle(
"momentum, GeV/c ");
46 hMomentumBetta->GetYaxis()->SetTitle(
"beta ");
50 TChain *eveTree =
new TChain(
"cbmsim");
51 TString inName = Form(
"$VMCWORKDIR/macro/run/%s", NameFileIn.Data());
53 cout <<
"Open file " << inName << endl << endl;
56 TClonesArray *Tof400Hits;
57 eveTree->SetBranchAddress(
"BmnTof400Hit", &Tof400Hits);
59 TClonesArray *BmnGlobTr;
60 eveTree->SetBranchAddress(
"BmnGlobalTrack", &BmnGlobTr);
62 Long64_t nEvents = eveTree->GetEntries();
63 if (nEvForRead == 0 || nEvForRead > nEvents) nEvForRead = nEvents;
64 cout <<
"Will be read " << nEvForRead <<
" events from " << nEvents << endl;
66 for (Int_t iEv = 0; iEv < nEvForRead; iEv++) {
69 cout <<
"EVENT: " << iEv << endl;
70 nBytes = eveTree->GetEntry(iEv);
72 for (Int_t iGlobTrack = 0; iGlobTrack < BmnGlobTr->GetEntriesFast(); iGlobTrack++) {
77 if (IndexTof1Hit == -1)
continue;
80 Double_t Velocity = hitTof400->
GetLength() / hitTof400->GetTimeStamp() / 10.;
81 Double_t Betta = Velocity / 2.99792458;
84 hMomentumBetta ->Fill(Momentum, Betta);
90 cout <<
"Readed " << nEvForRead <<
" events" << endl;
91 cout <<
"Time = " << timer.RealTime() <<
" s" << endl;
92 cout <<
"Time/Event = " << timer.RealTime() / (Double_t) nEvForRead * 1000. <<
" ms/Event" << endl;
93 cout <<
"TimeCPU = " << timer.CpuTime() <<
" s" << endl;
94 cout <<
"TimeCPU/Event = " << timer.CpuTime() / (Double_t) nEvForRead * 1000. <<
" ms/Event" << endl;
98 TString outName = NameFileIn;
99 Int_t Point = outName.First(
'.');
100 outName.Replace(Point, 15,
"_Identification.root");
101 outName = Form(
"/home/storage/analysis/%s", outName.Data());
102 cout <<
"Save data to " << outName.Data() << endl;
103 TFile *fileout =
new TFile(outName.Data(),
"RECREATE");
106 hMomentumBetta->Write();
112 cout <<
"Time for write root = " << timer.RealTime() <<
" s" << endl;