/[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.26 by carbone, Fri Nov 20 11:05:21 2009 UTC revision 1.43 by mocchiut, Thu Feb 26 11:27:35 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 class
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(notrack, 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(notrack, 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(notrack, 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 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  /*    /*
533  Float_t  PMTsat[48] = {      Float_t  PMTsat[48] = {
534  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,
535  3130.05, 3087.07, 3112.22, 3102.92, 3080.58, 3092.55, 3087.94, 3125.03,      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,      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,      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,      3081.37, 3111.04, 3066.77, 3108.17, 3133, 3111.06, 3052.52, 3140.66,
539  3106.33, 3094.85, 3150.85, 3118.8, 3096.24, 3118.47,3111.36, 3117.11 } ;      3106.33, 3094.85, 3150.85, 3118.8, 3096.24, 3118.47,3111.36, 3117.11 } ;
540  */    */
   
 // new values from Napoli dec 2008  
 Float_t  PMTsat[48] = {  
 3176.35,3178.19,3167.38,3099.73,3117.00,3126.29,3111.44,3092.27,  
 3146.48,3094.41,3132.13,3115.37,3099.32,3110.97,3111.80,3143.14,  
 3106.72,3153.44,3136.00,3188.96,3104.73,3140.45,3073.18,3106.62,  
 3112.48,3146.92,3127.24,3136.52,3109.59,3112.89,3045.15,3147.26,  
 3095.92,3121.05,3083.25,3123.62,3150.92,3125.30,3067.60,3160.18,  
 3119.36,3108.92,3164.77,3133.64,3111.47,3131.98,3128.87,3135.56 };  
541    
542  for (Int_t i=0; i<48;i++) PMTsat[i] = PMTsat[i] - 5.;  // safety margin    // new values from Napoli dec 2008
543      Float_t  PMTsat[48] = {
544        3176.35,3178.19,3167.38,3099.73,3117.00,3126.29,3111.44,3092.27,
545        3146.48,3094.41,3132.13,3115.37,3099.32,3110.97,3111.80,3143.14,
546        3106.72,3153.44,3136.00,3188.96,3104.73,3140.45,3073.18,3106.62,
547        3112.48,3146.92,3127.24,3136.52,3109.59,3112.89,3045.15,3147.26,
548        3095.92,3121.05,3083.25,3123.62,3150.92,3125.30,3067.60,3160.18,
549        3119.36,3108.92,3164.77,3133.64,3111.47,3131.98,3128.87,3135.56 };
550    
551      for (Int_t i=0; i<48;i++) PMTsat[i] = PMTsat[i] - 5.;  // safety margin
552    
553    
554    PadEdx = 0.;    PadEdx = 0.;
555  //  SatWarning = 1000;    //  SatWarning = 1000;
556    SatWarning = 0;   // 0=good, increase for each bad PMT    SatWarning = 0;   // 0=good, increase for each bad PMT
557    
558    Float_t dEdx[48] = {0};    Float_t dEdx[48] = {0};
# Line 474  for (Int_t i=0; i<48;i++) PMTsat[i] = PM Line 599  for (Int_t i=0; i<48;i++) PMTsat[i] = PM
599    }    }
600    
601    
602  //  if( adcraw[pmtleft] >3000 || adcraw[pmtright] >3000)SatWarning=1;  //old version    //  if( adcraw[pmtleft] >3000 || adcraw[pmtright] >3000)SatWarning=1;  //old version
603    
604  // Increase SatWarning Counter for each PMT>Sat    // Increase SatWarning Counter for each PMT>Sat
605    if( adcraw[pmtleft] > PMTsat[pmtleft])SatWarning++;      if( adcraw[pmtleft] > PMTsat[pmtleft])SatWarning++;  
606    if( adcraw[pmtright] > PMTsat[pmtright])SatWarning++;    if( adcraw[pmtright] > PMTsat[pmtright])SatWarning++;
607    
608  // if ADC  > sat set dEdx=1000    // if ADC  > sat set dEdx=1000
609    if( adcraw[pmtleft] > PMTsat[pmtleft]) dEdx[pmtleft] = 1000.;    if( adcraw[pmtleft] > PMTsat[pmtleft]) dEdx[pmtleft] = 1000.;
610    if( adcraw[pmtright] > PMTsat[pmtright]) dEdx[pmtright] = 1000. ;    if( adcraw[pmtright] > PMTsat[pmtright]) dEdx[pmtright] = 1000. ;
611    
612  // 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
613    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;
614    if(dEdx[pmtleft]==1000 && dEdx[pmtright]<1000) PadEdx = dEdx[pmtright];      if(dEdx[pmtleft]==1000 && dEdx[pmtright]<1000) PadEdx = dEdx[pmtright];  
615    if(dEdx[pmtleft]<1000 && dEdx[pmtright]==1000) PadEdx = dEdx[pmtleft];    if(dEdx[pmtleft]<1000 && dEdx[pmtright]==1000) PadEdx = dEdx[pmtleft];
616        
617  };  };
618    
619  //  //
620    //  wm Nov 08 revision - saturation values included
621    /// gf Apr 07
622    /**
623     * Method to get the dEdx from a given ToF paddle.
624     * If two PMTs are good, the mean dEdx of both PMTs is taken, otherwise
625     * just the dEdx of the "good" PMT. If both PMTs are above saturation => dEdx=1000
626     * @param notrack Track Number
627     * @param Paddle index (0,1,...,23).
628     * @param adcflag in the paddle (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; )
629     * @param PadEdx dEdx from a given ToF paddle
630     * @param SatWarning 1 if the PMT ios near saturation region (adcraw ~3000)
631     */
632    void ToFLevel2::GetdEdxPaddle(ToFTrkVar *trk, Int_t paddleid, Int_t adcfl, Float_t &PadEdx, Int_t &SatWarning){
633    
634      /*
635        Float_t  PMTsat[48] = {
636        3162.14, 3165.48, 3153.85, 3085.73, 3089.65, 3107.64, 3097.52, 3078.37,
637        3130.05, 3087.07, 3112.22, 3102.92, 3080.58, 3092.55, 3087.94, 3125.03,
638        3094.09, 3143.16, 3125.51, 3181.27, 3092.09, 3124.98, 3069.3, 3095.53,
639        3097.11, 3133.53, 3114.73, 3113.01, 3091.19, 3097.99, 3033.84, 3134.98,
640        3081.37, 3111.04, 3066.77, 3108.17, 3133, 3111.06, 3052.52, 3140.66,
641        3106.33, 3094.85, 3150.85, 3118.8, 3096.24, 3118.47,3111.36, 3117.11 } ;
642      */
643    
644      // new values from Napoli dec 2008
645      Float_t  PMTsat[48] = {
646        3176.35,3178.19,3167.38,3099.73,3117.00,3126.29,3111.44,3092.27,
647        3146.48,3094.41,3132.13,3115.37,3099.32,3110.97,3111.80,3143.14,
648        3106.72,3153.44,3136.00,3188.96,3104.73,3140.45,3073.18,3106.62,
649        3112.48,3146.92,3127.24,3136.52,3109.59,3112.89,3045.15,3147.26,
650        3095.92,3121.05,3083.25,3123.62,3150.92,3125.30,3067.60,3160.18,
651        3119.36,3108.92,3164.77,3133.64,3111.47,3131.98,3128.87,3135.56 };
652    
653      for (Int_t i=0; i<48;i++) PMTsat[i] = PMTsat[i] - 5.;  // safety margin
654    
655    
656      PadEdx = 0.;
657      //  SatWarning = 1000;
658      SatWarning = 0;   // 0=good, increase for each bad PMT
659    
660      Float_t dEdx[48] = {0};
661      Int_t pmt_id = -1;
662      Float_t adcraw[48];
663      //
664      if(!trk) return; //ELENA
665      //
666    
667      Int_t pmtleft=-1;
668      Int_t pmtright=-1;
669      GetPaddlePMT(paddleid, pmtleft, pmtright);
670    
671      adcraw[pmtleft] = 4095;
672      adcraw[pmtright] = 4095;
673    
674      
675      for (Int_t jj=0; jj<npmt(); jj++){
676        
677        ToFPMT *pmt = GetToFPMT(jj);
678        if(!pmt)break; //ELENA
679        
680        pmt_id = pmt->pmt_id;
681        if(pmt_id==pmtleft){
682          adcraw[pmtleft] = pmt->adc;
683        }
684        
685        if(pmt_id==pmtright){
686          adcraw[pmtright] = pmt->adc;
687        }
688      }
689    
690      
691      for (Int_t i=0; i<trk->npmtadc; i++){
692    
693        if((trk->adcflag).At(i)==0 || adcfl==100){
694          if((trk->pmtadc).At(i) == pmtleft)dEdx[pmtleft] = (trk->dedx).At(i);
695          if((trk->pmtadc).At(i) == pmtright)dEdx[pmtright] = (trk->dedx).At(i);
696        }else{
697          if((trk->pmtadc).At(i) == pmtleft)dEdx[pmtleft] = 0.;
698          if((trk->pmtadc).At(i) == pmtright)dEdx[pmtright] = 0.;
699        }
700      }
701    
702    
703      //  if( adcraw[pmtleft] >3000 || adcraw[pmtright] >3000)SatWarning=1;  //old version
704    
705      // Increase SatWarning Counter for each PMT>Sat
706      if( adcraw[pmtleft] > PMTsat[pmtleft])SatWarning++;  
707      if( adcraw[pmtright] > PMTsat[pmtright])SatWarning++;
708    
709      // if ADC  > sat set dEdx=1000
710      if( adcraw[pmtleft] > PMTsat[pmtleft]) dEdx[pmtleft] = 1000.;
711      if( adcraw[pmtright] > PMTsat[pmtright]) dEdx[pmtright] = 1000. ;
712    
713      // if two PMT are good, take mean dEdx, otherwise only the good dEdx
714      if(dEdx[pmtleft]<1000 && dEdx[pmtright]<1000) PadEdx = (dEdx[pmtleft]+dEdx[pmtright])*0.5;
715      if(dEdx[pmtleft]==1000 && dEdx[pmtright]<1000) PadEdx = dEdx[pmtright];  
716      if(dEdx[pmtleft]<1000 && dEdx[pmtright]==1000) PadEdx = dEdx[pmtleft];
717      
718    };
719    
720  // gf Apr 07  // gf Apr 07
721    
722  /**  /**
# Line 1149  Int_t ToFLevel2::Process(TrkLevel2 *trk, Line 1373  Int_t ToFLevel2::Process(TrkLevel2 *trk,
1373    //    //
1374    // Copiare qui qualcosa di simile a calonuclei per evitare di riprocessare sempre tutto    // Copiare qui qualcosa di simile a calonuclei per evitare di riprocessare sempre tutto
1375    //    //
1376      printf("\n\n\n ERROR: NOT IMPLEMENTED ANYMORE, write Emiliano if you need this method (Emiliano.Mocchiutti@ts.infn.it) \n\n\n");
1377      return(-1);
1378      //   //
1379      //   // structures to communicate with F77
1380    //    //   //
1381    // structures to communicate with F77    //   extern struct ToFInput  tofinput_;
1382    //  //   extern struct ToFOutput tofoutput_;
1383    extern struct ToFInput  tofinput_;  //   //
1384    extern struct ToFOutput tofoutput_;  //   // DB connection
1385    //  //   //
1386    // DB connection  //   TString host;
1387    //  //   TString user;
1388    TString host;  //   TString psw;
1389    TString user;  //   const char *pamdbhost=gSystem->Getenv("PAM_DBHOST");
1390    TString psw;  //   const char *pamdbuser=gSystem->Getenv("PAM_DBUSER");
1391    const char *pamdbhost=gSystem->Getenv("PAM_DBHOST");  //   const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW");
1392    const char *pamdbuser=gSystem->Getenv("PAM_DBUSER");  //   if ( !pamdbhost ) pamdbhost = "";
1393    const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW");  //   if ( !pamdbuser ) pamdbuser = "";
1394    if ( !pamdbhost ) pamdbhost = "";  //   if ( !pamdbpsw ) pamdbpsw = "";
1395    if ( !pamdbuser ) pamdbuser = "";  //   if ( strcmp(pamdbhost,"") ) host = pamdbhost;
1396    if ( !pamdbpsw ) pamdbpsw = "";  //   if ( strcmp(pamdbuser,"") ) user = pamdbuser;
1397    if ( strcmp(pamdbhost,"") ) host = pamdbhost;  //   if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw;
1398    if ( strcmp(pamdbuser,"") ) user = pamdbuser;  //   //
1399    if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw;  //   //
1400    //  //   TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
1401    //  //   if ( !dbc->IsConnected() ) return 1;
1402    TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());  //   stringstream myquery;
1403    if ( !dbc->IsConnected() ) return 1;  //   myquery.str("");
1404    stringstream myquery;  //   myquery << "SET time_zone='+0:00';";
1405    myquery.str("");  //   dbc->Query(myquery.str().c_str());
1406    myquery << "SET time_zone='+0:00'";  //   delete dbc->Query("SET sql_mode = 'NO_UNSIGNED_SUBTRACTION';");
1407    dbc->Query(myquery.str().c_str());  //   GL_PARAM *glparam = new GL_PARAM();
1408    GL_PARAM *glparam = new GL_PARAM();  //   glparam->Query_GL_PARAM(1,1,dbc); // parameters stored in DB in GL_PRAM table
1409    glparam->Query_GL_PARAM(1,1,dbc); // parameters stored in DB in GL_PRAM table  //   trk->LoadField(glparam->PATH+glparam->NAME);
1410    trk->LoadField(glparam->PATH+glparam->NAME);  //   //
1411    //  //   Bool_t defcal = true;
1412    Bool_t defcal = true;  //   Int_t error=glparam->Query_GL_PARAM(run->RUNHEADER_TIME,201,dbc); // parameters stored in DB in GL_PRAM table
1413    Int_t error=glparam->Query_GL_PARAM(run->RUNHEADER_TIME,201,dbc); // parameters stored in DB in GL_PRAM table  //   if ( error<0 ) {
1414    if ( error<0 ) {  //     return(1);
1415      return(1);  //   };
1416    };  //   printf(" Reading ToF parameter file: %s \n",(glparam->PATH+glparam->NAME).Data());
1417    printf(" Reading ToF parameter file: %s \n",(glparam->PATH+glparam->NAME).Data());  //   if ( (UInt_t)glparam->TO_TIME != (UInt_t)4294967295UL ) defcal = false;
1418    if ( (UInt_t)glparam->TO_TIME != (UInt_t)4294967295UL ) defcal = false;  //   //
1419    //  //   Int_t nlen = (Int_t)(glparam->PATH+glparam->NAME).Length();
1420    Int_t nlen = (Int_t)(glparam->PATH+glparam->NAME).Length();  //   rdtofcal((char *)(glparam->PATH+glparam->NAME).Data(),&nlen);
1421    rdtofcal((char *)(glparam->PATH+glparam->NAME).Data(),&nlen);  //   //
1422    //  //   Int_t adc[4][12];
1423    Int_t adc[4][12];  //   Int_t tdc[4][12];
1424    Int_t tdc[4][12];  //   Float_t tdcc[4][12];
1425    Float_t tdcc[4][12];  //   //
1426    //  //   // process tof data
1427    // process tof data  //   //
1428    //  //   for (Int_t hh=0; hh<12;hh++){
1429    for (Int_t hh=0; hh<12;hh++){  //     for (Int_t kk=0; kk<4;kk++){
1430      for (Int_t kk=0; kk<4;kk++){  //            adc[kk][hh] = 4095;
1431             adc[kk][hh] = 4095;  //            tdc[kk][hh] = 4095;
1432             tdc[kk][hh] = 4095;  //            tdcc[kk][hh] = 4095.;
1433             tdcc[kk][hh] = 4095.;  //            tofinput_.adc[hh][kk] = 4095;
1434             tofinput_.adc[hh][kk] = 4095;  //            tofinput_.tdc[hh][kk] = 4095;
1435             tofinput_.tdc[hh][kk] = 4095;  //     };
1436      };  //   };
1437    };  //   Int_t ntrkentry = 0;
1438    Int_t ntrkentry = 0;  //   Int_t npmtentry = 0;
1439    Int_t npmtentry = 0;  //   Int_t gg = 0;
1440    Int_t gg = 0;  //   Int_t hh = 0;
1441    Int_t hh = 0;  //   Int_t adcf[48];
1442    Int_t adcf[48];  //   memset(adcf, 0, 48*sizeof(Int_t));
1443    memset(adcf, 0, 48*sizeof(Int_t));  //   Int_t tdcf[48];
1444    Int_t tdcf[48];  //   memset(tdcf, 0, 48*sizeof(Int_t));
1445    memset(tdcf, 0, 48*sizeof(Int_t));  //   for (Int_t pm=0; pm < this->ntrk() ; pm++){
1446    for (Int_t pm=0; pm < this->ntrk() ; pm++){  //      ToFTrkVar *ttf = this->GetToFTrkVar(pm);
1447       ToFTrkVar *ttf = this->GetToFTrkVar(pm);  //      for ( Int_t nc=0; nc < ttf->npmttdc; nc++){
1448       for ( Int_t nc=0; nc < ttf->npmttdc; nc++){  //             if ( (ttf->tdcflag).At(nc) != 0 ) tdcf[(ttf->pmttdc).At(nc)] = 1;
1449              if ( (ttf->tdcflag).At(nc) != 0 ) tdcf[(ttf->pmttdc).At(nc)] = 1;  //      };
1450       };  //      for ( Int_t nc=0; nc < ttf->npmtadc; nc++){
1451       for ( Int_t nc=0; nc < ttf->npmtadc; nc++){  //             if ( (ttf->adcflag).At(nc) != 0 ) adcf[(ttf->pmtadc).At(nc)] = 1;
1452              if ( (ttf->adcflag).At(nc) != 0 ) adcf[(ttf->pmtadc).At(nc)] = 1;  //      };
1453       };  //   };
1454    };  //   //
1455    //  //   for (Int_t pm=0; pm < this->npmt() ; pm++){
1456    for (Int_t pm=0; pm < this->npmt() ; pm++){  //      ToFPMT *pmt = this->GetToFPMT(pm);
1457       ToFPMT *pmt = this->GetToFPMT(pm);  //      this->GetPMTIndex(pmt->pmt_id, gg, hh);
1458       this->GetPMTIndex(pmt->pmt_id, gg, hh);  //      if ( adcf[pmt->pmt_id] == 0 ){
1459       if ( adcf[pmt->pmt_id] == 0 ){  //              tofinput_.adc[gg][hh] = (int)pmt->adc;
1460               tofinput_.adc[gg][hh] = (int)pmt->adc;  //              adc[hh][gg] = (int)pmt->adc;
1461               adc[hh][gg] = (int)pmt->adc;  //      };
1462       };  //      if ( tdcf[pmt->pmt_id] == 0 ){
1463       if ( tdcf[pmt->pmt_id] == 0 ){  //              tofinput_.tdc[gg][hh] = (int)pmt->tdc;
1464               tofinput_.tdc[gg][hh] = (int)pmt->tdc;  //              tdc[hh][gg] = (int)pmt->tdc;
1465               tdc[hh][gg] = (int)pmt->tdc;  //      };
1466       };  //      tdcc[hh][gg] = (float)pmt->tdc_tw;
1467       tdcc[hh][gg] = (float)pmt->tdc_tw;  //      // Int_t pppid = this->GetPMTid(hh,gg);
1468       // Int_t pppid = this->GetPMTid(hh,gg);  //      //      printf(" pm %i pmt_id %i pppid %i hh %i gg %i tdcc %f tdc %f adc %f \n",pm,pmt->pmt_id,pppid,hh,gg,pmt->tdc_tw,pmt->tdc,pmt->adc);
1469       //      printf(" pm %i pmt_id %i pppid %i hh %i gg %i tdcc %f tdc %f adc %f \n",pm,pmt->pmt_id,pppid,hh,gg,pmt->tdc_tw,pmt->tdc,pmt->adc);  //   };
1470    };  //   //
1471    //  //   Int_t unpackError = this->unpackError;
1472    Int_t unpackError = this->unpackError;  //   //
1473    //  //   for (Int_t hh=0; hh<5;hh++){
1474    for (Int_t hh=0; hh<5;hh++){  //      tofinput_.patterntrig[hh]=trg->patterntrig[hh];
1475       tofinput_.patterntrig[hh]=trg->patterntrig[hh];  //   };
1476    };  //   //
1477    //  //   this->Clear();
1478    this->Clear();  //   //
1479    //  //       Int_t pmt_id = 0;
1480        Int_t pmt_id = 0;  //       ToFPMT *t_pmt = new ToFPMT();
1481        ToFPMT *t_pmt = new ToFPMT();  //       if(!(this->PMT)) this->PMT = new TClonesArray("ToFPMT",12); //ELENA
1482        if(!(this->PMT)) this->PMT = new TClonesArray("ToFPMT",12); //ELENA  //       TClonesArray &tpmt = *this->PMT;
1483        TClonesArray &tpmt = *this->PMT;  //       ToFTrkVar *t_tof = new ToFTrkVar();
1484        ToFTrkVar *t_tof = new ToFTrkVar();  //       if(!(this->ToFTrk)) this->ToFTrk = new TClonesArray("ToFTrkVar",2); //ELENA
1485        if(!(this->ToFTrk)) this->ToFTrk = new TClonesArray("ToFTrkVar",2); //ELENA  //       TClonesArray &t = *this->ToFTrk;
1486        TClonesArray &t = *this->ToFTrk;  //       //
1487        //  //       //
1488        //  //       // Here we have calibrated data, ready to be passed to the FORTRAN routine which will extract common and track-related  variables.
1489        // Here we have calibrated data, ready to be passed to the FORTRAN routine which will extract common and track-related  variables.  //       //
1490        //  //       npmtentry = 0;
1491        npmtentry = 0;  //       //
1492        //  //       ntrkentry = 0;
1493        ntrkentry = 0;  //       //
1494        //  //       // Calculate tracks informations from ToF alone
1495        // Calculate tracks informations from ToF alone  //       //
1496        //  //       tofl2com();
1497        tofl2com();  //       //
1498        //  //       memcpy(this->tof_j_flag,tofoutput_.tof_j_flag,6*sizeof(Int_t));
1499        memcpy(this->tof_j_flag,tofoutput_.tof_j_flag,6*sizeof(Int_t));  //       //
1500        //  //       t_tof->trkseqno = -1;
1501        t_tof->trkseqno = -1;  //       //
1502        //  //       // and now we must copy from the output structure to the level2 class:
1503        // and now we must copy from the output structure to the level2 class:  //       //
1504        //  //       t_tof->npmttdc = 0;
1505        t_tof->npmttdc = 0;  //       //
1506        //  //       for (Int_t hh=0; hh<12;hh++){
1507        for (Int_t hh=0; hh<12;hh++){  //         for (Int_t kk=0; kk<4;kk++){
1508          for (Int_t kk=0; kk<4;kk++){  //           if ( tofoutput_.tofmask[hh][kk] != 0 ){
1509            if ( tofoutput_.tofmask[hh][kk] != 0 ){  //             pmt_id = this->GetPMTid(kk,hh);
1510              pmt_id = this->GetPMTid(kk,hh);  //             t_tof->pmttdc.AddAt(pmt_id,t_tof->npmttdc);
1511              t_tof->pmttdc.AddAt(pmt_id,t_tof->npmttdc);  //             t_tof->tdcflag.AddAt(tofoutput_.tdcflagtof[hh][kk],t_tof->npmttdc); // gf: Jan 09/07
1512              t_tof->tdcflag.AddAt(tofoutput_.tdcflagtof[hh][kk],t_tof->npmttdc); // gf: Jan 09/07  //             t_tof->npmttdc++;
1513              t_tof->npmttdc++;  //           };
1514            };  //         };
1515          };  //       };
1516        };  //       for (Int_t kk=0; kk<13;kk++){
1517        for (Int_t kk=0; kk<13;kk++){  //         t_tof->beta[kk] = tofoutput_.betatof_a[kk];
1518          t_tof->beta[kk] = tofoutput_.betatof_a[kk];  //       }
1519        }  //       //
1520        //  //       t_tof->npmtadc = 0;
1521        t_tof->npmtadc = 0;  //       for (Int_t hh=0; hh<12;hh++){
1522        for (Int_t hh=0; hh<12;hh++){  //         for (Int_t kk=0; kk<4;kk++){
1523          for (Int_t kk=0; kk<4;kk++){  //           if ( tofoutput_.adctof_c[hh][kk] < 1000 ){
1524            if ( tofoutput_.adctof_c[hh][kk] < 1000 ){  //             t_tof->dedx.AddAt(tofoutput_.adctof_c[hh][kk],t_tof->npmtadc);
1525              t_tof->dedx.AddAt(tofoutput_.adctof_c[hh][kk],t_tof->npmtadc);  //             pmt_id = this->GetPMTid(kk,hh);
1526              pmt_id = this->GetPMTid(kk,hh);  //             t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc);
1527              t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc);  //             t_tof->adcflag.AddAt(tofoutput_.adcflagtof[hh][kk],t_tof->npmtadc); // gf: Jan 09/07
1528              t_tof->adcflag.AddAt(tofoutput_.adcflagtof[hh][kk],t_tof->npmtadc); // gf: Jan 09/07  //             t_tof->npmtadc++;
1529              t_tof->npmtadc++;  //           };
1530            };  //         };
1531          };  //       };
1532        };  //       //
1533        //  //       memcpy(t_tof->xtofpos,tofoutput_.xtofpos,sizeof(t_tof->xtofpos));
1534        memcpy(t_tof->xtofpos,tofoutput_.xtofpos,sizeof(t_tof->xtofpos));  //       memcpy(t_tof->ytofpos,tofoutput_.ytofpos,sizeof(t_tof->ytofpos));
1535        memcpy(t_tof->ytofpos,tofoutput_.ytofpos,sizeof(t_tof->ytofpos));  //       memcpy(t_tof->xtr_tof,tofoutput_.xtr_tof,sizeof(t_tof->xtr_tof));
1536        memcpy(t_tof->xtr_tof,tofoutput_.xtr_tof,sizeof(t_tof->xtr_tof));  //       memcpy(t_tof->ytr_tof,tofoutput_.ytr_tof,sizeof(t_tof->ytr_tof));
1537        memcpy(t_tof->ytr_tof,tofoutput_.ytr_tof,sizeof(t_tof->ytr_tof));  //       //
1538        //  //       new(t[ntrkentry]) ToFTrkVar(*t_tof);
1539        new(t[ntrkentry]) ToFTrkVar(*t_tof);  //       ntrkentry++;
1540        ntrkentry++;  //       t_tof->Clear();
1541        t_tof->Clear();  //       //
1542        //  //       //
1543        //  //       //
1544        //  //       t_pmt->Clear();
1545        t_pmt->Clear();  //       //
1546        //  //       for (Int_t hh=0; hh<12;hh++){
1547        for (Int_t hh=0; hh<12;hh++){  //         for (Int_t kk=0; kk<4;kk++){
1548          for (Int_t kk=0; kk<4;kk++){  //          // new WM
1549           // new WM  //           if ( tofoutput_.tdc_c[hh][kk] < 4095 || adc[kk][hh] < 4095  || tdc[kk][hh] < 4095 ){
1550            if ( tofoutput_.tdc_c[hh][kk] < 4095 || adc[kk][hh] < 4095  || tdc[kk][hh] < 4095 ){  // //          if ( tdcc[kk][hh] < 4095. || adc[kk][hh] < 4095  || tdc[kk][hh] < 4095 ){
1551  //          if ( tdcc[kk][hh] < 4095. || adc[kk][hh] < 4095  || tdc[kk][hh] < 4095 ){  //             //
1552              //  //             t_pmt->pmt_id = this->GetPMTid(kk,hh);
1553              t_pmt->pmt_id = this->GetPMTid(kk,hh);  //             t_pmt->tdc_tw = tofoutput_.tdc_c[hh][kk];
1554              t_pmt->tdc_tw = tofoutput_.tdc_c[hh][kk];  //             t_pmt->adc = (Float_t)adc[kk][hh];
1555              t_pmt->adc = (Float_t)adc[kk][hh];  //             t_pmt->tdc = (Float_t)tdc[kk][hh];
1556              t_pmt->tdc = (Float_t)tdc[kk][hh];  //             //
1557              //  //             new(tpmt[npmtentry]) ToFPMT(*t_pmt);
1558              new(tpmt[npmtentry]) ToFPMT(*t_pmt);  //             npmtentry++;
1559              npmtentry++;  //             t_pmt->Clear();
1560              t_pmt->Clear();  //           };
1561            };  //         };
1562          };  //       };
1563        };  //       //
1564        //  //       // Calculate track-related variables
1565        // Calculate track-related variables  //       //
1566        //  //       if ( trk->ntrk() > 0 ){
1567        if ( trk->ntrk() > 0 ){  //         //
1568          //  //         // We have at least one track
1569          // We have at least one track  //         //
1570          //  //         //
1571          //  //         // Run over tracks
1572          // Run over tracks  //         //
1573          //  //         for(Int_t nt=0; nt < trk->ntrk(); nt++){
1574          for(Int_t nt=0; nt < trk->ntrk(); nt++){  //           //
1575            //  //           TrkTrack *ptt = trk->GetStoredTrack(nt);
1576            TrkTrack *ptt = trk->GetStoredTrack(nt);  //           //
1577            //  //           // Copy the alpha vector in the input structure
1578            // Copy the alpha vector in the input structure  //           //
1579            //  //           for (Int_t e = 0; e < 5 ; e++){
1580            for (Int_t e = 0; e < 5 ; e++){  //             tofinput_.al_pp[e] = ptt->al[e];
1581              tofinput_.al_pp[e] = ptt->al[e];  //           };
1582            };  //           //
1583            //  //           // Get tracker related variables for this track
1584            // Get tracker related variables for this track  //           //
1585            //  //           toftrk();
1586            toftrk();  //           //
1587            //  //           // Copy values in the class from the structure (we need to use a temporary class to store variables).
1588            // Copy values in the class from the structure (we need to use a temporary class to store variables).  //           //
1589            //  //           t_tof->npmttdc = 0;
1590            t_tof->npmttdc = 0;  //           for (Int_t hh=0; hh<12;hh++){
1591            for (Int_t hh=0; hh<12;hh++){  //             for (Int_t kk=0; kk<4;kk++){
1592              for (Int_t kk=0; kk<4;kk++){  //               if ( tofoutput_.tofmask[hh][kk] != 0 ){
1593                if ( tofoutput_.tofmask[hh][kk] != 0 ){  //                 pmt_id = this->GetPMTid(kk,hh);
1594                  pmt_id = this->GetPMTid(kk,hh);  //                 t_tof->pmttdc.AddAt(pmt_id,t_tof->npmttdc);
1595                  t_tof->pmttdc.AddAt(pmt_id,t_tof->npmttdc);  //                 t_tof->tdcflag.AddAt(tofoutput_.tdcflag[hh][kk],t_tof->npmttdc); // gf: Jan 09/07
1596                  t_tof->tdcflag.AddAt(tofoutput_.tdcflag[hh][kk],t_tof->npmttdc); // gf: Jan 09/07  //                 t_tof->npmttdc++;
1597                  t_tof->npmttdc++;  //               };
1598                };  //             };
1599              };  //           };
1600            };  //           for (Int_t kk=0; kk<13;kk++){
1601            for (Int_t kk=0; kk<13;kk++){  //             t_tof->beta[kk] = tofoutput_.beta_a[kk];
1602              t_tof->beta[kk] = tofoutput_.beta_a[kk];  //           };
1603            };  //           //
1604            //  //           t_tof->npmtadc = 0;
1605            t_tof->npmtadc = 0;  //           for (Int_t hh=0; hh<12;hh++){
1606            for (Int_t hh=0; hh<12;hh++){  //             for (Int_t kk=0; kk<4;kk++){
1607              for (Int_t kk=0; kk<4;kk++){  //               if ( tofoutput_.adc_c[hh][kk] < 1000 ){
1608                if ( tofoutput_.adc_c[hh][kk] < 1000 ){  //                 t_tof->dedx.AddAt(tofoutput_.adc_c[hh][kk],t_tof->npmtadc);
1609                  t_tof->dedx.AddAt(tofoutput_.adc_c[hh][kk],t_tof->npmtadc);  //                 pmt_id = this->GetPMTid(kk,hh);
1610                  pmt_id = this->GetPMTid(kk,hh);  //                 t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc);
1611                  t_tof->pmtadc.AddAt(pmt_id,t_tof->npmtadc);  //                 t_tof->adcflag.AddAt(tofoutput_.adcflag[hh][kk],t_tof->npmtadc); // gf: Jan 09/07
1612                  t_tof->adcflag.AddAt(tofoutput_.adcflag[hh][kk],t_tof->npmtadc); // gf: Jan 09/07  //                 t_tof->npmtadc++;
1613                  t_tof->npmtadc++;  //               };
1614                };  //             };
1615              };  //           };
1616            };  //           //
1617            //  //           memcpy(t_tof->xtofpos,tofoutput_.xtofpos,sizeof(t_tof->xtofpos));
1618            memcpy(t_tof->xtofpos,tofoutput_.xtofpos,sizeof(t_tof->xtofpos));  //           memcpy(t_tof->ytofpos,tofoutput_.ytofpos,sizeof(t_tof->ytofpos));
1619            memcpy(t_tof->ytofpos,tofoutput_.ytofpos,sizeof(t_tof->ytofpos));  //           memcpy(t_tof->xtr_tof,tofoutput_.xtr_tof,sizeof(t_tof->xtr_tof));
1620            memcpy(t_tof->xtr_tof,tofoutput_.xtr_tof,sizeof(t_tof->xtr_tof));  //           memcpy(t_tof->ytr_tof,tofoutput_.ytr_tof,sizeof(t_tof->ytr_tof));
1621            memcpy(t_tof->ytr_tof,tofoutput_.ytr_tof,sizeof(t_tof->ytr_tof));  //           //
1622            //  //           // Store the tracker track number in order to be sure to have shyncronized data during analysis
1623            // Store the tracker track number in order to be sure to have shyncronized data during analysis  //           //
1624            //  //           t_tof->trkseqno = nt;
1625            t_tof->trkseqno = nt;  //           //
1626            //  //           // create a new object for this event with track-related variables
1627            // create a new object for this event with track-related variables  //           //
1628            //  //           new(t[ntrkentry]) ToFTrkVar(*t_tof);
1629            new(t[ntrkentry]) ToFTrkVar(*t_tof);  //           ntrkentry++;
1630            ntrkentry++;  //           t_tof->Clear();
1631            t_tof->Clear();  //           //
1632            //  //         }; // loop on all the tracks
1633          }; // loop on all the tracks  //       //
1634        //  //       this->unpackError = unpackError;
1635        this->unpackError = unpackError;  //       if ( defcal ){
1636        if ( defcal ){  //         this->default_calib = 1;
1637          this->default_calib = 1;  //       } else {
1638        } else {  //         this->default_calib = 0;
1639          this->default_calib = 0;  //       };
1640        };  //};
1641   };  //  return(0);
1642    }
1643    
1644    bool ToFLevel2::bit(int decimal, char pos){
1645    return(0);    return( (decimal>>pos)%2 );
1646    }
1647    
1648    bool ToFLevel2::checkPMT(TString givenpmt){
1649      TClonesArray* Pmt = this->PMT;
1650      //  printf(" ou %s entries %i \n",givenpmt.Data(),Pmt->GetEntries());
1651      for(int i=0; i<Pmt->GetEntries(); i++) {  
1652        ToFPMT* pmthit = (ToFPMT*)Pmt->At(i);
1653        TString pmtname = this->GetPMTName(pmthit->pmt_id);
1654        //    printf(" name %s \n",pmtname.Data());
1655        if ( !strcmp(pmtname.Data(),givenpmt.Data()) )
1656          return true;
1657      }
1658      //  printf(" PMT %s missing \n",givenpmt.Data());
1659      return false;
1660    }
1661    
1662    bool ToFLevel2::checkPMTpatternPMThit(TrigLevel2 *trg, int &pmtpattern, int &pmtnosignal){
1663      UInt_t *patterntrig = trg->patterntrig;
1664      pmtpattern = 0;
1665      pmtnosignal = 0;
1666      bool good = true;
1667      //S3
1668      if ( this->bit(patterntrig[2],0) ){ pmtpattern++;  if ( !this->checkPMT("S31_1A")){ pmtnosignal++; good = false;}}
1669      if ( this->bit(patterntrig[2],1) ){ pmtpattern++;  if ( !this->checkPMT("S31_2A")){ pmtnosignal++; good = false;}}
1670      if ( this->bit(patterntrig[2],2) ){ pmtpattern++;  if ( !this->checkPMT("S31_3A")){ pmtnosignal++; good = false;}}
1671      if ( this->bit(patterntrig[2],3) ){ pmtpattern++;  if ( !this->checkPMT("S31_1B")){ pmtnosignal++; good = false;}}
1672      if ( this->bit(patterntrig[2],4) ){ pmtpattern++;  if ( !this->checkPMT("S31_2B")){ pmtnosignal++; good = false;}}
1673      if ( this->bit(patterntrig[2],5) ){ pmtpattern++;  if ( !this->checkPMT("S31_3B")){ pmtnosignal++; good = false;}}      
1674      if ( this->bit(patterntrig[2],6) ){ pmtpattern++;  if ( !this->checkPMT("S32_1A")){ pmtnosignal++; good = false;}}
1675      if ( this->bit(patterntrig[2],7) ){ pmtpattern++;  if ( !this->checkPMT("S32_2A")){ pmtnosignal++; good = false;}}
1676      if ( this->bit(patterntrig[2],8) ){ pmtpattern++;  if ( !this->checkPMT("S32_3A")){ pmtnosignal++; good = false;}}
1677      if ( this->bit(patterntrig[2],9) ){ pmtpattern++;  if ( !this->checkPMT("S32_1B")){ pmtnosignal++; good = false;}}
1678      if ( this->bit(patterntrig[2],10) ){ pmtpattern++;  if ( !this->checkPMT("S32_2B")){ pmtnosignal++; good = false;}}
1679      if ( this->bit(patterntrig[2],11) ){ pmtpattern++;  if ( !this->checkPMT("S32_3B")){ pmtnosignal++; good = false;}}      
1680      //S2
1681      if ( this->bit(patterntrig[3],0) ){ pmtpattern++;  if ( !this->checkPMT("S21_1A")){ pmtnosignal++; good = false;}}
1682      if ( this->bit(patterntrig[3],1) ){ pmtpattern++;  if ( !this->checkPMT("S21_2A")){ pmtnosignal++; good = false;}}
1683      if ( this->bit(patterntrig[3],2) ){ pmtpattern++;  if ( !this->checkPMT("S21_1B")){ pmtnosignal++; good = false;}}
1684      if ( this->bit(patterntrig[3],3) ){ pmtpattern++;  if ( !this->checkPMT("S21_2B")){ pmtnosignal++; good = false;}}      
1685      if ( this->bit(patterntrig[3],4) ){ pmtpattern++;  if ( !this->checkPMT("S22_1A")){ pmtnosignal++; good = false;}}
1686      if ( this->bit(patterntrig[3],5) ){ pmtpattern++;  if ( !this->checkPMT("S22_2A")){ pmtnosignal++; good = false;}}
1687      if ( this->bit(patterntrig[3],6) ){ pmtpattern++;  if ( !this->checkPMT("S22_1B")){ pmtnosignal++; good = false;}}
1688      if ( this->bit(patterntrig[3],7) ){ pmtpattern++;  if ( !this->checkPMT("S22_2B")){ pmtnosignal++; good = false;}}      
1689      //S12
1690      if ( this->bit(patterntrig[4],0) ){ pmtpattern++;  if ( !this->checkPMT("S12_1A")){ pmtnosignal++; good = false;}}
1691      if ( this->bit(patterntrig[4],1) ){ pmtpattern++;  if ( !this->checkPMT("S12_2A")){ pmtnosignal++; good = false;}}
1692      if ( this->bit(patterntrig[4],2) ){ pmtpattern++;  if ( !this->checkPMT("S12_3A")){ pmtnosignal++; good = false;}}
1693      if ( this->bit(patterntrig[4],3) ){ pmtpattern++;  if ( !this->checkPMT("S12_4A")){ pmtnosignal++; good = false;}}
1694      if ( this->bit(patterntrig[4],4) ){ pmtpattern++;  if ( !this->checkPMT("S12_5A")){ pmtnosignal++; good = false;}}
1695      if ( this->bit(patterntrig[4],5) ){ pmtpattern++;  if ( !this->checkPMT("S12_6A")){ pmtnosignal++; good = false;}}      
1696      if ( this->bit(patterntrig[4],6) ){ pmtpattern++;  if ( !this->checkPMT("S12_1A")){ pmtnosignal++; good = false;}}
1697      if ( this->bit(patterntrig[4],7) ){ pmtpattern++;  if ( !this->checkPMT("S12_2A")){ pmtnosignal++; good = false;}}
1698      if ( this->bit(patterntrig[4],8) ){ pmtpattern++;  if ( !this->checkPMT("S12_3A")){ pmtnosignal++; good = false;}}
1699      if ( this->bit(patterntrig[4],9) ){ pmtpattern++;  if ( !this->checkPMT("S12_4B")){ pmtnosignal++; good = false;}}
1700      if ( this->bit(patterntrig[4],10) ){ pmtpattern++; if ( !this->checkPMT("S12_5B")){ pmtnosignal++; good = false;}}
1701      if ( this->bit(patterntrig[4],11) ){ pmtpattern++; if ( !this->checkPMT("S12_6B")){ pmtnosignal++; good = false;}}      
1702      //S11
1703      if ( this->bit(patterntrig[5],0) ){ pmtpattern++;  if ( !this->checkPMT("S11_1A")){ pmtnosignal++; good = false;}}
1704      if ( this->bit(patterntrig[5],1) ){ pmtpattern++;  if ( !this->checkPMT("S11_2A")){ pmtnosignal++; good = false;}}
1705      if ( this->bit(patterntrig[5],2) ){ pmtpattern++;  if ( !this->checkPMT("S11_3A")){ pmtnosignal++; good = false;}}
1706      if ( this->bit(patterntrig[5],3) ){ pmtpattern++;  if ( !this->checkPMT("S11_4A")){ pmtnosignal++; good = false;}}
1707      if ( this->bit(patterntrig[5],4) ){ pmtpattern++;  if ( !this->checkPMT("S11_5A")){ pmtnosignal++; good = false;}}
1708      if ( this->bit(patterntrig[5],5) ){ pmtpattern++;  if ( !this->checkPMT("S11_6A")){ pmtnosignal++; good = false;}}
1709      if ( this->bit(patterntrig[5],6) ){ pmtpattern++;  if ( !this->checkPMT("S11_7A")){ pmtnosignal++; good = false;}}
1710      if ( this->bit(patterntrig[5],7) ){ pmtpattern++;  if ( !this->checkPMT("S11_8A")){ pmtnosignal++; good = false;}}      
1711      if ( this->bit(patterntrig[5],8) ){ pmtpattern++;  if ( !this->checkPMT("S11_1B")){ pmtnosignal++; good = false;}}
1712      if ( this->bit(patterntrig[5],9) ){ pmtpattern++;  if ( !this->checkPMT("S11_2B")){ pmtnosignal++; good = false;}}
1713      if ( this->bit(patterntrig[5],10) ){ pmtpattern++; if ( !this->checkPMT("S11_3B")){ pmtnosignal++; good = false;}}
1714      if ( this->bit(patterntrig[5],11) ){ pmtpattern++; if ( !this->checkPMT("S11_4B")){ pmtnosignal++; good = false;}}
1715      if ( this->bit(patterntrig[5],12) ){ pmtpattern++; if ( !this->checkPMT("S11_5B")){ pmtnosignal++; good = false;}}
1716      if ( this->bit(patterntrig[5],13) ){ pmtpattern++; if ( !this->checkPMT("S11_6B")){ pmtnosignal++; good = false;}}
1717      if ( this->bit(patterntrig[5],14) ){ pmtpattern++; if ( !this->checkPMT("S11_7B")){ pmtnosignal++; good = false;}}
1718      if ( this->bit(patterntrig[5],15) ){ pmtpattern++; if ( !this->checkPMT("S11_8B")){ pmtnosignal++; good = false;}}
1719    
1720      return good;
1721    }
1722    
1723    bool ToFLevel2::checkPMTpmttrig(TrigLevel2 *trg){
1724      //  UInt_t *patterntrig = trg->patterntrig;
1725      int rS11 = 0;
1726      int rS12 = 0;
1727      int rS21 = 0;
1728      int rS22 = 0;
1729      int rS31 = 0;
1730      int rS32 = 0;
1731    
1732      // trigger configuration for the event from saved pmts
1733      TClonesArray* Pmt = this->PMT;
1734      for(int i=0; i<Pmt->GetEntries(); i++) {  
1735        ToFPMT* pmthit = (ToFPMT*)Pmt->At(i);
1736        TString pmtname = this->GetPMTName(pmthit->pmt_id);
1737        if ( pmtname.Contains("S11") ) rS11++;
1738        if ( pmtname.Contains("S12") ) rS12++;
1739        if ( pmtname.Contains("S21") ) rS21++;
1740        if ( pmtname.Contains("S22") ) rS22++;
1741        if ( pmtname.Contains("S31") ) rS31++;
1742        if ( pmtname.Contains("S32") ) rS32++;
1743      }
1744      int rTOF1 = (rS11 + rS12) * (rS21 + rS22) * (rS31 + rS32);
1745      int rTOF2 = (rS11 * rS12) * (rS21 * rS22) * (rS31 * rS32);
1746    
1747      int rTOF3 = (rS21 + rS22) * (rS31 + rS32);
1748      int rTOF4 = (rS21 * rS22) * (rS31 * rS32);
1749    
1750      int rTOF5 = rS12 * (rS21 * rS22);
1751    
1752      int rTOF6 = (rS11 + rS12) * (rS31 + rS32);
1753      int rTOF7 = (rS11 * rS12) * (rS31 * rS32);
1754    
1755    
1756      // trigger configuration of the run
1757      bool TCTOF1 = false;
1758      bool TCTOF2 = false;
1759      bool TCTOF3 = false;
1760      bool TCTOF4 = false;
1761      bool TCTOF5 = false;
1762      bool TCTOF6 = false;
1763      bool TCTOF7 = false;
1764      if ( trg->trigconf & (1<<0) ) TCTOF1 = true;
1765      if ( trg->trigconf & (1<<1) ) TCTOF2 = true;
1766      if ( trg->trigconf & (1<<2) ) TCTOF3 = true;
1767      if ( trg->trigconf & (1<<3) ) TCTOF4 = true;
1768      if ( trg->trigconf & (1<<4) ) TCTOF5 = true;
1769      if ( trg->trigconf & (1<<5) ) TCTOF6 = true;
1770      if ( trg->trigconf & (1<<6) ) TCTOF7 = true;
1771    
1772      // do patterntrig pmts match the trigger configuration?
1773      bool pmtsconf_trigconf_match = true;
1774      if ( rTOF1 == 0 && TCTOF1 ) pmtsconf_trigconf_match = false;
1775      if ( rTOF2 == 0 && TCTOF2 ) pmtsconf_trigconf_match = false;
1776      if ( rTOF3 == 0 && TCTOF3 ) pmtsconf_trigconf_match = false;
1777      if ( rTOF4 == 0 && TCTOF4 ) pmtsconf_trigconf_match = false;
1778      if ( rTOF5 == 0 && TCTOF5 ) pmtsconf_trigconf_match = false;
1779      if ( rTOF6 == 0 && TCTOF6 ) pmtsconf_trigconf_match = false;
1780      if ( rTOF7 == 0 && TCTOF7 ) pmtsconf_trigconf_match = false;
1781    
1782      return pmtsconf_trigconf_match;
1783    }
1784    
1785    void ToFLevel2::printPMT(){
1786      TClonesArray* Pmt = this->PMT;
1787      for(int i=0; i<Pmt->GetEntries(); i++) {  
1788        ToFPMT* pmthit = (ToFPMT*)Pmt->At(i);
1789        TString pmtname = this->GetPMTName(pmthit->pmt_id);
1790        printf(" PMT hit: %s \n",pmtname.Data());
1791      }
1792  }  }
1793    
1794    
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
1795  ToFdEdx::ToFdEdx()  ToFdEdx::ToFdEdx()
1796  {  {
1797    memset(conn,0,12*sizeof(Bool_t));    memset(conn,0,12*sizeof(Bool_t));
1798    memset(ts,0,12*sizeof(UInt_t));    memset(ts,0,12*sizeof(UInt_t));
1799    memset(te,0,12*sizeof(UInt_t));    memset(te,0,12*sizeof(UInt_t));
1800      eDEDXpmt = new TArrayF(48);
1801    Define_PMTsat();    Define_PMTsat();
1802    Clear();    Clear();
1803  }  }
1804    
1805    ToFdEdx::~ToFdEdx(){
1806      Clear();
1807      Delete();
1808    }
1809    
1810    void ToFdEdx::Delete(Option_t *option){
1811      if ( eDEDXpmt ){
1812        eDEDXpmt->Set(0);
1813        if ( eDEDXpmt) delete eDEDXpmt;
1814      }
1815    }
1816    
1817  //------------------------------------------------------------------------  //------------------------------------------------------------------------
1818  void ToFdEdx::CheckConnectors(UInt_t atime, GL_PARAM *glparam, TSQLServer *dbc)  void ToFdEdx::CheckConnectors(UInt_t atime, GL_PARAM *glparam, TSQLServer *dbc)
1819  {  {
# Line 1493  void ToFdEdx::Clear(Option_t *option) Line 1855  void ToFdEdx::Clear(Option_t *option)
1855  {  {
1856    //    //
1857    // Set arrays and initialize structure    // Set arrays and initialize structure
1858      //  eDEDXpmt.Set(48);    eDEDXpmt.Reset(-1);   // Set array size  and reset structure
1859    eDEDXpmt.Set(48);    eDEDXpmt.Reset(-1);   // Set array size  and reset structure    eDEDXpmt->Set(48);    eDEDXpmt->Reset(-1);   // Set array size  and reset structure
   eZpmt.Set(48);       eZpmt.Reset(-1);  
   eDEDXpad.Set(24);    eDEDXpad.Reset(-1);  
   eZpad.Set(24);       eZpad.Reset(-1);  
   eDEDXlayer.Set(6);   eDEDXlayer.Reset(-1);  
   eZlayer.Set(6);      eZlayer.Reset(-1);  
   eDEDXplane.Set(3);   eDEDXplane.Reset(-1);  
   eZplane.Set(3);      eZplane.Reset(-1);  
   INFOpmt.Set(48);     INFOpmt.Reset(0);  
   INFOlayer.Set(6);    INFOlayer.Reset(0);  
1860    //    //
1861  };  };
1862    
# Line 1515  void ToFdEdx::Print(Option_t *option) Line 1868  void ToFdEdx::Print(Option_t *option)
1868    
1869  };  };
1870    
   
1871  //------------------------------------------------------------------------  //------------------------------------------------------------------------
1872  // void ToFdEdx::InitPar(TString parname, TString parfile)  void ToFdEdx::Init(pamela::tof::TofEvent *tofl0)
1873  // {  {
1874  //   // expensive function - call it once/run    //
1875      ToFLevel2 tf;
1876      for (Int_t gg=0; gg<4;gg++){
1877        for (Int_t hh=0; hh<12;hh++){
1878  //   ReadParAtt(            Form("%s/attenuation.txt"              , pardir) );        //          tofinput_.tdc[hh][gg]=tofEvent->tdc[gg][hh];          
1879  //   ReadParPos(            Form("%s/desaturation_position.txt"    , pardir) );        int mm = tf.GetPMTid(gg,hh);        
1880  //   ReadParBBneg(          Form("%s/BetheBloch.txt"               , pardir) );        adc[mm]= (0xFFF & tofl0->adc[gg][hh]); // EM, exclude warning bits
1881  //   ReadParBBpos(          Form("%s/BetheBloch_betagt1.txt"       , pardir) );      };      
1882  //   ReadParDesatBB(        Form("%s/desaturation_beta.txt"        , pardir) );    };
1883      
1884  // };  };
   
1885    
1886  //------------------------------------------------------------------------  //------------------------------------------------------------------------
1887  void ToFdEdx::Process(UInt_t atime, Float_t betamean, Float_t *xtr_tof, Float_t *ytr_tof, pamela::tof::TofEvent *tofl0 )  void ToFdEdx::Init(Int_t gg, Int_t hh, Float_t adce)
1888  {  {
1889      //
1890      ToFLevel2 tf;
1891      //  for (Int_t gg=0; gg<4;gg++){
1892      //    for (Int_t hh=0; hh<12;hh++){
1893      int mm = tf.GetPMTid(gg,hh);    
1894      adc[mm]=adce;
1895      
1896    };
1897    //------------------------------------------------------------------------
1898    void ToFdEdx::Process(UInt_t atime, Float_t betamean, Float_t *xtr_tof, Float_t *ytr_tof, Int_t exitat)
1899    {
1900      bool debug = false;
1901      if ( debug ) printf(" INSIDE TOFDEDX PROCESS \n");
1902    // the parameters should be already initialised by InitPar()    // the parameters should be already initialised by InitPar()
1903      //  printf(" in process \n");
   
1904    Clear();    Clear();
1905    
   
   
   //  Float_t betamean = fabs(trackTRK->GetToFTrack()->beta[12]);  
   
   if(betamean<0.05 || betamean>2){  
     for(int i=0;i<48;i++)INFOpmt[i]=1;  
   }  
   
1906   // define angle:     // define angle:  
1907    double dx   = xtr_tof[1] - xtr_tof[5];    double dx   = xtr_tof[1] - xtr_tof[5];
1908    double dy   = ytr_tof[0] - ytr_tof[4];    double dy   = ytr_tof[0] - ytr_tof[4];
1909    double dr   = sqrt(dx*dx+dy*dy);    double dr   = sqrt(dx*dx+dy*dy);
1910    double theta=atan(dr/76.81);    double theta=atan(dr/76.81);
1911      //
1912      if ( xtr_tof[1] > 99. ||  xtr_tof[5] > 99. || ytr_tof[0] > 99. ||  ytr_tof[4] > 99. ) theta = 0.;
1913      for (Int_t ii=0; ii<6; ii++){
1914    //  TArrayF adc;      if ( xtr_tof[ii] > 99. ) xtr_tof[ii] = 0.;
1915    Float_t adc[48];      if ( ytr_tof[ii] > 99. ) ytr_tof[ii] = 0.;
   
   ToFLevel2 tf;  
   
   for (Int_t gg=0; gg<4;gg++){  
     for (Int_t hh=0; hh<12;hh++){  
       //          tofinput_.tdc[hh][gg]=tofEvent->tdc[gg][hh];            
       int mm = tf.GetPMTid(gg,hh);          
       adc[mm]=tofl0->adc[gg][hh];  
     };        
1916    };    };
1917        //
1918        if ( debug ) printf(" theta %f \n",theta);
1919        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]);
1920        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]);
1921      //--------------------- TABLE OF PERIODS WITH HV PROBLEMS ----------------------------
1922      
1923      int Aconn=conn[0];    // PMT 0,20,22,24
1924      int Bconn=conn[1];    // PMT 6,12,26,34
1925      int Cconn=conn[2];    // PMT 4,14,28,32
1926      int Dconn=conn[3];    // PMT 2,8,10,30
1927      int Econn=conn[4];    // PMT 42,43,44,47
1928      int Fconn=conn[5];    // PMT 7,19,23,27
1929      int Gconn=conn[6];    // PMT 3,11,25,33
1930      int Hconn=conn[7];    // PMT 1,9,13,21
1931      int Iconn=conn[8];    // PMT 5,29,31,35
1932      int Lconn=conn[9];    // PMT 37,40,45,46
1933      int Mconn=conn[10];    // PMT 15,16,17,18
1934      int Nconn=conn[11];    // PMT 36,38,39,41
1935      if( false ) cout << Gconn << Iconn << Lconn <<endl; // to avoid compilation warnings
1936        
1937      //  printf(" size %i \n",eDEDXpmt.GetSize());
1938    for( int ii=0; ii<48; ii++ ) {    for( int ii=0; ii<48; ii++ ) {
1939      if( adc[ii] >= PMTsat[ii]-5 )  continue;      //
1940      if( adc[ii] <= 0. )            continue;      //    eDEDXpmt.SetAt(-1.,ii);
1941          //    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]);
1942      double adcpC   = f_adcPC( adc[ii] );    // - adc conversion in pC      if ( debug ) printf("II %i adc %f \n",ii,adc[ii]);
1943      double adccorr = adcpC*fabs(cos(theta));  
1944        if( adc[ii] >= 4095. ){
1945           if(adccorr<=0.)           continue;        //      eDEDXpmt[ii] = 0.;
1946          eDEDXpmt->AddAt(0.,ii);
1947          if ( debug ) printf(" %i adc>4095 \n",ii);
1948          continue; // EMILIANO
1949        };
1950    
1951      //--------------------- TABLE OF PERIODS WITH HV PROBLEMS ----------------------------      if( adc[ii] >= (PMTsat[ii]-5.) && adc[ii] < 4095. ){
1952          eDEDXpmt->AddAt(1000.,ii);
1953          if ( debug ) printf(" %i adc> pmtsat && adc<4095 \n",ii);
1954          continue; // EMILIANO
1955        };
1956    
1957      int Aconn=conn[0];    // PMT 0,20,22,24      if( adc[ii] <= 0. ) {
1958      int Bconn=conn[1];    // PMT 6,12,26,34        eDEDXpmt->AddAt(1500.,ii);
1959      int Cconn=conn[2];    // PMT 4,14,28,32        if ( debug ) printf(" %i adc<=0 \n",ii);
1960      int Dconn=conn[3];    // PMT 2,8,10,30        continue;
1961      int Econn=conn[4];    // PMT 42,43,44,47      };
1962      int Fconn=conn[5];    // PMT 7,19,23,27      //
1963      int Gconn=conn[6];    // PMT 3,11,25,33      double adcpC   = f_adcPC( adc[ii] );    // - adc conversion in pC
1964      int Hconn=conn[7];    // PMT 1,9,13,21      if ( exitat == 0 ){
1965      int Iconn=conn[8];    // PMT 5,29,31,35        eDEDXpmt->AddAt((Float_t)adcpC,ii);
1966      int Lconn=conn[9];    // PMT 37,40,45,46        continue;
1967      int Mconn=conn[10];    // PMT 15,16,17,18      }
1968      int Nconn=conn[11];    // PMT 36,38,39,41      //    printf(" e qua? \n");
1969    
1970        double adccorr = adcpC*fabs(cos(theta));    
1971        if ( debug ) printf(" adccorr %f \n",adccorr);
1972        if(adccorr<=0.){
1973          if ( debug ) printf(" %i adccorr<=0 \n",ii);
1974          //      eDEDXpmt->AddAt((Float_t)adcpC,ii);//?
1975          continue;
1976        }
1977        if ( exitat == 1 ){
1978          eDEDXpmt->AddAt((Float_t)adccorr,ii);
1979          continue;
1980        }
1981        //    printf(" e quo? \n");
1982    
1983      //    int standard=0;      //    int standard=0;
     if( false ) cout << Gconn << Iconn << Lconn <<endl;  
1984      int S115B_ok=0;      int S115B_ok=0;
1985      int S115B_break=0;      int S115B_break=0;
1986    
 //   if(atime>=1153660001 && atime<=1154375000)Dconn=1;  
 //     else if(atime>=1155850001 && atime<=1156280000){  
 //       Hconn=1;  
 //       Nconn=1;  
 //     }  
   
 //  else if(atime>=1168490001 && atime<=1168940000)Dconn=1;  
 //     else if(atime>=1168940001 && atime<=1169580000){  
 //       Fconn=1;  
 //       Mconn=1;  
 //     }  
   
 //  else if(atime>=1174665001 && atime<=1175000000)Bconn=1;  
 //     else if(atime>=1176120001 && atime<=1176800000)Hconn=1;  
 //     else if(atime>=1176800001 && atime<=1178330000)Econn=1;  
 //     else if(atime>=1178330001 && atime<=1181322000)Hconn=1;  
 //     else if(atime>=1182100001 && atime<=1183030000)Aconn=1;  
 //     else if(atime>=1184000001 && atime<=1184570000)Hconn=1;  
 //     else if(atime>=1185090001 && atime<=1185212000)Dconn=1;  
 //     else if(atime>=1191100001 && atime<=1191940000)Dconn=1;  
 //     else if(atime>=1196230001 && atime<=1196280000)Hconn=1;  
 //     else if(atime>=1206100001 && atime<=1206375600)Cconn=1;  
 //     else if(atime>=1217989201 && atime<=1218547800)Econn=1;  
 //     else if(atime>=1225789201 && atime<=1226566800)Econn=1;  
 //     else if(atime>=1229400901 && atime<=1229700000)Econn=1;  
 //     else if(atime>=1230318001 && atime<=1230415200)Econn=1;  
 //     else {  
 //       standard=1;  
 //     }  
1987      if(atime<1158720000)S115B_ok=1;      if(atime<1158720000)S115B_ok=1;
1988      else S115B_break=1;      else S115B_break=1;
1989    
1990    
1991   //------------------------------------------------------------------------      //------------------------------------------------------------------------
1992        //    printf(" e qui? \n");
1993  //---------------------------------------------------- Z reconstruction      //---------------------------------------------------- Z reconstruction
1994    
1995  double adcHe, adcnorm, adclin, dEdx, Zeta;      double adcHe, adcnorm, adclin, dEdx;//, Zeta; // EM GCC4.7
1996    
1997   adcHe=-2;      adcHe=-2;
1998   adcnorm=-2;      adcnorm=-2;
1999   adclin=-2;      adclin=-2;
2000   dEdx=-2;      dEdx=-2;
2001   Zeta=-2;      //    Zeta=-2;//EM GCC4.7
2002        Double_t correction = 1.;
   
 //  float ZetaH=-2;  
 //  float dEdxH=-2;  
   
 //  double day = (atime-1150000000)/84600;  
2003    
2004      if(Aconn==1 && (ii==0 || ii==20 || ii==22 || ii==24)){      if(Aconn==1 && (ii==0 || ii==20 || ii==22 || ii==24)){
2005         adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.675;        correction = 1.675;
2006      }      }
2007      else if(Bconn==1 && (ii==6 || ii==12 || ii==26 || ii==34)){      else if(Bconn==1 && (ii==6 || ii==12 || ii==26 || ii==34)){
2008         adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/2.482;        correction = 2.482;
2009      }      }
2010      else if(Cconn==1 && (ii==4 || ii==14 || ii==28 || ii==32)){      else if(Cconn==1 && (ii==4 || ii==14 || ii==28 || ii==32)){
2011        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.464;        correction = 1.464;
2012      }      }
2013      else if(Dconn==1 && (ii==2 || ii==8 || ii==10 || ii==30)){      else if(Dconn==1 && (ii==2 || ii==8 || ii==10 || ii==30)){
2014         adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.995;        correction = 1.995;
2015      }      }
2016      else if(Econn==1 && (ii==42 || ii==43 || ii==44 || ii==47)){      else if(Econn==1 && (ii==42 || ii==43 || ii==44 || ii==47)){
2017         adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.273;        correction = 1.273;
2018      }      }
2019      else if(Fconn==1 && (ii==7 || ii==19 || ii==23 || ii==27)){      else if(Fconn==1 && (ii==7 || ii==19 || ii==23 || ii==27)){
2020         adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.565;        correction = 1.565;
2021      }      }
2022      else if(Mconn==1 && (ii==15 || ii==16 || ii==17 || ii==18)){      else if(Mconn==1 && (ii==15 || ii==16 || ii==17 || ii==18)){
2023         adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.565;        correction = 1.565;
2024      }      }
2025      else if(Nconn==1 && (ii==36 || ii==38 || ii==39 || ii==41)){      else if(Nconn==1 && (ii==36 || ii==38 || ii==39 || ii==41)){
2026         adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.018;        correction = 1.018;
2027      }      }
2028      else if(Hconn==1 && (ii==1 || ii==13 || ii==21 || (ii==9&&S115B_ok==1))){      else if(Hconn==1 && (ii==1 || ii==13 || ii==21 || (ii==9&&S115B_ok==1))){
2029        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.84;        correction = 1.84;
     }  
     else if(S115B_break==1 && ii==9 && Hconn==0){  
        adcHe   = f_att5B( ytr_tof[0] );   //N.B.: this function refers to the Carbon!!!  
2030      }      }
2031      else if(S115B_break==1 && ii==9 && Hconn==1){      else if(S115B_break==1 && ii==9 && Hconn==1){
2032         adcHe   = (f_att5B( ytr_tof[0] ))/1.64;        correction = 1.64;
2033        }
2034        else correction = 1.;
2035        
2036        if( ii==9 && S115B_break==1 ){
2037          adcHe   = f_att5B( ytr_tof[0] )/correction;
2038        } else {
2039          adcHe   = Get_adc_he(ii, xtr_tof, ytr_tof)/correction;
2040        };
2041        if(adcHe<=0){
2042          if ( debug ) printf(" %i adcHe<=0 \n",ii);
2043          //      eDEDXpmt->AddAt((Float_t)adccorr,ii); //?
2044          continue;
2045        }
2046        if ( exitat == 2 ){
2047          if(ii==9 && S115B_break==1)  eDEDXpmt->AddAt(36.*(Float_t)adccorr/adcHe,ii);
2048          else  adclin  = 4.*(Float_t)adccorr/adcHe;
2049          continue;
2050      }      }
     else  adcHe   = Get_adc_he(ii, xtr_tof, ytr_tof);  
   
     if(adcHe<=0)   continue;  
2051    
2052      if(ii==9 && S115B_break==1)  adcnorm = f_pos5B(adccorr);      if(ii==9 && S115B_break==1)  adcnorm = f_pos5B(adccorr);
2053      else adcnorm = f_pos( (parPos[ii]), adccorr);      else adcnorm = f_pos( (parPos[ii]), adccorr);
2054        if(adcnorm<=0){
2055      if(adcnorm<=0) continue;        if ( debug ) printf(" %i adcnorm<=0 \n",ii);
2056          //      eDEDXpmt->AddAt((Float_t)adccorr,ii);//?
2057          continue;
2058        }
2059        if ( debug ) printf(" adcnorm %f \n",adcnorm);
2060    
2061      if(ii==9 && S115B_break==1)  adclin  = 36.*adcnorm/adcHe;      if(ii==9 && S115B_break==1)  adclin  = 36.*adcnorm/adcHe;
2062      else  adclin  = 4.*adcnorm/adcHe;      else  adclin  = 4.*adcnorm/adcHe;
2063        if ( debug ) printf(" adclin %f \n",adclin);
2064      if(adclin<=0)  continue;      if(adclin<=0){
2065          if ( debug ) printf(" %i adclin<=0 \n",ii);
2066          //      eDEDXpmt->AddAt((Float_t)adccorr,ii);//?
2067          continue;
2068        }
2069        if ( exitat == 3 ){
2070          if(ii==9 && S115B_break==1)  eDEDXpmt->AddAt((Float_t)adclin,ii);
2071          else  eDEDXpmt->AddAt((Float_t)adclin,ii);
2072          continue;
2073        }
2074        //
2075        if ( betamean > 99. ){
2076          //      eDEDXpmt.AddAt((Float_t)adclin,ii);
2077          eDEDXpmt->AddAt((Float_t)adclin,ii);
2078          //      printf(" AAPMT IS %i dedx is %f vector is %f \n",ii,adclin,eDEDXpmt[ii]);
2079          if ( debug ) printf(" %i betamean > 99 \n",ii);
2080          continue;
2081        };
2082        //
2083      double dEdxHe=-2;      double dEdxHe=-2;
2084      if(ii==9 && S115B_break==1){      if(ii==9 && S115B_break==1){
2085        if( betamean <1. ) dEdxHe = f_BB5B( betamean );        if( betamean <1. ) dEdxHe = f_BB5B( betamean );
# Line 1709  double adcHe, adcnorm, adclin, dEdx, Zet Line 2088  double adcHe, adcnorm, adclin, dEdx, Zet
2088        if( betamean <1. ) dEdxHe = f_BB( (parBBneg[ii]), betamean );        if( betamean <1. ) dEdxHe = f_BB( (parBBneg[ii]), betamean );
2089        else                       dEdxHe = parBBpos[ii];        else                       dEdxHe = parBBpos[ii];
2090      }      }
   
     if(dEdxHe<=0)  continue;  
   
     if(ii==9 && S115B_break==1)  dEdx = f_desatBB5B( adclin );  
     else  dEdx = f_desatBB((parDesatBB[ii]), adclin );  
   
     if(dEdx<=0)    continue;  
   
     if(ii==9 && S115B_break==1)  Zeta = sqrt(36.*(dEdx/dEdxHe));  
     else  Zeta = sqrt(4.*(dEdx/dEdxHe));  
   
     if(Zeta<=0)    continue;  
   
 //--------------------- TIME DEPENDENCE ----------------------------------  
   
   
 //      TArrayF &binx = TDx[ii];  
 //      TArrayF &biny = TDy[ii];  
 //      for(int k=0; k<200; k++) {  
 //        if (day > binx[k]-2.5 && day<=binx[k]+2.5 && biny[k]>0)  {  
 //       ZetaH=Zeta/biny[k]*6;  
 //       dEdxH=dEdx/(pow(biny[k],2))*36;  
 //        }  
 //      }  
   
 //      if(ZetaH!=-2)eZpmt[ii]=(Float_t)ZetaH;  
 //      else eZpmt[ii]=(Float_t)Zeta;  
   
 //      if(dEdxH!=-2)eDEDXpmt[ii]=(Float_t)dEdxH;  
 //      else eDEDXpmt[ii]=(Float_t)dEdx;  
   
 //      printf("%5d %8.2f %8.2f %8.2f  %8.2f %8.2f  %8.2f %5.4f \n",               ii, adcpC,  adccorr, adcHe, dEdxHe, dEdx, Zeta, betamean );  
   
     eZpmt[ii]=(Float_t)Zeta;  
     eDEDXpmt[ii]=(Float_t)dEdx;  
   
   
  }  //end loop on 48 PMT  
   
 //---------------------------------------------------  paddle + layer --------------------  
   
   for(int j=0;j<48;j++){  
     int k=100;  
     if(j%2==0 || j==0)k=j/2;  
       
     double zpdl=-1;  
       
     if((j%2==0 || j==0) && eZpmt[j]!=-1 && eZpmt[j+1]!=-1){  
       zpdl=0.5*(eZpmt[j]+eZpmt[j+1]);  
     }else if((j%2==0 || j==0) && eZpmt[j]!=-1 && eZpmt[j+1]==-1){  
       zpdl=eZpmt[j];  
     }else if((j%2==0 || j==0) && eZpmt[j]==-1 && eZpmt[j+1]!=-1){  
       zpdl=eZpmt[j+1];  
     }  
       
     if(j%2==0 || j==0)eZpad[k]= (Float_t)zpdl;  
       
     if((j%2==0 || j==0)&&eZpad[k]!=-1){  
       if(k>=0&&k<8)eZlayer[0]=eZpad[k];  
       if(k>=8&&k<14)eZlayer[1]=eZpad[k];  
       if(k>=14&&k<16)eZlayer[2]=eZpad[k];  
       if(k>=16&&k<18)eZlayer[3]=eZpad[k];  
       if(k>=18&&k<21)eZlayer[4]=eZpad[k];  
       if(k>=21)eZlayer[5]=eZpad[k];  
     }  
   
     if(eZlayer[0]!=-1&&eZlayer[1]!=-1&&fabs(eZlayer[0]-eZlayer[1])<1.5)eZplane[0]=0.5*(eZlayer[0]+eZlayer[1]);  
     else if(eZlayer[0]!=-1&&eZlayer[1]==-1)eZplane[0]=eZlayer[0];  
     else if(eZlayer[1]!=-1&&eZlayer[0]==-1)eZplane[0]=eZlayer[1];  
   
     if(eZlayer[2]!=-1&&eZlayer[3]!=-1&&fabs(eZlayer[2]-eZlayer[3])<1.5)eZplane[1]=0.5*(eZlayer[2]+eZlayer[3]);  
     else if(eZlayer[2]!=-1&&eZlayer[3]==-1)eZplane[1]=eZlayer[2];  
     else if(eZlayer[3]!=-1&&eZlayer[2]==-1)eZplane[1]=eZlayer[3];  
   
     if(eZlayer[4]!=-1&&eZlayer[5]!=-1&&fabs(eZlayer[4]-eZlayer[5])<1.5)eZplane[2]=0.5*(eZlayer[4]+eZlayer[5]);  
     else if(eZlayer[4]!=-1&&eZlayer[5]==-1)eZplane[2]=eZlayer[4];  
     else if(eZlayer[5]!=-1&&eZlayer[4]==-1)eZplane[2]=eZlayer[5];  
   
   }  
   
   for(int jj=0;jj<48;jj++){  
     int k=100;  
     if(jj%2==0 || jj==0)k=jj/2;  
2091            
2092      double dedxpdl=-1;      if ( debug ) printf(" dEdxHe %f \n",dEdxHe);
2093            
2094      if((jj%2==0 || jj==0) && eDEDXpmt[jj]!=-1 && eDEDXpmt[jj+1]!=-1){      if(dEdxHe<=0){
2095        dedxpdl=0.5*(eDEDXpmt[jj]+eDEDXpmt[jj+1]);        eDEDXpmt->AddAt((Float_t)adclin,ii);
2096      }else if((jj%2==0 || jj==0) && eDEDXpmt[jj]!=-1 && eDEDXpmt[jj+1]==-1){        if ( debug ) printf(" %i dEdxHe<=0 \n",ii);
2097        dedxpdl=eDEDXpmt[jj];        continue;
2098      }else if((jj%2==0 || jj==0) && eDEDXpmt[jj]==-1 && eDEDXpmt[jj+1]!=-1){      };
       dedxpdl=eDEDXpmt[jj+1];  
     }  
       
     if(jj%2==0 || jj==0)eDEDXpad[k]= (Float_t)dedxpdl;  
       
     if((jj%2==0 || jj==0)&&eDEDXpad[k]!=-1){  
       if(k>=0&&k<8)eDEDXlayer[0]=eDEDXpad[k];  
       if(k>=8&&k<14)eDEDXlayer[1]=eDEDXpad[k];  
       if(k>=14&&k<16)eDEDXlayer[2]=eDEDXpad[k];  
       if(k>=16&&k<18)eDEDXlayer[3]=eDEDXpad[k];  
       if(k>=18&&k<21)eDEDXlayer[4]=eDEDXpad[k];  
       if(k>=21)eDEDXlayer[5]=eDEDXpad[k];  
     }  
2099    
2100      if(eDEDXlayer[0]!=-1&&eDEDXlayer[1]!=-1&&fabs(eDEDXlayer[0]-eDEDXlayer[1])<10)eDEDXplane[0]=0.5*(eDEDXlayer[0]+eDEDXlayer[1]);      if(ii==9 && S115B_break==1)  dEdx = f_desatBB5B( adclin );
2101      else if(eDEDXlayer[0]!=-1&&eDEDXlayer[1]==-1)eDEDXplane[0]=eDEDXlayer[0];      else  dEdx = f_desatBB((parDesatBB[ii]), adclin );
     else if(eDEDXlayer[1]!=-1&&eDEDXlayer[0]==-1)eDEDXplane[0]=eDEDXlayer[1];  
2102    
2103      if(eDEDXlayer[2]!=-1&&eDEDXlayer[3]!=-1&&fabs(eDEDXlayer[2]-eDEDXlayer[3])<10)eDEDXplane[1]=0.5*(eDEDXlayer[2]+eDEDXlayer[3]);      if(dEdx<=0){
2104      else if(eDEDXlayer[2]!=-1&&eDEDXlayer[3]==-1)eDEDXplane[1]=eDEDXlayer[2];        eDEDXpmt->AddAt((Float_t)adclin,ii);
2105      else if(eDEDXlayer[3]!=-1&&eDEDXlayer[2]==-1)eDEDXplane[1]=eDEDXlayer[3];        if ( debug ) printf(" %i dEdx<=0 \n",ii);
2106          continue;
2107        };
2108    
2109      if(eDEDXlayer[4]!=-1&&eDEDXlayer[5]!=-1&&fabs(eDEDXlayer[4]-eDEDXlayer[5])<10)eDEDXplane[2]=0.5*(eDEDXlayer[4]+eDEDXlayer[5]);      if ( debug ) printf(" dEdx %f \n",dEdx);
2110      else if(eDEDXlayer[4]!=-1&&eDEDXlayer[5]==-1)eDEDXplane[2]=eDEDXlayer[4];      eDEDXpmt->AddAt((Float_t)dEdx,ii);
2111      else if(eDEDXlayer[5]!=-1&&eDEDXlayer[4]==-1)eDEDXplane[2]=eDEDXlayer[5];      //    eDEDXpmt.AddAt((Float_t)dEdx,ii);
2112    
2113    }      //    printf(" PMT IS %i dedx is %f vector is %f \n",ii,dEdx,eDEDXpmt[ii]);
     
2114    
2115      }  //end loop on 48 PMT
2116    
2117  };  };
2118    
2119    
2120  //------------------------------------------------------------------------  //------------------------------------------------------------------------
 void ToFdEdx::PrintTD()  
 {  
   for(int i=0; i<48; i++) {    
     TArrayF &binx = TDx[i];  
     TArrayF &biny = TDy[i];  
     for(int k=0; k<200; k++) {  // bin temporali  
       printf("%d %d %f %f", i,k, binx[k], biny[k]);  
         
     }  
   }  
 }  
   
   
 //------------------------------------------------------------------------  
2121  void ToFdEdx::Define_PMTsat()  void ToFdEdx::Define_PMTsat()
2122  {  {
2123    Float_t  sat[48] = {    Float_t  sat[48] = {
# Line 1861  void ToFdEdx::Define_PMTsat() Line 2131  void ToFdEdx::Define_PMTsat()
2131  }  }
2132    
2133  //------------------------------------------------------------------------  //------------------------------------------------------------------------
 // void ToFdEdx::ReadParTD( Int_t ipmt, const char *fname )  
 // {  
 //   printf("read %s\n",fname);  
 //   if(ipmt<0)  return;  
 //   if(ipmt>47) return;  
 //   FILE *fattin = fopen( fname , "r" );  
 //   Float_t yTD[200],xTD[200];  
 //   for(int j=0;j<200;j++){  
 //     float x,y,ym,e;  
 //     if(fscanf(fattin,"%f %f %f %f",  
 //            &x, &y, &ym, &e )!=4) break;  
 //     xTD[j]=x;  
 //     if(ym>0&&fabs(y-ym)>1)  yTD[j]=ym;  
 //     else                    yTD[j]=y;  
 //   }  
 //   TDx[ipmt].Set(200,xTD);  
 //   TDy[ipmt].Set(200,yTD);  
 //   fclose(fattin);  
 // }  
   
 //------------------------------------------------------------------------  
2134  void ToFdEdx::ReadParBBpos( const char *fname )  void ToFdEdx::ReadParBBpos( const char *fname )
2135  {  {
2136    printf("read %s\n",fname);    //  printf("read %s\n",fname);
2137    parBBpos.Set(48);    parBBpos.Set(48);
2138    FILE *fattin = fopen( fname , "r" );    FILE *fattin = fopen( fname , "r" );
2139    for (int i=0; i<48; i++) {    for (int i=0; i<48; i++) {
# Line 1900  void ToFdEdx::ReadParBBpos( const char * Line 2149  void ToFdEdx::ReadParBBpos( const char *
2149  //------------------------------------------------------------------------  //------------------------------------------------------------------------
2150  void ToFdEdx::ReadParDesatBB( const char *fname )  void ToFdEdx::ReadParDesatBB( const char *fname )
2151  {  {
2152    printf("read %s\n",fname);    //  printf("read %s\n",fname);
2153    FILE *fattin = fopen( fname , "r" );    FILE *fattin = fopen( fname , "r" );
2154    for (int i=0; i<48; i++) {    for (int i=0; i<48; i++) {
2155      int   tid=0;      int   tid=0;
# Line 1917  void ToFdEdx::ReadParDesatBB( const char Line 2166  void ToFdEdx::ReadParDesatBB( const char
2166  void ToFdEdx::ReadParBBneg( const char *fname )  void ToFdEdx::ReadParBBneg( const char *fname )
2167    
2168  {  {
2169    printf("read %s\n",fname);    //  printf("read %s\n",fname);
2170    FILE *fattin = fopen( fname , "r" );    FILE *fattin = fopen( fname , "r" );
2171    for (int i=0; i<48; i++) {    for (int i=0; i<48; i++) {
2172      int   tid=0;      int   tid=0;
# Line 1932  void ToFdEdx::ReadParBBneg( const char * Line 2181  void ToFdEdx::ReadParBBneg( const char *
2181  //------------------------------------------------------------------------  //------------------------------------------------------------------------
2182  void ToFdEdx::ReadParPos( const char *fname )  void ToFdEdx::ReadParPos( const char *fname )
2183  {  {
2184    printf("read %s\n",fname);    //  printf("read %s\n",fname);
2185    FILE *fattin = fopen( fname , "r" );    FILE *fattin = fopen( fname , "r" );
2186    for (int i=0; i<48; i++) {    for (int i=0; i<48; i++) {
2187      int   tid=0;      int   tid=0;
# Line 1947  void ToFdEdx::ReadParPos( const char *fn Line 2196  void ToFdEdx::ReadParPos( const char *fn
2196  //------------------------------------------------------------------------  //------------------------------------------------------------------------
2197  void ToFdEdx::ReadParAtt( const char *fname )  void ToFdEdx::ReadParAtt( const char *fname )
2198  {  {
2199    printf("read %s\n",fname);    //  printf("read %s\n",fname);
2200    FILE *fattin = fopen( fname , "r" );    FILE *fattin = fopen( fname , "r" );
2201    for (int i=0; i<48; i++) {    for (int i=0; i<48; i++) {
2202      int   tid=0;      int   tid=0;
# Line 2020  float ToFdEdx::Get_adc_he( int id, float Line 2269  float ToFdEdx::Get_adc_he( int id, float
2269    //             pl_x - coord x of the tof plane    //             pl_x - coord x of the tof plane
2270    //             pl_y - coord y    //             pl_y - coord y
2271    
2272     adc_he = 0;    adc_he = 0;
2273    if( eGeom.GetXY(id)==1 )  adc_he = f_att( (parAtt[id]), pl_x[eGeom.GetPlane(id)] );    if( eGeom.GetXY(id)==1 )  adc_he = f_att( (parAtt[id]), pl_x[eGeom.GetPlane(id)] );
2274    if( eGeom.GetXY(id)==2 )  adc_he = f_att( (parAtt[id]), pl_y[eGeom.GetPlane(id)] );    if( eGeom.GetXY(id)==2 )  adc_he = f_att( (parAtt[id]), pl_y[eGeom.GetPlane(id)] );
2275    return adc_he;    return adc_he;
# Line 2055  double ToFdEdx::f_desatBB5B( float x ) Line 2304  double ToFdEdx::f_desatBB5B( float x )
2304      0.009*x*x;      0.009*x*x;
2305  }  }
2306    
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   

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

  ViewVC Help
Powered by ViewVC 1.1.23