24 |
|
|
25 |
_whichAlg = id; |
_whichAlg = id; |
26 |
|
|
|
SetDebug(false); |
|
27 |
|
|
28 |
|
SetDebug(true); |
29 |
|
|
30 |
if(id == 0){ |
if(id == 0){ |
31 |
if(_debug){ |
// if(_debug){ |
32 |
cout << "ExtTrkingAlg::ExtTrkingAlg("<<id<<")"<<endl; |
cout << "ExtTrkingAlg::ExtTrkingAlg("<<id<<")"<<endl; |
33 |
cout << "Creating array of TrkTrack objects "<<endl; |
// cout << "Creating array of TrkTrack objects "<<endl; |
34 |
cout << "WARNING!!! tracking not accurate!! bug not fixed yet... "<<endl; |
cout << "WARNING!!! tracking not accurate!! bug not fixed yet... "<<endl; |
35 |
} |
// } |
36 |
_trkArray = new TClonesArray("TrkTrack"); |
_trkArray = new TClonesArray("TrkTrack"); |
37 |
// |
// |
38 |
_sel_nClstrMAX = 20. ; // selection parameter: maximum number of cluster |
_sel_nClstrMAX = 20. ; // selection parameter: maximum number of cluster |
55 |
}else if ( (id >= 100 && id < 144) || |
}else if ( (id >= 100 && id < 144) || |
56 |
(id >= 200 && id < 244) || |
(id >= 200 && id < 244) || |
57 |
false){ //add n calo planes |
false){ //add n calo planes |
58 |
if(_debug){ |
// if(_debug){ |
59 |
cout << "ExtTrkingAlg::ExtTrkingAlg("<<id<<")"<<endl; |
cout << "ExtTrkingAlg::ExtTrkingAlg("<<id<<")"<<endl; |
60 |
cout << "Creating array of ExtTrack objects "<<endl; |
// cout << "Creating array of ExtTrack objects "<<endl; |
61 |
} |
// } |
62 |
_trkArray = new TClonesArray("ExtTrack"); |
_trkArray = new TClonesArray("ExtTrack"); |
63 |
// |
// |
64 |
_alg_nClFixX = 3.; // algorythm parameter: n.hits required on X view |
_alg_nClFixX = 3.; // algorythm parameter: n.hits required on X view |
96 |
// _extTrack->SetZ(4,ZTRK5); |
// _extTrack->SetZ(4,ZTRK5); |
97 |
// _extTrack->SetZ(5,ZTRK6); |
// _extTrack->SetZ(5,ZTRK6); |
98 |
|
|
99 |
|
|
100 |
|
|
101 |
_caloStripRoto.clear(); |
_caloStripRoto.clear(); |
102 |
for(int iv=0; iv<_alg_nViewCal; iv++){ //loop over calorimater tracking planes |
for(int iv=0; iv<_alg_nViewCal; iv++){ //loop over calorimater tracking planes |
103 |
for(int is=0; is<9; is++){ //loop over calorimeter sensors |
for(int is=0; is<9; is++){ //loop over calorimeter sensors |
113 |
const char *pamca = gSystem->Getenv("PAM_CALIB"); |
const char *pamca = gSystem->Getenv("PAM_CALIB"); |
114 |
TString filep = "/trk-param/align_param_calo-0/CaloAlignParams.txt"; |
TString filep = "/trk-param/align_param_calo-0/CaloAlignParams.txt"; |
115 |
filep.Prepend(pamca); |
filep.Prepend(pamca); |
116 |
|
|
117 |
|
if(_debug)cout << " ---> "<<filep.Data()<<endl; |
118 |
std::fstream fs; |
std::fstream fs; |
119 |
fs.open (filep.Data(), std::fstream::in ); |
fs.open (filep.Data(), std::fstream::in ); |
120 |
do{ |
|
121 |
|
if(!fs.is_open()){ |
122 |
|
|
123 |
|
cout <<" WARNING!!!!!!!!!!!! error opening file "<<filep.Data()<<endl; |
124 |
|
cout <<" No alignment parameters loaded "<<endl; |
125 |
|
} |
126 |
|
// do{ |
127 |
|
while(fs.is_open() && !fs.eof()){ |
128 |
|
|
129 |
int view,plane,sensor; |
int view,plane,sensor; |
130 |
float par[5],err[5]; |
float par[5],err[5]; |
131 |
fs>>view >> plane>> sensor; |
fs>>view >> plane>> sensor; |
150 |
// _caloStripRoto[index].SetView(view); |
// _caloStripRoto[index].SetView(view); |
151 |
// _caloStripRoto[index].SetPlane(plane); |
// _caloStripRoto[index].SetPlane(plane); |
152 |
|
|
153 |
} |
}; |
154 |
}while(!fs.eof()); |
// }while(!fs.eof()); |
155 |
|
}; |
156 |
fs.close(); |
fs.close(); |
157 |
|
|
158 |
// ----------------------------------- |
// ----------------------------------- |
295 |
*/ |
*/ |
296 |
Bool_t ExtTrkingAlg::CheckEvent(){ |
Bool_t ExtTrkingAlg::CheckEvent(){ |
297 |
|
|
298 |
if(!_trk_l2)return true; |
if(!_trk_l1)return false; |
299 |
|
TrkLevel1 *trkl1 = _trk_l1;//event->GetTrkLevel1(); |
|
TrkLevel2 *trkl2 = _trk_l2;//event->GetTrkLevel2(); |
|
300 |
int nClstrMAX = _sel_nClstrMAX; //maximum number of cluster |
int nClstrMAX = _sel_nClstrMAX; //maximum number of cluster |
301 |
int nPlaneXMIN = _sel_nPlaneXMIN; |
///////////////////////////////////////////////////////////////////// |
302 |
int nPlaneYMIN = _sel_nPlaneYMIN; |
/// dump selection |
303 |
|
///////////////////////////////////////////////////////////////////// |
304 |
|
if(_debug){ |
305 |
|
cout << " n.clusters "<<trkl1->nclstr()<<endl; |
306 |
|
} |
307 |
|
if(trkl1->nclstr() > nClstrMAX) return false; |
308 |
///////////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////////// |
309 |
/// count number of hit planes |
/// count number of hit planes |
310 |
///////////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////////// |
311 |
|
int nPlaneXMIN = _sel_nPlaneXMIN; |
312 |
|
int nPlaneYMIN = _sel_nPlaneYMIN; |
313 |
int nHitX[] = {0,0,0,0,0,0}; |
int nHitX[] = {0,0,0,0,0,0}; |
314 |
int nHitY[] = {0,0,0,0,0,0}; |
int nHitY[] = {0,0,0,0,0,0}; |
315 |
for(int ix=0; ix<trkl2->nclsx(); ix++)nHitX[trkl2->GetSingletX(ix)->plane-1]++; |
for(int ic=0; ic<trkl1->nclstr(); ic++){ |
316 |
for(int iy=0; iy<trkl2->nclsy(); iy++)nHitY[trkl2->GetSingletY(iy)->plane-1]++; |
if (trkl1->GetCluster(ic)->IsX() ) nHitX[trkl1->GetCluster(ic)->GetPlane()-1]++; |
317 |
|
else if (trkl1->GetCluster(ic)->IsY() ) nHitY[trkl1->GetCluster(ic)->GetPlane()-1]++; |
318 |
|
} |
319 |
///////////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////////// |
320 |
/// set minimum condition 3x+2y |
/// set minimum condition 3x+2y |
321 |
///////////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////////// |
323 |
for(int ip=0; ip<6; ip++)if(nHitX[ip])nPlaneX++; |
for(int ip=0; ip<6; ip++)if(nHitX[ip])nPlaneX++; |
324 |
int nPlaneY=0; |
int nPlaneY=0; |
325 |
for(int ip=0; ip<6; ip++)if(nHitY[ip])nPlaneY++; |
for(int ip=0; ip<6; ip++)if(nHitY[ip])nPlaneY++; |
326 |
|
|
327 |
///////////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////////// |
328 |
/// dump selection |
/// dump selection |
329 |
///////////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////////// |
330 |
if(_debug){ |
if(_debug){ |
331 |
cout << " n.tracks "<<trkl2->GetNTracks()<<endl; |
cout << " n.x-hit planes "<<nPlaneX<<endl; |
332 |
cout << " n.x-singles "<<trkl2->nclsx()<<endl; |
cout << " n.y-hit planes "<<nPlaneY<<endl; |
333 |
cout << " n.y-singles "<<trkl2->nclsy()<<endl; |
} |
334 |
cout << " n.x-planes with singles "<<nPlaneX<<endl; |
if( nPlaneX<nPlaneXMIN ) return false; |
335 |
cout << " n.y-planes with singles "<<nPlaneY<<endl; |
if( nPlaneY<nPlaneYMIN ) return false; |
336 |
} |
|
337 |
|
|
338 |
|
// if(!_trk_l2)return true; |
339 |
|
// TrkLevel2 *trkl2 = _trk_l2;//event->GetTrkLevel2(); |
340 |
|
// ///////////////////////////////////////////////////////////////////// |
341 |
|
// /// dump selection |
342 |
|
// ///////////////////////////////////////////////////////////////////// |
343 |
|
// if(_debug){ |
344 |
|
// cout << " n.tracks "<<trkl2->GetNTracks()<<endl; |
345 |
|
// cout << " n.x-singles "<<trkl2->nclsx()<<endl; |
346 |
|
// cout << " n.y-singles "<<trkl2->nclsy()<<endl; |
347 |
|
// cout << " n.y-singles "<<trkl2->nclsy()<<endl; |
348 |
|
// } |
349 |
|
// if(trkl2->nclsy()+trkl2->nclsx() > nClstrMAX) return false; |
350 |
|
// ///////////////////////////////////////////////////////////////////// |
351 |
|
// /// count number of hit planes |
352 |
|
// ///////////////////////////////////////////////////////////////////// |
353 |
|
// int nPlaneXMIN = _sel_nPlaneXMIN; |
354 |
|
// int nPlaneYMIN = _sel_nPlaneYMIN; |
355 |
|
// int nHitX[] = {0,0,0,0,0,0}; |
356 |
|
// int nHitY[] = {0,0,0,0,0,0}; |
357 |
|
// for(int ix=0; ix<trkl2->nclsx(); ix++)nHitX[trkl2->GetSingletX(ix)->plane-1]++; |
358 |
|
// for(int iy=0; iy<trkl2->nclsy(); iy++)nHitY[trkl2->GetSingletY(iy)->plane-1]++; |
359 |
|
// ///////////////////////////////////////////////////////////////////// |
360 |
|
// /// set minimum condition 3x+2y |
361 |
|
// ///////////////////////////////////////////////////////////////////// |
362 |
|
// int nPlaneX=0; |
363 |
|
// for(int ip=0; ip<6; ip++)if(nHitX[ip])nPlaneX++; |
364 |
|
// int nPlaneY=0; |
365 |
|
// for(int ip=0; ip<6; ip++)if(nHitY[ip])nPlaneY++; |
366 |
|
// ///////////////////////////////////////////////////////////////////// |
367 |
|
// /// dump selection |
368 |
|
// ///////////////////////////////////////////////////////////////////// |
369 |
|
// if(_debug){ |
370 |
|
// cout << " n.x-planes with singles "<<nPlaneX<<endl; |
371 |
|
// cout << " n.y-planes with singles "<<nPlaneY<<endl; |
372 |
|
// } |
373 |
//////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////// |
374 |
// |
// |
375 |
// check condition for retracking |
// check condition for retracking |
376 |
// |
// |
377 |
//////////////////////////////////////////////////////////////////////// |
//////////////////////////////////////////////////////////////////////// |
378 |
if(trkl2->GetNTracks()==0 && nPlaneX<nPlaneXMIN) return false; |
// if(trkl2->GetNTracks()==0 && nPlaneX<nPlaneXMIN) return false; |
379 |
if(trkl2->GetNTracks()==0 && nPlaneY<nPlaneYMIN) return false; |
// if(trkl2->GetNTracks()==0 && nPlaneY<nPlaneYMIN) return false; |
|
if(trkl2->nclsy()+trkl2->nclsx() > nClstrMAX) return false; |
|
380 |
|
|
381 |
return true; |
return true; |
382 |
|
|