/[PAMELA software]/DarthVader/ToFLevel2/src/ToFLevel2.cpp
ViewVC logotype

Diff of /DarthVader/ToFLevel2/src/ToFLevel2.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.39 by mocchiut, Thu Aug 7 16:04:11 2014 UTC revision 1.43 by mocchiut, Thu Feb 26 11:27:35 2015 UTC
# Line 113  void ToFLevel2::Set(){//ELENA Line 113  void ToFLevel2::Set(){//ELENA
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    //    //
# Line 151  ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t Line 161  ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t
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()){
# Line 214  ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit) Line 252  ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit)
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){
# Line 225  Int_t ToFLevel2::GetNHitPaddles(Int_t pl Line 266  Int_t ToFLevel2::GetNHitPaddles(Int_t pl
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){
# Line 245  Int_t ToFLevel2::GetTrueNHitPaddles(Int_ Line 288  Int_t ToFLevel2::GetTrueNHitPaddles(Int_
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.;    return this->GetdEdx(trk, plane, adcfl);
309    Float_t PadEdx =0.;  }
   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);  
 };  
   
310    
311    //new, wm Feb 15
312  //wm Nov 08  //wm Nov 08
313  //gf Apr 07  //gf Apr 07
314  /**  /**
315   * Method to get the mean dEdx from a ToF layer - ATTENTION:   * Method to get the mean dEdx from a ToF layer
316   * 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
317   * 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
318   * 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
319   * paddle in each layer!   * The method was modified for the "ToF-standalone" part in february 2015
320   * The "adcfl" option is not very useful (an artificial dEdx is per   * The "adcfl" option is not very useful (an artificial dEdx is per
321   * 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
322   * @param notrack Track Number   * @param trk Pointer to TofTrkVar class
323   * @param plane Plane index (0,1,2,3,4,5)   * @param plane Plane index (0,1,2,3,4,5)
324   * @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; )
325   */   */
326  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){
327    //  printf("fiffi\n");    
328    Float_t dedx = 0.;    Float_t dedx = 0.;
329    Float_t PadEdx =0.;    Float_t PadEdx =0.;
330    Int_t SatWarning;    Int_t SatWarning;
331    Int_t pad=-1;    Int_t pad=-1;
332    //    //
   ToFTrkVar *trk = GetToFTrkVar(notrack);  
333    if(!trk) return 0; //ELENA    if(!trk) return 0; //ELENA
334    //    //
335    if ( trk->trkseqno == -1 ){ //standalone, only paddles along the track, or about...    // ToF standalone part
336      //    printf("ciccio\n");    //
337      Float_t xleft=0;    if ( trk->trkseqno == -1 ){
338      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.};  
339      ToFTrkVar *t_tof = trk;      ToFTrkVar *t_tof = trk;
340            
341      xtof_temp[0]=t_tof->xtofpos[0];      // Find the hitted paddle  (two good TDC values) using the tof_j_flag (from tofl2com.for)
342      ytof_temp[0]=t_tof->ytofpos[0];      
343      xtof_temp[1]=t_tof->xtofpos[0];      Int_t Ipaddle=-1;
344      ytof_temp[1]=t_tof->ytofpos[0];      // if tof_j_flag == 0: no paddle was hitted. Otherwise decode tof_j_flag to get the paddle
345        if (this->tof_j_flag[plane] > 0)  Ipaddle = (Int_t)log2(this->tof_j_flag[plane]) ;
346      xtof_temp[2]=t_tof->xtofpos[1];      
347      ytof_temp[2]=t_tof->ytofpos[1];      Ipaddle =  (Int_t)log2(this->tof_j_flag[plane]) ;
348      xtof_temp[3]=t_tof->xtofpos[1];      
349      ytof_temp[3]=t_tof->ytofpos[1];      // Get the dEdx of this paddle using "GetdEdxPaddle"
350        if (Ipaddle>-1) {
351      xtof_temp[4]=t_tof->xtofpos[2];        Int_t pad = GetPaddleid(plane,Ipaddle);
352      ytof_temp[4]=t_tof->ytofpos[2];        GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning);
353      xtof_temp[5]=t_tof->xtofpos[2];        dedx = PadEdx;
354      ytof_temp[5]=t_tof->ytofpos[2];      }
355        
356      if(t_tof->xtofpos[0]<100. && t_tof->ytofpos[0]<100.){      // If there was no correct hitted paddle, but there was one (and only one) paddle with some
357        xtof_temp[1]=t_tof->xtofpos[0];      // PMT entries in the PMT-class (found with "GetTrueNHitPaddles", use the dEdx of this paddle
358        ytof_temp[0]=t_tof->ytofpos[0];      
359      }else if(t_tof->xtofpos[0]>=100. && t_tof->ytofpos[0]<100.){      if ((Ipaddle<0) && (GetTrueNHitPaddles(plane)==1)) {
360        ytof_temp[0]=t_tof->ytofpos[0];        // find the paddle by looping over the paddles in each layer
361        this->GetPaddleGeometry(0,(Int_t)log2(this->tof_j_flag[0]),xleft, xright, yleft, yright);        // since GetTrueNHitPaddles==1 this is OK
362        xtof_temp[1]=xleft+2.55;        for (Int_t ii=0; ii<GetNPaddle(plane); ii++){
363      }else if(t_tof->ytofpos[0]>=100. && t_tof->xtofpos[0]<100.){          Int_t paddleid=ii;
364        xtof_temp[1]=t_tof->xtofpos[0];          Int_t pad = GetPaddleid(plane,paddleid);
       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 ){  
365          GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning);          GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning);
366          dedx += PadEdx;          dedx += PadEdx;
367        }        }
368      };      }
369    } else {    } else {
370        // track dependent dEdx: simple, there will be only one paddle hitted in    each layer
371        // so just loop over the paddles in each layer
372      for (Int_t ii=0; ii<GetNPaddle(plane); ii++){      for (Int_t ii=0; ii<GetNPaddle(plane); ii++){
373        Int_t paddleid=ii;        Int_t paddleid=ii;
374        pad = GetPaddleid(plane,paddleid);        pad = GetPaddleid(plane,paddleid);
375        GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning);        GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning);
376        dedx += PadEdx;        dedx += PadEdx;
377  //      printf("TTT %i %i %f\n",paddleid,plane,PadEdx);      }
     };  
378    }    }
379    //    //
380    return(dedx);    return(dedx);
381  };  }
382    
383  /**  /**
384   * 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
# Line 1550  Int_t ToFLevel2::Process(TrkLevel2 *trk, Line 1401  Int_t ToFLevel2::Process(TrkLevel2 *trk,
1401  //   if ( !dbc->IsConnected() ) return 1;  //   if ( !dbc->IsConnected() ) return 1;
1402  //   stringstream myquery;  //   stringstream myquery;
1403  //   myquery.str("");  //   myquery.str("");
1404  //   myquery << "SET time_zone='+0:00'";  //   myquery << "SET time_zone='+0:00';";
1405  //   dbc->Query(myquery.str().c_str());  //   dbc->Query(myquery.str().c_str());
1406    //   delete dbc->Query("SET sql_mode = 'NO_UNSIGNED_SUBTRACTION';");
1407  //   GL_PARAM *glparam = new GL_PARAM();  //   GL_PARAM *glparam = new GL_PARAM();
1408  //   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
1409  //   trk->LoadField(glparam->PATH+glparam->NAME);  //   trk->LoadField(glparam->PATH+glparam->NAME);

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.43

  ViewVC Help
Powered by ViewVC 1.1.23