1 |
|
|
2 |
/** |
/** |
3 |
* \file TrkParams.cpp |
* \file TrkParams.cpp |
4 |
* \author Elena Vannuccini |
* \author Elena Vannuccini |
10 |
using namespace std; |
using namespace std; |
11 |
|
|
12 |
|
|
13 |
|
Bool_t TrkParams::simuflag = kFALSE; |
14 |
// ------------------------- |
// ------------------------- |
15 |
// CALIBRATION (PED,SIG,BAD) |
// CALIBRATION (PED,SIG,BAD) |
16 |
// ------------------------- |
// ------------------------- |
19 |
TString TrkParams::calibpathf = ""; |
TString TrkParams::calibpathf = ""; |
20 |
Bool_t TrkParams::calib104 = 0; |
Bool_t TrkParams::calib104 = 0; |
21 |
Bool_t TrkParams::calibload = false; |
Bool_t TrkParams::calibload = false; |
22 |
|
TrkCalib* TrkParams::calib1 = 0; |
23 |
|
TrkCalib* TrkParams::calib2 = 0; |
24 |
// ------------------------- |
// ------------------------- |
25 |
// PARAMETERS loaded from DB |
// PARAMETERS loaded from DB |
26 |
// ------------------------- |
// ------------------------- |
42 |
double TrkParams::init__deltab_0 = 0.; |
double TrkParams::init__deltab_0 = 0.; |
43 |
double TrkParams::init__deltab_1 = 0.; |
double TrkParams::init__deltab_1 = 0.; |
44 |
double TrkParams::init__dlt = 1.e-5; |
double TrkParams::init__dlt = 1.e-5; |
45 |
|
// ------------------------------------------ |
46 |
|
// nominal z-coordinates to define acceptance |
47 |
|
// ------------------------------------------ |
48 |
|
int TrkParams::nGF = NGF; |
49 |
|
float TrkParams::zGF[] = {+53.74,+53.04,+23.94,+23.44,+22.29,+21.83,+13.39,+4.49,-4.41,-13.31,-21.83,-22.22,-23.49,-24.34}; |
50 |
|
float TrkParams::xGF_min[] = {-20.40,-20.40,-9.00,-9.00,-8.07,-8.07,-8.07,-8.07,-8.07,-8.07,-8.07,-8.07,-9.00,-9.00}; |
51 |
|
float TrkParams::xGF_max[] = {+20.40,+20.40,+9.00,+9.00,+8.07,+8.07,+8.07,+8.07,+8.07,+8.07,+8.07,+8.07,+9.00,+9.00}; |
52 |
|
// float TrkParams::yGF_min[] = {-16.50,-16.50,-7.50,-7.50,-7.25,-6.57,-7.25,-7.25,-7.25,-7.25,-6.57,-6.75,-7.50,-7.50}; |
53 |
|
// float TrkParams::yGF_max[] = {+16.50,+16.50,+7.50,+7.50,+6.75,+6.57,+6.75,+6.75,+6.75,+6.75,+6.57,+7.25,+7.50,+7.50}; |
54 |
|
// per i piani interni alla cavita`, gli estremi sono dati dalla cavita` stessa |
55 |
|
float TrkParams::yGF_min[] = {-16.50,-16.50,-7.50,-7.50,-7.25,-6.57,-6.57,-6.57,-6.57,-6.57,-6.57,-6.75,-7.50,-7.50}; |
56 |
|
float TrkParams::yGF_max[] = {+16.50,+16.50,+7.50,+7.50,+6.75,+6.57,+6.57,+6.57,+6.57,+6.57,+6.57,+7.25,+7.50,+7.50}; |
57 |
|
TString TrkParams::GF_element[] = {"S11","S12","S21","S22","T1","CUF","T2","T3","T4","T5","CLF","T6","S31","S32"}; |
58 |
|
|
59 |
TrkParams::TrkParams(){ |
TrkParams::TrkParams(){ |
60 |
|
|
75 |
return ret1; |
return ret1; |
76 |
} |
} |
77 |
|
|
78 |
|
void TrkParams::SetSimuFlag(Bool_t flag){ |
79 |
|
simuflag = flag; |
80 |
|
} |
81 |
|
|
82 |
|
Bool_t TrkParams::GetSimuFlag(){ |
83 |
|
return simuflag; |
84 |
|
} |
85 |
|
|
86 |
|
|
87 |
/** |
/** |
88 |
* Static method to open a DB connection. |
* Static method to open a DB connection. |
89 |
* HOST, USER and PASSWORD are taken from enviroment variables $PAM_DBHOST, |
* HOST, USER and PASSWORD are taken from enviroment variables $PAM_DBHOST, |
104 |
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
105 |
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
106 |
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
107 |
if(TrkParams::VerboseMode()){ |
if(TrkParams::DebugMode()){ |
108 |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
109 |
cout<<"Connecting to DB"<<endl; |
cout<<"TrkParams::SetDBConnection() >> Connecting to DB"<<endl; |
110 |
cout<<"HOST "<<host<<endl; |
cout<<"HOST "<<host<<endl; |
111 |
cout<<"USER "<<user<<endl; |
cout<<"USER "<<user<<endl; |
112 |
cout<<"PSW "<<psw<<endl; |
cout<<"PSW "<<psw<<endl; |
116 |
if( !dbc->IsConnected() )return NULL; |
if( !dbc->IsConnected() )return NULL; |
117 |
stringstream myquery; // EMILIANO |
stringstream myquery; // EMILIANO |
118 |
myquery.str(""); // EMILIANO |
myquery.str(""); // EMILIANO |
119 |
myquery << "SET time_zone='+0:00'"; // EMILIANO |
myquery << "SET time_zone='+0:00'; SET sql_mode = 'NO_UNSIGNED_SUBTRACTION';"; // EMILIANO |
120 |
dbc->Query(myquery.str().c_str()); // EMILIANO |
dbc->Query(myquery.str().c_str()); // EMILIANO |
121 |
if(TrkParams::VerboseMode()){ |
if(TrkParams::DebugMode()){ |
122 |
cout << " ...done"<<endl; |
cout << " ...done"<<endl; |
123 |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
124 |
} |
} |
153 |
bool LOCAL_CONNECTION = false; |
bool LOCAL_CONNECTION = false; |
154 |
if( !dbc || (dbc && !dbc->IsConnected()) ){ |
if( !dbc || (dbc && !dbc->IsConnected()) ){ |
155 |
|
|
156 |
if(TrkParams::WarningMode())cout <<" Missing DB connection -- check PAMELA environment variables "<<endl; |
// if(TrkParams::WarningMode())cout <<" Missing DB connection -- check PAMELA environment variables "<<endl; |
157 |
dbc = TrkParams::SetDBConnection(); |
dbc = TrkParams::SetDBConnection(); |
158 |
if(dbc && dbc->IsConnected())LOCAL_CONNECTION = true; |
if(dbc && dbc->IsConnected())LOCAL_CONNECTION = true; |
159 |
|
|
185 |
calibpatht = q4.PATH + q4.NAME; |
calibpatht = q4.PATH + q4.NAME; |
186 |
} |
} |
187 |
|
|
188 |
if(LOCAL_CONNECTION){ |
if(LOCAL_CONNECTION&&dbc){ |
189 |
dbc->Close(); |
dbc->Close(); |
190 |
delete dbc; |
delete dbc; |
191 |
|
if(TrkParams::DebugMode()){ |
192 |
|
cout << " DB connection closed."<<endl; |
193 |
|
} |
194 |
} |
} |
195 |
|
|
196 |
// return TrkParams::LoadCalib(); |
// return TrkParams::LoadCalib(); |
258 |
// ------------------------------------------------- |
// ------------------------------------------------- |
259 |
UInt_t build=0; |
UInt_t build=0; |
260 |
UInt_t base=0; |
UInt_t base=0; |
261 |
UInt_t mask=0; |
// UInt_t mask=0;// EM GCC 4.7 |
262 |
if(classname.Contains("CalibTrk1Event")){ |
if(classname.Contains("CalibTrk1Event")){ |
263 |
base=12; |
base=12; |
264 |
mask=0x03F000; |
// mask=0x03F000; // EM GCC 4.7 |
265 |
} |
} |
266 |
if(classname.Contains("CalibTrk2Event")){ |
if(classname.Contains("CalibTrk2Event")){ |
267 |
base=18; |
base=18; |
268 |
mask=0xFC0000; |
// mask=0xFC0000; // EM GCC 4.7 |
269 |
} |
} |
270 |
// ------------------------------------------------- |
// ------------------------------------------------- |
271 |
// Count number of packets and set build variable |
// Count number of packets and set build variable |
348 |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
349 |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
350 |
|
|
351 |
CalibTrk1Event *calibdata1 = 0; |
if(!calib1)calib1 = new TrkCalib(); |
352 |
CalibTrk2Event *calibdata2 = 0; |
if(!calib2)calib2 = new TrkCalib(); |
353 |
tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
// calibx->Set(calibdata1); |
354 |
tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
// caliby->Set(calibdata2); |
355 |
tr1->GetEntry(ev_reg1); |
|
356 |
tr2->GetEntry(ev_reg2); |
// CalibTrk1Event *calibdata1 = 0; |
357 |
|
// CalibTrk2Event *calibdata2 = 0; |
358 |
|
// tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
359 |
|
// tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
360 |
|
tr1->SetBranchAddress("CalibTrk1",calib1->GetPointerTo()); |
361 |
|
tr2->SetBranchAddress("CalibTrk2",calib2->GetPointerTo()); |
362 |
|
if ( tr1->GetEntry(ev_reg1) <= 0 ) throw -36;//EM |
363 |
|
if ( tr2->GetEntry(ev_reg2) <= 0 ) throw -36;//EM |
364 |
Int_t dspn1(0),dspn2(0); |
Int_t dspn1(0),dspn2(0); |
365 |
|
|
366 |
|
|
367 |
// --- TEST TEST TEST TEST --- // |
// --- TEST TEST TEST TEST --- // |
368 |
// TrkParams::ValidateTrkCalib(calibdata1); |
// TrkParams::ValidateTrkCalib(calib1->Get()); |
369 |
// TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
// TrkParams::ValidateTrkCalib((CalibTrk1Event*)calib2->Get()); |
370 |
|
|
371 |
UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1); |
UInt_t test1 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)(calib1->Get())); |
372 |
UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)(calib2->Get())); |
373 |
if( !test1 || !test2 ){ |
if( !test1 || !test2 ){ |
374 |
if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl; |
// if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl; |
375 |
TrkParams::calib.VALIDATION = 0; |
TrkParams::calib.VALIDATION = 0; |
376 |
} |
} |
377 |
if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl; |
// if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl; |
378 |
|
|
379 |
for(Int_t i=0;i<6;i++){ |
for(Int_t i=0;i<6;i++){ |
380 |
dspn1=calibdata1->DSPnumber[i]-1; |
|
381 |
dspn2=calibdata2->DSPnumber[i]-1; |
|
382 |
|
dspn1=calib1->Get()->DSPnumber[i]-1; |
383 |
|
dspn2=calib2->Get()->DSPnumber[i]-1; |
384 |
// cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; |
// cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; |
385 |
for(Int_t ii=0;ii<3072;ii++){ |
for(Int_t ii=0;ii<3072;ii++){ |
386 |
Int_t j=(ii/128); |
Int_t j=(ii/128); |
387 |
Int_t jj=ii-j*128; |
Int_t jj=ii-j*128; |
388 |
if(dspn1>=0 && dspn1<12){ |
if(dspn1>=0 && dspn1<12){ |
389 |
ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii]; |
ca->pedestal[jj][j][dspn1]=calib1->Get()->DSPped_par[i][ii]; |
390 |
ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]); |
ca->pedestal_t[jj][j][dspn1]=aint(calib1->Get()->DSPped_par[i][ii]); |
391 |
ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii]; |
ca->sigma[jj][j][dspn1]=calib1->Get()->DSPsig_par[i][ii]; |
392 |
ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]); |
ca->sigma_t[jj][j][dspn1]=anint(calib1->Get()->DSPsig_par[i][ii]); |
393 |
if(calibdata1->DSPbad_par[i][ii]==0) |
if(calib1->Get()->DSPbad_par[i][ii]==0) |
394 |
ca->bad[jj][j][dspn1]=1; |
ca->bad[jj][j][dspn1]=1; |
395 |
else if(calibdata1->DSPbad_par[i][ii]==1) |
else if(calib1->Get()->DSPbad_par[i][ii]==1) |
396 |
ca->bad[jj][j][dspn1]=0; |
ca->bad[jj][j][dspn1]=0; |
397 |
// cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
// cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
398 |
// cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
// cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
399 |
} |
} |
400 |
|
|
401 |
if(dspn2>=0 && dspn2<12){ |
if(dspn2>=0 && dspn2<12){ |
402 |
ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii]; |
ca->pedestal[jj][j][dspn2]=calib2->Get()->DSPped_par[i][ii]; |
403 |
ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]); |
ca->pedestal_t[jj][j][dspn2]=aint(calib2->Get()->DSPped_par[i][ii]); |
404 |
ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii]; |
ca->sigma[jj][j][dspn2]=calib2->Get()->DSPsig_par[i][ii]; |
405 |
ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]); |
ca->sigma_t[jj][j][dspn2]=anint(calib2->Get()->DSPsig_par[i][ii]); |
406 |
if(calibdata2->DSPbad_par[i][ii]==0) |
if(calib2->Get()->DSPbad_par[i][ii]==0) |
407 |
ca->bad[jj][j][dspn2]=1; |
ca->bad[jj][j][dspn2]=1; |
408 |
else if(calibdata2->DSPbad_par[i][ii]==1) |
else if(calib2->Get()->DSPbad_par[i][ii]==1) |
409 |
ca->bad[jj][j][dspn2]=0; |
ca->bad[jj][j][dspn2]=0; |
410 |
// cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
// cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
411 |
// cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
// cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
419 |
/** |
/** |
420 |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
421 |
*/ |
*/ |
422 |
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){ |
423 |
|
|
424 |
cTrkCalib *ca = &pedsigbad_; |
// cTrkCalib *ca = &pedsigbad_; |
425 |
// ca->Reset(); |
// // ca->Reset(); |
426 |
|
|
427 |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
// TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
428 |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
// TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
|
|
|
|
CalibTrk1Event *calibdata1 = 0; |
|
|
CalibTrk2Event *calibdata2 = 0; |
|
|
tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
|
|
tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
|
|
tr1->GetEntry(ev_reg1); |
|
|
tr2->GetEntry(ev_reg2); |
|
|
Int_t dspn1(0),dspn2(0); |
|
429 |
|
|
430 |
// --- TEST TEST TEST TEST --- // |
// CalibTrk1Event *calibdata1 = 0; |
431 |
// TrkParams::ValidateTrkCalib(calibdata1); |
// CalibTrk2Event *calibdata2 = 0; |
432 |
// TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
// tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
433 |
UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1); |
// tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
434 |
UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
// tr1->GetEntry(ev_reg1); |
435 |
if( !test1 || !test2 ){ |
// tr2->GetEntry(ev_reg2); |
436 |
if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl; |
// Int_t dspn1(0),dspn2(0); |
437 |
TrkParams::calib.VALIDATION = 0; |
|
438 |
} |
// // --- TEST TEST TEST TEST --- // |
439 |
if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl; |
// // TrkParams::ValidateTrkCalib(calibdata1); |
440 |
|
// // TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
441 |
|
// UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1); |
442 |
|
// UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
443 |
|
// if( !test1 || !test2 ){ |
444 |
|
// if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl; |
445 |
|
// TrkParams::calib.VALIDATION = 0; |
446 |
|
// } |
447 |
|
// if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl; |
448 |
|
|
449 |
for(Int_t i=0;i<6;i++){ |
// for(Int_t i=0;i<6;i++){ |
450 |
dspn1=calibdata1->DSPnumber[i]-1; |
// dspn1=calibdata1->DSPnumber[i]-1; |
451 |
dspn2=calibdata2->DSPnumber[i]-1; |
// dspn2=calibdata2->DSPnumber[i]-1; |
452 |
/* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
// /* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
453 |
for(Int_t ii=0;ii<3072;ii++){ |
// for(Int_t ii=0;ii<3072;ii++){ |
454 |
Int_t j=(ii/128); |
// Int_t j=(ii/128); |
455 |
Int_t jj=ii-j*128; |
// Int_t jj=ii-j*128; |
456 |
if(dspn1>=0 && dspn1<12){ |
// if(dspn1>=0 && dspn1<12){ |
457 |
ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii]; |
// ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii]; |
458 |
ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii]; |
// ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii]; |
459 |
if(calibdata1->DSPbad_par[i][ii]==0) |
// if(calibdata1->DSPbad_par[i][ii]==0) |
460 |
ca->bad[jj][j][dspn1]=1; |
// ca->bad[jj][j][dspn1]=1; |
461 |
else if(calibdata1->DSPbad_par[i][ii]==1) |
// else if(calibdata1->DSPbad_par[i][ii]==1) |
462 |
ca->bad[jj][j][dspn1]=0; |
// ca->bad[jj][j][dspn1]=0; |
463 |
// cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
// // cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
464 |
// cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
// // cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
465 |
} |
// } |
466 |
if(dspn2>=0 && dspn2<12){ |
// if(dspn2>=0 && dspn2<12){ |
467 |
ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii]; |
// ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii]; |
468 |
ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii]; |
// ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii]; |
469 |
if(calibdata2->DSPbad_par[i][ii]==0) |
// if(calibdata2->DSPbad_par[i][ii]==0) |
470 |
ca->bad[jj][j][dspn2]=1; |
// ca->bad[jj][j][dspn2]=1; |
471 |
else if(calibdata2->DSPbad_par[i][ii]==1) |
// else if(calibdata2->DSPbad_par[i][ii]==1) |
472 |
ca->bad[jj][j][dspn2]=0; |
// ca->bad[jj][j][dspn2]=0; |
473 |
// cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
// // cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
474 |
// cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
// // cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
475 |
} |
// } |
476 |
}; |
// }; |
477 |
}; |
// }; |
478 |
|
|
479 |
tr1->Delete(); |
// tr1->Delete(); |
480 |
tr2->Delete(); |
// tr2->Delete(); |
481 |
}; |
// }; |
482 |
/** |
/** |
483 |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
484 |
*/ |
*/ |
485 |
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){ |
486 |
|
|
487 |
cTrkCalib *ca = &pedsigbad_; |
// cTrkCalib *ca = &pedsigbad_; |
488 |
// ca->Reset(); |
// // ca->Reset(); |
489 |
|
|
490 |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
// TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
491 |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
// TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
492 |
|
|
493 |
CalibTrk1Event *calibdata1 = 0; |
// CalibTrk1Event *calibdata1 = 0; |
494 |
CalibTrk2Event *calibdata2 = 0; |
// CalibTrk2Event *calibdata2 = 0; |
495 |
tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
// tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
496 |
tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
// tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
497 |
tr1->GetEntry(ev_reg1); |
// tr1->GetEntry(ev_reg1); |
498 |
tr2->GetEntry(ev_reg2); |
// tr2->GetEntry(ev_reg2); |
499 |
Int_t dspn1(0),dspn2(0); |
// Int_t dspn1(0),dspn2(0); |
500 |
|
|
501 |
// --- TEST TEST TEST TEST --- // |
// // --- TEST TEST TEST TEST --- // |
502 |
// TrkParams::ValidateTrkCalib(calibdata1); |
// // TrkParams::ValidateTrkCalib(calibdata1); |
503 |
// TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
// // TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
504 |
UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1); |
// UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1); |
505 |
UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
// UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
506 |
if( !test1 || !test2 ){ |
// if( !test1 || !test2 ){ |
507 |
if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl; |
// if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl; |
508 |
TrkParams::calib.VALIDATION = 0; |
// TrkParams::calib.VALIDATION = 0; |
509 |
} |
// } |
510 |
if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl; |
// if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl; |
511 |
|
|
512 |
for(Int_t i=0;i<6;i++){ |
// for(Int_t i=0;i<6;i++){ |
513 |
dspn1=calibdata1->DSPnumber[i]-1; |
// dspn1=calibdata1->DSPnumber[i]-1; |
514 |
dspn2=calibdata2->DSPnumber[i]-1; |
// dspn2=calibdata2->DSPnumber[i]-1; |
515 |
/* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
// /* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
516 |
for(Int_t ii=0;ii<3072;ii++){ |
// for(Int_t ii=0;ii<3072;ii++){ |
517 |
Int_t j=(ii/128); |
// Int_t j=(ii/128); |
518 |
Int_t jj=ii-j*128; |
// Int_t jj=ii-j*128; |
519 |
if(dspn1>=0 && dspn1<12){ |
// if(dspn1>=0 && dspn1<12){ |
520 |
ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]); |
// ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]); |
521 |
ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]); |
// ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]); |
522 |
} |
// } |
523 |
if(dspn2>=0 && dspn2<12){ |
// if(dspn2>=0 && dspn2<12){ |
524 |
ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]); |
// ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]); |
525 |
ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]); |
// ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]); |
526 |
} |
// } |
527 |
}; |
// }; |
528 |
}; |
// }; |
529 |
|
|
530 |
tr1->Delete(); |
// tr1->Delete(); |
531 |
tr2->Delete(); |
// tr2->Delete(); |
532 |
}; |
// }; |
533 |
/** |
/** |
534 |
* Method to fill the tracker calibration-parameter struct from default calibration |
* Method to fill the tracker calibration-parameter struct from default calibration |
535 |
*/ |
*/ |
558 |
//------------------------- |
//------------------------- |
559 |
tr = (TTree*)f0->Get("CalibTrk1"); |
tr = (TTree*)f0->Get("CalibTrk1"); |
560 |
tr->SetBranchAddress("CalibTrk1",calib->GetPointerTo()); |
tr->SetBranchAddress("CalibTrk1",calib->GetPointerTo()); |
561 |
tr->GetEntry(ev_reg1); |
if ( tr->GetEntry(ev_reg1) <= 0 ) throw -36;//EM |
562 |
} |
} |
563 |
if(i==1){ |
if(i==1){ |
564 |
//------------------------- |
//------------------------- |
566 |
//------------------------- |
//------------------------- |
567 |
tr = (TTree*)f0->Get("CalibTrk2"); |
tr = (TTree*)f0->Get("CalibTrk2"); |
568 |
tr->SetBranchAddress("CalibTrk2",calib->GetPointerTo()); |
tr->SetBranchAddress("CalibTrk2",calib->GetPointerTo()); |
569 |
tr->GetEntry(ev_reg2); |
if ( tr->GetEntry(ev_reg2) <= 0 ) throw -36; |
570 |
} |
} |
571 |
for(Int_t ipkt=0; ipkt<NPLANE; ipkt++){ |
for(Int_t ipkt=0; ipkt<NPLANE; ipkt++){ |
572 |
Int_t view = calib->GetView(ipkt); |
Int_t view = calib->GetView(ipkt); |
640 |
cout << " - full+truncated parameters "<<endl; |
cout << " - full+truncated parameters "<<endl; |
641 |
} |
} |
642 |
TrkParams::FillACalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
TrkParams::FillACalibFrom(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
643 |
if(TrkParams::VerboseMode())cout << " - VK-mask "<<endl; |
if(TrkParams::VerboseMode())cout << " - VK-mask (RUN-by-RUN)"<<endl; |
644 |
TrkParams::FillMask(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
TrkParams::FillMask(f0_c,calib.EV_ROOT_CALIBTRK1,calib.EV_ROOT_CALIBTRK2); |
645 |
|
|
646 |
// ============================================================= |
// ============================================================= |
684 |
* If dbc==NULL, try to open a connection taking DB-connection |
* If dbc==NULL, try to open a connection taking DB-connection |
685 |
* parameters from PAMELA environment variables. |
* parameters from PAMELA environment variables. |
686 |
*/ |
*/ |
687 |
Bool_t TrkParams::Set( GL_RUN* glrun , TSQLServer* dbc , UInt_t type){ |
Bool_t TrkParams::Set( GL_RUN* glrun , TSQLServer* dbc , UInt_t type, UInt_t abstime){ |
688 |
|
|
689 |
|
|
690 |
UInt_t index = TrkParams::GetIndex( type ); |
UInt_t index = TrkParams::GetIndex( type ); |
691 |
if(index < 0)return false; |
if(index < 0)return false; |
692 |
|
|
693 |
UInt_t runheadtime=0; |
if(TrkParams::VerboseMode()) |
694 |
|
cout <<"Calling Bool_t TrkParams::Set(GL_RUN* "<<glrun<<" ,TSQLServer* "<<dbc<<" ,UInt_t "<<type<<" ,UInt_t " <<abstime << " ) >> (**WARNING** check that this is all ok!! )"<<endl; |
695 |
|
|
696 |
|
UInt_t runheadtime=1; |
697 |
UInt_t runid=0; |
UInt_t runid=0; |
698 |
// UInt_t runheadtime = numeric_limits<UInt_t>::max(); |
// UInt_t runheadtime = numeric_limits<UInt_t>::max(); |
699 |
if(glrun){ |
if(glrun){ |
700 |
runheadtime = glrun->RUNHEADER_TIME; |
runheadtime = glrun->RUNHEADER_TIME; |
701 |
runid = glrun->ID; |
runid = glrun->ID; |
702 |
}else cout <<"Bool_t TrkParams::Set(GL_RUN*,TSQLServer*,UInt_t) >> Missing run info -- taking first entry (**WARNING** check that this is ok!! )"<<endl; |
}else |
703 |
|
cout <<"Bool_t TrkParams::Set(GL_RUN* "<<glrun<<" ,TSQLServer* "<<dbc<<" ,UInt_t "<<type<<" ,UInt_t " <<abstime << " ) >> GL_RUN==NULL -- taking first entry (**WARNING** check that this is ok!! )"<<endl; |
|
// if(TrkParams::VerboseMode()) |
|
|
cout << "<< set TrkParams type "<<type<<" from DB << RUN "<<runid<<endl; |
|
|
|
|
|
|
|
|
if( !TrkParams::IsLoaded(type) || |
|
|
runheadtime < gl[index].FROM_TIME || |
|
|
runheadtime > gl[index].TO_TIME || |
|
|
false ){ |
|
|
|
|
|
bool LOCAL_CONNECTION = false; |
|
|
if( !dbc || (dbc && !dbc->IsConnected()) ){ |
|
|
|
|
|
if(TrkParams::WarningMode())cout <<" Missing DB connection -- check PAMELA environment variables "<<endl; |
|
|
dbc = TrkParams::SetDBConnection(); |
|
|
if(dbc && dbc->IsConnected())LOCAL_CONNECTION = true; |
|
704 |
|
|
|
} |
|
705 |
|
|
706 |
GL_PARAM q4; |
if( !abstime || !simuflag ) abstime = runheadtime;// EM: if simu? |
|
if( q4.Query_GL_PARAM(runheadtime,type,dbc) )return false; |
|
|
if(LOCAL_CONNECTION){ |
|
|
dbc->Close(); |
|
|
delete dbc; |
|
|
} |
|
|
gl[index] = q4; |
|
|
glpath[index] = q4.PATH+q4.NAME; |
|
|
glload[index] = false; |
|
707 |
|
|
708 |
return true; |
if(TrkParams::VerboseMode()) |
709 |
|
cout << "TrkParams::IsLoaded(type)=" << TrkParams::IsLoaded(type) << " abstime=" << abstime << " runheadtime=" << runheadtime << " gl[index].FROM_TIME=" << gl[index].FROM_TIME << " gl[index].TO_TIME=" << gl[index].TO_TIME << endl; |
710 |
|
|
711 |
|
if( !TrkParams::IsLoaded(type) || |
712 |
|
abstime < gl[index].FROM_TIME || |
713 |
|
abstime > gl[index].TO_TIME || |
714 |
|
false ){ |
715 |
|
|
716 |
|
if(TrkParams::VerboseMode()) |
717 |
|
cout << "<< set TrkParams type "<<type<<" from DB << RUN "<<runid<<endl; |
718 |
|
|
719 |
|
bool LOCAL_CONNECTION = false; |
720 |
|
if( !dbc || (dbc && !dbc->IsConnected()) ){ |
721 |
|
|
722 |
|
// if(TrkParams::WarningMode())cout <<" Missing DB connection -- check PAMELA environment variables "<<endl; |
723 |
|
dbc = TrkParams::SetDBConnection(); |
724 |
|
if(dbc && dbc->IsConnected())LOCAL_CONNECTION = true; |
725 |
|
|
726 |
|
} |
727 |
|
|
728 |
|
GL_PARAM q4; |
729 |
|
// if( q4.Query_GL_PARAM(runheadtime,type,dbc) )return false; |
730 |
|
if( q4.Query_GL_PARAM(abstime,type,dbc) )return false; //VALERIO |
731 |
|
if(LOCAL_CONNECTION){ |
732 |
|
dbc->Close(); |
733 |
|
delete dbc; |
734 |
|
if(TrkParams::DebugMode()){ |
735 |
|
cout << " DB connection closed."<<endl; |
736 |
|
} |
737 |
|
} |
738 |
|
gl[index] = q4; |
739 |
|
glpath[index] = q4.PATH+q4.NAME; |
740 |
|
glload[index] = false; |
741 |
|
|
742 |
|
//return true; |
743 |
|
|
744 |
} |
} |
745 |
return false; |
return true; |
746 |
|
|
747 |
}; |
}; |
748 |
/** |
/** |
749 |
* Set tracker parameters proper for the run, from input. |
* Set tracker parameters proper for the run, from input. |
786 |
* otherwise it set a default path. |
* otherwise it set a default path. |
787 |
* @return FALSE if parameter set fails. |
* @return FALSE if parameter set fails. |
788 |
*/ |
*/ |
789 |
|
|
790 |
Bool_t TrkParams::Set( ){ |
Bool_t TrkParams::Set( ){ |
791 |
|
|
792 |
|
|
804 |
|
|
805 |
Int_t index = TrkParams::GetIndex( type ); |
Int_t index = TrkParams::GetIndex( type ); |
806 |
if( index<0 )return false; |
if( index<0 )return false; |
807 |
if( glload[index] )return true; |
if( glload[index] )return false; |
|
|
|
808 |
if( glpath[index].IsNull() )TrkParams::Set(type); |
if( glpath[index].IsNull() )TrkParams::Set(type); |
809 |
|
|
810 |
switch( type ){ |
switch( type ){ |
888 |
} |
} |
889 |
|
|
890 |
Bool_t TrkParams::Load( ){ |
Bool_t TrkParams::Load( ){ |
891 |
for(Int_t i=0 ; i<NTYPES; i++)if(!glload[i] && trkparamtype[i]>0 )if( !TrkParams::Load(trkparamtype[i]) )return false; |
Bool_t result = true; |
892 |
return true; |
for(Int_t i=0 ; i<NTYPES; i++) |
893 |
|
if(!glload[i] && trkparamtype[i]>0 ) |
894 |
|
if( !TrkParams::Load(trkparamtype[i]) ) |
895 |
|
result = false; |
896 |
|
return result; |
897 |
}; |
}; |
898 |
Bool_t TrkParams::IsLoaded( ){ |
Bool_t TrkParams::IsLoaded( ){ |
899 |
for(Int_t i=0 ; i<NTYPES; i++)if(!glload[i] && trkparamtype[i]>0 )return false; |
for(Int_t i=0 ; i<NTYPES; i++)if(!glload[i] && trkparamtype[i]>0 )return false; |
900 |
return true; |
return true; |
901 |
}; |
}; |
902 |
|
|
903 |
|
/** |
904 |
|
* Get ADC-to-MIP conversion parameters |
905 |
|
* @param nl ladder number (0-2) |
906 |
|
* @param nv view number (0-11) |
907 |
|
*/ |
908 |
|
float TrkParams::GetMIP(int nl, int nv){ |
909 |
|
TrkParams::Load(2); |
910 |
|
if( !TrkParams::IsLoaded(2) )return 0.; |
911 |
|
return adc2mip_.mip[nl][nv]; |
912 |
|
} |
913 |
|
|
914 |
/** |
/** |
915 |
* Get BY (kGauss) |
* Get BY (kGauss) |
1047 |
*/ |
*/ |
1048 |
float TrkParams::GetResolution(int view, float angle){ |
float TrkParams::GetResolution(int view, float angle){ |
1049 |
float res = 1000; |
float res = 1000; |
1050 |
if( init__pfa == 0 )res = riseta_(&view,&angle); |
if ( init__pfa == 0 )res = riseta_(&view,&angle); |
1051 |
|
else if( init__pfa == 5 )res = riseta_(&view,&angle); |
1052 |
else cout << "float TrkParams::GetResolution(int view, float angle) -- PFA "<<init__pfa<<" not yet implemented"<<endl; |
else cout << "float TrkParams::GetResolution(int view, float angle) -- PFA "<<init__pfa<<" not yet implemented"<<endl; |
1053 |
return res; |
return res; |
1054 |
} |
} |
1055 |
|
|
1056 |
|
/** |
1057 |
|
* Returns the number of angular bins for p.f.a. parameters |
1058 |
|
*/ |
1059 |
|
int TrkParams::GetPFA_NbinsAngle(){ |
1060 |
|
TrkParams::Load(4); |
1061 |
|
if( !TrkParams::IsLoaded(4) ){ |
1062 |
|
cout << "int TrkParams::GetPFA_NbinsAngle() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
1063 |
|
return 0; |
1064 |
|
} |
1065 |
|
return pfa_.nangbin; |
1066 |
|
}; |
1067 |
|
/** |
1068 |
|
* Returns the number of eta bins for p.f.a. parameters |
1069 |
|
*/ |
1070 |
|
int TrkParams::GetPFA_NbinsETA(){ |
1071 |
|
TrkParams::Load(4); |
1072 |
|
if( !TrkParams::IsLoaded(4) ){ |
1073 |
|
cout << "int TrkParams::GetPFA_NbinsETA() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
1074 |
|
return 0; |
1075 |
|
} |
1076 |
|
return pfa_.netaval; |
1077 |
|
}; |
1078 |
|
|
1079 |
|
/** |
1080 |
|
* Returns the pointer to a vector ( of size TrkParams::GetPFA_NbinsETA() ), |
1081 |
|
* with eta-correction values for each eta bin. |
1082 |
|
* Bin extremes are given by float* TrkParams::GetPFA_ETAabs(pfa,int). |
1083 |
|
* |
1084 |
|
* @param pfa "ETA2","ETA3" or "ETA4" |
1085 |
|
* @param nview View number (0-11) |
1086 |
|
* @param nladder Ladder number (0-2) |
1087 |
|
* @param nang Angular bin (@see int TrkParams::GetPFA_NbinsAngle()). |
1088 |
|
* |
1089 |
|
* NB! the vector must be deallocated! |
1090 |
|
* delete [] vname; |
1091 |
|
*/ |
1092 |
|
float* TrkParams::GetPFA_ETAcorr(TString pfa, int nview, int nladder, int nang){ |
1093 |
|
|
1094 |
|
TrkParams::Load(4); |
1095 |
|
if( !TrkParams::IsLoaded(4) ){ |
1096 |
|
cout << "float* TrkParams::GetPFA_ETAcorr(TString pfa, int nview, int nladder, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
1097 |
|
return 0; |
1098 |
|
} |
1099 |
|
|
1100 |
|
int nbins = GetPFA_NbinsETA(); |
1101 |
|
if(!nbins)return 0; |
1102 |
|
|
1103 |
|
if( nview < 0 || |
1104 |
|
nview >= 12 || |
1105 |
|
nladder < 0 || |
1106 |
|
nladder >= 3 || |
1107 |
|
nang < 0 || |
1108 |
|
nang >= GetPFA_NbinsAngle() || |
1109 |
|
false)return 0; |
1110 |
|
|
1111 |
|
float *fcorr = new float [nbins]; |
1112 |
|
// float fcorr[nbins]; |
1113 |
|
|
1114 |
|
if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){ |
1115 |
|
for(int ib=0; ib<nbins; ib++){ |
1116 |
|
fcorr[ib] = pfa_.feta2[nang][nladder][nview][ib]; |
1117 |
|
// cout << pfa_.eta2[nang][ib] << " - " << pfa_.feta2[nang][nladder][nview][ib]<<endl;; |
1118 |
|
} |
1119 |
|
}else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){ |
1120 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta3[nang][nladder][nview][ib]; |
1121 |
|
}else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){ |
1122 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta4[nang][nladder][nview][ib]; |
1123 |
|
}else{ |
1124 |
|
cout << "float* TrkParams::GetPFA_ETAcorr("<<pfa<<",...) --- pfa parameters not implemented "<<endl; |
1125 |
|
return 0; |
1126 |
|
} |
1127 |
|
|
1128 |
|
return fcorr; |
1129 |
|
|
1130 |
|
}; |
1131 |
|
|
1132 |
|
/** |
1133 |
|
* Returns the pointer to a vector with eta-bin extremes (@see float* TrkParams::GetPFA_ETAcorr(TString,int,int,int)). |
1134 |
|
* |
1135 |
|
* @param pfa "ETA2","ETA3" or "ETA4" |
1136 |
|
* @param nang Angular bin (@see int TrkParams::GetPFA_NbinsAngle()). |
1137 |
|
* |
1138 |
|
* NB the vector must be deallocated |
1139 |
|
* delete [] vname; |
1140 |
|
*/ |
1141 |
|
float* TrkParams::GetPFA_ETAabs(TString pfa, int nang){ |
1142 |
|
|
1143 |
|
TrkParams::Load(4); |
1144 |
|
if( !TrkParams::IsLoaded(4) ){ |
1145 |
|
cout << "float* TrkParams::GetPFA_ETAabs(TString pfa, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
1146 |
|
return 0; |
1147 |
|
} |
1148 |
|
|
1149 |
|
int nbins = GetPFA_NbinsETA(); |
1150 |
|
if(!nbins)return 0; |
1151 |
|
|
1152 |
|
float *fcorr = new float [nbins]; |
1153 |
|
// float fcorr[nbins]; |
1154 |
|
if( nang < 0 || |
1155 |
|
nang >= GetPFA_NbinsAngle() || |
1156 |
|
false)return 0; |
1157 |
|
|
1158 |
|
if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){ |
1159 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta2[nang][ib]; |
1160 |
|
}else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){ |
1161 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta3[nang][ib]; |
1162 |
|
}else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){ |
1163 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta4[nang][ib]; |
1164 |
|
}else{ |
1165 |
|
cout << "float* TrkParams::GetPFA_ETAabs("<<pfa<<",...) --- pfa parameters not implemented "<<endl; |
1166 |
|
return 0; |
1167 |
|
} |
1168 |
|
|
1169 |
|
return fcorr; |
1170 |
|
|
1171 |
|
}; |
1172 |
|
/** |
1173 |
|
* Returns the "Landi-correction". |
1174 |
|
* |
1175 |
|
* @param nview View number (0-11) |
1176 |
|
* @param nladder Ladder number (0-2) |
1177 |
|
* @param nang Angular bin (@see int TrkParams::GetPFA_NbinsAngle()). |
1178 |
|
*/ |
1179 |
|
float TrkParams::GetPFA_ETAlandi(int nview, int nladder, int nang){ |
1180 |
|
|
1181 |
|
// TrkParams::Load(4); |
1182 |
|
// if( !TrkParams::IsLoaded(4) ){ |
1183 |
|
// cout << "float* TrkParams::GetPFA_ETAlandi(int nview, int nladder, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
1184 |
|
// return 0; |
1185 |
|
// } |
1186 |
|
int nbins = GetPFA_NbinsAngle(); |
1187 |
|
if(!nbins)return 0; |
1188 |
|
|
1189 |
|
if( nview < 0 || |
1190 |
|
nview >= 12 || |
1191 |
|
nladder < 0 || |
1192 |
|
nladder >= 3 || |
1193 |
|
nang < 0 || |
1194 |
|
nang >= nbins || |
1195 |
|
false)return 0; |
1196 |
|
|
1197 |
|
|
1198 |
|
return pfa_.fcorr[nang][nladder][nview]; |
1199 |
|
|
1200 |
|
}; |
1201 |
|
|
1202 |
|
/** |
1203 |
|
* Returns the index (0, n.bin-1) of the angular bin for pfa parameters |
1204 |
|
* @param angle Effective angle (deg) |
1205 |
|
*/ |
1206 |
|
int TrkParams::GetPFA_AngleBin(float angle){ |
1207 |
|
|
1208 |
|
int nangbin = TrkParams::GetPFA_NbinsAngle(); |
1209 |
|
int istart = (int)(nangbin/2); |
1210 |
|
int idbin = -1; |
1211 |
|
// cout << angle <<" ??" << endl; |
1212 |
|
if( angle > pfa_.angR[istart] ){ |
1213 |
|
idbin = nangbin-1; |
1214 |
|
for(int id=istart+1; id<nangbin; id++ ){ |
1215 |
|
// cout << id << endl; |
1216 |
|
if( pfa_.angR[id] >= angle ){ |
1217 |
|
idbin = id; |
1218 |
|
break; |
1219 |
|
} |
1220 |
|
} |
1221 |
|
}else{ |
1222 |
|
idbin = 0; |
1223 |
|
for(int id=istart; id>=0; id-- ){ |
1224 |
|
// cout << id << endl; |
1225 |
|
if( pfa_.angL[id] < angle ){ |
1226 |
|
idbin = id; |
1227 |
|
break; |
1228 |
|
} |
1229 |
|
} |
1230 |
|
|
1231 |
|
} |
1232 |
|
// cout << ">>> "<<idbin<<" "<<pfa_.angL[idbin]<<" "<<pfa_.angR[idbin]<<endl; |
1233 |
|
return idbin; |
1234 |
|
} |
1235 |
|
|
1236 |
|
|
1237 |
|
|