72 |
// |
// |
73 |
GL_S4_CALIB *glS4calib = new GL_S4_CALIB(); |
GL_S4_CALIB *glS4calib = new GL_S4_CALIB(); |
74 |
// |
// |
75 |
|
if ( !dbc->IsConnected() ) throw -504; |
76 |
glS4calib->Query_GL_S4_CALIB(atime, dbc); |
glS4calib->Query_GL_S4_CALIB(atime, dbc); |
77 |
// |
// |
78 |
GL_ROOT *glroot = new GL_ROOT(); |
GL_ROOT *glroot = new GL_ROOT(); |
79 |
|
if ( !dbc->IsConnected() ) throw -504; |
80 |
glroot->Query_GL_ROOT(glS4calib->ID_ROOT_L0,dbc); |
glroot->Query_GL_ROOT(glS4calib->ID_ROOT_L0,dbc); |
81 |
// |
// |
82 |
stringstream ftmpname; |
stringstream ftmpname; |
198 |
// |
// |
199 |
// variables needed to reprocess data |
// variables needed to reprocess data |
200 |
// |
// |
201 |
|
Long64_t maxsize = 10000000000LL; |
202 |
|
TTree::SetMaxTreeSize(maxsize); |
203 |
|
// |
204 |
TString S4version; |
TString S4version; |
205 |
ItoRunInfo *runinfo = 0; |
ItoRunInfo *runinfo = 0; |
206 |
TArrayI *runlist = 0; |
TArrayI *runlist = 0; |
346 |
// |
// |
347 |
// tree exists, we are reprocessing data. Are we reprocessing a single run or all the file? |
// tree exists, we are reprocessing data. Are we reprocessing a single run or all the file? |
348 |
// |
// |
349 |
|
S4trclone->SetAutoSave(900000000000000LL); |
350 |
reproc = true; |
reproc = true; |
351 |
// |
// |
352 |
// update versioning information |
// update versioning information |
391 |
// |
// |
392 |
file->cd(); |
file->cd(); |
393 |
S4tr = new TTree("S4-new","PAMELA Level2 S4 data"); |
S4tr = new TTree("S4-new","PAMELA Level2 S4 data"); |
394 |
|
S4tr->SetAutoSave(900000000000000LL); |
395 |
S4tr->Branch("S4Level2","S4Level2",&s4); |
S4tr->Branch("S4Level2","S4Level2",&s4); |
396 |
// |
// |
397 |
if ( reproc && !reprocall ){ |
if ( reproc && !reprocall ){ |
400 |
// |
// |
401 |
tempfile = new TFile(tempname.str().c_str(),"READ"); |
tempfile = new TFile(tempname.str().c_str(),"READ"); |
402 |
S4trclone = (TTree*)tempfile->Get("S4-old"); |
S4trclone = (TTree*)tempfile->Get("S4-old"); |
403 |
|
S4trclone->SetAutoSave(900000000000000LL); |
404 |
S4trclone->SetBranchAddress("S4Level2",&s4clone); |
S4trclone->SetBranchAddress("S4Level2",&s4clone); |
405 |
// |
// |
406 |
if ( nobefrun > 0 ){ |
if ( nobefrun > 0 ){ |
469 |
// |
// |
470 |
// prepare the timesync for the db |
// prepare the timesync for the db |
471 |
// |
// |
472 |
|
if ( !dbc->IsConnected() ) throw -504; |
473 |
dbtime = new GL_TIMESYNC(runinfo->ID_ROOT_L0,"ID",dbc); |
dbtime = new GL_TIMESYNC(runinfo->ID_ROOT_L0,"ID",dbc); |
474 |
// |
// |
475 |
// Search in the DB the path and name of the LEVEL0 file to be processed. |
// Search in the DB the path and name of the LEVEL0 file to be processed. |
476 |
// |
// |
477 |
|
if ( !dbc->IsConnected() ) throw -504; |
478 |
glroot->Query_GL_ROOT(runinfo->ID_ROOT_L0,dbc); |
glroot->Query_GL_ROOT(runinfo->ID_ROOT_L0,dbc); |
479 |
// |
// |
480 |
ftmpname.str(""); |
ftmpname.str(""); |
583 |
// |
// |
584 |
s4->Clear(); |
s4->Clear(); |
585 |
l0S4->GetEntry(re); |
l0S4->GetEntry(re); |
586 |
if (l0s4e->unpackError == 1) continue; |
if (l0s4e->unpackError == 0){ |
587 |
s4->S4adc = l0s4e->S4_DATA; |
s4->S4adc = l0s4e->S4_DATA; |
588 |
|
// |
589 |
|
if ((l0s4e->S4_DATA) > 31 ){ |
590 |
|
s4->S4calibrated = ParamFit0*((l0s4e->S4_DATA)-32)+ParamFit1; |
591 |
|
}else{ |
592 |
|
s4->S4calibrated = 0; |
593 |
|
} |
594 |
|
}; |
595 |
// |
// |
596 |
if ((l0s4e->S4_DATA) > 31 ){ |
s4->unpackError = l0s4e->unpackError; |
|
s4->S4calibrated = ParamFit0*((l0s4e->S4_DATA)-32)+ParamFit1; |
|
|
}else{ |
|
|
s4->S4calibrated = 0; |
|
|
} |
|
597 |
// |
// |
598 |
S4tr->Fill(); |
S4tr->Fill(); |
599 |
// |
// |