/[PAMELA software]/DarthVader/CalorimeterLevel2/src/CaloCore.cpp
ViewVC logotype

Annotation of /DarthVader/CalorimeterLevel2/src/CaloCore.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.41 - (hide annotations) (download)
Thu Jun 19 20:03:59 2008 UTC (16 years, 8 months ago) by mocchiut
Branch: MAIN
Changes since 1.40: +35 -4 lines
New calorimeter calibration

1 mocchiut 1.1 //
2     // Given a calibration and a data file this program create an ntuple with LEVEL2 calorimeter variables - Emiliano Mocchiutti
3     //
4 mocchiut 1.3 // CaloCore.cxx version 3.05 (2006-05-30)
5 mocchiut 1.1 //
6     // The only input needed is the path to the directory created by YODA for the data file you want to analyze.
7     //
8     // Changelog:
9 mocchiut 1.3 //
10 mocchiut 1.11 // 3.08 (2006-11-13): Added high energy nuclei capability and "process all events" capability.
11     //
12 mocchiut 1.4 // 3.04 - 3.05 (2006-05-30): Qlast and nlast are now calculated using 4 (not 8) strips aournd the shower axis. Small bug fixed.
13 mocchiut 1.2 //
14     // 3.03 - 3.04 (2006-05-23): Forgot to put impx and impy in the PAMELA reference system, fixed.
15 mocchiut 1.1 //
16     // 3.02 - 3.03 (2006-05-18): updated to be called in DarthVader. Output dimension are now in cm and in the PAMELA reference system.
17     //
18     // 3.01 - 3.02 (2006-04-21): when copying entries get size of caclone and not of ca... (shouldn't matter). Fixed increasing file dimension bug when reprocessing.
19     // Added variable planemax[2], plane of maximum energy release (x and y) in final output. Use ItoRunInfo instead of RunInfo.
20     //
21     // 3.00 - 3.01 (2006-04-14): fixed small bug in tagging the track used to determine track-related variables, put in caloprocessing the opening of parameters files, fixed
22     // small bug in fortran routines
23     //
24     // 2.01 - 3.00 (2006-04-14): almost everything has changed. Now it can process one, all or some runs, introduced the final CaloLevel2 class+methods and the
25     // working class "CaloProcessing", linked to the preliminary tracker flight software v0r00, reads YODA unique output files,
26     // reduced the number of installed libraries, F77 programs splitted depending on the function contained, introduced the readout and
27     // processing of self-trigger events, if the tracker provides more than one track all calorimeter track-related variables are saved
28     // as many times as the number of tracks (via the TClonesArray object in the level2 rootple) and many other small changes.
29     //
30     // 2.00 - 2.01 (2006-01-26): bug: wrong calculation of baselines in some cases, fixed.
31     //
32     // 1.00 - 2.00 (2006-01-11): use TSQL ROOT classes instead of directly calling MySQL.
33     //
34     // 0.00 - 1.00 (2005-09-14): seems working.
35     //
36     // 0.00 (2005-09-09): clone of CaloLEVEL2.c .
37     //
38     // C/C++ headers
39     //
40     #include <fstream>
41     #include <string.h>
42     //
43     // ROOT headers
44     //
45     #include <TTree.h>
46     #include <TClassEdit.h>
47     #include <TObject.h>
48     #include <TList.h>
49 mocchiut 1.8 #include <TArrayI.h>
50 mocchiut 1.1 #include <TSystem.h>
51     #include <TSystemDirectory.h>
52     #include <TString.h>
53     #include <TFile.h>
54     #include <TClass.h>
55     #include <TCanvas.h>
56     #include <TH1.h>
57     #include <TH1F.h>
58     #include <TH2D.h>
59     #include <TLatex.h>
60     #include <TPad.h>
61     #include <TSQLServer.h>
62     #include <TSQLRow.h>
63     #include <TSQLResult.h>
64     #include <TClonesArray.h>
65     #include <TStreamerInfo.h>
66     //
67 mocchiut 1.20 // This program headers
68     //
69     #include <RunInfo.h>
70     //
71 mocchiut 1.1 // YODA headers
72     //
73     #include <PamelaRun.h>
74     #include <physics/trigger/TriggerEvent.h>
75     //
76     // This program headers
77     //
78     #include <CaloCore.h>
79 mocchiut 1.13 #include <CaloLevel1.h>
80 mocchiut 1.1 #include <CaloLevel2.h>
81 mocchiut 1.22 #include <CaloLevel0.h>
82 mocchiut 1.1 #include <CaloVerl2.h>
83     //
84     // Tracker classes headers and definitions
85     //
86     #include <TrkLevel2.h>
87     //
88     using namespace std;
89     //
90     // CORE ROUTINE
91     //
92 mocchiut 1.32 int CaloCore(UInt_t run, TFile *file, GL_TABLES *glt, Int_t calargc, char *calargv[]){
93 mocchiut 1.1 //
94     // Set these to true to have a very verbose output.
95     //
96     Bool_t verbose = false;
97     Bool_t debug = false;
98     //
99 mocchiut 1.21 Bool_t crosst = true;
100 mocchiut 1.36 Bool_t ctground = false;
101 mocchiut 1.41 Bool_t usetable = true;
102     Bool_t noselfct = false;
103 mocchiut 1.21 //
104 mocchiut 1.11 Bool_t trackanyway = true;
105     //
106     Float_t rigdefault = 50.;
107 mocchiut 1.35 //
108 mocchiut 1.11 Bool_t hZn = true;
109     //
110     Bool_t withtrk = true;
111     //
112     Bool_t st = true;
113     //
114 mocchiut 1.13 Bool_t getl1 = true;
115     //
116 mocchiut 1.23 Bool_t mechal = false;
117     //
118 mocchiut 1.30 Bool_t checksimu = true;
119     //
120 mocchiut 1.1 // Output directory is the working directoy.
121     //
122     const char* outdir = gSystem->DirName(gSystem->DirName(file->GetPath()));
123     //
124     Int_t ri = 0;
125 mocchiut 1.26 TString processFolder = Form("calorimeterFolder_%u",run);
126 mocchiut 1.1 if ( calargc > 0 ){
127     ri = 0;
128     while ( ri < calargc ){
129     if ( !strcmp(calargv[ri],"-processFolder") ) {
130     if ( calargc < ri+1 ){
131     throw -3;
132     };
133     processFolder = (TString)calargv[ri+1];
134     ri++;
135     };
136     if ( !strcmp(calargv[ri],"-v") || !strcmp(calargv[ri],"--verbose") ) {
137     verbose = true;
138     };
139     if ( !strcmp(calargv[ri],"-g") || !strcmp(calargv[ri],"--debug") ) {
140 mocchiut 1.13 verbose = true;
141 mocchiut 1.1 debug = true;
142     };
143 mocchiut 1.11 if ( !strcmp(calargv[ri],"--alltracks") ) {
144     trackanyway = true;
145     };
146 mocchiut 1.23 if ( !strcmp(calargv[ri],"--use-default-alig") ) {
147     mechal = true;
148     };
149 mocchiut 1.21 if ( !strcmp(calargv[ri],"--no-crosstalk") ) {
150     crosst = false;
151     };
152 mocchiut 1.34 if ( !strcmp(calargv[ri],"--flight-crosstalk") ) {
153     ctground = false;
154     };
155 mocchiut 1.41 if ( !strcmp(calargv[ri],"--ct-use-pulse") ) {
156     usetable = false;
157     };
158     if ( !strcmp(calargv[ri],"--ct-use-table") ) {
159     usetable = true;
160     };
161 mocchiut 1.34 if ( !strcmp(calargv[ri],"--ground-crosstalk") ) {
162     ctground = true;
163     };
164 mocchiut 1.41 if ( !strcmp(calargv[ri],"--no-self-crosstalk") ) {
165     noselfct = true;
166     };
167 mocchiut 1.11 if ( !strcmp(calargv[ri],"--no-tracker") ) {
168     withtrk = false;
169     };
170     if ( !strcmp(calargv[ri],"--with-tracker") ) {
171     withtrk = true;
172     };
173     if ( !strcmp(calargv[ri],"--defrig") ) {
174     if ( calargc < ri+1 ){
175     throw -3;
176     };
177     rigdefault = atof(calargv[ri+1]);
178     ri++;
179     };
180     if ( !strcmp(calargv[ri],"--no-alltracks") ) {
181     trackanyway = false;
182     };
183     if ( !strcmp(calargv[ri],"--highZnuclei") ) {
184     hZn = true;
185     };
186     if ( !strcmp(calargv[ri],"--no-highZnuclei") ) {
187     hZn = false;
188     };
189     if ( !strcmp(calargv[ri],"--selftrigger") ) {
190     st = true;
191     };
192     if ( !strcmp(calargv[ri],"--no-selftrigger") ) {
193     st = false;
194     };
195 mocchiut 1.13 if ( !strcmp(calargv[ri],"--no-level1") ) {
196     getl1 = false;
197     };
198 mocchiut 1.41 if ( !strcmp(calargv[ri],"--level1") ) {
199     getl1 = true;
200     };
201 mocchiut 1.30 if ( !strcmp(calargv[ri],"--ignore-h20") ) {
202     checksimu = false;
203     };
204 mocchiut 1.11 if ( !strcmp(calargv[ri],"--help") ) {
205     printf("\n\n CALORIMETER HELP CALLED\n\n");
206     printf(" CaloCore options: \n");
207     printf(" -v | --verbose be verbose\n");
208     printf(" -g | --debug be really verbose\n");
209     printf(" --defrig rig rig is the default rigidity in GV to be used to\n");
210     printf(" obtain calorimeter variables in the routines\n");
211     printf(" \"alltracks\" and \"higZnuclei\" [default = 50]\n");
212     printf(" --alltracks fill the track related variables even in the case\n");
213     printf(" of no tracks from tracker and no selftrigger event\n");
214 mocchiut 1.14 printf(" when we have a calorimeter fit for both views [default]\n");
215     printf(" --no-alltracks fill the track related variables only in the case\n");
216     printf(" of a good track from tracker or selftrigger\n");
217 mocchiut 1.11 printf(" --highZnuclei call the routine to analyze high Z nuclei\n");
218     printf(" selftrigger events [default]\n");
219     printf(" --no-highZnuclei do not call the routine to analyze high Z nuclei\n");
220     printf(" selftrigger events\n");
221     printf(" --no-tracker do not use tracker level2\n");
222     printf(" --with-tracker use tracker level2 [default]\n");
223 mocchiut 1.21 printf(" --no-crosstalk do not apply crosstalk corrections\n");
224 mocchiut 1.37 printf(" --ground-crosstalk apply ground crosstalk corrections\n");
225     printf(" --flight-crosstalk apply flight crosstalk corrections [default]\n");
226 mocchiut 1.41 printf(" --no-self-crosstalk do not apply preamplifiers crosstalk corrections to the strip itself\n");
227     printf(" --ct--use-pulse flight crosstalk corrections from pulse calibrations \n");
228     printf(" --ct--use-table flight crosstalk corrections from calibration table [default] \n");
229 mocchiut 1.11 printf(" --selftrigger process selftrigger events [default]\n");
230     printf(" --no-selftrigger skip selftrigger events\n");
231 mocchiut 1.13 printf(" --no-level1 do not save Level1 TBranch\n");
232 mocchiut 1.41 printf(" --level1 save Level1 TBranch [default] \n");
233 mocchiut 1.30 printf(" --ignore-h20 do not check if it is a file from simulations\n");
234 mocchiut 1.27 printf(" --use-default-alig use default mechanical alignement (defined in CaloLevel1.h)\n");
235 mocchiut 1.11 throw -114;
236     };
237 mocchiut 1.1 ri++;
238     };
239     };
240     //
241 mocchiut 1.13 if ( verbose ){
242     printf("\n");
243     if ( getl1 ) printf(" Saving calorimeter level1 data \n");
244     if ( st ) printf(" Calling selftrigger subroutine \n");
245     if ( hZn ) printf(" Calling high energy nuclei subroutine \n");
246     if ( trackanyway ) printf(" Filling track related variables for all the possible tracks \n");
247     if ( hZn || trackanyway ) printf(" => default assumed rigidity %f \n",rigdefault);
248     if ( withtrk ) printf(" Using tracker level2 data \n");
249 mocchiut 1.27 if ( mechal ) printf(" Using default mechanical alignement (defined in CaloLevel1.h)\n");
250 mocchiut 1.34 if ( crosst ){
251     printf(" Applying cross-talk corrections \n");
252     if ( ctground ){
253     printf(" => Using ground cross-talk coefficients \n");
254     } else {
255 mocchiut 1.41 printf(" => Using flight cross-talk coefficients... \n");
256     };
257     if ( usetable ){
258     printf(" ... coming from tables \n");
259     } else {
260     printf(" ... coming from pulse calibrations \n");
261 mocchiut 1.34 };
262     } else {
263     printf(" Do not applying cross-talk corrections \n");
264     };
265     if ( !checksimu ) printf(" Check on h20 TTree in level2 file skipped \n");
266 mocchiut 1.13 printf("\n");
267     };
268 mocchiut 1.11 //
269 mocchiut 1.1 // Working filename
270     //
271     TString outputfile;
272     stringstream name;
273     name.str("");
274     name << outdir << "/";
275     //
276     // Variables.
277     //
278     TTree *tracker = 0;
279     TTree *calo = 0;
280     TTree *caloclone = 0;
281     Bool_t reproc = false;
282     Bool_t reprocall = false;
283 mocchiut 1.8 UInt_t nevents = 0;
284 mocchiut 1.1 UInt_t nobefrun = 0;
285     UInt_t noaftrun = 0;
286     UInt_t numbofrun = 0;
287 mocchiut 1.8 UInt_t totnorun = 0;
288 mocchiut 1.1 //
289     Int_t code = 0;
290     Int_t sgnl;
291     //
292     // calorimeter level2 classes
293     //
294 mocchiut 1.13 CaloLevel1 *c1 = 0;
295     CaloLevel1 *c1clone = 0;
296     if ( getl1 ){
297     c1 = new CaloLevel1();
298     c1clone = new CaloLevel1();
299     };
300     //
301     // calorimeter level2 classes
302     //
303 mocchiut 1.1 CaloLevel2 *ca = new CaloLevel2();
304     CaloLevel2 *caclone = new CaloLevel2();
305     //
306     TrkLevel2 *trk = new TrkLevel2();
307 mocchiut 1.8 Int_t nevtrkl2 = 0;
308 mocchiut 1.1 //
309     UInt_t procev = 0;
310     //
311 mocchiut 1.8 // define variables where to store the absolute run header and run trailer times (unsigned long long integers, when set to a number use to store the correct number).
312 mocchiut 1.1 //
313 mocchiut 1.8 UInt_t runheadtime = 0;
314     UInt_t runtrailtime = 0;
315 mocchiut 1.1 UInt_t evfrom = 0;
316     UInt_t evto = 0;
317 mocchiut 1.8 UInt_t totfileentries = 0;
318     UInt_t idRun = 0;
319 mocchiut 1.1 Int_t id_reg_run=-1;
320     stringstream ftmpname;
321     TString fname;
322     //
323     // define variables for opening and reading level0 file
324     //
325     TFile *l0File = 0;
326     TTree *l0tr = 0;
327 mocchiut 1.24 TTree *softinfo = 0;
328 mocchiut 1.1 TBranch *l0head = 0;
329     TBranch *l0calo = 0;
330     TBranch *l0trig = 0;
331 mocchiut 1.8 pamela::EventHeader *eh = 0;
332     pamela::PscuHeader *ph = 0;
333 mocchiut 1.1 pamela::trigger::TriggerEvent *trig = 0;
334 mocchiut 1.24 Int_t yodaver = 0;
335 mocchiut 1.1 //
336     // Define some basic variables
337     //
338 mocchiut 1.22 CaloLevel0 *event = new CaloLevel0(); // NOTICE: very important to call here the constructor!
339 mocchiut 1.21 event->SetCrossTalk(crosst);
340 mocchiut 1.41 // event->SetCrossTalkType(ctground);
341     Int_t ict = -1;
342     if ( ctground ) ict = 0;
343     if ( !ctground ){
344     ict = 1;
345     };
346     if ( !ctground && noselfct ){
347     ict = 2;
348     };
349     event->SetCrossTalkType(ict);
350 mocchiut 1.1 stringstream file2;
351     stringstream file3;
352     stringstream qy;
353     // Bool_t imtrack = false;
354     Bool_t filled = false;
355     //
356 mocchiut 1.8 UInt_t caloevents = 0;
357 mocchiut 1.1 stringstream calfile;
358     stringstream aligfile;
359     //
360     Int_t i = -1;
361     Int_t itr = -1;
362     Int_t badevent = 0;
363     Int_t totevent = 0;
364     //
365 mocchiut 1.8 UInt_t atime = 0;
366 mocchiut 1.1 //
367     Int_t S3 = 0;
368     Int_t S2 = 0;
369     Int_t S12 = 0;
370     Int_t S11 = 0;
371     UInt_t re = 0;
372 mocchiut 1.9 UInt_t jumped = 0;
373 mocchiut 1.1 //
374     TString caloversion;
375     ItoRunInfo *runinfo = 0;
376 mocchiut 1.8 TArrayI *runlist = 0;
377 mocchiut 1.1 //
378     Float_t tmptrigty = -1.;
379     Int_t ntrkentry = 0;
380     GL_PARAM *q4 = new GL_PARAM();
381 mocchiut 1.8 UInt_t tttrkpar1 = 0;
382 mocchiut 1.1 Bool_t trkpar1 = true;
383     GL_ROOT *glroot = new GL_ROOT();
384 mocchiut 1.8 GL_TIMESYNC *dbtime = 0;
385 mocchiut 1.1 //
386 mocchiut 1.15 Long64_t maxsize = 10000000000LL;
387     TTree::SetMaxTreeSize(maxsize);
388 mocchiut 1.1 //
389     //
390     TFile *tempfile = 0;
391     TTree *tempcalo = 0;
392 mocchiut 1.30 Bool_t myfold = false;
393 mocchiut 1.1 stringstream tempname;
394     stringstream calofolder;
395     tempname.str("");
396     tempname << outdir;
397     tempname << "/" << processFolder.Data();
398     calofolder.str("");
399     calofolder << tempname.str().c_str();
400     tempname << "/calotree_run";
401     tempname << run << ".root";
402     //
403     // As a first thing we must check what we have to do: if run = -1 we must process all events in the file has been passed
404     // if run != -1 we must process only that run but first we have to check if the branch calorimeter already exist in the file
405     // if it exists we are reprocessing data and we must delete that entries, if not we must create it.
406     //
407 mocchiut 1.8 if ( run == 0 ) reproc = true;
408 mocchiut 1.1 //
409     //
410     //
411     if ( !file->IsOpen() ){
412     if ( verbose ) printf(" CALORIMETER - ERROR: cannot open file for writing\n");
413     throw -101;
414     };
415     //
416 mocchiut 1.11 if ( withtrk ){
417     //
418     // Does it contain the Tracker tree?
419     //
420     tracker = (TTree*)file->Get("Tracker");
421     if ( !tracker ) {
422     if ( verbose ) printf(" CALORIMETER - ERROR: no tracker tree\n");
423     code = -102;
424     goto closeandexit;
425     };
426     tracker->SetBranchAddress("TrkLevel2",&trk);
427     nevtrkl2 = tracker->GetEntries();
428 mocchiut 1.1 };
429     //
430 mocchiut 1.30 // Is it a file from simulations?
431     //
432     if ( checksimu ){
433     TTree *h20 = (TTree*)file->Get("h20");
434     if ( h20 ){
435     //
436     // yes!
437     //
438     crosst = false;
439 mocchiut 1.34 ctground = true;
440 mocchiut 1.30 mechal = true;
441     if ( verbose ) printf("\n\n SIMULATION!!! Setting --use-default-alig and --no-crosstalk flags!\n\n");
442     h20->Delete();
443     };
444     };
445     //
446 mocchiut 1.1 // Call runinfo
447     //
448     sgnl = 0;
449     runinfo = new ItoRunInfo(file);
450     //
451     // update versioning information and retrieve informations about the run to be processed
452     //
453     caloversion = CaloInfo(false);
454     sgnl = runinfo->Update(run,"CALO",caloversion);
455     //
456     if ( sgnl ){
457     if ( verbose ) printf(" CALORIMETER - ERROR: RunInfo exited with non-zero status\n");
458     code = sgnl;
459     goto closeandexit;
460     } else {
461     sgnl = 0;
462     };
463     //
464     // number of events in the file BEFORE the first event of our run
465     //
466     nobefrun = runinfo->GetFirstEntry();
467     //
468     // total number of events in the file
469     //
470     totfileentries = runinfo->GetFileEntries();
471     //
472     // first file entry AFTER the last event of our run
473     //
474     noaftrun = runinfo->GetLastEntry() + 1;
475     //
476     // number of run to be processed
477     //
478     numbofrun = runinfo->GetNoRun();
479     //
480     // number of runs in the file
481     //
482     totnorun = runinfo->GetRunEntries();
483     //
484     // Does it contain already a Calorimeter branch? if so we are reprocessing data, if not we must create it.
485     //
486     caloclone = (TTree*)file->Get("Calorimeter");
487     //
488     if ( !caloclone ){
489     reproc = false;
490 mocchiut 1.8 if ( run == 0 && verbose ) printf(" CALORIMETER - WARNING: you are reprocessing data but calorimeter tree does not exist!\n");
491     if ( runinfo->IsReprocessing() && run != 0 && verbose ) printf(" CALORIMETER - WARNING: it seems you are not reprocessing data but calorimeter\n versioning information already exists in RunInfo.\n");
492 mocchiut 1.1 //
493     } else {
494     //
495 mocchiut 1.15 caloclone->SetAutoSave(900000000000000LL);
496 mocchiut 1.1 reproc = true;
497     //
498     if ( verbose ) printf("\n Preparing the pre-processing...\n");
499     //
500 mocchiut 1.28 if ( run == 0 || totnorun == 1 ){
501 mocchiut 1.1 //
502     // if we are reprocessing everything we don't need to copy any old event and we can just create a new branch in the clone tree and jump steps 4/5/7.
503     //
504     if ( verbose ) printf("\n CALORIMETER - WARNING: Reprocessing all runs in the file\n");
505     reprocall = true;
506     //
507     } else {
508     //
509     // we are reprocessing a single run
510     //
511 mocchiut 1.8 if ( verbose ) printf("\n CALORIMETER - WARNING: Reprocessing run number %u \n",run);
512 mocchiut 1.1 reprocall = false;
513     //
514     //
515     //
516 mocchiut 1.30 gSystem->MakeDirectory(calofolder.str().c_str());
517     myfold = true;
518 mocchiut 1.1 tempfile = new TFile(tempname.str().c_str(),"RECREATE");
519     tempcalo = caloclone->CloneTree(-1,"fast");
520     tempcalo->SetName("Calorimeter-old");
521     tempfile->Write();
522     tempfile->Close();
523     };
524     //
525     // delete old tree
526     //
527     caloclone->Delete("all");
528     //
529     if ( verbose ) printf("\n ...done!\n");
530     //
531     };
532     //
533     // create calorimeter tree calo
534     //
535     file->cd();
536     calo = new TTree("Calorimeter-new","PAMELA Level2 calorimeter data");
537 mocchiut 1.15 calo->SetAutoSave(900000000000000LL);
538 pam-fi 1.16 ca->Set();
539 mocchiut 1.1 calo->Branch("CaloLevel2","CaloLevel2",&ca);
540 mocchiut 1.13 if ( getl1 ) calo->Branch("CaloLevel1","CaloLevel1",&c1);
541 mocchiut 1.1 //
542     if ( reproc && !reprocall ){
543     //
544     //
545     //
546     tempfile = new TFile(tempname.str().c_str(),"READ");
547     caloclone = (TTree*)tempfile->Get("Calorimeter-old");
548 mocchiut 1.15 caloclone->SetAutoSave(900000000000000LL);
549 mocchiut 1.1 caloclone->SetBranchAddress("CaloLevel2",&caclone);
550 mocchiut 1.13 TBranch *havel1 = caloclone->GetBranch("CaloLevel1");
551     if ( !havel1 && getl1 ) throw -117;
552     if ( havel1 && !getl1 ) throw -118;
553     if ( getl1 ) caloclone->SetBranchAddress("CaloLevel1",&c1clone);
554 mocchiut 1.1 //
555     if ( nobefrun > 0 ){
556     if ( verbose ) printf("\n Pre-processing: copying events from the old tree before the processed run\n");
557 mocchiut 1.8 if ( verbose ) printf(" Copying %u events in the file which are before the beginning of the run %u \n",nobefrun,run);
558 mocchiut 1.1 if ( verbose ) printf(" Start copying at event number 0, end copying at event number %u \n",nobefrun);
559     for (UInt_t j = 0; j < nobefrun; j++){
560     //
561     caloclone->GetEntry(j);
562     //
563     // copy caclone to ca
564     //
565 mocchiut 1.13 if ( getl1 ) memcpy(&c1,&c1clone,sizeof(c1clone));
566 mocchiut 1.1 memcpy(&ca,&caclone,sizeof(caclone));
567     //
568     // Fill entry in the new tree
569     //
570     calo->Fill();
571     //
572 mocchiut 1.13 if ( getl1 ) c1->Clear();
573 mocchiut 1.6 ca->Clear();
574     //
575 mocchiut 1.1 };
576     if ( verbose ) printf(" Finished successful copying!\n");
577     };
578     };
579     //
580     // Get the list of run to be processed
581     //
582     runlist = runinfo->GetRunList();
583     //
584     // Loop over the run to be processed
585     //
586     for (UInt_t irun=0; irun < numbofrun; irun++){
587     //
588     badevent = 0;
589     //
590     idRun = runlist->At(irun);
591     if ( verbose ) printf("\n\n\n ####################################################################### \n");
592 mocchiut 1.8 if ( verbose ) printf(" PROCESSING RUN NUMBER %u \n",idRun);
593 mocchiut 1.1 if ( verbose ) printf(" ####################################################################### \n\n\n");
594     //
595     sgnl = runinfo->GetRunInfo(idRun);
596     if ( sgnl ){
597     if ( verbose ) printf(" CALORIMETER - ERROR: RunInfo exited with non-zero status\n");
598     code = sgnl;
599     goto closeandexit;
600     } else {
601     sgnl = 0;
602     };
603 mocchiut 1.8 id_reg_run = runinfo->ID_ROOT_L0;
604 mocchiut 1.1 runheadtime = runinfo->RUNHEADER_TIME;
605     runtrailtime = runinfo->RUNTRAILER_TIME;
606 mocchiut 1.8 evfrom = runinfo->EV_FROM;
607     evto = runinfo->EV_TO;
608 mocchiut 1.1 //
609     if ( id_reg_run == -1 ){
610 mocchiut 1.8 if ( verbose ) printf("\n CALORIMETER - ERROR: no run with ID_RUN = %u \n\n Exiting... \n\n",idRun);
611 mocchiut 1.1 code = -5;
612     goto closeandexit;
613     };
614     //
615 mocchiut 1.8 // prepare the timesync for the db
616     //
617 mocchiut 1.32 TString host = glt->CGetHost();
618     TString user = glt->CGetUser();
619     TString psw = glt->CGetPsw();
620     TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
621     if ( !dbc->IsConnected() ) throw -116;
622 mocchiut 1.33 stringstream myquery;
623     myquery.str("");
624     myquery << "SET time_zone='+0:00'";
625     dbc->Query(myquery.str().c_str());
626 mocchiut 1.32 //
627 mocchiut 1.31 // if ( !dbc->IsConnected() ) throw -116;
628 mocchiut 1.8 dbtime = new GL_TIMESYNC(runinfo->ID_ROOT_L0,"ID",dbc);
629     //
630 mocchiut 1.1 // Search in the DB the path and name of the LEVEL0 file to be processed.
631     //
632 mocchiut 1.31 // if ( !dbc->IsConnected() ) throw -116;
633 mocchiut 1.8 glroot->Query_GL_ROOT(runinfo->ID_ROOT_L0,dbc);
634 mocchiut 1.1 //
635     ftmpname.str("");
636     ftmpname << glroot->PATH.Data() << "/";
637     ftmpname << glroot->NAME.Data();
638     fname = ftmpname.str().c_str();
639     //
640     // print out informations
641     //
642 mocchiut 1.8 totevent = runinfo->NEVENTS;
643 mocchiut 1.1 if ( verbose ) printf("\n LEVEL0 data file: %s \n",fname.Data());
644 mocchiut 1.8 if ( verbose ) printf(" RUN HEADER absolute time is: %u \n",runheadtime);
645     if ( verbose ) printf(" RUN TRAILER absolute time is: %u \n",runtrailtime);
646     if ( verbose ) printf(" %i events to be processed for run %u: from %i to %i (reg entries)\n\n",totevent,idRun,evfrom,evfrom+totevent);
647 mocchiut 1.1 //
648     // Open Level0 file
649     //
650     l0File = new TFile(fname.Data());
651     if ( !l0File ) {
652     if ( verbose ) printf(" CALORIMETER - ERROR: problems opening Level0 file\n");
653     code = -6;
654     goto closeandexit;
655     };
656     l0tr = (TTree*)l0File->Get("Physics");
657     if ( !l0tr ) {
658     if ( verbose ) printf(" CALORIMETER - ERROR: no Physics tree in Level0 file\n");
659     l0File->Close();
660     code = -7;
661     goto closeandexit;
662     };
663     l0head = l0tr->GetBranch("Header");
664     if ( !l0head ) {
665     if ( verbose ) printf(" CALORIMETER - ERROR: no Header branch in Level0 tree\n");
666     l0File->Close();
667     code = -8;
668     goto closeandexit;
669     };
670     l0calo = l0tr->GetBranch("Calorimeter");
671     if ( !l0calo ) {
672     if ( verbose ) printf(" CALORIMETER - ERROR: no Calorimeter branch in Level0 tree\n");
673     l0File->Close();
674     code = -103;
675     goto closeandexit;
676     };
677     l0trig = l0tr->GetBranch("Trigger");
678     if ( !l0trig ) {
679     if ( verbose ) printf(" CALORIMETER - ERROR: no Trigger branch in Level0 tree\n");
680     l0File->Close();
681     code = -104;
682     goto closeandexit;
683     };
684     //
685     l0tr->SetBranchAddress("Trigger", &trig);
686 mocchiut 1.8 l0tr->SetBranchAddress("Header", &eh);
687 mocchiut 1.1 //
688 mocchiut 1.24 softinfo = (TTree*)l0File->Get("SoftInfo");
689     if ( softinfo ){
690     softinfo->SetBranchAddress("SoftInfo",&yodaver);
691     softinfo->GetEntry(0);
692     };
693     if ( debug ) printf(" LEVEL0 FILE GENERATED WITH YODA VERSION %i \n",yodaver);
694     //
695 mocchiut 1.38 if ( withtrk ){
696     if ( trkpar1 || ( tttrkpar1 != 0 && tttrkpar1 < runheadtime ) ){
697     trkpar1 = false;
698     Int_t glpar = q4->Query_GL_PARAM(runinfo->RUNHEADER_TIME,1,dbc);
699     if ( glpar < 0 ){
700     code = glpar;
701     goto closeandexit;
702     };
703     tttrkpar1 = q4->TO_TIME;
704     // ----------------------------
705     // Read the magnetic field
706     // ----------------------------
707     if ( verbose ) printf(" Reading magnetic field maps at %s\n",(q4->PATH+q4->NAME).Data());
708     trk->LoadField(q4->PATH+q4->NAME);
709     if ( verbose ) printf("\n");
710     };
711     };
712     //
713     // Close DB connection
714     //
715     if ( dbc ){
716     dbc->Close();
717     delete dbc;
718     };
719     //
720     //
721 mocchiut 1.1 // Construct the event object, look for the calibration which include the first header
722     //
723     sgnl = 0;
724     if ( verbose ) printf(" Check for calorimeter calibrations and initialize event object \n");
725 mocchiut 1.31 // if ( !dbc->IsConnected() ) throw -116;
726 mocchiut 1.32 event->ProcessingInit(glt,runheadtime,sgnl,l0tr,debug,verbose);
727 mocchiut 1.1 if ( verbose ) printf("\n");
728     if ( sgnl == 100 ) {
729     code = sgnl;
730     if ( verbose ) printf(" CALORIMETER - WARNING: run header not included in any calibration interval\n");
731     sgnl = 0;
732     };
733     if ( sgnl ){
734     l0File->Close();
735     code = sgnl;
736     goto closeandexit;
737     };
738     //
739     qy.str("");
740     //
741 mocchiut 1.8 nevents = l0head->GetEntries();
742 mocchiut 1.1 caloevents = l0calo->GetEntries();
743     //
744     if ( nevents < 1 ) {
745     if ( verbose ) printf(" CALORIMETER - ERROR: Level0 file is empty\n\n");
746     l0File->Close();
747     code = -11;
748     goto closeandexit;
749     };
750     //
751     if ( evto > nevents-1 ) {
752     if ( verbose ) printf(" CALORIMETER - ERROR: too few entries in the registry tree\n");
753     l0File->Close();
754     code = -12;
755     goto closeandexit;
756     };
757     //
758     // Check if we have to load parameter files
759     //
760     sgnl = 0;
761 mocchiut 1.32 sgnl = event->ChkParam(glt,runheadtime,mechal); // calorimeter parameter files
762 mocchiut 1.1 if ( sgnl < 0 ){
763     code = sgnl;
764     l0File->Close();
765     goto closeandexit;
766     };
767     //
768 mocchiut 1.34 // Calculate the cross talk corrections needed for this run using calibration informations
769     //
770     if ( crosst && !ctground ){
771     sgnl = 0;
772 mocchiut 1.41 sgnl = event->CalcCrossTalkCorr(glt,runheadtime,usetable);
773 mocchiut 1.34 if ( sgnl < 0 ){
774     code = sgnl;
775     l0File->Close();
776     goto closeandexit;
777     };
778     };
779     //
780 mocchiut 1.1 // run over all the events of the run
781     //
782     if ( verbose ) printf("\n Ready to start! \n\n Processed events: \n\n");
783     //
784 mocchiut 1.19 for ( re = runinfo->EV_FROM; re < (runinfo->EV_FROM+runinfo->NEVENTS); re++){
785 mocchiut 1.40 //for ( re = 92012+3400; re < 92012+3700; re++){
786 mocchiut 1.18 // printf(" i = %i \n",re-200241);
787 mocchiut 1.1 //
788     if ( procev%1000 == 0 && procev > 0 && verbose ) printf(" %iK \n",procev/1000);
789     //
790 mocchiut 1.39 if ( debug ) printf("\n\n\n EVENT NUMBER %i \n",procev);
791     //
792 mocchiut 1.8 l0head->GetEntry(re);
793 mocchiut 1.1 //
794     // absolute time of this event
795     //
796 mocchiut 1.8 ph = eh->GetPscuHeader();
797     atime = dbtime->DBabsTime(ph->GetOrbitalTime());
798 mocchiut 1.1 //
799     //
800     //
801 mocchiut 1.8 if ( re > caloevents-1 ){
802 mocchiut 1.1 if ( verbose ) printf(" CALORIMETER - ERROR: no physics events with entry = %i in Level0 file\n",i);
803     l0File->Close();
804     code = -112;
805     goto closeandexit;
806     };
807     //
808     if ( atime > runtrailtime || atime < runheadtime ) {
809     if ( verbose ) printf(" CALORIMETER - WARNING: event at time outside the run time window, skipping it\n");
810 mocchiut 1.9 jumped++;
811 mocchiut 1.1 goto jumpev;
812     };
813     //
814     // retrieve tracker informations
815     //
816     if ( !reprocall ){
817 mocchiut 1.19 itr = nobefrun + (re - evfrom - jumped);
818     //itr = re-(46438+200241);
819 mocchiut 1.1 } else {
820 mocchiut 1.9 itr = runinfo->GetFirstEntry() + (re - evfrom - jumped);
821 mocchiut 1.1 };
822 mocchiut 1.11 //
823     if ( withtrk ){
824     if ( itr > nevtrkl2 ){
825     if ( verbose ) printf(" CALORIMETER - ERROR: no tracker events with entry = %i in Level2 file\n",itr);
826     l0File->Close();
827     code = -113;
828     goto closeandexit;
829     };
830     //
831     trk->Clear();
832     //
833     tracker->GetEntry(itr);
834     //
835 mocchiut 1.1 };
836 mocchiut 1.10 //
837 mocchiut 1.1 procev++;
838     //
839     // start processing
840     //
841 mocchiut 1.13 if ( getl1 ) c1->Clear();
842 mocchiut 1.6 ca->Clear();
843 mocchiut 1.1 //
844     // determine who generate the trigger for this event (TOF, S4/PULSER, CALO)
845     //
846 mocchiut 1.8 l0trig->GetEntry(re);
847 mocchiut 1.1 S3 = 0;
848     S2 = 0;
849     S12 = 0;
850     S11 = 0;
851     S3 = trig->patterntrig[2];
852     S2 = trig->patterntrig[3];
853     S12 = trig->patterntrig[4];
854     S11 = trig->patterntrig[5];
855 mocchiut 1.17 if ( trig->patterntrig[1] & (1<<0) ) tmptrigty = 1.;
856 mocchiut 1.1 if ( trig->patterntrig[0] ) tmptrigty = 2.;
857     if ( S3 || S2 || S12 || S11 ) tmptrigty = 0.;
858 mocchiut 1.17 if ( !(trig->patterntrig[1] & (1<<0)) && !trig->patterntrig[0] && !S3 && !S2 && !S12 && !S11 ) tmptrigty = 1.;
859 mocchiut 1.1 event->clevel2->trigty = tmptrigty;
860     //
861     // check if the calibration we are using is still good, if not load another calibration
862     //
863     sgnl = 0;
864 mocchiut 1.32 sgnl = event->ChkCalib(glt,atime);
865 mocchiut 1.1 if ( sgnl < 0 ){
866     code = sgnl;
867     goto closeandexit;
868     };
869     if ( sgnl == 100 ){
870     code = sgnl;
871     if ( verbose ) printf(" CALORIMETER - WARNING: data not associated to any calibration interval\n");
872     badevent++;
873     sgnl = 0;
874     };
875     //
876 mocchiut 1.11 // do we have at least one track from the tracker? this check has been disabled
877 mocchiut 1.1 //
878     event->clevel1->good2 = 1;
879 mocchiut 1.8 //
880 mocchiut 1.29 // use the whole calorimeter, 22 W planes
881     //
882     event->clevel1->npla = 22;
883     //
884     // Use the standard silicon planes shifting
885     //
886     event->clevel1->reverse = 0;
887     //
888 mocchiut 1.1 //
889 mocchiut 1.8 // Calibrate calorimeter event "re" and store output in the two structures that will be passed to fortran routine
890 mocchiut 1.1 //
891 mocchiut 1.11 event->Calibrate(re);
892 mocchiut 1.1 //
893     // Here we have calibrated data, ready to be passed to the FORTRAN routine which will extract topological variables.
894     //
895     //
896     // Calculate variables common to all tracks (qtot, nstrip, etc.)
897     //
898     event->GetCommonVar();
899     //
900     // Fill common variables
901     //
902 mocchiut 1.13 event->FillCommonVar(c1,ca);
903 mocchiut 1.1 //
904     // Calculate variables related to tracks only if we have at least one track (from selftrigger and/or tracker)
905     //
906     ntrkentry = 0;
907     //
908     filled = false;
909     //
910 mocchiut 1.11 // Run over tracks (tracker or calorimeter )
911     //
912     if ( withtrk ){
913     for(Int_t nt=0; nt < trk->ntrk(); nt++){
914     //
915     event->clevel1->good2 = 1;
916     //
917     TrkTrack *ptt = trk->GetStoredTrack(nt);
918     //
919     event->clevel1->trkchi2 = 0;
920     //
921     // Copy the alpha vector in the input structure
922     //
923     for (Int_t e = 0; e < 5 ; e++){
924     event->clevel1->al_p[e][0] = ptt->al[e];
925     };
926     //
927     // Get tracker related variables for this track
928     //
929     event->GetTrkVar();
930     //
931     // Save tracker track sequence number
932     //
933     event->trkseqno = nt;
934     //
935     // Copy values in the class ca from the structure clevel2
936     //
937     event->FillTrkVar(ca,ntrkentry);
938     ntrkentry++;
939     filled = true;
940     //
941     }; // loop on all the tracks
942     };
943     //
944     // if no tracks found but there is the possibility to have a good track we should try to calculate anyway the track related variables using the calorimeter
945     // fit of the track (to be used for example when TRK is off due to any reason like IPM3/5 off).
946     // here we make an event selection so it must be done very carefully...
947     //
948     // conditions are: 0) no track from the tracker 1) we have a track fit both in x and y 2) no problems with calo for this event 3) no selftrigger event
949     //
950     if ( trackanyway && !filled && event->clevel2->npcfit[0] >= 2 && event->clevel2->npcfit[1] >= 2 && event->clevel2->good != 0 && event->clevel2->trigty < 2. ){
951     if ( debug ) printf(" Event with a track not fitted by the tracker at entry %i \n",itr);
952     //
953     // Disable "track mode" in the fortran routine
954     //
955     event->clevel1->good2 = 0;
956     event->clevel1->riginput = rigdefault;
957     if ( debug ) printf(" Using as default rigidity: %f \n",event->clevel1->riginput);
958     //
959     // We have a selftrigger event to analyze.
960     //
961     for (Int_t e = 0; e < 5 ; e++){
962     event->clevel1->al_p[e][0] = 0.;
963     event->clevel1->al_p[e][1] = 0.;
964     };
965     event->clevel1->trkchi2 = 0;
966     //
967     event->GetTrkVar();
968     //
969     // if we had no problem (clevel1->good2 = 0, NOTICE zero, not one in this mode!), fill and go on
970 mocchiut 1.1 //
971 mocchiut 1.11 if ( event->clevel1->good2 == 0 ) {
972 mocchiut 1.1 //
973 mocchiut 1.11 // In selftrigger mode the trkentry variable is set to -1
974 mocchiut 1.1 //
975 mocchiut 1.11 event->trkseqno = -3;
976 mocchiut 1.1 //
977 mocchiut 1.11 // Copy values in the class ca from the structure clevel2
978 mocchiut 1.1 //
979 mocchiut 1.11 event->FillTrkVar(ca,ntrkentry);
980     ntrkentry++;
981     filled = true;
982     //
983     } else {
984     if ( verbose ) printf(" Selftrigger: problems with event at entry %i \n",itr);
985     };
986     //
987     };
988     //
989     // Call high energy nuclei routine
990     //
991     if ( hZn && event->clevel2->trigty >= 2. ){
992     if ( debug ) printf(" Calling selftrigger high energy nuclei routine for entry %i \n",itr);
993     //
994     // Disable "track mode" in the fortran routine
995     //
996     event->clevel1->good2 = 0;
997     //
998     // Set high energy nuclei flag to one
999     //
1000     event->clevel1->hzn = 1;
1001     event->clevel1->riginput = rigdefault;
1002     //
1003     // We have a selftrigger event to analyze.
1004     //
1005     for (Int_t e = 0; e < 5 ; e++){
1006     event->clevel1->al_p[e][0] = 0.;
1007     event->clevel1->al_p[e][1] = 0.;
1008 mocchiut 1.1 };
1009 mocchiut 1.11 event->clevel1->trkchi2 = 0;
1010     //
1011     event->GetTrkVar();
1012     //
1013     // if we had no problem (clevel1->good2 = 0, NOTICE zero, not one in this mode!), fill and go on
1014     //
1015     if ( event->clevel1->good2 == 0 ) {
1016     //
1017     // In selftrigger mode the trkentry variable is set to -1
1018     //
1019     event->trkseqno = -2;
1020     //
1021     // Copy values in the class ca from the structure clevel2
1022 mocchiut 1.1 //
1023 mocchiut 1.11 event->FillTrkVar(ca,ntrkentry);
1024     ntrkentry++;
1025     filled = true;
1026 mocchiut 1.1 //
1027 mocchiut 1.11 } else {
1028     if ( verbose ) printf(" Selftrigger: problems with event at entry %i \n",itr);
1029     };
1030     //
1031     };
1032     //
1033     // self trigger event
1034     //
1035     if ( st && event->clevel2->trigty >= 2. ){
1036     if ( verbose ) printf(" Selftrigger event at entry %i \n",itr);
1037     //
1038     // Disable "track mode" in the fortran routine
1039     //
1040     event->clevel1->good2 = 0;
1041     //
1042     // disable high enery nuclei flag;
1043     //
1044     event->clevel1->hzn = 0;
1045     //
1046     // We have a selftrigger event to analyze.
1047     //
1048     for (Int_t e = 0; e < 5 ; e++){
1049     event->clevel1->al_p[e][0] = 0.;
1050     event->clevel1->al_p[e][1] = 0.;
1051     };
1052     event->clevel1->trkchi2 = 0;
1053     //
1054     event->GetTrkVar();
1055     //
1056     // if we had no problem (clevel2->good = 0, NOTICE zero, not one in selftrigger mode!), fill and go on
1057     //
1058     if ( event->clevel1->good2 == 0 ) {
1059 mocchiut 1.1 //
1060 mocchiut 1.11 // In selftrigger mode the trkentry variable is set to -1
1061 mocchiut 1.1 //
1062 mocchiut 1.11 event->trkseqno = -1;
1063 mocchiut 1.1 //
1064 mocchiut 1.11 // Copy values in the class ca from the structure clevel2
1065 mocchiut 1.1 //
1066 mocchiut 1.11 event->FillTrkVar(ca,ntrkentry);
1067     ntrkentry++;
1068     filled = true;
1069 mocchiut 1.1 //
1070 mocchiut 1.11 } else {
1071     if ( verbose ) printf(" Selftrigger: problems with event at entry %i \n",itr);
1072 mocchiut 1.1 };
1073     };
1074     //
1075     if ( !filled ) badevent++;
1076     //
1077     // Clear structures used to communicate with fortran
1078     //
1079     event->ClearStructs();
1080     //
1081     // Fill the rootple
1082     //
1083     calo->Fill();
1084     //
1085 mocchiut 1.6 // delete ca;
1086 mocchiut 1.1 //
1087     jumpev:
1088 mocchiut 1.23 if ( !debug ) debug = false;
1089 mocchiut 1.1 //
1090     };
1091     //
1092     if ( verbose ) printf("\n SUMMARY:\n");
1093     if ( verbose ) printf(" Total number of events: %i \n",totevent);
1094     if ( verbose ) printf(" Events with at least one track: %i \n",totevent-badevent);
1095     if ( verbose ) printf(" Events without tracks: %i \n",badevent);
1096     //
1097     if ( badevent == totevent ){
1098 mocchiut 1.8 if ( verbose ) printf("\n CALORIMETER - WARNING no tracks or good events in run %u \n",idRun);
1099 mocchiut 1.1 code = 101;
1100     };
1101     //
1102 mocchiut 1.8 delete dbtime;
1103 mocchiut 1.1 //
1104     // Clear variables before processing another run (needed to have always the same result when reprocessing data with the same software).
1105     //
1106     event->RunClose();
1107     if ( l0File ) l0File->Close();
1108     //
1109     }; // process all the runs
1110     //
1111     if ( verbose ) printf("\n Finished processing data \n");
1112     //
1113     closeandexit:
1114     //
1115     if ( !reprocall && reproc && code >= 0 ){
1116     if ( totfileentries > noaftrun ){
1117     if ( verbose ) printf("\n Post-processing: copying events from the old tree after the processed run\n");
1118 mocchiut 1.8 if ( verbose ) printf(" Copying %u events in the file which are after the end of the run %u \n",(totfileentries-noaftrun),run);
1119     if ( verbose ) printf(" Start copying at event number %u end copying at event number %u \n",noaftrun,totfileentries);
1120 mocchiut 1.1 for (UInt_t j = noaftrun; j < totfileentries; j++ ){
1121     //
1122     // Get entry from old tree
1123     //
1124     caloclone->GetEntry(j);
1125     //
1126     // copy caclone to ca
1127     //
1128 mocchiut 1.13 if ( getl1 ) c1->Clear();
1129 mocchiut 1.6 ca->Clear();
1130 mocchiut 1.8 //
1131 mocchiut 1.13 if ( getl1 ) memcpy(&c1,&c1clone,sizeof(c1clone));
1132 mocchiut 1.1 memcpy(&ca,&caclone,sizeof(caclone));
1133     //
1134     // Fill entry in the new tree
1135     //
1136     calo->Fill();
1137     //
1138     };
1139     if ( verbose ) printf(" Finished successful copying!\n");
1140     };
1141     };
1142     //
1143     // Case of no errors: close files, delete old tree(s), write and close level2 file
1144     //
1145     if ( l0File ) l0File->Close();
1146     if ( tempfile ) tempfile->Close();
1147 mocchiut 1.30 if ( myfold ) gSystem->Unlink(tempname.str().c_str());
1148 mocchiut 1.1 if ( tracker ) tracker->Delete();
1149     //
1150     if ( code < 0 ) printf("\n CALORIMETER - ERROR: an error occurred, try to save anyway...\n");
1151     if ( verbose ) printf("\n Writing and closing rootple\n");
1152     if ( runinfo ) runinfo->Close();
1153     if ( calo ) calo->SetName("Calorimeter");
1154     if ( file ){
1155     file->cd();
1156     file->Write();
1157     };
1158     if ( calo ) calo->Delete();
1159     //
1160 mocchiut 1.30 if ( myfold ) gSystem->Unlink(calofolder.str().c_str());
1161 mocchiut 1.1 //
1162 mocchiut 1.7 if ( ca ) delete ca;
1163     if ( caclone ) delete caclone;
1164 mocchiut 1.13 if ( c1 ) delete c1;
1165     if ( c1clone ) delete c1clone;
1166 mocchiut 1.7 if ( trk ) delete trk;
1167     if ( q4 ) delete q4;
1168     if ( glroot ) delete glroot;
1169     if ( runinfo ) delete runinfo;
1170     //
1171 mocchiut 1.1 // the end
1172     //
1173     if ( verbose ) printf("\n Exiting...\n");
1174     if ( code < 0 ) throw code;
1175     return(code);
1176     }
1177    
1178    
1179    

  ViewVC Help
Powered by ViewVC 1.1.23