/[PAMELA software]/DarthVader/AnticounterLevel2/src/AcCore.cpp
ViewVC logotype

Annotation of /DarthVader/AnticounterLevel2/src/AcCore.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations) (download)
Fri Nov 17 10:08:07 2006 UTC (18 years ago) by mocchiut
Branch: MAIN
Changes since 1.6: +2 -0 lines
Added some checks on MySQL connection

1 mocchiut 1.1 //
2     // C/C++ headers
3     //
4     #include <fstream>
5     #include <string.h>
6     //
7     // ROOT headers
8     //
9     #include <TTree.h>
10     #include <TClassEdit.h>
11     #include <TObject.h>
12     #include <TList.h>
13 mocchiut 1.5 #include <TArrayI.h>
14 mocchiut 1.1 #include <TSystem.h>
15     #include <TSystemDirectory.h>
16     #include <TString.h>
17     #include <TFile.h>
18     #include <TClass.h>
19     #include <TCanvas.h>
20     #include <TH1.h>
21     #include <TH1F.h>
22     #include <TH2D.h>
23     #include <TLatex.h>
24     #include <TPad.h>
25     #include <TSQLServer.h>
26     #include <TSQLRow.h>
27     #include <TSQLResult.h>
28     //#include <TClonesArray.h>
29     //
30     // YODA headers
31     //
32     #include <PamelaRun.h>
33     #include <physics/trigger/TriggerEvent.h>
34     #include <physics/anticounter/AnticounterEvent.h>
35     //
36     // RunInfo header
37     //
38     #include <RunInfo.h>
39     //
40     // This program headers
41     //
42     #include <AcCore.h>
43     #include <AcLevel2.h>
44     #include <AcVerl2.h>
45     //
46     using namespace std;
47     //
48     // CORE ROUTINE
49     //
50     //
51 mocchiut 1.5 int AcCore(UInt_t run, TFile *file, TSQLServer *dbc, Int_t Acargc, char *Acargv[]){
52 mocchiut 1.1 Int_t i = 0;
53     Bool_t verbose = false;
54     Bool_t debug = false;
55     //
56     TString processFolder = "AcFolder";
57     if ( Acargc > 0 ){
58     i = 0;
59     while ( i < Acargc ){
60     if ( !strcmp(Acargv[i],"-processFolder") ) {
61     if ( Acargc < i+1 ){
62     throw -3;
63     };
64     processFolder = (TString)Acargv[i+1];
65     i++;
66     };
67     if ( !strcmp(Acargv[i],"-v") || !strcmp(Acargv[i],"--verbose") ) {
68     verbose = true;
69     };
70     if ( !strcmp(Acargv[i],"-g") || !strcmp(Acargv[i],"--debug") ) {
71     debug = true;
72     };
73     i++;
74     };
75     };
76     //
77     // Set these to true to have a very verbose output.
78     //
79     //
80     // Output directory is the working directoy.
81     //
82     const char* outdir = gSystem->DirName(gSystem->DirName(file->GetPath()));
83     //
84     // Variables for level2
85     //
86     TTree *ac = 0;
87 mocchiut 1.5 UInt_t nevents = 0;
88 mocchiut 1.1 //
89     // variables needed to reprocess data
90     //
91     TString acversion;
92     ItoRunInfo *runinfo = 0;
93 mocchiut 1.5 TArrayI *runlist = 0;
94 mocchiut 1.1 TTree *acclone = 0;
95     Bool_t reproc = false;
96     Bool_t reprocall = false;
97     UInt_t nobefrun = 0;
98     UInt_t noaftrun = 0;
99     UInt_t numbofrun = 0;
100     stringstream ftmpname;
101     TString fname;
102 mocchiut 1.5 UInt_t totfileentries = 0;
103     UInt_t idRun = 0;
104 mocchiut 1.1 //
105     // variables needed to handle error signals
106     //
107     Int_t code = 0;
108     Int_t sgnl;
109     //
110     // anticounter level2 classes
111     //
112     AcLevel2 *acl2 = new AcLevel2();
113     AcLevel2 *acl2clone = new AcLevel2();
114     // note: the string "mydect" is now "ac", "mydetector" is "anticounter" (mydectversion -> acversion, mydectclone -> acclone);
115     // the string "mydec" (without t) -> acl2 (acl2, acl2clone)
116     //
117     // define variables for opening and reading level0 file
118     //
119     TFile *l0File = 0;
120     TTree *l0tr = 0;
121     TBranch *l0head = 0;
122     TBranch *l0ac = 0;
123 mocchiut 1.5 pamela::EventHeader *eh = 0;
124     pamela::PscuHeader *ph = 0;
125 mocchiut 1.1 pamela::anticounter::AnticounterEvent *acc = 0;
126     //
127     // Define other basic variables
128     //
129     UInt_t procev = 0;
130     stringstream file2;
131     stringstream file3;
132     stringstream qy;
133     Int_t totevent = 0;
134 mocchiut 1.5 UInt_t atime = 0;
135     UInt_t re = 0;
136 mocchiut 1.1 //
137     // Working filename
138     //
139     TString outputfile;
140     stringstream name;
141     name.str("");
142     name << outdir << "/";
143     //
144     // temporary file and folder
145     //
146     TFile *tempfile = 0;
147     TTree *tempac = 0;
148     stringstream tempname;
149     stringstream acfolder;
150     tempname.str("");
151     tempname << outdir;
152     tempname << "/" << processFolder.Data();
153     acfolder.str("");
154     acfolder << tempname.str().c_str();
155     gSystem->MakeDirectory(acfolder.str().c_str());
156     tempname << "/ac2tree_run";
157     tempname << run << ".root";
158     //
159     // DB classes
160     //
161     GL_ROOT *glroot = new GL_ROOT();
162 mocchiut 1.5 GL_TIMESYNC *dbtime = 0;
163 mocchiut 1.1 //
164 mocchiut 1.4 UShort_t CRCcheck[2]= {0,0};
165     UShort_t Status[2]= {0,0};
166     UShort_t Hitmap[2]= {0,0};
167     UShort_t Hitstatus[2]= {0,0};
168     UShort_t Trigger[2] = {0,0};
169     UShort_t Trigg_old[2] = {0,0};
170     UShort_t Counter[2][16];
171     UShort_t Counter_old[2][16];
172     UShort_t Shift[2][16];
173     Int_t vec[2][16][16];
174     Int_t tmp = 0;
175     memset(vec, 0, 2*16*16*sizeof(UShort_t));
176     memset(Shift, 0, 2*16*sizeof(UShort_t));
177     memset(Counter, 0, 2*16*sizeof(UShort_t));
178     memset(Counter_old, 0, 2*16*sizeof(UShort_t));
179     //
180 mocchiut 1.1 // Let's start!
181     //
182     //
183     // As a first thing we must check what we have to do: if run = 0 we must process all events in the file has been passed
184     // if run != 0 we must process only that run but first we have to check if the tree Anticounter already exist in the file
185     // if it exists we are reprocessing data and we must delete that entries, if not we must create it.
186     //
187 mocchiut 1.5 if ( run == 0 ) reproc = true;
188 mocchiut 1.1 //
189     // Output file is "outputfile"
190     //
191     outputfile = name.str().c_str();
192     if ( verbose ) printf("\n Output filename is: \n %s \n\n",outputfile.Data());
193     //
194     //
195     if ( !file->IsOpen() ){
196     if ( verbose ) printf(" ANTICOUNTER - ERROR: cannot open file for writing\n");
197     throw -701;
198     };
199     //
200     // Retrieve GL_RUN variables from the level2 file
201     //
202     acversion = AcInfo(false); // we should decide how to handle versioning system
203     //
204     // create an interface to RunInfo called "runinfo"
205     //
206     runinfo = new ItoRunInfo(file);
207     //
208     // open "Run" tree in level2 file, if not existing return an error (sngl != 0)
209     //
210     sgnl = 0;
211     sgnl = runinfo->Update(run,"AC",acversion);
212     if ( sgnl ){
213     if ( verbose ) printf(" ANTICOUNTER - ERROR: RunInfo exited with non-zero status\n");
214     code = sgnl;
215     goto closeandexit;
216     } else {
217     sgnl = 0;
218     };
219     //
220     // number of events in the file BEFORE the first event of our run
221     //
222     nobefrun = runinfo->GetFirstEntry();
223     //
224     // total number of events in the file
225     //
226     totfileentries = runinfo->GetFileEntries();
227     //
228     // first file entry AFTER the last event of our run
229     //
230     noaftrun = runinfo->GetLastEntry() + 1;
231     //
232     // number of run to be processed
233     //
234     numbofrun = runinfo->GetNoRun();
235     //
236     // Try to access the Anticounter tree in the file, if it exists we are reprocessing data if not we are processing a new run
237     //
238     acclone = (TTree*)file->Get("Anticounter");
239     //
240     if ( !acclone ){
241     //
242     // tree does not exist, we are not reprocessing
243     //
244     reproc = false;
245 mocchiut 1.5 if ( run == 0 && verbose ) printf(" ANTICOUNTER - WARNING: you are reprocessing data but AC tree does not exist!\n");
246     if ( verbose && runinfo->IsReprocessing() && run != 0 ) printf(" ANTICOUNTER - WARNING: it seems you are not reprocessing data but Anticounter\n versioning information already exists in RunInfo.\n");
247 mocchiut 1.1
248     } else {
249     //
250     // tree exists, we are reprocessing data. Are we reprocessing a single run or all the file?
251     //
252     reproc = true;
253     //
254     //
255     if ( verbose ) printf("\n Preparing the pre-processing...\n");
256     //
257 mocchiut 1.5 if ( run == 0 ){
258 mocchiut 1.1 //
259     // we are reprocessing all the file
260     // if we are reprocessing everything we don't need to copy any old event and we can just work with the new tree and delete the old one immediately
261     //
262     reprocall = true;
263     //
264     if ( verbose ) printf("\n ANTICOUNTER - WARNING: Reprocessing all runs\n");
265     //
266     } else {
267     //
268     // we are reprocessing a single run, we must copy to the new tree the events in the file which preceed the first event of the run
269     //
270     reprocall = false;
271     //
272 mocchiut 1.5 if ( verbose ) printf("\n ANTICOUNTER - WARNING: Reprocessing run number %u \n",run);
273 mocchiut 1.1 //
274     // copying old tree to a new file
275     //
276     tempfile = new TFile(tempname.str().c_str(),"RECREATE");
277     tempac = acclone->CloneTree(-1,"fast");
278     tempac->SetName("Anticounter-old");
279     tempfile->Write();
280     tempfile->Close();
281     }
282     //
283     // Delete the old tree from old file and memory
284     //
285     acclone->Delete("all");
286     //
287     if ( verbose ) printf(" ...done!\n");
288     //
289     };
290     //
291     // create anticounter tree ac
292     //
293     file->cd();
294     ac = new TTree("Anticounter-new","PAMELA Level2 Anticounter data");
295     ac->Branch("AcLevel2","AcLevel2",&acl2);
296     //
297     if ( reproc && !reprocall ){
298     //
299     // open new file and retrieve alo tree informations
300     //
301     tempfile = new TFile(tempname.str().c_str(),"READ");
302     acclone = (TTree*)tempfile->Get("Anticounter-old");
303     acclone->SetBranchAddress("AcLevel2",&acl2clone);
304     //
305     if ( nobefrun > 0 ){
306     if ( verbose ) {
307     printf("\n Pre-processing: copying events from the old tree before the processed run\n");
308 mocchiut 1.5 printf(" Copying %u events in the file which are before the beginning of the run %u \n",nobefrun,run);
309 mocchiut 1.1 printf(" Start copying at event number 0, end copying at event number %u \n",nobefrun);
310     };
311     for (UInt_t j = 0; j < nobefrun; j++){
312     //
313     acclone->GetEntry(j);
314     //
315     // copy acl2clone to acl2
316     //
317 mocchiut 1.3 acl2->Clear();
318 mocchiut 1.5 //
319 mocchiut 1.1 memcpy(&acl2,&acl2clone,sizeof(acl2clone));
320     //
321     // Fill entry in the new tree
322     //
323     ac->Fill();
324     //
325     };
326     if ( verbose ) printf(" Finished successful copying!\n");
327     };
328     };
329     //
330     // Get the list of run to be processed, if only one run has to be processed the list will contain one entry only.
331     //
332     runlist = runinfo->GetRunList();
333     //
334     // Loop over the run to be processed
335     //
336     for (UInt_t irun=0; irun < numbofrun; irun++){
337     //
338     // retrieve the first run ID to be processed using the RunInfo list
339     //
340     idRun = runlist->At(irun);
341     if ( verbose ){
342     printf("\n\n\n ####################################################################### \n");
343 mocchiut 1.5 printf(" PROCESSING RUN NUMBER %u \n",idRun);
344 mocchiut 1.1 printf(" ####################################################################### \n\n\n");
345     };
346     //
347 mocchiut 1.5 runinfo->ID_ROOT_L0 = 0;
348 mocchiut 1.1 //
349     // store in the runinfo class the GL_RUN variables for our run
350     //
351     sgnl = 0;
352     sgnl = runinfo->GetRunInfo(idRun);
353     if ( sgnl ){
354     if ( verbose ) printf(" ANTICOUNTER - ERROR: RunInfo exited with non-zero status\n");
355     code = sgnl;
356     goto closeandexit;
357     } else {
358     sgnl = 0;
359     };
360     //
361 mocchiut 1.5 // now you can access that variables using the RunInfo class this way runinfo->ID_ROOT_L0
362 mocchiut 1.1 //
363 mocchiut 1.5 if ( runinfo->ID_ROOT_L0 == 0 ){
364     if ( verbose ) printf("\n ANTICOUNTER - ERROR: no run with ID_RUN = %u \n\n Exiting... \n\n",idRun);
365 mocchiut 1.1 code = -5;
366     goto closeandexit;
367     };
368     //
369 mocchiut 1.5 // prepare the timesync for the db
370     //
371 mocchiut 1.7 if ( !dbc->IsConnected() ) throw -705;
372 mocchiut 1.5 dbtime = new GL_TIMESYNC(runinfo->ID_ROOT_L0,"ID",dbc);
373     //
374 mocchiut 1.1 // Search in the DB the path and name of the LEVEL0 file to be processed.
375     //
376 mocchiut 1.7 if ( !dbc->IsConnected() ) throw -705;
377 mocchiut 1.5 glroot->Query_GL_ROOT(runinfo->ID_ROOT_L0,dbc);
378 mocchiut 1.1 //
379     ftmpname.str("");
380     ftmpname << glroot->PATH.Data() << "/";
381     ftmpname << glroot->NAME.Data();
382     fname = ftmpname.str().c_str();
383     //
384     // print out informations
385     //
386 mocchiut 1.5 totevent = runinfo->NEVENTS;
387 mocchiut 1.1 if ( verbose ) {
388     printf("\n LEVEL0 data file: %s \n",fname.Data());
389 mocchiut 1.5 printf(" RUN HEADER absolute time is: %u \n",runinfo->RUNHEADER_TIME);
390     printf(" RUN TRAILER absolute time is: %u \n",runinfo->RUNTRAILER_TIME);
391     printf(" %i events to be processed for run %u: from %i to %i \n\n",totevent,idRun,runinfo->EV_FROM,runinfo->EV_FROM+totevent);
392 mocchiut 1.1 };
393     //
394     // Open Level0 file
395     //
396     l0File = new TFile(fname.Data());
397     if ( !l0File ) {
398     if ( verbose ) printf(" ANTICOUNTER - ERROR: problems opening Level0 file\n");
399     code = -6;
400     goto closeandexit;
401     };
402     l0tr = (TTree*)l0File->Get("Physics");
403     if ( !l0tr ) {
404     if ( verbose ) printf(" ANTICOUNTER - ERROR: no Physics tree in Level0 file\n");
405     l0File->Close();
406     code = -7;
407     goto closeandexit;
408     };
409     l0head = l0tr->GetBranch("Header");
410     if ( !l0head ) {
411     if ( verbose ) printf(" ANTICOUNTER - ERROR: no Header branch in Level0 tree\n");
412     l0File->Close();
413     code = -8;
414     goto closeandexit;
415     };
416     l0ac = l0tr->GetBranch("Anticounter");
417     if ( !l0ac ) {
418     if ( verbose ) printf(" ANTICOUNTER - ERROR: no Anticounter branch in Level0 tree\n");
419     l0File->Close();
420     code = -704;
421     goto closeandexit;
422     };
423     //
424     l0tr->SetBranchAddress("Anticounter", &acc);
425 mocchiut 1.5 l0tr->SetBranchAddress("Header", &eh);
426 mocchiut 1.1 //
427 mocchiut 1.5 nevents = l0ac->GetEntries();
428 mocchiut 1.1 //
429     if ( nevents < 1 ) {
430     if ( verbose ) printf(" ANTICOUNTER - ERROR: Level0 file is empty\n\n");
431     l0File->Close();
432     code = -11;
433     goto closeandexit;
434     };
435     //
436 mocchiut 1.5 if ( runinfo->EV_TO > nevents-1 ) {
437     if ( verbose ) printf(" ANTICOUNTER - ERROR: too few entries in the tree\n");
438 mocchiut 1.1 l0File->Close();
439     code = -12;
440     goto closeandexit;
441     };
442     //
443     // run over all the events of the run
444     //
445     if ( verbose ) printf("\n Ready to start! \n\n Processed events: \n\n");
446     //
447 mocchiut 1.5 for ( re = runinfo->EV_FROM; re < (runinfo->EV_FROM+runinfo->NEVENTS); re++){
448 mocchiut 1.1 //
449     if ( procev%1000 == 0 && procev > 0 && verbose ) printf(" %iK \n",procev/1000);
450     //
451 mocchiut 1.5 l0head->GetEntry(re);
452 mocchiut 1.1 //
453     // absolute time of this event
454     //
455 mocchiut 1.5 ph = eh->GetPscuHeader();
456     atime = dbtime->DBabsTime(ph->GetOrbitalTime());
457 mocchiut 1.1 //
458     // paranoid check
459     //
460     if ( atime > runinfo->RUNTRAILER_TIME || atime < runinfo->RUNHEADER_TIME ) {
461     if ( verbose ) printf(" ANTICOUNTER - WARNING: event at time outside the run time window, skipping it\n");
462     goto jumpev;
463     };
464     //
465     procev++;
466     //
467     // start processing
468     //
469 mocchiut 1.3 acl2->Clear();
470 mocchiut 1.1 //
471 mocchiut 1.5 l0ac->GetEntry(re);
472 pam-se 1.2 //
473 mocchiut 1.1 /***********************************************/
474     // Here starts Anticounter specific code (Silvio)
475     //
476 mocchiut 1.4 memset(vec, 0, 2*16*16*sizeof(UShort_t));
477     memset(Shift, 0, 2*16*sizeof(UShort_t));
478     memset(Counter, 0, 2*16*sizeof(UShort_t));
479     memset(Counter_old, 0, 2*16*sizeof(UShort_t));
480     memset(CRCcheck, 0, 2*sizeof(UShort_t));
481     memset(Status, 0, 2*sizeof(UShort_t));
482     memset(Hitmap, 0, 2*sizeof(UShort_t));
483     memset(Hitstatus, 0, 2*sizeof(UShort_t));
484     memset(Trigger, 0, 2*sizeof(UShort_t));
485     memset(Trigg_old, 0, 2*sizeof(UShort_t));
486     tmp = 0;
487 mocchiut 1.1 //
488     for(Int_t gg = 0; gg < 2; gg++)
489     {
490     Hitstatus[gg] = 0;
491     }
492     //
493     //fetch data
494     //
495     for(Int_t kk = 0; kk < 2; kk++)
496     {
497     if(re>0)
498     {
499     Trigg_old[kk] = Trigger[kk];
500     for(Int_t jj = 0; jj < 16; jj++)
501     Counter_old[kk][jj] = Counter[kk][jj];
502     }
503    
504     for(Int_t jj = 0; jj < 16; jj++)
505     {
506     Counter[kk][jj] = acc->counters[kk][jj];
507     Shift[kk][jj] = acc->shift[kk][jj];
508     }
509     Status[kk] = acc->status[kk];
510     Hitmap[kk] = acc->hitmap[kk];
511     Trigger[kk] = acc->trigg[kk];
512     CRCcheck[kk] = acc->CRCcheck[kk];
513     }
514    
515     /***********************************************/
516     //process data
517     /***********************************************/
518     //shiftregisters
519     for(Int_t b = 0; b < 2; b++){ //card
520     for(Int_t k = 0; k < 16; k++){ //shift register
521     Int_t cnt=1;
522     for(Int_t l = 0; l < 16; l++){ //bin
523     tmp = ((Shift[b][k] & cnt) > 0 ? 1 : 0);
524     vec[b][k][l]=tmp;
525     cnt=cnt<<1;
526     }
527     //cnt=1;
528     }
529     }
530 mocchiut 1.5 //
531 mocchiut 1.1 //fill Level1 file
532     /************************************************/
533     for(Int_t s = 0; s < 2; s++) {
534     acl2->hitmap[s] = Hitmap[s];
535     acl2->trigger[s] = Trigger[s];
536     Int_t cnt=1;
537     for(Int_t k = 0; k < 16; k++) {
538     for(Int_t bin = 5; bin < 9; bin++) { //acceptance window
539     if(vec[s][bin][k]==1)
540     Hitstatus[s] = Hitstatus[s] | cnt;
541     }
542     cnt=cnt<<1;
543     }
544     acl2->hitstatus[s] = Hitstatus[s];
545 mocchiut 1.5 //
546 mocchiut 1.1 //Status
547     /****************************************/
548     if(s==0){
549     if(Trigger[0] != (Trigg_old[0]+1))
550     acl2->status[0] = acl2->status[0] | 0x1;
551     if(Status[0] & 0x001F < 0x001F)
552     acl2->status[0] = acl2->status[0] | 0x2;
553     if(CRCcheck[0] == 0)
554     acl2->status[0] = acl2->status[0] | 0x4;
555     for(Int_t gg = 0; gg < 16; gg++){
556 mocchiut 1.5 if((Counter[0][gg] == Counter_old[0][gg]) && re>0){
557 mocchiut 1.1 acl2->status[0] = acl2->status[0] | 0x8;
558     }
559     }
560     }
561     else {
562     if(Trigger[1] != (Trigg_old[1]+2))
563     acl2->status[1] = acl2->status[1] | 0x1;
564     if(Status[1] & 0x001F < 0x001F)
565     acl2->status[1] = acl2->status[1] | 0x2;
566     if(CRCcheck[1] == 0)
567     acl2->status[1] = acl2->status[1] | 0x4;
568     for(Int_t gg = 0; gg < 16; gg++){
569 mocchiut 1.5 if((Counter[1][gg] == Counter_old[1][gg]) && re>0)
570 mocchiut 1.1 acl2->status[1] = acl2->status[1] | 0x8;
571     }
572     }
573     }
574     //
575     // End Anticounter specific code
576     //
577 mocchiut 1.5 /************************************************/
578 mocchiut 1.6 acl2->unpackError = acc->unpackError;
579 mocchiut 1.1 //
580     // Fill the rootple
581     //
582     ac->Fill();
583     //
584     //
585     jumpev:
586     debug = false;
587     //
588     };
589     //
590     // Here you may want to clear some variables before processing another run
591     //
592 mocchiut 1.5 delete dbtime;
593 mocchiut 1.1 }; // process all the runs
594     //
595     if ( verbose ) printf("\n Finished processing data \n");
596     //
597     closeandexit:
598     //
599     // we have finished processing the run(s). If we processed a single run now we must copy all the events after our run from the old tree to the new one and delete the old tree.
600     //
601     if ( !reprocall && reproc && code >= 0 ){
602     if ( totfileentries > noaftrun ){
603     if ( verbose ){
604     printf("\n Post-processing: copying events from the old tree after the processed run\n");
605     printf(" Copying %i events in the file which are after the end of the run %i \n",(int)(totfileentries-noaftrun),(int)run);
606     printf(" Start copying at event number %i end copying at event number %i \n",(int)noaftrun,(int)totfileentries);
607     };
608     for (UInt_t j = noaftrun; j < totfileentries; j++ ){
609     //
610     // Get entry from old tree
611     //
612     acclone->GetEntry(j);
613     //
614     // copy acl2clone to acl2
615     //
616 mocchiut 1.3 acl2->Clear();
617 mocchiut 1.1 memcpy(&acl2,&acl2clone,sizeof(acl2clone));
618     //
619     // Fill entry in the new tree
620     //
621     ac->Fill();
622     };
623     if ( verbose ) printf(" Finished successful copying!\n");
624     };
625     };
626     //
627     // Close files, delete old tree(s), write and close level2 file
628     //
629     if ( l0File ) l0File->Close();
630     if ( tempfile ) tempfile->Close();
631     gSystem->Unlink(tempname.str().c_str());
632     //
633     if ( code < 0 && verbose ) printf("\n ANTICOUNTER - ERROR: an error occurred, try to save anyway...\n");
634     if ( verbose ) printf("\n Writing and closing rootple\n");
635     if ( runinfo ) runinfo->Close();
636     if ( ac ) ac->SetName("Anticounter");
637     if ( file ){
638     file->cd();
639     file->Write();
640     };
641     //
642     gSystem->Unlink(acfolder.str().c_str());
643     //
644     // the end
645     //
646     if ( verbose ) printf("\n Exiting...\n");
647     if( ac ) ac->Delete();
648 mocchiut 1.4 //
649     if ( acl2 ) delete acl2;
650     if ( acclone ) delete acclone;
651     if ( glroot ) delete glroot;
652     if ( runinfo ) delete runinfo;
653     //
654 mocchiut 1.1 if(code < 0) throw code;
655     return(code);
656     }
657    
658    
659    

  ViewVC Help
Powered by ViewVC 1.1.23