| 12 |
TrkCluster::TrkCluster(){ |
TrkCluster::TrkCluster(){ |
| 13 |
|
|
| 14 |
view = 0; |
view = 0; |
|
ladder = 0; |
|
| 15 |
maxs = 0; |
maxs = 0; |
| 16 |
mult = 0; |
indmax = 0; |
| 17 |
sgnl = 0; |
|
|
whichtrk = -1; |
|
| 18 |
CLlength = 0; |
CLlength = 0; |
| 19 |
clsignal = 0; |
clsignal = 0; |
| 20 |
clsigma = 0; |
clsigma = 0; |
| 40 |
TrkCluster::TrkCluster(const TrkCluster& t){ |
TrkCluster::TrkCluster(const TrkCluster& t){ |
| 41 |
|
|
| 42 |
view = t.view; |
view = t.view; |
|
ladder = t.ladder; |
|
| 43 |
maxs = t.maxs; |
maxs = t.maxs; |
| 44 |
mult = t.mult; |
indmax = t.indmax; |
|
sgnl = t.sgnl; |
|
|
whichtrk = t.whichtrk; |
|
| 45 |
|
|
| 46 |
CLlength = t.CLlength; |
CLlength = t.CLlength; |
| 47 |
clsignal = new Float_t[CLlength]; |
clsignal = new Float_t[CLlength]; |
| 60 |
// |
// |
| 61 |
// |
// |
| 62 |
//-------------------------------------- |
//-------------------------------------- |
| 63 |
|
/** |
| 64 |
|
* Evaluate the cluster signal. |
| 65 |
|
* @param cut Inclusion cut. |
| 66 |
|
*/ |
| 67 |
|
Float_t TrkCluster::GetSignal(Float_t cut){ |
| 68 |
|
Float_t s = 0; |
| 69 |
|
for(Int_t is = 0; is < CLlength; is++){ |
| 70 |
|
Float_t scut = cut*clsigma[is]; |
| 71 |
|
if(clsignal[is] > scut) s += clsignal[is]; |
| 72 |
|
}; |
| 73 |
|
return s; |
| 74 |
|
}; |
| 75 |
|
/** |
| 76 |
|
* Evaluate the cluster signal-to-noise, as defined by Turchetta. |
| 77 |
|
* @param cut Inclusion cut. |
| 78 |
|
*/ |
| 79 |
|
Float_t TrkCluster::GetSignalToNoise(Float_t cut){ |
| 80 |
|
Float_t sn = 0; |
| 81 |
|
for(Int_t is = 0; is < CLlength; is++){ |
| 82 |
|
Float_t scut = cut*clsigma[is]; |
| 83 |
|
if(clsignal[is] > scut) sn += clsignal[is]/clsigma[is]; |
| 84 |
|
}; |
| 85 |
|
return sn; |
| 86 |
|
}; |
| 87 |
|
/** |
| 88 |
|
* Evaluate the cluster multiplicity. |
| 89 |
|
* @param cut Inclusion cut. |
| 90 |
|
*/ |
| 91 |
|
Int_t TrkCluster::GetMultiplicity(Float_t cut){ |
| 92 |
|
Int_t m = 0; |
| 93 |
|
for(Int_t is = 0; is < CLlength; is++){ |
| 94 |
|
Float_t scut = cut*clsigma[is]; |
| 95 |
|
if(clsignal[is] > scut) m++; |
| 96 |
|
}; |
| 97 |
|
return m; |
| 98 |
|
}; |
| 99 |
|
/** |
| 100 |
|
* True if the cluster contains bad strips. |
| 101 |
|
* @param nbad Number of strips around the maximum. |
| 102 |
|
*/ |
| 103 |
|
Bool_t TrkCluster::IsBad(Int_t nbad){ |
| 104 |
|
|
| 105 |
|
/* Float_t max = 0; |
| 106 |
|
Int_t imax = 0; |
| 107 |
|
for(Int_t is = 0; is < CLlength; is++){ |
| 108 |
|
if(clsignal[is] > max){ |
| 109 |
|
max = clsignal[is]; |
| 110 |
|
imax = is; |
| 111 |
|
}; |
| 112 |
|
}; |
| 113 |
|
|
| 114 |
|
Int_t il,ir; |
| 115 |
|
il = imax; |
| 116 |
|
ir = imax;*/ |
| 117 |
|
|
| 118 |
|
Int_t il,ir; |
| 119 |
|
il = indmax; |
| 120 |
|
ir = indmax; |
| 121 |
|
for(Int_t i=1; i<nbad; i++){ |
| 122 |
|
if (ir == CLlength && il == 0)break; |
| 123 |
|
else if (ir == CLlength && il != 0)il--; |
| 124 |
|
else if (ir != CLlength && il == 0)ir++; |
| 125 |
|
else{ |
| 126 |
|
if(clsignal[il-1] > clsignal[ir+1])il--; |
| 127 |
|
else ir++; |
| 128 |
|
} |
| 129 |
|
} |
| 130 |
|
Int_t isbad = 0; |
| 131 |
|
for(Int_t i=il; i<=ir; i++)isbad += clbad[i]; |
| 132 |
|
|
| 133 |
|
return ( isbad != nbad ); |
| 134 |
|
}; |
| 135 |
|
//-------------------------------------- |
| 136 |
|
// |
| 137 |
|
// |
| 138 |
|
//-------------------------------------- |
| 139 |
void TrkCluster::Dump(){ |
void TrkCluster::Dump(){ |
| 140 |
|
|
| 141 |
cout << "----- Cluster" << endl; |
cout << "----- Cluster" << endl; |
| 142 |
cout << "View "<<view << " - Ladder "<<ladder<<endl; |
cout << "View "<<view << " - Ladder "<<GetLadder()<<endl; |
| 143 |
cout << "(Track ID "<<whichtrk<<")"<<endl; |
cout << "Position of maximun "<< maxs <<endl; |
| 144 |
cout << "Position of maximun "<<maxs<<endl; |
cout << "Multiplicity "<< GetMultiplicity() <<endl; |
| 145 |
cout << "Multiplicity "<<mult<<endl; |
cout << "Tot signal "<< GetSignal() << " (ADC channels)"<<endl ; |
| 146 |
cout << "Tot signal "<<sgnl<< " (ADC channels)"; |
cout << "Signal/Noise "<< GetSignalToNoise(); |
| 147 |
cout <<endl<< "Strip signals "; |
cout <<endl<< "Strip signals "; |
| 148 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsignal[i]; |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clsignal[i]; |
| 149 |
cout <<endl<< "Strip sigmas "; |
cout <<endl<< "Strip sigmas "; |
| 151 |
cout <<endl<< "Strip ADC "; |
cout <<endl<< "Strip ADC "; |
| 152 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<cladc[i]; |
for(Int_t i =0; i<CLlength; i++)cout << " " <<cladc[i]; |
| 153 |
cout <<endl<< "Strip BAD "; |
cout <<endl<< "Strip BAD "; |
| 154 |
for(Int_t i =0; i<CLlength; i++)cout << " " <<clbad[i]; |
for(Int_t i =0; i<CLlength; i++){ |
| 155 |
|
if(i==indmax)cout << " *" <<clbad[i]<<"*"; |
| 156 |
|
else cout << " " <<clbad[i]; |
| 157 |
|
} |
| 158 |
cout << endl; |
cout << endl; |
| 159 |
|
|
| 160 |
} |
} |
| 164 |
//-------------------------------------- |
//-------------------------------------- |
| 165 |
TrkLevel1::TrkLevel1(){ |
TrkLevel1::TrkLevel1(){ |
| 166 |
|
|
| 167 |
good1 = -1; |
// good1 = -1; |
| 168 |
|
|
| 169 |
Cluster = new TClonesArray("TrkCluster"); |
Cluster = new TClonesArray("TrkCluster"); |
| 170 |
|
|
| 171 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
| 172 |
// crc[i] = -1; |
// crc[i] = -1; |
| 173 |
|
good[i] = -1; |
| 174 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
| 175 |
cnev[j][i]=0; |
cnev[j][i]=0; |
| 176 |
cnnev[j][i]=0; |
cnnev[j][i]=0; |
| 177 |
}; |
}; |
| 178 |
fshower[i]=0; |
// fshower[i]=0; |
| 179 |
}; |
}; |
| 180 |
} |
} |
| 181 |
//-------------------------------------- |
//-------------------------------------- |
| 184 |
//-------------------------------------- |
//-------------------------------------- |
| 185 |
void TrkLevel1::Dump(){ |
void TrkLevel1::Dump(){ |
| 186 |
|
|
| 187 |
|
cout<<"DSP status: "; |
| 188 |
|
for(Int_t i=0; i<12 ; i++)cout<<good[i]<<" "; |
| 189 |
|
cout<<endl; |
| 190 |
|
|
| 191 |
TClonesArray &t = *Cluster; |
TClonesArray &t = *Cluster; |
|
|
|
| 192 |
for(int i=0; i<this->nclstr(); i++) ((TrkCluster *)t[i])->Dump(); |
for(int i=0; i<this->nclstr(); i++) ((TrkCluster *)t[i])->Dump(); |
| 193 |
|
|
| 194 |
} |
} |
| 207 |
for(int i=0; i<l1->nclstr1; i++){ |
for(int i=0; i<l1->nclstr1; i++){ |
| 208 |
|
|
| 209 |
t_cl->view = l1->view[i]; |
t_cl->view = l1->view[i]; |
|
t_cl->ladder = l1->ladder[i]; |
|
| 210 |
t_cl->maxs = l1->maxs[i]; |
t_cl->maxs = l1->maxs[i]; |
| 211 |
t_cl->mult = l1->mult[i]; |
t_cl->indmax = l1->indmax[i] - l1->indstart[i]; |
|
t_cl->sgnl = l1->dedx[i]; |
|
|
t_cl->whichtrk = l1->whichtrack[i]-1; |
|
| 212 |
|
|
| 213 |
Int_t from = l1->indstart[i] -1; |
Int_t from = l1->indstart[i] -1; |
| 214 |
Int_t to = l1->totCLlength ; |
Int_t to = l1->totCLlength ; |
| 233 |
|
|
| 234 |
delete t_cl; |
delete t_cl; |
| 235 |
|
|
| 236 |
// general variables |
// ****general variables**** |
| 237 |
|
|
|
good1 = l1->good1; |
|
| 238 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
| 239 |
// crc[i] = l1->crc[i]; |
good[i] = -1; |
| 240 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
| 241 |
cnev[j][i] = l1->cnev[j][i]; |
cnev[j][i] = l1->cnev[j][i]; |
| 242 |
cnnev[j][i] = l1->cnnev[j][i]; |
cnnev[j][i] = l1->cnnev[j][i]; |
| 243 |
}; |
}; |
|
fshower[i] = l1->fshower[i]; |
|
| 244 |
}; |
}; |
| 245 |
|
|
| 246 |
} |
} |
| 257 |
// ********* completare ********* // |
// ********* completare ********* // |
| 258 |
// ********* completare ********* // |
// ********* completare ********* // |
| 259 |
// general variables |
// general variables |
| 260 |
l1->good1 = good1; |
// l1->good1 = good1; |
| 261 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
| 262 |
// l1->crc[i] = crc[i]; |
// l1->crc[i] = crc[i]; |
| 263 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
| 264 |
l1->cnev[j][i] = cnev[j][i]; |
l1->cnev[j][i] = cnev[j][i]; |
| 265 |
l1->cnnev[j][i] = cnnev[j][i]; |
l1->cnnev[j][i] = cnnev[j][i]; |
| 266 |
}; |
}; |
| 267 |
l1->fshower[i] = fshower[i]; |
// l1->fshower[i] = fshower[i]; |
| 268 |
}; |
}; |
| 269 |
|
|
| 270 |
// *** CLUSTERS *** |
// *** CLUSTERS *** |
| 272 |
for(Int_t i=0;i<l1->nclstr1;i++){ |
for(Int_t i=0;i<l1->nclstr1;i++){ |
| 273 |
|
|
| 274 |
l1->view[i] = ((TrkCluster *)Cluster->At(i))->view; |
l1->view[i] = ((TrkCluster *)Cluster->At(i))->view; |
| 275 |
l1->ladder[i] = ((TrkCluster *)Cluster->At(i))->ladder; |
// l1->ladder[i] = ((TrkCluster *)Cluster->At(i))->ladder; |
| 276 |
l1->maxs[i] = ((TrkCluster *)Cluster->At(i))->maxs; |
l1->maxs[i] = ((TrkCluster *)Cluster->At(i))->maxs; |
| 277 |
l1->mult[i] = ((TrkCluster *)Cluster->At(i))->mult; |
// l1->mult[i] = ((TrkCluster *)Cluster->At(i))->mult; |
| 278 |
l1->dedx[i] = ((TrkCluster *)Cluster->At(i))->sgnl; |
// l1->dedx[i] = ((TrkCluster *)Cluster->At(i))->sgnl; |
| 279 |
|
|
| 280 |
} |
} |
| 281 |
|
|
| 288 |
//-------------------------------------- |
//-------------------------------------- |
| 289 |
void TrkLevel1::Clear(){ |
void TrkLevel1::Clear(){ |
| 290 |
|
|
|
good1 = -1; |
|
| 291 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
| 292 |
// crc[i] = -1; |
good[i] = -1; |
| 293 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
| 294 |
cnev[j][i] = 0; |
cnev[j][i] = 0; |
| 295 |
cnnev[j][i] = 0; |
cnnev[j][i] = 0; |
| 296 |
}; |
}; |
|
fshower[i] = 0; |
|
| 297 |
}; |
}; |
| 298 |
// totCLlength = 0; |
// |
| 299 |
Cluster->Clear(); |
Cluster->Clear(); |
| 300 |
|
|
| 301 |
} |
} |
| 315 |
return cluster; |
return cluster; |
| 316 |
} |
} |
| 317 |
|
|
|
// //-------------------------------------- |
|
|
// // |
|
|
// // |
|
|
// //-------------------------------------- |
|
|
// TrkTrackRef::TrkTrackRef(){ |
|
|
// for(int ip=0;ip<6;ip++){ |
|
|
// clx[ip] = 0; |
|
|
// cly[ip] = 0; |
|
|
// }; |
|
|
// }; |
|
|
// //-------------------------------------- |
|
|
// // |
|
|
// // |
|
|
// //-------------------------------------- |
|
|
// TrkTrackRef::TrkTrackRef(const TrkTrackRef& t){ |
|
|
// for(int ip=0;ip<6;ip++){ |
|
|
// clx[ip] = t.clx[ip]; |
|
|
// cly[ip] = t.cly[ip]; |
|
|
// }; |
|
|
// }; |
|
|
// //-------------------------------------- |
|
|
// // |
|
|
// // |
|
|
// //-------------------------------------- |
|
|
// void TrkTrackRef::Clear(){ |
|
|
// for(int ip=0;ip<6;ip++){ |
|
|
// clx[ip] = 0; |
|
|
// cly[ip] = 0; |
|
|
// }; |
|
|
// }; |
|
|
// //-------------------------------------- |
|
|
// // |
|
|
// // |
|
|
// //-------------------------------------- |
|
|
// TrkLevel2Ref::TrkLevel2Ref(){ |
|
|
// Track = new TClonesArray("TrkTrackRef"); |
|
|
// SingletX = new TClonesArray("TRef"); |
|
|
// SingletY = new TClonesArray("TRef"); |
|
|
// }; |
|
|
// //-------------------------------------- |
|
|
// // |
|
|
// // |
|
|
// //-------------------------------------- |
|
|
// void TrkLevel2Ref::SetFromLevel2Struct(cTrkLevel2 *l2){ |
|
|
// |
|
|
// TrkTrackRef* t_track = new TrkTrackRef(); |
|
|
// TRef t_singlet = 0; |
|
|
// |
|
|
// TClonesArray &t = *Track; |
|
|
// for(int i=0; i<l2->ntrk; i++){ |
|
|
// for(int ip=0;ip<6;ip++){ |
|
|
// t_track->clx[ip] = 0;//<<<puntatore al cluster |
|
|
// t_track->cly[ip] = 0;//<<<puntatore al cluster |
|
|
// }; |
|
|
// new(t[i]) TrkTrackRef(*t_track); |
|
|
// t_track->Clear(); |
|
|
// }; |
|
|
// // *** SINGLETS *** |
|
|
// TClonesArray &sx = *SingletX; |
|
|
// for(int i=0; i<l2->nclsx; i++){ |
|
|
// t_singlet = 0;//<<<puntatore al cluster |
|
|
// new(sx[i]) TRef(t_singlet); |
|
|
// } |
|
|
// TClonesArray &sy = *SingletY; |
|
|
// for(int i=0; i<l2->nclsy; i++){ |
|
|
// t_singlet = 0;//<<<puntatore al cluster |
|
|
// new(sy[i]) TRef(t_singlet); |
|
|
// }; |
|
|
// |
|
|
// delete t_track; |
|
|
// } |
|
|
// //-------------------------------------- |
|
|
// // |
|
|
// // |
|
|
// //-------------------------------------- |
|
|
// void TrkLevel2Ref::Clear(){ |
|
|
// Track->Clear(); |
|
|
// SingletX->Clear(); |
|
|
// SingletY->Clear(); |
|
|
// } |
|
| 318 |
|
|
| 319 |
ClassImp(TrkLevel1); |
ClassImp(TrkLevel1); |
| 320 |
ClassImp(TrkCluster); |
ClassImp(TrkCluster); |
|
// ClassImp(TrkTrackRef); |
|
|
// ClassImp(TrkLevel2Ref); |
|