/[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.36 by mocchiut, Thu Apr 12 12:27:10 2012 UTC revision 1.48 by pam-fi, Wed May 20 10:57:02 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 137  void ToFLevel2::Delete(Option_t *t){ //E Line 147  void ToFLevel2::Delete(Option_t *t){ //E
147    //    //
148  }; //ELENA  }; //ELENA
149    
150    /**
151     * Retrieves the itrk-th tof track stored in the array
152     * @param itrk Array index (min 0, max ToFLevel2::ntrk())
153     *
154     */
155  ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t itrk){  ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t itrk){
156    //        //    
157    if(itrk >= ntrk()){    if(itrk >= ntrk()){
# Line 151  ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t Line 166  ToFTrkVar *ToFLevel2::GetToFTrkVar(Int_t
166    return toftrack;    return toftrack;
167  }  }
168    
169    /**
170     * Retrieves the tof track matching the seqno-th tracker stored track.
171     * @param seqno Track sequential number
172     * (seqno = -1 for standalone tof track, seqno=0-TrkLevel2::ntrk() for tof tracks associated to a tracker track)
173     *
174     */
175    ToFTrkVar *ToFLevel2::GetToFStoredTrack(int seqno){
176    
177      if( ntrk()==0 ){
178        printf("ToFLevel2::GetToFStoredTrack(int) : requested tracker SeqNo %i but no ToFrimeter tracks are stored\n",seqno);
179        return NULL;
180      };
181      
182      ToFTrkVar *c = 0;
183      Int_t it_tof=0;
184        
185      do {
186        c = GetToFTrkVar(it_tof);
187        it_tof++;
188      } while( c && seqno != c->trkseqno && it_tof < ntrk());      
189      
190      if(!c || seqno != c->trkseqno){
191        c = 0;
192        if(seqno!=-1 ) printf("ToFLevel2::GetToFStoredTrack(int) : requested tracker SeqNo %i does not match ToFrimeter stored tracks\n",seqno);
193      };
194      return c;
195        
196    }
197    
198    
199  ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit){  ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit){
200    //        //    
201    if(ihit >= npmt()){    if(ihit >= npmt()){
# Line 214  ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit) Line 259  ToFPMT *ToFLevel2::GetToFPMT(Int_t ihit)
259         false) return true;         false) return true;
260      else return false;      else return false;
261  };  };
262    
263  /**  /**
264   * 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.
265     * The method uses "HitPaddle" which checks if there is a TDC signal
266     * from both PMTs.
267   * @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).
268   */   */
269  Int_t ToFLevel2::GetNHitPaddles(Int_t plane){  Int_t ToFLevel2::GetNHitPaddles(Int_t plane){
# Line 225  Int_t ToFLevel2::GetNHitPaddles(Int_t pl Line 273  Int_t ToFLevel2::GetNHitPaddles(Int_t pl
273  };  };
274    
275  /**  /**
276   * 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.
277     * The method does NOT check if there is a signal from both PMTs, it only
278     * checks if there is some PMT signal in a paddle
279   * @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).
280   */   */
281  Int_t ToFLevel2::GetTrueNHitPaddles(Int_t plane){  Int_t ToFLevel2::GetTrueNHitPaddles(Int_t plane){
# Line 245  Int_t ToFLevel2::GetTrueNHitPaddles(Int_ Line 295  Int_t ToFLevel2::GetTrueNHitPaddles(Int_
295      return npad;      return npad;
296  };  };
297    
298    //new, wm Feb 15
299  //wm Nov 08  //wm Nov 08
300  //gf Apr 07  //gf Apr 07
301  /**  /**
302   * Method to get the mean dEdx from a ToF layer - ATTENTION:   * Method to get the mean dEdx from a ToF layer
303   * 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
304   * 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
305   * 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
306   * paddle in each layer!   * The method was modified for the "ToF-standalone" part in february 2015
307   * The "adcfl" option is not very useful (an artificial dEdx is per   * The "adcfl" option is not very useful (an artificial dEdx is per
308   * 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
309   * @param notrack Track Number   * @param notrack Track Number (array index, ranging from 0 to ntrk())
310   * @param plane Plane index (0,1,2,3,4,5)   * @param plane Plane index (0,1,2,3,4,5)
311   * @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; )
312   */   */
313  Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane, Int_t adcfl){  Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane, Int_t adcfl){
314    //  printf("fiffi\n");      ToFTrkVar *trk = GetToFTrkVar(notrack);
315    //    ToFTrkVar *trk = GetToFStoredTrack(seqno);//Elena 2015
316      return this->GetdEdx(trk, plane, adcfl);
317    }
318    
319    //new, wm Feb 15
320    //wm Nov 08
321    //gf Apr 07
322    /**
323     * Method to get the mean dEdx from a ToF layer
324     * By definition there should be PMTs with dEdx values only in one paddle of a layer
325     * (the paddle hitted by the track), this method looks for the hitted paddle
326     * and gives the mean dEdx of that paddle as the output
327     * The method was modified for the "ToF-standalone" part in february 2015
328     * The "adcfl" option is not very useful (an artificial dEdx is per
329     * definition= 1 mip and not a real measurement), anyway left in the code
330     * @param trk Pointer to TofTrkVar object
331     * @param plane Plane index (0,1,2,3,4,5)
332     * @param adcflag in the plane (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; )
333     */
334    Float_t ToFLevel2::GetdEdx(ToFTrkVar *trk, Int_t plane, Int_t adcfl){
335      
336    Float_t dedx = 0.;    Float_t dedx = 0.;
337    Float_t PadEdx =0.;    Float_t PadEdx =0.;
338    Int_t SatWarning;    Int_t SatWarning;
339    Int_t pad=-1;    Int_t pad=-1;
340    //    //
341    ToFTrkVar *trk = GetToFTrkVar(notrack);    if(!trk) cout << "ToFLevel2::GetdEdx(...) ---> NULL ToFTrkVar obj "<<endl;
342    if(!trk) return 0; //ELENA    if(!trk) return 0; //ELENA
343    //    //
344    if ( trk->trkseqno == -1 ){ //standalone, only paddles along the track, or about...    // ToF standalone part
345      //    printf("ciccio\n");    //
346      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;  
347            
348      xtof_temp[0]=t_tof->xtofpos[0];      //    ToFTrkVar *t_tof = trk;
349      ytof_temp[0]=t_tof->ytofpos[0];      
350      xtof_temp[1]=t_tof->xtofpos[0];      // Find the hitted paddle  (two good TDC values) using the tof_j_flag (from tofl2com.for)
     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;  
     }  
351            
352      if(t_tof->xtofpos[1]<100. && t_tof->ytofpos[1]<100.){      Int_t Ipaddle=-1;
353        xtof_temp[2]=t_tof->xtofpos[1];      // if tof_j_flag == 0: no paddle was hitted. Otherwise decode tof_j_flag to get the paddle
354        ytof_temp[3]=t_tof->ytofpos[1];      if (this->tof_j_flag[plane] > 0)  Ipaddle = (Int_t)log2(this->tof_j_flag[plane]) ;
355      }else if(t_tof->xtofpos[1]>=100. && t_tof->ytofpos[1]<100.){      
356        ytof_temp[3]=t_tof->ytofpos[1];      Ipaddle =  (Int_t)log2(this->tof_j_flag[plane]) ;
357        this->GetPaddleGeometry(3,(Int_t)log2(this->tof_j_flag[3]),xleft, xright, yleft, yright);      
358        xtof_temp[2]=xleft+4.5;      // Get the dEdx of this paddle using "GetdEdxPaddle"
359      }else if(t_tof->ytofpos[1]>=100. && t_tof->xtofpos[1]<100.){      if (Ipaddle>-1) {
360        xtof_temp[2]=t_tof->xtofpos[1];        Int_t pad = GetPaddleid(plane,Ipaddle);
361        this->GetPaddleGeometry(2,(Int_t)log2(this->tof_j_flag[2]),xleft, xright, yleft, yright);        GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning);
362        ytof_temp[3]=yleft+3.75;        dedx = PadEdx;
363      }      }
364            
365      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
366        xtof_temp[5]=t_tof->xtofpos[2];      // PMT entries in the PMT-class (found with "GetTrueNHitPaddles", use the dEdx of this paddle
367        ytof_temp[4]=t_tof->ytofpos[2];      
368      }else if(t_tof->xtofpos[2]>=100. && t_tof->ytofpos[2]<100.){      if ((Ipaddle<0) && (GetTrueNHitPaddles(plane)==1)) {
369        ytof_temp[4]=t_tof->ytofpos[2];        // find the paddle by looping over the paddles in each layer
370        this->GetPaddleGeometry(4,(Int_t)log2(this->tof_j_flag[4]),xleft, xright, yleft, yright);        // since GetTrueNHitPaddles==1 this is OK
371        xtof_temp[5]=xleft+3;        for (Int_t ii=0; ii<GetNPaddle(plane); ii++){
372      }else if(t_tof->ytofpos[2]>=100. && t_tof->xtofpos[2]<100.){          Int_t paddleid=ii;
373        xtof_temp[5]=t_tof->xtofpos[2];          Int_t pad = GetPaddleid(plane,paddleid);
374        this->GetPaddleGeometry(5,(Int_t)log2(this->tof_j_flag[5]),xleft, xright, yleft, yright);          GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning);
375        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;  
376        }        }
377      };      }
378    } else {    } else {
379        // track dependent dEdx: simple, there will be only one paddle hitted in    each layer
380        // so just loop over the paddles in each layer
381      for (Int_t ii=0; ii<GetNPaddle(plane); ii++){      for (Int_t ii=0; ii<GetNPaddle(plane); ii++){
382        Int_t paddleid=ii;        Int_t paddleid=ii;
383        pad = GetPaddleid(plane,paddleid);        pad = GetPaddleid(plane,paddleid);
384        GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning);        GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning);
385        dedx += PadEdx;        dedx += PadEdx;
386  //      printf("TTT %i %i %f\n",paddleid,plane,PadEdx);      }
     };  
387    }    }
388    //    //
389    return(dedx);    return(dedx);
390  };  }
391    
392  /**  /**
393   * 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
394   * with the time-walk corrected TDC values.   * with the time-walk corrected TDC values.
395   * @param notrack Track Number   * @param notrack Track Number (arry index, ranging from 0 to ntrk())
396   * @param adc  ADC_C matrix with dEdx values   * @param adc  ADC_C matrix with dEdx values
397   * @param tdc  TDC matrix   * @param tdc  TDC matrix
398   */   */
# Line 460  Int_t ToFLevel2::GetPlaneIndex(Int_t pmt Line 462  Int_t ToFLevel2::GetPlaneIndex(Int_t pmt
462   */   */
463  Int_t ToFLevel2::GetPMTid(Int_t hh, Int_t kk){  Int_t ToFLevel2::GetPMTid(Int_t hh, Int_t kk){
464    //    //
465    short tof[4][24] = {    static const short tof[4][24] = {
466      {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},
467      {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},
468      {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},
# Line 496  Int_t ToFLevel2::GetPMTid(Int_t hh, Int_ Line 498  Int_t ToFLevel2::GetPMTid(Int_t hh, Int_
498   */   */
499  void ToFLevel2::GetPMTIndex(Int_t ind, Int_t &hb, Int_t &ch){  void ToFLevel2::GetPMTIndex(Int_t ind, Int_t &hb, Int_t &ch){
500    //    //
501    short tof[4][24] = {    static const short tof[4][24] = {
502      {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},
503      {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},
504      {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},
# Line 528  void ToFLevel2::GetPMTIndex(Int_t ind, I Line 530  void ToFLevel2::GetPMTIndex(Int_t ind, I
530   * Method to get the dEdx from a given ToF paddle.   * Method to get the dEdx from a given ToF paddle.
531   * If two PMTs are good, the mean dEdx of both PMTs is taken, otherwise   * If two PMTs are good, the mean dEdx of both PMTs is taken, otherwise
532   * just the dEdx of the "good" PMT. If both PMTs are above saturation => dEdx=1000   * just the dEdx of the "good" PMT. If both PMTs are above saturation => dEdx=1000
533   * @param notrack Track Number   * @param notrack Track Number (-1 for standalone info)
534   * @param Paddle index (0,1,...,23).   * @param Paddle index (0,1,...,23).
535   * @param adcflag in the paddle (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; )   * @param adcflag in the paddle (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; )
536   * @param PadEdx dEdx from a given ToF paddle   * @param PadEdx dEdx from a given ToF paddle
# Line 536  void ToFLevel2::GetPMTIndex(Int_t ind, I Line 538  void ToFLevel2::GetPMTIndex(Int_t ind, I
538   */   */
539  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){
540    
541      ToFTrkVar *trk = GetToFTrkVar(notrack);
542    //    ToFTrkVar *trk = GetToFStoredTrack(seqno); //Elena 2015
543      this->GetdEdxPaddle(trk, paddleid, adcfl, PadEdx, SatWarning);
544      
545    };
546    
547    //
548    //  wm Nov 08 revision - saturation values included
549    /// gf Apr 07
550    /**
551     * Method to get the dEdx from a given ToF paddle.
552     * If two PMTs are good, the mean dEdx of both PMTs is taken, otherwise
553     * just the dEdx of the "good" PMT. If both PMTs are above saturation => dEdx=1000
554     * @param notrack Track Number
555     * @param Paddle index (0,1,...,23).
556     * @param adcflag in the paddle (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; )
557     * @param PadEdx dEdx from a given ToF paddle
558     * @param SatWarning 1 if the PMT ios near saturation region (adcraw ~3000)
559     */
560    void ToFLevel2::GetdEdxPaddle(ToFTrkVar *trk, Int_t paddleid, Int_t adcfl, Float_t &PadEdx, Int_t &SatWarning){
561    
562    /*    /*
563      Float_t  PMTsat[48] = {      Float_t  PMTsat[48] = {
564      3162.14, 3165.48, 3153.85, 3085.73, 3089.65, 3107.64, 3097.52, 3078.37,      3162.14, 3165.48, 3153.85, 3085.73, 3089.65, 3107.64, 3097.52, 3078.37,
# Line 566  void ToFLevel2::GetdEdxPaddle(Int_t notr Line 589  void ToFLevel2::GetdEdxPaddle(Int_t notr
589    Int_t pmt_id = -1;    Int_t pmt_id = -1;
590    Float_t adcraw[48];    Float_t adcraw[48];
591    //    //
592    ToFTrkVar *trk = GetToFTrkVar(notrack);    if(!trk)cout << "ToFLevel2::GetdEdxPaddle(...) ---> NULL ToFTrkVar obj "<<endl;
593    if(!trk) return; //ELENA    if(!trk) return; //ELENA
594    //    //
595    
# Line 622  void ToFLevel2::GetdEdxPaddle(Int_t notr Line 645  void ToFLevel2::GetdEdxPaddle(Int_t notr
645    if(dEdx[pmtleft]<1000 && dEdx[pmtright]==1000) PadEdx = dEdx[pmtleft];    if(dEdx[pmtleft]<1000 && dEdx[pmtright]==1000) PadEdx = dEdx[pmtleft];
646        
647  };  };
 //  
   
648    
649  // gf Apr 07  // gf Apr 07
650    
# Line 639  TString ToFLevel2::GetPMTName(Int_t ind, Line 660  TString ToFLevel2::GetPMTName(Int_t ind,
660        
661    TString pmtname = " ";    TString pmtname = " ";
662        
663    TString photoS[48] = {    static const TString photoS[48] = {
664      "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",
665      "S11_4B",      "S11_4B",
666      "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",
# Line 1099  Int_t ToFLevel2::GetNPaddle(Int_t plane) Line 1120  Int_t ToFLevel2::GetNPaddle(Int_t plane)
1120   * @param cut on chi2   * @param cut on chi2
1121   */   */
1122    
 Float_t ToFLevel2::CalcBeta(Int_t notrack, Float_t resmax, Float_t qualitycut, Float_t chi2cut){  
1123    
1124  //  cout<<" in CalcBeta "<<resmax<<" "<<chi2cut<<" "<<qualitycut<<endl;  Float_t ToFTrkVar::CalcBeta( Float_t resmax, Float_t qualitycut, Float_t chi2cut){
1125    
1126    
1127    Float_t bxx = 100.;    Float_t bxx = 100.;
1128    //    //
1129    ToFTrkVar *trk = GetToFTrkVar(notrack);    ToFTrkVar *trk = this;
   if(!trk) return 0; //ELENA  
1130    
1131    
1132    Float_t chi2,xhelp,beta_mean;    Float_t chi2,xhelp,beta_mean;
# Line 1133  Float_t  w_il[6]; Line 1153  Float_t  w_il[6];
1153    for (Int_t i=0; i<trk->npmttdc; i++){    for (Int_t i=0; i<trk->npmttdc; i++){
1154      //      //
1155      pmt_id = (trk->pmttdc).At(i);      pmt_id = (trk->pmttdc).At(i);
1156      pmt_plane = GetPlaneIndex(pmt_id);      pmt_plane = ToFLevel2::GetPlaneIndex(pmt_id);
1157      tdcfl = (trk->tdcflag).At(i);      tdcfl = (trk->tdcflag).At(i);
1158      if (w_il[pmt_plane] != 1.) w_il[pmt_plane] = tdcfl; //tdcflag      if (w_il[pmt_plane] != 1.) w_il[pmt_plane] = tdcfl; //tdcflag
1159                                       };                                       };
# Line 1220  Int_t ibot[12] = {4,5,4,5,4,5,4,5,2,3,2, Line 1240  Int_t ibot[12] = {4,5,4,5,4,5,4,5,2,3,2,
1240    //    //
1241    return(bxx);    return(bxx);
1242  };  };
1243    ////////////////////////////////////////////////////
1244    ////////////////////////////////////////////////////
1245    /**
1246     * See ToFTrkVar::CalcBeta(Float_t,Float_t, Float_t).
1247     * @param notrack Track Number (arry index, ranging from 0 to ntrk())
1248     */
1249    Float_t ToFLevel2::CalcBeta(Int_t notrack, Float_t resmax, Float_t qualitycut, Float_t chi2cut){
1250    
1251    //  cout<<" in CalcBeta "<<resmax<<" "<<chi2cut<<" "<<qualitycut<<endl;
1252    
1253      ToFTrkVar *trk = GetToFTrkVar(notrack);
1254    //    ToFTrkVar *trk = GetToFStoredTrack(seqno);//Elena Apr 2015
1255      if(!trk) return 0; //ELENA
1256    
1257      return trk->CalcBeta(resmax,qualitycut,chi2cut);
1258    
1259    };
1260    
1261    
1262  ////////////////////////////////////////////////////  ////////////////////////////////////////////////////
# Line 1309  Int_t ToFLevel2::Process(TrkLevel2 *trk, Line 1346  Int_t ToFLevel2::Process(TrkLevel2 *trk,
1346  //   if ( !dbc->IsConnected() ) return 1;  //   if ( !dbc->IsConnected() ) return 1;
1347  //   stringstream myquery;  //   stringstream myquery;
1348  //   myquery.str("");  //   myquery.str("");
1349  //   myquery << "SET time_zone='+0:00'";  //   myquery << "SET time_zone='+0:00';";
1350  //   dbc->Query(myquery.str().c_str());  //   dbc->Query(myquery.str().c_str());
1351    //   delete dbc->Query("SET sql_mode = 'NO_UNSIGNED_SUBTRACTION';");
1352  //   GL_PARAM *glparam = new GL_PARAM();  //   GL_PARAM *glparam = new GL_PARAM();
1353  //   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
1354  //   trk->LoadField(glparam->PATH+glparam->NAME);  //   trk->LoadField(glparam->PATH+glparam->NAME);
# Line 1784  void ToFdEdx::Init(pamela::tof::TofEvent Line 1822  void ToFdEdx::Init(pamela::tof::TofEvent
1822      for (Int_t hh=0; hh<12;hh++){      for (Int_t hh=0; hh<12;hh++){
1823        //          tofinput_.tdc[hh][gg]=tofEvent->tdc[gg][hh];                  //          tofinput_.tdc[hh][gg]=tofEvent->tdc[gg][hh];          
1824        int mm = tf.GetPMTid(gg,hh);                int mm = tf.GetPMTid(gg,hh);        
1825        adc[mm]=tofl0->adc[gg][hh];        adc[mm]= (0xFFF & tofl0->adc[gg][hh]); // EM, exclude warning bits
1826      };            };      
1827    };    };
1828        
# Line 1899  void ToFdEdx::Process(UInt_t atime, Floa Line 1937  void ToFdEdx::Process(UInt_t atime, Floa
1937      //    printf(" e qui? \n");      //    printf(" e qui? \n");
1938      //---------------------------------------------------- Z reconstruction      //---------------------------------------------------- Z reconstruction
1939    
1940      double adcHe, adcnorm, adclin, dEdx, Zeta;      double adcHe, adcnorm, adclin, dEdx;//, Zeta; // EM GCC4.7
1941    
1942      adcHe=-2;      adcHe=-2;
1943      adcnorm=-2;      adcnorm=-2;
1944      adclin=-2;      adclin=-2;
1945      dEdx=-2;      dEdx=-2;
1946      Zeta=-2;      //    Zeta=-2;//EM GCC4.7
1947      Double_t correction = 1.;      Double_t correction = 1.;
1948    
1949      if(Aconn==1 && (ii==0 || ii==20 || ii==22 || ii==24)){      if(Aconn==1 && (ii==0 || ii==20 || ii==22 || ii==24)){

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.48

  ViewVC Help
Powered by ViewVC 1.1.23