15 |
// |
// |
16 |
#include <GLTables.h> |
#include <GLTables.h> |
17 |
#include <RunInfo.h> |
#include <RunInfo.h> |
18 |
|
ClassImp(ProcInfo); |
19 |
ClassImp(SoftInfo); |
ClassImp(SoftInfo); |
20 |
ClassImp(ItoRunInfo); |
ClassImp(ItoRunInfo); |
21 |
// |
// |
22 |
using namespace std; |
using namespace std; |
23 |
// |
// |
24 |
|
|
25 |
|
ProcInfo::ProcInfo() { |
26 |
|
Clear(); |
27 |
|
} |
28 |
|
|
29 |
|
void ProcInfo::Clear(Option_t *t){ |
30 |
|
runID = 0; |
31 |
|
date = ""; |
32 |
|
commandLine = ""; |
33 |
|
outputFilename = ""; |
34 |
|
localDir = ""; |
35 |
|
uname = ""; |
36 |
|
DB = ""; |
37 |
|
} |
38 |
|
|
39 |
SoftInfo::SoftInfo() { |
SoftInfo::SoftInfo() { |
40 |
TRIG_ver = ""; |
Clear(); |
|
TOF_ver = ""; |
|
|
AC_ver = ""; |
|
|
TRK_ver = ""; |
|
|
ORB_ver = ""; |
|
|
CAL_ver = ""; |
|
|
ND_ver = ""; |
|
|
S4_ver = ""; |
|
41 |
} |
} |
42 |
|
|
43 |
void SoftInfo::Clear(){ |
void SoftInfo::Clear(Option_t *t){ |
44 |
TRIG_ver = ""; |
TRIG_ver = ""; |
45 |
TOF_ver = ""; |
TOF_ver = ""; |
46 |
AC_ver = ""; |
AC_ver = ""; |
49 |
CAL_ver = ""; |
CAL_ver = ""; |
50 |
ND_ver = ""; |
ND_ver = ""; |
51 |
S4_ver = ""; |
S4_ver = ""; |
52 |
|
DV_ver = ""; |
53 |
} |
} |
54 |
|
|
55 |
|
UInt_t SoftInfo::GetSWinfo(TString Detector){ |
56 |
|
TString sver; |
57 |
|
UInt_t version = 0; |
58 |
|
if ( !strcmp(Detector.Data(),"TRIG") ){ |
59 |
|
sver = TRIG_ver; |
60 |
|
}; |
61 |
|
if ( !strcmp(Detector.Data(),"TOF") ){ |
62 |
|
sver = TOF_ver; |
63 |
|
}; |
64 |
|
if ( !strcmp(Detector.Data(),"AC") ){ |
65 |
|
sver = AC_ver; |
66 |
|
}; |
67 |
|
if ( !strcmp(Detector.Data(),"TRK") ){ |
68 |
|
sver = TRK_ver; |
69 |
|
}; |
70 |
|
if ( !strcmp(Detector.Data(),"CALO") ){ |
71 |
|
sver = CAL_ver; |
72 |
|
}; |
73 |
|
if ( !strcmp(Detector.Data(),"S4") ){ |
74 |
|
sver = S4_ver; |
75 |
|
}; |
76 |
|
if ( !strcmp(Detector.Data(),"DV") ){ |
77 |
|
sver = DV_ver; |
78 |
|
}; |
79 |
|
if ( !strcmp(Detector.Data(),"ND") ){ |
80 |
|
sver = ND_ver; |
81 |
|
}; |
82 |
|
if ( !strcmp(Detector.Data(),"ORB") ){ |
83 |
|
sver = ORB_ver; |
84 |
|
}; |
85 |
|
sver.ReplaceAll("v",1," ",1); |
86 |
|
sver.ReplaceAll("r",1," ",1); |
87 |
|
version = (UInt_t)sver.Atoi(); |
88 |
|
return(version); |
89 |
|
}; |
90 |
|
|
91 |
/** |
/** |
92 |
* Fills a struct cSoftInfo with values from a SoftInfo object (to put data into a F77 common). |
* Fills a struct cSoftInfo with values from a SoftInfo object (to put data into a F77 common). |
103 |
} |
} |
104 |
/***********************/ |
/***********************/ |
105 |
|
|
106 |
|
ItoRunInfo::~ItoRunInfo() { |
107 |
|
this->GL_RUN::Clear(); |
108 |
|
} |
109 |
|
|
110 |
ItoRunInfo::ItoRunInfo() { |
ItoRunInfo::ItoRunInfo() { |
111 |
reprocessing = false; |
reprocessing = false; |
112 |
updating = false; |
updating = false; |
120 |
norun = 0; |
norun = 0; |
121 |
runlist = new TArrayI(500); |
runlist = new TArrayI(500); |
122 |
file = NULL; |
file = NULL; |
123 |
newtree = new TTree(); |
newtree = NULL;//new TTree(); |
124 |
} |
} |
125 |
|
|
126 |
ItoRunInfo::ItoRunInfo(TFile *processFl){ |
ItoRunInfo::ItoRunInfo(TFile *processFl){ |
141 |
norun = 0; |
norun = 0; |
142 |
totnorun = 0; |
totnorun = 0; |
143 |
runlist = new TArrayI(500); |
runlist = new TArrayI(500); |
144 |
|
newtree = NULL; |
145 |
// |
// |
146 |
} |
} |
147 |
|
|
148 |
|
|
149 |
|
|
150 |
TChain *ItoRunInfo::LoadRunInfoTree(TList *fl){ |
TChain *ItoRunInfo::GetRunTree(TList *fl){ |
151 |
// |
// |
152 |
TChain *Tout = new TChain("Run"); |
TChain *Tout = new TChain("Run"); |
153 |
// loop over files and create chains |
// loop over files and create chains |
189 |
// |
// |
190 |
if ( glrun && newrun ){ |
if ( glrun && newrun ){ |
191 |
// |
// |
192 |
// printf("copy \n"); |
// printf("copy \n"); |
193 |
// |
// |
194 |
newrun->ID = glrun->ID ; |
newrun->ID = glrun->ID ; |
195 |
newrun->ID_RUN_FRAG = glrun-> ID_RUN_FRAG ; |
newrun->ID_RUN_FRAG = glrun-> ID_RUN_FRAG ; |
221 |
newrun->TRK_CALIB_USED = glrun->TRK_CALIB_USED ; |
newrun->TRK_CALIB_USED = glrun->TRK_CALIB_USED ; |
222 |
newrun->CAL_DSP_MASK = glrun->CAL_DSP_MASK ; |
newrun->CAL_DSP_MASK = glrun->CAL_DSP_MASK ; |
223 |
newrun->BOOT_NUMBER = glrun->BOOT_NUMBER ; |
newrun->BOOT_NUMBER = glrun->BOOT_NUMBER ; |
224 |
|
newrun->PHYSENDRUN_MASK_S3S2S12 = glrun->PHYSENDRUN_MASK_S3S2S12 ; |
225 |
|
newrun->PHYSENDRUN_MASK_S11CRC = glrun->PHYSENDRUN_MASK_S11CRC ; |
226 |
newrun->VALIDATION = glrun->VALIDATION ; |
newrun->VALIDATION = glrun->VALIDATION ; |
227 |
// |
// |
228 |
}; |
}; |
236 |
newver->ORB_ver = sinfo->ORB_ver; |
newver->ORB_ver = sinfo->ORB_ver; |
237 |
newver->CAL_ver = sinfo->CAL_ver; |
newver->CAL_ver = sinfo->CAL_ver; |
238 |
newver->S4_ver = sinfo->S4_ver; |
newver->S4_ver = sinfo->S4_ver; |
239 |
|
newver->DV_ver = sinfo->DV_ver; |
240 |
newver->ND_ver = sinfo->ND_ver; |
newver->ND_ver = sinfo->ND_ver; |
241 |
// |
// |
242 |
}; |
}; |
249 |
// |
// |
250 |
Bool_t debug = false; |
Bool_t debug = false; |
251 |
// |
// |
252 |
Bool_t ismydir = false; |
// Bool_t ismydir = false; |
253 |
// |
// |
254 |
if ( !strcmp(processFolder.Data(),"") ){ |
if ( !strcmp(processFolder.Data(),"") ){ |
255 |
processFolder = "runinfoFolder"; |
processFolder = "runinfoFolder"; |
256 |
ismydir = true; |
// ismydir = true; |
257 |
}; |
}; |
258 |
// |
// |
259 |
GL_RUN *oldrun = new GL_RUN(); |
GL_RUN *oldrun = new GL_RUN(); |
286 |
version->ORB_ver = Version; |
version->ORB_ver = Version; |
287 |
version->CAL_ver = Version; |
version->CAL_ver = Version; |
288 |
version->S4_ver = Version; |
version->S4_ver = Version; |
289 |
|
version->DV_ver = Version; |
290 |
version->ND_ver = Version; |
version->ND_ver = Version; |
291 |
} else { |
} else { |
292 |
if ( !strcmp(Detector.Data(),"TRIG") ) version->TRIG_ver = Version; |
if ( !strcmp(Detector.Data(),"TRIG") ) version->TRIG_ver = Version; |
295 |
if ( !strcmp(Detector.Data(),"TRK") ) version->TRK_ver = Version; |
if ( !strcmp(Detector.Data(),"TRK") ) version->TRK_ver = Version; |
296 |
if ( !strcmp(Detector.Data(),"CALO") ) version->CAL_ver = Version; |
if ( !strcmp(Detector.Data(),"CALO") ) version->CAL_ver = Version; |
297 |
if ( !strcmp(Detector.Data(),"S4") ) version->S4_ver = Version; |
if ( !strcmp(Detector.Data(),"S4") ) version->S4_ver = Version; |
298 |
|
if ( !strcmp(Detector.Data(),"DV") ) version->DV_ver = Version; |
299 |
if ( !strcmp(Detector.Data(),"ND") ) version->ND_ver = Version; |
if ( !strcmp(Detector.Data(),"ND") ) version->ND_ver = Version; |
300 |
if ( !strcmp(Detector.Data(),"ORB") ) version->ORB_ver = Version; |
if ( !strcmp(Detector.Data(),"ORB") ) version->ORB_ver = Version; |
301 |
if ( strcmp(Detector.Data(),"TRIG") && strcmp(Detector.Data(),"TOF") && strcmp(Detector.Data(),"AC") && strcmp(Detector.Data(),"TRK") && strcmp(Detector.Data(),"CALO") && strcmp(Detector.Data(),"S4") && strcmp(Detector.Data(),"ND") && strcmp(Detector.Data(),"ORB") ) return(-804); |
if ( strcmp(Detector.Data(),"TRIG") && strcmp(Detector.Data(),"TOF") && strcmp(Detector.Data(),"AC") && strcmp(Detector.Data(),"TRK") && strcmp(Detector.Data(),"CALO") && strcmp(Detector.Data(),"S4") && strcmp(Detector.Data(),"ND") && strcmp(Detector.Data(),"ORB") && strcmp(Detector.Data(),"DV") ) return(-804); |
302 |
}; |
}; |
303 |
// |
// |
304 |
if ( !oldtree ) { |
if ( !oldtree ) { |
350 |
totnorun = 1; |
totnorun = 1; |
351 |
reprocessing = false; |
reprocessing = false; |
352 |
first_file_entry = 0; |
first_file_entry = 0; |
353 |
last_file_entry = (UInt_t)(EV_TO - EV_FROM); |
if ( EV_TO >= EV_FROM ) last_file_entry = (UInt_t)(EV_TO - EV_FROM); |
354 |
norun = 1; |
norun = 1; |
355 |
runlist->AddAt((Int_t)ID,0); |
runlist->AddAt((Int_t)ID,0); |
356 |
// |
// |
382 |
// |
// |
383 |
for ( UInt_t run = 0; run < totnorun; run++){ |
for ( UInt_t run = 0; run < totnorun; run++){ |
384 |
// |
// |
385 |
oldtree->GetEntry(run); |
if ( oldtree->GetEntry(run) <= 0 ) throw -36; |
386 |
// |
// |
387 |
CopyFromTo(oldrun,newrun,oldver,newver); |
CopyFromTo(oldrun,newrun,oldver,newver); |
388 |
// |
// |
392 |
// |
// |
393 |
if ( idRun == 0 || idRun == newrun->ID ) { |
if ( idRun == 0 || idRun == newrun->ID ) { |
394 |
// |
// |
395 |
if ( debug ) printf(" Updating run number %u \n",idRun); |
if ( debug ) printf(" Updating run number %u newrun->ID %i \n",idRun,(int)newrun->ID); |
396 |
// |
// |
397 |
found = true; |
found = true; |
398 |
// |
// |
422 |
newver->ORB_ver = oldver->ORB_ver; |
newver->ORB_ver = oldver->ORB_ver; |
423 |
newver->CAL_ver = oldver->CAL_ver; |
newver->CAL_ver = oldver->CAL_ver; |
424 |
newver->S4_ver = oldver->S4_ver; |
newver->S4_ver = oldver->S4_ver; |
425 |
|
newver->DV_ver = oldver->DV_ver; |
426 |
newver->ND_ver = oldver->ND_ver; |
newver->ND_ver = oldver->ND_ver; |
427 |
if ( strcmp(oldver->TRIG_ver.Data(),"") ) reprocessing = true; |
if ( strcmp(oldver->TRIG_ver.Data(),"") ) reprocessing = true; |
428 |
}; |
}; |
433 |
newver->TRK_ver = oldver->TRK_ver; |
newver->TRK_ver = oldver->TRK_ver; |
434 |
newver->ORB_ver = oldver->ORB_ver; |
newver->ORB_ver = oldver->ORB_ver; |
435 |
newver->CAL_ver = oldver->CAL_ver; |
newver->CAL_ver = oldver->CAL_ver; |
436 |
|
newver->DV_ver = oldver->DV_ver; |
437 |
newver->S4_ver = oldver->S4_ver; |
newver->S4_ver = oldver->S4_ver; |
438 |
newver->ND_ver = oldver->ND_ver; |
newver->ND_ver = oldver->ND_ver; |
439 |
if ( strcmp(oldver->TOF_ver.Data(),"") ) reprocessing = true; |
if ( strcmp(oldver->TOF_ver.Data(),"") ) reprocessing = true; |
444 |
newver->TRK_ver = oldver->TRK_ver; |
newver->TRK_ver = oldver->TRK_ver; |
445 |
newver->ORB_ver = oldver->ORB_ver; |
newver->ORB_ver = oldver->ORB_ver; |
446 |
newver->CAL_ver = oldver->CAL_ver; |
newver->CAL_ver = oldver->CAL_ver; |
447 |
|
newver->DV_ver = oldver->DV_ver; |
448 |
newver->S4_ver = oldver->S4_ver; |
newver->S4_ver = oldver->S4_ver; |
449 |
newver->ND_ver = oldver->ND_ver; |
newver->ND_ver = oldver->ND_ver; |
450 |
newver->AC_ver = version->AC_ver; |
newver->AC_ver = version->AC_ver; |
455 |
newver->TOF_ver = oldver->TOF_ver; |
newver->TOF_ver = oldver->TOF_ver; |
456 |
newver->CAL_ver = oldver->CAL_ver; |
newver->CAL_ver = oldver->CAL_ver; |
457 |
newver->ORB_ver = oldver->ORB_ver; |
newver->ORB_ver = oldver->ORB_ver; |
458 |
|
newver->DV_ver = oldver->DV_ver; |
459 |
newver->S4_ver = oldver->S4_ver; |
newver->S4_ver = oldver->S4_ver; |
460 |
newver->ND_ver = oldver->ND_ver; |
newver->ND_ver = oldver->ND_ver; |
461 |
newver->AC_ver = oldver->AC_ver; |
newver->AC_ver = oldver->AC_ver; |
467 |
newver->TOF_ver = oldver->TOF_ver; |
newver->TOF_ver = oldver->TOF_ver; |
468 |
newver->CAL_ver = oldver->CAL_ver; |
newver->CAL_ver = oldver->CAL_ver; |
469 |
newver->TRK_ver = oldver->TRK_ver; |
newver->TRK_ver = oldver->TRK_ver; |
470 |
|
newver->DV_ver = oldver->DV_ver; |
471 |
newver->S4_ver = oldver->S4_ver; |
newver->S4_ver = oldver->S4_ver; |
472 |
newver->ND_ver = oldver->ND_ver; |
newver->ND_ver = oldver->ND_ver; |
473 |
newver->AC_ver = oldver->AC_ver; |
newver->AC_ver = oldver->AC_ver; |
477 |
if ( !strcmp(Detector.Data(),"CALO") ){ |
if ( !strcmp(Detector.Data(),"CALO") ){ |
478 |
newver->TRIG_ver = oldver->TRIG_ver; |
newver->TRIG_ver = oldver->TRIG_ver; |
479 |
newver->TOF_ver = oldver->TOF_ver; |
newver->TOF_ver = oldver->TOF_ver; |
480 |
|
newver->DV_ver = oldver->DV_ver; |
481 |
newver->S4_ver = oldver->S4_ver; |
newver->S4_ver = oldver->S4_ver; |
482 |
newver->ORB_ver = oldver->ORB_ver; |
newver->ORB_ver = oldver->ORB_ver; |
483 |
newver->ND_ver = oldver->ND_ver; |
newver->ND_ver = oldver->ND_ver; |
494 |
newver->TRK_ver = oldver->TRK_ver; |
newver->TRK_ver = oldver->TRK_ver; |
495 |
newver->ORB_ver = oldver->ORB_ver; |
newver->ORB_ver = oldver->ORB_ver; |
496 |
newver->CAL_ver = oldver->CAL_ver; |
newver->CAL_ver = oldver->CAL_ver; |
497 |
|
newver->DV_ver = oldver->DV_ver; |
498 |
newver->S4_ver = version->S4_ver; |
newver->S4_ver = version->S4_ver; |
499 |
if ( strcmp(oldver->S4_ver.Data(),"") ) reprocessing = true; |
if ( strcmp(oldver->S4_ver.Data(),"") ) reprocessing = true; |
500 |
}; |
}; |
501 |
|
if ( !strcmp(Detector.Data(),"DV") ){ |
502 |
|
newver->TRIG_ver = oldver->TRIG_ver; |
503 |
|
newver->TOF_ver = oldver->TOF_ver; |
504 |
|
newver->ND_ver = oldver->ND_ver; |
505 |
|
newver->AC_ver = oldver->AC_ver; |
506 |
|
newver->TRK_ver = oldver->TRK_ver; |
507 |
|
newver->ORB_ver = oldver->ORB_ver; |
508 |
|
newver->CAL_ver = oldver->CAL_ver; |
509 |
|
newver->S4_ver = oldver->S4_ver; |
510 |
|
newver->DV_ver = version->DV_ver; |
511 |
|
if ( strcmp(oldver->DV_ver.Data(),"") ) reprocessing = true; |
512 |
|
}; |
513 |
if ( !strcmp(Detector.Data(),"ND") ){ |
if ( !strcmp(Detector.Data(),"ND") ){ |
514 |
newver->TRIG_ver = oldver->TRIG_ver; |
newver->TRIG_ver = oldver->TRIG_ver; |
515 |
newver->TOF_ver = oldver->TOF_ver; |
newver->TOF_ver = oldver->TOF_ver; |
516 |
|
newver->DV_ver = oldver->DV_ver; |
517 |
newver->S4_ver = oldver->S4_ver; |
newver->S4_ver = oldver->S4_ver; |
518 |
newver->AC_ver = oldver->AC_ver; |
newver->AC_ver = oldver->AC_ver; |
519 |
newver->ORB_ver = oldver->ORB_ver; |
newver->ORB_ver = oldver->ORB_ver; |
524 |
}; |
}; |
525 |
}; |
}; |
526 |
// |
// |
527 |
last_file_entry = first_file_entry + (oldrun->EV_TO - oldrun->EV_FROM + 1); |
if ( oldrun->EV_TO >= oldrun->EV_FROM ) last_file_entry = first_file_entry + (oldrun->EV_TO - oldrun->EV_FROM + 1); |
528 |
// |
// |
529 |
} else { |
} else { |
530 |
if ( !found ) first_file_entry += (oldrun->EV_TO - oldrun->EV_FROM + 1); |
if ( !found ) first_file_entry += (oldrun->EV_TO - oldrun->EV_FROM + 1); |
531 |
}; |
}; |
532 |
// |
// |
533 |
file->cd(); |
file->cd(); |
534 |
|
if ( debug ) printf("filling: totnorun %i idRun %i newrun->ID %i \n",(int)totnorun,(int)idRun,(int)newrun->ID); |
535 |
newtree->Fill(); |
newtree->Fill(); |
536 |
// |
// |
537 |
}; |
}; |
550 |
return(-5); |
return(-5); |
551 |
}; |
}; |
552 |
// |
// |
553 |
|
this->Write(); |
554 |
// newtree->Write(); |
// newtree->Write(); |
555 |
}; |
}; |
556 |
|
// if ( oldtree ) oldtree->Delete(); // crasha qua in queste righe e se non le metti... |
557 |
|
// if ( newver ) delete newver; |
558 |
|
// if ( newrun ) delete newrun; |
559 |
|
// if ( oldver ) delete oldver; |
560 |
|
// if ( oldrun ) delete oldrun; |
561 |
return(0); |
return(0); |
562 |
} |
} |
563 |
|
|
564 |
|
void ItoRunInfo::Write(){ |
565 |
|
file->cd(); |
566 |
|
newtree->Write("Run",TObject::kOverwrite); |
567 |
|
} |
568 |
|
|
569 |
Int_t ItoRunInfo::Read(UInt_t idRun){ |
Int_t ItoRunInfo::Read(UInt_t idRun){ |
570 |
// |
// |
571 |
isreadonly = true; |
isreadonly = true; |
602 |
// |
// |
603 |
for ( UInt_t run = 0; run < totnorun; run++){ |
for ( UInt_t run = 0; run < totnorun; run++){ |
604 |
// |
// |
605 |
newtree->GetEntry(run); |
if ( newtree->GetEntry(run) <= 0 ) throw -36; |
606 |
// |
// |
607 |
file_entries += (newrun->EV_TO - newrun->EV_FROM + 1); |
file_entries += (newrun->EV_TO - newrun->EV_FROM + 1); |
608 |
// |
// |
613 |
runlist->AddAt(newrun->ID,norun); |
runlist->AddAt(newrun->ID,norun); |
614 |
norun++; |
norun++; |
615 |
}; |
}; |
616 |
last_file_entry = first_file_entry + (newrun->EV_TO - newrun->EV_FROM + 1); |
if ( newrun->EV_TO >= newrun->EV_FROM ) last_file_entry = first_file_entry + (newrun->EV_TO - newrun->EV_FROM + 1); |
617 |
}; |
}; |
618 |
}; |
}; |
619 |
if ( debug ) printf("norun %i \n",(int)norun); |
if ( debug ) printf("norun %i \n",(int)norun); |
633 |
file_entries = 0; |
file_entries = 0; |
634 |
norun = 0; |
norun = 0; |
635 |
delete runlist; |
delete runlist; |
636 |
file = new TFile(); |
// file = new TFile(); |
637 |
if ( isreadonly ) newtree->Delete(); |
file = 0; |
638 |
|
// if ( isreadonly ) newtree->Delete(); |
639 |
} |
} |
640 |
|
|
641 |
void ItoRunInfo::Clear(){ |
void ItoRunInfo::Clear(Option_t *t){ |
642 |
if ( newtree ) newtree->Delete(); |
if ( newtree ) newtree->Delete(); |
643 |
} |
} |
644 |
|
|
691 |
totnorun = newtree->GetEntries(); |
totnorun = newtree->GetEntries(); |
692 |
// |
// |
693 |
for ( UInt_t nrun = 0; nrun < totnorun; nrun++){ |
for ( UInt_t nrun = 0; nrun < totnorun; nrun++){ |
694 |
newtree->GetEntry(nrun); |
if ( newtree->GetEntry(nrun) <= 0 ) throw -36; |
695 |
// |
// |
696 |
if ( nwrun->ID == run || run == 0 ){ |
if ( nwrun->ID == run || run == 0 ){ |
697 |
CopyFromTo(nwrun,(GL_RUN*)this,nwver,version); |
CopyFromTo(nwrun,(GL_RUN*)this,nwver,version); |
698 |
found = true; |
found = true; |
699 |
last_file_entry = first_file_entry + (nwrun->EV_TO - nwrun->EV_FROM + 1); |
if ( nwrun->EV_TO >= nwrun->EV_FROM ) last_file_entry = first_file_entry + (nwrun->EV_TO - nwrun->EV_FROM + 1); |
700 |
}; |
}; |
701 |
if ( !found ) first_file_entry += (nwrun->EV_TO - nwrun->EV_FROM + 1); |
if ( !found ) first_file_entry += (nwrun->EV_TO - nwrun->EV_FROM + 1); |
702 |
}; |
}; |