5 |
|
|
6 |
#include <TrkParams.h> |
#include <TrkParams.h> |
7 |
#include <iostream> |
#include <iostream> |
8 |
|
#include <iomanip> |
9 |
using namespace std; |
using namespace std; |
10 |
|
|
11 |
|
|
17 |
TString TrkParams::calibpathf = ""; |
TString TrkParams::calibpathf = ""; |
18 |
Bool_t TrkParams::calib104 = 0; |
Bool_t TrkParams::calib104 = 0; |
19 |
Bool_t TrkParams::calibload = false; |
Bool_t TrkParams::calibload = false; |
20 |
|
// ------------------------- |
21 |
|
// PARAMETERS loaded from DB |
22 |
|
// ------------------------- |
23 |
UInt_t TrkParams::trkparamtype[] = {1,2,3,4,5,6,7}; |
UInt_t TrkParams::trkparamtype[] = {1,2,3,4,5,6,7}; |
24 |
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()}; |
25 |
TString TrkParams::glpath[] = {"","","","","","",""}; |
TString TrkParams::glpath[] = {"","","","","","",""}; |
26 |
Bool_t TrkParams::glload[] = {false,false,false,false,false,false,false}; |
Bool_t TrkParams::glload[] = {false,false,false,false,false,false,false}; |
27 |
cDbg TrkParams::dbg_mode = {0,0,0}; |
// ---------------- |
28 |
|
// other parameters |
29 |
|
// ---------------- |
30 |
|
cDbg TrkParams::init__dbg_mode = {0,0,0}; |
31 |
|
int TrkParams::init__pfa = 14;//COG4 |
32 |
|
int TrkParams::init__mini_trackmode = 0; |
33 |
|
int TrkParams::init__mini_istepmin = 5; //3; |
34 |
|
double TrkParams::init__mini_fact = 1.e4; //100.; |
35 |
|
float TrkParams::init__pfa_e234ax[] = {0.,10.,10.,15.,15.,90.}; |
36 |
|
float TrkParams::init__pfa_e234ay[] = {0.,20.,90.,90.,90.,90.}; |
37 |
|
|
38 |
TrkParams::TrkParams(){ |
TrkParams::TrkParams(){ |
39 |
|
|
40 |
// cout<<"TrkParams::TrkParams()"<<endl; |
cout<<"TrkParams::TrkParams()"<<endl; |
41 |
|
|
42 |
} |
} |
43 |
float aint(float f){ |
float aint(float f){ |
54 |
return ret1; |
return ret1; |
55 |
} |
} |
56 |
/** |
/** |
57 |
* Static method to set the calibration to be loaded. |
* \brief Static method to set the calibration to be loaded. |
58 |
|
|
59 |
* It retrieves the calibration associated to a given run, from |
* It retrieves the calibration associated to a given run, from |
60 |
* a given DB. It fills the F77 common. |
* a given DB. It fills the F77 common. |
72 |
glrun->RUNHEADER_TIME > calib.TO_TIME || |
glrun->RUNHEADER_TIME > calib.TO_TIME || |
73 |
false ){ |
false ){ |
74 |
|
|
75 |
|
// cout <<">>> isloaded? "<< CalibIsLoaded() << endl; |
76 |
|
// cout <<">>> trk_calib_used "<< glrun->TRK_CALIB_USED<<endl; |
77 |
|
// cout <<">>> 104 loaded? "<< calib104 <<endl; |
78 |
|
// cout <<">>> from time "<< calib.FROM_TIME<<endl; |
79 |
|
// cout <<">>> to time "<< calib.TO_TIME<<endl; |
80 |
|
// if( !dbc || (dbc && !dbc->IsConnected()) ){ |
81 |
|
|
82 |
|
// if(TrkParams::WarningMode())cout <<" Missing DB connection -- check PAMELA environment variables "<<endl; |
83 |
|
// TString host = "mysql://localhost/pamelaprod"; |
84 |
|
// TString user = "anonymous"; |
85 |
|
// TString psw = ""; |
86 |
|
// const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
87 |
|
// const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
88 |
|
// const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
89 |
|
// if ( !pamdbhost ) pamdbhost = ""; |
90 |
|
// if ( !pamdbuser ) pamdbuser = ""; |
91 |
|
// if ( !pamdbpsw ) pamdbpsw = ""; |
92 |
|
// if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
93 |
|
// if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
94 |
|
// if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
95 |
|
// if(TrkParams::VerboseMode()){ |
96 |
|
// cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
97 |
|
// cout<<"Connecting to DB"<<endl; |
98 |
|
// cout<<"HOST "<<host<<endl; |
99 |
|
// cout<<"USER "<<user<<endl; |
100 |
|
// cout<<"PSW "<<psw<<endl; |
101 |
|
// } |
102 |
|
// dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
103 |
|
// if( !dbc )return false; |
104 |
|
// if( !dbc->IsConnected() )return false; |
105 |
|
// if(TrkParams::VerboseMode()){ |
106 |
|
// cout << " ...done"<<endl; |
107 |
|
// cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
108 |
|
// } |
109 |
|
// } |
110 |
|
|
111 |
GL_TRK_CALIB q2; |
GL_TRK_CALIB q2; |
112 |
GL_ROOT q3; |
GL_ROOT q3; |
113 |
GL_PARAM q4; |
GL_PARAM q4; |
151 |
*/ |
*/ |
152 |
UInt_t TrkParams::ValidateTrkCalib( CalibTrk1Event* caltrk){ |
UInt_t TrkParams::ValidateTrkCalib( CalibTrk1Event* caltrk){ |
153 |
|
|
154 |
|
UInt_t validate = 1; |
155 |
Int_t vorder[]={5,5,3,3,4,4,2,2,1,1,0,0}; |
Int_t vorder[]={5,5,3,3,4,4,2,2,1,1,0,0}; |
156 |
// UInt_t timeaftercalib=120000; //2000; |
// UInt_t timeaftercalib=120000; //2000; |
157 |
TString classname = caltrk->GetName(); |
TString classname = caltrk->GetName(); |
160 |
// ---------- |
// ---------- |
161 |
if(TrkParams::VerboseMode())cout << " DSP: "; |
if(TrkParams::VerboseMode())cout << " DSP: "; |
162 |
for(Int_t ipkt=0; ipkt<6; ipkt++){ |
for(Int_t ipkt=0; ipkt<6; ipkt++){ |
163 |
cout <<" "<<caltrk->DSPnumber[ipkt]; |
if(TrkParams::VerboseMode())cout <<" "<<caltrk->DSPnumber[ipkt]; |
164 |
if(caltrk->DSPnumber[ipkt]>0 && caltrk->DSPnumber[ipkt]<=12){ |
if(caltrk->DSPnumber[ipkt]>0 && caltrk->DSPnumber[ipkt]<=12){ |
165 |
if( caltrk->crc_hcal[ipkt] ){ |
if( caltrk->crc_hcal[ipkt] ){ |
166 |
if(TrkParams::WarningMode())cout<<"(CRC Header)"; |
if(TrkParams::WarningMode())cout<<"(CRC Header)"; |
167 |
// if(TrkParams::WarningMode())cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- CRC error in calibration header: pkt "<<ipkt<<endl; |
// if(TrkParams::WarningMode())cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- CRC error in calibration header: pkt "<<ipkt<<endl; |
168 |
// return 0; // :-( |
// return 0; // :-( |
169 |
|
validate = 0; |
170 |
} |
} |
171 |
for(Int_t ilad=0; ilad<3; ilad++)if( caltrk->crc_cal[ipkt][ilad] ){ |
for(Int_t ilad=0; ilad<3; ilad++)if( caltrk->crc_cal[ipkt][ilad] ){ |
172 |
if(TrkParams::WarningMode())cout<<"(CRC Pkt-"<<ilad<<")"; |
if(TrkParams::WarningMode())cout<<"(CRC Pkt-"<<ilad<<")"; |
173 |
// if(TrkParams::WarningMode())cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- CRC error in calibration packet: pkt "<<ipkt<<endl; |
// if(TrkParams::WarningMode())cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- CRC error in calibration packet: pkt "<<ipkt<<endl; |
174 |
// return 0; // :-( |
// return 0; // :-( |
175 |
|
validate = 0; |
176 |
} |
} |
177 |
} |
} |
178 |
} |
} |
222 |
build = build | ( 1<<(base+vorder[caltrk->DSPnumber[ipkt]-1]) ); |
build = build | ( 1<<(base+vorder[caltrk->DSPnumber[ipkt]-1]) ); |
223 |
}; |
}; |
224 |
} |
} |
225 |
if( npkts==6 )return 1; // :-) |
if( npkts==6 ){}//return 1; // :-) |
226 |
else { |
else { |
227 |
if(TrkParams::WarningMode())cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- there might be some missing packets :-( ( "<<npkts<<" instead of 6 ) --> "<<endl; |
if(TrkParams::WarningMode())cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- there might be some missing packets :-( ( "<<npkts<<" instead of 6 ) --> "<<endl; |
228 |
|
validate = 0; |
229 |
} |
} |
230 |
// cout << classname << " "<<eh->GetPscuHeader()->GetOrbitalTime()<<endl; |
// cout << classname << " "<<eh->GetPscuHeader()->GetOrbitalTime()<<endl; |
231 |
|
|
275 |
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) ACQ_BUILD_INFO= >>> "<<hex << (run->ACQ_BUILD_INFO&mask) << " != "<< build << dec<<endl; |
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) ACQ_BUILD_INFO= >>> "<<hex << (run->ACQ_BUILD_INFO&mask) << " != "<< build << dec<<endl; |
276 |
// return 0; // :-( |
// return 0; // :-( |
277 |
// } |
// } |
278 |
return 1; // :-) |
|
279 |
|
// return 1; // :-) |
280 |
|
|
281 |
|
// cout << validate << endl; |
282 |
|
return validate; |
283 |
|
|
284 |
} |
} |
285 |
/** |
/** |
288 |
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){ |
289 |
|
|
290 |
cTrkCalib *ca = &pedsigbad_; |
cTrkCalib *ca = &pedsigbad_; |
291 |
|
ca->Reset(); |
292 |
|
|
293 |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
294 |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
302 |
Int_t dspn1(0),dspn2(0); |
Int_t dspn1(0),dspn2(0); |
303 |
|
|
304 |
// --- TEST TEST TEST TEST --- // |
// --- TEST TEST TEST TEST --- // |
305 |
TrkParams::ValidateTrkCalib(calibdata1); |
// TrkParams::ValidateTrkCalib(calibdata1); |
306 |
TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
// TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
307 |
|
|
308 |
|
UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1); |
309 |
|
UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
310 |
|
if( !test1 || !test2 ){ |
311 |
|
if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl; |
312 |
|
TrkParams::calib.VALIDATION = 0; |
313 |
|
} |
314 |
|
if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl; |
315 |
|
|
316 |
for(Int_t i=0;i<6;i++){ |
for(Int_t i=0;i<6;i++){ |
317 |
dspn1=calibdata1->DSPnumber[i]-1; |
dspn1=calibdata1->DSPnumber[i]-1; |
318 |
dspn2=calibdata2->DSPnumber[i]-1; |
dspn2=calibdata2->DSPnumber[i]-1; |
319 |
/* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
// cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; |
320 |
for(Int_t ii=0;ii<3072;ii++){ |
for(Int_t ii=0;ii<3072;ii++){ |
321 |
Int_t j=(ii/128); |
Int_t j=(ii/128); |
322 |
Int_t jj=ii-j*128; |
Int_t jj=ii-j*128; |
323 |
ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii]; |
if(dspn1>=0 && dspn1<12){ |
324 |
ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii]; |
ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii]; |
325 |
ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]); |
ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]); |
326 |
ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]); |
ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii]; |
327 |
ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii]; |
ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]); |
328 |
ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii]; |
if(calibdata1->DSPbad_par[i][ii]==0) |
329 |
ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]); |
ca->bad[jj][j][dspn1]=1; |
330 |
ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]); |
else if(calibdata1->DSPbad_par[i][ii]==1) |
331 |
// cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
ca->bad[jj][j][dspn1]=0; |
332 |
// cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
// cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
333 |
// cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
// cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
334 |
// cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
} |
335 |
|
|
336 |
// |
if(dspn2>=0 && dspn2<12){ |
337 |
// invert the bad |
ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii]; |
338 |
// |
ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]); |
339 |
if(calibdata1->DSPbad_par[i][ii]==0) |
ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii]; |
340 |
ca->bad[jj][j][dspn1]=1; |
ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]); |
341 |
else if(calibdata1->DSPbad_par[i][ii]==1) |
if(calibdata2->DSPbad_par[i][ii]==0) |
342 |
ca->bad[jj][j][dspn1]=0; |
ca->bad[jj][j][dspn2]=1; |
343 |
if(calibdata2->DSPbad_par[i][ii]==0) |
else if(calibdata2->DSPbad_par[i][ii]==1) |
344 |
ca->bad[jj][j][dspn2]=1; |
ca->bad[jj][j][dspn2]=0; |
345 |
else if(calibdata2->DSPbad_par[i][ii]==1) |
// cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
346 |
ca->bad[jj][j][dspn2]=0; |
// cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
347 |
|
} |
348 |
}; |
}; |
349 |
}; |
}; |
350 |
|
|
357 |
void TrkParams::FillFCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
void TrkParams::FillFCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
358 |
|
|
359 |
cTrkCalib *ca = &pedsigbad_; |
cTrkCalib *ca = &pedsigbad_; |
360 |
|
// ca->Reset(); |
361 |
|
|
362 |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
363 |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
371 |
Int_t dspn1(0),dspn2(0); |
Int_t dspn1(0),dspn2(0); |
372 |
|
|
373 |
// --- TEST TEST TEST TEST --- // |
// --- TEST TEST TEST TEST --- // |
374 |
TrkParams::ValidateTrkCalib(calibdata1); |
// TrkParams::ValidateTrkCalib(calibdata1); |
375 |
TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
// TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
376 |
|
UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1); |
377 |
|
UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
378 |
|
if( !test1 || !test2 ){ |
379 |
|
if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl; |
380 |
|
TrkParams::calib.VALIDATION = 0; |
381 |
|
} |
382 |
|
if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl; |
383 |
|
|
384 |
for(Int_t i=0;i<6;i++){ |
for(Int_t i=0;i<6;i++){ |
385 |
dspn1=calibdata1->DSPnumber[i]-1; |
dspn1=calibdata1->DSPnumber[i]-1; |
388 |
for(Int_t ii=0;ii<3072;ii++){ |
for(Int_t ii=0;ii<3072;ii++){ |
389 |
Int_t j=(ii/128); |
Int_t j=(ii/128); |
390 |
Int_t jj=ii-j*128; |
Int_t jj=ii-j*128; |
391 |
ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii]; |
if(dspn1>=0 && dspn1<12){ |
392 |
ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii]; |
ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii]; |
393 |
ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii]; |
ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii]; |
394 |
ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii]; |
if(calibdata1->DSPbad_par[i][ii]==0) |
395 |
// cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
ca->bad[jj][j][dspn1]=1; |
396 |
// cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
else if(calibdata1->DSPbad_par[i][ii]==1) |
397 |
// cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
ca->bad[jj][j][dspn1]=0; |
398 |
// cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
// cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
399 |
|
// cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
400 |
// |
} |
401 |
// invert the bad |
if(dspn2>=0 && dspn2<12){ |
402 |
// |
ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii]; |
403 |
if(calibdata1->DSPbad_par[i][ii]==0) |
ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii]; |
404 |
ca->bad[jj][j][dspn1]=1; |
if(calibdata2->DSPbad_par[i][ii]==0) |
405 |
else if(calibdata1->DSPbad_par[i][ii]==1) |
ca->bad[jj][j][dspn2]=1; |
406 |
ca->bad[jj][j][dspn1]=0; |
else if(calibdata2->DSPbad_par[i][ii]==1) |
407 |
if(calibdata2->DSPbad_par[i][ii]==0) |
ca->bad[jj][j][dspn2]=0; |
408 |
ca->bad[jj][j][dspn2]=1; |
// cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
409 |
else if(calibdata2->DSPbad_par[i][ii]==1) |
// cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
410 |
ca->bad[jj][j][dspn2]=0; |
} |
411 |
}; |
}; |
412 |
}; |
}; |
413 |
|
|
420 |
void TrkParams::FillTCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
void TrkParams::FillTCalibFrom(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
421 |
|
|
422 |
cTrkCalib *ca = &pedsigbad_; |
cTrkCalib *ca = &pedsigbad_; |
423 |
|
// ca->Reset(); |
424 |
|
|
425 |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
426 |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
434 |
Int_t dspn1(0),dspn2(0); |
Int_t dspn1(0),dspn2(0); |
435 |
|
|
436 |
// --- TEST TEST TEST TEST --- // |
// --- TEST TEST TEST TEST --- // |
437 |
TrkParams::ValidateTrkCalib(calibdata1); |
// TrkParams::ValidateTrkCalib(calibdata1); |
438 |
TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
// TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
439 |
|
UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1); |
440 |
|
UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
441 |
|
if( !test1 || !test2 ){ |
442 |
|
if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl; |
443 |
|
TrkParams::calib.VALIDATION = 0; |
444 |
|
} |
445 |
|
if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl; |
446 |
|
|
447 |
for(Int_t i=0;i<6;i++){ |
for(Int_t i=0;i<6;i++){ |
448 |
dspn1=calibdata1->DSPnumber[i]-1; |
dspn1=calibdata1->DSPnumber[i]-1; |
451 |
for(Int_t ii=0;ii<3072;ii++){ |
for(Int_t ii=0;ii<3072;ii++){ |
452 |
Int_t j=(ii/128); |
Int_t j=(ii/128); |
453 |
Int_t jj=ii-j*128; |
Int_t jj=ii-j*128; |
454 |
ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]); |
if(dspn1>=0 && dspn1<12){ |
455 |
ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]); |
ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]); |
456 |
ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]); |
ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]); |
457 |
ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]); |
} |
458 |
|
if(dspn2>=0 && dspn2<12){ |
459 |
|
ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]); |
460 |
|
ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]); |
461 |
|
} |
462 |
}; |
}; |
463 |
}; |
}; |
464 |
|
|
481 |
void TrkParams::FillMask(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
void TrkParams::FillMask(TFile* f0, Int_t ev_reg1, Int_t ev_reg2){ |
482 |
|
|
483 |
cTrkMask *ma = &mask_; |
cTrkMask *ma = &mask_; |
484 |
|
ma->Reset(); |
485 |
|
|
486 |
TrkCalib *calib = new TrkCalib(); |
TrkCalib *calib = new TrkCalib(); |
487 |
|
|
504 |
tr->GetEntry(ev_reg2); |
tr->GetEntry(ev_reg2); |
505 |
} |
} |
506 |
for(Int_t ipkt=0; ipkt<NPLANE; ipkt++){ |
for(Int_t ipkt=0; ipkt<NPLANE; ipkt++){ |
507 |
for(Int_t ivk=0; ivk<NVK; ivk++){ |
Int_t view = calib->GetView(ipkt); |
508 |
Int_t view = calib->GetView(ipkt); |
if( (view-1)>= 0 && (view-1)<12 ){ |
509 |
Float_t sigm = calib->GetMean("SIG-BAD",ipkt,ivk+1); |
for(Int_t ivk=0; ivk<NVK; ivk++){ |
510 |
Float_t sigmin = 0.; |
Float_t sigm = calib->GetMean("SIG-BAD",ipkt,ivk+1); |
511 |
if(view%2)sigmin = 6.5; |
Float_t sigmin = 0.; |
512 |
else sigmin = 2.5; |
if(view%2)sigmin = 6.5; |
513 |
Int_t mask = 1; |
else sigmin = 2.5; |
514 |
if( sigm<sigmin )mask = 0; |
Int_t mask = 1; |
515 |
|
if( sigm<sigmin )mask = 0; |
516 |
ma->mask_vk_run[ivk][view-1] = mask; |
ma->mask_vk_run[ivk][view-1] = mask; |
517 |
|
} |
518 |
// if(mask==0)cout<< " VIEW "<<view<<" VK "<<ivk+1<<" -- <SIG> "<<sigm<<" ---> MASKED!"<<endl; |
} |
|
} |
|
519 |
} |
} |
520 |
if(tr)tr->Delete(); |
if(tr)tr->Delete(); |
521 |
} |
} |
522 |
|
|
523 |
|
if(TrkParams::VerboseMode()){ |
524 |
|
for(Int_t iv=0; iv<NVIEW; iv++){ |
525 |
|
cout<<"view "<<setw(3)<<iv<<": "; |
526 |
|
for(Int_t ivk=0; ivk<NVK; ivk++)cout<<ma->mask_vk_run[ivk][iv]; |
527 |
|
cout << endl; |
528 |
|
} |
529 |
|
} |
530 |
|
|
531 |
if(calib)calib->Delete(); |
if(calib)calib->Delete(); |
532 |
|
|
533 |
}; |
}; |
540 |
|
|
541 |
|
|
542 |
/** |
/** |
543 |
* Static method to load calibration. |
* \brief Static method to load calibration. |
544 |
* Calibration is loaded ONLY IF TrkParams::CalibLoaded()==kTRUE, which appens the |
* Calibration is loaded ONLY IF TrkParams::CalibLoaded()==kTRUE, which appens after the method TrkParams::SetCalib(***) is called. |
|
* first time the method is called (but it does not work becouse I didn't set any |
|
|
* default calibration for the moment) or after the method TrkParams::SetCalib(***) is called. |
|
545 |
*/ |
*/ |
546 |
Bool_t TrkParams::LoadCalib( ){ |
Bool_t TrkParams::LoadCalib( ){ |
547 |
|
|
672 |
gl[index] = q4; |
gl[index] = q4; |
673 |
glpath[index] = q4.PATH+q4.NAME; |
glpath[index] = q4.PATH+q4.NAME; |
674 |
glload[index] = false; |
glload[index] = false; |
675 |
if(TrkParams::VerboseMode())cout << "<< set TrkParams type "<<type<<" >> (from DB) "<<endl; |
if(TrkParams::VerboseMode()) |
676 |
|
cout << "<< set TrkParams type "<<type<<" from DB << RUN "<<glrun->ID<<endl; |
677 |
return true; |
return true; |
678 |
|
|
679 |
} |
} |
693 |
|
|
694 |
gl[index].TYPE= type; |
gl[index].TYPE= type; |
695 |
glpath[index] = path; |
glpath[index] = path; |
696 |
if(TrkParams::VerboseMode())cout << "<< set TrkParams type "<<type<<" >> (from input) "<<endl; |
if(TrkParams::VerboseMode()) |
697 |
|
cout << "<< set TrkParams type "<<type<<" from path << "<<path<<endl; |
698 |
glload[index] = false; |
glload[index] = false; |
699 |
|
|
700 |
// return TrkParams::Load(type); |
// return TrkParams::Load(type); |
903 |
return true; |
return true; |
904 |
}; |
}; |
905 |
|
|
906 |
|
|
907 |
|
/** |
908 |
|
* Get BY (kGauss) |
909 |
|
* @param v (x,y,z) coordinates in cm |
910 |
|
*/ |
911 |
|
float TrkParams::GetBX(float* v){ |
912 |
|
TrkParams::Load(1); |
913 |
|
if( !TrkParams::IsLoaded(1) )return 0.; |
914 |
|
float b[3]; |
915 |
|
gufld_(v,b); |
916 |
|
return b[0]/10.; |
917 |
|
} |
918 |
|
/** |
919 |
|
* Get BY (kGauss) |
920 |
|
* @param v (x,y,z) coordinates in cm |
921 |
|
*/ |
922 |
|
float TrkParams::GetBY(float* v){ |
923 |
|
TrkParams::Load(1); |
924 |
|
if( !TrkParams::IsLoaded(1) )return 0.; |
925 |
|
float b[3]; |
926 |
|
gufld_(v,b); |
927 |
|
return b[1]/10.; |
928 |
|
} |
929 |
|
/** |
930 |
|
* Get BY (kGauss) |
931 |
|
* @param v (x,y,z) coordinates in cm |
932 |
|
*/ |
933 |
|
float TrkParams::GetBZ(float* v){ |
934 |
|
TrkParams::Load(1); |
935 |
|
if( !TrkParams::IsLoaded(1) )return 0.; |
936 |
|
float b[3]; |
937 |
|
gufld_(v,b); |
938 |
|
return b[2]/10.; |
939 |
|
} |
940 |
|
|
941 |
|
|
942 |
|
|
943 |
|
/** |
944 |
|
* \brief Set tracking mode (0=standard. 1=???) |
945 |
|
*/ |
946 |
|
void TrkParams::SetTrackingMode(int trackmode) { |
947 |
|
init__mini_trackmode = trackmode; |
948 |
|
SetTrackingMode(); |
949 |
|
}; |
950 |
|
/** |
951 |
|
* \brief Set fit-precision factor (typical value fact=100.) |
952 |
|
*/ |
953 |
|
void TrkParams::SetPrecisionFactor(double fact){ |
954 |
|
init__mini_fact = fact; |
955 |
|
SetPrecisionFactor(); |
956 |
|
}; |
957 |
|
/** |
958 |
|
* \brief Set minimum number of step in track fitting |
959 |
|
*/ |
960 |
|
void TrkParams::SetStepMin(int istepmin){ |
961 |
|
init__mini_istepmin = istepmin; |
962 |
|
SetStepMin(); |
963 |
|
}; |
964 |
|
|
965 |
|
/** |
966 |
|
* Fill F77 commons with PFA settings |
967 |
|
*/ |
968 |
|
void TrkParams::SetPFA(){ |
969 |
|
sw_.pfaid = init__pfa; |
970 |
|
for(int i=0; i<6; i++){ |
971 |
|
pfa_.e234ax[i] = init__pfa_e234ax[i]; |
972 |
|
pfa_.e234ay[i] = init__pfa_e234ay[i]; |
973 |
|
} |
974 |
|
}; |
975 |
|
/** |
976 |
|
* \brief Set p.f.a. |
977 |
|
* |
978 |
|
* Implemented algorythms: |
979 |
|
* 0 ETA |
980 |
|
* 1 --- |
981 |
|
* 2 ETA2 |
982 |
|
* 3 ETA3 |
983 |
|
* 4 ETA4 |
984 |
|
* 5 ETAL ==> ETA+LANDI |
985 |
|
* 10 COG |
986 |
|
* 11 COG1 |
987 |
|
* 12 COG2 |
988 |
|
* 13 COG3 |
989 |
|
* 14 COG4 |
990 |
|
*/ |
991 |
|
void TrkParams::SetPFA(int pfaid){ |
992 |
|
init__pfa = pfaid; |
993 |
|
SetPFA(); |
994 |
|
}; |
995 |
|
/** |
996 |
|
* \brief Set p.f.a. angular intervals |
997 |
|
* |
998 |
|
* This methods allows to set these amgular intervals to apply ETA2,ETA3 or ETA4 |
999 |
|
* algorythm, in case ETA or ETAL is chosen (see TrkParams::SetPFA(int pfaid)). |
1000 |
|
* @param v Pointer to a vector of 12 components, which represent the |
1001 |
|
* angular limits for ETA2,ETA3 and ETA4, for x and y views, respectivelly. |
1002 |
|
* |
1003 |
|
*/ |
1004 |
|
void TrkParams::SetPFA(float *v){ |
1005 |
|
for(int i=0; i<6; i++){ |
1006 |
|
init__pfa_e234ax[i] = v[i]; |
1007 |
|
init__pfa_e234ay[i] = v[i+6]; |
1008 |
|
} |
1009 |
|
SetPFA(); |
1010 |
|
}; |
1011 |
|
|
1012 |
|
|
1013 |
|
/** |
1014 |
|
* \brief Get spatial resolution. |
1015 |
|
* |
1016 |
|
* Method to retrieve the spatial resolution associated with the |
1017 |
|
* adopted p.f.a. |
1018 |
|
* @param view Tracker view (1-12) |
1019 |
|
* @param angle Track projected angle |
1020 |
|
* |
1021 |
|
* In order to change p.f.a. use the SetPFA(int pfaid) method, eg.: |
1022 |
|
* |
1023 |
|
* TrkParams::SetPFA(0) // ETA |
1024 |
|
* |
1025 |
|
*/ |
1026 |
|
float TrkParams::GetResolution(int view, float angle){ |
1027 |
|
float res = 1000; |
1028 |
|
if( init__pfa == 0 )res = riseta_(&view,&angle); |
1029 |
|
else cout << "float TrkParams::GetResolution(int view, float angle) -- PFA "<<init__pfa<<" not yet implemented"<<endl; |
1030 |
|
return res; |
1031 |
|
} |
1032 |
|
|
1033 |
|
|
1034 |
|
|
1035 |
|
|
1036 |
ClassImp(TrkParams); |
ClassImp(TrkParams); |