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); |
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 |
|
cout << "DSP n. "<<caltrk->DSPnumber[ipkt]<<endl; |
107 |
|
if(caltrk->DSPnumber[ipkt]>0 && caltrk->DSPnumber[ipkt]<=12){ |
108 |
|
if( caltrk->crc_hcal[ipkt] ){ |
109 |
|
cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- CRC error in calibration header: pkt "<<ipkt<<endl; |
110 |
|
// return 0; // :-( |
111 |
|
} |
112 |
|
for(Int_t ilad=0; ilad<3; ilad++)if( caltrk->crc_cal[ipkt][ilad] ){ |
113 |
|
cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- CRC error in calibration packet: pkt "<<ipkt<<endl; |
114 |
|
// return 0; // :-( |
115 |
|
} |
116 |
|
} |
117 |
|
} |
118 |
|
// ----------------------- |
119 |
|
// Check missing packets: |
120 |
|
// ----------------------- |
121 |
|
// Readout order: |
122 |
|
// ------------------ |
123 |
|
// DSP packet board |
124 |
|
// ------------------ |
125 |
|
// 12 0 1 |
126 |
|
// 10 1 1 |
127 |
|
// 8 2 1 |
128 |
|
// 4 3 1 |
129 |
|
// 6 4 1 |
130 |
|
// 2 5 1 |
131 |
|
// ------------------ |
132 |
|
// 11 0 2 |
133 |
|
// 9 1 2 |
134 |
|
// 7 2 2 |
135 |
|
// 3 3 2 |
136 |
|
// 5 4 2 |
137 |
|
// 1 5 2 |
138 |
|
// ------------------ |
139 |
|
// ------------------------------------------------- |
140 |
|
// Check if it is first or second calibration packet |
141 |
|
// ------------------------------------------------- |
142 |
|
UInt_t build=0; |
143 |
|
UInt_t base=0; |
144 |
|
UInt_t mask=0; |
145 |
|
if(classname.Contains("CalibTrk1Event")){ |
146 |
|
base=12; |
147 |
|
mask=0x03F000; |
148 |
|
} |
149 |
|
if(classname.Contains("CalibTrk2Event")){ |
150 |
|
base=18; |
151 |
|
mask=0xFC0000; |
152 |
|
} |
153 |
|
// ------------------------------------------------- |
154 |
|
// Count number of packets and set build variable |
155 |
|
// ------------------------------------------------- |
156 |
|
Int_t npkts=0; |
157 |
|
for(Int_t ipkt=0; ipkt<6; ipkt++){ |
158 |
|
if(caltrk->DSPnumber[ipkt]>0 && caltrk->DSPnumber[ipkt]<=12){ |
159 |
|
npkts++; |
160 |
|
build = build | ( 1<<(base+vorder[caltrk->DSPnumber[ipkt]-1]) ); |
161 |
|
}; |
162 |
|
} |
163 |
|
if( npkts==6 )return 1; // :-) |
164 |
|
else cout << "ValidateTrkCalib: "<<classname<<" --WARNING-- there might be some missing packets :-( ( "<<npkts<<" instead of 6 ) --> "<<endl; |
165 |
|
|
166 |
|
// cout << classname << " "<<eh->GetPscuHeader()->GetOrbitalTime()<<endl; |
167 |
|
|
168 |
|
// ----------------------------------------------- |
169 |
|
// If missing packets: check the acq configuration |
170 |
|
// (some DSPs might be excluded from acquisition) |
171 |
|
// ----------------------------------------------- |
172 |
|
|
173 |
|
// ----------------------------------------------- |
174 |
|
// retrieve the first run header after calib |
175 |
|
// ----------------------------------------------- |
176 |
|
// PacketType *pctp; |
177 |
|
// EventCounter *cod; |
178 |
|
// cod = eh->GetCounter(); |
179 |
|
// Int_t irun = cod->Get(pctp->RunHeader); |
180 |
|
// TTree *rh=(TTree*)file->Get("RunHeader"); |
181 |
|
// if ( !rh || rh->IsZombie() ) throw -17; |
182 |
|
// if( rh->GetEntries() == irun ){ |
183 |
|
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) no runs after calib (1) -- cannot validate :-( "<<endl; |
184 |
|
// return 0; // :-( |
185 |
|
// } |
186 |
|
|
187 |
|
// RunHeaderEvent *run = 0; |
188 |
|
// EventHeader *hrun = 0; |
189 |
|
// rh->SetBranchAddress("RunHeader", &run); |
190 |
|
// rh->SetBranchAddress("Header", &hrun); |
191 |
|
// rh->GetEntry(irun); |
192 |
|
// // cout << classname << " "<<eh->GetPscuHeader()->GetOrbitalTime() << " Run " << hrun->GetPscuHeader()->GetOrbitalTime() <<endl; |
193 |
|
|
194 |
|
// if( OBT(hrun->GetPscuHeader()->GetOrbitalTime()) < OBT(eh->GetPscuHeader()->GetOrbitalTime())){ |
195 |
|
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) no runs after calib (2) -- cannot validate :-( "<<endl; |
196 |
|
// return 0; // :-( |
197 |
|
// } |
198 |
|
|
199 |
|
// if( !run->RM_ACQ_AFTER_CALIB ){ |
200 |
|
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) RM_ACQ_AFTER_CALIB=0 -- cannot validate :-( "<<endl; |
201 |
|
// return 0; // :-( |
202 |
|
// } |
203 |
|
|
204 |
|
// UInt_t dtime = OBT(hrun->GetPscuHeader()->GetOrbitalTime()) - OBT(eh->GetPscuHeader()->GetOrbitalTime()); |
205 |
|
// if( dtime > timeaftercalib ){ |
206 |
|
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) run after calib too far ( "<<dtime<<"ms ) -- cannot validate :-( "<<endl; |
207 |
|
// return 0; // :-( |
208 |
|
// } |
209 |
|
|
210 |
|
// if( (run->ACQ_BUILD_INFO & mask) != build ){ |
211 |
|
// if ( IsDebug() ) cout << "ValidateTrkCalib: (MISSING VIEW) ACQ_BUILD_INFO= >>> "<<hex << (run->ACQ_BUILD_INFO&mask) << " != "<< build << dec<<endl; |
212 |
|
// return 0; // :-( |
213 |
|
// } |
214 |
|
return 1; // :-) |
215 |
|
|
216 |
|
} |
217 |
|
/** |
218 |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
* Method to fill the tracker calibration-parameter struct from on-line calibrations |
219 |
*/ |
*/ |
220 |
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){ |
231 |
tr1->GetEntry(ev_reg1); |
tr1->GetEntry(ev_reg1); |
232 |
tr2->GetEntry(ev_reg2); |
tr2->GetEntry(ev_reg2); |
233 |
Int_t dspn1(0),dspn2(0); |
Int_t dspn1(0),dspn2(0); |
234 |
|
|
235 |
|
// --- TEST TEST TEST TEST --- // |
236 |
|
TrkParams::ValidateTrkCalib(calibdata1); |
237 |
|
TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
238 |
|
|
239 |
for(Int_t i=0;i<6;i++){ |
for(Int_t i=0;i<6;i++){ |
240 |
dspn1=calibdata1->DSPnumber[i]-1; |
dspn1=calibdata1->DSPnumber[i]-1; |
290 |
tr1->GetEntry(ev_reg1); |
tr1->GetEntry(ev_reg1); |
291 |
tr2->GetEntry(ev_reg2); |
tr2->GetEntry(ev_reg2); |
292 |
Int_t dspn1(0),dspn2(0); |
Int_t dspn1(0),dspn2(0); |
293 |
|
|
294 |
|
// --- TEST TEST TEST TEST --- // |
295 |
|
TrkParams::ValidateTrkCalib(calibdata1); |
296 |
|
TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
297 |
|
|
298 |
for(Int_t i=0;i<6;i++){ |
for(Int_t i=0;i<6;i++){ |
299 |
dspn1=calibdata1->DSPnumber[i]-1; |
dspn1=calibdata1->DSPnumber[i]-1; |
346 |
tr2->GetEntry(ev_reg2); |
tr2->GetEntry(ev_reg2); |
347 |
Int_t dspn1(0),dspn2(0); |
Int_t dspn1(0),dspn2(0); |
348 |
|
|
349 |
|
// --- TEST TEST TEST TEST --- // |
350 |
|
TrkParams::ValidateTrkCalib(calibdata1); |
351 |
|
TrkParams::ValidateTrkCalib((CalibTrk1Event*)calibdata2); |
352 |
|
|
353 |
for(Int_t i=0;i<6;i++){ |
for(Int_t i=0;i<6;i++){ |
354 |
dspn1=calibdata1->DSPnumber[i]-1; |
dspn1=calibdata1->DSPnumber[i]-1; |
355 |
dspn2=calibdata2->DSPnumber[i]-1; |
dspn2=calibdata2->DSPnumber[i]-1; |