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 |
|
|
|
28 |
mocchiut |
1.1 |
// ......................................................... |
29 |
|
|
// other general header files |
30 |
|
|
// ......................................................... |
31 |
|
|
#include <fstream> |
32 |
|
|
#include <iostream> |
33 |
|
|
// ......................................................... |
34 |
|
|
// files in the inc directory |
35 |
|
|
// ......................................................... |
36 |
|
|
#include <RunInfo.h> |
37 |
|
|
#include <GLTables.h> |
38 |
|
|
#include <TrkVerl2.h> |
39 |
|
|
#include <TrkProcess.h> |
40 |
pam-fi |
1.2 |
//#include <TrkStruct.h> |
41 |
mocchiut |
1.1 |
#include <TrkLevel2.h> |
42 |
pam-fi |
1.6 |
#include <TrkLevel1.h> |
43 |
mocchiut |
1.1 |
#include <TrkLevel0.h> |
44 |
pam-fi |
1.15 |
#include <TrkHough.h> |
45 |
mocchiut |
1.1 |
// ......................................................... |
46 |
|
|
// YODA header files |
47 |
|
|
// ......................................................... |
48 |
|
|
#include <PamelaRun.h> |
49 |
pam-fi |
1.7 |
//#include <RegistryEvent.h> |
50 |
mocchiut |
1.1 |
#include <physics/tracker/TrackerEvent.h> |
51 |
|
|
#include <CalibTrk1Event.h> |
52 |
|
|
#include <CalibTrk2Event.h> |
53 |
pam-fi |
1.2 |
|
54 |
mocchiut |
1.1 |
// ......................................................... |
55 |
|
|
// namespaces |
56 |
|
|
// ......................................................... |
57 |
|
|
using namespace std; |
58 |
|
|
using namespace pamela; |
59 |
|
|
// ================================================================================ |
60 |
|
|
// |
61 |
|
|
// |
62 |
|
|
// ================================================================================ |
63 |
|
|
/** |
64 |
|
|
* \brief Tracker data reduction routine. |
65 |
|
|
* |
66 |
|
|
* It performs data reduction LEVEL0->LEVEL1->LEVEL2, producing LEVEL1 and or LEVEL2 output, in ROOT or HBOOK format. |
67 |
|
|
* Input parameters: |
68 |
|
|
* @param run id of the run to be processed (if run=0 a whole file is reprocessed) |
69 |
|
|
* @param dbc pointer to BD server |
70 |
|
|
* @param file1 output LEVEL1 file name (null if no LEVEL1 output is required) |
71 |
|
|
* @param file2 output LEVEL2 file name (null if no LEVEL2 output is required) |
72 |
|
|
* @param standalone (flag to run the program in standalone mode, that is without reading RunInfo) |
73 |
|
|
*/ |
74 |
|
|
//short int TrkCore(Int_t run, TSQLServer *dbc, TString file1, TString file2, Bool_t standalone) |
75 |
mocchiut |
1.29 |
//int TrkCore(UInt_t run, TFile *f2, TSQLServer *dbc, int ncustom, char*vcustom[]) |
76 |
|
|
int TrkCore(UInt_t run, TFile *f2, GL_TABLES *glt, int ncustom, char*vcustom[]) |
77 |
mocchiut |
1.1 |
{ |
78 |
|
|
// --------------------------- |
79 |
|
|
// Define some basic variables |
80 |
|
|
// --------------------------- |
81 |
|
|
|
82 |
|
|
TString filename = 0; |
83 |
pam-fi |
1.7 |
Long64_t nentries = 0LL; |
84 |
pam-fi |
1.2 |
|
85 |
mocchiut |
1.1 |
// LEVEL0 input |
86 |
|
|
TFile *f0 = 0; |
87 |
|
|
TTree *physicsTree = 0; |
88 |
|
|
TBranch *b_trk = 0; |
89 |
|
|
TBranch *b_header = 0; |
90 |
|
|
EventHeader *header = 0; |
91 |
|
|
PscuHeader *pscu = 0; |
92 |
pam-fi |
1.22 |
TrkLevel0 *l0_event = new TrkLevel0(); |
93 |
mocchiut |
1.1 |
// RunInfo |
94 |
|
|
ItoRunInfo *runinfo = 0; |
95 |
pam-fi |
1.7 |
TArrayI *runlist = 0; |
96 |
|
|
UInt_t from_run; |
97 |
|
|
UInt_t to_run; |
98 |
mocchiut |
1.1 |
Bool_t reprocessing = false; |
99 |
|
|
//LEVEL2 output - ROOT |
100 |
|
|
TTree *t_level2 = 0; |
101 |
|
|
TTree *t_clone = 0; |
102 |
|
|
TrkLevel2 *l2_event = new TrkLevel2(); |
103 |
|
|
TrkLevel2 *l2_clone = new TrkLevel2(); |
104 |
pam-fi |
1.13 |
//LEVEL1 output - ROOT |
105 |
|
|
TrkLevel1 *l1_event = new TrkLevel1(); |
106 |
pam-fi |
1.15 |
TrkHough *lh_event = new TrkHough(); |
107 |
mocchiut |
1.1 |
// ----------------------- |
108 |
|
|
// ----------------------- |
109 |
|
|
// Handle input parameters |
110 |
|
|
// (data) |
111 |
|
|
// |
112 |
|
|
// - open/create output files, determining the environment root/hbook from the estension |
113 |
|
|
// - create the level1/level2 tree+branch/nt-uple |
114 |
|
|
// ----------------------- |
115 |
|
|
// ----------------------- |
116 |
|
|
TrkProcess *p = new TrkProcess(run,f2); |
117 |
pam-fi |
1.26 |
if( p->HandleCustomPar(ncustom,vcustom) )return(p->ostatus);; |
118 |
pam-fi |
1.25 |
if( TrkParams::VerboseMode() )p->Dump(); |
119 |
mocchiut |
1.1 |
|
120 |
|
|
// =================================== |
121 |
|
|
// Open/Create level2 output file |
122 |
|
|
// =================================== |
123 |
|
|
if(p->get2){ |
124 |
pam-fi |
1.13 |
//------------------------------------------- |
125 |
|
|
// read RunInfo |
126 |
|
|
//------------------------------------------- |
127 |
|
|
if(!(p->standalone)){ |
128 |
|
|
// Open "RunInfo" tree and get list of run |
129 |
|
|
runinfo = new ItoRunInfo(f2); |
130 |
|
|
char *trkversion = TrkInfo(false); |
131 |
|
|
int runinfo_error = runinfo->Update(run,"TRK",trkversion); |
132 |
|
|
if( runinfo_error ) throw runinfo_error; |
133 |
|
|
runlist = runinfo->GetRunList(); |
134 |
|
|
reprocessing = runinfo->IsReprocessing();//???? |
135 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode()){ |
136 |
pam-fi |
1.13 |
cout << "#events "<< runinfo->GetFileEntries() << endl;// #events in the file |
137 |
|
|
cout << "#runs "<< runinfo->GetRunEntries() << endl;// #runs in the file |
138 |
|
|
cout << "1-st run "<< runlist->At(0) << endl; |
139 |
|
|
cout << "last run "<< runlist->At(runinfo->GetRunEntries()-1) << endl; |
140 |
|
|
cout << "1-st event "<< runinfo->GetFirstEntry() << endl;// first event of our run |
141 |
|
|
cout << "last event+1 "<< runinfo->GetLastEntry() << endl;// first event AFTER the last event of our run |
142 |
|
|
cout << "reprocessing "<< runinfo->IsReprocessing() << endl << endl; |
143 |
|
|
}; |
144 |
|
|
}; |
145 |
|
|
//------------------------------------------- |
146 |
|
|
// |
147 |
|
|
//------------------------------------------- |
148 |
|
|
// Take (if present) the old Tracker tree |
149 |
|
|
t_clone = (TTree*)f2->Get("Tracker"); |
150 |
|
|
if( t_clone != NULL ) t_clone->SetBranchAddress("TrkLevel2",&l2_clone); |
151 |
|
|
// Create NEW Tracker tree |
152 |
|
|
t_level2 = new TTree("Tracker","PAMELA tracker level2 data "); |
153 |
pam-fi |
1.21 |
l2_event->Set(); // ****NBNBNBN***** |
154 |
pam-fi |
1.13 |
t_level2->Branch("TrkLevel2","TrkLevel2",&l2_event); |
155 |
|
|
if(p->get1){ |
156 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode())cout << endl << "Requested LEVEL1 output" << endl; |
157 |
pam-fi |
1.21 |
l1_event->Set(); // ****NBNBNBN***** |
158 |
pam-fi |
1.13 |
t_level2->Branch("TrkLevel1","TrkLevel1",&l1_event); |
159 |
pam-fi |
1.16 |
} |
160 |
|
|
if(p->geth){ |
161 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode())cout << endl << "Requested Hough-Transform output" << endl; |
162 |
pam-fi |
1.16 |
t_level2->Branch("TrkHough","TrkHough",&lh_event); |
163 |
pam-fi |
1.7 |
}; |
164 |
pam-fi |
1.13 |
}; |
165 |
mocchiut |
1.1 |
|
166 |
|
|
|
167 |
|
|
// ------------------------------------------- |
168 |
|
|
// define runs to be processed/reprocessed |
169 |
|
|
// ------------------------------------------- |
170 |
|
|
if(run == 0){ |
171 |
pam-fi |
1.13 |
// reprocessing ALL runs |
172 |
|
|
if(p->standalone)throw -298; // reprocessing not implemented |
173 |
|
|
from_run = runlist->At(0); |
174 |
|
|
to_run = runlist->At(runinfo->GetRunEntries()-1); |
175 |
mocchiut |
1.1 |
}else{ |
176 |
|
|
// processing/reprocessing ONE single run |
177 |
pam-fi |
1.13 |
from_run = run; |
178 |
|
|
to_run = run; |
179 |
mocchiut |
1.1 |
}; |
180 |
|
|
|
181 |
|
|
// |
182 |
|
|
// init event counter |
183 |
|
|
// |
184 |
|
|
Int_t ev_count =0; |
185 |
|
|
// |
186 |
|
|
// create query-results objects |
187 |
|
|
// |
188 |
pam-fi |
1.7 |
GL_RUN q1 = GL_RUN(); |
189 |
mocchiut |
1.1 |
GL_TRK_CALIB q2 = GL_TRK_CALIB(); |
190 |
|
|
GL_ROOT q3 = GL_ROOT(); |
191 |
|
|
GL_PARAM q4 = GL_PARAM(); |
192 |
|
|
|
193 |
|
|
// ------------------------------------------------------------ |
194 |
|
|
// if reprocessing one run, copy all the events BEFORE the run |
195 |
|
|
// ------------------------------------------------------------ |
196 |
|
|
if( !(p->standalone) ){ |
197 |
pam-fi |
1.13 |
for(UInt_t i=0; i<runinfo->GetFirstEntry(); i++){ |
198 |
|
|
t_clone->GetEntry(i); |
199 |
|
|
*l2_event = *l2_clone; |
200 |
|
|
t_level2->Fill(); |
201 |
|
|
l2_event->Clear(); |
202 |
|
|
// COPY COPY COPY |
203 |
|
|
}; |
204 |
mocchiut |
1.1 |
}; |
205 |
|
|
// ------------------------------------------------------------ |
206 |
|
|
// ------------------------------------------------------------ |
207 |
pam-fi |
1.25 |
// START LOOP OVER RUNS TO PROCESS/REPROCESS |
208 |
mocchiut |
1.1 |
// ------------------------------------------------------------ |
209 |
|
|
// ------------------------------------------------------------ |
210 |
pam-fi |
1.7 |
for(UInt_t idRun = from_run; idRun <= to_run; idRun++){ |
211 |
mocchiut |
1.1 |
|
212 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode()) cout << endl<<" ========================= Run: "<< idRun << endl; |
213 |
pam-fi |
1.7 |
UInt_t runheadtime = 0; |
214 |
|
|
UInt_t runtrailtime = 0; |
215 |
mocchiut |
1.1 |
UInt_t evfrom = 0; |
216 |
|
|
UInt_t evto = 0; |
217 |
pam-fi |
1.7 |
UInt_t nevents = 0; |
218 |
|
|
Int_t id_root_l0 =-1; |
219 |
mocchiut |
1.1 |
Int_t trk_calib_used = 0; |
220 |
pam-fi |
1.7 |
|
221 |
mocchiut |
1.29 |
TString host = glt->CGetHost(); |
222 |
|
|
TString user = glt->CGetUser(); |
223 |
|
|
TString psw = glt->CGetPsw(); |
224 |
|
|
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
225 |
mocchiut |
1.1 |
if(p->standalone){ |
226 |
|
|
// ============================== |
227 |
|
|
// first query: retrieve run info |
228 |
|
|
// ============================== |
229 |
pam-fi |
1.7 |
if (q1.Query_GL_RUN(idRun,dbc) )throw -50; |
230 |
|
|
id_root_l0 = q1.ID_ROOT_L0; |
231 |
mocchiut |
1.1 |
runheadtime = q1.RUNHEADER_TIME; |
232 |
|
|
runtrailtime = q1.RUNTRAILER_TIME; |
233 |
pam-fi |
1.7 |
evfrom = q1.EV_FROM; |
234 |
|
|
evto = q1.EV_TO; |
235 |
pam-fi |
1.13 |
nevents = q1.NEVENTS; |
236 |
|
|
trk_calib_used = q1.TRK_CALIB_USED; |
237 |
mocchiut |
1.1 |
}else{ |
238 |
|
|
// ============================== |
239 |
|
|
// get run info from RunInfo tree |
240 |
|
|
// ============================== |
241 |
pam-fi |
1.3 |
int runinfo_error = runinfo->GetRunInfo(idRun); |
242 |
pam-fi |
1.7 |
if( runinfo_error ) throw runinfo_error; |
243 |
|
|
id_root_l0 = runinfo->ID_ROOT_L0; |
244 |
mocchiut |
1.1 |
runheadtime = runinfo->RUNHEADER_TIME; |
245 |
|
|
runtrailtime = runinfo->RUNTRAILER_TIME; |
246 |
pam-fi |
1.7 |
evfrom = runinfo->EV_FROM; |
247 |
|
|
evto = runinfo->EV_TO; |
248 |
pam-fi |
1.13 |
nevents = runinfo->NEVENTS; |
249 |
|
|
trk_calib_used = runinfo->TRK_CALIB_USED; |
250 |
pam-fi |
1.24 |
|
251 |
mocchiut |
1.1 |
}; |
252 |
pam-fi |
1.24 |
|
253 |
mocchiut |
1.1 |
// |
254 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode()){ |
255 |
pam-fi |
1.7 |
cout << "ROOT file ID "<< id_root_l0 << endl; |
256 |
mocchiut |
1.1 |
cout << "RunHeader time "<< runheadtime << endl; |
257 |
|
|
cout << "RunTrailer time "<< runtrailtime << endl; |
258 |
pam-fi |
1.7 |
cout << " from event "<< evfrom << endl; |
259 |
|
|
cout << " to event "<< evto << endl; |
260 |
pam-fi |
1.24 |
cout << " num. events "<< nevents << endl; |
261 |
|
|
cout << "trk-calibration used "<< trk_calib_used << endl; |
262 |
mocchiut |
1.1 |
}; |
263 |
|
|
// ======================================================== |
264 |
|
|
// second query: search the LEVEL0 file that contains idRun |
265 |
|
|
// ======================================================== |
266 |
|
|
TString lastfilename = filename; |
267 |
pam-fi |
1.7 |
if( q3.Query_GL_ROOT(id_root_l0,dbc) )throw -51; |
268 |
mocchiut |
1.1 |
filename = q3.PATH + q3.NAME; |
269 |
|
|
// ======================================================== |
270 |
|
|
// Open the input LEVEL0 data file |
271 |
|
|
// ======================================================== |
272 |
|
|
if(filename.CompareTo(lastfilename)){ |
273 |
|
|
if(!lastfilename.IsNull())f0->Close(); |
274 |
|
|
//if( debug ) cout << "Opening LEVEL0 file: "<< filename << endl; |
275 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode()) cout << "Opening LEVEL0 file: "<< filename << endl; |
276 |
pam-fi |
1.2 |
FileStat_t t; |
277 |
|
|
if( gSystem->GetPathInfo(filename.Data(),t) )throw -6; |
278 |
mocchiut |
1.1 |
f0 = new TFile(filename); |
279 |
|
|
if ( !f0 ) throw -6; |
280 |
|
|
physicsTree = (TTree*)f0->Get("Physics"); if(!physicsTree) throw -7; |
281 |
|
|
b_header = physicsTree ->GetBranch("Header"); if(!b_header ) throw -8; |
282 |
|
|
b_trk = physicsTree ->GetBranch("Tracker"); if(!b_trk ) throw -203; |
283 |
pam-fi |
1.22 |
l0_event->Set(); |
284 |
|
|
physicsTree->SetBranchAddress("Tracker" ,l0_event->GetPointerToTrackerEvent()); |
285 |
mocchiut |
1.1 |
physicsTree->SetBranchAddress("Header",&header); |
286 |
|
|
|
287 |
pam-fi |
1.7 |
nentries = physicsTree->GetEntries(); |
288 |
|
|
if ( nentries < 1 ) throw -11; |
289 |
|
|
if ( nentries < (evto+1)) throw -12; |
290 |
|
|
|
291 |
mocchiut |
1.1 |
}; |
292 |
|
|
|
293 |
pam-fi |
1.7 |
GL_TIMESYNC *dbtime = new GL_TIMESYNC(id_root_l0,"ID",dbc); |
294 |
|
|
|
295 |
pam-fi |
1.24 |
|
296 |
|
|
// ============================================================= |
297 |
|
|
// retrieve information about parameters to process LEVEL2 |
298 |
|
|
// ============================================================= |
299 |
|
|
|
300 |
|
|
TrkParams::Set(runinfo->GetGL_RUN(),dbc); |
301 |
pam-fi |
1.25 |
for(int i=0; i<p->npar; i++){ |
302 |
|
|
if(TrkParams::VerboseMode())cout<<" ((( force parameters from input path )))"<<endl; |
303 |
|
|
TrkParams::Set(p->parpath[i],p->partype[i]); |
304 |
|
|
} |
305 |
|
|
|
306 |
pam-fi |
1.24 |
TrkParams::Load(); |
307 |
|
|
if( !TrkParams::IsLoaded() )throw -52; |
308 |
|
|
|
309 |
|
|
// ============================================================= |
310 |
|
|
// retrieve calibration file needed to reduce data |
311 |
|
|
// ============================================================= |
312 |
|
|
|
313 |
|
|
TrkParams::SetCalib(runinfo->GetGL_RUN(),dbc); |
314 |
|
|
TrkParams::LoadCalib( ); |
315 |
|
|
if( !TrkParams::CalibIsLoaded() )throw -53; |
316 |
|
|
|
317 |
pam-fi |
1.11 |
TBenchmark *reduction = new TBenchmark(); |
318 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode())reduction->Start("reduction"); |
319 |
pam-fi |
1.11 |
Int_t ntrk=0; |
320 |
mocchiut |
1.1 |
// ==================================================== |
321 |
|
|
// start looping on events cointained in the data file |
322 |
|
|
// ==================================================== |
323 |
mocchiut |
1.28 |
if(dbc){ |
324 |
mocchiut |
1.29 |
dbc->Close(); |
325 |
|
|
delete dbc;}; |
326 |
mocchiut |
1.28 |
// |
327 |
pam-fi |
1.7 |
for (UInt_t re = evfrom; re < evfrom+nevents; re++){ |
328 |
mocchiut |
1.1 |
|
329 |
|
|
ev_count++; |
330 |
|
|
|
331 |
pam-fi |
1.25 |
// if ( TrkParams::DebugMode() && re%100 == 0 && re > 0 ) cout << "."; |
332 |
mocchiut |
1.1 |
|
333 |
pam-fi |
1.13 |
b_trk->GetEntry(re); |
334 |
|
|
b_header->GetEntry(re); |
335 |
|
|
pscu = header->GetPscuHeader(); |
336 |
pam-fi |
1.23 |
|
337 |
pam-fi |
1.25 |
if( TrkParams::DebugMode() )cout << ">>> "<<ev_count-1<<" @ OBT "<<pscu->GetOrbitalTime()<<endl; |
338 |
pam-fi |
1.23 |
|
339 |
pam-fi |
1.13 |
if ( dbtime->DBabsTime(pscu->GetOrbitalTime()) > runtrailtime || dbtime->DBabsTime(pscu->GetOrbitalTime()) < runheadtime) { |
340 |
pam-fi |
1.7 |
|
341 |
pam-fi |
1.25 |
if (TrkParams::VerboseMode()){ |
342 |
pam-fi |
1.14 |
printf(" TrkCore - WARNING: event outside the run time window, skipping it\n"); |
343 |
|
|
cout << " OBT "<<pscu->GetOrbitalTime()<<" ABS-time "<<dbtime->DBabsTime(pscu->GetOrbitalTime())<<" RUN "<<runheadtime<<"-"<<runtrailtime<<endl; |
344 |
|
|
}; |
345 |
pam-fi |
1.13 |
}else{ |
346 |
pam-fi |
1.25 |
if ( TrkParams::DebugMode() ) |
347 |
pam-fi |
1.23 |
printf("\n-------------------------------\nevent %d\n",re-evfrom); |
348 |
pam-fi |
1.16 |
|
349 |
pam-fi |
1.13 |
p->ProcessEvent(l0_event); |
350 |
pam-fi |
1.7 |
|
351 |
pam-fi |
1.13 |
// ---------------- |
352 |
|
|
// LEVEL1 output |
353 |
|
|
// ---------------- |
354 |
|
|
if(p->get1){ |
355 |
|
|
if(p->ifroot1){ // root |
356 |
|
|
l1_event->Clear(); |
357 |
pam-fi |
1.22 |
// l1_event->SetFromLevel1Struct(&level1event_,p->full1); |
358 |
|
|
l1_event->SetFromLevel1Struct(p->full1); |
359 |
pam-fi |
1.13 |
// t_level1->Fill(); |
360 |
pam-fi |
1.23 |
}else{ // hbook |
361 |
pam-fi |
1.13 |
throw -299; |
362 |
|
|
}; |
363 |
|
|
}; |
364 |
|
|
// ---------------- |
365 |
|
|
// HOUGH output |
366 |
|
|
// ---------------- |
367 |
|
|
if(p->geth){ |
368 |
|
|
if(p->ifrooth){ // root |
369 |
pam-fi |
1.23 |
lh_event->Delete(); |
370 |
|
|
lh_event->SetFromHoughStruct(&houghevent_); |
371 |
pam-fi |
1.13 |
}else{ // hbook |
372 |
|
|
throw -299; |
373 |
|
|
}; |
374 |
|
|
}; |
375 |
|
|
// ---------------- |
376 |
|
|
// LEVEL2 output |
377 |
|
|
// ---------------- |
378 |
|
|
if(p->get2){ |
379 |
pam-fi |
1.23 |
l2_event->Clear(); |
380 |
|
|
if(p->get1){ |
381 |
|
|
l2_event->SetFromLevel2Struct(&level2event_,l1_event);//set references to level1 |
382 |
|
|
}else{ |
383 |
|
|
l2_event->SetFromLevel2Struct(&level2event_); |
384 |
|
|
} |
385 |
pam-fi |
1.10 |
// l2_event->Dump(); |
386 |
pam-fi |
1.23 |
t_level2->Fill(); |
387 |
|
|
if( l2_event->ntrk()>0 )ntrk++; |
388 |
pam-fi |
1.27 |
if(TrkParams::VerboseMode())l2_event->Dump(); |
389 |
mocchiut |
1.1 |
}; |
390 |
pam-fi |
1.13 |
}; |
391 |
mocchiut |
1.1 |
}; // end loop on events |
392 |
pam-fi |
1.25 |
if(TrkParams::VerboseMode()){ |
393 |
pam-fi |
1.13 |
cout << " >>> processed "<< ev_count <<" events"<< endl; |
394 |
|
|
if(ev_count)cout << ntrk << " events with at least one track ("<<(Int_t)(100*ntrk/ev_count)<<"%)\n"; |
395 |
|
|
reduction->Show("reduction"); |
396 |
pam-fi |
1.11 |
} |
397 |
|
|
delete reduction; |
398 |
pam-fi |
1.7 |
|
399 |
|
|
delete dbtime; |
400 |
|
|
|
401 |
pam-fi |
1.13 |
}; // end loop on runs |
402 |
|
|
|
403 |
|
|
|
404 |
mocchiut |
1.1 |
// ------------------------------------------------------------ |
405 |
|
|
// if reprocessing one run, copy all the events AFTER the run |
406 |
|
|
// ------------------------------------------------------------ |
407 |
|
|
if( !(p->standalone) ){ |
408 |
|
|
for(UInt_t i=runinfo->GetLastEntry()+1; i<runinfo->GetFileEntries(); i++){ |
409 |
|
|
t_clone->GetEntry(i); |
410 |
|
|
*l2_event = *l2_clone; |
411 |
|
|
t_level2->Fill(); |
412 |
|
|
l2_event->Clear(); |
413 |
|
|
// COPY COPY COPY |
414 |
|
|
}; |
415 |
|
|
}; |
416 |
|
|
// --------------- |
417 |
|
|
// close the files |
418 |
|
|
// --------------- |
419 |
|
|
if(p->get2){ |
420 |
pam-fi |
1.13 |
if( t_clone )t_clone->Delete("all");//delete old tree from file |
421 |
|
|
if( !(p->standalone) )runinfo->Close(); |
422 |
|
|
f2->Write("Tracker"); |
423 |
|
|
if( t_level2 )t_level2->Delete(); //delete new tree from memory |
424 |
|
|
|
425 |
|
|
}; |
426 |
pam-fi |
1.6 |
|
427 |
pam-fi |
1.24 |
if(f0) if(f0->IsOpen()) f0->Close(); |
428 |
|
|
// if( f0_c->IsOpen() )f0_c->Close(); |
429 |
pam-fi |
1.13 |
|
430 |
|
|
// lh_event->Delete(); |
431 |
|
|
l1_event->Delete(); |
432 |
|
|
l2_event->Delete(); |
433 |
|
|
l2_clone->Delete(); |
434 |
pam-fi |
1.2 |
|
435 |
|
|
return(p->ostatus); |
436 |
mocchiut |
1.1 |
} |
437 |
|
|
|