/[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.3 by pam-fi, Fri Mar 16 20:26:33 2007 UTC revision 1.4 by pam-fi, Mon Mar 19 17:24:29 2007 UTC
# Line 72  Bool_t TrkParams::SetCalib( GL_RUN *glru Line 72  Bool_t TrkParams::SetCalib( GL_RUN *glru
72              return false;              return false;
73          }          }
74    
75  //      cout << "selected "<<q2.ID<<" from_time "<<q2.FROM_TIME<<" to time "<<q2.TO_TIME<<endl;          cout << "selected "<<q2.ID<<" from_time "<<q2.FROM_TIME<<" to time "<<q2.TO_TIME<<" --> VALIDATION "<<q2.VALIDATION<<endl;
76          calib      = q2;          calib      = q2;
77          calibpathf = q3.PATH + q3.NAME;          calibpathf = q3.PATH + q3.NAME;
78          calib104   = (glrun->TRK_CALIB_USED==104);          calib104   = (glrun->TRK_CALIB_USED==104);
# Line 91  Bool_t TrkParams::SetCalib( GL_RUN *glru Line 91  Bool_t TrkParams::SetCalib( GL_RUN *glru
91  };  };
92    
93  /**  /**
94     * Method to "validate" tracker calibration. Implemented for test purpose. Effective implementation
95     * in YodaProfiler.
96     */
97    UInt_t TrkParams::ValidateTrkCalib( CalibTrk1Event* caltrk){
98    
99        Int_t vorder[]={5,5,3,3,4,4,2,2,1,1,0,0};
100    //    UInt_t timeaftercalib=120000; //2000;
101        TString classname = caltrk->GetName();
102    //  ----------
103    //  Check CRCs
104    //  ----------
105        for(Int_t ipkt=0; ipkt<6; ipkt++){
106            if( caltrk->crc_hcal[ipkt] ){
107                cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- CRC error in calibration header: pkt "<<ipkt<<endl;    
108                return 0; // :-(
109            }
110            for(Int_t ilad=0; ilad<3; ilad++)if( caltrk->crc_cal[ipkt][ilad] ){
111                cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- CRC error in calibration packet: pkt "<<ipkt<<endl;    
112                return 0; // :-(
113            }
114        }
115    //  -----------------------
116    //  Check missing packets:
117    //  -----------------------
118    //    Readout order:
119    //    ------------------
120    //    DSP   packet board
121    //    ------------------
122    //    12    0      1
123    //    10    1      1
124    //     8    2      1
125    //     4    3      1
126    //     6    4      1
127    //     2    5      1
128    //    ------------------
129    //    11    0      2
130    //     9    1      2
131    //     7    2      2
132    //     3    3      2
133    //     5    4      2
134    //     1    5      2
135    //    ------------------
136    //  -------------------------------------------------
137    //  Check if it is first or second calibration packet
138    //  -------------------------------------------------
139        UInt_t build=0;
140        UInt_t base=0;
141        UInt_t mask=0;
142        if(classname.Contains("CalibTrk1Event")){
143            base=12;
144            mask=0x03F000;
145        }
146        if(classname.Contains("CalibTrk2Event")){
147            base=18;
148            mask=0xFC0000;
149        }
150    //  -------------------------------------------------
151    //  Count number of packets and set build variable
152    //  -------------------------------------------------
153        Int_t  npkts=0;
154        for(Int_t ipkt=0; ipkt<6; ipkt++){
155            if(caltrk->DSPnumber[ipkt]>0 && caltrk->DSPnumber[ipkt]<=12){
156                npkts++;
157                build = build | ( 1<<(base+vorder[caltrk->DSPnumber[ipkt]-1]) );
158            };
159        }
160        if( npkts==6 )return 1; // :-)
161        else cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- there might be some missing packets :-(  ( "<<npkts<<" instead of 6 ) --> "<<endl;    
162    
163    //    cout << classname << " "<<eh->GetPscuHeader()->GetOrbitalTime()<<endl;
164    
165    //  -----------------------------------------------
166    //  If missing packets: check the acq configuration
167    //  (some DSPs might be excluded from acquisition)
168    //  -----------------------------------------------
169    
170    //  -----------------------------------------------
171    //  retrieve the first run header after calib
172    //  -----------------------------------------------
173    //      PacketType *pctp;
174    //      EventCounter *cod;
175    //      cod = eh->GetCounter();
176    //      Int_t irun = cod->Get(pctp->RunHeader);
177    //      TTree *rh=(TTree*)file->Get("RunHeader");
178    //      if ( !rh || rh->IsZombie() ) throw -17;
179    //      if( rh->GetEntries() == irun ){
180    //        if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) no runs after calib (1)  -- cannot validate :-( "<<endl;
181    //       return 0; // :-(
182    //      }
183    
184    //      RunHeaderEvent *run  = 0;
185    //      EventHeader    *hrun = 0;
186    //      rh->SetBranchAddress("RunHeader", &run);
187    //      rh->SetBranchAddress("Header", &hrun);
188    //      rh->GetEntry(irun);
189    // //     cout << classname << " "<<eh->GetPscuHeader()->GetOrbitalTime() << " Run " << hrun->GetPscuHeader()->GetOrbitalTime() <<endl;
190    
191    //      if( OBT(hrun->GetPscuHeader()->GetOrbitalTime()) < OBT(eh->GetPscuHeader()->GetOrbitalTime())){
192    //        if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) no runs after calib (2) -- cannot validate :-( "<<endl;
193    //       return 0; // :-(
194    //      }
195        
196    //      if( !run->RM_ACQ_AFTER_CALIB ){
197    //        if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) RM_ACQ_AFTER_CALIB=0    -- cannot validate :-( "<<endl;
198    //       return 0; // :-(
199    //      }
200    
201    //      UInt_t dtime = OBT(hrun->GetPscuHeader()->GetOrbitalTime()) - OBT(eh->GetPscuHeader()->GetOrbitalTime());
202    //      if( dtime > timeaftercalib ){
203    //       if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) run after calib too far ( "<<dtime<<"ms ) -- cannot validate :-( "<<endl;
204    //       return 0; // :-(
205    //      }
206        
207    //      if( (run->ACQ_BUILD_INFO & mask) != build ){
208    //       if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) ACQ_BUILD_INFO= >>> "<<hex << (run->ACQ_BUILD_INFO&mask) << " != "<< build << dec<<endl;
209    //       return 0; // :-(
210    //      }
211          return 1; // :-)
212    
213    }
214    /**
215   * Method to fill the tracker calibration-parameter struct from on-line calibrations   * Method to fill the tracker calibration-parameter struct from on-line calibrations
216   */   */
217  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){
# Line 107  void TrkParams::FillACalibFrom(TFile* f0 Line 228  void TrkParams::FillACalibFrom(TFile* f0
228      tr1->GetEntry(ev_reg1);      tr1->GetEntry(ev_reg1);
229      tr2->GetEntry(ev_reg2);      tr2->GetEntry(ev_reg2);
230      Int_t dspn1(0),dspn2(0);      Int_t dspn1(0),dspn2(0);
231    
232        // --- TEST TEST TEST TEST --- //
233        TrkParams::ValidateTrkCalib(calibdata1);
234        TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);
235                    
236      for(Int_t i=0;i<6;i++){      for(Int_t i=0;i<6;i++){
237          dspn1=calibdata1->DSPnumber[i]-1;          dspn1=calibdata1->DSPnumber[i]-1;
# Line 162  void TrkParams::FillFCalibFrom(TFile* f0 Line 287  void TrkParams::FillFCalibFrom(TFile* f0
287      tr1->GetEntry(ev_reg1);      tr1->GetEntry(ev_reg1);
288      tr2->GetEntry(ev_reg2);      tr2->GetEntry(ev_reg2);
289      Int_t dspn1(0),dspn2(0);      Int_t dspn1(0),dspn2(0);
290    
291        // --- TEST TEST TEST TEST --- //
292        TrkParams::ValidateTrkCalib(calibdata1);
293        TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);
294                    
295      for(Int_t i=0;i<6;i++){      for(Int_t i=0;i<6;i++){
296          dspn1=calibdata1->DSPnumber[i]-1;          dspn1=calibdata1->DSPnumber[i]-1;
# Line 214  void TrkParams::FillTCalibFrom(TFile* f0 Line 343  void TrkParams::FillTCalibFrom(TFile* f0
343      tr2->GetEntry(ev_reg2);      tr2->GetEntry(ev_reg2);
344      Int_t dspn1(0),dspn2(0);      Int_t dspn1(0),dspn2(0);
345                    
346        // --- TEST TEST TEST TEST --- //
347        TrkParams::ValidateTrkCalib(calibdata1);
348        TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2);
349    
350      for(Int_t i=0;i<6;i++){      for(Int_t i=0;i<6;i++){
351          dspn1=calibdata1->DSPnumber[i]-1;          dspn1=calibdata1->DSPnumber[i]-1;
352          dspn2=calibdata2->DSPnumber[i]-1;          dspn2=calibdata2->DSPnumber[i]-1;

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.23