2 |
#include <sstream> |
#include <sstream> |
3 |
// |
// |
4 |
#include <TObject.h> |
#include <TObject.h> |
5 |
|
#include <TChain.h> |
6 |
#include <TSystem.h> |
#include <TSystem.h> |
7 |
#include <TArrayL.h> |
#include <TSystemFile.h> |
8 |
|
#include <TArrayI.h> |
9 |
#include <TFile.h> |
#include <TFile.h> |
10 |
#include <TTree.h> |
#include <TTree.h> |
11 |
#include <TDirectory.h> |
#include <TDirectory.h> |
32 |
S4_ver = ""; |
S4_ver = ""; |
33 |
} |
} |
34 |
|
|
35 |
|
void SoftInfo::Clear(){ |
36 |
|
TRIG_ver = ""; |
37 |
|
TOF_ver = ""; |
38 |
|
AC_ver = ""; |
39 |
|
TRK_ver = ""; |
40 |
|
ORB_ver = ""; |
41 |
|
CAL_ver = ""; |
42 |
|
ND_ver = ""; |
43 |
|
S4_ver = ""; |
44 |
|
} |
45 |
|
|
46 |
|
|
47 |
/** |
/** |
48 |
* 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). |
49 |
*/ |
*/ |
65 |
isreadonly = true; |
isreadonly = true; |
66 |
first_file_entry = 0; |
first_file_entry = 0; |
67 |
last_file_entry = 0; |
last_file_entry = 0; |
68 |
file_entries = 0ULL; |
file_entries = 0; |
69 |
totnorun = 0LL; |
totnorun = 0; |
70 |
|
this->GL_RUN::Clear(); |
71 |
version = new SoftInfo(); |
version = new SoftInfo(); |
|
version->TRIG_ver = ""; |
|
|
version->TOF_ver = ""; |
|
|
version->AC_ver = ""; |
|
|
version->TRK_ver = ""; |
|
|
version->CAL_ver = ""; |
|
|
version->ND_ver = ""; |
|
|
version->S4_ver = ""; |
|
|
version->ORB_ver = ""; |
|
72 |
norun = 0; |
norun = 0; |
73 |
runlist = new TArrayL(0,NULL); |
runlist = new TArrayI(500); |
74 |
file = new TFile(); |
file = NULL; |
75 |
newtree = new TTree(); |
newtree = new TTree(); |
76 |
} |
} |
77 |
|
|
80 |
file=(TFile*)processFl; |
file=(TFile*)processFl; |
81 |
dbc=NULL; |
dbc=NULL; |
82 |
processFolder = ""; |
processFolder = ""; |
83 |
idRun = 0ULL; |
idRun = 0; |
84 |
Detector = "NONE"; |
Detector = "NONE"; |
85 |
// |
// |
86 |
reprocessing = false; |
reprocessing = false; |
87 |
updating = false; |
updating = false; |
88 |
first_file_entry = 0; |
first_file_entry = 0; |
89 |
last_file_entry = 0; |
last_file_entry = 0; |
90 |
file_entries = 0ULL; |
file_entries = 0; |
91 |
version = new SoftInfo(); |
version = new SoftInfo(); |
|
version->TRIG_ver = ""; |
|
|
version->TOF_ver = ""; |
|
|
version->AC_ver = ""; |
|
|
version->TRK_ver = ""; |
|
|
version->ORB_ver = ""; |
|
|
version->CAL_ver = ""; |
|
|
version->ND_ver = ""; |
|
|
version->S4_ver = ""; |
|
92 |
norun = 0; |
norun = 0; |
93 |
totnorun = 0; |
totnorun = 0; |
94 |
// runlist = new TArrayL(0,NULL); |
runlist = new TArrayI(500); |
95 |
|
// |
96 |
|
} |
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
TChain *ItoRunInfo::LoadRunInfoTree(TList *fl){ |
101 |
|
// |
102 |
|
TChain *Tout=0; |
103 |
|
// |
104 |
|
TChain *RI = 0; |
105 |
|
TChain *SI = 0; |
106 |
|
RI = new TChain("RunInfo"); |
107 |
|
SI = new TChain("SoftInfo"); |
108 |
|
// loop over files and create chains |
109 |
|
TIter next(fl); |
110 |
|
TSystemFile *questo = 0; |
111 |
|
while ( (questo = (TSystemFile*) next()) ) { |
112 |
|
TString name = questo->GetName(); |
113 |
|
RI->Add(name); |
114 |
|
SI->Add(name); |
115 |
|
}; |
116 |
|
// |
117 |
|
RI->SetBranchAddress("RunInfo", GetPointerToRI()); |
118 |
|
Tout = RI; |
119 |
|
SI->SetBranchAddress("SoftInfo", GetPointerToSI()); |
120 |
|
Tout->AddFriend("SoftInfo"); |
121 |
|
// |
122 |
|
return Tout; |
123 |
// |
// |
124 |
} |
} |
125 |
|
|
133 |
updating = false; |
updating = false; |
134 |
first_file_entry = 0; |
first_file_entry = 0; |
135 |
last_file_entry = 0; |
last_file_entry = 0; |
136 |
file_entries = 0ULL; |
file_entries = 0; |
137 |
version = new SoftInfo(); |
version = new SoftInfo(); |
|
version->TRIG_ver = ""; |
|
|
version->TOF_ver = ""; |
|
|
version->AC_ver = ""; |
|
|
version->TRK_ver = ""; |
|
|
version->ORB_ver = ""; |
|
|
version->CAL_ver = ""; |
|
|
version->ND_ver = ""; |
|
|
version->S4_ver = ""; |
|
138 |
norun = 0; |
norun = 0; |
139 |
totnorun = 0; |
totnorun = 0; |
140 |
runlist = new TArrayL(0,NULL); |
runlist = new TArrayI(500); |
141 |
|
// |
142 |
|
} |
143 |
|
|
144 |
|
void ItoRunInfo::CopyFromTo(GL_RUN *glrun,GL_RUN *newrun,SoftInfo *sinfo, SoftInfo *newver){ |
145 |
// |
// |
146 |
|
if ( glrun && newrun ){ |
147 |
|
// |
148 |
|
newrun->ID = glrun->ID ; |
149 |
|
newrun->ID_RUN_FRAG = glrun-> ID_RUN_FRAG ; |
150 |
|
newrun->ID_ROOT_L0 = glrun->ID_ROOT_L0 ; |
151 |
|
newrun->ID_ROOT_L2 = glrun->ID_ROOT_L2 ; |
152 |
|
newrun->RUNHEADER_TIME = glrun->RUNHEADER_TIME ; |
153 |
|
newrun->RUNTRAILER_TIME = glrun->RUNTRAILER_TIME ; |
154 |
|
newrun->EV_FROM = glrun->EV_FROM ; |
155 |
|
newrun->EV_TO = glrun->EV_TO ; |
156 |
|
newrun->TRK_CALIB_USED = glrun->TRK_CALIB_USED ; |
157 |
|
newrun->EFF_WRK_SCHEDULE = glrun->EFF_WRK_SCHEDULE ; |
158 |
|
newrun->PRH_VAR_TRG_MODE_A = glrun->PRH_VAR_TRG_MODE_A ; |
159 |
|
newrun->PRH_VAR_TRG_MODE_B = glrun->PRH_VAR_TRG_MODE_B ; |
160 |
|
newrun->ACQ_BUILD_INFO =glrun->ACQ_BUILD_INFO ; |
161 |
|
newrun->ACQ_VAR_INFO = glrun->ACQ_VAR_INFO ; |
162 |
|
newrun->RUNHEADER_OBT = glrun->RUNHEADER_OBT ; |
163 |
|
newrun->RUNTRAILER_OBT = glrun->RUNTRAILER_OBT ; |
164 |
|
newrun->RUNHEADER_PKT = glrun->RUNHEADER_PKT ; |
165 |
|
newrun->RUNTRAILER_PKT = glrun->RUNTRAILER_PKT ; |
166 |
|
newrun->NEVENTS = glrun->NEVENTS ; |
167 |
|
newrun->LAST_TIMESYNC = glrun->LAST_TIMESYNC ; |
168 |
|
newrun->OBT_TIMESYNC = glrun->OBT_TIMESYNC ; |
169 |
|
newrun->COMPILATIONTIMESTAMP = glrun->COMPILATIONTIMESTAMP ; |
170 |
|
newrun->FAV_WRK_SCHEDULE = glrun->FAV_WRK_SCHEDULE ; |
171 |
|
newrun->RM_ACQ_AFTER_CALIB = glrun->RM_ACQ_AFTER_CALIB ; |
172 |
|
newrun->RM_ACQ_SETTING_MODE = glrun->RM_ACQ_SETTING_MODE ; |
173 |
|
newrun->PKT_COUNTER = glrun->PKT_COUNTER ; |
174 |
|
newrun->PKT_READY_COUNTER = glrun->PKT_READY_COUNTER ; |
175 |
|
newrun->TRK_CALIB_USED = glrun->TRK_CALIB_USED ; |
176 |
|
newrun->CAL_DSP_MASK = glrun->CAL_DSP_MASK ; |
177 |
|
newrun->BOOT_NUMBER = glrun->BOOT_NUMBER ; |
178 |
|
newrun->VALIDATION = glrun->VALIDATION ; |
179 |
|
// |
180 |
|
}; |
181 |
|
// |
182 |
|
if ( newver && sinfo ){ |
183 |
|
// |
184 |
|
newver->TRIG_ver = sinfo->TRIG_ver; |
185 |
|
newver->TOF_ver = sinfo->TOF_ver; |
186 |
|
newver->AC_ver = sinfo->AC_ver; |
187 |
|
newver->TRK_ver = sinfo->TRK_ver; |
188 |
|
newver->ORB_ver = sinfo->ORB_ver; |
189 |
|
newver->CAL_ver = sinfo->CAL_ver; |
190 |
|
newver->S4_ver = sinfo->S4_ver; |
191 |
|
newver->ND_ver = sinfo->ND_ver; |
192 |
|
// |
193 |
|
}; |
194 |
} |
} |
195 |
|
|
196 |
Int_t ItoRunInfo::Update(ULong64_t run, TString Detector, TString Version){ |
Int_t ItoRunInfo::Update(UInt_t run, TString Detector, TString Version){ |
197 |
// |
// |
198 |
isreadonly = false; |
isreadonly = false; |
199 |
idRun = run; |
idRun = run; |
212 |
SoftInfo *oldver = new SoftInfo(); |
SoftInfo *oldver = new SoftInfo(); |
213 |
SoftInfo *newver = new SoftInfo(); |
SoftInfo *newver = new SoftInfo(); |
214 |
// |
// |
215 |
ID = 0ULL; |
this->GL_RUN::Clear(); |
216 |
ID_REG_RUN = 0ULL; |
version->Clear(); |
|
ID_REG_RUN_L2 = 0ULL; |
|
|
RUNHEADER_TIME = 0ULL; |
|
|
RUNTRAILER_TIME = 0ULL; |
|
|
EV_REG_PHYS_FROM = 0; |
|
|
EV_REG_PHYS_TO = 0; |
|
|
EV_REG_RUNHEADER = 0; |
|
|
EV_REG_RUNTRAILER = 0; |
|
|
TRK_CALIB_USED = 0; |
|
|
EFF_WRK_SCHEDULE = 0; |
|
|
PRH_VAR_TRG_MODE_A = 0; |
|
|
PRH_VAR_TRG_MODE_B = 0; |
|
|
ACQ_BUILD_INFO = 0; |
|
|
ACQ_VAR_INFO = 0; |
|
|
version->TRIG_ver = ""; |
|
|
version->TOF_ver = ""; |
|
|
version->AC_ver = ""; |
|
|
version->TRK_ver = ""; |
|
|
version->ORB_ver = ""; |
|
|
version->CAL_ver = ""; |
|
|
version->ND_ver = ""; |
|
|
version->S4_ver = ""; |
|
217 |
// |
// |
218 |
norun = 0; |
norun = 0; |
|
runlist = new TArrayL(0,NULL); |
|
|
//runlist->Reset(); |
|
219 |
// |
// |
220 |
Bool_t found = false; |
Bool_t found = false; |
221 |
Int_t error = 0; |
Int_t error = 0; |
222 |
// |
// |
|
// TFile *temprfile = 0; |
|
|
// TTree *temprrun = 0; |
|
|
// stringstream temprname; |
|
|
// stringstream tempdir; |
|
|
// const char* routdir = gSystem->DirName(gSystem->DirName(file->GetPath())); |
|
|
// |
|
223 |
TTree *oldtree = 0; |
TTree *oldtree = 0; |
224 |
// |
// |
|
// |
|
225 |
// Try to get the tree Run in the processed file |
// Try to get the tree Run in the processed file |
226 |
// |
// |
227 |
oldtree = (TTree*)file->Get("Run"); |
oldtree = (TTree*)file->Get("Run"); |
258 |
// |
// |
259 |
} else { |
} else { |
260 |
// |
// |
|
// temprname.str(""); |
|
|
// temprname << routdir; |
|
|
// temprname << "/" << processFolder.Data(); |
|
|
// gSystem->MakeDirectory(temprname.str().c_str()); |
|
|
// tempdir.str(""); |
|
|
// tempdir << temprname.str().c_str(); |
|
|
// temprname << "/runinfo_run"; |
|
|
// temprname << idRun << ".root"; |
|
|
// if ( debug ) printf(" file temporaneo is %s \n",temprname.str().c_str()); |
|
|
// // |
|
|
// temprfile = new TFile(temprname.str().c_str(),"RECREATE"); |
|
|
// // |
|
|
// temprrun = new TTree(); |
|
|
// // |
|
|
// if ( !temprfile ) return(-805); |
|
|
// if ( !oldtree ) return(-806); |
|
|
// if ( !temprrun ) return(-807); |
|
|
// // |
|
|
// temprrun = oldtree->CloneTree(-1,"fast"); |
|
|
// // |
|
|
// temprfile->cd(); |
|
|
// temprrun->SetName("Run-old"); |
|
|
// temprfile->Write(); |
|
|
// if ( temprrun ) temprrun->Delete(); |
|
|
// temprfile->Close(); |
|
|
// // |
|
|
// oldtree->Delete("all"); |
|
|
// |
|
261 |
updating = true; |
updating = true; |
262 |
if ( debug ) printf(" RunInfo: updating versioning information \n"); |
if ( debug ) printf(" RunInfo: updating versioning information \n"); |
263 |
// |
// |
273 |
// |
// |
274 |
// |
// |
275 |
if ( !updating ){ |
if ( !updating ){ |
276 |
if ( idRun == 0ULL ){ |
if ( idRun == 0 ){ |
277 |
if ( debug ) printf("\n RUNINFO - ERROR: reprocessing data but no RunInfo tree in Level2 file. \n"); |
if ( debug ) printf("\n RUNINFO - ERROR: reprocessing data but no RunInfo tree in Level2 file. \n"); |
278 |
return(-805); |
return(-805); |
279 |
}; |
}; |
280 |
// |
// |
|
runlist = new TArrayL(1); |
|
|
// |
|
281 |
error = Query_GL_RUN(idRun, dbc); |
error = Query_GL_RUN(idRun, dbc); |
282 |
// |
// |
283 |
if ( error ){ |
if ( error ){ |
284 |
if ( debug ) printf("\n RUNINFO - ERROR: Query_GL_RUN exited with non zero error\n"); |
if ( debug ) printf("\n RUNINFO - ERROR: Query_GL_RUN exited with non zero error\n"); |
285 |
return(error); |
return(error); |
286 |
}; |
}; |
287 |
if ( ID == 0ULL ){ |
if ( ID == 0 ){ |
288 |
if ( debug ) printf("\n RUNINFO - ERROR: no run with ID_RUN = %llu \n",idRun); |
if ( debug ) printf("\n RUNINFO - ERROR: no run with ID_RUN = %u \n",idRun); |
289 |
return(-5); |
return(-5); |
290 |
}; |
}; |
291 |
// |
// |
292 |
// |
// |
293 |
// |
CopyFromTo((GL_RUN*)this,newrun,version,newver); |
|
newrun->ID = ID; |
|
|
newrun->ID_REG_RUN = ID_REG_RUN; |
|
|
newrun->ID_REG_RUN_L2 = ID_REG_RUN_L2; |
|
|
newrun->RUNHEADER_TIME = RUNHEADER_TIME; |
|
|
newrun->RUNTRAILER_TIME = RUNTRAILER_TIME; |
|
|
newrun->EV_REG_PHYS_FROM = EV_REG_PHYS_FROM; |
|
|
newrun->EV_REG_PHYS_TO = EV_REG_PHYS_TO; |
|
|
newrun->EV_REG_RUNHEADER = EV_REG_RUNHEADER; |
|
|
newrun->EV_REG_RUNTRAILER = EV_REG_RUNTRAILER; |
|
|
newrun->TRK_CALIB_USED = TRK_CALIB_USED; |
|
|
newrun->EFF_WRK_SCHEDULE = EFF_WRK_SCHEDULE; |
|
|
newrun->PRH_VAR_TRG_MODE_A = PRH_VAR_TRG_MODE_A; |
|
|
newrun->PRH_VAR_TRG_MODE_B = PRH_VAR_TRG_MODE_B; |
|
|
newrun->ACQ_BUILD_INFO = ACQ_BUILD_INFO; |
|
|
newrun->ACQ_VAR_INFO = ACQ_VAR_INFO; |
|
|
newver->TRIG_ver = version->TRIG_ver; |
|
|
newver->TOF_ver = version->TOF_ver; |
|
|
newver->AC_ver = version->AC_ver; |
|
|
newver->TRK_ver = version->TRK_ver; |
|
|
newver->ORB_ver = version->ORB_ver; |
|
|
newver->CAL_ver = version->CAL_ver; |
|
|
newver->S4_ver = version->S4_ver; |
|
|
newver->ND_ver = version->ND_ver; |
|
294 |
// |
// |
295 |
// fill the tree; |
// fill the tree; |
296 |
// |
// |
299 |
totnorun = 1; |
totnorun = 1; |
300 |
reprocessing = false; |
reprocessing = false; |
301 |
first_file_entry = 0; |
first_file_entry = 0; |
302 |
last_file_entry = (UInt_t)(EV_REG_PHYS_TO - EV_REG_PHYS_FROM); |
last_file_entry = (UInt_t)(EV_TO - EV_FROM); |
303 |
norun = 1; |
norun = 1; |
304 |
runlist->AddAt((Long64_t)ID,0); |
runlist->AddAt((Int_t)ID,0); |
305 |
// |
// |
306 |
newtree->SetName("Run"); |
newtree->SetName("Run"); |
307 |
// |
// |
308 |
file->cd(); |
file->cd(); |
309 |
// file->Write("Run"); |
// |
|
//newtree->Delete(); |
|
310 |
delete newver; |
delete newver; |
311 |
delete newrun; |
delete newrun; |
312 |
delete oldver; |
delete oldver; |
316 |
// |
// |
317 |
} else { |
} else { |
318 |
// |
// |
|
// temprfile = new TFile(temprname.str().c_str(),"READ"); |
|
|
// oldtree = (TTree*)temprfile->Get("Run-old"); |
|
319 |
// |
// |
320 |
oldtree->SetBranchAddress("RunInfo",&oldrun); |
oldtree->SetBranchAddress("RunInfo",&oldrun); |
321 |
oldtree->SetBranchAddress("SoftInfo",&oldver); |
oldtree->SetBranchAddress("SoftInfo",&oldver); |
322 |
// |
// |
323 |
totnorun = oldtree->GetEntries(); |
totnorun = oldtree->GetEntries(); |
324 |
// |
// |
325 |
runlist = new TArrayL((Int_t)totnorun); |
if ( totnorun > 500 ){ |
326 |
|
if ( debug ) printf("\n RUNINFO - ERROR: can not handle more than 500 runs!\n"); |
327 |
|
return(-806); |
328 |
|
}; |
329 |
// |
// |
330 |
found = false; |
found = false; |
331 |
// |
// |
333 |
// |
// |
334 |
oldtree->GetEntry(run); |
oldtree->GetEntry(run); |
335 |
// |
// |
336 |
newrun->ID = oldrun->ID; |
CopyFromTo(oldrun,newrun,oldver,newver); |
|
newrun->ID_REG_RUN = oldrun->ID_REG_RUN; |
|
|
newrun->ID_REG_RUN_L2 = oldrun->ID_REG_RUN_L2; |
|
|
newrun->RUNHEADER_TIME = oldrun->RUNHEADER_TIME; |
|
|
newrun->RUNTRAILER_TIME = oldrun->RUNTRAILER_TIME; |
|
|
newrun->EV_REG_PHYS_FROM = oldrun->EV_REG_PHYS_FROM; |
|
|
newrun->EV_REG_PHYS_TO = oldrun->EV_REG_PHYS_TO; |
|
|
newrun->EV_REG_RUNHEADER = oldrun->EV_REG_RUNHEADER; |
|
|
newrun->EV_REG_RUNTRAILER = oldrun->EV_REG_RUNTRAILER; |
|
|
newrun->TRK_CALIB_USED = oldrun->TRK_CALIB_USED; |
|
|
newrun->EFF_WRK_SCHEDULE = oldrun->EFF_WRK_SCHEDULE; |
|
|
newrun->PRH_VAR_TRG_MODE_A = oldrun->PRH_VAR_TRG_MODE_A; |
|
|
newrun->PRH_VAR_TRG_MODE_B = oldrun->PRH_VAR_TRG_MODE_B; |
|
|
newrun->ACQ_BUILD_INFO = oldrun->ACQ_BUILD_INFO; |
|
|
newrun->ACQ_VAR_INFO = oldrun->ACQ_VAR_INFO; |
|
|
newver->TRIG_ver = oldver->TRIG_ver; |
|
|
newver->TOF_ver = oldver->TOF_ver; |
|
|
newver->AC_ver = oldver->AC_ver; |
|
|
newver->TRK_ver = oldver->TRK_ver; |
|
|
newver->ORB_ver = oldver->ORB_ver; |
|
|
newver->CAL_ver = oldver->CAL_ver; |
|
|
newver->S4_ver = oldver->S4_ver; |
|
|
newver->ND_ver = oldver->ND_ver; |
|
337 |
// |
// |
338 |
file_entries += (oldrun->EV_REG_PHYS_TO - oldrun->EV_REG_PHYS_FROM + 1); |
file_entries += (oldrun->EV_TO - oldrun->EV_FROM + 1); |
339 |
// |
// |
340 |
if ( debug ) printf("totnorun %i idRun %i newrun->ID %i \n",(int)totnorun,(int)idRun,(int)newrun->ID); |
if ( debug ) printf("totnorun %i idRun %i newrun->ID %i \n",(int)totnorun,(int)idRun,(int)newrun->ID); |
341 |
// |
// |
342 |
if ( idRun == 0ULL || idRun == newrun->ID ) { |
if ( idRun == 0 || idRun == newrun->ID ) { |
343 |
// |
// |
344 |
if ( debug ) printf(" Updating run number %llu \n",idRun); |
if ( debug ) printf(" Updating run number %u \n",idRun); |
345 |
// |
// |
346 |
found = true; |
found = true; |
347 |
// |
// |
359 |
return(error); |
return(error); |
360 |
}; |
}; |
361 |
// |
// |
362 |
newrun->ID = ID; |
CopyFromTo((GL_RUN*)this,newrun,NULL,NULL); |
363 |
newrun->ID_REG_RUN = ID_REG_RUN; |
// |
|
newrun->ID_REG_RUN_L2 = ID_REG_RUN_L2; |
|
|
newrun->RUNHEADER_TIME = RUNHEADER_TIME; |
|
|
newrun->RUNTRAILER_TIME = RUNTRAILER_TIME; |
|
|
newrun->EV_REG_PHYS_FROM = EV_REG_PHYS_FROM; |
|
|
newrun->EV_REG_PHYS_TO = EV_REG_PHYS_TO; |
|
|
newrun->EV_REG_RUNHEADER = EV_REG_RUNHEADER; |
|
|
newrun->EV_REG_RUNTRAILER = EV_REG_RUNTRAILER; |
|
|
newrun->TRK_CALIB_USED = TRK_CALIB_USED; |
|
|
newrun->EFF_WRK_SCHEDULE = EFF_WRK_SCHEDULE; |
|
|
newrun->PRH_VAR_TRG_MODE_A = PRH_VAR_TRG_MODE_A; |
|
|
newrun->PRH_VAR_TRG_MODE_B = PRH_VAR_TRG_MODE_B; |
|
|
newrun->ACQ_BUILD_INFO = ACQ_BUILD_INFO; |
|
|
newrun->ACQ_VAR_INFO = ACQ_VAR_INFO; |
|
364 |
} else { |
} else { |
365 |
// |
// |
366 |
if ( !strcmp(Detector.Data(),"TRIG") ){ |
if ( !strcmp(Detector.Data(),"TRIG") ){ |
453 |
}; |
}; |
454 |
}; |
}; |
455 |
// |
// |
456 |
last_file_entry = first_file_entry + (oldrun->EV_REG_PHYS_TO - oldrun->EV_REG_PHYS_FROM + 1); |
last_file_entry = first_file_entry + (oldrun->EV_TO - oldrun->EV_FROM + 1); |
457 |
// |
// |
458 |
} else { |
} else { |
459 |
if ( !found ) first_file_entry += (oldrun->EV_REG_PHYS_TO - oldrun->EV_REG_PHYS_FROM + 1); |
if ( !found ) first_file_entry += (oldrun->EV_TO - oldrun->EV_FROM + 1); |
460 |
}; |
}; |
461 |
// |
// |
462 |
file->cd(); |
file->cd(); |
464 |
// |
// |
465 |
}; |
}; |
466 |
// |
// |
|
// temprfile->Close(); |
|
|
// gSystem->Unlink(temprname.str().c_str()); |
|
|
// if ( ismydir ) gSystem->Unlink(tempdir.str().c_str()); |
|
467 |
file->cd(); |
file->cd(); |
468 |
if ( oldtree ) oldtree->Delete("all"); |
if ( oldtree ) oldtree->Delete("all"); |
469 |
newtree->SetName("Run"); |
newtree->SetName("Run"); |
470 |
// file->Write("Run"); |
// |
|
// newtree->Delete(); |
|
471 |
delete newver; |
delete newver; |
472 |
delete newrun; |
delete newrun; |
473 |
delete oldver; |
delete oldver; |
474 |
delete oldrun; |
delete oldrun; |
475 |
// |
// |
476 |
if ( !found ){ |
if ( !found ){ |
477 |
if ( debug ) printf("\n RUNINFO - ERROR: no run with ID_RUN = %llu \n",idRun); |
if ( debug ) printf("\n RUNINFO - ERROR: no run with ID_RUN = %u \n",idRun); |
478 |
return(-5); |
return(-5); |
479 |
}; |
}; |
480 |
// |
// |
483 |
return(0); |
return(0); |
484 |
} |
} |
485 |
|
|
486 |
Int_t ItoRunInfo::Read(ULong64_t idRun){ |
Int_t ItoRunInfo::Read(UInt_t idRun){ |
487 |
// |
// |
488 |
isreadonly = true; |
isreadonly = true; |
489 |
// |
// |
510 |
// |
// |
511 |
totnorun = newtree->GetEntries(); |
totnorun = newtree->GetEntries(); |
512 |
// |
// |
513 |
runlist = new TArrayL((Int_t)totnorun); |
if ( totnorun > 500 ){ |
514 |
|
if ( debug ) printf("\n RUNINFO - ERROR: can not handle more than 500 runs!\n"); |
515 |
|
return(-806); |
516 |
|
}; |
517 |
// |
// |
518 |
first_file_entry = 0; |
first_file_entry = 0; |
519 |
// |
// |
521 |
// |
// |
522 |
newtree->GetEntry(run); |
newtree->GetEntry(run); |
523 |
// |
// |
524 |
file_entries += (newrun->EV_REG_PHYS_TO - newrun->EV_REG_PHYS_FROM + 1); |
file_entries += (newrun->EV_TO - newrun->EV_FROM + 1); |
525 |
// |
// |
526 |
if ( debug ) printf("totnorun %i newrun->ID %i \n",(int)totnorun,(int)newrun->ID); |
if ( debug ) printf("totnorun %i newrun->ID %i \n",(int)totnorun,(int)newrun->ID); |
527 |
// |
// |
528 |
ID = newrun->ID; |
CopyFromTo(newrun,(GL_RUN*)this,newver,version); |
529 |
ID_REG_RUN = newrun->ID_REG_RUN; |
if ( idRun == ID || idRun == 0 ){ |
|
ID_REG_RUN_L2 = newrun->ID_REG_RUN_L2; |
|
|
RUNHEADER_TIME = newrun->RUNHEADER_TIME; |
|
|
RUNTRAILER_TIME = newrun->RUNTRAILER_TIME; |
|
|
EV_REG_PHYS_FROM = newrun->EV_REG_PHYS_FROM; |
|
|
EV_REG_PHYS_TO = newrun->EV_REG_PHYS_TO; |
|
|
EV_REG_RUNHEADER = newrun->EV_REG_RUNHEADER; |
|
|
EV_REG_RUNTRAILER = newrun->EV_REG_RUNTRAILER; |
|
|
TRK_CALIB_USED = newrun->TRK_CALIB_USED; |
|
|
EFF_WRK_SCHEDULE = newrun->EFF_WRK_SCHEDULE; |
|
|
PRH_VAR_TRG_MODE_A = newrun->PRH_VAR_TRG_MODE_A; |
|
|
PRH_VAR_TRG_MODE_B = newrun->PRH_VAR_TRG_MODE_B; |
|
|
ACQ_BUILD_INFO = newrun->ACQ_BUILD_INFO; |
|
|
ACQ_VAR_INFO = newrun->ACQ_VAR_INFO; |
|
|
version->TRIG_ver = newver->TRIG_ver; |
|
|
version->TOF_ver = newver->TOF_ver; |
|
|
version->AC_ver = newver->AC_ver; |
|
|
version->TRK_ver = newver->TRK_ver; |
|
|
version->ORB_ver = newver->ORB_ver; |
|
|
version->CAL_ver = newver->CAL_ver; |
|
|
version->S4_ver = newver->S4_ver; |
|
|
version->ND_ver = newver->ND_ver; |
|
|
if ( idRun == ID || idRun == 0ULL ){ |
|
530 |
runlist->AddAt(newrun->ID,norun); |
runlist->AddAt(newrun->ID,norun); |
531 |
norun++; |
norun++; |
532 |
}; |
}; |
533 |
last_file_entry = first_file_entry + (newrun->EV_REG_PHYS_TO - newrun->EV_REG_PHYS_FROM + 1); |
last_file_entry = first_file_entry + (newrun->EV_TO - newrun->EV_FROM + 1); |
534 |
}; |
}; |
535 |
}; |
}; |
536 |
if ( debug ) printf("norun %i \n",(int)norun); |
if ( debug ) printf("norun %i \n",(int)norun); |
547 |
updating = false; |
updating = false; |
548 |
first_file_entry = 0; |
first_file_entry = 0; |
549 |
last_file_entry = 0; |
last_file_entry = 0; |
550 |
file_entries = 0ULL; |
file_entries = 0; |
551 |
norun = 0; |
norun = 0; |
552 |
runlist = new TArrayL(0,NULL); |
delete runlist; |
553 |
file = new TFile(); |
file = new TFile(); |
554 |
if ( isreadonly ) newtree->Delete(); |
if ( isreadonly ) newtree->Delete(); |
555 |
} |
} |
566 |
// |
// |
567 |
if ( entry > (UInt_t)last_file_entry ){ |
if ( entry > (UInt_t)last_file_entry ){ |
568 |
for ( UInt_t nrun = 0; nrun < norun; nrun++){ |
for ( UInt_t nrun = 0; nrun < norun; nrun++){ |
569 |
if ( ID == (ULong64_t)runlist->At(nrun) ) { |
if ( ID == (UInt_t)runlist->At(nrun) ) { |
570 |
startfrom = nrun+1; |
startfrom = nrun+1; |
571 |
break; |
break; |
572 |
}; |
}; |
580 |
retry: |
retry: |
581 |
// |
// |
582 |
for ( UInt_t nrun = startfrom; nrun < norun; nrun++){ |
for ( UInt_t nrun = startfrom; nrun < norun; nrun++){ |
583 |
GetRunInfo((ULong64_t)runlist->At(nrun)); |
GetRunInfo((UInt_t)runlist->At(nrun)); |
584 |
if ( entry >= (UInt_t)first_file_entry && entry <= (UInt_t)last_file_entry ){ |
if ( entry >= (UInt_t)first_file_entry && entry <= (UInt_t)last_file_entry ){ |
585 |
return((UInt_t)runlist->At(nrun)); |
return((UInt_t)runlist->At(nrun)); |
586 |
}; |
}; |
593 |
return(0); |
return(0); |
594 |
} |
} |
595 |
|
|
596 |
Int_t ItoRunInfo::GetRunInfo(ULong64_t run){ |
Int_t ItoRunInfo::GetRunInfo(UInt_t run){ |
597 |
Bool_t found = false; |
Bool_t found = false; |
598 |
SoftInfo *nwver = new SoftInfo(); |
SoftInfo *nwver = new SoftInfo(); |
599 |
GL_RUN *nwrun = new GL_RUN(); |
GL_RUN *nwrun = new GL_RUN(); |
609 |
for ( UInt_t nrun = 0; nrun < totnorun; nrun++){ |
for ( UInt_t nrun = 0; nrun < totnorun; nrun++){ |
610 |
newtree->GetEntry(nrun); |
newtree->GetEntry(nrun); |
611 |
// |
// |
612 |
if ( nwrun->ID == run || run == 0ULL ){ |
if ( nwrun->ID == run || run == 0 ){ |
613 |
ID = nwrun->ID; |
CopyFromTo(nwrun,(GL_RUN*)this,nwver,version); |
|
ID_REG_RUN = nwrun->ID_REG_RUN; |
|
|
ID_REG_RUN_L2 = nwrun->ID_REG_RUN_L2; |
|
|
RUNHEADER_TIME = nwrun->RUNHEADER_TIME; |
|
|
RUNTRAILER_TIME = nwrun->RUNTRAILER_TIME; |
|
|
EV_REG_PHYS_FROM = nwrun->EV_REG_PHYS_FROM; |
|
|
EV_REG_PHYS_TO = nwrun->EV_REG_PHYS_TO; |
|
|
EV_REG_RUNHEADER = nwrun->EV_REG_RUNHEADER; |
|
|
EV_REG_RUNTRAILER = nwrun->EV_REG_RUNTRAILER; |
|
|
TRK_CALIB_USED = nwrun->TRK_CALIB_USED; |
|
|
EFF_WRK_SCHEDULE = nwrun->EFF_WRK_SCHEDULE; |
|
|
PRH_VAR_TRG_MODE_A = nwrun->PRH_VAR_TRG_MODE_A; |
|
|
PRH_VAR_TRG_MODE_B = nwrun->PRH_VAR_TRG_MODE_B; |
|
|
ACQ_BUILD_INFO = nwrun->ACQ_BUILD_INFO; |
|
|
ACQ_VAR_INFO = nwrun->ACQ_VAR_INFO; |
|
|
version->TRIG_ver = nwver->TRIG_ver; |
|
|
version->TOF_ver = nwver->TOF_ver; |
|
|
version->AC_ver = nwver->AC_ver; |
|
|
version->TRK_ver = nwver->TRK_ver; |
|
|
version->ORB_ver = nwver->ORB_ver; |
|
|
version->CAL_ver = nwver->CAL_ver; |
|
|
version->S4_ver = nwver->S4_ver; |
|
|
version->ND_ver = nwver->ND_ver; |
|
614 |
found = true; |
found = true; |
615 |
last_file_entry = first_file_entry + (nwrun->EV_REG_PHYS_TO - nwrun->EV_REG_PHYS_FROM + 1); |
last_file_entry = first_file_entry + (nwrun->EV_TO - nwrun->EV_FROM + 1); |
616 |
}; |
}; |
617 |
if ( !found ) first_file_entry += (nwrun->EV_REG_PHYS_TO - nwrun->EV_REG_PHYS_FROM + 1); |
if ( !found ) first_file_entry += (nwrun->EV_TO - nwrun->EV_FROM + 1); |
618 |
}; |
}; |
619 |
delete nwver; |
delete nwver; |
620 |
delete nwrun; |
delete nwrun; |