113 |
if(!PMT)PMT = new TClonesArray("ToFPMT",12); //ELENA |
if(!PMT)PMT = new TClonesArray("ToFPMT",12); //ELENA |
114 |
if(!ToFTrk)ToFTrk = new TClonesArray("ToFTrkVar",2); //ELENA |
if(!ToFTrk)ToFTrk = new TClonesArray("ToFTrkVar",2); //ELENA |
115 |
}//ELENA |
}//ELENA |
116 |
|
//-------------------------------------- |
117 |
|
// |
118 |
|
// |
119 |
|
//-------------------------------------- |
120 |
|
void ToFLevel2::SetTrackArray(TClonesArray *track){//ELENA |
121 |
|
if(track && strcmp(track->GetClass()->GetName(),"ToFTrkVar")==0){ |
122 |
|
if(ToFTrk)ToFTrk->Clear("C"); |
123 |
|
ToFTrk = track; |
124 |
|
} |
125 |
|
} |
126 |
|
|
127 |
void ToFLevel2::Clear(Option_t *t){ |
void ToFLevel2::Clear(Option_t *t){ |
128 |
// |
// |
161 |
return toftrack; |
return toftrack; |
162 |
} |
} |
163 |
|
|
164 |
|
/** |
165 |
|
* Retrieves the tof track matching the seqno-th tracker stored track. |
166 |
|
* |
167 |
|
*/ |
168 |
|
ToFTrkVar *ToFLevel2::GetToFStoredTrack(int seqno){ |
169 |
|
|
170 |
|
if( ntrk()==0 ){ |
171 |
|
printf("ToFLevel2::GetToFStoredTrack(int) : requested tracker SeqNo %i but no ToFrimeter tracks are stored\n",seqno); |
172 |
|
return NULL; |
173 |
|
}; |
174 |
|
|
175 |
|
ToFTrkVar *c = 0; |
176 |
|
Int_t it_tof=0; |
177 |
|
|
178 |
|
do { |
179 |
|
c = GetToFTrkVar(it_tof); |
180 |
|
it_tof++; |
181 |
|
} while( c && seqno != c->trkseqno && it_tof < ntrk()); |
182 |
|
|
183 |
|
if(!c || seqno != c->trkseqno){ |
184 |
|
c = 0; |
185 |
|
if(seqno!=-1 ) printf("ToFLevel2::GetToFStoredTrack(int) : requested tracker SeqNo %i does not match ToFrimeter stored tracks\n",seqno); |
186 |
|
}; |
187 |
|
return c; |
188 |
|
|
189 |
|
} |
190 |
|
|
191 |
|
|
192 |
ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit){ |
ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit){ |
193 |
// |
// |
194 |
if(ihit >= npmt()){ |
if(ihit >= npmt()){ |
252 |
false) return true; |
false) return true; |
253 |
else return false; |
else return false; |
254 |
}; |
}; |
255 |
|
|
256 |
/** |
/** |
257 |
* Method to get the number of hit paddles on a ToF plane. |
* Strict method to get the number of hit paddles on a ToF plane. |
258 |
|
* The method uses "HitPaddle" which checks if there is a TDC signal |
259 |
|
* from both PMTs. |
260 |
* @param plane Plane ID (11, 12, 21, 22, 31, 32) or Plane index (0,1,2,3,4,5). |
* @param plane Plane ID (11, 12, 21, 22, 31, 32) or Plane index (0,1,2,3,4,5). |
261 |
*/ |
*/ |
262 |
Int_t ToFLevel2::GetNHitPaddles(Int_t plane){ |
Int_t ToFLevel2::GetNHitPaddles(Int_t plane){ |
266 |
}; |
}; |
267 |
|
|
268 |
/** |
/** |
269 |
* Method to get the number of hit paddles on a ToF plane. |
* Optional method to get the number of hit paddles on a ToF plane. |
270 |
|
* The method does NOT check if there is a signal from both PMTs, it only |
271 |
|
* checks if there is some PMT signal in a paddle |
272 |
* @param plane Plane ID (11, 12, 21, 22, 31, 32) or Plane index (0,1,2,3,4,5). |
* @param plane Plane ID (11, 12, 21, 22, 31, 32) or Plane index (0,1,2,3,4,5). |
273 |
*/ |
*/ |
274 |
Int_t ToFLevel2::GetTrueNHitPaddles(Int_t plane){ |
Int_t ToFLevel2::GetTrueNHitPaddles(Int_t plane){ |
288 |
return npad; |
return npad; |
289 |
}; |
}; |
290 |
|
|
291 |
|
//new, wm Feb 15 |
292 |
//wm Nov 08 |
//wm Nov 08 |
293 |
//gf Apr 07 |
//gf Apr 07 |
294 |
/** |
/** |
295 |
* Method to get the mean dEdx from a ToF layer - ATTENTION: |
* Method to get the mean dEdx from a ToF layer |
296 |
* It will sum up the dEdx of all the paddles, but since by definition |
* By definition there should be PMTs with dEdx values only in one paddle of a layer |
297 |
* only the paddle hitted by the track gets a dEdx value and the other |
* (the paddle hitted by the track), this method looks for the hitted paddle |
298 |
* paddles are set to zero, the output is just the dEdx of the hitted |
* and gives the mean dEdx of that paddle as the output |
299 |
* paddle in each layer! |
* The method was modified for the "ToF-standalone" part in february 2015 |
300 |
* The "adcfl" option is not very useful (an artificial dEdx is per |
* The "adcfl" option is not very useful (an artificial dEdx is per |
301 |
* definition= 1 mip and not a real measurement), anyway left in the code |
* definition= 1 mip and not a real measurement), anyway left in the code |
302 |
* @param notrack Track Number |
* @param notrack Track Number |
303 |
* @param plane Plane index (0,1,2,3,4,5) |
* @param plane Plane index (0,1,2,3,4,5) |
304 |
* @param adcflag in the plane (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; ) |
* @param adcflag in the plane (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; ) |
305 |
*/ |
*/ |
306 |
Float_t ToFLevel2::GetdEdx(ToFTrkVar *trk, Int_t plane, Int_t adcfl){ |
Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane, Int_t adcfl){ |
307 |
// printf("fiffi\n"); |
// ToFTrkVar *trk = GetToFTrkVar(notrack); |
308 |
Float_t dedx = 0.; |
ToFTrkVar *trk = GetToFStoredTrack(notrack);//Elena 2015 |
309 |
Float_t PadEdx =0.; |
return this->GetdEdx(trk, plane, adcfl); |
310 |
Int_t SatWarning; |
} |
|
Int_t pad=-1; |
|
|
// |
|
|
if(!trk) return 0; //ELENA |
|
|
// |
|
|
if ( trk->trkseqno == -1 ){ //standalone, only paddles along the track, or about... |
|
|
// printf("ciccio\n"); |
|
|
Float_t xleft=0; |
|
|
Float_t xright=0; |
|
|
Float_t yleft=0; |
|
|
Float_t yright=0; |
|
|
Float_t xtof_temp[6]={100.,100.,100.,100.,100.,100.}; |
|
|
Float_t ytof_temp[6]={100.,100.,100.,100.,100.,100.}; |
|
|
ToFTrkVar *t_tof = trk; |
|
|
|
|
|
xtof_temp[0]=t_tof->xtofpos[0]; |
|
|
ytof_temp[0]=t_tof->ytofpos[0]; |
|
|
xtof_temp[1]=t_tof->xtofpos[0]; |
|
|
ytof_temp[1]=t_tof->ytofpos[0]; |
|
|
|
|
|
xtof_temp[2]=t_tof->xtofpos[1]; |
|
|
ytof_temp[2]=t_tof->ytofpos[1]; |
|
|
xtof_temp[3]=t_tof->xtofpos[1]; |
|
|
ytof_temp[3]=t_tof->ytofpos[1]; |
|
|
|
|
|
xtof_temp[4]=t_tof->xtofpos[2]; |
|
|
ytof_temp[4]=t_tof->ytofpos[2]; |
|
|
xtof_temp[5]=t_tof->xtofpos[2]; |
|
|
ytof_temp[5]=t_tof->ytofpos[2]; |
|
|
|
|
|
if(t_tof->xtofpos[0]<100. && t_tof->ytofpos[0]<100.){ |
|
|
xtof_temp[1]=t_tof->xtofpos[0]; |
|
|
ytof_temp[0]=t_tof->ytofpos[0]; |
|
|
}else if(t_tof->xtofpos[0]>=100. && t_tof->ytofpos[0]<100.){ |
|
|
ytof_temp[0]=t_tof->ytofpos[0]; |
|
|
this->GetPaddleGeometry(0,(Int_t)log2(this->tof_j_flag[0]),xleft, xright, yleft, yright); |
|
|
xtof_temp[1]=xleft+2.55; |
|
|
}else if(t_tof->ytofpos[0]>=100. && t_tof->xtofpos[0]<100.){ |
|
|
xtof_temp[1]=t_tof->xtofpos[0]; |
|
|
this->GetPaddleGeometry(1,(Int_t)log2(this->tof_j_flag[1]),xleft, xright, yleft, yright); |
|
|
ytof_temp[0]=yleft+2.75; |
|
|
} |
|
|
|
|
|
if(t_tof->xtofpos[1]<100. && t_tof->ytofpos[1]<100.){ |
|
|
xtof_temp[2]=t_tof->xtofpos[1]; |
|
|
ytof_temp[3]=t_tof->ytofpos[1]; |
|
|
}else if(t_tof->xtofpos[1]>=100. && t_tof->ytofpos[1]<100.){ |
|
|
ytof_temp[3]=t_tof->ytofpos[1]; |
|
|
this->GetPaddleGeometry(3,(Int_t)log2(this->tof_j_flag[3]),xleft, xright, yleft, yright); |
|
|
xtof_temp[2]=xleft+4.5; |
|
|
}else if(t_tof->ytofpos[1]>=100. && t_tof->xtofpos[1]<100.){ |
|
|
xtof_temp[2]=t_tof->xtofpos[1]; |
|
|
this->GetPaddleGeometry(2,(Int_t)log2(this->tof_j_flag[2]),xleft, xright, yleft, yright); |
|
|
ytof_temp[3]=yleft+3.75; |
|
|
} |
|
|
|
|
|
if(t_tof->xtofpos[2]<100. && t_tof->ytofpos[2]<100.){ |
|
|
xtof_temp[5]=t_tof->xtofpos[2]; |
|
|
ytof_temp[4]=t_tof->ytofpos[2]; |
|
|
}else if(t_tof->xtofpos[2]>=100. && t_tof->ytofpos[2]<100.){ |
|
|
ytof_temp[4]=t_tof->ytofpos[2]; |
|
|
this->GetPaddleGeometry(4,(Int_t)log2(this->tof_j_flag[4]),xleft, xright, yleft, yright); |
|
|
xtof_temp[5]=xleft+3; |
|
|
}else if(t_tof->ytofpos[2]>=100. && t_tof->xtofpos[2]<100.){ |
|
|
xtof_temp[5]=t_tof->xtofpos[2]; |
|
|
this->GetPaddleGeometry(5,(Int_t)log2(this->tof_j_flag[5]),xleft, xright, yleft, yright); |
|
|
ytof_temp[4]=yleft+2.5; |
|
|
} |
|
|
|
|
|
if ( (xtof_temp[0])> 17.85 && fabs(xtof_temp[0])<17.85+4. ) xtof_temp[0] =17.84; |
|
|
if ( (xtof_temp[1])> 17.85 && fabs(xtof_temp[1])<17.85+4. ) xtof_temp[1] =17.84; |
|
|
if ( (ytof_temp[0])> 13.75 && fabs(ytof_temp[0])<13.75+4. ) ytof_temp[0] =13.74; |
|
|
if ( (ytof_temp[1])> 13.75 && fabs(ytof_temp[1])<13.75+4. ) ytof_temp[1] =13.74; |
|
|
if ( (xtof_temp[0])< -17.85 && fabs(xtof_temp[0])>-(17.85+4.) ) xtof_temp[0] =-17.84; |
|
|
if ( (xtof_temp[1])< -17.85 && fabs(xtof_temp[1])>-(17.85+4.) ) xtof_temp[1] =-17.84; |
|
|
if ( (ytof_temp[0])< -13.75 && fabs(ytof_temp[0])>-(13.75+4.) ) ytof_temp[0] =-13.74; |
|
|
if ( (ytof_temp[1])< -13.75 && fabs(ytof_temp[1])>-(13.75+4.) ) ytof_temp[1] =-13.74; |
|
|
|
|
|
if ( (xtof_temp[2])> 4.5 && (xtof_temp[2])<4.5+4. ) xtof_temp[2] =4.4; |
|
|
if ( (xtof_temp[3])> 4.45 && (xtof_temp[3])<4.5+4. ) xtof_temp[3] =4.4; |
|
|
if ( (ytof_temp[2])> 3.75 && (ytof_temp[2])<3.75+4. ) ytof_temp[2] =3.74; |
|
|
if ( (ytof_temp[3])> 3.75 && (ytof_temp[3])<3.75+4. ) ytof_temp[3] =3.74; |
|
|
if ( (xtof_temp[2])< -4.5 && (xtof_temp[2])>-(4.5+4.) ) xtof_temp[2] =-4.4; |
|
|
if ( (xtof_temp[3])< -4.45 && (xtof_temp[3])>-(4.5+4.) ) xtof_temp[3] =-4.4; |
|
|
if ( (ytof_temp[2])< -3.75 && (ytof_temp[2])>-(3.75+4.) ) ytof_temp[2] =-3.74; |
|
|
if ( (ytof_temp[3])< -3.75 && (ytof_temp[3])>-(3.75+4.) ) ytof_temp[3] =-3.74; |
|
|
|
|
|
if ( (xtof_temp[4])> 6. && (xtof_temp[4])<6.+4. ) xtof_temp[2] =5.9; |
|
|
if ( (xtof_temp[5])> 6. && (xtof_temp[5])<6.+4. ) xtof_temp[3] =5.9; |
|
|
if ( (ytof_temp[4])> 5. && (ytof_temp[4])<5.+4. ) ytof_temp[2] =4.9; |
|
|
if ( (ytof_temp[5])> 5. && (ytof_temp[5])<5.+4. ) ytof_temp[3] =4.9; |
|
|
if ( (xtof_temp[4])< -6. && (xtof_temp[4])>-(6.+4.) ) xtof_temp[2] =-5.9; |
|
|
if ( (xtof_temp[5])< -6. && (xtof_temp[5])>-(6.+4.) ) xtof_temp[3] =-5.9; |
|
|
if ( (ytof_temp[4])< -5. && (ytof_temp[4])>-(5.+4.) ) ytof_temp[2] =-4.9; |
|
|
if ( (ytof_temp[5])< -5. && (ytof_temp[5])>-(5.+4.) ) ytof_temp[3] =-4.9; |
|
|
|
|
|
|
|
|
for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ |
|
|
Int_t paddleid=ii; |
|
|
pad = GetPaddleid(plane,paddleid); |
|
|
Int_t IpaddleT=-1; |
|
|
IpaddleT=this->GetPaddleIdOfTrack(xtof_temp[plane],ytof_temp[plane], plane,0.0); |
|
|
// printf("SSS %i %i %f %f %f %f \n",IpaddleT,paddleid,xtof_temp[plane],ytof_temp[plane],t_tof->xtofpos[plane],t_tof->ytofpos[plane]); |
|
|
// if ( IpaddleT == paddleid || IpaddleT-1 == paddleid || IpaddleT+1 == paddleid ){ |
|
|
if ( IpaddleT == paddleid || GetTrueNHitPaddles(plane) == 1 ){ |
|
|
//IpaddleT-1 == paddleid || IpaddleT+1 == paddleid ){ |
|
|
GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning); |
|
|
dedx += PadEdx; |
|
|
} |
|
|
}; |
|
|
} else { |
|
|
for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ |
|
|
Int_t paddleid=ii; |
|
|
pad = GetPaddleid(plane,paddleid); |
|
|
GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning); |
|
|
dedx += PadEdx; |
|
|
// printf("TTT %i %i %f\n",paddleid,plane,PadEdx); |
|
|
}; |
|
|
} |
|
|
// |
|
|
return(dedx); |
|
|
}; |
|
|
|
|
311 |
|
|
312 |
|
//new, wm Feb 15 |
313 |
//wm Nov 08 |
//wm Nov 08 |
314 |
//gf Apr 07 |
//gf Apr 07 |
315 |
/** |
/** |
316 |
* Method to get the mean dEdx from a ToF layer - ATTENTION: |
* Method to get the mean dEdx from a ToF layer |
317 |
* It will sum up the dEdx of all the paddles, but since by definition |
* By definition there should be PMTs with dEdx values only in one paddle of a layer |
318 |
* only the paddle hitted by the track gets a dEdx value and the other |
* (the paddle hitted by the track), this method looks for the hitted paddle |
319 |
* paddles are set to zero, the output is just the dEdx of the hitted |
* and gives the mean dEdx of that paddle as the output |
320 |
* paddle in each layer! |
* The method was modified for the "ToF-standalone" part in february 2015 |
321 |
* The "adcfl" option is not very useful (an artificial dEdx is per |
* The "adcfl" option is not very useful (an artificial dEdx is per |
322 |
* definition= 1 mip and not a real measurement), anyway left in the code |
* definition= 1 mip and not a real measurement), anyway left in the code |
323 |
* @param notrack Track Number |
* @param trk Pointer to TofTrkVar object |
324 |
* @param plane Plane index (0,1,2,3,4,5) |
* @param plane Plane index (0,1,2,3,4,5) |
325 |
* @param adcflag in the plane (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; ) |
* @param adcflag in the plane (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; ) |
326 |
*/ |
*/ |
327 |
Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane, Int_t adcfl){ |
Float_t ToFLevel2::GetdEdx(ToFTrkVar *trk, Int_t plane, Int_t adcfl){ |
328 |
// printf("fiffi\n"); |
|
329 |
Float_t dedx = 0.; |
Float_t dedx = 0.; |
330 |
Float_t PadEdx =0.; |
Float_t PadEdx =0.; |
331 |
Int_t SatWarning; |
Int_t SatWarning; |
332 |
Int_t pad=-1; |
Int_t pad=-1; |
333 |
// |
// |
334 |
ToFTrkVar *trk = GetToFTrkVar(notrack); |
if(!trk) cout << "ToFLevel2::GetdEdx(...) ---> NULL ToFTrkVar obj "<<endl; |
335 |
if(!trk) return 0; //ELENA |
if(!trk) return 0; //ELENA |
336 |
// |
// |
337 |
if ( trk->trkseqno == -1 ){ //standalone, only paddles along the track, or about... |
// ToF standalone part |
338 |
// printf("ciccio\n"); |
// |
339 |
Float_t xleft=0; |
if ( trk->trkseqno == -1 ){ |
|
Float_t xright=0; |
|
|
Float_t yleft=0; |
|
|
Float_t yright=0; |
|
|
Float_t xtof_temp[6]={100.,100.,100.,100.,100.,100.}; |
|
|
Float_t ytof_temp[6]={100.,100.,100.,100.,100.,100.}; |
|
|
ToFTrkVar *t_tof = trk; |
|
340 |
|
|
341 |
xtof_temp[0]=t_tof->xtofpos[0]; |
// ToFTrkVar *t_tof = trk; |
|
ytof_temp[0]=t_tof->ytofpos[0]; |
|
|
xtof_temp[1]=t_tof->xtofpos[0]; |
|
|
ytof_temp[1]=t_tof->ytofpos[0]; |
|
|
|
|
|
xtof_temp[2]=t_tof->xtofpos[1]; |
|
|
ytof_temp[2]=t_tof->ytofpos[1]; |
|
|
xtof_temp[3]=t_tof->xtofpos[1]; |
|
|
ytof_temp[3]=t_tof->ytofpos[1]; |
|
|
|
|
|
xtof_temp[4]=t_tof->xtofpos[2]; |
|
|
ytof_temp[4]=t_tof->ytofpos[2]; |
|
|
xtof_temp[5]=t_tof->xtofpos[2]; |
|
|
ytof_temp[5]=t_tof->ytofpos[2]; |
|
|
|
|
|
if(t_tof->xtofpos[0]<100. && t_tof->ytofpos[0]<100.){ |
|
|
xtof_temp[1]=t_tof->xtofpos[0]; |
|
|
ytof_temp[0]=t_tof->ytofpos[0]; |
|
|
}else if(t_tof->xtofpos[0]>=100. && t_tof->ytofpos[0]<100.){ |
|
|
ytof_temp[0]=t_tof->ytofpos[0]; |
|
|
this->GetPaddleGeometry(0,(Int_t)log2(this->tof_j_flag[0]),xleft, xright, yleft, yright); |
|
|
xtof_temp[1]=xleft+2.55; |
|
|
}else if(t_tof->ytofpos[0]>=100. && t_tof->xtofpos[0]<100.){ |
|
|
xtof_temp[1]=t_tof->xtofpos[0]; |
|
|
this->GetPaddleGeometry(1,(Int_t)log2(this->tof_j_flag[1]),xleft, xright, yleft, yright); |
|
|
ytof_temp[0]=yleft+2.75; |
|
|
} |
|
342 |
|
|
343 |
if(t_tof->xtofpos[1]<100. && t_tof->ytofpos[1]<100.){ |
// Find the hitted paddle (two good TDC values) using the tof_j_flag (from tofl2com.for) |
344 |
xtof_temp[2]=t_tof->xtofpos[1]; |
|
345 |
ytof_temp[3]=t_tof->ytofpos[1]; |
Int_t Ipaddle=-1; |
346 |
}else if(t_tof->xtofpos[1]>=100. && t_tof->ytofpos[1]<100.){ |
// if tof_j_flag == 0: no paddle was hitted. Otherwise decode tof_j_flag to get the paddle |
347 |
ytof_temp[3]=t_tof->ytofpos[1]; |
if (this->tof_j_flag[plane] > 0) Ipaddle = (Int_t)log2(this->tof_j_flag[plane]) ; |
348 |
this->GetPaddleGeometry(3,(Int_t)log2(this->tof_j_flag[3]),xleft, xright, yleft, yright); |
|
349 |
xtof_temp[2]=xleft+4.5; |
Ipaddle = (Int_t)log2(this->tof_j_flag[plane]) ; |
350 |
}else if(t_tof->ytofpos[1]>=100. && t_tof->xtofpos[1]<100.){ |
|
351 |
xtof_temp[2]=t_tof->xtofpos[1]; |
// Get the dEdx of this paddle using "GetdEdxPaddle" |
352 |
this->GetPaddleGeometry(2,(Int_t)log2(this->tof_j_flag[2]),xleft, xright, yleft, yright); |
if (Ipaddle>-1) { |
353 |
ytof_temp[3]=yleft+3.75; |
Int_t pad = GetPaddleid(plane,Ipaddle); |
354 |
|
GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning); |
355 |
|
dedx = PadEdx; |
356 |
} |
} |
357 |
|
|
358 |
if(t_tof->xtofpos[2]<100. && t_tof->ytofpos[2]<100.){ |
// If there was no correct hitted paddle, but there was one (and only one) paddle with some |
359 |
xtof_temp[5]=t_tof->xtofpos[2]; |
// PMT entries in the PMT-class (found with "GetTrueNHitPaddles", use the dEdx of this paddle |
360 |
ytof_temp[4]=t_tof->ytofpos[2]; |
|
361 |
}else if(t_tof->xtofpos[2]>=100. && t_tof->ytofpos[2]<100.){ |
if ((Ipaddle<0) && (GetTrueNHitPaddles(plane)==1)) { |
362 |
ytof_temp[4]=t_tof->ytofpos[2]; |
// find the paddle by looping over the paddles in each layer |
363 |
this->GetPaddleGeometry(4,(Int_t)log2(this->tof_j_flag[4]),xleft, xright, yleft, yright); |
// since GetTrueNHitPaddles==1 this is OK |
364 |
xtof_temp[5]=xleft+3; |
for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ |
365 |
}else if(t_tof->ytofpos[2]>=100. && t_tof->xtofpos[2]<100.){ |
Int_t paddleid=ii; |
366 |
xtof_temp[5]=t_tof->xtofpos[2]; |
Int_t pad = GetPaddleid(plane,paddleid); |
367 |
this->GetPaddleGeometry(5,(Int_t)log2(this->tof_j_flag[5]),xleft, xright, yleft, yright); |
GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning); |
368 |
ytof_temp[4]=yleft+2.5; |
dedx += PadEdx; |
|
} |
|
|
|
|
|
if ( (xtof_temp[0])> 17.85 && fabs(xtof_temp[0])<17.85+4. ) xtof_temp[0] =17.84; |
|
|
if ( (xtof_temp[1])> 17.85 && fabs(xtof_temp[1])<17.85+4. ) xtof_temp[1] =17.84; |
|
|
if ( (ytof_temp[0])> 13.75 && fabs(ytof_temp[0])<13.75+4. ) ytof_temp[0] =13.74; |
|
|
if ( (ytof_temp[1])> 13.75 && fabs(ytof_temp[1])<13.75+4. ) ytof_temp[1] =13.74; |
|
|
if ( (xtof_temp[0])< -17.85 && fabs(xtof_temp[0])>-(17.85+4.) ) xtof_temp[0] =-17.84; |
|
|
if ( (xtof_temp[1])< -17.85 && fabs(xtof_temp[1])>-(17.85+4.) ) xtof_temp[1] =-17.84; |
|
|
if ( (ytof_temp[0])< -13.75 && fabs(ytof_temp[0])>-(13.75+4.) ) ytof_temp[0] =-13.74; |
|
|
if ( (ytof_temp[1])< -13.75 && fabs(ytof_temp[1])>-(13.75+4.) ) ytof_temp[1] =-13.74; |
|
|
|
|
|
if ( (xtof_temp[2])> 4.5 && (xtof_temp[2])<4.5+4. ) xtof_temp[2] =4.4; |
|
|
if ( (xtof_temp[3])> 4.45 && (xtof_temp[3])<4.5+4. ) xtof_temp[3] =4.4; |
|
|
if ( (ytof_temp[2])> 3.75 && (ytof_temp[2])<3.75+4. ) ytof_temp[2] =3.74; |
|
|
if ( (ytof_temp[3])> 3.75 && (ytof_temp[3])<3.75+4. ) ytof_temp[3] =3.74; |
|
|
if ( (xtof_temp[2])< -4.5 && (xtof_temp[2])>-(4.5+4.) ) xtof_temp[2] =-4.4; |
|
|
if ( (xtof_temp[3])< -4.45 && (xtof_temp[3])>-(4.5+4.) ) xtof_temp[3] =-4.4; |
|
|
if ( (ytof_temp[2])< -3.75 && (ytof_temp[2])>-(3.75+4.) ) ytof_temp[2] =-3.74; |
|
|
if ( (ytof_temp[3])< -3.75 && (ytof_temp[3])>-(3.75+4.) ) ytof_temp[3] =-3.74; |
|
|
|
|
|
if ( (xtof_temp[4])> 6. && (xtof_temp[4])<6.+4. ) xtof_temp[2] =5.9; |
|
|
if ( (xtof_temp[5])> 6. && (xtof_temp[5])<6.+4. ) xtof_temp[3] =5.9; |
|
|
if ( (ytof_temp[4])> 5. && (ytof_temp[4])<5.+4. ) ytof_temp[2] =4.9; |
|
|
if ( (ytof_temp[5])> 5. && (ytof_temp[5])<5.+4. ) ytof_temp[3] =4.9; |
|
|
if ( (xtof_temp[4])< -6. && (xtof_temp[4])>-(6.+4.) ) xtof_temp[2] =-5.9; |
|
|
if ( (xtof_temp[5])< -6. && (xtof_temp[5])>-(6.+4.) ) xtof_temp[3] =-5.9; |
|
|
if ( (ytof_temp[4])< -5. && (ytof_temp[4])>-(5.+4.) ) ytof_temp[2] =-4.9; |
|
|
if ( (ytof_temp[5])< -5. && (ytof_temp[5])>-(5.+4.) ) ytof_temp[3] =-4.9; |
|
|
|
|
|
|
|
|
for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ |
|
|
Int_t paddleid=ii; |
|
|
pad = GetPaddleid(plane,paddleid); |
|
|
Int_t IpaddleT=-1; |
|
|
IpaddleT=this->GetPaddleIdOfTrack(xtof_temp[plane],ytof_temp[plane], plane,0.0); |
|
|
// printf("SSS %i %i %f %f %f %f \n",IpaddleT,paddleid,xtof_temp[plane],ytof_temp[plane],t_tof->xtofpos[plane],t_tof->ytofpos[plane]); |
|
|
// if ( IpaddleT == paddleid || IpaddleT-1 == paddleid || IpaddleT+1 == paddleid ){ |
|
|
if ( IpaddleT == paddleid || GetTrueNHitPaddles(plane) == 1 ){ |
|
|
//IpaddleT-1 == paddleid || IpaddleT+1 == paddleid ){ |
|
|
GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning); |
|
|
dedx += PadEdx; |
|
369 |
} |
} |
370 |
}; |
} |
371 |
} else { |
} else { |
372 |
|
// track dependent dEdx: simple, there will be only one paddle hitted in each layer |
373 |
|
// so just loop over the paddles in each layer |
374 |
for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ |
for (Int_t ii=0; ii<GetNPaddle(plane); ii++){ |
375 |
Int_t paddleid=ii; |
Int_t paddleid=ii; |
376 |
pad = GetPaddleid(plane,paddleid); |
pad = GetPaddleid(plane,paddleid); |
377 |
GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning); |
GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning); |
378 |
dedx += PadEdx; |
dedx += PadEdx; |
379 |
// printf("TTT %i %i %f\n",paddleid,plane,PadEdx); |
} |
|
}; |
|
380 |
} |
} |
381 |
// |
// |
382 |
return(dedx); |
return(dedx); |
383 |
}; |
} |
384 |
|
|
385 |
/** |
/** |
386 |
* Method to fill the ADC_C 4x12 matrix with the dEdx values and the TDC 4x12 matrix |
* Method to fill the ADC_C 4x12 matrix with the dEdx values and the TDC 4x12 matrix |
455 |
*/ |
*/ |
456 |
Int_t ToFLevel2::GetPMTid(Int_t hh, Int_t kk){ |
Int_t ToFLevel2::GetPMTid(Int_t hh, Int_t kk){ |
457 |
// |
// |
458 |
short tof[4][24] = { |
static const short tof[4][24] = { |
459 |
{4, 4, 4, 4, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 2, 3, 3, 3, 3, 4}, |
{4, 4, 4, 4, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 2, 3, 3, 3, 3, 4}, |
460 |
{1, 3, 5, 7, 10, 12, 2, 4, 2, 4, 6, 8, 10, 12, 1, 5, 3, 9, 7, 9, 11, 1, 5, 9}, |
{1, 3, 5, 7, 10, 12, 2, 4, 2, 4, 6, 8, 10, 12, 1, 5, 3, 9, 7, 9, 11, 1, 5, 9}, |
461 |
{2, 2, 2, 2, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 2, 1, 2, 1, 2, 2, 2, 3, 3, 4}, |
{2, 2, 2, 2, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 2, 1, 2, 1, 2, 2, 2, 3, 3, 4}, |
491 |
*/ |
*/ |
492 |
void ToFLevel2::GetPMTIndex(Int_t ind, Int_t &hb, Int_t &ch){ |
void ToFLevel2::GetPMTIndex(Int_t ind, Int_t &hb, Int_t &ch){ |
493 |
// |
// |
494 |
short tof[4][24] = { |
static const short tof[4][24] = { |
495 |
{4, 4, 4, 4, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 2, 3, 3, 3, 3, 4}, |
{4, 4, 4, 4, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 2, 3, 3, 3, 3, 4}, |
496 |
{1, 3, 5, 7, 10, 12, 2, 4, 2, 4, 6, 8, 10, 12, 1, 5, 3, 9, 7, 9, 11, 1, 5, 9}, |
{1, 3, 5, 7, 10, 12, 2, 4, 2, 4, 6, 8, 10, 12, 1, 5, 3, 9, 7, 9, 11, 1, 5, 9}, |
497 |
{2, 2, 2, 2, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 2, 1, 2, 1, 2, 2, 2, 3, 3, 4}, |
{2, 2, 2, 2, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 2, 1, 2, 1, 2, 2, 2, 3, 3, 4}, |
531 |
*/ |
*/ |
532 |
void ToFLevel2::GetdEdxPaddle(Int_t notrack, Int_t paddleid, Int_t adcfl, Float_t &PadEdx, Int_t &SatWarning){ |
void ToFLevel2::GetdEdxPaddle(Int_t notrack, Int_t paddleid, Int_t adcfl, Float_t &PadEdx, Int_t &SatWarning){ |
533 |
|
|
534 |
/* |
// ToFTrkVar *trk = GetToFTrkVar(notrack); |
535 |
Float_t PMTsat[48] = { |
ToFTrkVar *trk = GetToFStoredTrack(notrack); //Elena 2015 |
536 |
3162.14, 3165.48, 3153.85, 3085.73, 3089.65, 3107.64, 3097.52, 3078.37, |
this->GetdEdxPaddle(trk, paddleid, adcfl, PadEdx, SatWarning); |
|
3130.05, 3087.07, 3112.22, 3102.92, 3080.58, 3092.55, 3087.94, 3125.03, |
|
|
3094.09, 3143.16, 3125.51, 3181.27, 3092.09, 3124.98, 3069.3, 3095.53, |
|
|
3097.11, 3133.53, 3114.73, 3113.01, 3091.19, 3097.99, 3033.84, 3134.98, |
|
|
3081.37, 3111.04, 3066.77, 3108.17, 3133, 3111.06, 3052.52, 3140.66, |
|
|
3106.33, 3094.85, 3150.85, 3118.8, 3096.24, 3118.47,3111.36, 3117.11 } ; |
|
|
*/ |
|
|
|
|
|
// new values from Napoli dec 2008 |
|
|
Float_t PMTsat[48] = { |
|
|
3176.35,3178.19,3167.38,3099.73,3117.00,3126.29,3111.44,3092.27, |
|
|
3146.48,3094.41,3132.13,3115.37,3099.32,3110.97,3111.80,3143.14, |
|
|
3106.72,3153.44,3136.00,3188.96,3104.73,3140.45,3073.18,3106.62, |
|
|
3112.48,3146.92,3127.24,3136.52,3109.59,3112.89,3045.15,3147.26, |
|
|
3095.92,3121.05,3083.25,3123.62,3150.92,3125.30,3067.60,3160.18, |
|
|
3119.36,3108.92,3164.77,3133.64,3111.47,3131.98,3128.87,3135.56 }; |
|
|
|
|
|
for (Int_t i=0; i<48;i++) PMTsat[i] = PMTsat[i] - 5.; // safety margin |
|
|
|
|
|
|
|
|
PadEdx = 0.; |
|
|
// SatWarning = 1000; |
|
|
SatWarning = 0; // 0=good, increase for each bad PMT |
|
|
|
|
|
Float_t dEdx[48] = {0}; |
|
|
Int_t pmt_id = -1; |
|
|
Float_t adcraw[48]; |
|
|
// |
|
|
ToFTrkVar *trk = GetToFTrkVar(notrack); |
|
|
if(!trk) return; //ELENA |
|
|
// |
|
|
|
|
|
Int_t pmtleft=-1; |
|
|
Int_t pmtright=-1; |
|
|
GetPaddlePMT(paddleid, pmtleft, pmtright); |
|
|
|
|
|
adcraw[pmtleft] = 4095; |
|
|
adcraw[pmtright] = 4095; |
|
|
|
|
|
|
|
|
for (Int_t jj=0; jj<npmt(); jj++){ |
|
|
|
|
|
ToFPMT *pmt = GetToFPMT(jj); |
|
|
if(!pmt)break; //ELENA |
|
|
|
|
|
pmt_id = pmt->pmt_id; |
|
|
if(pmt_id==pmtleft){ |
|
|
adcraw[pmtleft] = pmt->adc; |
|
|
} |
|
|
|
|
|
if(pmt_id==pmtright){ |
|
|
adcraw[pmtright] = pmt->adc; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
for (Int_t i=0; i<trk->npmtadc; i++){ |
|
|
|
|
|
if((trk->adcflag).At(i)==0 || adcfl==100){ |
|
|
if((trk->pmtadc).At(i) == pmtleft)dEdx[pmtleft] = (trk->dedx).At(i); |
|
|
if((trk->pmtadc).At(i) == pmtright)dEdx[pmtright] = (trk->dedx).At(i); |
|
|
}else{ |
|
|
if((trk->pmtadc).At(i) == pmtleft)dEdx[pmtleft] = 0.; |
|
|
if((trk->pmtadc).At(i) == pmtright)dEdx[pmtright] = 0.; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// if( adcraw[pmtleft] >3000 || adcraw[pmtright] >3000)SatWarning=1; //old version |
|
|
|
|
|
// Increase SatWarning Counter for each PMT>Sat |
|
|
if( adcraw[pmtleft] > PMTsat[pmtleft])SatWarning++; |
|
|
if( adcraw[pmtright] > PMTsat[pmtright])SatWarning++; |
|
|
|
|
|
// if ADC > sat set dEdx=1000 |
|
|
if( adcraw[pmtleft] > PMTsat[pmtleft]) dEdx[pmtleft] = 1000.; |
|
|
if( adcraw[pmtright] > PMTsat[pmtright]) dEdx[pmtright] = 1000. ; |
|
|
|
|
|
// if two PMT are good, take mean dEdx, otherwise only the good dEdx |
|
|
if(dEdx[pmtleft]<1000 && dEdx[pmtright]<1000) PadEdx = (dEdx[pmtleft]+dEdx[pmtright])*0.5; |
|
|
if(dEdx[pmtleft]==1000 && dEdx[pmtright]<1000) PadEdx = dEdx[pmtright]; |
|
|
if(dEdx[pmtleft]<1000 && dEdx[pmtright]==1000) PadEdx = dEdx[pmtleft]; |
|
537 |
|
|
538 |
}; |
}; |
539 |
|
|
582 |
Int_t pmt_id = -1; |
Int_t pmt_id = -1; |
583 |
Float_t adcraw[48]; |
Float_t adcraw[48]; |
584 |
// |
// |
585 |
|
if(!trk)cout << "ToFLevel2::GetdEdxPaddle(...) ---> NULL ToFTrkVar obj "<<endl; |
586 |
if(!trk) return; //ELENA |
if(!trk) return; //ELENA |
587 |
// |
// |
588 |
|
|
653 |
|
|
654 |
TString pmtname = " "; |
TString pmtname = " "; |
655 |
|
|
656 |
TString photoS[48] = { |
static const TString photoS[48] = { |
657 |
"S11_1A", "S11_1B", "S11_2A", "S11_2B", "S11_3A", "S11_3B", "S11_4A", |
"S11_1A", "S11_1B", "S11_2A", "S11_2B", "S11_3A", "S11_3B", "S11_4A", |
658 |
"S11_4B", |
"S11_4B", |
659 |
"S11_5A", "S11_5B", "S11_6A", "S11_6B", "S11_7A", "S11_7B", "S11_8A", |
"S11_5A", "S11_5B", "S11_6A", "S11_6B", "S11_7A", "S11_7B", "S11_8A", |
1113 |
* @param cut on chi2 |
* @param cut on chi2 |
1114 |
*/ |
*/ |
1115 |
|
|
|
Float_t ToFLevel2::CalcBeta(Int_t notrack, Float_t resmax, Float_t qualitycut, Float_t chi2cut){ |
|
1116 |
|
|
1117 |
// cout<<" in CalcBeta "<<resmax<<" "<<chi2cut<<" "<<qualitycut<<endl; |
Float_t ToFTrkVar::CalcBeta( Float_t resmax, Float_t qualitycut, Float_t chi2cut){ |
1118 |
|
|
1119 |
|
|
1120 |
Float_t bxx = 100.; |
Float_t bxx = 100.; |
1121 |
// |
// |
1122 |
ToFTrkVar *trk = GetToFTrkVar(notrack); |
ToFTrkVar *trk = this; |
|
if(!trk) return 0; //ELENA |
|
1123 |
|
|
1124 |
|
|
1125 |
Float_t chi2,xhelp,beta_mean; |
Float_t chi2,xhelp,beta_mean; |
1146 |
for (Int_t i=0; i<trk->npmttdc; i++){ |
for (Int_t i=0; i<trk->npmttdc; i++){ |
1147 |
// |
// |
1148 |
pmt_id = (trk->pmttdc).At(i); |
pmt_id = (trk->pmttdc).At(i); |
1149 |
pmt_plane = GetPlaneIndex(pmt_id); |
pmt_plane = ToFLevel2::GetPlaneIndex(pmt_id); |
1150 |
tdcfl = (trk->tdcflag).At(i); |
tdcfl = (trk->tdcflag).At(i); |
1151 |
if (w_il[pmt_plane] != 1.) w_il[pmt_plane] = tdcfl; //tdcflag |
if (w_il[pmt_plane] != 1.) w_il[pmt_plane] = tdcfl; //tdcflag |
1152 |
}; |
}; |
1233 |
// |
// |
1234 |
return(bxx); |
return(bxx); |
1235 |
}; |
}; |
1236 |
|
//////////////////////////////////////////////////// |
1237 |
|
//////////////////////////////////////////////////// |
1238 |
|
/** |
1239 |
|
* See ToFTrkVar::CalcBeta(Float_t,Float_t, Float_t). |
1240 |
|
*/ |
1241 |
|
Float_t ToFLevel2::CalcBeta(Int_t notrack, Float_t resmax, Float_t qualitycut, Float_t chi2cut){ |
1242 |
|
|
1243 |
|
// cout<<" in CalcBeta "<<resmax<<" "<<chi2cut<<" "<<qualitycut<<endl; |
1244 |
|
|
1245 |
|
ToFTrkVar *trk = GetToFTrkVar(notrack); |
1246 |
|
if(!trk) return 0; //ELENA |
1247 |
|
|
1248 |
|
return trk->CalcBeta(resmax,qualitycut,chi2cut); |
1249 |
|
|
1250 |
|
}; |
1251 |
|
|
1252 |
|
|
1253 |
//////////////////////////////////////////////////// |
//////////////////////////////////////////////////// |
1337 |
// if ( !dbc->IsConnected() ) return 1; |
// if ( !dbc->IsConnected() ) return 1; |
1338 |
// stringstream myquery; |
// stringstream myquery; |
1339 |
// myquery.str(""); |
// myquery.str(""); |
1340 |
// myquery << "SET time_zone='+0:00'"; |
// myquery << "SET time_zone='+0:00';"; |
1341 |
// dbc->Query(myquery.str().c_str()); |
// dbc->Query(myquery.str().c_str()); |
1342 |
|
// delete dbc->Query("SET sql_mode = 'NO_UNSIGNED_SUBTRACTION';"); |
1343 |
// GL_PARAM *glparam = new GL_PARAM(); |
// GL_PARAM *glparam = new GL_PARAM(); |
1344 |
// glparam->Query_GL_PARAM(1,1,dbc); // parameters stored in DB in GL_PRAM table |
// glparam->Query_GL_PARAM(1,1,dbc); // parameters stored in DB in GL_PRAM table |
1345 |
// trk->LoadField(glparam->PATH+glparam->NAME); |
// trk->LoadField(glparam->PATH+glparam->NAME); |