49 |
*/ |
*/ |
50 |
Bool_t TrkParams::SetCalib( GL_RUN *glrun, TSQLServer* dbc ){ |
Bool_t TrkParams::SetCalib( GL_RUN *glrun, TSQLServer* dbc ){ |
51 |
|
|
52 |
GL_TRK_CALIB q2; |
if( !CalibIsLoaded() || |
53 |
GL_ROOT q3; |
(glrun->TRK_CALIB_USED==104 && !calib104) || |
54 |
GL_PARAM q4; |
(glrun->TRK_CALIB_USED!=104 && calib104) || |
55 |
|
glrun->RUNHEADER_TIME < calib.FROM_TIME || |
56 |
if( q2.Query_GL_TRK_CALIB(glrun->RUNHEADER_TIME,dbc) )return false; |
glrun->RUNHEADER_TIME > calib.TO_TIME || |
57 |
if(q2.EV_ROOT_CALIBTRK1 != q2.EV_ROOT_CALIBTRK2) |
false ){ |
58 |
printf("WARNING!! ---> EV_ROOT_CALIBTRK1=%d it's different from EV_ROOT_CALIBTRK2=%d \n\n",q2.EV_ROOT_CALIBTRK1,q2.EV_ROOT_CALIBTRK2); |
|
59 |
if( q3.Query_GL_ROOT(q2.ID_ROOT_L0,dbc) )return false; |
GL_TRK_CALIB q2; |
60 |
|
GL_ROOT q3; |
61 |
calib = q2; |
GL_PARAM q4; |
62 |
calibpathf = q3.PATH + q3.NAME; |
|
63 |
calib104 = (glrun->TRK_CALIB_USED==104); |
cout << " UPDATING calibration -- run-header time "<< glrun->RUNHEADER_TIME <<endl; |
64 |
calibload = kFALSE; |
if( q2.Query_GL_TRK_CALIB(glrun->RUNHEADER_TIME,dbc) ){ |
65 |
if(calib104){ |
cout << "Bool_t TrkParams::SetCalib( GL_RUN* , TSQLServer* ) -- ERROR -- failed query to GL_TRK_CALIB "<<endl; |
66 |
if (q4.Query_GL_PARAM(glrun->RUNHEADER_TIME,7,dbc) )return false; |
return false; |
67 |
calibpatht = q4.PATH + q4.NAME; |
} |
68 |
} |
if( q2.EV_ROOT_CALIBTRK1 != q2.EV_ROOT_CALIBTRK2 ) |
69 |
|
printf("WARNING!! ---> EV_ROOT_CALIBTRK1=%d it's different from EV_ROOT_CALIBTRK2=%d \n\n",q2.EV_ROOT_CALIBTRK1,q2.EV_ROOT_CALIBTRK2); |
70 |
|
if( q3.Query_GL_ROOT(q2.ID_ROOT_L0,dbc) ){ |
71 |
|
cout << "Bool_t TrkParams::SetCalib( GL_RUN* , TSQLServer* ) -- ERROR -- failed query to GL_ROOT "<<endl; |
72 |
|
return false; |
73 |
|
} |
74 |
|
|
75 |
|
// cout << "selected "<<q2.ID<<" from_time "<<q2.FROM_TIME<<" to time "<<q2.TO_TIME<<endl; |
76 |
|
calib = q2; |
77 |
|
calibpathf = q3.PATH + q3.NAME; |
78 |
|
calib104 = (glrun->TRK_CALIB_USED==104); |
79 |
|
calibload = kFALSE; |
80 |
|
if(calib104){ |
81 |
|
if (q4.Query_GL_PARAM(glrun->RUNHEADER_TIME,7,dbc) )return false; |
82 |
|
calibpatht = q4.PATH + q4.NAME; |
83 |
|
} |
84 |
|
|
85 |
|
|
86 |
// return TrkParams::LoadCalib(); |
// return TrkParams::LoadCalib(); |
87 |
return true; |
return true; |
88 |
|
} |
89 |
|
|
90 |
|
return false; |
91 |
}; |
}; |
92 |
|
|
93 |
/** |
/** |
290 |
|
|
291 |
}; |
}; |
292 |
|
|
293 |
|
// Bool_t TrkParams::CalibIsLoaded(UInt_t time){ |
294 |
|
|
295 |
|
// if( !calibload ) return false; |
296 |
|
|
297 |
|
// }; |
298 |
|
|
299 |
|
|
300 |
/** |
/** |
301 |
* Static method to load calibration. |
* Static method to load calibration. |
302 |
* Calibration is loaded ONLY IF TrkParams::CalibLoaded()==kTRUE, which appens the |
* Calibration is loaded ONLY IF TrkParams::CalibLoaded()==kTRUE, which appens the |
356 |
// ca->FillTCalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
// ca->FillTCalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
357 |
TrkParams::FillTCalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
TrkParams::FillTCalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
358 |
}; |
}; |
359 |
for(int i=0; i<12; i++) cout << " DSP "<< i << " "<< pedsigbad_.pedestal_t[64][12][i] << endl; |
// for(int i=0; i<12; i++) cout << " DSP "<< i << " "<< pedsigbad_.pedestal_t[64][12][i] << endl; |
360 |
f0_c->Close(); |
f0_c->Close(); |
361 |
// delete f0_c; |
// delete f0_c; |
362 |
cout << "--------------------------------------"<<endl; |
cout << "--------------------------------------"<<endl; |
545 |
if ( !TrkParams::Set(0,dbc) )return false; |
if ( !TrkParams::Set(0,dbc) )return false; |
546 |
dbc->Close(); |
dbc->Close(); |
547 |
}else for(Int_t i=0; i<NTYPES; i++)if ( !TrkParams::Set(trkparamtype[i])) return false; |
}else for(Int_t i=0; i<NTYPES; i++)if ( !TrkParams::Set(trkparamtype[i])) return false; |
548 |
|
|
549 |
|
return true; |
550 |
} |
} |
551 |
|
|
552 |
/** |
/** |