1 |
mocchiut |
1.1 |
/** |
2 |
|
|
* \file TrkCore.cpp |
3 |
|
|
* \author Elena Vannuccini |
4 |
|
|
*/ |
5 |
|
|
// ......................................................... |
6 |
|
|
// ROOT header files |
7 |
|
|
// ......................................................... |
8 |
|
|
#include <TTree.h> |
9 |
|
|
#include <TClassEdit.h> |
10 |
|
|
#include <TObject.h> |
11 |
|
|
#include <TList.h> |
12 |
|
|
#include <TSystem.h> |
13 |
|
|
#include <TSystemDirectory.h> |
14 |
|
|
#include <TString.h> |
15 |
|
|
#include <TFile.h> |
16 |
|
|
#include <TClass.h> |
17 |
|
|
#include <TCanvas.h> |
18 |
|
|
#include <TH1.h> |
19 |
|
|
#include <TH1F.h> |
20 |
|
|
#include <TH2D.h> |
21 |
|
|
#include <TLatex.h> |
22 |
|
|
#include <TPad.h> |
23 |
|
|
#include <TSQLServer.h> |
24 |
|
|
#include <TSQLRow.h> |
25 |
|
|
#include <TSQLResult.h> |
26 |
pam-fi |
1.11 |
#include <TBenchmark.h> |
27 |
pam-ts |
1.46 |
#include <TStopwatch.h> |
28 |
pam-fi |
1.11 |
|
29 |
mocchiut |
1.1 |
// ......................................................... |
30 |
|
|
// other general header files |
31 |
|
|
// ......................................................... |
32 |
|
|
#include <fstream> |
33 |
|
|
#include <iostream> |
34 |
|
|
// ......................................................... |
35 |
|
|
// files in the inc directory |
36 |
|
|
// ......................................................... |
37 |
|
|
#include <RunInfo.h> |
38 |
|
|
#include <GLTables.h> |
39 |
|
|
#include <TrkVerl2.h> |
40 |
|
|
#include <TrkProcess.h> |
41 |
pam-fi |
1.2 |
//#include <TrkStruct.h> |
42 |
mocchiut |
1.1 |
#include <TrkLevel2.h> |
43 |
pam-fi |
1.6 |
#include <TrkLevel1.h> |
44 |
mocchiut |
1.1 |
#include <TrkLevel0.h> |
45 |
pam-fi |
1.15 |
#include <TrkHough.h> |
46 |
mocchiut |
1.1 |
// ......................................................... |
47 |
|
|
// YODA header files |
48 |
|
|
// ......................................................... |
49 |
|
|
#include <PamelaRun.h> |
50 |
pam-fi |
1.7 |
//#include <RegistryEvent.h> |
51 |
mocchiut |
1.1 |
#include <physics/tracker/TrackerEvent.h> |
52 |
|
|
#include <CalibTrk1Event.h> |
53 |
|
|
#include <CalibTrk2Event.h> |
54 |
mocchiut |
1.42 |
// |
55 |
mocchiut |
1.43 |
// Calorimeter level1 class header and definitions |
56 |
mocchiut |
1.42 |
// |
57 |
|
|
#include <CaloLevel1.h> //EM |
58 |
mocchiut |
1.43 |
// |
59 |
|
|
// ToF level2 class header and definitions |
60 |
|
|
// |
61 |
|
|
#include <ToFLevel2.h> //EM |
62 |
pam-fi |
1.45 |
// |
63 |
|
|
// Extended tracking |
64 |
|
|
// |
65 |
|
|
#include <ExtTrkingAlg.h> //EV |
66 |
pam-fi |
1.2 |
|
67 |
mocchiut |
1.1 |
// ......................................................... |
68 |
|
|
// namespaces |
69 |
|
|
// ......................................................... |
70 |
|
|
using namespace std; |
71 |
|
|
using namespace pamela; |
72 |
|
|
// ================================================================================ |
73 |
|
|
// |
74 |
|
|
// |
75 |
|
|
// ================================================================================ |
76 |
|
|
/** |
77 |
|
|
* \brief Tracker data reduction routine. |
78 |
|
|
* |
79 |
|
|
* It performs data reduction LEVEL0->LEVEL1->LEVEL2, producing LEVEL1 and or LEVEL2 output, in ROOT or HBOOK format. |
80 |
|
|
* Input parameters: |
81 |
|
|
* @param run id of the run to be processed (if run=0 a whole file is reprocessed) |
82 |
|
|
* @param dbc pointer to BD server |
83 |
|
|
* @param file1 output LEVEL1 file name (null if no LEVEL1 output is required) |
84 |
|
|
* @param file2 output LEVEL2 file name (null if no LEVEL2 output is required) |
85 |
|
|
* @param standalone (flag to run the program in standalone mode, that is without reading RunInfo) |
86 |
|
|
*/ |
87 |
|
|
//short int TrkCore(Int_t run, TSQLServer *dbc, TString file1, TString file2, Bool_t standalone) |
88 |
mocchiut |
1.31 |
//int TrkCore(UInt_t run, TFile *f2, TSQLServer *dbc, int ncustom, char*vcustom[]) // EMILIANO |
89 |
|
|
int TrkCore(UInt_t run, TFile *f2, GL_TABLES *glt, int ncustom, char*vcustom[]) // EMILIANO |
90 |
mocchiut |
1.1 |
{ |
91 |
|
|
// --------------------------- |
92 |
|
|
// Define some basic variables |
93 |
|
|
// --------------------------- |
94 |
|
|
|
95 |
pizzolot |
1.36 |
TString filename = ""; |
96 |
pam-fi |
1.7 |
Long64_t nentries = 0LL; |
97 |
pam-fi |
1.2 |
|
98 |
mocchiut |
1.1 |
// LEVEL0 input |
99 |
|
|
TFile *f0 = 0; |
100 |
|
|
TTree *physicsTree = 0; |
101 |
|
|
TBranch *b_trk = 0; |
102 |
|
|
TBranch *b_header = 0; |
103 |
|
|
EventHeader *header = 0; |
104 |
|
|
PscuHeader *pscu = 0; |
105 |
pam-fi |
1.22 |
TrkLevel0 *l0_event = new TrkLevel0(); |
106 |
mocchiut |
1.1 |
// RunInfo |
107 |
|
|
ItoRunInfo *runinfo = 0; |
108 |
pam-fi |
1.7 |
TArrayI *runlist = 0; |
109 |
|
|
UInt_t from_run; |
110 |
|
|
UInt_t to_run; |
111 |
mocchiut |
1.44 |
// Bool_t reprocessing = false; // EM GCC 4.7 |
112 |
mocchiut |
1.1 |
//LEVEL2 output - ROOT |
113 |
|
|
TTree *t_level2 = 0; |
114 |
|
|
TTree *t_clone = 0; |
115 |
|
|
TrkLevel2 *l2_event = new TrkLevel2(); |
116 |
|
|
TrkLevel2 *l2_clone = new TrkLevel2(); |
117 |
pam-ts |
1.52 |
|
118 |
mocchiut |
1.49 |
TrkLevel2 *l2_event_nuclei = NULL; // EM bug new TrkLevel2(); |
119 |
mocchiut |
1.47 |
// EM TrkLevel2 *l2_clone_nuclei = new TrkLevel2(); |
120 |
pam-fi |
1.13 |
//LEVEL1 output - ROOT |
121 |
pam-ts |
1.46 |
TrkLevel1 *l1_event = new TrkLevel1(); |
122 |
mocchiut |
1.49 |
TrkLevel1 *l1_event_nuclei = NULL; // EM, bug new TrkLevel1(); |
123 |
pam-fi |
1.15 |
TrkHough *lh_event = new TrkHough(); |
124 |
mocchiut |
1.42 |
|
125 |
pam-fi |
1.45 |
//Extended tracking: |
126 |
|
|
TTree *t_cal = NULL; |
127 |
|
|
TTree *t_tof = NULL; |
128 |
|
|
ExtTrkingAlg *trkAlg = NULL; |
129 |
pam-ts |
1.46 |
ExtTrkingAlg *trkAlg_nuclei = NULL; |
130 |
pam-fi |
1.45 |
TClonesArray *trk_array = NULL; |
131 |
pam-ts |
1.46 |
TClonesArray *trk_array_nuclei = NULL; |
132 |
|
|
|
133 |
pam-fi |
1.45 |
CaloLevel1 *cl1 = NULL; |
134 |
|
|
ToFLevel2 *tl2 = NULL; |
135 |
pam-ts |
1.46 |
|
136 |
|
|
typedef struct { |
137 |
|
|
|
138 |
|
|
Int_t nTrk; |
139 |
|
|
Int_t nTrkNuc; |
140 |
|
|
Int_t nTrkExt; |
141 |
|
|
Int_t nTrkExtNuc; |
142 |
|
|
|
143 |
|
|
Int_t nCl; |
144 |
|
|
Int_t nClCut; |
145 |
|
|
|
146 |
|
|
Float_t tTrk; |
147 |
|
|
Float_t tTrkExt; |
148 |
|
|
Float_t tTrkNuc; |
149 |
|
|
|
150 |
pam-ts |
1.52 |
|
151 |
|
|
void Dump(){ |
152 |
|
|
cout <<" nTrk"<<setw(5)<<nTrk ; |
153 |
|
|
cout <<" nTrkNuc"<<setw(5)<<nTrkNuc ; |
154 |
|
|
cout <<" nTrkExt"<<setw(5)<< nTrkExt; |
155 |
|
|
cout <<" nTrkExtNuc"<<setw(5)<<nTrkExtNuc ; |
156 |
|
|
cout <<" nCl"<<setw(5)<<nCl ; |
157 |
|
|
cout <<" nClCut"<<setw(5)<<nClCut ; |
158 |
|
|
cout <<" tTrk"<<setw(15)<<tTrk ; |
159 |
|
|
cout <<" tTrkExt"<<setw(15)<<tTrkExt; |
160 |
|
|
cout <<" tTrkNuc"<<setw(15)<<tTrkNuc ; |
161 |
|
|
cout << endl; |
162 |
|
|
} |
163 |
|
|
|
164 |
|
|
|
165 |
pam-ts |
1.46 |
} TrkWatch; |
166 |
|
|
TrkWatch trkWatch; |
167 |
|
|
TTree *tWatch = NULL; |
168 |
|
|
|
169 |
pam-ts |
1.48 |
Int_t extAlgFlag=0; |
170 |
pam-ts |
1.46 |
|
171 |
mocchiut |
1.1 |
// ----------------------- |
172 |
|
|
// ----------------------- |
173 |
|
|
// Handle input parameters |
174 |
|
|
// (data) |
175 |
|
|
// |
176 |
|
|
// - open/create output files, determining the environment root/hbook from the estension |
177 |
|
|
// - create the level1/level2 tree+branch/nt-uple |
178 |
|
|
// ----------------------- |
179 |
|
|
// ----------------------- |
180 |
|
|
TrkProcess *p = new TrkProcess(run,f2); |
181 |
pam-fi |
1.26 |
if( p->HandleCustomPar(ncustom,vcustom) )return(p->ostatus);; |
182 |
pam-fi |
1.25 |
if( TrkParams::VerboseMode() )p->Dump(); |
183 |
pam-ts |
1.46 |
// p->Dump(); |
184 |
mocchiut |
1.1 |
|
185 |
|
|
// =================================== |
186 |
|
|
// Open/Create level2 output file |
187 |
|
|
// =================================== |
188 |
|
|
if(p->get2){ |
189 |
pam-fi |
1.13 |
//------------------------------------------- |
190 |
|
|
// read RunInfo |
191 |
|
|
//------------------------------------------- |
192 |
|
|
if(!(p->standalone)){ |
193 |
|
|
// Open "RunInfo" tree and get list of run |
194 |
|
|
runinfo = new ItoRunInfo(f2); |
195 |
|
|
char *trkversion = TrkInfo(false); |
196 |
|
|
int runinfo_error = runinfo->Update(run,"TRK",trkversion); |
197 |
|
|
if( runinfo_error ) throw runinfo_error; |
198 |
|
|
runlist = runinfo->GetRunList(); |
199 |
mocchiut |
1.44 |
// reprocessing = runinfo->IsReprocessing();//???? |
200 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode()){ |
201 |
pam-fi |
1.13 |
cout << "#events "<< runinfo->GetFileEntries() << endl;// #events in the file |
202 |
|
|
cout << "#runs "<< runinfo->GetRunEntries() << endl;// #runs in the file |
203 |
|
|
cout << "1-st run "<< runlist->At(0) << endl; |
204 |
|
|
cout << "last run "<< runlist->At(runinfo->GetRunEntries()-1) << endl; |
205 |
|
|
cout << "1-st event "<< runinfo->GetFirstEntry() << endl;// first event of our run |
206 |
|
|
cout << "last event+1 "<< runinfo->GetLastEntry() << endl;// first event AFTER the last event of our run |
207 |
mocchiut |
1.44 |
// cout << "reprocessing "<< runinfo->IsReprocessing() << endl << endl; |
208 |
pam-fi |
1.13 |
}; |
209 |
|
|
}; |
210 |
|
|
//------------------------------------------- |
211 |
|
|
// |
212 |
pam-ts |
1.46 |
//------------------------------------------- |
213 |
pam-fi |
1.13 |
// Take (if present) the old Tracker tree |
214 |
|
|
t_clone = (TTree*)f2->Get("Tracker"); |
215 |
mocchiut |
1.51 |
if( t_clone != NULL ){ |
216 |
|
|
t_clone->SetBranchAddress("TrkLevel2",&l2_clone); |
217 |
mocchiut |
1.53 |
// t_clone->SetMaxVirtualSize(2500000000LL); // EM residual Tracker-new tree in level2 files when NEVENTS is big |
218 |
mocchiut |
1.51 |
t_clone->SetAutoSave(900000000000000LL); // EM residual Tracker-new tree in level2 files when NEVENTS is big |
219 |
|
|
} |
220 |
pam-ts |
1.46 |
|
221 |
pam-fi |
1.13 |
// Create NEW Tracker tree |
222 |
mocchiut |
1.50 |
t_level2 = new TTree("Tracker-new","PAMELA tracker level2 data "); |
223 |
mocchiut |
1.53 |
// t_level2->SetMaxVirtualSize(2500000000LL); // EM residual Tracker-new tree in level2 files when NEVENTS is big |
224 |
mocchiut |
1.51 |
t_level2->SetAutoSave(900000000000000LL); // EM residual Tracker-new tree in level2 files when NEVENTS is big |
225 |
pam-fi |
1.21 |
l2_event->Set(); // ****NBNBNBN***** |
226 |
pam-fi |
1.13 |
t_level2->Branch("TrkLevel2","TrkLevel2",&l2_event); |
227 |
pam-ts |
1.46 |
|
228 |
pam-fi |
1.13 |
if(p->get1){ |
229 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode())cout << endl << "Requested LEVEL1 output" << endl; |
230 |
mocchiut |
1.51 |
l1_event->Set(); // ****NBNBNBN***** |
231 |
pam-fi |
1.13 |
t_level2->Branch("TrkLevel1","TrkLevel1",&l1_event); |
232 |
pam-fi |
1.16 |
} |
233 |
|
|
if(p->geth){ |
234 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode())cout << endl << "Requested Hough-Transform output" << endl; |
235 |
pam-fi |
1.16 |
t_level2->Branch("TrkHough","TrkHough",&lh_event); |
236 |
pam-fi |
1.7 |
}; |
237 |
pam-ts |
1.46 |
if(p->getn){ |
238 |
|
|
if(TrkParams::VerboseMode())cout << endl << "Requested nuclei-algorythm output" << endl; |
239 |
|
|
if(!l2_event_nuclei)l2_event_nuclei = new TrkLevel2(); |
240 |
mocchiut |
1.49 |
if(!l1_event_nuclei)l1_event_nuclei = new TrkLevel1(); // EM bug |
241 |
pam-ts |
1.46 |
l2_event_nuclei->Set(); // ****NBNBNBN***** |
242 |
|
|
t_level2->Branch("TrackNuclei",l2_event_nuclei->GetPointerToTrackArray()); |
243 |
|
|
|
244 |
|
|
} |
245 |
|
|
// ========================================================= |
246 |
|
|
// extended tracking algorythm output |
247 |
|
|
// ========================================================= |
248 |
|
|
if(p->gete){ |
249 |
pam-ts |
1.52 |
|
250 |
|
|
cout <<"Creating extended tracking algorythm "<<p->extAlgID<<endl; |
251 |
pam-ts |
1.46 |
trkAlg = new ExtTrkingAlg(p->extAlgID);// create the algorythm |
252 |
|
|
trk_array = trkAlg->GetTrackArray(); // get the track array |
253 |
|
|
if(!trk_array)throw -206; |
254 |
|
|
t_level2->Branch("RecoveredTrack",trkAlg->GetPointerToTrackArray());// put it in a branch |
255 |
|
|
if(p->getn){ |
256 |
mocchiut |
1.49 |
if(TrkParams::VerboseMode())cout << endl << "Requested extended nuclei-algorythm output" << endl; |
257 |
pam-ts |
1.46 |
trkAlg_nuclei = new ExtTrkingAlg(p->extAlgID);// create the algorythm for nuclei |
258 |
|
|
trk_array_nuclei = trkAlg_nuclei->GetTrackArray();// get the track array |
259 |
|
|
if(!trk_array_nuclei)throw -206; |
260 |
|
|
t_level2->Branch("RecoveredTrackNuclei",trkAlg_nuclei->GetPointerToTrackArray()); // put it in a branch |
261 |
|
|
} |
262 |
pam-ts |
1.48 |
t_level2->Branch("extAlgFlag",&extAlgFlag,"extAlgFlag/I"); |
263 |
|
|
// ------------------------ |
264 |
pam-ts |
1.46 |
// calorimeter and tof tree |
265 |
pam-ts |
1.48 |
// ------------------------ |
266 |
pam-ts |
1.46 |
t_cal = (TTree*)f2->Get("Calorimeter"); |
267 |
|
|
if(!t_cal)throw -206; |
268 |
|
|
cl1 = new CaloLevel1(); |
269 |
|
|
t_cal->SetBranchAddress("CaloLevel1",&cl1); |
270 |
mocchiut |
1.51 |
t_cal->SetAutoSave(900000000000000LL); // EM residual Tracker-new tree in level2 files when NEVENTS is big |
271 |
mocchiut |
1.53 |
// t_cal->SetMaxVirtualSize(2500000000LL); // EM residual Tracker-new tree in level2 files when NEVENTS is big |
272 |
pam-ts |
1.46 |
|
273 |
|
|
|
274 |
|
|
t_tof = (TTree*)f2->Get("ToF"); |
275 |
|
|
if(!t_tof)throw -206; |
276 |
|
|
tl2 = new ToFLevel2(); |
277 |
|
|
t_tof->SetBranchAddress("ToFLevel2",&tl2); |
278 |
mocchiut |
1.51 |
t_tof->SetAutoSave(900000000000000LL); // EM residual Tracker-new tree in level2 files when NEVENTS is big |
279 |
mocchiut |
1.53 |
// t_tof->SetMaxVirtualSize(2500000000LL); // EM residual Tracker-new tree in level2 files when NEVENTS is big |
280 |
pam-ts |
1.46 |
|
281 |
|
|
} |
282 |
|
|
if(p->watch){ |
283 |
|
|
|
284 |
|
|
// f2->cd(); |
285 |
|
|
tWatch = new TTree("TrkWatch"," Tracking timing info"); |
286 |
|
|
|
287 |
|
|
tWatch->Branch("nCl",&trkWatch.nCl,"nCl/I"); |
288 |
|
|
tWatch->Branch("nClCut",&trkWatch.nClCut,"nClCut/I"); |
289 |
|
|
|
290 |
|
|
tWatch->Branch("nTrk",&trkWatch.nTrk,"nTrk/I"); |
291 |
|
|
tWatch->Branch("nTrkExt",&trkWatch.nTrkExt,"nTrkExt/I"); |
292 |
|
|
tWatch->Branch("nTrkNuc",&trkWatch.nTrkNuc,"nTrkNuc/I"); |
293 |
|
|
tWatch->Branch("nTrkExtNuc",&trkWatch.nTrkExtNuc,"nTrkExtExt/I"); |
294 |
|
|
|
295 |
|
|
tWatch->Branch("tTrk",&trkWatch.tTrk,"tTrk/F"); |
296 |
|
|
tWatch->Branch("tTrkExt",&trkWatch.tTrkExt,"tTrkExt/F"); |
297 |
|
|
tWatch->Branch("tTrkNuc",&trkWatch.tTrkNuc,"tTrkNuc/F"); |
298 |
|
|
|
299 |
|
|
|
300 |
|
|
} |
301 |
|
|
|
302 |
|
|
|
303 |
|
|
|
304 |
|
|
|
305 |
pam-fi |
1.13 |
}; |
306 |
pam-fi |
1.45 |
|
307 |
pam-ts |
1.46 |
|
308 |
pam-fi |
1.45 |
|
309 |
mocchiut |
1.1 |
|
310 |
|
|
// ------------------------------------------- |
311 |
|
|
// define runs to be processed/reprocessed |
312 |
|
|
// ------------------------------------------- |
313 |
|
|
if(run == 0){ |
314 |
pam-fi |
1.13 |
// reprocessing ALL runs |
315 |
|
|
if(p->standalone)throw -298; // reprocessing not implemented |
316 |
|
|
from_run = runlist->At(0); |
317 |
|
|
to_run = runlist->At(runinfo->GetRunEntries()-1); |
318 |
mocchiut |
1.1 |
}else{ |
319 |
|
|
// processing/reprocessing ONE single run |
320 |
pam-fi |
1.13 |
from_run = run; |
321 |
|
|
to_run = run; |
322 |
mocchiut |
1.1 |
}; |
323 |
|
|
|
324 |
|
|
// |
325 |
|
|
// init event counter |
326 |
|
|
// |
327 |
|
|
Int_t ev_count =0; |
328 |
|
|
// |
329 |
|
|
// create query-results objects |
330 |
|
|
// |
331 |
pam-fi |
1.7 |
GL_RUN q1 = GL_RUN(); |
332 |
mocchiut |
1.1 |
GL_TRK_CALIB q2 = GL_TRK_CALIB(); |
333 |
|
|
GL_ROOT q3 = GL_ROOT(); |
334 |
|
|
GL_PARAM q4 = GL_PARAM(); |
335 |
|
|
|
336 |
|
|
// ------------------------------------------------------------ |
337 |
|
|
// if reprocessing one run, copy all the events BEFORE the run |
338 |
|
|
// ------------------------------------------------------------ |
339 |
|
|
if( !(p->standalone) ){ |
340 |
mocchiut |
1.50 |
if(TrkParams::VerboseMode()) cout << " Reprocessing one run: "<<run<< endl; |
341 |
pam-fi |
1.13 |
for(UInt_t i=0; i<runinfo->GetFirstEntry(); i++){ |
342 |
mocchiut |
1.37 |
if ( t_clone->GetEntry(i) <= 0 ) throw -36;// EM |
343 |
pam-ts |
1.46 |
// COPY COPY COPY |
344 |
pam-fi |
1.13 |
*l2_event = *l2_clone; |
345 |
|
|
t_level2->Fill(); |
346 |
|
|
l2_event->Clear(); |
347 |
|
|
}; |
348 |
mocchiut |
1.1 |
}; |
349 |
|
|
// ------------------------------------------------------------ |
350 |
|
|
// ------------------------------------------------------------ |
351 |
pam-fi |
1.25 |
// START LOOP OVER RUNS TO PROCESS/REPROCESS |
352 |
mocchiut |
1.1 |
// ------------------------------------------------------------ |
353 |
|
|
// ------------------------------------------------------------ |
354 |
pam-fi |
1.7 |
for(UInt_t idRun = from_run; idRun <= to_run; idRun++){ |
355 |
mocchiut |
1.1 |
|
356 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode()) cout << endl<<" ========================= Run: "<< idRun << endl; |
357 |
pam-fi |
1.7 |
UInt_t runheadtime = 0; |
358 |
|
|
UInt_t runtrailtime = 0; |
359 |
pam-fi |
1.32 |
UInt_t runheadobt = 0; |
360 |
|
|
UInt_t runtrailobt = 0; |
361 |
mocchiut |
1.41 |
UInt_t abstime = 0; |
362 |
mocchiut |
1.1 |
UInt_t evfrom = 0; |
363 |
|
|
UInt_t evto = 0; |
364 |
pam-fi |
1.7 |
UInt_t nevents = 0; |
365 |
|
|
Int_t id_root_l0 =-1; |
366 |
mocchiut |
1.1 |
Int_t trk_calib_used = 0; |
367 |
pam-fi |
1.7 |
|
368 |
mocchiut |
1.31 |
TString host = glt->CGetHost(); // EMILIANO |
369 |
|
|
TString user = glt->CGetUser(); // EMILIANO |
370 |
|
|
TString psw = glt->CGetPsw(); // EMILIANO |
371 |
|
|
// TString host = "mysql://localhost/pamelaprod"; |
372 |
|
|
// TString user = "anonymous"; |
373 |
|
|
// TString psw = ""; |
374 |
|
|
// const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
375 |
|
|
// const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
376 |
|
|
// const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
377 |
|
|
// if ( !pamdbhost ) pamdbhost = ""; |
378 |
|
|
// if ( !pamdbuser ) pamdbuser = ""; |
379 |
|
|
// if ( !pamdbpsw ) pamdbpsw = ""; |
380 |
|
|
// if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
381 |
|
|
// if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
382 |
|
|
// if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
383 |
mocchiut |
1.29 |
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
384 |
mocchiut |
1.31 |
stringstream myquery; // EMILIANO |
385 |
|
|
myquery.str(""); // EMILIANO |
386 |
|
|
myquery << "SET time_zone='+0:00'"; // EMILIANO |
387 |
mocchiut |
1.39 |
delete dbc->Query(myquery.str().c_str()); // EMILIANO |
388 |
mocchiut |
1.1 |
if(p->standalone){ |
389 |
|
|
// ============================== |
390 |
|
|
// first query: retrieve run info |
391 |
|
|
// ============================== |
392 |
pam-fi |
1.7 |
if (q1.Query_GL_RUN(idRun,dbc) )throw -50; |
393 |
|
|
id_root_l0 = q1.ID_ROOT_L0; |
394 |
mocchiut |
1.1 |
runheadtime = q1.RUNHEADER_TIME; |
395 |
|
|
runtrailtime = q1.RUNTRAILER_TIME; |
396 |
pam-fi |
1.32 |
runheadobt = q1.RUNHEADER_OBT; |
397 |
|
|
runtrailobt = q1.RUNTRAILER_OBT; |
398 |
pam-fi |
1.7 |
evfrom = q1.EV_FROM; |
399 |
|
|
evto = q1.EV_TO; |
400 |
pam-fi |
1.13 |
nevents = q1.NEVENTS; |
401 |
|
|
trk_calib_used = q1.TRK_CALIB_USED; |
402 |
mocchiut |
1.1 |
}else{ |
403 |
|
|
// ============================== |
404 |
|
|
// get run info from RunInfo tree |
405 |
|
|
// ============================== |
406 |
pam-fi |
1.3 |
int runinfo_error = runinfo->GetRunInfo(idRun); |
407 |
pam-fi |
1.7 |
if( runinfo_error ) throw runinfo_error; |
408 |
|
|
id_root_l0 = runinfo->ID_ROOT_L0; |
409 |
mocchiut |
1.1 |
runheadtime = runinfo->RUNHEADER_TIME; |
410 |
|
|
runtrailtime = runinfo->RUNTRAILER_TIME; |
411 |
pam-fi |
1.32 |
runheadobt = runinfo->RUNHEADER_OBT; |
412 |
|
|
runtrailobt = runinfo->RUNTRAILER_OBT; |
413 |
pam-fi |
1.7 |
evfrom = runinfo->EV_FROM; |
414 |
|
|
evto = runinfo->EV_TO; |
415 |
pam-fi |
1.13 |
nevents = runinfo->NEVENTS; |
416 |
|
|
trk_calib_used = runinfo->TRK_CALIB_USED; |
417 |
pam-fi |
1.24 |
|
418 |
mocchiut |
1.1 |
}; |
419 |
pam-fi |
1.24 |
|
420 |
mocchiut |
1.1 |
// |
421 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode()){ |
422 |
pam-fi |
1.7 |
cout << "ROOT file ID "<< id_root_l0 << endl; |
423 |
mocchiut |
1.1 |
cout << "RunHeader time "<< runheadtime << endl; |
424 |
|
|
cout << "RunTrailer time "<< runtrailtime << endl; |
425 |
pam-fi |
1.7 |
cout << " from event "<< evfrom << endl; |
426 |
|
|
cout << " to event "<< evto << endl; |
427 |
pam-fi |
1.24 |
cout << " num. events "<< nevents << endl; |
428 |
|
|
cout << "trk-calibration used "<< trk_calib_used << endl; |
429 |
mocchiut |
1.1 |
}; |
430 |
|
|
// ======================================================== |
431 |
|
|
// second query: search the LEVEL0 file that contains idRun |
432 |
|
|
// ======================================================== |
433 |
|
|
TString lastfilename = filename; |
434 |
pam-fi |
1.7 |
if( q3.Query_GL_ROOT(id_root_l0,dbc) )throw -51; |
435 |
mocchiut |
1.1 |
filename = q3.PATH + q3.NAME; |
436 |
|
|
// ======================================================== |
437 |
|
|
// Open the input LEVEL0 data file |
438 |
|
|
// ======================================================== |
439 |
|
|
if(filename.CompareTo(lastfilename)){ |
440 |
|
|
if(!lastfilename.IsNull())f0->Close(); |
441 |
|
|
//if( debug ) cout << "Opening LEVEL0 file: "<< filename << endl; |
442 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode()) cout << "Opening LEVEL0 file: "<< filename << endl; |
443 |
pam-fi |
1.2 |
FileStat_t t; |
444 |
|
|
if( gSystem->GetPathInfo(filename.Data(),t) )throw -6; |
445 |
mocchiut |
1.39 |
if ( f0 ) f0->Close(); |
446 |
mocchiut |
1.1 |
f0 = new TFile(filename); |
447 |
|
|
if ( !f0 ) throw -6; |
448 |
|
|
physicsTree = (TTree*)f0->Get("Physics"); if(!physicsTree) throw -7; |
449 |
|
|
b_header = physicsTree ->GetBranch("Header"); if(!b_header ) throw -8; |
450 |
|
|
b_trk = physicsTree ->GetBranch("Tracker"); if(!b_trk ) throw -203; |
451 |
pam-fi |
1.22 |
l0_event->Set(); |
452 |
|
|
physicsTree->SetBranchAddress("Tracker" ,l0_event->GetPointerToTrackerEvent()); |
453 |
mocchiut |
1.1 |
physicsTree->SetBranchAddress("Header",&header); |
454 |
|
|
|
455 |
pam-fi |
1.7 |
nentries = physicsTree->GetEntries(); |
456 |
mocchiut |
1.34 |
if ( nentries < 1 && nevents ) throw -11; // EMILIANO: go on if the file is empty, why not? in principle we should not have any event to process but if the case the next line will take care of exiting; exit only if the file is empty but nevents is not zero |
457 |
mocchiut |
1.33 |
if ( nentries < (evto+1) && nevents > 0 ) throw -12; // EMILIANO: if NEVENTS = 0 and the file is empty everything is ok but due to a mistake in the |
458 |
|
|
// variable EV_TO type (UInt_t instead of Int_t) that we don't want to change to avoid changing a lot of code, evto becomes inf hence |
459 |
|
|
// the condition ( nentries < (evto+1) ) is satisfied and DV exit with error even if the error is only in the DB. |
460 |
pam-fi |
1.7 |
|
461 |
mocchiut |
1.1 |
}; |
462 |
|
|
|
463 |
pam-fi |
1.7 |
GL_TIMESYNC *dbtime = new GL_TIMESYNC(id_root_l0,"ID",dbc); |
464 |
|
|
|
465 |
pam-fi |
1.24 |
|
466 |
|
|
// ============================================================= |
467 |
|
|
// retrieve information about parameters to process LEVEL2 |
468 |
|
|
// ============================================================= |
469 |
|
|
|
470 |
mocchiut |
1.41 |
TrkParams::Set(runinfo->GetGL_RUN(),dbc); |
471 |
|
|
for(int i=0; i<p->npar; i++){ |
472 |
|
|
if(TrkParams::VerboseMode())cout<<" ((( force parameters from input path )))"<<endl; |
473 |
|
|
TrkParams::Set(p->parpath[i],p->partype[i]); |
474 |
|
|
} |
475 |
pam-fi |
1.25 |
|
476 |
mocchiut |
1.41 |
TrkParams::Load(); |
477 |
|
|
if( !TrkParams::IsLoaded() )throw -52; |
478 |
pam-fi |
1.24 |
|
479 |
|
|
// ============================================================= |
480 |
|
|
// retrieve calibration file needed to reduce data |
481 |
|
|
// ============================================================= |
482 |
|
|
|
483 |
|
|
TrkParams::SetCalib(runinfo->GetGL_RUN(),dbc); |
484 |
|
|
TrkParams::LoadCalib( ); |
485 |
|
|
if( !TrkParams::CalibIsLoaded() )throw -53; |
486 |
|
|
|
487 |
pam-fi |
1.11 |
TBenchmark *reduction = new TBenchmark(); |
488 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode())reduction->Start("reduction"); |
489 |
pam-fi |
1.11 |
Int_t ntrk=0; |
490 |
mocchiut |
1.1 |
// ==================================================== |
491 |
|
|
// start looping on events cointained in the data file |
492 |
|
|
// ==================================================== |
493 |
mocchiut |
1.41 |
if ( TrkParams::GetSimuFlag() ){ |
494 |
|
|
abstime = runheadtime; |
495 |
|
|
} else { |
496 |
|
|
if(dbc){ |
497 |
|
|
dbc->Close(); |
498 |
|
|
delete dbc; |
499 |
|
|
} |
500 |
|
|
} |
501 |
|
|
|
502 |
pam-fi |
1.32 |
for (UInt_t re = evfrom+min(p->nskip,nevents); re < evfrom+nevents; re++){ |
503 |
mocchiut |
1.49 |
|
504 |
mocchiut |
1.1 |
ev_count++; |
505 |
pam-fi |
1.32 |
|
506 |
pam-fi |
1.45 |
// |
507 |
|
|
// NBNB check if events are aligned!!!!!!!!!!! |
508 |
|
|
// |
509 |
|
|
|
510 |
|
|
|
511 |
|
|
if(p->gete){ |
512 |
|
|
int iev = 0; |
513 |
|
|
int jumped = 0; |
514 |
|
|
iev = runinfo->GetFirstEntry() + (re - evfrom -jumped); |
515 |
|
|
if ( t_cal->GetEntry(iev) <= 0 ) throw -36;//EV |
516 |
|
|
if ( t_tof->GetEntry(iev) <= 0 ) throw -36;//EV |
517 |
|
|
} |
518 |
mocchiut |
1.49 |
|
519 |
pam-fi |
1.25 |
// if ( TrkParams::DebugMode() && re%100 == 0 && re > 0 ) cout << "."; |
520 |
mocchiut |
1.1 |
|
521 |
mocchiut |
1.37 |
if ( b_trk->GetEntry(re) <= 0 ) throw -36;//EM |
522 |
|
|
if ( b_header->GetEntry(re) <= 0 ) throw -36;//EM |
523 |
pam-fi |
1.13 |
pscu = header->GetPscuHeader(); |
524 |
mocchiut |
1.49 |
|
525 |
mocchiut |
1.41 |
// ============================================================= |
526 |
|
|
// The following 6 lines have been moved here by VALERIO. |
527 |
|
|
if(TrkParams::GetSimuFlag()){ |
528 |
|
|
abstime = runheadtime + (int) floor(0.03*(re-evfrom)); //If simulated data we need to assign a fake abstime. 30ms between each event. |
529 |
|
|
if(TrkParams::VerboseMode())cout << "Event: " << re-evfrom << " - Attempting to retrieve Mask Info for abstime=" << abstime << endl; |
530 |
|
|
if(!TrkParams::Set(runinfo->GetGL_RUN(),dbc,6,abstime))throw -52; // Setting to load mask (VALERIO) |
531 |
|
|
TrkParams::Load(6); |
532 |
|
|
if( !TrkParams::IsLoaded() )throw -52; |
533 |
|
|
if(TrkParams::VerboseMode())cout << "Mask Info for abstime=" << abstime << " retrieved" << endl; |
534 |
|
|
} |
535 |
|
|
|
536 |
pam-fi |
1.25 |
if( TrkParams::DebugMode() )cout << ">>> "<<ev_count-1<<" @ OBT "<<pscu->GetOrbitalTime()<<endl; |
537 |
pam-fi |
1.23 |
|
538 |
mocchiut |
1.35 |
if ( dbtime->DBabsTime(pscu->GetOrbitalTime()) > (runtrailtime+1) || dbtime->DBabsTime(pscu->GetOrbitalTime()) < (runheadtime-1)) { |
539 |
pam-fi |
1.7 |
|
540 |
pam-fi |
1.25 |
if (TrkParams::VerboseMode()){ |
541 |
pam-fi |
1.14 |
printf(" TrkCore - WARNING: event outside the run time window, skipping it\n"); |
542 |
pam-fi |
1.32 |
cout << " OBT "<<pscu->GetOrbitalTime()<<" RUN "<<runheadobt<<"-"<<runtrailobt<<" ABS-time "<<dbtime->DBabsTime(pscu->GetOrbitalTime())<<" RUN "<<runheadtime<<"-"<<runtrailtime<<endl; |
543 |
pam-fi |
1.14 |
}; |
544 |
pam-fi |
1.13 |
}else{ |
545 |
pam-fi |
1.25 |
if ( TrkParams::DebugMode() ) |
546 |
pam-fi |
1.23 |
printf("\n-------------------------------\nevent %d\n",re-evfrom); |
547 |
pam-fi |
1.16 |
|
548 |
pam-ts |
1.52 |
|
549 |
|
|
|
550 |
pam-ts |
1.46 |
//============================================= |
551 |
|
|
// EVENT PROCESSING |
552 |
|
|
//============================================= |
553 |
|
|
TStopwatch w; |
554 |
pam-ts |
1.52 |
// cout << " -------------------------------------------------------------------------"<<endl; |
555 |
pam-ts |
1.46 |
|
556 |
pam-ts |
1.52 |
// ---------------------------------------------- |
557 |
pam-ts |
1.46 |
// default tracking |
558 |
pam-ts |
1.52 |
// ---------------------------------------------- |
559 |
|
|
if(tWatch)w.Start(); |
560 |
|
|
|
561 |
pam-ts |
1.46 |
p->ProcessEvent(l0_event);//call f77 routine |
562 |
|
|
|
563 |
pam-ts |
1.52 |
if(tWatch)w.Stop(); |
564 |
|
|
if(tWatch)trkWatch.tTrk = (float) w.CpuTime(); |
565 |
|
|
// if(tWatch)cout << " t."<<trkWatch.tTrk<<endl; |
566 |
|
|
|
567 |
pam-fi |
1.7 |
|
568 |
pam-ts |
1.52 |
// // ---------------- |
569 |
|
|
// // LEVEL1 output |
570 |
|
|
// // ---------------- |
571 |
|
|
l1_event->Clear(); |
572 |
|
|
l1_event->SetFromLevel1Struct(); |
573 |
|
|
|
574 |
pam-fi |
1.13 |
// ---------------- |
575 |
|
|
// HOUGH output |
576 |
|
|
// ---------------- |
577 |
|
|
if(p->geth){ |
578 |
|
|
if(p->ifrooth){ // root |
579 |
pam-fi |
1.23 |
lh_event->Delete(); |
580 |
|
|
lh_event->SetFromHoughStruct(&houghevent_); |
581 |
pam-fi |
1.13 |
}else{ // hbook |
582 |
|
|
throw -299; |
583 |
|
|
}; |
584 |
|
|
}; |
585 |
pam-ts |
1.46 |
|
586 |
|
|
// // ---------------- |
587 |
|
|
// // LEVEL2 output |
588 |
|
|
// // ---------------- |
589 |
|
|
l2_event->Clear(); |
590 |
|
|
if(p->get1){ |
591 |
|
|
l2_event->SetFromLevel2Struct(&level2event_,l1_event);//set references to level1 |
592 |
|
|
}else{ |
593 |
|
|
l2_event->SetFromLevel2Struct(&level2event_); |
594 |
|
|
} |
595 |
|
|
|
596 |
|
|
if( l2_event->ntrk()>0 )ntrk++; |
597 |
|
|
if(TrkParams::VerboseMode())l2_event->Dump(); |
598 |
|
|
|
599 |
pam-ts |
1.48 |
|
600 |
|
|
//---------------------------------------------- |
601 |
|
|
// verify conditions to apply extended algorythm |
602 |
|
|
//---------------------------------------------- |
603 |
|
|
bool APPLY_EXTENDED = false; |
604 |
|
|
if( |
605 |
pam-ts |
1.52 |
p->gete && //imput flag set |
606 |
pam-ts |
1.48 |
true){ |
607 |
|
|
|
608 |
pam-ts |
1.52 |
// regular condition for extended processing |
609 |
|
|
if(l2_event->ntrk()==0){ |
610 |
pam-ts |
1.48 |
APPLY_EXTENDED = true; |
611 |
|
|
extAlgFlag = 0; |
612 |
|
|
} |
613 |
pam-ts |
1.52 |
// extended algorythm applied for cross-check |
614 |
pam-ts |
1.48 |
if(p->gete_ncheck>0 && ev_count%p->gete_ncheck==0){ |
615 |
|
|
APPLY_EXTENDED = true; |
616 |
|
|
extAlgFlag = 1; |
617 |
mocchiut |
1.49 |
if(l2_event->ntrk()==0) extAlgFlag = 2; // EM make it easier to recognize events with no standard tracks AND forced extended algorithm |
618 |
pam-ts |
1.48 |
} |
619 |
|
|
|
620 |
|
|
} |
621 |
|
|
|
622 |
pam-ts |
1.52 |
// cout << " apply extended "<<APPLY_EXTENDED<<" forced "<<extAlgFlag<<endl; |
623 |
|
|
|
624 |
|
|
if(tWatch)w.Start(); |
625 |
pam-ts |
1.46 |
|
626 |
pam-fi |
1.45 |
// ------------------ |
627 |
|
|
// extended-tracking |
628 |
|
|
// ------------------ |
629 |
pam-ts |
1.52 |
trkAlg->Clear(); |
630 |
pam-ts |
1.48 |
if(APPLY_EXTENDED){ |
631 |
pam-ts |
1.46 |
|
632 |
pam-ts |
1.48 |
// //---------------------------- |
633 |
|
|
// // check conditions |
634 |
|
|
// //---------------------------- |
635 |
|
|
// if( |
636 |
|
|
// l2_event->ntrk()==0 && |
637 |
|
|
// l1_event->nclstr()<24 && |
638 |
|
|
// true){ |
639 |
pam-ts |
1.46 |
|
640 |
pam-ts |
1.48 |
trkAlg->SetDebug(false); |
641 |
|
|
trkAlg->SetTrkLevel2(l2_event); |
642 |
|
|
trkAlg->SetTrkLevel1(l1_event); |
643 |
|
|
trkAlg->SetCaloLevel1(cl1); |
644 |
|
|
trkAlg->SetToFLevel2(tl2); |
645 |
|
|
// trkAlg->Dump(); |
646 |
|
|
trkAlg->ProcessEvent(); |
647 |
mocchiut |
1.49 |
|
648 |
pam-ts |
1.48 |
// } |
649 |
pam-ts |
1.46 |
} |
650 |
|
|
|
651 |
pam-ts |
1.52 |
if(tWatch)w.Stop(); |
652 |
|
|
if(tWatch)trkWatch.tTrkExt = (float) w.CpuTime(); |
653 |
|
|
// if(tWatch)cout << " t."<<trkWatch.tTrkExt<<endl; |
654 |
pam-ts |
1.46 |
|
655 |
|
|
|
656 |
|
|
if(p->getn){ |
657 |
|
|
|
658 |
pam-ts |
1.52 |
if(tWatch)w.Start(); |
659 |
|
|
|
660 |
|
|
l1_event_nuclei->Clear(); |
661 |
pam-ts |
1.46 |
l1_event_nuclei->Set(l1_event,5.,0.2);//apply a cut |
662 |
|
|
l1_event_nuclei->GetLevel1Struct();//from cleaned l1 object, to f77 common |
663 |
|
|
l1_event_nuclei->ProcessEvent(); // default routine |
664 |
pam-ts |
1.52 |
l2_event_nuclei->Clear(); |
665 |
pam-ts |
1.46 |
l2_event_nuclei->SetFromLevel2Struct(); // from f77 common to l2 object |
666 |
pam-ts |
1.48 |
|
667 |
pam-ts |
1.52 |
|
668 |
pam-ts |
1.46 |
trkAlg_nuclei->Clear(); |
669 |
pam-ts |
1.52 |
|
670 |
pam-ts |
1.48 |
if(APPLY_EXTENDED){ |
671 |
|
|
|
672 |
|
|
trkAlg_nuclei->SetDebug(false); |
673 |
|
|
trkAlg_nuclei->SetTrkLevel2( l2_event_nuclei ); |
674 |
|
|
trkAlg_nuclei->SetTrkLevel1( l1_event_nuclei );//cleaned level1 |
675 |
|
|
trkAlg_nuclei->SetCaloLevel1( cl1 ); |
676 |
|
|
trkAlg_nuclei->SetToFLevel2( tl2 ); |
677 |
|
|
trkAlg_nuclei->ProcessEvent(); |
678 |
pam-ts |
1.46 |
} |
679 |
|
|
|
680 |
pam-ts |
1.52 |
if(tWatch)w.Stop(); |
681 |
|
|
if(tWatch)trkWatch.tTrkNuc = (float) w.CpuTime(); |
682 |
|
|
// if(tWatch)cout << " t."<<trkWatch.tTrkNuc<<endl; |
683 |
pam-fi |
1.45 |
|
684 |
pam-ts |
1.46 |
} |
685 |
mocchiut |
1.49 |
|
686 |
pam-fi |
1.45 |
|
687 |
pam-ts |
1.52 |
// if( l1_event->nclstr() > 15 && trkAlg->GetTrackArray()->GetEntries()>0){ |
688 |
|
|
|
689 |
|
|
// if(l1_event)cout<<" std n.cl "<<l1_event->nclstr(); |
690 |
|
|
// if(l2_event)cout<<" n.tr "<<l2_event->GetNTracks() ; |
691 |
|
|
// if(trkAlg)cout<<" ext "<<trkAlg->GetTrackArray()->GetEntries(); |
692 |
|
|
// cout<<endl; |
693 |
|
|
|
694 |
|
|
// trkAlg->SetDebug(true); |
695 |
|
|
// trkAlg->CheckEvent(); |
696 |
|
|
// trkAlg->SetDebug(false); |
697 |
|
|
|
698 |
pam-fi |
1.45 |
|
699 |
pam-ts |
1.52 |
// } |
700 |
|
|
|
701 |
|
|
// if( l1_event_nuclei->nclstr() <3 && trkAlg_nuclei->GetTrackArray()->GetEntries()>0){ |
702 |
|
|
// if(l1_event_nuclei)cout<<" nuc n.cl "<<l1_event_nuclei->nclstr(); |
703 |
|
|
// if(l2_event_nuclei)cout<<" n.tr "<<l2_event_nuclei->GetNTracks() ; |
704 |
|
|
// if(trkAlg_nuclei)cout<<" ext "<<trkAlg_nuclei->GetTrackArray()->GetEntries(); |
705 |
|
|
// cout<<endl; |
706 |
|
|
// trkAlg_nuclei->SetDebug(true); |
707 |
|
|
// trkAlg_nuclei->CheckEvent(); |
708 |
|
|
// trkAlg_nuclei->SetDebug(false); |
709 |
|
|
// } |
710 |
pam-ts |
1.46 |
|
711 |
|
|
///////////////////// |
712 |
|
|
// ==== FILL ===== // |
713 |
|
|
///////////////////// |
714 |
|
|
t_level2->Fill(); |
715 |
|
|
|
716 |
pam-ts |
1.52 |
if(tWatch){ |
717 |
|
|
|
718 |
|
|
trkWatch.nCl = (l1_event ? l1_event->nclstr() :0); |
719 |
|
|
trkWatch.nClCut = (l1_event_nuclei ? l1_event_nuclei->nclstr() :0); |
720 |
|
|
|
721 |
|
|
|
722 |
|
|
trkWatch.nTrk = (l2_event ? l2_event->GetNTracks() :0); |
723 |
|
|
trkWatch.nTrkNuc = (l2_event_nuclei ? l2_event_nuclei->GetNTracks() :0); |
724 |
|
|
|
725 |
|
|
trkWatch.nTrkExt = ( trkAlg ? trkAlg->GetTrackArray()->GetEntries() : 0); |
726 |
|
|
trkWatch.nTrkExtNuc = ( trkAlg_nuclei ? trkAlg_nuclei->GetTrackArray()->GetEntries() : 0); |
727 |
|
|
|
728 |
|
|
if(TrkParams::VerboseMode())trkWatch.Dump(); |
729 |
|
|
|
730 |
|
|
|
731 |
|
|
tWatch->Fill(); |
732 |
|
|
} |
733 |
pam-fi |
1.45 |
|
734 |
pam-fi |
1.13 |
}; |
735 |
mocchiut |
1.1 |
}; // end loop on events |
736 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode()){ |
737 |
pam-fi |
1.13 |
cout << " >>> processed "<< ev_count <<" events"<< endl; |
738 |
|
|
if(ev_count)cout << ntrk << " events with at least one track ("<<(Int_t)(100*ntrk/ev_count)<<"%)\n"; |
739 |
|
|
reduction->Show("reduction"); |
740 |
pam-fi |
1.11 |
} |
741 |
|
|
delete reduction; |
742 |
pam-fi |
1.7 |
|
743 |
|
|
delete dbtime; |
744 |
|
|
|
745 |
pam-fi |
1.13 |
}; // end loop on runs |
746 |
|
|
|
747 |
|
|
|
748 |
mocchiut |
1.1 |
// ------------------------------------------------------------ |
749 |
|
|
// if reprocessing one run, copy all the events AFTER the run |
750 |
|
|
// ------------------------------------------------------------ |
751 |
|
|
if( !(p->standalone) ){ |
752 |
mocchiut |
1.50 |
if(TrkParams::VerboseMode()) cout << " Reprocessing one run: "<<run<< " copy all events AFTER the run"<< endl; |
753 |
mocchiut |
1.1 |
for(UInt_t i=runinfo->GetLastEntry()+1; i<runinfo->GetFileEntries(); i++){ |
754 |
mocchiut |
1.37 |
if ( t_clone->GetEntry(i) <= 0 ) throw -36;//EM |
755 |
mocchiut |
1.1 |
*l2_event = *l2_clone; |
756 |
pam-ts |
1.46 |
// COPY COPY COPY |
757 |
mocchiut |
1.1 |
t_level2->Fill(); |
758 |
|
|
l2_event->Clear(); |
759 |
|
|
}; |
760 |
|
|
}; |
761 |
|
|
// --------------- |
762 |
|
|
// close the files |
763 |
|
|
// --------------- |
764 |
|
|
if(p->get2){ |
765 |
mocchiut |
1.50 |
if(TrkParams::VerboseMode()) cout << " Writing and closing the files, t_level2 "<< t_level2<< endl; |
766 |
pam-ts |
1.46 |
f2->cd(); |
767 |
|
|
// if(tWatch){ |
768 |
|
|
// if(tWatch)f2->Write("TrkWatch",TObject::kOverwrite); |
769 |
|
|
// } |
770 |
|
|
// f2->Write("Tracker", TObject::kOverwrite); |
771 |
mocchiut |
1.50 |
// if( t_level2 )t_level2->Write(); |
772 |
|
|
|
773 |
|
|
if( t_clone )t_clone->Delete("all");//delete old tree from file |
774 |
|
|
|
775 |
|
|
if( t_level2 )t_level2->SetName("Tracker"); |
776 |
|
|
if( t_level2 )t_level2->Write("Tracker",TObject::kOverwrite); |
777 |
pam-ts |
1.46 |
if( t_level2 )t_level2->Delete(); //delete new tree from memory |
778 |
|
|
|
779 |
pam-fi |
1.13 |
if( !(p->standalone) )runinfo->Close(); |
780 |
pam-ts |
1.46 |
if(tWatch)tWatch->Write(); |
781 |
pam-fi |
1.13 |
|
782 |
|
|
}; |
783 |
pam-ts |
1.46 |
|
784 |
pam-fi |
1.45 |
|
785 |
pam-fi |
1.24 |
if(f0) if(f0->IsOpen()) f0->Close(); |
786 |
pam-ts |
1.46 |
|
787 |
pam-fi |
1.13 |
l1_event->Delete(); |
788 |
|
|
l2_event->Delete(); |
789 |
|
|
l2_clone->Delete(); |
790 |
pam-fi |
1.2 |
|
791 |
pam-fi |
1.45 |
|
792 |
pam-fi |
1.2 |
return(p->ostatus); |
793 |
mocchiut |
1.1 |
} |
794 |
|
|
|