20 |
GL_PARAM TrkParams::gl[] = {GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM()}; |
GL_PARAM TrkParams::gl[] = {GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM(),GL_PARAM()}; |
21 |
TString TrkParams::glpath[] = {"","","","","","",""}; |
TString TrkParams::glpath[] = {"","","","","","",""}; |
22 |
Bool_t TrkParams::glload[] = {false,false,false,false,false,false,false}; |
Bool_t TrkParams::glload[] = {false,false,false,false,false,false,false}; |
23 |
|
cDbg TrkParams::dbg_mode = {0,0,0}; |
24 |
|
|
25 |
TrkParams::TrkParams(){ |
TrkParams::TrkParams(){ |
26 |
|
|
27 |
cout<<"TrkParams::TrkParams()"<<endl; |
// cout<<"TrkParams::TrkParams()"<<endl; |
28 |
|
|
29 |
} |
} |
30 |
float aint(float f){ |
float aint(float f){ |
50 |
*/ |
*/ |
51 |
Bool_t TrkParams::SetCalib( GL_RUN *glrun, TSQLServer* dbc ){ |
Bool_t TrkParams::SetCalib( GL_RUN *glrun, TSQLServer* dbc ){ |
52 |
|
|
53 |
|
// cout << "glrun-> RUNHEADER_TIME "<<glrun->RUNHEADER_TIME <<endl; |
54 |
|
|
55 |
if( !CalibIsLoaded() || |
if( !CalibIsLoaded() || |
56 |
(glrun->TRK_CALIB_USED==104 && !calib104) || |
(glrun->TRK_CALIB_USED==104 && !calib104) || |
57 |
(glrun->TRK_CALIB_USED!=104 && calib104) || |
(glrun->TRK_CALIB_USED!=104 && calib104) || |
63 |
GL_ROOT q3; |
GL_ROOT q3; |
64 |
GL_PARAM q4; |
GL_PARAM q4; |
65 |
|
|
66 |
cout << " UPDATING calibration -- run-header time "<< glrun->RUNHEADER_TIME <<endl; |
if(TrkParams::VerboseMode()){ |
67 |
|
cout << "--------------------------------------"<<endl; |
68 |
|
cout << "UPDATING calibration -- run-header time "<< glrun->RUNHEADER_TIME <<endl; |
69 |
|
} |
70 |
if( q2.Query_GL_TRK_CALIB(glrun->RUNHEADER_TIME,dbc) ){ |
if( q2.Query_GL_TRK_CALIB(glrun->RUNHEADER_TIME,dbc) ){ |
71 |
cout << "Bool_t TrkParams::SetCalib( GL_RUN* , TSQLServer* ) -- ERROR -- failed query to GL_TRK_CALIB "<<endl; |
cout << " Bool_t TrkParams::SetCalib( GL_RUN* , TSQLServer* ) -- ERROR -- failed query to GL_TRK_CALIB "<<endl; |
72 |
return false; |
return false; |
73 |
} |
} |
74 |
if( q2.EV_ROOT_CALIBTRK1 != q2.EV_ROOT_CALIBTRK2 ) |
if( q2.EV_ROOT_CALIBTRK1 != q2.EV_ROOT_CALIBTRK2 ) |
75 |
printf("WARNING!! ---> EV_ROOT_CALIBTRK1=%d it's different from EV_ROOT_CALIBTRK2=%d \n\n",q2.EV_ROOT_CALIBTRK1,q2.EV_ROOT_CALIBTRK2); |
printf(" WARNING!! ---> EV_ROOT_CALIBTRK1=%d it's different from EV_ROOT_CALIBTRK2=%d \n\n",q2.EV_ROOT_CALIBTRK1,q2.EV_ROOT_CALIBTRK2); |
76 |
if( q3.Query_GL_ROOT(q2.ID_ROOT_L0,dbc) ){ |
if( q3.Query_GL_ROOT(q2.ID_ROOT_L0,dbc) ){ |
77 |
cout << "Bool_t TrkParams::SetCalib( GL_RUN* , TSQLServer* ) -- ERROR -- failed query to GL_ROOT "<<endl; |
cout << " Bool_t TrkParams::SetCalib( GL_RUN* , TSQLServer* ) -- ERROR -- failed query to GL_ROOT "<<endl; |
78 |
return false; |
return false; |
79 |
} |
} |
80 |
|
|
81 |
// cout << "selected "<<q2.ID<<" from_time "<<q2.FROM_TIME<<" to time "<<q2.TO_TIME<<endl; |
if(TrkParams::VerboseMode())cout << "selected DB entry "<<q2.ID<<" from_time "<<q2.FROM_TIME<<" to time "<<q2.TO_TIME<<" --> VALIDATION "<<q2.VALIDATION<<endl; |
82 |
calib = q2; |
calib = q2; |
83 |
calibpathf = q3.PATH + q3.NAME; |
calibpathf = q3.PATH + q3.NAME; |
84 |
calib104 = (glrun->TRK_CALIB_USED==104); |
calib104 = (glrun->TRK_CALIB_USED==104); |
97 |
}; |
}; |
98 |
|
|
99 |
/** |
/** |
100 |
|
* Method to "validate" tracker calibration. Implemented for test purpose. Effective implementation |
101 |
|
* in YodaProfiler. |
102 |
|
*/ |
103 |
|
UInt_t TrkParams::ValidateTrkCalib( CalibTrk1Event* caltrk){ |
104 |
|
|
105 |
|
Int_t vorder[]={5,5,3,3,4,4,2,2,1,1,0,0}; |
106 |
|
// UInt_t timeaftercalib=120000; //2000; |
107 |
|
TString classname = caltrk->GetName(); |
108 |
|
// ---------- |
109 |
|
// Check CRCs |
110 |
|
// ---------- |
111 |
|
if(TrkParams::VerboseMode())cout << " DSP: "; |
112 |
|
for(Int_t ipkt=0; ipkt<6; ipkt++){ |
113 |
|
if(TrkParams::VerboseMode())cout <<" "<<caltrk->DSPnumber[ipkt]; |
114 |
|
if(caltrk->DSPnumber[ipkt]>0 && caltrk->DSPnumber[ipkt]<=12){ |
115 |
|
if( caltrk->crc_hcal[ipkt] ){ |
116 |
|
if(TrkParams::WarningMode())cout<<"(CRC Header)"; |
117 |
|
// if(TrkParams::WarningMode())cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- CRC error in calibration header: pkt "<<ipkt<<endl; |
118 |
|
// return 0; // :-( |
119 |
|
} |
120 |
|
for(Int_t ilad=0; ilad<3; ilad++)if( caltrk->crc_cal[ipkt][ilad] ){ |
121 |
|
if(TrkParams::WarningMode())cout<<"(CRC Pkt-"<<ilad<<")"; |
122 |
|
// if(TrkParams::WarningMode())cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- CRC error in calibration packet: pkt "<<ipkt<<endl; |
123 |
|
// return 0; // :-( |
124 |
|
} |
125 |
|
} |
126 |
|
} |
127 |
|
if(TrkParams::VerboseMode())cout << endl;; |
128 |
|
// ----------------------- |
129 |
|
// Check missing packets: |
130 |
|
// ----------------------- |
131 |
|
// Readout order: |
132 |
|
// ------------------ |
133 |
|
// DSP packet board |
134 |
|
// ------------------ |
135 |
|
// 12 0 1 |
136 |
|
// 10 1 1 |
137 |
|
// 8 2 1 |
138 |
|
// 4 3 1 |
139 |
|
// 6 4 1 |
140 |
|
// 2 5 1 |
141 |
|
// ------------------ |
142 |
|
// 11 0 2 |
143 |
|
// 9 1 2 |
144 |
|
// 7 2 2 |
145 |
|
// 3 3 2 |
146 |
|
// 5 4 2 |
147 |
|
// 1 5 2 |
148 |
|
// ------------------ |
149 |
|
// ------------------------------------------------- |
150 |
|
// Check if it is first or second calibration packet |
151 |
|
// ------------------------------------------------- |
152 |
|
UInt_t build=0; |
153 |
|
UInt_t base=0; |
154 |
|
UInt_t mask=0; |
155 |
|
if(classname.Contains("CalibTrk1Event")){ |
156 |
|
base=12; |
157 |
|
mask=0x03F000; |
158 |
|
} |
159 |
|
if(classname.Contains("CalibTrk2Event")){ |
160 |
|
base=18; |
161 |
|
mask=0xFC0000; |
162 |
|
} |
163 |
|
// ------------------------------------------------- |
164 |
|
// Count number of packets and set build variable |
165 |
|
// ------------------------------------------------- |
166 |
|
Int_t npkts=0; |
167 |
|
for(Int_t ipkt=0; ipkt<6; ipkt++){ |
168 |
|
if(caltrk->DSPnumber[ipkt]>0 && caltrk->DSPnumber[ipkt]<=12){ |
169 |
|
npkts++; |
170 |
|
build = build | ( 1<<(base+vorder[caltrk->DSPnumber[ipkt]-1]) ); |
171 |
|
}; |
172 |
|
} |
173 |
|
if( npkts==6 )return 1; // :-) |
174 |
|
else { |
175 |
|
if(TrkParams::WarningMode())cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- there might be some missing packets :-( ( "<<npkts<<" instead of 6 ) --> "<<endl; |
176 |
|
} |
177 |
|
// cout << classname << " "<<eh->GetPscuHeader()->GetOrbitalTime()<<endl; |
178 |
|
|
179 |
|
// ----------------------------------------------- |
180 |
|
// If missing packets: check the acq configuration |
181 |
|
// (some DSPs might be excluded from acquisition) |
182 |
|
// ----------------------------------------------- |
183 |
|
|
184 |
|
// ----------------------------------------------- |
185 |
|
// retrieve the first run header after calib |
186 |
|
// ----------------------------------------------- |
187 |
|
// PacketType *pctp; |
188 |
|
// EventCounter *cod; |
189 |
|
// cod = eh->GetCounter(); |
190 |
|
// Int_t irun = cod->Get(pctp->RunHeader); |
191 |
|
// TTree *rh=(TTree*)file->Get("RunHeader"); |
192 |
|
// if ( !rh || rh->IsZombie() ) throw -17; |
193 |
|
// if( rh->GetEntries() == irun ){ |
194 |
|
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) no runs after calib (1) -- cannot validate :-( "<<endl; |
195 |
|
// return 0; // :-( |
196 |
|
// } |
197 |
|
|
198 |
|
// RunHeaderEvent *run = 0; |
199 |
|
// EventHeader *hrun = 0; |
200 |
|
// rh->SetBranchAddress("RunHeader", &run); |
201 |
|
// rh->SetBranchAddress("Header", &hrun); |
202 |
|
// rh->GetEntry(irun); |
203 |
|
// // cout << classname << " "<<eh->GetPscuHeader()->GetOrbitalTime() << " Run " << hrun->GetPscuHeader()->GetOrbitalTime() <<endl; |
204 |
|
|
205 |
|
// if( OBT(hrun->GetPscuHeader()->GetOrbitalTime()) < OBT(eh->GetPscuHeader()->GetOrbitalTime())){ |
206 |
|
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) no runs after calib (2) -- cannot validate :-( "<<endl; |
207 |
|
// return 0; // :-( |
208 |
|
// } |
209 |
|
|
210 |
|
// if( !run->RM_ACQ_AFTER_CALIB ){ |
211 |
|
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) RM_ACQ_AFTER_CALIB=0 -- cannot validate :-( "<<endl; |
212 |
|
// return 0; // :-( |
213 |
|
// } |
214 |
|
|
215 |
|
// UInt_t dtime = OBT(hrun->GetPscuHeader()->GetOrbitalTime()) - OBT(eh->GetPscuHeader()->GetOrbitalTime()); |
216 |
|
// if( dtime > timeaftercalib ){ |
217 |
|
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) run after calib too far ( "<<dtime<<"ms ) -- cannot validate :-( "<<endl; |
218 |
|
// return 0; // :-( |
219 |
|
// } |
220 |
|
|
221 |
|
// if( (run->ACQ_BUILD_INFO & mask) != build ){ |
222 |
|
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) ACQ_BUILD_INFO= >>> "<<hex << (run->ACQ_BUILD_INFO&mask) << " != "<< build << dec<<endl; |
223 |
|
// return 0; // :-( |
224 |
|
// } |
225 |
|
return 1; // :-) |
226 |
|
|
227 |
|
} |
228 |
|
/** |
229 |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
230 |
*/ |
*/ |
231 |
void TrkParams::FillACalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
void TrkParams::FillACalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
242 |
tr1->GetEntry(ev_reg1); |
tr1->GetEntry(ev_reg1); |
243 |
tr2->GetEntry(ev_reg2); |
tr2->GetEntry(ev_reg2); |
244 |
Int_t dspn1(0),dspn2(0); |
Int_t dspn1(0),dspn2(0); |
245 |
|
|
246 |
|
// --- TEST TEST TEST TEST --- // |
247 |
|
TrkParams::ValidateTrkCalib(calibdata1); |
248 |
|
TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
249 |
|
|
250 |
for(Int_t i=0;i<6;i++){ |
for(Int_t i=0;i<6;i++){ |
251 |
dspn1=calibdata1->DSPnumber[i]-1; |
dspn1=calibdata1->DSPnumber[i]-1; |
301 |
tr1->GetEntry(ev_reg1); |
tr1->GetEntry(ev_reg1); |
302 |
tr2->GetEntry(ev_reg2); |
tr2->GetEntry(ev_reg2); |
303 |
Int_t dspn1(0),dspn2(0); |
Int_t dspn1(0),dspn2(0); |
304 |
|
|
305 |
|
// --- TEST TEST TEST TEST --- // |
306 |
|
TrkParams::ValidateTrkCalib(calibdata1); |
307 |
|
TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
308 |
|
|
309 |
for(Int_t i=0;i<6;i++){ |
for(Int_t i=0;i<6;i++){ |
310 |
dspn1=calibdata1->DSPnumber[i]-1; |
dspn1=calibdata1->DSPnumber[i]-1; |
357 |
tr2->GetEntry(ev_reg2); |
tr2->GetEntry(ev_reg2); |
358 |
Int_t dspn1(0),dspn2(0); |
Int_t dspn1(0),dspn2(0); |
359 |
|
|
360 |
|
// --- TEST TEST TEST TEST --- // |
361 |
|
TrkParams::ValidateTrkCalib(calibdata1); |
362 |
|
TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
363 |
|
|
364 |
for(Int_t i=0;i<6;i++){ |
for(Int_t i=0;i<6;i++){ |
365 |
dspn1=calibdata1->DSPnumber[i]-1; |
dspn1=calibdata1->DSPnumber[i]-1; |
366 |
dspn2=calibdata2->DSPnumber[i]-1; |
dspn2=calibdata2->DSPnumber[i]-1; |
454 |
|
|
455 |
if( TrkParams::CalibIsLoaded() )return false; |
if( TrkParams::CalibIsLoaded() )return false; |
456 |
|
|
|
// cTrkCalib *ca = new cTrkCalib; //&pedsigbad_; |
|
|
|
|
|
// extern cTrkCalib pedsigbad_; |
|
|
// extern cTrkMask mask_; |
|
|
|
|
|
cout << "--------------------------------------"<<endl; |
|
|
cout << "Retrieve calibration (PED-SIG-BAD) ..."<<endl; |
|
457 |
// ============================================================= |
// ============================================================= |
458 |
// retrieve calibration file needed to reduce data |
// retrieve calibration file needed to reduce data |
459 |
// ============================================================= |
// ============================================================= |
460 |
// if run OBT is > last calibration "expiration date" |
// if run OBT is > last calibration "expiration date" |
461 |
// - search for new calibration packet |
// - search for new calibration packet |
462 |
// - load calibration parameters (full + truncated) |
// - load calibration parameters (full + truncated) |
463 |
cout << "Full pedestals for cluster finding:"; |
if(TrkParams::VerboseMode()){ |
464 |
cout << " >> Loading from LEVEL0 file: "<< calibpathf << endl; |
cout << "--------------------------------------"<<endl; |
465 |
|
cout << "Retrieve calibration (PED-SIG-BAD) ..."<<endl; |
466 |
|
cout << " Full pedestals for cluster finding:"; |
467 |
|
cout << " >> loading from LEVEL0 file: "<< calibpathf << endl; |
468 |
|
} |
469 |
FileStat_t t; |
FileStat_t t; |
470 |
if( gSystem->GetPathInfo(calibpathf.Data(),t) )return false; |
if( gSystem->GetPathInfo(calibpathf.Data(),t) )return false; |
471 |
|
|
472 |
TFile *f0_c = new TFile(calibpathf); |
bool alreadyopened = false; |
473 |
|
TFile *f0_c=0; |
474 |
|
f0_c = (TFile*)gROOT->GetListOfFiles()->FindObject(calibpathf); |
475 |
|
if(f0_c)alreadyopened=true; |
476 |
|
else f0_c = new TFile(calibpathf); |
477 |
if ( !f0_c ) return false; |
if ( !f0_c ) return false; |
478 |
cout << " calibration entries "<< calib.EV_ROOT_CALIBTRK1 << " " << calib.EV_ROOT_CALIBTRK2; |
|
479 |
cout << " (from time "<< calib.FROM_TIME <<" to time "<< calib.TO_TIME <<")"<<endl; |
if(TrkParams::VerboseMode()){ |
480 |
// ca->FillACalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
cout << " calibration entry "<< calib.EV_ROOT_CALIBTRK1 << " " << calib.EV_ROOT_CALIBTRK2; |
481 |
|
cout << " (from time "<< calib.FROM_TIME <<" to time "<< calib.TO_TIME <<")"<<endl; |
482 |
|
cout << " - full+truncated parameters "<<endl; |
483 |
|
} |
484 |
TrkParams::FillACalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
TrkParams::FillACalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
485 |
|
if(TrkParams::VerboseMode())cout << " - VK-mask "<<endl; |
486 |
TrkParams::FillMask(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
TrkParams::FillMask(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
|
// mask_.Set(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
|
|
// for(int i=0; i<12; i++) cout << " DSP "<< i << " "<< pedsigbad_.pedestal[64][12][i] << endl; |
|
487 |
|
|
|
// }; |
|
488 |
// ============================================================= |
// ============================================================= |
489 |
// retrieve calibration file needed to uncompress data |
// retrieve calibration file needed to uncompress data |
490 |
// ============================================================= |
// ============================================================= |
491 |
// if the run was compressed using default calib |
// if the run was compressed using default calib |
492 |
// load truncated pedestals from default |
// load truncated pedestals from default |
493 |
// otherwise reload them from on-line calibration |
// otherwise reload them from on-line calibration |
494 |
cout << "Truncated pedestals for uncompression:"; |
if(TrkParams::VerboseMode())cout << " Truncated pedestals for uncompression:"; |
495 |
if( calib104 ){ |
if( calib104 ){ |
496 |
|
|
497 |
cout << " >> Loading default calibration: "<< calibpatht << endl; |
if(TrkParams::VerboseMode())cout << " >> loading default calibration: "<< calibpatht << endl; |
|
// ca->FillTCalibFrom(calibpatht); |
|
498 |
TrkParams::FillTCalibFrom(calibpatht); |
TrkParams::FillTCalibFrom(calibpatht); |
499 |
|
|
500 |
}else{ |
}else{ |
501 |
|
|
502 |
if ( !f0_c ) return false; |
// if ( !f0_c ) return false; |
503 |
cout << ">> Loading on-line calibration " << endl; |
if(TrkParams::VerboseMode())cout << ">> already loaded " << endl; |
504 |
// ca->FillTCalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
// TrkParams::FillTCalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
|
TrkParams::FillTCalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
|
505 |
}; |
}; |
506 |
// for(int i=0; i<12; i++) cout << " DSP "<< i << " "<< pedsigbad_.pedestal_t[64][12][i] << endl; |
if(!alreadyopened)f0_c->Close(); |
507 |
f0_c->Close(); |
if(TrkParams::VerboseMode())cout << "--------------------------------------"<<endl; |
|
// delete f0_c; |
|
|
cout << "--------------------------------------"<<endl; |
|
508 |
|
|
509 |
calibload = kTRUE; |
calibload = kTRUE; |
510 |
return true; |
return true; |
528 |
*/ |
*/ |
529 |
Bool_t TrkParams::Set( GL_RUN* glrun , TSQLServer* dbc , UInt_t type){ |
Bool_t TrkParams::Set( GL_RUN* glrun , TSQLServer* dbc , UInt_t type){ |
530 |
|
|
|
// if( !dbc )return false; |
|
531 |
|
|
532 |
|
UInt_t index = TrkParams::GetIndex( type ); |
533 |
|
if(index < 0)return false; |
534 |
|
|
535 |
|
if( !TrkParams::IsLoaded(type) || |
536 |
|
glrun->RUNHEADER_TIME < gl[index].FROM_TIME || |
537 |
|
glrun->RUNHEADER_TIME > gl[index].TO_TIME || |
538 |
|
false ){ |
539 |
|
|
540 |
if( !dbc || (dbc && !dbc->IsConnected()) ){ |
if( !dbc || (dbc && !dbc->IsConnected()) ){ |
541 |
|
|
542 |
cout <<" Missing DB connection -- check PAMELA environment variables "<<endl; |
if(TrkParams::WarningMode())cout <<" Missing DB connection -- check PAMELA environment variables "<<endl; |
543 |
TString host = "mysql://localhost/pamelaprod"; |
TString host = "mysql://localhost/pamelaprod"; |
544 |
TString user = "anonymous"; |
TString user = "anonymous"; |
545 |
TString psw = ""; |
TString psw = ""; |
546 |
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
547 |
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
548 |
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
549 |
if ( !pamdbhost ) pamdbhost = ""; |
if ( !pamdbhost ) pamdbhost = ""; |
550 |
if ( !pamdbuser ) pamdbuser = ""; |
if ( !pamdbuser ) pamdbuser = ""; |
551 |
if ( !pamdbpsw ) pamdbpsw = ""; |
if ( !pamdbpsw ) pamdbpsw = ""; |
552 |
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
553 |
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
554 |
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
555 |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
if(TrkParams::VerboseMode()){ |
556 |
cout<<"Connecting to DB"<<endl; |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
557 |
cout<<"HOST "<<host<<endl; |
cout<<"Connecting to DB"<<endl; |
558 |
cout<<"USER "<<user<<endl; |
cout<<"HOST "<<host<<endl; |
559 |
cout<<"PSW "<<psw<<endl; |
cout<<"USER "<<user<<endl; |
560 |
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
cout<<"PSW "<<psw<<endl; |
561 |
if( !dbc )return false; |
} |
562 |
if( !dbc->IsConnected() )return false; |
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
563 |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
if( !dbc )return false; |
564 |
|
if( !dbc->IsConnected() )return false; |
565 |
|
if(TrkParams::VerboseMode()){ |
566 |
|
cout << " ...done"<<endl; |
567 |
|
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
568 |
|
} |
569 |
|
} |
570 |
|
|
|
} |
|
571 |
|
|
572 |
UInt_t index = TrkParams::GetIndex( type ); |
UInt_t runheadtime = numeric_limits<UInt_t>::max(); |
573 |
if(index < 0)return false; |
if(glrun)runheadtime = glrun->RUNHEADER_TIME; |
574 |
|
else cout <<"Missing run info -- taking last entry "<<endl; |
575 |
|
|
576 |
UInt_t runheadtime = numeric_limits<UInt_t>::max(); |
GL_PARAM q4; |
577 |
if(glrun)runheadtime = glrun->RUNHEADER_TIME; |
if( q4.Query_GL_PARAM(runheadtime,type,dbc) )return false; |
|
else cout <<"Missing run info -- taking last entry "<<endl; |
|
578 |
|
|
579 |
GL_PARAM q4; |
gl[index] = q4; |
580 |
if( q4.Query_GL_PARAM(runheadtime,type,dbc) )return false; |
glpath[index] = q4.PATH+q4.NAME; |
581 |
|
glload[index] = false; |
582 |
|
if(TrkParams::VerboseMode())cout << "<< set TrkParams type "<<type<<" >> (from DB) "<<endl; |
583 |
|
return true; |
584 |
|
|
585 |
gl[index] = q4; |
} |
586 |
glpath[index] = q4.PATH+q4.NAME; |
return false; |
|
glload[index] = false; |
|
|
cout << "<< set TrkParams type "<<type<<" >> (from DB) "<<endl; |
|
|
return true; |
|
|
// return TrkParams::Load(type); |
|
587 |
|
|
588 |
}; |
}; |
589 |
/** |
/** |
599 |
|
|
600 |
gl[index].TYPE= type; |
gl[index].TYPE= type; |
601 |
glpath[index] = path; |
glpath[index] = path; |
602 |
cout << "<< set TrkParams type "<<type<<" >> (from input) "<<endl; |
if(TrkParams::VerboseMode())cout << "<< set TrkParams type "<<type<<" >> (from input) "<<endl; |
603 |
glload[index] = false; |
glload[index] = false; |
604 |
|
|
605 |
// return TrkParams::Load(type); |
// return TrkParams::Load(type); |
658 |
|
|
659 |
} |
} |
660 |
|
|
661 |
cout << "<< set TrkParams type "<<type<<" (from env var PAM_CALIB) >>"<<endl; |
if(TrkParams::VerboseMode())cout << "<< set TrkParams type "<<type<<" (from env var PAM_CALIB) >>"<<endl; |
662 |
// return TrkParams::Load(type); |
// return TrkParams::Load(type); |
663 |
return true; |
return true; |
664 |
|
|
673 |
|
|
674 |
Bool_t connected = false; |
Bool_t connected = false; |
675 |
|
|
676 |
cout <<" Missing DB connection -- check PAMELA environment variables "<<endl; |
// cout <<" Missing DB connection -- check PAMELA environment variables "<<endl; |
677 |
TString host = "mysql://localhost/pamelaprod"; |
TString host = "mysql://localhost/pamelaprod"; |
678 |
TString user = "anonymous"; |
TString user = "anonymous"; |
679 |
TString psw = ""; |
TString psw = ""; |
686 |
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
687 |
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
688 |
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
689 |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
if(TrkParams::VerboseMode()){ |
690 |
cout<<"Connecting to DB"<<endl; |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
691 |
cout<<"HOST "<<host<<endl; |
cout<<"Connecting to DB"<<endl; |
692 |
cout<<"USER "<<user<<endl; |
cout<<"HOST "<<host<<endl; |
693 |
cout<<"PSW "<<psw<<endl; |
cout<<"USER "<<user<<endl; |
694 |
|
cout<<"PSW "<<psw<<endl; |
695 |
|
} |
696 |
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
697 |
if( dbc || dbc->IsConnected() )connected = true; |
if( dbc || dbc->IsConnected() )connected = true; |
698 |
else cout << " >> FAILED!!!"<<endl; |
else cout << " >> DB connection FAILED!!!"<<endl; |
699 |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
if(TrkParams::VerboseMode())cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
700 |
|
|
701 |
if(connected){ |
if(connected){ |
702 |
if ( !TrkParams::Set(0,dbc) )return false; |
if ( !TrkParams::Set(0,dbc) )return false; |
722 |
switch( type ){ |
switch( type ){ |
723 |
//------------------------------------------ |
//------------------------------------------ |
724 |
case 1: |
case 1: |
725 |
cout <<type<<" -- Loading magnetic field "<<glpath[index]<<endl; |
if(TrkParams::VerboseMode())cout <<type<<" -- Loading magnetic field "<<glpath[index]<<endl; |
726 |
strcpy(path_.path,glpath[index].Data()); |
strcpy(path_.path,glpath[index].Data()); |
727 |
path_.pathlen = glpath[index].Length(); |
path_.pathlen = glpath[index].Length(); |
728 |
path_.error = 0; |
path_.error = 0; |
732 |
break; |
break; |
733 |
//------------------------------------------ |
//------------------------------------------ |
734 |
case 2: |
case 2: |
735 |
cout <<type<<" -- Loading ADC-to-MIP conversion parameters "<<glpath[index]<<endl; |
if(TrkParams::VerboseMode())cout <<type<<" -- Loading ADC-to-MIP conversion parameters "<<glpath[index]<<endl; |
736 |
strcpy(path_.path,glpath[index].Data()); |
strcpy(path_.path,glpath[index].Data()); |
737 |
path_.pathlen = glpath[index].Length(); |
path_.pathlen = glpath[index].Length(); |
738 |
path_.error = 0; |
path_.error = 0; |
742 |
break; |
break; |
743 |
//------------------------------------------ |
//------------------------------------------ |
744 |
case 3: |
case 3: |
745 |
cout <<type<<" -- Loading charge-correlation parameters "<<glpath[index]<<endl; |
if(TrkParams::VerboseMode())cout <<type<<" -- Loading charge-correlation parameters "<<glpath[index]<<endl; |
746 |
strcpy(path_.path,glpath[index].Data()); |
strcpy(path_.path,glpath[index].Data()); |
747 |
path_.pathlen = glpath[index].Length(); |
path_.pathlen = glpath[index].Length(); |
748 |
path_.error = 0; |
path_.error = 0; |
752 |
break; |
break; |
753 |
//------------------------------------------ |
//------------------------------------------ |
754 |
case 4: |
case 4: |
755 |
cout <<type<<" -- Loading p.f.a. parameters "<<glpath[index]<<endl; |
if(TrkParams::VerboseMode())cout <<type<<" -- Loading p.f.a. parameters "<<glpath[index]<<endl; |
756 |
strcpy(path_.path,glpath[index].Data()); |
strcpy(path_.path,glpath[index].Data()); |
757 |
path_.pathlen = glpath[index].Length(); |
path_.pathlen = glpath[index].Length(); |
758 |
path_.error = 0; |
path_.error = 0; |
762 |
break; |
break; |
763 |
//------------------------------------------ |
//------------------------------------------ |
764 |
case 5: |
case 5: |
765 |
cout <<type<<" -- Loading alignment parameters "<<glpath[index]<<endl; |
if(TrkParams::VerboseMode())cout <<type<<" -- Loading alignment parameters "<<glpath[index]<<endl; |
766 |
strcpy(path_.path,glpath[index].Data()); |
strcpy(path_.path,glpath[index].Data()); |
767 |
path_.pathlen = glpath[index].Length(); |
path_.pathlen = glpath[index].Length(); |
768 |
path_.error = 0; |
path_.error = 0; |
772 |
break; |
break; |
773 |
//------------------------------------------ |
//------------------------------------------ |
774 |
case 6: |
case 6: |
775 |
cout <<type<<" -- Loading VK-mask parameters "<<glpath[index]<<endl; |
if(TrkParams::VerboseMode())cout <<type<<" -- Loading VK-mask parameters "<<glpath[index]<<endl; |
776 |
strcpy(path_.path,glpath[index].Data()); |
strcpy(path_.path,glpath[index].Data()); |
777 |
path_.pathlen = glpath[index].Length(); |
path_.pathlen = glpath[index].Length(); |
778 |
path_.error = 0; |
path_.error = 0; |
782 |
break; |
break; |
783 |
//------------------------------------------ |
//------------------------------------------ |
784 |
case 7: |
case 7: |
785 |
cout <<type<<" -- Loading default calibration "<<glpath[index]<<endl; |
if(TrkParams::VerboseMode())cout <<type<<" -- Loading default calibration "<<glpath[index]<<endl; |
786 |
strcpy(path_.path,glpath[index].Data()); |
strcpy(path_.path,glpath[index].Data()); |
787 |
path_.pathlen = glpath[index].Length(); |
path_.pathlen = glpath[index].Length(); |
788 |
path_.error = 0; |
path_.error = 0; |
789 |
// fillpedsigfromdefault_(); |
// fillpedsigfromdefault_(); |
790 |
cout << ">> not implemented <<"<<endl; |
if(TrkParams::VerboseMode())cout << ">> not implemented <<"<<endl; |
791 |
if(path_.error) return false; |
if(path_.error) return false; |
792 |
glload[index]=true; |
glload[index]=true; |
793 |
break; |
break; |
794 |
default: |
default: |
795 |
cout << " Bool_t TrkParams::Load(UInt_t type) -- type "<< type << "not yet implemented"<<endl; |
if(TrkParams::VerboseMode())cout << " Bool_t TrkParams::Load(UInt_t type) -- type "<< type << "not yet implemented"<<endl; |
796 |
return false; |
return false; |
797 |
}; |
}; |
798 |
|
|