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 |
mocchiut |
1.54 |
if(TrkParams::VerboseMode()) 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 |
mocchiut |
1.56 |
myquery << "SET time_zone='+0:00'; SET sql_mode = 'NO_UNSIGNED_SUBTRACTION';"; // 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 |
mocchiut |
1.55 |
ev_count =0; // EM, ev_count must be cleared before processing a run (to be consistent when/if reprocessing) |
503 |
|
|
|
504 |
pam-fi |
1.32 |
for (UInt_t re = evfrom+min(p->nskip,nevents); re < evfrom+nevents; re++){ |
505 |
mocchiut |
1.49 |
|
506 |
mocchiut |
1.1 |
ev_count++; |
507 |
pam-fi |
1.32 |
|
508 |
pam-fi |
1.45 |
// |
509 |
|
|
// NBNB check if events are aligned!!!!!!!!!!! |
510 |
|
|
// |
511 |
|
|
|
512 |
|
|
|
513 |
|
|
if(p->gete){ |
514 |
|
|
int iev = 0; |
515 |
|
|
int jumped = 0; |
516 |
|
|
iev = runinfo->GetFirstEntry() + (re - evfrom -jumped); |
517 |
|
|
if ( t_cal->GetEntry(iev) <= 0 ) throw -36;//EV |
518 |
|
|
if ( t_tof->GetEntry(iev) <= 0 ) throw -36;//EV |
519 |
|
|
} |
520 |
mocchiut |
1.49 |
|
521 |
pam-fi |
1.25 |
// if ( TrkParams::DebugMode() && re%100 == 0 && re > 0 ) cout << "."; |
522 |
mocchiut |
1.1 |
|
523 |
mocchiut |
1.37 |
if ( b_trk->GetEntry(re) <= 0 ) throw -36;//EM |
524 |
|
|
if ( b_header->GetEntry(re) <= 0 ) throw -36;//EM |
525 |
pam-fi |
1.13 |
pscu = header->GetPscuHeader(); |
526 |
mocchiut |
1.49 |
|
527 |
mocchiut |
1.41 |
// ============================================================= |
528 |
|
|
// The following 6 lines have been moved here by VALERIO. |
529 |
|
|
if(TrkParams::GetSimuFlag()){ |
530 |
|
|
abstime = runheadtime + (int) floor(0.03*(re-evfrom)); //If simulated data we need to assign a fake abstime. 30ms between each event. |
531 |
|
|
if(TrkParams::VerboseMode())cout << "Event: " << re-evfrom << " - Attempting to retrieve Mask Info for abstime=" << abstime << endl; |
532 |
|
|
if(!TrkParams::Set(runinfo->GetGL_RUN(),dbc,6,abstime))throw -52; // Setting to load mask (VALERIO) |
533 |
|
|
TrkParams::Load(6); |
534 |
|
|
if( !TrkParams::IsLoaded() )throw -52; |
535 |
|
|
if(TrkParams::VerboseMode())cout << "Mask Info for abstime=" << abstime << " retrieved" << endl; |
536 |
|
|
} |
537 |
|
|
|
538 |
pam-fi |
1.25 |
if( TrkParams::DebugMode() )cout << ">>> "<<ev_count-1<<" @ OBT "<<pscu->GetOrbitalTime()<<endl; |
539 |
pam-fi |
1.23 |
|
540 |
mocchiut |
1.35 |
if ( dbtime->DBabsTime(pscu->GetOrbitalTime()) > (runtrailtime+1) || dbtime->DBabsTime(pscu->GetOrbitalTime()) < (runheadtime-1)) { |
541 |
pam-fi |
1.7 |
|
542 |
pam-fi |
1.25 |
if (TrkParams::VerboseMode()){ |
543 |
pam-fi |
1.14 |
printf(" TrkCore - WARNING: event outside the run time window, skipping it\n"); |
544 |
pam-fi |
1.32 |
cout << " OBT "<<pscu->GetOrbitalTime()<<" RUN "<<runheadobt<<"-"<<runtrailobt<<" ABS-time "<<dbtime->DBabsTime(pscu->GetOrbitalTime())<<" RUN "<<runheadtime<<"-"<<runtrailtime<<endl; |
545 |
pam-fi |
1.14 |
}; |
546 |
pam-fi |
1.13 |
}else{ |
547 |
pam-fi |
1.25 |
if ( TrkParams::DebugMode() ) |
548 |
pam-fi |
1.23 |
printf("\n-------------------------------\nevent %d\n",re-evfrom); |
549 |
pam-fi |
1.16 |
|
550 |
pam-ts |
1.52 |
|
551 |
|
|
|
552 |
pam-ts |
1.46 |
//============================================= |
553 |
|
|
// EVENT PROCESSING |
554 |
|
|
//============================================= |
555 |
|
|
TStopwatch w; |
556 |
pam-ts |
1.52 |
// cout << " -------------------------------------------------------------------------"<<endl; |
557 |
pam-ts |
1.46 |
|
558 |
pam-ts |
1.52 |
// ---------------------------------------------- |
559 |
pam-ts |
1.46 |
// default tracking |
560 |
pam-ts |
1.52 |
// ---------------------------------------------- |
561 |
|
|
if(tWatch)w.Start(); |
562 |
|
|
|
563 |
pam-ts |
1.46 |
p->ProcessEvent(l0_event);//call f77 routine |
564 |
|
|
|
565 |
pam-ts |
1.52 |
if(tWatch)w.Stop(); |
566 |
|
|
if(tWatch)trkWatch.tTrk = (float) w.CpuTime(); |
567 |
|
|
// if(tWatch)cout << " t."<<trkWatch.tTrk<<endl; |
568 |
|
|
|
569 |
pam-fi |
1.7 |
|
570 |
pam-ts |
1.52 |
// // ---------------- |
571 |
|
|
// // LEVEL1 output |
572 |
|
|
// // ---------------- |
573 |
|
|
l1_event->Clear(); |
574 |
|
|
l1_event->SetFromLevel1Struct(); |
575 |
|
|
|
576 |
pam-fi |
1.13 |
// ---------------- |
577 |
|
|
// HOUGH output |
578 |
|
|
// ---------------- |
579 |
|
|
if(p->geth){ |
580 |
|
|
if(p->ifrooth){ // root |
581 |
pam-fi |
1.23 |
lh_event->Delete(); |
582 |
|
|
lh_event->SetFromHoughStruct(&houghevent_); |
583 |
pam-fi |
1.13 |
}else{ // hbook |
584 |
|
|
throw -299; |
585 |
|
|
}; |
586 |
|
|
}; |
587 |
pam-ts |
1.46 |
|
588 |
|
|
// // ---------------- |
589 |
|
|
// // LEVEL2 output |
590 |
|
|
// // ---------------- |
591 |
|
|
l2_event->Clear(); |
592 |
|
|
if(p->get1){ |
593 |
|
|
l2_event->SetFromLevel2Struct(&level2event_,l1_event);//set references to level1 |
594 |
|
|
}else{ |
595 |
|
|
l2_event->SetFromLevel2Struct(&level2event_); |
596 |
|
|
} |
597 |
|
|
|
598 |
|
|
if( l2_event->ntrk()>0 )ntrk++; |
599 |
|
|
if(TrkParams::VerboseMode())l2_event->Dump(); |
600 |
|
|
|
601 |
pam-ts |
1.48 |
|
602 |
|
|
//---------------------------------------------- |
603 |
|
|
// verify conditions to apply extended algorythm |
604 |
|
|
//---------------------------------------------- |
605 |
|
|
bool APPLY_EXTENDED = false; |
606 |
mocchiut |
1.55 |
extAlgFlag = 0; // EM: this is the standard situation, extAlgFlag must be set to zero here. It does not garantuee you have an extended track, it just states |
607 |
|
|
// that if there were no standard tracks the extended algorithm is used. If not cleared and if there is at least one standard track |
608 |
|
|
// extAlgFlag retains the previous value that could be DIFFERENT from zero if the previous event was a check event... |
609 |
pam-ts |
1.48 |
if( |
610 |
mocchiut |
1.55 |
p->gete && //input flag set |
611 |
pam-ts |
1.48 |
true){ |
612 |
|
|
|
613 |
pam-ts |
1.52 |
// regular condition for extended processing |
614 |
|
|
if(l2_event->ntrk()==0){ |
615 |
pam-ts |
1.48 |
APPLY_EXTENDED = true; |
616 |
mocchiut |
1.55 |
extAlgFlag = 1; // EM: meaning of extAlgFlag changed: 0 if not used, 1 if used, 2 if used for cross-check, 3 used for cross-check and no std tracks |
617 |
pam-ts |
1.48 |
} |
618 |
pam-ts |
1.52 |
// extended algorythm applied for cross-check |
619 |
pam-ts |
1.48 |
if(p->gete_ncheck>0 && ev_count%p->gete_ncheck==0){ |
620 |
|
|
APPLY_EXTENDED = true; |
621 |
mocchiut |
1.55 |
extAlgFlag = 2; // EM read above |
622 |
|
|
if(l2_event->ntrk()==0) extAlgFlag = 3; // EM make it easier to recognize events with no standard tracks AND forced extended algorithm // EM read above |
623 |
pam-ts |
1.48 |
} |
624 |
|
|
|
625 |
|
|
} |
626 |
|
|
|
627 |
pam-ts |
1.52 |
// cout << " apply extended "<<APPLY_EXTENDED<<" forced "<<extAlgFlag<<endl; |
628 |
|
|
|
629 |
|
|
if(tWatch)w.Start(); |
630 |
pam-ts |
1.46 |
|
631 |
pam-fi |
1.45 |
// ------------------ |
632 |
|
|
// extended-tracking |
633 |
|
|
// ------------------ |
634 |
pam-ts |
1.52 |
trkAlg->Clear(); |
635 |
pam-ts |
1.48 |
if(APPLY_EXTENDED){ |
636 |
pam-ts |
1.46 |
|
637 |
pam-ts |
1.48 |
// //---------------------------- |
638 |
|
|
// // check conditions |
639 |
|
|
// //---------------------------- |
640 |
|
|
// if( |
641 |
|
|
// l2_event->ntrk()==0 && |
642 |
|
|
// l1_event->nclstr()<24 && |
643 |
|
|
// true){ |
644 |
pam-ts |
1.46 |
|
645 |
pam-ts |
1.48 |
trkAlg->SetDebug(false); |
646 |
|
|
trkAlg->SetTrkLevel2(l2_event); |
647 |
|
|
trkAlg->SetTrkLevel1(l1_event); |
648 |
|
|
trkAlg->SetCaloLevel1(cl1); |
649 |
|
|
trkAlg->SetToFLevel2(tl2); |
650 |
|
|
// trkAlg->Dump(); |
651 |
|
|
trkAlg->ProcessEvent(); |
652 |
mocchiut |
1.49 |
|
653 |
pam-ts |
1.48 |
// } |
654 |
pam-ts |
1.46 |
} |
655 |
|
|
|
656 |
pam-ts |
1.52 |
if(tWatch)w.Stop(); |
657 |
|
|
if(tWatch)trkWatch.tTrkExt = (float) w.CpuTime(); |
658 |
|
|
// if(tWatch)cout << " t."<<trkWatch.tTrkExt<<endl; |
659 |
pam-ts |
1.46 |
|
660 |
|
|
|
661 |
|
|
if(p->getn){ |
662 |
|
|
|
663 |
pam-ts |
1.52 |
if(tWatch)w.Start(); |
664 |
|
|
|
665 |
|
|
l1_event_nuclei->Clear(); |
666 |
pam-ts |
1.46 |
l1_event_nuclei->Set(l1_event,5.,0.2);//apply a cut |
667 |
|
|
l1_event_nuclei->GetLevel1Struct();//from cleaned l1 object, to f77 common |
668 |
|
|
l1_event_nuclei->ProcessEvent(); // default routine |
669 |
pam-ts |
1.52 |
l2_event_nuclei->Clear(); |
670 |
pam-ts |
1.46 |
l2_event_nuclei->SetFromLevel2Struct(); // from f77 common to l2 object |
671 |
pam-ts |
1.48 |
|
672 |
pam-ts |
1.52 |
|
673 |
pam-ts |
1.46 |
trkAlg_nuclei->Clear(); |
674 |
pam-ts |
1.52 |
|
675 |
pam-ts |
1.48 |
if(APPLY_EXTENDED){ |
676 |
|
|
|
677 |
|
|
trkAlg_nuclei->SetDebug(false); |
678 |
|
|
trkAlg_nuclei->SetTrkLevel2( l2_event_nuclei ); |
679 |
|
|
trkAlg_nuclei->SetTrkLevel1( l1_event_nuclei );//cleaned level1 |
680 |
|
|
trkAlg_nuclei->SetCaloLevel1( cl1 ); |
681 |
|
|
trkAlg_nuclei->SetToFLevel2( tl2 ); |
682 |
|
|
trkAlg_nuclei->ProcessEvent(); |
683 |
pam-ts |
1.46 |
} |
684 |
|
|
|
685 |
pam-ts |
1.52 |
if(tWatch)w.Stop(); |
686 |
|
|
if(tWatch)trkWatch.tTrkNuc = (float) w.CpuTime(); |
687 |
|
|
// if(tWatch)cout << " t."<<trkWatch.tTrkNuc<<endl; |
688 |
pam-fi |
1.45 |
|
689 |
pam-ts |
1.46 |
} |
690 |
mocchiut |
1.49 |
|
691 |
pam-fi |
1.45 |
|
692 |
pam-ts |
1.52 |
// if( l1_event->nclstr() > 15 && trkAlg->GetTrackArray()->GetEntries()>0){ |
693 |
|
|
|
694 |
|
|
// if(l1_event)cout<<" std n.cl "<<l1_event->nclstr(); |
695 |
|
|
// if(l2_event)cout<<" n.tr "<<l2_event->GetNTracks() ; |
696 |
|
|
// if(trkAlg)cout<<" ext "<<trkAlg->GetTrackArray()->GetEntries(); |
697 |
|
|
// cout<<endl; |
698 |
|
|
|
699 |
|
|
// trkAlg->SetDebug(true); |
700 |
|
|
// trkAlg->CheckEvent(); |
701 |
|
|
// trkAlg->SetDebug(false); |
702 |
|
|
|
703 |
pam-fi |
1.45 |
|
704 |
pam-ts |
1.52 |
// } |
705 |
|
|
|
706 |
|
|
// if( l1_event_nuclei->nclstr() <3 && trkAlg_nuclei->GetTrackArray()->GetEntries()>0){ |
707 |
|
|
// if(l1_event_nuclei)cout<<" nuc n.cl "<<l1_event_nuclei->nclstr(); |
708 |
|
|
// if(l2_event_nuclei)cout<<" n.tr "<<l2_event_nuclei->GetNTracks() ; |
709 |
|
|
// if(trkAlg_nuclei)cout<<" ext "<<trkAlg_nuclei->GetTrackArray()->GetEntries(); |
710 |
|
|
// cout<<endl; |
711 |
|
|
// trkAlg_nuclei->SetDebug(true); |
712 |
|
|
// trkAlg_nuclei->CheckEvent(); |
713 |
|
|
// trkAlg_nuclei->SetDebug(false); |
714 |
|
|
// } |
715 |
pam-ts |
1.46 |
|
716 |
|
|
///////////////////// |
717 |
|
|
// ==== FILL ===== // |
718 |
|
|
///////////////////// |
719 |
|
|
t_level2->Fill(); |
720 |
|
|
|
721 |
pam-ts |
1.52 |
if(tWatch){ |
722 |
|
|
|
723 |
|
|
trkWatch.nCl = (l1_event ? l1_event->nclstr() :0); |
724 |
|
|
trkWatch.nClCut = (l1_event_nuclei ? l1_event_nuclei->nclstr() :0); |
725 |
|
|
|
726 |
|
|
|
727 |
|
|
trkWatch.nTrk = (l2_event ? l2_event->GetNTracks() :0); |
728 |
|
|
trkWatch.nTrkNuc = (l2_event_nuclei ? l2_event_nuclei->GetNTracks() :0); |
729 |
|
|
|
730 |
|
|
trkWatch.nTrkExt = ( trkAlg ? trkAlg->GetTrackArray()->GetEntries() : 0); |
731 |
|
|
trkWatch.nTrkExtNuc = ( trkAlg_nuclei ? trkAlg_nuclei->GetTrackArray()->GetEntries() : 0); |
732 |
|
|
|
733 |
|
|
if(TrkParams::VerboseMode())trkWatch.Dump(); |
734 |
|
|
|
735 |
|
|
|
736 |
|
|
tWatch->Fill(); |
737 |
|
|
} |
738 |
pam-fi |
1.45 |
|
739 |
pam-fi |
1.13 |
}; |
740 |
mocchiut |
1.1 |
}; // end loop on events |
741 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode()){ |
742 |
pam-fi |
1.13 |
cout << " >>> processed "<< ev_count <<" events"<< endl; |
743 |
|
|
if(ev_count)cout << ntrk << " events with at least one track ("<<(Int_t)(100*ntrk/ev_count)<<"%)\n"; |
744 |
|
|
reduction->Show("reduction"); |
745 |
pam-fi |
1.11 |
} |
746 |
|
|
delete reduction; |
747 |
pam-fi |
1.7 |
|
748 |
|
|
delete dbtime; |
749 |
|
|
|
750 |
pam-fi |
1.13 |
}; // end loop on runs |
751 |
|
|
|
752 |
|
|
|
753 |
mocchiut |
1.1 |
// ------------------------------------------------------------ |
754 |
|
|
// if reprocessing one run, copy all the events AFTER the run |
755 |
|
|
// ------------------------------------------------------------ |
756 |
|
|
if( !(p->standalone) ){ |
757 |
mocchiut |
1.50 |
if(TrkParams::VerboseMode()) cout << " Reprocessing one run: "<<run<< " copy all events AFTER the run"<< endl; |
758 |
mocchiut |
1.1 |
for(UInt_t i=runinfo->GetLastEntry()+1; i<runinfo->GetFileEntries(); i++){ |
759 |
mocchiut |
1.37 |
if ( t_clone->GetEntry(i) <= 0 ) throw -36;//EM |
760 |
mocchiut |
1.1 |
*l2_event = *l2_clone; |
761 |
pam-ts |
1.46 |
// COPY COPY COPY |
762 |
mocchiut |
1.1 |
t_level2->Fill(); |
763 |
|
|
l2_event->Clear(); |
764 |
|
|
}; |
765 |
|
|
}; |
766 |
|
|
// --------------- |
767 |
|
|
// close the files |
768 |
|
|
// --------------- |
769 |
|
|
if(p->get2){ |
770 |
mocchiut |
1.50 |
if(TrkParams::VerboseMode()) cout << " Writing and closing the files, t_level2 "<< t_level2<< endl; |
771 |
pam-ts |
1.46 |
f2->cd(); |
772 |
|
|
// if(tWatch){ |
773 |
|
|
// if(tWatch)f2->Write("TrkWatch",TObject::kOverwrite); |
774 |
|
|
// } |
775 |
|
|
// f2->Write("Tracker", TObject::kOverwrite); |
776 |
mocchiut |
1.50 |
// if( t_level2 )t_level2->Write(); |
777 |
|
|
|
778 |
|
|
if( t_clone )t_clone->Delete("all");//delete old tree from file |
779 |
|
|
|
780 |
|
|
if( t_level2 )t_level2->SetName("Tracker"); |
781 |
|
|
if( t_level2 )t_level2->Write("Tracker",TObject::kOverwrite); |
782 |
pam-ts |
1.46 |
if( t_level2 )t_level2->Delete(); //delete new tree from memory |
783 |
|
|
|
784 |
pam-fi |
1.13 |
if( !(p->standalone) )runinfo->Close(); |
785 |
pam-ts |
1.46 |
if(tWatch)tWatch->Write(); |
786 |
pam-fi |
1.13 |
|
787 |
|
|
}; |
788 |
pam-ts |
1.46 |
|
789 |
pam-fi |
1.45 |
|
790 |
pam-fi |
1.24 |
if(f0) if(f0->IsOpen()) f0->Close(); |
791 |
pam-ts |
1.46 |
|
792 |
pam-fi |
1.13 |
l1_event->Delete(); |
793 |
|
|
l2_event->Delete(); |
794 |
|
|
l2_clone->Delete(); |
795 |
pam-fi |
1.2 |
|
796 |
pam-fi |
1.45 |
|
797 |
pam-fi |
1.2 |
return(p->ostatus); |
798 |
mocchiut |
1.1 |
} |
799 |
|
|
|