/[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.32 by mocchiut, Mon Oct 25 13:22:11 2010 UTC revision 1.45 by pam-fi, Tue Mar 24 11:09:54 2015 UTC
# Line 21  ToFPMT::ToFPMT(){ Line 21  ToFPMT::ToFPMT(){
21    adc = 0.;    adc = 0.;
22    tdc_tw = 0.;    tdc_tw = 0.;
23    tdc = 0.;    tdc = 0.;
24      l0flag_adc = 0.;
25      l0flag_tdc = 0.;
26  }  }
27    
28  ToFPMT::ToFPMT(const ToFPMT &t){  ToFPMT::ToFPMT(const ToFPMT &t){
# Line 111  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 118  void ToFLevel2::Clear(Option_t *t){ Line 130  void ToFLevel2::Clear(Option_t *t){
130    if(PMT)PMT->Delete(); //ELENA    if(PMT)PMT->Delete(); //ELENA
131    memset(tof_j_flag, 0, 6*sizeof(Int_t));    memset(tof_j_flag, 0, 6*sizeof(Int_t));
132    unpackError = 0;    unpackError = 0;
133      unpackWarning = 0;
134    //    //
135  };  };
136    
# Line 148  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 211  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 221  Int_t ToFLevel2::GetNHitPaddles(Int_t pl Line 265  Int_t ToFLevel2::GetNHitPaddles(Int_t pl
265      return npad;      return npad;
266  };  };
267    
268    /**
269     * 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).
273     */
274    Int_t ToFLevel2::GetTrueNHitPaddles(Int_t plane){
275        Int_t npad=0;
276        TClonesArray* Pmt = this->PMT;
277        int paddle[24];
278        memset(paddle,0, 24*sizeof(int));
279        for(int i=0; i<Pmt->GetEntries(); i++) {  //loop per vedere quale TOF è colpito
280          ToFPMT* pmthit = (ToFPMT*)Pmt->At(i);
281          int pplane = -1;
282          int ppaddle = -1;
283          GetPMTPaddle(pmthit->pmt_id,pplane,ppaddle);
284          if ( pplane == plane ) paddle[ppaddle]++;
285        }
286        for(int i=0;i<24;i++) if ( paddle[i]>0 ) npad++;
287    
288        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
# Line 236  Int_t ToFLevel2::GetNHitPaddles(Int_t pl Line 304  Int_t ToFLevel2::GetNHitPaddles(Int_t pl
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(Int_t notrack, Int_t plane, Int_t adcfl){  Float_t ToFLevel2::GetdEdx(Int_t notrack, Int_t plane, Int_t adcfl){
307      ToFTrkVar *trk = GetToFTrkVar(notrack);
308      return this->GetdEdx(trk, plane, adcfl);
309    }
310    
311    //new, wm Feb 15
312    //wm Nov 08
313    //gf Apr 07
314    /**
315     * Method to get the mean dEdx from a ToF layer
316     * By definition there should be PMTs with dEdx values only in one paddle of a layer
317     * (the paddle hitted by the track), this method looks for the hitted paddle
318     * and gives the mean dEdx of that paddle as the output
319     * 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
321     * definition= 1 mip and not a real measurement), anyway left in the code
322     * @param trk Pointer to TofTrkVar object
323     * @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; )
325     */
326    Float_t ToFLevel2::GetdEdx(ToFTrkVar *trk, Int_t plane, Int_t adcfl){
327      
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    for (Int_t ii=0; ii<GetNPaddle(plane); ii++){    // ToF standalone part
     Int_t paddleid=ii;  
     pad = GetPaddleid(plane,paddleid);  
     GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning);  
     dedx += PadEdx;  
   };  
336    //    //
337      if ( trk->trkseqno == -1 ){
338        
339        //    ToFTrkVar *t_tof = trk;
340        
341        // Find the hitted paddle  (two good TDC values) using the tof_j_flag (from tofl2com.for)
342        
343        Int_t Ipaddle=-1;
344        // 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        
347        Ipaddle =  (Int_t)log2(this->tof_j_flag[plane]) ;
348        
349        // Get the dEdx of this paddle using "GetdEdxPaddle"
350        if (Ipaddle>-1) {
351          Int_t pad = GetPaddleid(plane,Ipaddle);
352          GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning);
353          dedx = PadEdx;
354        }
355        
356        // If there was no correct hitted paddle, but there was one (and only one) paddle with some
357        // PMT entries in the PMT-class (found with "GetTrueNHitPaddles", use the dEdx of this paddle
358        
359        if ((Ipaddle<0) && (GetTrueNHitPaddles(plane)==1)) {
360          // find the paddle by looping over the paddles in each layer
361          // since GetTrueNHitPaddles==1 this is OK
362          for (Int_t ii=0; ii<GetNPaddle(plane); ii++){
363            Int_t paddleid=ii;
364            Int_t pad = GetPaddleid(plane,paddleid);
365            GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning);
366            dedx += PadEdx;
367          }
368        }
369      } 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++){
373          Int_t paddleid=ii;
374          pad = GetPaddleid(plane,paddleid);
375          GetdEdxPaddle(trk, pad, adcfl, PadEdx, SatWarning);
376          dedx += PadEdx;
377        }
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 328  Int_t ToFLevel2::GetPlaneIndex(Int_t pmt Line 453  Int_t ToFLevel2::GetPlaneIndex(Int_t pmt
453   */   */
454  Int_t ToFLevel2::GetPMTid(Int_t hh, Int_t kk){  Int_t ToFLevel2::GetPMTid(Int_t hh, Int_t kk){
455    //    //
456    short tof[4][24] = {    static const short tof[4][24] = {
457      {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},
458      {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},
459      {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 364  Int_t ToFLevel2::GetPMTid(Int_t hh, Int_ Line 489  Int_t ToFLevel2::GetPMTid(Int_t hh, Int_
489   */   */
490  void ToFLevel2::GetPMTIndex(Int_t ind, Int_t &hb, Int_t &ch){  void ToFLevel2::GetPMTIndex(Int_t ind, Int_t &hb, Int_t &ch){
491    //    //
492    short tof[4][24] = {    static const short tof[4][24] = {
493      {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},
494      {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},
495      {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 404  void ToFLevel2::GetPMTIndex(Int_t ind, I Line 529  void ToFLevel2::GetPMTIndex(Int_t ind, I
529   */   */
530  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){
531    
532  /*    ToFTrkVar *trk = GetToFTrkVar(notrack);
533  Float_t  PMTsat[48] = {    this->GetdEdxPaddle(trk, paddleid, adcfl, PadEdx, SatWarning);
534  3162.14, 3165.48, 3153.85, 3085.73, 3089.65, 3107.64, 3097.52, 3078.37,    
535  3130.05, 3087.07, 3112.22, 3102.92, 3080.58, 3092.55, 3087.94, 3125.03,  };
536  3094.09, 3143.16, 3125.51, 3181.27, 3092.09, 3124.98, 3069.3, 3095.53,  
537  3097.11, 3133.53, 3114.73, 3113.01, 3091.19, 3097.99, 3033.84, 3134.98,  //
538  3081.37, 3111.04, 3066.77, 3108.17, 3133, 3111.06, 3052.52, 3140.66,  //  wm Nov 08 revision - saturation values included
539  3106.33, 3094.85, 3150.85, 3118.8, 3096.24, 3118.47,3111.36, 3117.11 } ;  /// gf Apr 07
540  */  /**
541     * Method to get the dEdx from a given ToF paddle.
542  // new values from Napoli dec 2008   * If two PMTs are good, the mean dEdx of both PMTs is taken, otherwise
543  Float_t  PMTsat[48] = {   * just the dEdx of the "good" PMT. If both PMTs are above saturation => dEdx=1000
544  3176.35,3178.19,3167.38,3099.73,3117.00,3126.29,3111.44,3092.27,   * @param notrack Track Number
545  3146.48,3094.41,3132.13,3115.37,3099.32,3110.97,3111.80,3143.14,   * @param Paddle index (0,1,...,23).
546  3106.72,3153.44,3136.00,3188.96,3104.73,3140.45,3073.18,3106.62,   * @param adcflag in the paddle (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; )
547  3112.48,3146.92,3127.24,3136.52,3109.59,3112.89,3045.15,3147.26,   * @param PadEdx dEdx from a given ToF paddle
548  3095.92,3121.05,3083.25,3123.62,3150.92,3125.30,3067.60,3160.18,   * @param SatWarning 1 if the PMT ios near saturation region (adcraw ~3000)
549  3119.36,3108.92,3164.77,3133.64,3111.47,3131.98,3128.87,3135.56 };   */
550    void ToFLevel2::GetdEdxPaddle(ToFTrkVar *trk, Int_t paddleid, Int_t adcfl, Float_t &PadEdx, Int_t &SatWarning){
551    
552      /*
553        Float_t  PMTsat[48] = {
554        3162.14, 3165.48, 3153.85, 3085.73, 3089.65, 3107.64, 3097.52, 3078.37,
555        3130.05, 3087.07, 3112.22, 3102.92, 3080.58, 3092.55, 3087.94, 3125.03,
556        3094.09, 3143.16, 3125.51, 3181.27, 3092.09, 3124.98, 3069.3, 3095.53,
557        3097.11, 3133.53, 3114.73, 3113.01, 3091.19, 3097.99, 3033.84, 3134.98,
558        3081.37, 3111.04, 3066.77, 3108.17, 3133, 3111.06, 3052.52, 3140.66,
559        3106.33, 3094.85, 3150.85, 3118.8, 3096.24, 3118.47,3111.36, 3117.11 } ;
560      */
561    
562      // new values from Napoli dec 2008
563      Float_t  PMTsat[48] = {
564        3176.35,3178.19,3167.38,3099.73,3117.00,3126.29,3111.44,3092.27,
565        3146.48,3094.41,3132.13,3115.37,3099.32,3110.97,3111.80,3143.14,
566        3106.72,3153.44,3136.00,3188.96,3104.73,3140.45,3073.18,3106.62,
567        3112.48,3146.92,3127.24,3136.52,3109.59,3112.89,3045.15,3147.26,
568        3095.92,3121.05,3083.25,3123.62,3150.92,3125.30,3067.60,3160.18,
569        3119.36,3108.92,3164.77,3133.64,3111.47,3131.98,3128.87,3135.56 };
570    
571  for (Int_t i=0; i<48;i++) PMTsat[i] = PMTsat[i] - 5.;  // safety margin    for (Int_t i=0; i<48;i++) PMTsat[i] = PMTsat[i] - 5.;  // safety margin
572    
573    
574    PadEdx = 0.;    PadEdx = 0.;
575  //  SatWarning = 1000;    //  SatWarning = 1000;
576    SatWarning = 0;   // 0=good, increase for each bad PMT    SatWarning = 0;   // 0=good, increase for each bad PMT
577    
578    Float_t dEdx[48] = {0};    Float_t dEdx[48] = {0};
579    Int_t pmt_id = -1;    Int_t pmt_id = -1;
580    Float_t adcraw[48];    Float_t adcraw[48];
581    //    //
   ToFTrkVar *trk = GetToFTrkVar(notrack);  
582    if(!trk) return; //ELENA    if(!trk) return; //ELENA
583    //    //
584    
# Line 474  for (Int_t i=0; i<48;i++) PMTsat[i] = PM Line 618  for (Int_t i=0; i<48;i++) PMTsat[i] = PM
618    }    }
619    
620    
621  //  if( adcraw[pmtleft] >3000 || adcraw[pmtright] >3000)SatWarning=1;  //old version    //  if( adcraw[pmtleft] >3000 || adcraw[pmtright] >3000)SatWarning=1;  //old version
622    
623  // Increase SatWarning Counter for each PMT>Sat    // Increase SatWarning Counter for each PMT>Sat
624    if( adcraw[pmtleft] > PMTsat[pmtleft])SatWarning++;      if( adcraw[pmtleft] > PMTsat[pmtleft])SatWarning++;  
625    if( adcraw[pmtright] > PMTsat[pmtright])SatWarning++;    if( adcraw[pmtright] > PMTsat[pmtright])SatWarning++;
626    
627  // if ADC  > sat set dEdx=1000    // if ADC  > sat set dEdx=1000
628    if( adcraw[pmtleft] > PMTsat[pmtleft]) dEdx[pmtleft] = 1000.;    if( adcraw[pmtleft] > PMTsat[pmtleft]) dEdx[pmtleft] = 1000.;
629    if( adcraw[pmtright] > PMTsat[pmtright]) dEdx[pmtright] = 1000. ;    if( adcraw[pmtright] > PMTsat[pmtright]) dEdx[pmtright] = 1000. ;
630    
631  // if two PMT are good, take mean dEdx, otherwise only the good dEdx    // if two PMT are good, take mean dEdx, otherwise only the good dEdx
632    if(dEdx[pmtleft]<1000 && dEdx[pmtright]<1000) PadEdx = (dEdx[pmtleft]+dEdx[pmtright])*0.5;    if(dEdx[pmtleft]<1000 && dEdx[pmtright]<1000) PadEdx = (dEdx[pmtleft]+dEdx[pmtright])*0.5;
633    if(dEdx[pmtleft]==1000 && dEdx[pmtright]<1000) PadEdx = dEdx[pmtright];      if(dEdx[pmtleft]==1000 && dEdx[pmtright]<1000) PadEdx = dEdx[pmtright];  
634    if(dEdx[pmtleft]<1000 && dEdx[pmtright]==1000) PadEdx = dEdx[pmtleft];    if(dEdx[pmtleft]<1000 && dEdx[pmtright]==1000) PadEdx = dEdx[pmtleft];
635        
636  };  };
 //  
   
637    
638  // gf Apr 07  // gf Apr 07
639    
# Line 507  TString ToFLevel2::GetPMTName(Int_t ind, Line 649  TString ToFLevel2::GetPMTName(Int_t ind,
649        
650    TString pmtname = " ";    TString pmtname = " ";
651        
652    TString photoS[48] = {    static const TString photoS[48] = {
653      "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",
654      "S11_4B",      "S11_4B",
655      "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 967  Int_t ToFLevel2::GetNPaddle(Int_t plane) Line 1109  Int_t ToFLevel2::GetNPaddle(Int_t plane)
1109   * @param cut on chi2   * @param cut on chi2
1110   */   */
1111    
 Float_t ToFLevel2::CalcBeta(Int_t notrack, Float_t resmax, Float_t qualitycut, Float_t chi2cut){  
1112    
1113  //  cout<<" in CalcBeta "<<resmax<<" "<<chi2cut<<" "<<qualitycut<<endl;  Float_t ToFTrkVar::CalcBeta( Float_t resmax, Float_t qualitycut, Float_t chi2cut){
1114    
1115    
1116    Float_t bxx = 100.;    Float_t bxx = 100.;
1117    //    //
1118    ToFTrkVar *trk = GetToFTrkVar(notrack);    ToFTrkVar *trk = this;
   if(!trk) return 0; //ELENA  
1119    
1120    
1121    Float_t chi2,xhelp,beta_mean;    Float_t chi2,xhelp,beta_mean;
# Line 1001  Float_t  w_il[6]; Line 1142  Float_t  w_il[6];
1142    for (Int_t i=0; i<trk->npmttdc; i++){    for (Int_t i=0; i<trk->npmttdc; i++){
1143      //      //
1144      pmt_id = (trk->pmttdc).At(i);      pmt_id = (trk->pmttdc).At(i);
1145      pmt_plane = GetPlaneIndex(pmt_id);      pmt_plane = ToFLevel2::GetPlaneIndex(pmt_id);
1146      tdcfl = (trk->tdcflag).At(i);      tdcfl = (trk->tdcflag).At(i);
1147      if (w_il[pmt_plane] != 1.) w_il[pmt_plane] = tdcfl; //tdcflag      if (w_il[pmt_plane] != 1.) w_il[pmt_plane] = tdcfl; //tdcflag
1148                                       };                                       };
# Line 1088  Int_t ibot[12] = {4,5,4,5,4,5,4,5,2,3,2, Line 1229  Int_t ibot[12] = {4,5,4,5,4,5,4,5,2,3,2,
1229    //    //
1230    return(bxx);    return(bxx);
1231  };  };
1232    ////////////////////////////////////////////////////
1233    ////////////////////////////////////////////////////
1234    /**
1235     * See ToFTrkVar::CalcBeta(Float_t,Float_t, Float_t).
1236     */
1237    Float_t ToFLevel2::CalcBeta(Int_t notrack, Float_t resmax, Float_t qualitycut, Float_t chi2cut){
1238    
1239    //  cout<<" in CalcBeta "<<resmax<<" "<<chi2cut<<" "<<qualitycut<<endl;
1240    
1241      ToFTrkVar *trk = GetToFTrkVar(notrack);
1242      if(!trk) return 0; //ELENA
1243    
1244      return trk->CalcBeta(resmax,qualitycut,chi2cut);
1245    
1246    };
1247    
1248    
1249  ////////////////////////////////////////////////////  ////////////////////////////////////////////////////
# Line 1177  Int_t ToFLevel2::Process(TrkLevel2 *trk, Line 1333  Int_t ToFLevel2::Process(TrkLevel2 *trk,
1333  //   if ( !dbc->IsConnected() ) return 1;  //   if ( !dbc->IsConnected() ) return 1;
1334  //   stringstream myquery;  //   stringstream myquery;
1335  //   myquery.str("");  //   myquery.str("");
1336  //   myquery << "SET time_zone='+0:00'";  //   myquery << "SET time_zone='+0:00';";
1337  //   dbc->Query(myquery.str().c_str());  //   dbc->Query(myquery.str().c_str());
1338    //   delete dbc->Query("SET sql_mode = 'NO_UNSIGNED_SUBTRACTION';");
1339  //   GL_PARAM *glparam = new GL_PARAM();  //   GL_PARAM *glparam = new GL_PARAM();
1340  //   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
1341  //   trk->LoadField(glparam->PATH+glparam->NAME);  //   trk->LoadField(glparam->PATH+glparam->NAME);
# Line 1416  Int_t ToFLevel2::Process(TrkLevel2 *trk, Line 1573  Int_t ToFLevel2::Process(TrkLevel2 *trk,
1573  //  return(0);  //  return(0);
1574  }  }
1575    
1576    bool ToFLevel2::bit(int decimal, char pos){
1577      return( (decimal>>pos)%2 );
1578    }
1579    
1580    bool ToFLevel2::checkPMT(TString givenpmt){
1581      TClonesArray* Pmt = this->PMT;
1582      //  printf(" ou %s entries %i \n",givenpmt.Data(),Pmt->GetEntries());
1583      for(int i=0; i<Pmt->GetEntries(); i++) {  
1584        ToFPMT* pmthit = (ToFPMT*)Pmt->At(i);
1585        TString pmtname = this->GetPMTName(pmthit->pmt_id);
1586        //    printf(" name %s \n",pmtname.Data());
1587        if ( !strcmp(pmtname.Data(),givenpmt.Data()) )
1588          return true;
1589      }
1590      //  printf(" PMT %s missing \n",givenpmt.Data());
1591      return false;
1592    }
1593    
1594    bool ToFLevel2::checkPMTpatternPMThit(TrigLevel2 *trg, int &pmtpattern, int &pmtnosignal){
1595      UInt_t *patterntrig = trg->patterntrig;
1596      pmtpattern = 0;
1597      pmtnosignal = 0;
1598      bool good = true;
1599      //S3
1600      if ( this->bit(patterntrig[2],0) ){ pmtpattern++;  if ( !this->checkPMT("S31_1A")){ pmtnosignal++; good = false;}}
1601      if ( this->bit(patterntrig[2],1) ){ pmtpattern++;  if ( !this->checkPMT("S31_2A")){ pmtnosignal++; good = false;}}
1602      if ( this->bit(patterntrig[2],2) ){ pmtpattern++;  if ( !this->checkPMT("S31_3A")){ pmtnosignal++; good = false;}}
1603      if ( this->bit(patterntrig[2],3) ){ pmtpattern++;  if ( !this->checkPMT("S31_1B")){ pmtnosignal++; good = false;}}
1604      if ( this->bit(patterntrig[2],4) ){ pmtpattern++;  if ( !this->checkPMT("S31_2B")){ pmtnosignal++; good = false;}}
1605      if ( this->bit(patterntrig[2],5) ){ pmtpattern++;  if ( !this->checkPMT("S31_3B")){ pmtnosignal++; good = false;}}      
1606      if ( this->bit(patterntrig[2],6) ){ pmtpattern++;  if ( !this->checkPMT("S32_1A")){ pmtnosignal++; good = false;}}
1607      if ( this->bit(patterntrig[2],7) ){ pmtpattern++;  if ( !this->checkPMT("S32_2A")){ pmtnosignal++; good = false;}}
1608      if ( this->bit(patterntrig[2],8) ){ pmtpattern++;  if ( !this->checkPMT("S32_3A")){ pmtnosignal++; good = false;}}
1609      if ( this->bit(patterntrig[2],9) ){ pmtpattern++;  if ( !this->checkPMT("S32_1B")){ pmtnosignal++; good = false;}}
1610      if ( this->bit(patterntrig[2],10) ){ pmtpattern++;  if ( !this->checkPMT("S32_2B")){ pmtnosignal++; good = false;}}
1611      if ( this->bit(patterntrig[2],11) ){ pmtpattern++;  if ( !this->checkPMT("S32_3B")){ pmtnosignal++; good = false;}}      
1612      //S2
1613      if ( this->bit(patterntrig[3],0) ){ pmtpattern++;  if ( !this->checkPMT("S21_1A")){ pmtnosignal++; good = false;}}
1614      if ( this->bit(patterntrig[3],1) ){ pmtpattern++;  if ( !this->checkPMT("S21_2A")){ pmtnosignal++; good = false;}}
1615      if ( this->bit(patterntrig[3],2) ){ pmtpattern++;  if ( !this->checkPMT("S21_1B")){ pmtnosignal++; good = false;}}
1616      if ( this->bit(patterntrig[3],3) ){ pmtpattern++;  if ( !this->checkPMT("S21_2B")){ pmtnosignal++; good = false;}}      
1617      if ( this->bit(patterntrig[3],4) ){ pmtpattern++;  if ( !this->checkPMT("S22_1A")){ pmtnosignal++; good = false;}}
1618      if ( this->bit(patterntrig[3],5) ){ pmtpattern++;  if ( !this->checkPMT("S22_2A")){ pmtnosignal++; good = false;}}
1619      if ( this->bit(patterntrig[3],6) ){ pmtpattern++;  if ( !this->checkPMT("S22_1B")){ pmtnosignal++; good = false;}}
1620      if ( this->bit(patterntrig[3],7) ){ pmtpattern++;  if ( !this->checkPMT("S22_2B")){ pmtnosignal++; good = false;}}      
1621      //S12
1622      if ( this->bit(patterntrig[4],0) ){ pmtpattern++;  if ( !this->checkPMT("S12_1A")){ pmtnosignal++; good = false;}}
1623      if ( this->bit(patterntrig[4],1) ){ pmtpattern++;  if ( !this->checkPMT("S12_2A")){ pmtnosignal++; good = false;}}
1624      if ( this->bit(patterntrig[4],2) ){ pmtpattern++;  if ( !this->checkPMT("S12_3A")){ pmtnosignal++; good = false;}}
1625      if ( this->bit(patterntrig[4],3) ){ pmtpattern++;  if ( !this->checkPMT("S12_4A")){ pmtnosignal++; good = false;}}
1626      if ( this->bit(patterntrig[4],4) ){ pmtpattern++;  if ( !this->checkPMT("S12_5A")){ pmtnosignal++; good = false;}}
1627      if ( this->bit(patterntrig[4],5) ){ pmtpattern++;  if ( !this->checkPMT("S12_6A")){ pmtnosignal++; good = false;}}      
1628      if ( this->bit(patterntrig[4],6) ){ pmtpattern++;  if ( !this->checkPMT("S12_1A")){ pmtnosignal++; good = false;}}
1629      if ( this->bit(patterntrig[4],7) ){ pmtpattern++;  if ( !this->checkPMT("S12_2A")){ pmtnosignal++; good = false;}}
1630      if ( this->bit(patterntrig[4],8) ){ pmtpattern++;  if ( !this->checkPMT("S12_3A")){ pmtnosignal++; good = false;}}
1631      if ( this->bit(patterntrig[4],9) ){ pmtpattern++;  if ( !this->checkPMT("S12_4B")){ pmtnosignal++; good = false;}}
1632      if ( this->bit(patterntrig[4],10) ){ pmtpattern++; if ( !this->checkPMT("S12_5B")){ pmtnosignal++; good = false;}}
1633      if ( this->bit(patterntrig[4],11) ){ pmtpattern++; if ( !this->checkPMT("S12_6B")){ pmtnosignal++; good = false;}}      
1634      //S11
1635      if ( this->bit(patterntrig[5],0) ){ pmtpattern++;  if ( !this->checkPMT("S11_1A")){ pmtnosignal++; good = false;}}
1636      if ( this->bit(patterntrig[5],1) ){ pmtpattern++;  if ( !this->checkPMT("S11_2A")){ pmtnosignal++; good = false;}}
1637      if ( this->bit(patterntrig[5],2) ){ pmtpattern++;  if ( !this->checkPMT("S11_3A")){ pmtnosignal++; good = false;}}
1638      if ( this->bit(patterntrig[5],3) ){ pmtpattern++;  if ( !this->checkPMT("S11_4A")){ pmtnosignal++; good = false;}}
1639      if ( this->bit(patterntrig[5],4) ){ pmtpattern++;  if ( !this->checkPMT("S11_5A")){ pmtnosignal++; good = false;}}
1640      if ( this->bit(patterntrig[5],5) ){ pmtpattern++;  if ( !this->checkPMT("S11_6A")){ pmtnosignal++; good = false;}}
1641      if ( this->bit(patterntrig[5],6) ){ pmtpattern++;  if ( !this->checkPMT("S11_7A")){ pmtnosignal++; good = false;}}
1642      if ( this->bit(patterntrig[5],7) ){ pmtpattern++;  if ( !this->checkPMT("S11_8A")){ pmtnosignal++; good = false;}}      
1643      if ( this->bit(patterntrig[5],8) ){ pmtpattern++;  if ( !this->checkPMT("S11_1B")){ pmtnosignal++; good = false;}}
1644      if ( this->bit(patterntrig[5],9) ){ pmtpattern++;  if ( !this->checkPMT("S11_2B")){ pmtnosignal++; good = false;}}
1645      if ( this->bit(patterntrig[5],10) ){ pmtpattern++; if ( !this->checkPMT("S11_3B")){ pmtnosignal++; good = false;}}
1646      if ( this->bit(patterntrig[5],11) ){ pmtpattern++; if ( !this->checkPMT("S11_4B")){ pmtnosignal++; good = false;}}
1647      if ( this->bit(patterntrig[5],12) ){ pmtpattern++; if ( !this->checkPMT("S11_5B")){ pmtnosignal++; good = false;}}
1648      if ( this->bit(patterntrig[5],13) ){ pmtpattern++; if ( !this->checkPMT("S11_6B")){ pmtnosignal++; good = false;}}
1649      if ( this->bit(patterntrig[5],14) ){ pmtpattern++; if ( !this->checkPMT("S11_7B")){ pmtnosignal++; good = false;}}
1650      if ( this->bit(patterntrig[5],15) ){ pmtpattern++; if ( !this->checkPMT("S11_8B")){ pmtnosignal++; good = false;}}
1651    
1652      return good;
1653    }
1654    
1655    bool ToFLevel2::checkPMTpmttrig(TrigLevel2 *trg){
1656      //  UInt_t *patterntrig = trg->patterntrig;
1657      int rS11 = 0;
1658      int rS12 = 0;
1659      int rS21 = 0;
1660      int rS22 = 0;
1661      int rS31 = 0;
1662      int rS32 = 0;
1663    
1664      // trigger configuration for the event from saved pmts
1665      TClonesArray* Pmt = this->PMT;
1666      for(int i=0; i<Pmt->GetEntries(); i++) {  
1667        ToFPMT* pmthit = (ToFPMT*)Pmt->At(i);
1668        TString pmtname = this->GetPMTName(pmthit->pmt_id);
1669        if ( pmtname.Contains("S11") ) rS11++;
1670        if ( pmtname.Contains("S12") ) rS12++;
1671        if ( pmtname.Contains("S21") ) rS21++;
1672        if ( pmtname.Contains("S22") ) rS22++;
1673        if ( pmtname.Contains("S31") ) rS31++;
1674        if ( pmtname.Contains("S32") ) rS32++;
1675      }
1676      int rTOF1 = (rS11 + rS12) * (rS21 + rS22) * (rS31 + rS32);
1677      int rTOF2 = (rS11 * rS12) * (rS21 * rS22) * (rS31 * rS32);
1678    
1679      int rTOF3 = (rS21 + rS22) * (rS31 + rS32);
1680      int rTOF4 = (rS21 * rS22) * (rS31 * rS32);
1681    
1682      int rTOF5 = rS12 * (rS21 * rS22);
1683    
1684      int rTOF6 = (rS11 + rS12) * (rS31 + rS32);
1685      int rTOF7 = (rS11 * rS12) * (rS31 * rS32);
1686    
1687    
1688      // trigger configuration of the run
1689      bool TCTOF1 = false;
1690      bool TCTOF2 = false;
1691      bool TCTOF3 = false;
1692      bool TCTOF4 = false;
1693      bool TCTOF5 = false;
1694      bool TCTOF6 = false;
1695      bool TCTOF7 = false;
1696      if ( trg->trigconf & (1<<0) ) TCTOF1 = true;
1697      if ( trg->trigconf & (1<<1) ) TCTOF2 = true;
1698      if ( trg->trigconf & (1<<2) ) TCTOF3 = true;
1699      if ( trg->trigconf & (1<<3) ) TCTOF4 = true;
1700      if ( trg->trigconf & (1<<4) ) TCTOF5 = true;
1701      if ( trg->trigconf & (1<<5) ) TCTOF6 = true;
1702      if ( trg->trigconf & (1<<6) ) TCTOF7 = true;
1703    
1704      // do patterntrig pmts match the trigger configuration?
1705      bool pmtsconf_trigconf_match = true;
1706      if ( rTOF1 == 0 && TCTOF1 ) pmtsconf_trigconf_match = false;
1707      if ( rTOF2 == 0 && TCTOF2 ) pmtsconf_trigconf_match = false;
1708      if ( rTOF3 == 0 && TCTOF3 ) pmtsconf_trigconf_match = false;
1709      if ( rTOF4 == 0 && TCTOF4 ) pmtsconf_trigconf_match = false;
1710      if ( rTOF5 == 0 && TCTOF5 ) pmtsconf_trigconf_match = false;
1711      if ( rTOF6 == 0 && TCTOF6 ) pmtsconf_trigconf_match = false;
1712      if ( rTOF7 == 0 && TCTOF7 ) pmtsconf_trigconf_match = false;
1713    
1714      return pmtsconf_trigconf_match;
1715    }
1716    
1717    void ToFLevel2::printPMT(){
1718      TClonesArray* Pmt = this->PMT;
1719      for(int i=0; i<Pmt->GetEntries(); i++) {  
1720        ToFPMT* pmthit = (ToFPMT*)Pmt->At(i);
1721        TString pmtname = this->GetPMTName(pmthit->pmt_id);
1722        printf(" PMT hit: %s \n",pmtname.Data());
1723      }
1724    }
1725    
1726    
1727  ToFdEdx::ToFdEdx()  ToFdEdx::ToFdEdx()
1728  {  {
1729    memset(conn,0,12*sizeof(Bool_t));    memset(conn,0,12*sizeof(Bool_t));
1730    memset(ts,0,12*sizeof(UInt_t));    memset(ts,0,12*sizeof(UInt_t));
1731    memset(te,0,12*sizeof(UInt_t));    memset(te,0,12*sizeof(UInt_t));
1732      eDEDXpmt = new TArrayF(48);
1733    Define_PMTsat();    Define_PMTsat();
1734    Clear();    Clear();
1735  }  }
1736    
1737    ToFdEdx::~ToFdEdx(){
1738      Clear();
1739      Delete();
1740    }
1741    
1742    void ToFdEdx::Delete(Option_t *option){
1743      if ( eDEDXpmt ){
1744        eDEDXpmt->Set(0);
1745        if ( eDEDXpmt) delete eDEDXpmt;
1746      }
1747    }
1748    
1749  //------------------------------------------------------------------------  //------------------------------------------------------------------------
1750  void ToFdEdx::CheckConnectors(UInt_t atime, GL_PARAM *glparam, TSQLServer *dbc)  void ToFdEdx::CheckConnectors(UInt_t atime, GL_PARAM *glparam, TSQLServer *dbc)
1751  {  {
# Line 1466  void ToFdEdx::Clear(Option_t *option) Line 1787  void ToFdEdx::Clear(Option_t *option)
1787  {  {
1788    //    //
1789    // Set arrays and initialize structure    // Set arrays and initialize structure
1790    eDEDXpmt.Set(48);    eDEDXpmt.Reset(-1);   // Set array size  and reset structure    //  eDEDXpmt.Set(48);    eDEDXpmt.Reset(-1);   // Set array size  and reset structure
1791      eDEDXpmt->Set(48);    eDEDXpmt->Reset(-1);   // Set array size  and reset structure
1792    //    //
1793  };  };
1794    
# Line 1487  void ToFdEdx::Init(pamela::tof::TofEvent Line 1809  void ToFdEdx::Init(pamela::tof::TofEvent
1809      for (Int_t hh=0; hh<12;hh++){      for (Int_t hh=0; hh<12;hh++){
1810        //          tofinput_.tdc[hh][gg]=tofEvent->tdc[gg][hh];                  //          tofinput_.tdc[hh][gg]=tofEvent->tdc[gg][hh];          
1811        int mm = tf.GetPMTid(gg,hh);                int mm = tf.GetPMTid(gg,hh);        
1812        adc[mm]=tofl0->adc[gg][hh];        adc[mm]= (0xFFF & tofl0->adc[gg][hh]); // EM, exclude warning bits
1813      };            };      
1814    };    };
1815        
# Line 1507  void ToFdEdx::Init(Int_t gg, Int_t hh, F Line 1829  void ToFdEdx::Init(Int_t gg, Int_t hh, F
1829  //------------------------------------------------------------------------  //------------------------------------------------------------------------
1830  void ToFdEdx::Process(UInt_t atime, Float_t betamean, Float_t *xtr_tof, Float_t *ytr_tof, Int_t exitat)  void ToFdEdx::Process(UInt_t atime, Float_t betamean, Float_t *xtr_tof, Float_t *ytr_tof, Int_t exitat)
1831  {  {
1832      bool debug = false;
1833      if ( debug ) printf(" INSIDE TOFDEDX PROCESS \n");
1834    // the parameters should be already initialised by InitPar()    // the parameters should be already initialised by InitPar()
1835      //  printf(" in process \n");
1836    Clear();    Clear();
1837    
1838   // define angle:     // define angle:  
# Line 1522  void ToFdEdx::Process(UInt_t atime, Floa Line 1847  void ToFdEdx::Process(UInt_t atime, Floa
1847      if ( ytr_tof[ii] > 99. ) ytr_tof[ii] = 0.;      if ( ytr_tof[ii] > 99. ) ytr_tof[ii] = 0.;
1848    };    };
1849    //    //
1850        if ( debug ) printf(" theta %f \n",theta);
1851      if ( debug ) printf(" xtr_tof %.1f %.1f %.1f %.1f %.1f %.1f \n",xtr_tof[0],xtr_tof[1],xtr_tof[2],xtr_tof[3],xtr_tof[4],xtr_tof[5]);
1852      if ( debug ) printf(" ytr_tof %.1f %.1f %.1f %.1f %.1f %.1f \n",ytr_tof[0],ytr_tof[1],ytr_tof[2],ytr_tof[3],ytr_tof[4],ytr_tof[5]);
1853    //--------------------- TABLE OF PERIODS WITH HV PROBLEMS ----------------------------    //--------------------- TABLE OF PERIODS WITH HV PROBLEMS ----------------------------
1854        
1855    int Aconn=conn[0];    // PMT 0,20,22,24    int Aconn=conn[0];    // PMT 0,20,22,24
# Line 1540  void ToFdEdx::Process(UInt_t atime, Floa Line 1866  void ToFdEdx::Process(UInt_t atime, Floa
1866    int Nconn=conn[11];    // PMT 36,38,39,41    int Nconn=conn[11];    // PMT 36,38,39,41
1867    if( false ) cout << Gconn << Iconn << Lconn <<endl; // to avoid compilation warnings    if( false ) cout << Gconn << Iconn << Lconn <<endl; // to avoid compilation warnings
1868            
1869      //  printf(" size %i \n",eDEDXpmt.GetSize());
1870    for( int ii=0; ii<48; ii++ ) {    for( int ii=0; ii<48; ii++ ) {
1871      //      //
1872        //    eDEDXpmt.SetAt(-1.,ii);
1873      //    printf(" ii %i beta %f atime %u xtr 1 %f ytr 1 %f adc %f \n",ii,betamean,atime,xtr_tof[0],ytr_tof[0],adc[ii]);      //    printf(" ii %i beta %f atime %u xtr 1 %f ytr 1 %f adc %f \n",ii,betamean,atime,xtr_tof[0],ytr_tof[0],adc[ii]);
1874      //    if( adc[ii] >= PMTsat[ii]-5 )  continue; // EMILIANO      if ( debug ) printf("II %i adc %f \n",ii,adc[ii]);
1875      if( adc[ii] <= 0. )            continue;  
1876        if( adc[ii] >= 4095. ){
1877          //      eDEDXpmt[ii] = 0.;
1878          eDEDXpmt->AddAt(0.,ii);
1879          if ( debug ) printf(" %i adc>4095 \n",ii);
1880          continue; // EMILIANO
1881        };
1882    
1883        if( adc[ii] >= (PMTsat[ii]-5.) && adc[ii] < 4095. ){
1884          eDEDXpmt->AddAt(1000.,ii);
1885          if ( debug ) printf(" %i adc> pmtsat && adc<4095 \n",ii);
1886          continue; // EMILIANO
1887        };
1888    
1889        if( adc[ii] <= 0. ) {
1890          eDEDXpmt->AddAt(1500.,ii);
1891          if ( debug ) printf(" %i adc<=0 \n",ii);
1892          continue;
1893        };
1894      //      //
1895      double adcpC   = f_adcPC( adc[ii] );    // - adc conversion in pC      double adcpC   = f_adcPC( adc[ii] );    // - adc conversion in pC
1896      if ( exitat == 0 ){      if ( exitat == 0 ){
1897        eDEDXpmt[ii]=(Float_t)adcpC;        eDEDXpmt->AddAt((Float_t)adcpC,ii);
1898        continue;        continue;
1899      }      }
1900        //    printf(" e qua? \n");
1901    
1902      double adccorr = adcpC*fabs(cos(theta));          double adccorr = adcpC*fabs(cos(theta));    
1903      if(adccorr<=0.)           continue;      if ( debug ) printf(" adccorr %f \n",adccorr);
1904        if(adccorr<=0.){
1905          if ( debug ) printf(" %i adccorr<=0 \n",ii);
1906          //      eDEDXpmt->AddAt((Float_t)adcpC,ii);//?
1907          continue;
1908        }
1909      if ( exitat == 1 ){      if ( exitat == 1 ){
1910        eDEDXpmt[ii]=(Float_t)adccorr;        eDEDXpmt->AddAt((Float_t)adccorr,ii);
1911        continue;        continue;
1912      }      }
1913        //    printf(" e quo? \n");
1914    
1915      //    int standard=0;      //    int standard=0;
1916      int S115B_ok=0;      int S115B_ok=0;
# Line 1568  void ToFdEdx::Process(UInt_t atime, Floa Line 1921  void ToFdEdx::Process(UInt_t atime, Floa
1921    
1922    
1923      //------------------------------------------------------------------------      //------------------------------------------------------------------------
1924        //    printf(" e qui? \n");
1925      //---------------------------------------------------- Z reconstruction      //---------------------------------------------------- Z reconstruction
1926    
1927      double adcHe, adcnorm, adclin, dEdx, Zeta;      double adcHe, adcnorm, adclin, dEdx;//, Zeta; // EM GCC4.7
1928    
1929      adcHe=-2;      adcHe=-2;
1930      adcnorm=-2;      adcnorm=-2;
1931      adclin=-2;      adclin=-2;
1932      dEdx=-2;      dEdx=-2;
1933      Zeta=-2;      //    Zeta=-2;//EM GCC4.7
1934      Double_t correction = 1.;      Double_t correction = 1.;
1935    
1936      if(Aconn==1 && (ii==0 || ii==20 || ii==22 || ii==24)){      if(Aconn==1 && (ii==0 || ii==20 || ii==22 || ii==24)){
# Line 1612  void ToFdEdx::Process(UInt_t atime, Floa Line 1965  void ToFdEdx::Process(UInt_t atime, Floa
1965      }      }
1966      else correction = 1.;      else correction = 1.;
1967            
1968      if( S115B_break==1 ){      if( ii==9 && S115B_break==1 ){
1969        adcHe   = f_att5B( ytr_tof[0] )/correction;        adcHe   = f_att5B( ytr_tof[0] )/correction;
1970      } else {      } else {
1971        adcHe   = Get_adc_he(ii, xtr_tof, ytr_tof)/correction;        adcHe   = Get_adc_he(ii, xtr_tof, ytr_tof)/correction;
1972      };      };
1973      if(adcHe<=0)   continue;      if(adcHe<=0){
1974          if ( debug ) printf(" %i adcHe<=0 \n",ii);
1975          //      eDEDXpmt->AddAt((Float_t)adccorr,ii); //?
1976          continue;
1977        }
1978      if ( exitat == 2 ){      if ( exitat == 2 ){
1979        if(ii==9 && S115B_break==1)  eDEDXpmt[ii]=36.*(Float_t)adccorr/adcHe;        if(ii==9 && S115B_break==1)  eDEDXpmt->AddAt(36.*(Float_t)adccorr/adcHe,ii);
1980        else  adclin  = 4.*(Float_t)adccorr/adcHe;        else  adclin  = 4.*(Float_t)adccorr/adcHe;
1981        continue;        continue;
1982      }      }
1983    
1984      if(ii==9 && S115B_break==1)  adcnorm = f_pos5B(adccorr);      if(ii==9 && S115B_break==1)  adcnorm = f_pos5B(adccorr);
1985      else adcnorm = f_pos( (parPos[ii]), adccorr);      else adcnorm = f_pos( (parPos[ii]), adccorr);
1986      if(adcnorm<=0) continue;      if(adcnorm<=0){
1987          if ( debug ) printf(" %i adcnorm<=0 \n",ii);
1988          //      eDEDXpmt->AddAt((Float_t)adccorr,ii);//?
1989          continue;
1990        }
1991        if ( debug ) printf(" adcnorm %f \n",adcnorm);
1992    
1993      if(ii==9 && S115B_break==1)  adclin  = 36.*adcnorm/adcHe;      if(ii==9 && S115B_break==1)  adclin  = 36.*adcnorm/adcHe;
1994      else  adclin  = 4.*adcnorm/adcHe;      else  adclin  = 4.*adcnorm/adcHe;
1995      if(adclin<=0)  continue;      if ( debug ) printf(" adclin %f \n",adclin);
1996        if(adclin<=0){
1997          if ( debug ) printf(" %i adclin<=0 \n",ii);
1998          //      eDEDXpmt->AddAt((Float_t)adccorr,ii);//?
1999          continue;
2000        }
2001      if ( exitat == 3 ){      if ( exitat == 3 ){
2002        if(ii==9 && S115B_break==1)  eDEDXpmt[ii]=(Float_t)adclin;        if(ii==9 && S115B_break==1)  eDEDXpmt->AddAt((Float_t)adclin,ii);
2003        else  eDEDXpmt[ii]=(Float_t)adclin;        else  eDEDXpmt->AddAt((Float_t)adclin,ii);
2004        continue;        continue;
2005      }      }
2006      //      //
2007      if ( betamean > 99. ){      if ( betamean > 99. ){
2008        //      eDEDXpmt.AddAt((Float_t)adclin,ii);        //      eDEDXpmt.AddAt((Float_t)adclin,ii);
2009        eDEDXpmt[ii]=(Float_t)adclin;        eDEDXpmt->AddAt((Float_t)adclin,ii);
2010        //      printf(" AAPMT IS %i dedx is %f vector is %f \n",ii,adclin,eDEDXpmt[ii]);        //      printf(" AAPMT IS %i dedx is %f vector is %f \n",ii,adclin,eDEDXpmt[ii]);
2011          if ( debug ) printf(" %i betamean > 99 \n",ii);
2012        continue;        continue;
2013      };      };
2014      //      //
# Line 1652  void ToFdEdx::Process(UInt_t atime, Floa Line 2021  void ToFdEdx::Process(UInt_t atime, Floa
2021        else                       dEdxHe = parBBpos[ii];        else                       dEdxHe = parBBpos[ii];
2022      }      }
2023            
2024        if ( debug ) printf(" dEdxHe %f \n",dEdxHe);
2025            
2026      if(dEdxHe<=0){      if(dEdxHe<=0){
2027        eDEDXpmt[ii]=(Float_t)adclin;        eDEDXpmt->AddAt((Float_t)adclin,ii);
2028          if ( debug ) printf(" %i dEdxHe<=0 \n",ii);
2029        continue;        continue;
2030      };      };
2031    
# Line 1662  void ToFdEdx::Process(UInt_t atime, Floa Line 2033  void ToFdEdx::Process(UInt_t atime, Floa
2033      else  dEdx = f_desatBB((parDesatBB[ii]), adclin );      else  dEdx = f_desatBB((parDesatBB[ii]), adclin );
2034    
2035      if(dEdx<=0){      if(dEdx<=0){
2036        eDEDXpmt[ii]=(Float_t)adclin;        eDEDXpmt->AddAt((Float_t)adclin,ii);
2037          if ( debug ) printf(" %i dEdx<=0 \n",ii);
2038        continue;        continue;
2039      };      };
2040    
2041      eDEDXpmt[ii]=(Float_t)dEdx;      if ( debug ) printf(" dEdx %f \n",dEdx);
2042        eDEDXpmt->AddAt((Float_t)dEdx,ii);
2043      //    eDEDXpmt.AddAt((Float_t)dEdx,ii);      //    eDEDXpmt.AddAt((Float_t)dEdx,ii);
2044    
2045      //    printf(" PMT IS %i dedx is %f vector is %f \n",ii,dEdx,eDEDXpmt[ii]);      //    printf(" PMT IS %i dedx is %f vector is %f \n",ii,dEdx,eDEDXpmt[ii]);
# Line 1863  double ToFdEdx::f_desatBB5B( float x ) Line 2236  double ToFdEdx::f_desatBB5B( float x )
2236      0.009*x*x;      0.009*x*x;
2237  }  }
2238    
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.45

  ViewVC Help
Powered by ViewVC 1.1.23