1 #if !defined(__CLING__) 9 #include "~/Acculinna/ER/beamtime/data/ERBeamTimeEventHeader.h" 11 #include "~/Acculinna/ER/BeamDet/data/ERBeamDetTOFDigi.h" 24 void TOF(TClonesArray *dataF3, TClonesArray *dataF5);
33 TString inFile =
"he8_10_0010.Digi.root";
34 TString outFile =
"he8_10_0010.TOF.reco.root";
36 TString inPath =
"~/Acculinna/ER/showBeam_VC/analysed/";
37 TString outPath =
"~/Acculinna/ER/showBeam_VC/reco/";
42 TFile *fr =
new TFile(inPath + inFile);
43 TTree *tr = (TTree*)fr->Get(
"er");
45 cout <<
"Founding " << tr->GetEntries() <<
" entries" << endl;
50 TClonesArray *v_F3 =
new TClonesArray(
"ERBeamDetTOFDigi");
51 TClonesArray *v_F5 =
new TClonesArray(
"ERBeamDetTOFDigi");
54 tr->SetBranchAddress(
"EventHeader.", &header);
56 printf(
"Yey! %i\n", tr->SetBranchAddress(
"BeamDetToFDigi1", &v_F3));
57 printf(
"Yey! %i\n", tr->SetBranchAddress(
"BeamDetToFDigi2", &v_F5));
62 TFile *fw =
new TFile(outPath + outFile,
"RECREATE");
63 TTree *tw =
new TTree(
"reco",
"Selected reconstructed variables");
66 tw->Branch(
"trigger", &trigger,
"trigger/I");
67 tw->Branch(
"dE", &dE,
"dE/D");
68 tw->Branch(
"ToF", &ToF,
"ToF/D");
69 tw->Branch(
"tF3", &tF3,
"tF3/D");
70 tw->Branch(
"tF5", &tF5,
"tF5/D");
72 Long64_t noEntries = tr->GetEntries();
76 for(Long64_t nentry = 1; nentry < noEntries; nentry++) {
78 if(nentry%100000==0) cout <<
"#Event " << nentry <<
"#" << endl;
84 trigger = header->GetTrigger();
116 void TOF(TClonesArray *dataF3, TClonesArray *dataF5) {
126 F3 = dataF3->GetEntriesFast();
131 F5 = dataF5->GetEntriesFast();
136 for (Int_t i = 0; i < 1; i++) {
138 dEbeam = ((ERBeamDetTOFDigi*)dataF5->At(i))->GetEdep();
148 const Double_t timeCal = 0.125;
149 const Double_t constTOF = 89.165;
151 if (F3 == 1 && F5 == 1) {
153 Float_t timeF3, timeF5;
154 for (Int_t i = 0; i < 1; i++) {
156 timeF3 = ((ERBeamDetTOFDigi*)dataF3->At(i))->GetTime();
162 for (Int_t i = 0; i < 1; i++) {
164 timeF5 = ((ERBeamDetTOFDigi*)dataF5->At(i))->GetTime();
169 TIME = (timeF5 - timeF3) + constTOF;