/[PAMELA software]/DarthVader/TrackerLevel2/src/TrkParams.cpp
ViewVC logotype

Diff of /DarthVader/TrackerLevel2/src/TrkParams.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.22 by pam-fi, Sat Mar 22 08:32:50 2008 UTC revision 1.27 by pam-fi, Tue Nov 29 13:25:07 2011 UTC
# Line 18  TString      TrkParams::calibpatht = ""; Line 18  TString      TrkParams::calibpatht = "";
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  // -------------------------  // -------------------------
# Line 141  Bool_t TrkParams::SetCalib( GL_RUN *glru Line 143  Bool_t TrkParams::SetCalib( GL_RUN *glru
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    
# Line 173  Bool_t TrkParams::SetCalib( GL_RUN *glru Line 175  Bool_t TrkParams::SetCalib( GL_RUN *glru
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                delete dbc;
181              if(TrkParams::DebugMode()){              if(TrkParams::DebugMode()){
182                  cout << " DB connection closed."<<endl;                  cout << " DB connection closed."<<endl;
183              }                    }      
# Line 336  void TrkParams::FillACalibFrom(TFile* f0 Line 338  void TrkParams::FillACalibFrom(TFile* f0
338      TTree *tr1 = (TTree*)f0->Get("CalibTrk1");        TTree *tr1 = (TTree*)f0->Get("CalibTrk1");  
339      TTree *tr2 = (TTree*)f0->Get("CalibTrk2");      TTree *tr2 = (TTree*)f0->Get("CalibTrk2");
340    
341      CalibTrk1Event *calibdata1 = 0;      if(!calib1)calib1 = new TrkCalib();
342      CalibTrk2Event *calibdata2 = 0;      if(!calib2)calib2 = new TrkCalib();
343      tr1->SetBranchAddress("CalibTrk1",&calibdata1);  //     calibx->Set(calibdata1);
344      tr2->SetBranchAddress("CalibTrk2",&calibdata2);  //     caliby->Set(calibdata2);
345      tr1->GetEntry(ev_reg1);  
346      tr2->GetEntry(ev_reg2);  //     CalibTrk1Event *calibdata1 = 0;
347    //     CalibTrk2Event *calibdata2 = 0;
348    //     tr1->SetBranchAddress("CalibTrk1",&calibdata1);
349    //     tr2->SetBranchAddress("CalibTrk2",&calibdata2);
350        tr1->SetBranchAddress("CalibTrk1",calib1->GetPointerTo());
351        tr2->SetBranchAddress("CalibTrk2",calib2->GetPointerTo());
352        if ( tr1->GetEntry(ev_reg1) <= 0 ) throw -36;//EM
353        if ( tr2->GetEntry(ev_reg2) <= 0 ) throw -36;//EM
354      Int_t dspn1(0),dspn2(0);      Int_t dspn1(0),dspn2(0);
355    
356    
357      // --- TEST TEST TEST TEST --- //      // --- TEST TEST TEST TEST --- //
358  //    TrkParams::ValidateTrkCalib(calibdata1);  //    TrkParams::ValidateTrkCalib(calib1->Get());
359  //    TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);  //    TrkParams::ValidateTrkCalib((CalibTrk1Event*)calib2->Get());
360    
361      UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1);      UInt_t test1 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)(calib1->Get()));
362      UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);      UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)(calib2->Get()));
363      if( !test1 || !test2 ){      if( !test1 || !test2 ){
364          if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl;  //      if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl;
365          TrkParams::calib.VALIDATION = 0;          TrkParams::calib.VALIDATION = 0;
366      }      }
367      if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl;  //    if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl;
368    
369      for(Int_t i=0;i<6;i++){      for(Int_t i=0;i<6;i++){
370          dspn1=calibdata1->DSPnumber[i]-1;  
371          dspn2=calibdata2->DSPnumber[i]-1;  
372            dspn1=calib1->Get()->DSPnumber[i]-1;
373            dspn2=calib2->Get()->DSPnumber[i]-1;
374  //      cout<<"dspn1= "<<dspn1<<"   dspn2= "<<dspn2<<endl;        //      cout<<"dspn1= "<<dspn1<<"   dspn2= "<<dspn2<<endl;      
375          for(Int_t ii=0;ii<3072;ii++){          for(Int_t ii=0;ii<3072;ii++){
376              Int_t j=(ii/128);              Int_t j=(ii/128);
377              Int_t jj=ii-j*128;              Int_t jj=ii-j*128;
378              if(dspn1>=0 && dspn1<12){              if(dspn1>=0 && dspn1<12){
379                  ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii];                  ca->pedestal[jj][j][dspn1]=calib1->Get()->DSPped_par[i][ii];
380                  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]);
381                  ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii];                  ca->sigma[jj][j][dspn1]=calib1->Get()->DSPsig_par[i][ii];
382                  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]);
383                  if(calibdata1->DSPbad_par[i][ii]==0)                  if(calib1->Get()->DSPbad_par[i][ii]==0)
384                      ca->bad[jj][j][dspn1]=1;                      ca->bad[jj][j][dspn1]=1;
385                  else if(calibdata1->DSPbad_par[i][ii]==1)                  else if(calib1->Get()->DSPbad_par[i][ii]==1)
386                      ca->bad[jj][j][dspn1]=0;                      ca->bad[jj][j][dspn1]=0;
387                  //            cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl;                  //            cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl;
388                  //        cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl;                  //        cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl;
389              }              }
390    
391              if(dspn2>=0 && dspn2<12){              if(dspn2>=0 && dspn2<12){
392                  ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii];                  ca->pedestal[jj][j][dspn2]=calib2->Get()->DSPped_par[i][ii];
393                  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]);
394                  ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii];                  ca->sigma[jj][j][dspn2]=calib2->Get()->DSPsig_par[i][ii];
395                  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]);
396                  if(calibdata2->DSPbad_par[i][ii]==0)                  if(calib2->Get()->DSPbad_par[i][ii]==0)
397                      ca->bad[jj][j][dspn2]=1;                      ca->bad[jj][j][dspn2]=1;
398                  else if(calibdata2->DSPbad_par[i][ii]==1)                  else if(calib2->Get()->DSPbad_par[i][ii]==1)
399                      ca->bad[jj][j][dspn2]=0;                      ca->bad[jj][j][dspn2]=0;
400                  //        cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl;                  //        cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl;
401                  //        cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl;                  //        cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl;
# Line 397  void TrkParams::FillACalibFrom(TFile* f0 Line 409  void TrkParams::FillACalibFrom(TFile* f0
409  /**  /**
410   * Method to fill the tracker calibration-parameter struct from on-line calibrations   * Method to fill the tracker calibration-parameter struct from on-line calibrations
411   */   */
412  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){
413    
414      cTrkCalib *ca = &pedsigbad_;  //     cTrkCalib *ca = &pedsigbad_;
415  //    ca->Reset();  // //    ca->Reset();
416    
417      TTree *tr1 = (TTree*)f0->Get("CalibTrk1");    //     TTree *tr1 = (TTree*)f0->Get("CalibTrk1");  
418      TTree *tr2 = (TTree*)f0->Get("CalibTrk2");  //     TTree *tr2 = (TTree*)f0->Get("CalibTrk2");
419    
420      CalibTrk1Event *calibdata1 = 0;  //     CalibTrk1Event *calibdata1 = 0;
421      CalibTrk2Event *calibdata2 = 0;  //     CalibTrk2Event *calibdata2 = 0;
422      tr1->SetBranchAddress("CalibTrk1",&calibdata1);  //     tr1->SetBranchAddress("CalibTrk1",&calibdata1);
423      tr2->SetBranchAddress("CalibTrk2",&calibdata2);  //     tr2->SetBranchAddress("CalibTrk2",&calibdata2);
424      tr1->GetEntry(ev_reg1);  //     tr1->GetEntry(ev_reg1);
425      tr2->GetEntry(ev_reg2);  //     tr2->GetEntry(ev_reg2);
426      Int_t dspn1(0),dspn2(0);  //     Int_t dspn1(0),dspn2(0);
427    
428      // --- TEST TEST TEST TEST --- //  //     // --- TEST TEST TEST TEST --- //
429  //     TrkParams::ValidateTrkCalib(calibdata1);  // //     TrkParams::ValidateTrkCalib(calibdata1);
430  //     TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);  // //     TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);
431      UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1);  //     UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1);
432      UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);  //     UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);
433      if( !test1 || !test2 ){  //     if( !test1 || !test2 ){
434          if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl;  //      if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl;
435          TrkParams::calib.VALIDATION = 0;  //      TrkParams::calib.VALIDATION = 0;
436      }  //     }
437      if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl;  //     if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl;
438                    
439      for(Int_t i=0;i<6;i++){  //     for(Int_t i=0;i<6;i++){
440          dspn1=calibdata1->DSPnumber[i]-1;  //      dspn1=calibdata1->DSPnumber[i]-1;
441          dspn2=calibdata2->DSPnumber[i]-1;  //      dspn2=calibdata2->DSPnumber[i]-1;
442          /*     cout<<"dspn1= "<<dspn1<<"   dspn2= "<<dspn2<<endl; */  //      /*     cout<<"dspn1= "<<dspn1<<"   dspn2= "<<dspn2<<endl; */
443          for(Int_t ii=0;ii<3072;ii++){  //      for(Int_t ii=0;ii<3072;ii++){
444              Int_t j=(ii/128);  //          Int_t j=(ii/128);
445              Int_t jj=ii-j*128;  //          Int_t jj=ii-j*128;
446              if(dspn1>=0 && dspn1<12){  //          if(dspn1>=0 && dspn1<12){
447                  ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii];  //              ca->pedestal[jj][j][dspn1]=calibdata1->DSPped_par[i][ii];
448                  ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii];  //              ca->sigma[jj][j][dspn1]=calibdata1->DSPsig_par[i][ii];
449                  if(calibdata1->DSPbad_par[i][ii]==0)  //              if(calibdata1->DSPbad_par[i][ii]==0)
450                      ca->bad[jj][j][dspn1]=1;  //                  ca->bad[jj][j][dspn1]=1;
451                  else if(calibdata1->DSPbad_par[i][ii]==1)  //              else if(calibdata1->DSPbad_par[i][ii]==1)
452                      ca->bad[jj][j][dspn1]=0;  //                  ca->bad[jj][j][dspn1]=0;
453                  //            cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl;  //              //            cout<<"sigma trk1= "<<sigma[jj][j][dspn1]<<endl;
454                  //        cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl;  //              //        cout<<"sigma_t trk1= "<<sigma_t[jj][j][dspn1]<<endl;
455              }  //          }
456              if(dspn2>=0 && dspn2<12){  //          if(dspn2>=0 && dspn2<12){
457                  ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii];  //              ca->pedestal[jj][j][dspn2]=calibdata2->DSPped_par[i][ii];
458                  ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii];  //              ca->sigma[jj][j][dspn2]=calibdata2->DSPsig_par[i][ii];
459                  if(calibdata2->DSPbad_par[i][ii]==0)  //              if(calibdata2->DSPbad_par[i][ii]==0)
460                      ca->bad[jj][j][dspn2]=1;  //                  ca->bad[jj][j][dspn2]=1;
461                  else if(calibdata2->DSPbad_par[i][ii]==1)  //              else if(calibdata2->DSPbad_par[i][ii]==1)
462                      ca->bad[jj][j][dspn2]=0;  //                  ca->bad[jj][j][dspn2]=0;
463                  //        cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl;  //              //        cout<<"sigma trk2= "<<sigma[jj][j][dspn2]<<endl;
464                  //        cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl;  //              //        cout<<"sigma_t trk2= "<<sigma_t[jj][j][dspn2]<<endl;
465              }  //          }
466          };  //      };
467      };  //     };
468                    
469      tr1->Delete();  //     tr1->Delete();
470      tr2->Delete();  //     tr2->Delete();
471  };  // };
472  /**  /**
473   * Method to fill the tracker calibration-parameter struct from on-line calibrations   * Method to fill the tracker calibration-parameter struct from on-line calibrations
474   */   */
475  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){
476    
477      cTrkCalib *ca = &pedsigbad_;  //     cTrkCalib *ca = &pedsigbad_;
478  //    ca->Reset();  // //    ca->Reset();
479    
480      TTree *tr1 = (TTree*)f0->Get("CalibTrk1");    //     TTree *tr1 = (TTree*)f0->Get("CalibTrk1");  
481      TTree *tr2 = (TTree*)f0->Get("CalibTrk2");  //     TTree *tr2 = (TTree*)f0->Get("CalibTrk2");
482    
483      CalibTrk1Event *calibdata1 = 0;  //     CalibTrk1Event *calibdata1 = 0;
484      CalibTrk2Event *calibdata2 = 0;  //     CalibTrk2Event *calibdata2 = 0;
485      tr1->SetBranchAddress("CalibTrk1",&calibdata1);  //     tr1->SetBranchAddress("CalibTrk1",&calibdata1);
486      tr2->SetBranchAddress("CalibTrk2",&calibdata2);  //     tr2->SetBranchAddress("CalibTrk2",&calibdata2);
487      tr1->GetEntry(ev_reg1);  //     tr1->GetEntry(ev_reg1);
488      tr2->GetEntry(ev_reg2);  //     tr2->GetEntry(ev_reg2);
489      Int_t dspn1(0),dspn2(0);  //     Int_t dspn1(0),dspn2(0);
490                    
491      // --- TEST TEST TEST TEST --- //  //     // --- TEST TEST TEST TEST --- //
492  //     TrkParams::ValidateTrkCalib(calibdata1);  // //     TrkParams::ValidateTrkCalib(calibdata1);
493  //     TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);  // //     TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);
494      UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1);  //     UInt_t test1 = TrkParams::ValidateTrkCalib(calibdata1);
495      UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);  //     UInt_t test2 = TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);
496      if( !test1 || !test2 ){  //     if( !test1 || !test2 ){
497          if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl;  //      if(TrkParams::calib.VALIDATION==1)cout << "--> modify DB info "<<endl;
498          TrkParams::calib.VALIDATION = 0;  //      TrkParams::calib.VALIDATION = 0;
499      }  //     }
500      if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl;  //     if(TrkParams::calib.VALIDATION==0)cout << " ** WARNING ** Calibration not validated "<<endl;
501    
502      for(Int_t i=0;i<6;i++){  //     for(Int_t i=0;i<6;i++){
503          dspn1=calibdata1->DSPnumber[i]-1;  //      dspn1=calibdata1->DSPnumber[i]-1;
504          dspn2=calibdata2->DSPnumber[i]-1;  //      dspn2=calibdata2->DSPnumber[i]-1;
505          /*     cout<<"dspn1= "<<dspn1<<"   dspn2= "<<dspn2<<endl; */  //      /*     cout<<"dspn1= "<<dspn1<<"   dspn2= "<<dspn2<<endl; */
506          for(Int_t ii=0;ii<3072;ii++){  //      for(Int_t ii=0;ii<3072;ii++){
507              Int_t j=(ii/128);  //          Int_t j=(ii/128);
508              Int_t jj=ii-j*128;  //          Int_t jj=ii-j*128;
509              if(dspn1>=0 && dspn1<12){  //          if(dspn1>=0 && dspn1<12){
510                  ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]);  //              ca->pedestal_t[jj][j][dspn1]=aint(calibdata1->DSPped_par[i][ii]);
511                  ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]);  //              ca->sigma_t[jj][j][dspn1]=anint(calibdata1->DSPsig_par[i][ii]);
512              }  //          }
513              if(dspn2>=0 && dspn2<12){  //          if(dspn2>=0 && dspn2<12){
514                  ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]);  //              ca->pedestal_t[jj][j][dspn2]=aint(calibdata2->DSPped_par[i][ii]);
515                  ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]);  //              ca->sigma_t[jj][j][dspn2]=anint(calibdata2->DSPsig_par[i][ii]);
516              }    //          }  
517          };  //      };
518      };  //     };
519                    
520      tr1->Delete();  //     tr1->Delete();
521      tr2->Delete();  //     tr2->Delete();
522  };  // };
523  /**  /**
524   * Method to fill the tracker calibration-parameter struct from default calibration   * Method to fill the tracker calibration-parameter struct from default calibration
525   */   */
# Line 536  void TrkParams::FillMask(TFile* f0, Int_ Line 548  void TrkParams::FillMask(TFile* f0, Int_
548              //-------------------------              //-------------------------
549              tr = (TTree*)f0->Get("CalibTrk1");                tr = (TTree*)f0->Get("CalibTrk1");  
550              tr->SetBranchAddress("CalibTrk1",calib->GetPointerTo());              tr->SetBranchAddress("CalibTrk1",calib->GetPointerTo());
551              tr->GetEntry(ev_reg1);              if ( tr->GetEntry(ev_reg1) <= 0 ) throw -36;//EM
552          }          }
553          if(i==1){          if(i==1){
554              //-------------------------              //-------------------------
# Line 544  void TrkParams::FillMask(TFile* f0, Int_ Line 556  void TrkParams::FillMask(TFile* f0, Int_
556              //-------------------------              //-------------------------
557              tr = (TTree*)f0->Get("CalibTrk2");              tr = (TTree*)f0->Get("CalibTrk2");
558              tr->SetBranchAddress("CalibTrk2",calib->GetPointerTo());              tr->SetBranchAddress("CalibTrk2",calib->GetPointerTo());
559              tr->GetEntry(ev_reg2);              if ( tr->GetEntry(ev_reg2) <= 0 ) throw -36;
560          }          }
561          for(Int_t ipkt=0; ipkt<NPLANE; ipkt++){          for(Int_t ipkt=0; ipkt<NPLANE; ipkt++){
562              Int_t view   = calib->GetView(ipkt);              Int_t view   = calib->GetView(ipkt);
# Line 668  Bool_t TrkParams::Set( GL_RUN* glrun , T Line 680  Bool_t TrkParams::Set( GL_RUN* glrun , T
680      UInt_t index = TrkParams::GetIndex( type );      UInt_t index = TrkParams::GetIndex( type );
681      if(index < 0)return false;      if(index < 0)return false;
682    
683      UInt_t runheadtime=0;  
684        UInt_t runheadtime=1;
685      UInt_t runid=0;      UInt_t runid=0;
686  //    UInt_t runheadtime = numeric_limits<UInt_t>::max();  //    UInt_t runheadtime = numeric_limits<UInt_t>::max();
687      if(glrun){      if(glrun){
688          runheadtime = glrun->RUNHEADER_TIME;          runheadtime = glrun->RUNHEADER_TIME;
689          runid       = glrun->ID;          runid       = glrun->ID;
690      }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
691            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;  
692    
693    
694      if( !TrkParams::IsLoaded(type) ||      if( !TrkParams::IsLoaded(type) ||
# Line 685  Bool_t TrkParams::Set( GL_RUN* glrun , T Line 696  Bool_t TrkParams::Set( GL_RUN* glrun , T
696          runheadtime > gl[index].TO_TIME     ||            runheadtime > gl[index].TO_TIME     ||  
697          false ){          false ){
698    
699    //    if(TrkParams::VerboseMode())
700            if(TrkParams::DebugMode())cout << "<< set TrkParams type "<<type<<" from DB << RUN "<<runid<<endl;
701    
702          bool LOCAL_CONNECTION = false;          bool LOCAL_CONNECTION = false;
703          if( !dbc || (dbc && !dbc->IsConnected()) ){          if( !dbc || (dbc && !dbc->IsConnected()) ){
704    
705              if(TrkParams::WarningMode())cout <<" Missing DB connection -- check PAMELA environment variables "<<endl;  //          if(TrkParams::WarningMode())cout <<" Missing DB connection -- check PAMELA environment variables "<<endl;
706              dbc = TrkParams::SetDBConnection();              dbc = TrkParams::SetDBConnection();
707              if(dbc && dbc->IsConnected())LOCAL_CONNECTION = true;              if(dbc && dbc->IsConnected())LOCAL_CONNECTION = true;
708    
# Line 771  Bool_t TrkParams::Load(UInt_t type){ Line 785  Bool_t TrkParams::Load(UInt_t type){
785            
786      Int_t index = TrkParams::GetIndex( type );      Int_t index = TrkParams::GetIndex( type );
787      if( index<0 )return false;      if( index<0 )return false;
788      if( glload[index] )return true;      if( glload[index] )return false;
   
789      if( glpath[index].IsNull() )TrkParams::Set(type);      if( glpath[index].IsNull() )TrkParams::Set(type);
790    
791      switch( type ){      switch( type ){
# Line 856  Bool_t TrkParams::Load(UInt_t type){ Line 869  Bool_t TrkParams::Load(UInt_t type){
869  }  }
870    
871  Bool_t TrkParams::Load( ){  Bool_t TrkParams::Load( ){
872      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;
873      return true;      for(Int_t i=0 ; i<NTYPES; i++)
874          if(!glload[i] && trkparamtype[i]>0 )
875            if( !TrkParams::Load(trkparamtype[i]) )
876              result = false;
877        return result;
878  };  };
879  Bool_t TrkParams::IsLoaded( ){  Bool_t TrkParams::IsLoaded( ){
880      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;
# Line 1162  int TrkParams::GetPFA_AngleBin(float ang Line 1179  int TrkParams::GetPFA_AngleBin(float ang
1179      int nangbin = TrkParams::GetPFA_NbinsAngle();      int nangbin = TrkParams::GetPFA_NbinsAngle();
1180      int istart = (int)(nangbin/2);      int istart = (int)(nangbin/2);
1181      int idbin = -1;      int idbin = -1;
1182    //    cout << angle <<" ??" << endl;
1183      if( angle > pfa_.angR[istart] ){      if( angle > pfa_.angR[istart] ){
1184          idbin = nangbin-1;          idbin = nangbin-1;
1185          for(int id=istart+1; id<nangbin; id++ ){          for(int id=istart+1; id<nangbin; id++ ){
1186    //          cout << id << endl;
1187              if( pfa_.angR[id] >= angle ){              if( pfa_.angR[id] >= angle ){
1188                  idbin = id;                  idbin = id;
1189                  break;                  break;
# Line 1173  int TrkParams::GetPFA_AngleBin(float ang Line 1192  int TrkParams::GetPFA_AngleBin(float ang
1192      }else{      }else{
1193          idbin = 0;          idbin = 0;
1194          for(int id=istart; id>=0; id-- ){          for(int id=istart; id>=0; id-- ){
1195    //          cout << id << endl;
1196              if( pfa_.angL[id] < angle ){              if( pfa_.angL[id] < angle ){
1197                  idbin = id;                  idbin = id;
1198                  break;                  break;
# Line 1180  int TrkParams::GetPFA_AngleBin(float ang Line 1200  int TrkParams::GetPFA_AngleBin(float ang
1200          }          }
1201    
1202      }      }
1203    //    cout << ">>> "<<idbin<<" "<<pfa_.angL[idbin]<<" "<<pfa_.angR[idbin]<<endl;
1204      return idbin;      return idbin;
1205  }  }
1206    

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.27

  ViewVC Help
Powered by ViewVC 1.1.23