| 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 |
Int_t ItoRunInfo::Update(ULong64_t run, TString Detector, TString Version){ |
void ItoRunInfo::CopyFromTo(GL_RUN *glrun,GL_RUN *newrun,SoftInfo *sinfo, SoftInfo *newver){ |
| 145 |
|
// |
| 146 |
|
if ( glrun && newrun ){ |
| 147 |
|
// |
| 148 |
|
// printf("copy \n"); |
| 149 |
|
// |
| 150 |
|
newrun->ID = glrun->ID ; |
| 151 |
|
newrun->ID_RUN_FRAG = glrun-> ID_RUN_FRAG ; |
| 152 |
|
newrun->ID_ROOT_L0 = glrun->ID_ROOT_L0 ; |
| 153 |
|
newrun->ID_ROOT_L2 = glrun->ID_ROOT_L2 ; |
| 154 |
|
newrun->RUNHEADER_TIME = glrun->RUNHEADER_TIME ; |
| 155 |
|
newrun->RUNTRAILER_TIME = glrun->RUNTRAILER_TIME ; |
| 156 |
|
newrun->EV_FROM = glrun->EV_FROM ; |
| 157 |
|
newrun->EV_TO = glrun->EV_TO ; |
| 158 |
|
newrun->TRK_CALIB_USED = glrun->TRK_CALIB_USED ; |
| 159 |
|
newrun->EFF_WRK_SCHEDULE = glrun->EFF_WRK_SCHEDULE ; |
| 160 |
|
newrun->PRH_VAR_TRG_MODE_A = glrun->PRH_VAR_TRG_MODE_A ; |
| 161 |
|
newrun->PRH_VAR_TRG_MODE_B = glrun->PRH_VAR_TRG_MODE_B ; |
| 162 |
|
newrun->ACQ_BUILD_INFO =glrun->ACQ_BUILD_INFO ; |
| 163 |
|
newrun->ACQ_VAR_INFO = glrun->ACQ_VAR_INFO ; |
| 164 |
|
newrun->RUNHEADER_OBT = glrun->RUNHEADER_OBT ; |
| 165 |
|
newrun->RUNTRAILER_OBT = glrun->RUNTRAILER_OBT ; |
| 166 |
|
newrun->RUNHEADER_PKT = glrun->RUNHEADER_PKT ; |
| 167 |
|
newrun->RUNTRAILER_PKT = glrun->RUNTRAILER_PKT ; |
| 168 |
|
newrun->NEVENTS = glrun->NEVENTS ; |
| 169 |
|
newrun->LAST_TIMESYNC = glrun->LAST_TIMESYNC ; |
| 170 |
|
newrun->OBT_TIMESYNC = glrun->OBT_TIMESYNC ; |
| 171 |
|
newrun->COMPILATIONTIMESTAMP = glrun->COMPILATIONTIMESTAMP ; |
| 172 |
|
newrun->FAV_WRK_SCHEDULE = glrun->FAV_WRK_SCHEDULE ; |
| 173 |
|
newrun->RM_ACQ_AFTER_CALIB = glrun->RM_ACQ_AFTER_CALIB ; |
| 174 |
|
newrun->RM_ACQ_SETTING_MODE = glrun->RM_ACQ_SETTING_MODE ; |
| 175 |
|
newrun->PKT_COUNTER = glrun->PKT_COUNTER ; |
| 176 |
|
newrun->PKT_READY_COUNTER = glrun->PKT_READY_COUNTER ; |
| 177 |
|
newrun->TRK_CALIB_USED = glrun->TRK_CALIB_USED ; |
| 178 |
|
newrun->CAL_DSP_MASK = glrun->CAL_DSP_MASK ; |
| 179 |
|
newrun->BOOT_NUMBER = glrun->BOOT_NUMBER ; |
| 180 |
|
newrun->VALIDATION = glrun->VALIDATION ; |
| 181 |
|
// |
| 182 |
|
}; |
| 183 |
|
// |
| 184 |
|
if ( newver && sinfo ){ |
| 185 |
|
// |
| 186 |
|
newver->TRIG_ver = sinfo->TRIG_ver; |
| 187 |
|
newver->TOF_ver = sinfo->TOF_ver; |
| 188 |
|
newver->AC_ver = sinfo->AC_ver; |
| 189 |
|
newver->TRK_ver = sinfo->TRK_ver; |
| 190 |
|
newver->ORB_ver = sinfo->ORB_ver; |
| 191 |
|
newver->CAL_ver = sinfo->CAL_ver; |
| 192 |
|
newver->S4_ver = sinfo->S4_ver; |
| 193 |
|
newver->ND_ver = sinfo->ND_ver; |
| 194 |
|
// |
| 195 |
|
}; |
| 196 |
|
} |
| 197 |
|
|
| 198 |
|
Int_t ItoRunInfo::Update(UInt_t run, TString Detector, TString Version){ |
| 199 |
// |
// |
| 200 |
isreadonly = false; |
isreadonly = false; |
| 201 |
idRun = run; |
idRun = run; |
| 202 |
// |
// |
| 203 |
Bool_t debug = false; |
Bool_t debug = true; |
| 204 |
// |
// |
| 205 |
Bool_t ismydir = false; |
Bool_t ismydir = false; |
| 206 |
// |
// |
| 214 |
SoftInfo *oldver = new SoftInfo(); |
SoftInfo *oldver = new SoftInfo(); |
| 215 |
SoftInfo *newver = new SoftInfo(); |
SoftInfo *newver = new SoftInfo(); |
| 216 |
// |
// |
| 217 |
ID = 0ULL; |
this->GL_RUN::Clear(); |
| 218 |
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 = ""; |
|
| 219 |
// |
// |
| 220 |
norun = 0; |
norun = 0; |
|
runlist = new TArrayL(0,NULL); |
|
|
//runlist->Reset(); |
|
| 221 |
// |
// |
| 222 |
Bool_t found = false; |
Bool_t found = false; |
| 223 |
Int_t error = 0; |
Int_t error = 0; |
| 224 |
// |
// |
|
// TFile *temprfile = 0; |
|
|
// TTree *temprrun = 0; |
|
|
// stringstream temprname; |
|
|
// stringstream tempdir; |
|
|
// const char* routdir = gSystem->DirName(gSystem->DirName(file->GetPath())); |
|
|
// |
|
| 225 |
TTree *oldtree = 0; |
TTree *oldtree = 0; |
| 226 |
// |
// |
|
// |
|
| 227 |
// Try to get the tree Run in the processed file |
// Try to get the tree Run in the processed file |
| 228 |
// |
// |
| 229 |
oldtree = (TTree*)file->Get("Run"); |
oldtree = (TTree*)file->Get("Run"); |
| 260 |
// |
// |
| 261 |
} else { |
} else { |
| 262 |
// |
// |
|
// 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"); |
|
|
// |
|
| 263 |
updating = true; |
updating = true; |
| 264 |
if ( debug ) printf(" RunInfo: updating versioning information \n"); |
if ( debug ) printf(" RunInfo: updating versioning information \n"); |
| 265 |
// |
// |
| 275 |
// |
// |
| 276 |
// |
// |
| 277 |
if ( !updating ){ |
if ( !updating ){ |
| 278 |
if ( idRun == 0ULL ){ |
if ( idRun == 0 ){ |
| 279 |
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"); |
| 280 |
return(-805); |
return(-805); |
| 281 |
}; |
}; |
| 282 |
// |
// |
|
runlist = new TArrayL(1); |
|
|
// |
|
| 283 |
error = Query_GL_RUN(idRun, dbc); |
error = Query_GL_RUN(idRun, dbc); |
| 284 |
// |
// |
| 285 |
if ( error ){ |
if ( error ){ |
| 286 |
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"); |
| 287 |
return(error); |
return(error); |
| 288 |
}; |
}; |
| 289 |
if ( ID == 0ULL ){ |
if ( ID == 0 ){ |
| 290 |
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); |
| 291 |
return(-5); |
return(-5); |
| 292 |
}; |
}; |
| 293 |
// |
// |
| 294 |
// |
// |
| 295 |
// |
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; |
|
| 296 |
// |
// |
| 297 |
// fill the tree; |
// fill the tree; |
| 298 |
// |
// |
| 301 |
totnorun = 1; |
totnorun = 1; |
| 302 |
reprocessing = false; |
reprocessing = false; |
| 303 |
first_file_entry = 0; |
first_file_entry = 0; |
| 304 |
last_file_entry = (UInt_t)(EV_REG_PHYS_TO - EV_REG_PHYS_FROM); |
last_file_entry = (UInt_t)(EV_TO - EV_FROM); |
| 305 |
norun = 1; |
norun = 1; |
| 306 |
runlist->AddAt((Long64_t)ID,0); |
runlist->AddAt((Int_t)ID,0); |
| 307 |
// |
// |
| 308 |
newtree->SetName("Run"); |
newtree->SetName("Run"); |
| 309 |
// |
// |
| 310 |
file->cd(); |
file->cd(); |
| 311 |
// file->Write("Run"); |
// |
|
//newtree->Delete(); |
|
| 312 |
delete newver; |
delete newver; |
| 313 |
delete newrun; |
delete newrun; |
| 314 |
delete oldver; |
delete oldver; |
| 318 |
// |
// |
| 319 |
} else { |
} else { |
| 320 |
// |
// |
|
// temprfile = new TFile(temprname.str().c_str(),"READ"); |
|
|
// oldtree = (TTree*)temprfile->Get("Run-old"); |
|
| 321 |
// |
// |
| 322 |
oldtree->SetBranchAddress("RunInfo",&oldrun); |
oldtree->SetBranchAddress("RunInfo",&oldrun); |
| 323 |
oldtree->SetBranchAddress("SoftInfo",&oldver); |
oldtree->SetBranchAddress("SoftInfo",&oldver); |
| 324 |
// |
// |
| 325 |
totnorun = oldtree->GetEntries(); |
totnorun = oldtree->GetEntries(); |
| 326 |
// |
// |
| 327 |
runlist = new TArrayL((Int_t)totnorun); |
if ( totnorun > 500 ){ |
| 328 |
|
if ( debug ) printf("\n RUNINFO - ERROR: can not handle more than 500 runs!\n"); |
| 329 |
|
return(-806); |
| 330 |
|
}; |
| 331 |
// |
// |
| 332 |
found = false; |
found = false; |
| 333 |
// |
// |
| 335 |
// |
// |
| 336 |
oldtree->GetEntry(run); |
oldtree->GetEntry(run); |
| 337 |
// |
// |
| 338 |
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; |
|
| 339 |
// |
// |
| 340 |
file_entries += (oldrun->EV_REG_PHYS_TO - oldrun->EV_REG_PHYS_FROM + 1); |
file_entries += (oldrun->EV_TO - oldrun->EV_FROM + 1); |
| 341 |
// |
// |
| 342 |
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); |
| 343 |
// |
// |
| 344 |
if ( idRun == 0ULL || idRun == newrun->ID ) { |
if ( idRun == 0 || idRun == newrun->ID ) { |
| 345 |
// |
// |
| 346 |
if ( debug ) printf(" Updating run number %llu \n",idRun); |
if ( debug ) printf(" Updating run number %u \n",idRun); |
| 347 |
// |
// |
| 348 |
found = true; |
found = true; |
| 349 |
// |
// |
| 361 |
return(error); |
return(error); |
| 362 |
}; |
}; |
| 363 |
// |
// |
| 364 |
newrun->ID = ID; |
CopyFromTo((GL_RUN*)this,newrun,NULL,NULL); |
| 365 |
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; |
|
| 366 |
} else { |
} else { |
| 367 |
// |
// |
| 368 |
if ( !strcmp(Detector.Data(),"TRIG") ){ |
if ( !strcmp(Detector.Data(),"TRIG") ){ |
| 455 |
}; |
}; |
| 456 |
}; |
}; |
| 457 |
// |
// |
| 458 |
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); |
| 459 |
// |
// |
| 460 |
} else { |
} else { |
| 461 |
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); |
| 462 |
}; |
}; |
| 463 |
// |
// |
| 464 |
file->cd(); |
file->cd(); |
| 466 |
// |
// |
| 467 |
}; |
}; |
| 468 |
// |
// |
|
// temprfile->Close(); |
|
|
// gSystem->Unlink(temprname.str().c_str()); |
|
|
// if ( ismydir ) gSystem->Unlink(tempdir.str().c_str()); |
|
| 469 |
file->cd(); |
file->cd(); |
| 470 |
if ( oldtree ) oldtree->Delete("all"); |
if ( oldtree ) oldtree->Delete("all"); |
| 471 |
newtree->SetName("Run"); |
newtree->SetName("Run"); |
| 472 |
// file->Write("Run"); |
// |
|
// newtree->Delete(); |
|
| 473 |
delete newver; |
delete newver; |
| 474 |
delete newrun; |
delete newrun; |
| 475 |
delete oldver; |
delete oldver; |
| 476 |
delete oldrun; |
delete oldrun; |
| 477 |
// |
// |
| 478 |
if ( !found ){ |
if ( !found ){ |
| 479 |
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); |
| 480 |
return(-5); |
return(-5); |
| 481 |
}; |
}; |
| 482 |
// |
// |
| 485 |
return(0); |
return(0); |
| 486 |
} |
} |
| 487 |
|
|
| 488 |
Int_t ItoRunInfo::Read(ULong64_t idRun){ |
Int_t ItoRunInfo::Read(UInt_t idRun){ |
| 489 |
// |
// |
| 490 |
isreadonly = true; |
isreadonly = true; |
| 491 |
// |
// |
| 512 |
// |
// |
| 513 |
totnorun = newtree->GetEntries(); |
totnorun = newtree->GetEntries(); |
| 514 |
// |
// |
| 515 |
runlist = new TArrayL((Int_t)totnorun); |
if ( totnorun > 500 ){ |
| 516 |
|
if ( debug ) printf("\n RUNINFO - ERROR: can not handle more than 500 runs!\n"); |
| 517 |
|
return(-806); |
| 518 |
|
}; |
| 519 |
// |
// |
| 520 |
first_file_entry = 0; |
first_file_entry = 0; |
| 521 |
// |
// |
| 523 |
// |
// |
| 524 |
newtree->GetEntry(run); |
newtree->GetEntry(run); |
| 525 |
// |
// |
| 526 |
file_entries += (newrun->EV_REG_PHYS_TO - newrun->EV_REG_PHYS_FROM + 1); |
file_entries += (newrun->EV_TO - newrun->EV_FROM + 1); |
| 527 |
// |
// |
| 528 |
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); |
| 529 |
// |
// |
| 530 |
ID = newrun->ID; |
CopyFromTo(newrun,(GL_RUN*)this,newver,version); |
| 531 |
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 ){ |
|
| 532 |
runlist->AddAt(newrun->ID,norun); |
runlist->AddAt(newrun->ID,norun); |
| 533 |
norun++; |
norun++; |
| 534 |
}; |
}; |
| 535 |
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); |
| 536 |
}; |
}; |
| 537 |
}; |
}; |
| 538 |
if ( debug ) printf("norun %i \n",(int)norun); |
if ( debug ) printf("norun %i \n",(int)norun); |
| 549 |
updating = false; |
updating = false; |
| 550 |
first_file_entry = 0; |
first_file_entry = 0; |
| 551 |
last_file_entry = 0; |
last_file_entry = 0; |
| 552 |
file_entries = 0ULL; |
file_entries = 0; |
| 553 |
norun = 0; |
norun = 0; |
| 554 |
runlist = new TArrayL(0,NULL); |
delete runlist; |
| 555 |
file = new TFile(); |
file = new TFile(); |
| 556 |
if ( isreadonly ) newtree->Delete(); |
if ( isreadonly ) newtree->Delete(); |
| 557 |
} |
} |
| 568 |
// |
// |
| 569 |
if ( entry > (UInt_t)last_file_entry ){ |
if ( entry > (UInt_t)last_file_entry ){ |
| 570 |
for ( UInt_t nrun = 0; nrun < norun; nrun++){ |
for ( UInt_t nrun = 0; nrun < norun; nrun++){ |
| 571 |
if ( ID == (ULong64_t)runlist->At(nrun) ) { |
if ( ID == (UInt_t)runlist->At(nrun) ) { |
| 572 |
startfrom = nrun+1; |
startfrom = nrun+1; |
| 573 |
break; |
break; |
| 574 |
}; |
}; |
| 582 |
retry: |
retry: |
| 583 |
// |
// |
| 584 |
for ( UInt_t nrun = startfrom; nrun < norun; nrun++){ |
for ( UInt_t nrun = startfrom; nrun < norun; nrun++){ |
| 585 |
GetRunInfo((ULong64_t)runlist->At(nrun)); |
GetRunInfo((UInt_t)runlist->At(nrun)); |
| 586 |
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 ){ |
| 587 |
return((UInt_t)runlist->At(nrun)); |
return((UInt_t)runlist->At(nrun)); |
| 588 |
}; |
}; |
| 595 |
return(0); |
return(0); |
| 596 |
} |
} |
| 597 |
|
|
| 598 |
Int_t ItoRunInfo::GetRunInfo(ULong64_t run){ |
Int_t ItoRunInfo::GetRunInfo(UInt_t run){ |
| 599 |
Bool_t found = false; |
Bool_t found = false; |
| 600 |
SoftInfo *nwver = new SoftInfo(); |
SoftInfo *nwver = new SoftInfo(); |
| 601 |
GL_RUN *nwrun = new GL_RUN(); |
GL_RUN *nwrun = new GL_RUN(); |
| 611 |
for ( UInt_t nrun = 0; nrun < totnorun; nrun++){ |
for ( UInt_t nrun = 0; nrun < totnorun; nrun++){ |
| 612 |
newtree->GetEntry(nrun); |
newtree->GetEntry(nrun); |
| 613 |
// |
// |
| 614 |
if ( nwrun->ID == run || run == 0ULL ){ |
if ( nwrun->ID == run || run == 0 ){ |
| 615 |
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; |
|
| 616 |
found = true; |
found = true; |
| 617 |
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); |
| 618 |
}; |
}; |
| 619 |
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); |
| 620 |
}; |
}; |
| 621 |
delete nwver; |
delete nwver; |
| 622 |
delete nwrun; |
delete nwrun; |