18 |
TString TrkParams::calibpathf = ""; |
TString TrkParams::calibpathf = ""; |
19 |
Bool_t TrkParams::calib104 = 0; |
Bool_t TrkParams::calib104 = 0; |
20 |
Bool_t TrkParams::calibload = false; |
Bool_t TrkParams::calibload = false; |
21 |
|
TrkCalib* TrkParams::calib1 = 0; |
22 |
|
TrkCalib* TrkParams::calib2 = 0; |
23 |
// ------------------------- |
// ------------------------- |
24 |
// PARAMETERS loaded from DB |
// PARAMETERS loaded from DB |
25 |
// ------------------------- |
// ------------------------- |
143 |
bool LOCAL_CONNECTION = false; |
bool LOCAL_CONNECTION = false; |
144 |
if( !dbc || (dbc && !dbc->IsConnected()) ){ |
if( !dbc || (dbc && !dbc->IsConnected()) ){ |
145 |
|
|
146 |
if(TrkParams::WarningMode())cout <<" Missing DB connection -- check PAMELA environment variables "<<endl; |
// if(TrkParams::WarningMode())cout <<" Missing DB connection -- check PAMELA environment variables "<<endl; |
147 |
dbc = TrkParams::SetDBConnection(); |
dbc = TrkParams::SetDBConnection(); |
148 |
if(dbc && dbc->IsConnected())LOCAL_CONNECTION = true; |
if(dbc && dbc->IsConnected())LOCAL_CONNECTION = true; |
149 |
|
|
175 |
calibpatht = q4.PATH + q4.NAME; |
calibpatht = q4.PATH + q4.NAME; |
176 |
} |
} |
177 |
|
|
178 |
if(LOCAL_CONNECTION){ |
if(LOCAL_CONNECTION&&dbc){ |
|
delete dbc; |
|
179 |
dbc->Close(); |
dbc->Close(); |
180 |
if(TrkParams::DebugMode()){ |
if(TrkParams::DebugMode()){ |
181 |
cout << " DB connection closed."<<endl; |
cout << " DB connection closed."<<endl; |
337 |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
338 |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
339 |
|
|
340 |
CalibTrk1Event *calibdata1 = 0; |
if(!calib1)calib1 = new TrkCalib(); |
341 |
CalibTrk2Event *calibdata2 = 0; |
if(!calib2)calib2 = new TrkCalib(); |
342 |
tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
// calibx->Set(calibdata1); |
343 |
tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
// caliby->Set(calibdata2); |
344 |
tr1->GetEntry(ev_reg1); |
|
345 |
tr2->GetEntry(ev_reg2); |
// CalibTrk1Event *calibdata1 = 0; |
346 |
|
// CalibTrk2Event *calibdata2 = 0; |
347 |
|
// tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
348 |
|
// tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
349 |
|
tr1->SetBranchAddress("CalibTrk1",calib1->GetPointerTo()); |
350 |
|
tr2->SetBranchAddress("CalibTrk2",calib2->GetPointerTo()); |
351 |
|
if ( tr1->GetEntry(ev_reg1) <= 0 ) throw -36;//EM |
352 |
|
if ( tr2->GetEntry(ev_reg2) <= 0 ) throw -36;//EM |
353 |
Int_t dspn1(0),dspn2(0); |
Int_t dspn1(0),dspn2(0); |
354 |
|
|
355 |
|
|
356 |
// --- TEST TEST TEST TEST --- // |
// --- TEST TEST TEST TEST --- // |
357 |
// TrkParams::ValidateTrkCalib(calibdata1); |
// TrkParams::ValidateTrkCalib(calib1->Get()); |
358 |
// TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
// TrkParams::ValidateTrkCalib((CalibTrk1Event*)calib2->Get()); |
359 |
|
|
360 |
UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1); |
UInt_t test1 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)(calib1->Get())); |
361 |
UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)(calib2->Get())); |
362 |
if( !test1 || !test2 ){ |
if( !test1 || !test2 ){ |
363 |
if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl; |
// if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl; |
364 |
TrkParams::calib.VALIDATION = 0; |
TrkParams::calib.VALIDATION = 0; |
365 |
} |
} |
366 |
if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl; |
// if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl; |
367 |
|
|
368 |
for(Int_t i=0;i<6;i++){ |
for(Int_t i=0;i<6;i++){ |
369 |
dspn1=calibdata1->DSPnumber[i]-1; |
|
370 |
dspn2=calibdata2->DSPnumber[i]-1; |
|
371 |
|
dspn1=calib1->Get()->DSPnumber[i]-1; |
372 |
|
dspn2=calib2->Get()->DSPnumber[i]-1; |
373 |
// cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; |
// cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; |
374 |
for(Int_t ii=0;ii<3072;ii++){ |
for(Int_t ii=0;ii<3072;ii++){ |
375 |
Int_t j=(ii/128); |
Int_t j=(ii/128); |
376 |
Int_t jj=ii-j*128; |
Int_t jj=ii-j*128; |
377 |
if(dspn1>=0 && dspn1<12){ |
if(dspn1>=0 && dspn1<12){ |
378 |
ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii]; |
ca->pedestal[jj][j][dspn1]=calib1->Get()->DSPped_par[i][ii]; |
379 |
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]); |
380 |
ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii]; |
ca->sigma[jj][j][dspn1]=calib1->Get()->DSPsig_par[i][ii]; |
381 |
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]); |
382 |
if(calibdata1->DSPbad_par[i][ii]==0) |
if(calib1->Get()->DSPbad_par[i][ii]==0) |
383 |
ca->bad[jj][j][dspn1]=1; |
ca->bad[jj][j][dspn1]=1; |
384 |
else if(calibdata1->DSPbad_par[i][ii]==1) |
else if(calib1->Get()->DSPbad_par[i][ii]==1) |
385 |
ca->bad[jj][j][dspn1]=0; |
ca->bad[jj][j][dspn1]=0; |
386 |
// cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
// cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
387 |
// cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
// cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
388 |
} |
} |
389 |
|
|
390 |
if(dspn2>=0 && dspn2<12){ |
if(dspn2>=0 && dspn2<12){ |
391 |
ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii]; |
ca->pedestal[jj][j][dspn2]=calib2->Get()->DSPped_par[i][ii]; |
392 |
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]); |
393 |
ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii]; |
ca->sigma[jj][j][dspn2]=calib2->Get()->DSPsig_par[i][ii]; |
394 |
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]); |
395 |
if(calibdata2->DSPbad_par[i][ii]==0) |
if(calib2->Get()->DSPbad_par[i][ii]==0) |
396 |
ca->bad[jj][j][dspn2]=1; |
ca->bad[jj][j][dspn2]=1; |
397 |
else if(calibdata2->DSPbad_par[i][ii]==1) |
else if(calib2->Get()->DSPbad_par[i][ii]==1) |
398 |
ca->bad[jj][j][dspn2]=0; |
ca->bad[jj][j][dspn2]=0; |
399 |
// cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
// cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
400 |
// cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
// cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
408 |
/** |
/** |
409 |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
410 |
*/ |
*/ |
411 |
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){ |
412 |
|
|
413 |
cTrkCalib *ca = &pedsigbad_; |
// cTrkCalib *ca = &pedsigbad_; |
414 |
// ca->Reset(); |
// // ca->Reset(); |
|
|
|
|
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
|
|
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
|
415 |
|
|
416 |
CalibTrk1Event *calibdata1 = 0; |
// TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
417 |
CalibTrk2Event *calibdata2 = 0; |
// TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
|
tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
|
|
tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
|
|
tr1->GetEntry(ev_reg1); |
|
|
tr2->GetEntry(ev_reg2); |
|
|
Int_t dspn1(0),dspn2(0); |
|
418 |
|
|
419 |
// --- TEST TEST TEST TEST --- // |
// CalibTrk1Event *calibdata1 = 0; |
420 |
// TrkParams::ValidateTrkCalib(calibdata1); |
// CalibTrk2Event *calibdata2 = 0; |
421 |
// TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
// tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
422 |
UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1); |
// tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
423 |
UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
// tr1->GetEntry(ev_reg1); |
424 |
if( !test1 || !test2 ){ |
// tr2->GetEntry(ev_reg2); |
425 |
if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl; |
// Int_t dspn1(0),dspn2(0); |
426 |
TrkParams::calib.VALIDATION = 0; |
|
427 |
} |
// // --- TEST TEST TEST TEST --- // |
428 |
if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl; |
// // TrkParams::ValidateTrkCalib(calibdata1); |
429 |
|
// // TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
430 |
|
// UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1); |
431 |
|
// UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
432 |
|
// if( !test1 || !test2 ){ |
433 |
|
// if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl; |
434 |
|
// TrkParams::calib.VALIDATION = 0; |
435 |
|
// } |
436 |
|
// if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl; |
437 |
|
|
438 |
for(Int_t i=0;i<6;i++){ |
// for(Int_t i=0;i<6;i++){ |
439 |
dspn1=calibdata1->DSPnumber[i]-1; |
// dspn1=calibdata1->DSPnumber[i]-1; |
440 |
dspn2=calibdata2->DSPnumber[i]-1; |
// dspn2=calibdata2->DSPnumber[i]-1; |
441 |
/* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
// /* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
442 |
for(Int_t ii=0;ii<3072;ii++){ |
// for(Int_t ii=0;ii<3072;ii++){ |
443 |
Int_t j=(ii/128); |
// Int_t j=(ii/128); |
444 |
Int_t jj=ii-j*128; |
// Int_t jj=ii-j*128; |
445 |
if(dspn1>=0 && dspn1<12){ |
// if(dspn1>=0 && dspn1<12){ |
446 |
ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii]; |
// ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii]; |
447 |
ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii]; |
// ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii]; |
448 |
if(calibdata1->DSPbad_par[i][ii]==0) |
// if(calibdata1->DSPbad_par[i][ii]==0) |
449 |
ca->bad[jj][j][dspn1]=1; |
// ca->bad[jj][j][dspn1]=1; |
450 |
else if(calibdata1->DSPbad_par[i][ii]==1) |
// else if(calibdata1->DSPbad_par[i][ii]==1) |
451 |
ca->bad[jj][j][dspn1]=0; |
// ca->bad[jj][j][dspn1]=0; |
452 |
// cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
// // cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl; |
453 |
// cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
// // cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl; |
454 |
} |
// } |
455 |
if(dspn2>=0 && dspn2<12){ |
// if(dspn2>=0 && dspn2<12){ |
456 |
ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii]; |
// ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii]; |
457 |
ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii]; |
// ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii]; |
458 |
if(calibdata2->DSPbad_par[i][ii]==0) |
// if(calibdata2->DSPbad_par[i][ii]==0) |
459 |
ca->bad[jj][j][dspn2]=1; |
// ca->bad[jj][j][dspn2]=1; |
460 |
else if(calibdata2->DSPbad_par[i][ii]==1) |
// else if(calibdata2->DSPbad_par[i][ii]==1) |
461 |
ca->bad[jj][j][dspn2]=0; |
// ca->bad[jj][j][dspn2]=0; |
462 |
// cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
// // cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl; |
463 |
// cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
// // cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl; |
464 |
} |
// } |
465 |
}; |
// }; |
466 |
}; |
// }; |
467 |
|
|
468 |
tr1->Delete(); |
// tr1->Delete(); |
469 |
tr2->Delete(); |
// tr2->Delete(); |
470 |
}; |
// }; |
471 |
/** |
/** |
472 |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
473 |
*/ |
*/ |
474 |
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){ |
475 |
|
|
476 |
cTrkCalib *ca = &pedsigbad_; |
// cTrkCalib *ca = &pedsigbad_; |
477 |
// ca->Reset(); |
// // ca->Reset(); |
478 |
|
|
479 |
TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
// TTree *tr1 = (TTree*)f0->Get("CalibTrk1"); |
480 |
TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
// TTree *tr2 = (TTree*)f0->Get("CalibTrk2"); |
481 |
|
|
482 |
CalibTrk1Event *calibdata1 = 0; |
// CalibTrk1Event *calibdata1 = 0; |
483 |
CalibTrk2Event *calibdata2 = 0; |
// CalibTrk2Event *calibdata2 = 0; |
484 |
tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
// tr1->SetBranchAddress("CalibTrk1",&calibdata1); |
485 |
tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
// tr2->SetBranchAddress("CalibTrk2",&calibdata2); |
486 |
tr1->GetEntry(ev_reg1); |
// tr1->GetEntry(ev_reg1); |
487 |
tr2->GetEntry(ev_reg2); |
// tr2->GetEntry(ev_reg2); |
488 |
Int_t dspn1(0),dspn2(0); |
// Int_t dspn1(0),dspn2(0); |
489 |
|
|
490 |
// --- TEST TEST TEST TEST --- // |
// // --- TEST TEST TEST TEST --- // |
491 |
// TrkParams::ValidateTrkCalib(calibdata1); |
// // TrkParams::ValidateTrkCalib(calibdata1); |
492 |
// TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
// // TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
493 |
UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1); |
// UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1); |
494 |
UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
// UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
495 |
if( !test1 || !test2 ){ |
// if( !test1 || !test2 ){ |
496 |
if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl; |
// if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl; |
497 |
TrkParams::calib.VALIDATION = 0; |
// TrkParams::calib.VALIDATION = 0; |
498 |
} |
// } |
499 |
if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl; |
// if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl; |
500 |
|
|
501 |
for(Int_t i=0;i<6;i++){ |
// for(Int_t i=0;i<6;i++){ |
502 |
dspn1=calibdata1->DSPnumber[i]-1; |
// dspn1=calibdata1->DSPnumber[i]-1; |
503 |
dspn2=calibdata2->DSPnumber[i]-1; |
// dspn2=calibdata2->DSPnumber[i]-1; |
504 |
/* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
// /* cout<<"dspn1= "<<dspn1<<" dspn2= "<<dspn2<<endl; */ |
505 |
for(Int_t ii=0;ii<3072;ii++){ |
// for(Int_t ii=0;ii<3072;ii++){ |
506 |
Int_t j=(ii/128); |
// Int_t j=(ii/128); |
507 |
Int_t jj=ii-j*128; |
// Int_t jj=ii-j*128; |
508 |
if(dspn1>=0 && dspn1<12){ |
// if(dspn1>=0 && dspn1<12){ |
509 |
ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]); |
// ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]); |
510 |
ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]); |
// ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]); |
511 |
} |
// } |
512 |
if(dspn2>=0 && dspn2<12){ |
// if(dspn2>=0 && dspn2<12){ |
513 |
ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]); |
// ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]); |
514 |
ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]); |
// ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]); |
515 |
} |
// } |
516 |
}; |
// }; |
517 |
}; |
// }; |
518 |
|
|
519 |
tr1->Delete(); |
// tr1->Delete(); |
520 |
tr2->Delete(); |
// tr2->Delete(); |
521 |
}; |
// }; |
522 |
/** |
/** |
523 |
* Method to fill the tracker calibration-parameter struct from default calibration |
* Method to fill the tracker calibration-parameter struct from default calibration |
524 |
*/ |
*/ |
547 |
//------------------------- |
//------------------------- |
548 |
tr = (TTree*)f0->Get("CalibTrk1"); |
tr = (TTree*)f0->Get("CalibTrk1"); |
549 |
tr->SetBranchAddress("CalibTrk1",calib->GetPointerTo()); |
tr->SetBranchAddress("CalibTrk1",calib->GetPointerTo()); |
550 |
tr->GetEntry(ev_reg1); |
if ( tr->GetEntry(ev_reg1) <= 0 ) throw -36;//EM |
551 |
} |
} |
552 |
if(i==1){ |
if(i==1){ |
553 |
//------------------------- |
//------------------------- |
555 |
//------------------------- |
//------------------------- |
556 |
tr = (TTree*)f0->Get("CalibTrk2"); |
tr = (TTree*)f0->Get("CalibTrk2"); |
557 |
tr->SetBranchAddress("CalibTrk2",calib->GetPointerTo()); |
tr->SetBranchAddress("CalibTrk2",calib->GetPointerTo()); |
558 |
tr->GetEntry(ev_reg2); |
if ( tr->GetEntry(ev_reg2) <= 0 ) throw -36; |
559 |
} |
} |
560 |
for(Int_t ipkt=0; ipkt<NPLANE; ipkt++){ |
for(Int_t ipkt=0; ipkt<NPLANE; ipkt++){ |
561 |
Int_t view = calib->GetView(ipkt); |
Int_t view = calib->GetView(ipkt); |
679 |
UInt_t index = TrkParams::GetIndex( type ); |
UInt_t index = TrkParams::GetIndex( type ); |
680 |
if(index < 0)return false; |
if(index < 0)return false; |
681 |
|
|
682 |
UInt_t runheadtime=0; |
|
683 |
|
UInt_t runheadtime=1; |
684 |
UInt_t runid=0; |
UInt_t runid=0; |
685 |
// UInt_t runheadtime = numeric_limits<UInt_t>::max(); |
// UInt_t runheadtime = numeric_limits<UInt_t>::max(); |
686 |
if(glrun){ |
if(glrun){ |
687 |
runheadtime = glrun->RUNHEADER_TIME; |
runheadtime = glrun->RUNHEADER_TIME; |
688 |
runid = glrun->ID; |
runid = glrun->ID; |
689 |
}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 |
690 |
|
cout <<"Bool_t TrkParams::Set(GL_RUN* "<<glrun<<" ,TSQLServer* "<<dbc<<" ,UInt_t "<<type<<" ) >> GL_RUN==NULL -- taking first entry (**WARNING** check that this is ok!! )"<<endl; |
|
// if(TrkParams::VerboseMode()) |
|
|
if(TrkParams::VerboseMode())cout << "<< set TrkParams type "<<type<<" from DB << RUN "<<runid<<endl; |
|
691 |
|
|
692 |
|
|
693 |
if( !TrkParams::IsLoaded(type) || |
if( !TrkParams::IsLoaded(type) || |
695 |
runheadtime > gl[index].TO_TIME || |
runheadtime > gl[index].TO_TIME || |
696 |
false ){ |
false ){ |
697 |
|
|
698 |
|
// if(TrkParams::VerboseMode()) |
699 |
|
if(TrkParams::DebugMode())cout << "<< set TrkParams type "<<type<<" from DB << RUN "<<runid<<endl; |
700 |
|
|
701 |
bool LOCAL_CONNECTION = false; |
bool LOCAL_CONNECTION = false; |
702 |
if( !dbc || (dbc && !dbc->IsConnected()) ){ |
if( !dbc || (dbc && !dbc->IsConnected()) ){ |
703 |
|
|
704 |
if(TrkParams::WarningMode())cout <<" Missing DB connection -- check PAMELA environment variables "<<endl; |
// if(TrkParams::WarningMode())cout <<" Missing DB connection -- check PAMELA environment variables "<<endl; |
705 |
dbc = TrkParams::SetDBConnection(); |
dbc = TrkParams::SetDBConnection(); |
706 |
if(dbc && dbc->IsConnected())LOCAL_CONNECTION = true; |
if(dbc && dbc->IsConnected())LOCAL_CONNECTION = true; |
707 |
|
|
784 |
|
|
785 |
Int_t index = TrkParams::GetIndex( type ); |
Int_t index = TrkParams::GetIndex( type ); |
786 |
if( index<0 )return false; |
if( index<0 )return false; |
787 |
if( glload[index] )return true; |
if( glload[index] )return false; |
|
|
|
788 |
if( glpath[index].IsNull() )TrkParams::Set(type); |
if( glpath[index].IsNull() )TrkParams::Set(type); |
789 |
|
|
790 |
switch( type ){ |
switch( type ){ |
1174 |
int nangbin = TrkParams::GetPFA_NbinsAngle(); |
int nangbin = TrkParams::GetPFA_NbinsAngle(); |
1175 |
int istart = (int)(nangbin/2); |
int istart = (int)(nangbin/2); |
1176 |
int idbin = -1; |
int idbin = -1; |
1177 |
|
// cout << angle <<" ??" << endl; |
1178 |
if( angle > pfa_.angR[istart] ){ |
if( angle > pfa_.angR[istart] ){ |
1179 |
idbin = nangbin-1; |
idbin = nangbin-1; |
1180 |
for(int id=istart+1; id<nangbin; id++ ){ |
for(int id=istart+1; id<nangbin; id++ ){ |
1181 |
|
// cout << id << endl; |
1182 |
if( pfa_.angR[id] >= angle ){ |
if( pfa_.angR[id] >= angle ){ |
1183 |
idbin = id; |
idbin = id; |
1184 |
break; |
break; |
1187 |
}else{ |
}else{ |
1188 |
idbin = 0; |
idbin = 0; |
1189 |
for(int id=istart; id>=0; id-- ){ |
for(int id=istart; id>=0; id-- ){ |
1190 |
|
// cout << id << endl; |
1191 |
if( pfa_.angL[id] < angle ){ |
if( pfa_.angL[id] < angle ){ |
1192 |
idbin = id; |
idbin = id; |
1193 |
break; |
break; |
1195 |
} |
} |
1196 |
|
|
1197 |
} |
} |
1198 |
|
// cout << ">>> "<<idbin<<" "<<pfa_.angL[idbin]<<" "<<pfa_.angR[idbin]<<endl; |
1199 |
return idbin; |
return idbin; |
1200 |
} |
} |
1201 |
|
|