/[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.31 by mocchiut, Fri Feb 5 12:51:44 2010 UTC revision 1.38 by mocchiut, Thu Jan 16 15:29:33 2014 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 118  void ToFLevel2::Clear(Option_t *t){ Line 120  void ToFLevel2::Clear(Option_t *t){
120    if(PMT)PMT->Delete(); //ELENA    if(PMT)PMT->Delete(); //ELENA
121    memset(tof_j_flag, 0, 6*sizeof(Int_t));    memset(tof_j_flag, 0, 6*sizeof(Int_t));
122    unpackError = 0;    unpackError = 0;
123      unpackWarning = 0;
124    //    //
125  };  };
126    
# Line 221  Int_t ToFLevel2::GetNHitPaddles(Int_t pl Line 224  Int_t ToFLevel2::GetNHitPaddles(Int_t pl
224      return npad;      return npad;
225  };  };
226    
227    /**
228     * Method to get the number of hit paddles on a ToF plane.
229     * @param plane Plane ID (11, 12, 21, 22, 31, 32) or Plane index (0,1,2,3,4,5).
230     */
231    Int_t ToFLevel2::GetTrueNHitPaddles(Int_t plane){
232        Int_t npad=0;
233        TClonesArray* Pmt = this->PMT;
234        int paddle[24];
235        memset(paddle,0, 24*sizeof(int));
236        for(int i=0; i<Pmt->GetEntries(); i++) {  //loop per vedere quale TOF è colpito
237          ToFPMT* pmthit = (ToFPMT*)Pmt->At(i);
238          int pplane = -1;
239          int ppaddle = -1;
240          GetPMTPaddle(pmthit->pmt_id,pplane,ppaddle);
241          if ( pplane == plane ) paddle[ppaddle]++;
242        }
243        for(int i=0;i<24;i++) if ( paddle[i]>0 ) npad++;
244    
245        return npad;
246    };
247    
248  //wm Nov 08  //wm Nov 08
249  //gf Apr 07  //gf Apr 07
250  /**  /**
# Line 236  Int_t ToFLevel2::GetNHitPaddles(Int_t pl Line 260  Int_t ToFLevel2::GetNHitPaddles(Int_t pl
260   * @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; )
261   */   */
262  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){
263      //  printf("fiffi\n");
264    Float_t dedx = 0.;    Float_t dedx = 0.;
265    Float_t PadEdx =0.;    Float_t PadEdx =0.;
266    Int_t SatWarning;    Int_t SatWarning;
# Line 245  Float_t ToFLevel2::GetdEdx(Int_t notrack Line 269  Float_t ToFLevel2::GetdEdx(Int_t notrack
269    ToFTrkVar *trk = GetToFTrkVar(notrack);    ToFTrkVar *trk = GetToFTrkVar(notrack);
270    if(!trk) return 0; //ELENA    if(!trk) return 0; //ELENA
271    //    //
272    for (Int_t ii=0; ii<GetNPaddle(plane); ii++){    if ( trk->trkseqno == -1 ){ //standalone, only paddles along the track, or about...
273      Int_t paddleid=ii;      //    printf("ciccio\n");
274      pad = GetPaddleid(plane,paddleid);      Float_t xleft=0;
275      GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning);      Float_t xright=0;
276      dedx += PadEdx;      Float_t yleft=0;
277    };      Float_t yright=0;
278        Float_t xtof_temp[6]={100.,100.,100.,100.,100.,100.};
279        Float_t ytof_temp[6]={100.,100.,100.,100.,100.,100.};
280        ToFTrkVar *t_tof = trk;
281        
282        xtof_temp[0]=t_tof->xtofpos[0];
283        ytof_temp[0]=t_tof->ytofpos[0];
284        xtof_temp[1]=t_tof->xtofpos[0];
285        ytof_temp[1]=t_tof->ytofpos[0];
286    
287        xtof_temp[2]=t_tof->xtofpos[1];
288        ytof_temp[2]=t_tof->ytofpos[1];
289        xtof_temp[3]=t_tof->xtofpos[1];
290        ytof_temp[3]=t_tof->ytofpos[1];
291    
292        xtof_temp[4]=t_tof->xtofpos[2];
293        ytof_temp[4]=t_tof->ytofpos[2];
294        xtof_temp[5]=t_tof->xtofpos[2];
295        ytof_temp[5]=t_tof->ytofpos[2];
296    
297        if(t_tof->xtofpos[0]<100. && t_tof->ytofpos[0]<100.){
298          xtof_temp[1]=t_tof->xtofpos[0];
299          ytof_temp[0]=t_tof->ytofpos[0];
300        }else if(t_tof->xtofpos[0]>=100. && t_tof->ytofpos[0]<100.){
301          ytof_temp[0]=t_tof->ytofpos[0];
302          this->GetPaddleGeometry(0,(Int_t)log2(this->tof_j_flag[0]),xleft, xright, yleft, yright);
303          xtof_temp[1]=xleft+2.55;
304        }else if(t_tof->ytofpos[0]>=100. && t_tof->xtofpos[0]<100.){
305          xtof_temp[1]=t_tof->xtofpos[0];
306          this->GetPaddleGeometry(1,(Int_t)log2(this->tof_j_flag[1]),xleft, xright, yleft, yright);
307          ytof_temp[0]=yleft+2.75;
308        }
309        
310        if(t_tof->xtofpos[1]<100. && t_tof->ytofpos[1]<100.){
311          xtof_temp[2]=t_tof->xtofpos[1];
312          ytof_temp[3]=t_tof->ytofpos[1];
313        }else if(t_tof->xtofpos[1]>=100. && t_tof->ytofpos[1]<100.){
314          ytof_temp[3]=t_tof->ytofpos[1];
315          this->GetPaddleGeometry(3,(Int_t)log2(this->tof_j_flag[3]),xleft, xright, yleft, yright);
316          xtof_temp[2]=xleft+4.5;
317        }else if(t_tof->ytofpos[1]>=100. && t_tof->xtofpos[1]<100.){
318          xtof_temp[2]=t_tof->xtofpos[1];
319          this->GetPaddleGeometry(2,(Int_t)log2(this->tof_j_flag[2]),xleft, xright, yleft, yright);
320          ytof_temp[3]=yleft+3.75;
321        }
322        
323        if(t_tof->xtofpos[2]<100. && t_tof->ytofpos[2]<100.){
324          xtof_temp[5]=t_tof->xtofpos[2];
325          ytof_temp[4]=t_tof->ytofpos[2];
326        }else if(t_tof->xtofpos[2]>=100. && t_tof->ytofpos[2]<100.){
327          ytof_temp[4]=t_tof->ytofpos[2];
328          this->GetPaddleGeometry(4,(Int_t)log2(this->tof_j_flag[4]),xleft, xright, yleft, yright);
329          xtof_temp[5]=xleft+3;
330        }else if(t_tof->ytofpos[2]>=100. && t_tof->xtofpos[2]<100.){
331          xtof_temp[5]=t_tof->xtofpos[2];
332          this->GetPaddleGeometry(5,(Int_t)log2(this->tof_j_flag[5]),xleft, xright, yleft, yright);
333          ytof_temp[4]=yleft+2.5;
334        }
335    
336        if ( (xtof_temp[0])> 17.85 && fabs(xtof_temp[0])<17.85+4. ) xtof_temp[0] =17.84;
337        if ( (xtof_temp[1])> 17.85 && fabs(xtof_temp[1])<17.85+4. ) xtof_temp[1] =17.84;
338        if ( (ytof_temp[0])> 13.75 && fabs(ytof_temp[0])<13.75+4. ) ytof_temp[0] =13.74;
339        if ( (ytof_temp[1])> 13.75 && fabs(ytof_temp[1])<13.75+4. ) ytof_temp[1] =13.74;
340        if ( (xtof_temp[0])< -17.85 && fabs(xtof_temp[0])>-(17.85+4.) ) xtof_temp[0] =-17.84;
341        if ( (xtof_temp[1])< -17.85 && fabs(xtof_temp[1])>-(17.85+4.) ) xtof_temp[1] =-17.84;
342        if ( (ytof_temp[0])< -13.75 && fabs(ytof_temp[0])>-(13.75+4.) ) ytof_temp[0] =-13.74;
343        if ( (ytof_temp[1])< -13.75 && fabs(ytof_temp[1])>-(13.75+4.) ) ytof_temp[1] =-13.74;
344    
345        if ( (xtof_temp[2])> 4.5 && (xtof_temp[2])<4.5+4. ) xtof_temp[2] =4.4;
346        if ( (xtof_temp[3])> 4.45 && (xtof_temp[3])<4.5+4. ) xtof_temp[3] =4.4;
347        if ( (ytof_temp[2])> 3.75 && (ytof_temp[2])<3.75+4. ) ytof_temp[2] =3.74;
348        if ( (ytof_temp[3])> 3.75 && (ytof_temp[3])<3.75+4. ) ytof_temp[3] =3.74;
349        if ( (xtof_temp[2])< -4.5 && (xtof_temp[2])>-(4.5+4.) ) xtof_temp[2] =-4.4;
350        if ( (xtof_temp[3])< -4.45 && (xtof_temp[3])>-(4.5+4.) ) xtof_temp[3] =-4.4;
351        if ( (ytof_temp[2])< -3.75 && (ytof_temp[2])>-(3.75+4.) ) ytof_temp[2] =-3.74;
352        if ( (ytof_temp[3])< -3.75 && (ytof_temp[3])>-(3.75+4.) ) ytof_temp[3] =-3.74;
353    
354        if ( (xtof_temp[4])> 6. && (xtof_temp[4])<6.+4. ) xtof_temp[2] =5.9;
355        if ( (xtof_temp[5])> 6. && (xtof_temp[5])<6.+4. ) xtof_temp[3] =5.9;
356        if ( (ytof_temp[4])> 5. && (ytof_temp[4])<5.+4. ) ytof_temp[2] =4.9;
357        if ( (ytof_temp[5])> 5. && (ytof_temp[5])<5.+4. ) ytof_temp[3] =4.9;
358        if ( (xtof_temp[4])< -6. && (xtof_temp[4])>-(6.+4.) ) xtof_temp[2] =-5.9;
359        if ( (xtof_temp[5])< -6. && (xtof_temp[5])>-(6.+4.) ) xtof_temp[3] =-5.9;
360        if ( (ytof_temp[4])< -5. && (ytof_temp[4])>-(5.+4.) ) ytof_temp[2] =-4.9;
361        if ( (ytof_temp[5])< -5. && (ytof_temp[5])>-(5.+4.) ) ytof_temp[3] =-4.9;
362    
363    
364        for (Int_t ii=0; ii<GetNPaddle(plane); ii++){
365          Int_t paddleid=ii;
366          pad = GetPaddleid(plane,paddleid);
367          Int_t IpaddleT=-1;
368          IpaddleT=this->GetPaddleIdOfTrack(xtof_temp[plane],ytof_temp[plane], plane,0.0);
369    //      printf("SSS %i %i %f %f  %f %f \n",IpaddleT,paddleid,xtof_temp[plane],ytof_temp[plane],t_tof->xtofpos[plane],t_tof->ytofpos[plane]);
370          //      if ( IpaddleT == paddleid || IpaddleT-1 == paddleid || IpaddleT+1 == paddleid ){
371          if ( IpaddleT == paddleid || GetTrueNHitPaddles(plane) == 1 ){
372            //IpaddleT-1 == paddleid || IpaddleT+1 == paddleid ){
373            GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning);
374            dedx += PadEdx;
375          }
376        };
377      } else {
378        for (Int_t ii=0; ii<GetNPaddle(plane); ii++){
379          Int_t paddleid=ii;
380          pad = GetPaddleid(plane,paddleid);
381          GetdEdxPaddle(notrack, pad, adcfl, PadEdx, SatWarning);
382          dedx += PadEdx;
383    //      printf("TTT %i %i %f\n",paddleid,plane,PadEdx);
384        };
385      }
386    //    //
387    return(dedx);    return(dedx);
388  };  };
# Line 404  void ToFLevel2::GetPMTIndex(Int_t ind, I Line 536  void ToFLevel2::GetPMTIndex(Int_t ind, I
536   */   */
537  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){
538    
539  /*    /*
540  Float_t  PMTsat[48] = {      Float_t  PMTsat[48] = {
541  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,
542  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,
543  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,
544  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,
545  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,
546  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 } ;
547  */    */
548    
549  // new values from Napoli dec 2008    // new values from Napoli dec 2008
550  Float_t  PMTsat[48] = {    Float_t  PMTsat[48] = {
551  3176.35,3178.19,3167.38,3099.73,3117.00,3126.29,3111.44,3092.27,      3176.35,3178.19,3167.38,3099.73,3117.00,3126.29,3111.44,3092.27,
552  3146.48,3094.41,3132.13,3115.37,3099.32,3110.97,3111.80,3143.14,      3146.48,3094.41,3132.13,3115.37,3099.32,3110.97,3111.80,3143.14,
553  3106.72,3153.44,3136.00,3188.96,3104.73,3140.45,3073.18,3106.62,      3106.72,3153.44,3136.00,3188.96,3104.73,3140.45,3073.18,3106.62,
554  3112.48,3146.92,3127.24,3136.52,3109.59,3112.89,3045.15,3147.26,      3112.48,3146.92,3127.24,3136.52,3109.59,3112.89,3045.15,3147.26,
555  3095.92,3121.05,3083.25,3123.62,3150.92,3125.30,3067.60,3160.18,      3095.92,3121.05,3083.25,3123.62,3150.92,3125.30,3067.60,3160.18,
556  3119.36,3108.92,3164.77,3133.64,3111.47,3131.98,3128.87,3135.56 };      3119.36,3108.92,3164.77,3133.64,3111.47,3131.98,3128.87,3135.56 };
557    
558  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
559    
560    
561    PadEdx = 0.;    PadEdx = 0.;
562  //  SatWarning = 1000;    //  SatWarning = 1000;
563    SatWarning = 0;   // 0=good, increase for each bad PMT    SatWarning = 0;   // 0=good, increase for each bad PMT
564    
565    Float_t dEdx[48] = {0};    Float_t dEdx[48] = {0};
# Line 474  for (Int_t i=0; i<48;i++) PMTsat[i] = PM Line 606  for (Int_t i=0; i<48;i++) PMTsat[i] = PM
606    }    }
607    
608    
609  //  if( adcraw[pmtleft] >3000 || adcraw[pmtright] >3000)SatWarning=1;  //old version    //  if( adcraw[pmtleft] >3000 || adcraw[pmtright] >3000)SatWarning=1;  //old version
610    
611  // Increase SatWarning Counter for each PMT>Sat    // Increase SatWarning Counter for each PMT>Sat
612    if( adcraw[pmtleft] > PMTsat[pmtleft])SatWarning++;      if( adcraw[pmtleft] > PMTsat[pmtleft])SatWarning++;  
613    if( adcraw[pmtright] > PMTsat[pmtright])SatWarning++;    if( adcraw[pmtright] > PMTsat[pmtright])SatWarning++;
614    
615  // if ADC  > sat set dEdx=1000    // if ADC  > sat set dEdx=1000
616    if( adcraw[pmtleft] > PMTsat[pmtleft]) dEdx[pmtleft] = 1000.;    if( adcraw[pmtleft] > PMTsat[pmtleft]) dEdx[pmtleft] = 1000.;
617    if( adcraw[pmtright] > PMTsat[pmtright]) dEdx[pmtright] = 1000. ;    if( adcraw[pmtright] > PMTsat[pmtright]) dEdx[pmtright] = 1000. ;
618    
619  // 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
620    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;
621    if(dEdx[pmtleft]==1000 && dEdx[pmtright]<1000) PadEdx = dEdx[pmtright];      if(dEdx[pmtleft]==1000 && dEdx[pmtright]<1000) PadEdx = dEdx[pmtright];  
622    if(dEdx[pmtleft]<1000 && dEdx[pmtright]==1000) PadEdx = dEdx[pmtleft];    if(dEdx[pmtleft]<1000 && dEdx[pmtright]==1000) PadEdx = dEdx[pmtleft];
# Line 1416  Int_t ToFLevel2::Process(TrkLevel2 *trk, Line 1548  Int_t ToFLevel2::Process(TrkLevel2 *trk,
1548  //  return(0);  //  return(0);
1549  }  }
1550    
1551    bool ToFLevel2::bit(int decimal, char pos){
1552      return( (decimal>>pos)%2 );
1553    }
1554    
1555    bool ToFLevel2::checkPMT(TString givenpmt){
1556      TClonesArray* Pmt = this->PMT;
1557      //  printf(" ou %s entries %i \n",givenpmt.Data(),Pmt->GetEntries());
1558      for(int i=0; i<Pmt->GetEntries(); i++) {  
1559        ToFPMT* pmthit = (ToFPMT*)Pmt->At(i);
1560        TString pmtname = this->GetPMTName(pmthit->pmt_id);
1561        //    printf(" name %s \n",pmtname.Data());
1562        if ( !strcmp(pmtname.Data(),givenpmt.Data()) )
1563          return true;
1564      }
1565      //  printf(" PMT %s missing \n",givenpmt.Data());
1566      return false;
1567    }
1568    
1569    bool ToFLevel2::checkPMTpatternPMThit(TrigLevel2 *trg, int &pmtpattern, int &pmtnosignal){
1570      UInt_t *patterntrig = trg->patterntrig;
1571      pmtpattern = 0;
1572      pmtnosignal = 0;
1573      bool good = true;
1574      //S3
1575      if ( this->bit(patterntrig[2],0) ){ pmtpattern++;  if ( !this->checkPMT("S31_1A")){ pmtnosignal++; good = false;}}
1576      if ( this->bit(patterntrig[2],1) ){ pmtpattern++;  if ( !this->checkPMT("S31_2A")){ pmtnosignal++; good = false;}}
1577      if ( this->bit(patterntrig[2],2) ){ pmtpattern++;  if ( !this->checkPMT("S31_3A")){ pmtnosignal++; good = false;}}
1578      if ( this->bit(patterntrig[2],3) ){ pmtpattern++;  if ( !this->checkPMT("S31_1B")){ pmtnosignal++; good = false;}}
1579      if ( this->bit(patterntrig[2],4) ){ pmtpattern++;  if ( !this->checkPMT("S31_2B")){ pmtnosignal++; good = false;}}
1580      if ( this->bit(patterntrig[2],5) ){ pmtpattern++;  if ( !this->checkPMT("S31_3B")){ pmtnosignal++; good = false;}}      
1581      if ( this->bit(patterntrig[2],6) ){ pmtpattern++;  if ( !this->checkPMT("S32_1A")){ pmtnosignal++; good = false;}}
1582      if ( this->bit(patterntrig[2],7) ){ pmtpattern++;  if ( !this->checkPMT("S32_2A")){ pmtnosignal++; good = false;}}
1583      if ( this->bit(patterntrig[2],8) ){ pmtpattern++;  if ( !this->checkPMT("S32_3A")){ pmtnosignal++; good = false;}}
1584      if ( this->bit(patterntrig[2],9) ){ pmtpattern++;  if ( !this->checkPMT("S32_1B")){ pmtnosignal++; good = false;}}
1585      if ( this->bit(patterntrig[2],10) ){ pmtpattern++;  if ( !this->checkPMT("S32_2B")){ pmtnosignal++; good = false;}}
1586      if ( this->bit(patterntrig[2],11) ){ pmtpattern++;  if ( !this->checkPMT("S32_3B")){ pmtnosignal++; good = false;}}      
1587      //S2
1588      if ( this->bit(patterntrig[3],0) ){ pmtpattern++;  if ( !this->checkPMT("S21_1A")){ pmtnosignal++; good = false;}}
1589      if ( this->bit(patterntrig[3],1) ){ pmtpattern++;  if ( !this->checkPMT("S21_2A")){ pmtnosignal++; good = false;}}
1590      if ( this->bit(patterntrig[3],2) ){ pmtpattern++;  if ( !this->checkPMT("S21_1B")){ pmtnosignal++; good = false;}}
1591      if ( this->bit(patterntrig[3],3) ){ pmtpattern++;  if ( !this->checkPMT("S21_2B")){ pmtnosignal++; good = false;}}      
1592      if ( this->bit(patterntrig[3],4) ){ pmtpattern++;  if ( !this->checkPMT("S22_1A")){ pmtnosignal++; good = false;}}
1593      if ( this->bit(patterntrig[3],5) ){ pmtpattern++;  if ( !this->checkPMT("S22_2A")){ pmtnosignal++; good = false;}}
1594      if ( this->bit(patterntrig[3],6) ){ pmtpattern++;  if ( !this->checkPMT("S22_1B")){ pmtnosignal++; good = false;}}
1595      if ( this->bit(patterntrig[3],7) ){ pmtpattern++;  if ( !this->checkPMT("S22_2B")){ pmtnosignal++; good = false;}}      
1596      //S12
1597      if ( this->bit(patterntrig[4],0) ){ pmtpattern++;  if ( !this->checkPMT("S12_1A")){ pmtnosignal++; good = false;}}
1598      if ( this->bit(patterntrig[4],1) ){ pmtpattern++;  if ( !this->checkPMT("S12_2A")){ pmtnosignal++; good = false;}}
1599      if ( this->bit(patterntrig[4],2) ){ pmtpattern++;  if ( !this->checkPMT("S12_3A")){ pmtnosignal++; good = false;}}
1600      if ( this->bit(patterntrig[4],3) ){ pmtpattern++;  if ( !this->checkPMT("S12_4A")){ pmtnosignal++; good = false;}}
1601      if ( this->bit(patterntrig[4],4) ){ pmtpattern++;  if ( !this->checkPMT("S12_5A")){ pmtnosignal++; good = false;}}
1602      if ( this->bit(patterntrig[4],5) ){ pmtpattern++;  if ( !this->checkPMT("S12_6A")){ pmtnosignal++; good = false;}}      
1603      if ( this->bit(patterntrig[4],6) ){ pmtpattern++;  if ( !this->checkPMT("S12_1A")){ pmtnosignal++; good = false;}}
1604      if ( this->bit(patterntrig[4],7) ){ pmtpattern++;  if ( !this->checkPMT("S12_2A")){ pmtnosignal++; good = false;}}
1605      if ( this->bit(patterntrig[4],8) ){ pmtpattern++;  if ( !this->checkPMT("S12_3A")){ pmtnosignal++; good = false;}}
1606      if ( this->bit(patterntrig[4],9) ){ pmtpattern++;  if ( !this->checkPMT("S12_4B")){ pmtnosignal++; good = false;}}
1607      if ( this->bit(patterntrig[4],10) ){ pmtpattern++; if ( !this->checkPMT("S12_5B")){ pmtnosignal++; good = false;}}
1608      if ( this->bit(patterntrig[4],11) ){ pmtpattern++; if ( !this->checkPMT("S12_6B")){ pmtnosignal++; good = false;}}      
1609      //S11
1610      if ( this->bit(patterntrig[5],0) ){ pmtpattern++;  if ( !this->checkPMT("S11_1A")){ pmtnosignal++; good = false;}}
1611      if ( this->bit(patterntrig[5],1) ){ pmtpattern++;  if ( !this->checkPMT("S11_2A")){ pmtnosignal++; good = false;}}
1612      if ( this->bit(patterntrig[5],2) ){ pmtpattern++;  if ( !this->checkPMT("S11_3A")){ pmtnosignal++; good = false;}}
1613      if ( this->bit(patterntrig[5],3) ){ pmtpattern++;  if ( !this->checkPMT("S11_4A")){ pmtnosignal++; good = false;}}
1614      if ( this->bit(patterntrig[5],4) ){ pmtpattern++;  if ( !this->checkPMT("S11_5A")){ pmtnosignal++; good = false;}}
1615      if ( this->bit(patterntrig[5],5) ){ pmtpattern++;  if ( !this->checkPMT("S11_6A")){ pmtnosignal++; good = false;}}
1616      if ( this->bit(patterntrig[5],6) ){ pmtpattern++;  if ( !this->checkPMT("S11_7A")){ pmtnosignal++; good = false;}}
1617      if ( this->bit(patterntrig[5],7) ){ pmtpattern++;  if ( !this->checkPMT("S11_8A")){ pmtnosignal++; good = false;}}      
1618      if ( this->bit(patterntrig[5],8) ){ pmtpattern++;  if ( !this->checkPMT("S11_1B")){ pmtnosignal++; good = false;}}
1619      if ( this->bit(patterntrig[5],9) ){ pmtpattern++;  if ( !this->checkPMT("S11_2B")){ pmtnosignal++; good = false;}}
1620      if ( this->bit(patterntrig[5],10) ){ pmtpattern++; if ( !this->checkPMT("S11_3B")){ pmtnosignal++; good = false;}}
1621      if ( this->bit(patterntrig[5],11) ){ pmtpattern++; if ( !this->checkPMT("S11_4B")){ pmtnosignal++; good = false;}}
1622      if ( this->bit(patterntrig[5],12) ){ pmtpattern++; if ( !this->checkPMT("S11_5B")){ pmtnosignal++; good = false;}}
1623      if ( this->bit(patterntrig[5],13) ){ pmtpattern++; if ( !this->checkPMT("S11_6B")){ pmtnosignal++; good = false;}}
1624      if ( this->bit(patterntrig[5],14) ){ pmtpattern++; if ( !this->checkPMT("S11_7B")){ pmtnosignal++; good = false;}}
1625      if ( this->bit(patterntrig[5],15) ){ pmtpattern++; if ( !this->checkPMT("S11_8B")){ pmtnosignal++; good = false;}}
1626    
1627      return good;
1628    }
1629    
1630    bool ToFLevel2::checkPMTpmttrig(TrigLevel2 *trg){
1631      //  UInt_t *patterntrig = trg->patterntrig;
1632      int rS11 = 0;
1633      int rS12 = 0;
1634      int rS21 = 0;
1635      int rS22 = 0;
1636      int rS31 = 0;
1637      int rS32 = 0;
1638    
1639      // trigger configuration for the event from saved pmts
1640      TClonesArray* Pmt = this->PMT;
1641      for(int i=0; i<Pmt->GetEntries(); i++) {  
1642        ToFPMT* pmthit = (ToFPMT*)Pmt->At(i);
1643        TString pmtname = this->GetPMTName(pmthit->pmt_id);
1644        if ( pmtname.Contains("S11") ) rS11++;
1645        if ( pmtname.Contains("S12") ) rS12++;
1646        if ( pmtname.Contains("S21") ) rS21++;
1647        if ( pmtname.Contains("S22") ) rS22++;
1648        if ( pmtname.Contains("S31") ) rS31++;
1649        if ( pmtname.Contains("S32") ) rS32++;
1650      }
1651      int rTOF1 = (rS11 + rS12) * (rS21 + rS22) * (rS31 + rS32);
1652      int rTOF2 = (rS11 * rS12) * (rS21 * rS22) * (rS31 * rS32);
1653    
1654      int rTOF3 = (rS21 + rS22) * (rS31 + rS32);
1655      int rTOF4 = (rS21 * rS22) * (rS31 * rS32);
1656    
1657      int rTOF5 = rS12 * (rS21 * rS22);
1658    
1659      int rTOF6 = (rS11 + rS12) * (rS31 + rS32);
1660      int rTOF7 = (rS11 * rS12) * (rS31 * rS32);
1661    
1662    
1663      // trigger configuration of the run
1664      bool TCTOF1 = false;
1665      bool TCTOF2 = false;
1666      bool TCTOF3 = false;
1667      bool TCTOF4 = false;
1668      bool TCTOF5 = false;
1669      bool TCTOF6 = false;
1670      bool TCTOF7 = false;
1671      if ( trg->trigconf & (1<<0) ) TCTOF1 = true;
1672      if ( trg->trigconf & (1<<1) ) TCTOF2 = true;
1673      if ( trg->trigconf & (1<<2) ) TCTOF3 = true;
1674      if ( trg->trigconf & (1<<3) ) TCTOF4 = true;
1675      if ( trg->trigconf & (1<<4) ) TCTOF5 = true;
1676      if ( trg->trigconf & (1<<5) ) TCTOF6 = true;
1677      if ( trg->trigconf & (1<<6) ) TCTOF7 = true;
1678    
1679      // do patterntrig pmts match the trigger configuration?
1680      bool pmtsconf_trigconf_match = true;
1681      if ( rTOF1 == 0 && TCTOF1 ) pmtsconf_trigconf_match = false;
1682      if ( rTOF2 == 0 && TCTOF2 ) pmtsconf_trigconf_match = false;
1683      if ( rTOF3 == 0 && TCTOF3 ) pmtsconf_trigconf_match = false;
1684      if ( rTOF4 == 0 && TCTOF4 ) pmtsconf_trigconf_match = false;
1685      if ( rTOF5 == 0 && TCTOF5 ) pmtsconf_trigconf_match = false;
1686      if ( rTOF6 == 0 && TCTOF6 ) pmtsconf_trigconf_match = false;
1687      if ( rTOF7 == 0 && TCTOF7 ) pmtsconf_trigconf_match = false;
1688    
1689      return pmtsconf_trigconf_match;
1690    }
1691    
1692    void ToFLevel2::printPMT(){
1693      TClonesArray* Pmt = this->PMT;
1694      for(int i=0; i<Pmt->GetEntries(); i++) {  
1695        ToFPMT* pmthit = (ToFPMT*)Pmt->At(i);
1696        TString pmtname = this->GetPMTName(pmthit->pmt_id);
1697        printf(" PMT hit: %s \n",pmtname.Data());
1698      }
1699    }
1700    
1701    
1702  ToFdEdx::ToFdEdx()  ToFdEdx::ToFdEdx()
1703  {  {
1704    memset(conn,0,12*sizeof(Bool_t));    memset(conn,0,12*sizeof(Bool_t));
1705    memset(ts,0,12*sizeof(UInt_t));    memset(ts,0,12*sizeof(UInt_t));
1706    memset(te,0,12*sizeof(UInt_t));    memset(te,0,12*sizeof(UInt_t));
1707      eDEDXpmt = new TArrayF(48);
1708    Define_PMTsat();    Define_PMTsat();
1709    Clear();    Clear();
1710  }  }
1711    
1712    ToFdEdx::~ToFdEdx(){
1713      Clear();
1714      Delete();
1715    }
1716    
1717    void ToFdEdx::Delete(Option_t *option){
1718      if ( eDEDXpmt ){
1719        eDEDXpmt->Set(0);
1720        if ( eDEDXpmt) delete eDEDXpmt;
1721      }
1722    }
1723    
1724  //------------------------------------------------------------------------  //------------------------------------------------------------------------
1725  void ToFdEdx::CheckConnectors(UInt_t atime, GL_PARAM *glparam, TSQLServer *dbc)  void ToFdEdx::CheckConnectors(UInt_t atime, GL_PARAM *glparam, TSQLServer *dbc)
1726  {  {
# Line 1466  void ToFdEdx::Clear(Option_t *option) Line 1762  void ToFdEdx::Clear(Option_t *option)
1762  {  {
1763    //    //
1764    // Set arrays and initialize structure    // Set arrays and initialize structure
1765    eDEDXpmt.Set(48);    eDEDXpmt.Reset(-1);   // Set array size  and reset structure    //  eDEDXpmt.Set(48);    eDEDXpmt.Reset(-1);   // Set array size  and reset structure
1766      eDEDXpmt->Set(48);    eDEDXpmt->Reset(-1);   // Set array size  and reset structure
1767    //    //
1768  };  };
1769    
# Line 1487  void ToFdEdx::Init(pamela::tof::TofEvent Line 1784  void ToFdEdx::Init(pamela::tof::TofEvent
1784      for (Int_t hh=0; hh<12;hh++){      for (Int_t hh=0; hh<12;hh++){
1785        //          tofinput_.tdc[hh][gg]=tofEvent->tdc[gg][hh];                  //          tofinput_.tdc[hh][gg]=tofEvent->tdc[gg][hh];          
1786        int mm = tf.GetPMTid(gg,hh);                int mm = tf.GetPMTid(gg,hh);        
1787        adc[mm]=tofl0->adc[gg][hh];        adc[mm]= (0xFFF & tofl0->adc[gg][hh]); // EM, exclude warning bits
1788      };            };      
1789    };    };
1790        
# Line 1505  void ToFdEdx::Init(Int_t gg, Int_t hh, F Line 1802  void ToFdEdx::Init(Int_t gg, Int_t hh, F
1802        
1803  };  };
1804  //------------------------------------------------------------------------  //------------------------------------------------------------------------
1805  void ToFdEdx::Process(UInt_t atime, Float_t betamean, Float_t *xtr_tof, Float_t *ytr_tof)  void ToFdEdx::Process(UInt_t atime, Float_t betamean, Float_t *xtr_tof, Float_t *ytr_tof, Int_t exitat)
1806  {  {
1807      bool debug = false;
1808      if ( debug ) printf(" INSIDE TOFDEDX PROCESS \n");
1809    // the parameters should be already initialised by InitPar()    // the parameters should be already initialised by InitPar()
1810      //  printf(" in process \n");
1811    Clear();    Clear();
1812    
1813   // define angle:     // define angle:  
# Line 1522  void ToFdEdx::Process(UInt_t atime, Floa Line 1822  void ToFdEdx::Process(UInt_t atime, Floa
1822      if ( ytr_tof[ii] > 99. ) ytr_tof[ii] = 0.;      if ( ytr_tof[ii] > 99. ) ytr_tof[ii] = 0.;
1823    };    };
1824    //    //
1825        if ( debug ) printf(" theta %f \n",theta);
1826      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]);
1827      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]);
1828      //--------------------- TABLE OF PERIODS WITH HV PROBLEMS ----------------------------
1829      
1830      int Aconn=conn[0];    // PMT 0,20,22,24
1831      int Bconn=conn[1];    // PMT 6,12,26,34
1832      int Cconn=conn[2];    // PMT 4,14,28,32
1833      int Dconn=conn[3];    // PMT 2,8,10,30
1834      int Econn=conn[4];    // PMT 42,43,44,47
1835      int Fconn=conn[5];    // PMT 7,19,23,27
1836      int Gconn=conn[6];    // PMT 3,11,25,33
1837      int Hconn=conn[7];    // PMT 1,9,13,21
1838      int Iconn=conn[8];    // PMT 5,29,31,35
1839      int Lconn=conn[9];    // PMT 37,40,45,46
1840      int Mconn=conn[10];    // PMT 15,16,17,18
1841      int Nconn=conn[11];    // PMT 36,38,39,41
1842      if( false ) cout << Gconn << Iconn << Lconn <<endl; // to avoid compilation warnings
1843        
1844      //  printf(" size %i \n",eDEDXpmt.GetSize());
1845    for( int ii=0; ii<48; ii++ ) {    for( int ii=0; ii<48; ii++ ) {
1846      //      //
1847        //    eDEDXpmt.SetAt(-1.,ii);
1848      //    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]);
1849      if( adc[ii] >= PMTsat[ii]-5 )  continue;      if ( debug ) printf("II %i adc %f \n",ii,adc[ii]);
1850      if( adc[ii] <= 0. )            continue;  
1851        if( adc[ii] >= 4095. ){
1852          //      eDEDXpmt[ii] = 0.;
1853          eDEDXpmt->AddAt(0.,ii);
1854          if ( debug ) printf(" %i adc>4095 \n",ii);
1855          continue; // EMILIANO
1856        };
1857    
1858        if( adc[ii] >= (PMTsat[ii]-5.) && adc[ii] < 4095. ){
1859          eDEDXpmt->AddAt(1000.,ii);
1860          if ( debug ) printf(" %i adc> pmtsat && adc<4095 \n",ii);
1861          continue; // EMILIANO
1862        };
1863    
1864        if( adc[ii] <= 0. ) {
1865          eDEDXpmt->AddAt(1500.,ii);
1866          if ( debug ) printf(" %i adc<=0 \n",ii);
1867          continue;
1868        };
1869      //      //
1870      double adcpC   = f_adcPC( adc[ii] );    // - adc conversion in pC      double adcpC   = f_adcPC( adc[ii] );    // - adc conversion in pC
1871      double adccorr = adcpC*fabs(cos(theta));      if ( exitat == 0 ){
1872      //        eDEDXpmt->AddAt((Float_t)adcpC,ii);
1873      if(adccorr<=0.)           continue;        continue;
1874        }
1875      //--------------------- TABLE OF PERIODS WITH HV PROBLEMS ----------------------------      //    printf(" e qua? \n");
1876    
1877      int Aconn=conn[0];    // PMT 0,20,22,24      double adccorr = adcpC*fabs(cos(theta));    
1878      int Bconn=conn[1];    // PMT 6,12,26,34      if ( debug ) printf(" adccorr %f \n",adccorr);
1879      int Cconn=conn[2];    // PMT 4,14,28,32      if(adccorr<=0.){
1880      int Dconn=conn[3];    // PMT 2,8,10,30        if ( debug ) printf(" %i adccorr<=0 \n",ii);
1881      int Econn=conn[4];    // PMT 42,43,44,47        //      eDEDXpmt->AddAt((Float_t)adcpC,ii);//?
1882      int Fconn=conn[5];    // PMT 7,19,23,27        continue;
1883      int Gconn=conn[6];    // PMT 3,11,25,33      }
1884      int Hconn=conn[7];    // PMT 1,9,13,21      if ( exitat == 1 ){
1885      int Iconn=conn[8];    // PMT 5,29,31,35        eDEDXpmt->AddAt((Float_t)adccorr,ii);
1886      int Lconn=conn[9];    // PMT 37,40,45,46        continue;
1887      int Mconn=conn[10];    // PMT 15,16,17,18      }
1888      int Nconn=conn[11];    // PMT 36,38,39,41      //    printf(" e quo? \n");
1889    
1890      //    int standard=0;      //    int standard=0;
     if( false ) cout << Gconn << Iconn << Lconn <<endl;  
1891      int S115B_ok=0;      int S115B_ok=0;
1892      int S115B_break=0;      int S115B_break=0;
1893    
# Line 1560  void ToFdEdx::Process(UInt_t atime, Floa Line 1896  void ToFdEdx::Process(UInt_t atime, Floa
1896    
1897    
1898      //------------------------------------------------------------------------      //------------------------------------------------------------------------
1899        //    printf(" e qui? \n");
1900      //---------------------------------------------------- Z reconstruction      //---------------------------------------------------- Z reconstruction
1901    
1902      double adcHe, adcnorm, adclin, dEdx, Zeta;      double adcHe, adcnorm, adclin, dEdx;//, Zeta; // EM GCC4.7
1903    
1904      adcHe=-2;      adcHe=-2;
1905      adcnorm=-2;      adcnorm=-2;
1906      adclin=-2;      adclin=-2;
1907      dEdx=-2;      dEdx=-2;
1908      Zeta=-2;      //    Zeta=-2;//EM GCC4.7
1909        Double_t correction = 1.;
1910    
1911      if(Aconn==1 && (ii==0 || ii==20 || ii==22 || ii==24)){      if(Aconn==1 && (ii==0 || ii==20 || ii==22 || ii==24)){
1912        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.675;        correction = 1.675;
1913      }      }
1914      else if(Bconn==1 && (ii==6 || ii==12 || ii==26 || ii==34)){      else if(Bconn==1 && (ii==6 || ii==12 || ii==26 || ii==34)){
1915        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/2.482;        correction = 2.482;
1916      }      }
1917      else if(Cconn==1 && (ii==4 || ii==14 || ii==28 || ii==32)){      else if(Cconn==1 && (ii==4 || ii==14 || ii==28 || ii==32)){
1918        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.464;        correction = 1.464;
1919      }      }
1920      else if(Dconn==1 && (ii==2 || ii==8 || ii==10 || ii==30)){      else if(Dconn==1 && (ii==2 || ii==8 || ii==10 || ii==30)){
1921        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.995;        correction = 1.995;
1922      }      }
1923      else if(Econn==1 && (ii==42 || ii==43 || ii==44 || ii==47)){      else if(Econn==1 && (ii==42 || ii==43 || ii==44 || ii==47)){
1924        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.273;        correction = 1.273;
1925      }      }
1926      else if(Fconn==1 && (ii==7 || ii==19 || ii==23 || ii==27)){      else if(Fconn==1 && (ii==7 || ii==19 || ii==23 || ii==27)){
1927        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.565;        correction = 1.565;
1928      }      }
1929      else if(Mconn==1 && (ii==15 || ii==16 || ii==17 || ii==18)){      else if(Mconn==1 && (ii==15 || ii==16 || ii==17 || ii==18)){
1930        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.565;        correction = 1.565;
1931      }      }
1932      else if(Nconn==1 && (ii==36 || ii==38 || ii==39 || ii==41)){      else if(Nconn==1 && (ii==36 || ii==38 || ii==39 || ii==41)){
1933        adcHe   = (Get_adc_he(ii, xtr_tof, ytr_tof))/1.018;        correction = 1.018;
1934      }      }
1935      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))){
1936        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!!!  
1937      }      }
1938      else if(S115B_break==1 && ii==9 && Hconn==1){      else if(S115B_break==1 && ii==9 && Hconn==1){
1939        adcHe   = (f_att5B( ytr_tof[0] ))/1.64;        correction = 1.64;
1940        }
1941        else correction = 1.;
1942        
1943        if( ii==9 && S115B_break==1 ){
1944          adcHe   = f_att5B( ytr_tof[0] )/correction;
1945        } else {
1946          adcHe   = Get_adc_he(ii, xtr_tof, ytr_tof)/correction;
1947        };
1948        if(adcHe<=0){
1949          if ( debug ) printf(" %i adcHe<=0 \n",ii);
1950          //      eDEDXpmt->AddAt((Float_t)adccorr,ii); //?
1951          continue;
1952        }
1953        if ( exitat == 2 ){
1954          if(ii==9 && S115B_break==1)  eDEDXpmt->AddAt(36.*(Float_t)adccorr/adcHe,ii);
1955          else  adclin  = 4.*(Float_t)adccorr/adcHe;
1956          continue;
1957      }      }
     else  adcHe   = Get_adc_he(ii, xtr_tof, ytr_tof);  
   
     if(adcHe<=0)   continue;  
1958    
1959      if(ii==9 && S115B_break==1)  adcnorm = f_pos5B(adccorr);      if(ii==9 && S115B_break==1)  adcnorm = f_pos5B(adccorr);
1960      else adcnorm = f_pos( (parPos[ii]), adccorr);      else adcnorm = f_pos( (parPos[ii]), adccorr);
1961        if(adcnorm<=0){
1962      if(adcnorm<=0) continue;        if ( debug ) printf(" %i adcnorm<=0 \n",ii);
1963          //      eDEDXpmt->AddAt((Float_t)adccorr,ii);//?
1964          continue;
1965        }
1966        if ( debug ) printf(" adcnorm %f \n",adcnorm);
1967    
1968      if(ii==9 && S115B_break==1)  adclin  = 36.*adcnorm/adcHe;      if(ii==9 && S115B_break==1)  adclin  = 36.*adcnorm/adcHe;
1969      else  adclin  = 4.*adcnorm/adcHe;      else  adclin  = 4.*adcnorm/adcHe;
1970        if ( debug ) printf(" adclin %f \n",adclin);
1971      if(adclin<=0)  continue;      if(adclin<=0){
1972          if ( debug ) printf(" %i adclin<=0 \n",ii);
1973          //      eDEDXpmt->AddAt((Float_t)adccorr,ii);//?
1974          continue;
1975        }
1976        if ( exitat == 3 ){
1977          if(ii==9 && S115B_break==1)  eDEDXpmt->AddAt((Float_t)adclin,ii);
1978          else  eDEDXpmt->AddAt((Float_t)adclin,ii);
1979          continue;
1980        }
1981      //      //
1982      if ( betamean > 99. ){      if ( betamean > 99. ){
1983        //      eDEDXpmt.AddAt((Float_t)adclin,ii);        //      eDEDXpmt.AddAt((Float_t)adclin,ii);
1984        eDEDXpmt[ii]=(Float_t)adclin;        eDEDXpmt->AddAt((Float_t)adclin,ii);
1985        //      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]);
1986          if ( debug ) printf(" %i betamean > 99 \n",ii);
1987        continue;        continue;
1988      };      };
1989      //      //
# Line 1634  void ToFdEdx::Process(UInt_t atime, Floa Line 1996  void ToFdEdx::Process(UInt_t atime, Floa
1996        else                       dEdxHe = parBBpos[ii];        else                       dEdxHe = parBBpos[ii];
1997      }      }
1998            
1999      if(dEdxHe<=0)  continue;      if ( debug ) printf(" dEdxHe %f \n",dEdxHe);
2000        
2001        if(dEdxHe<=0){
2002          eDEDXpmt->AddAt((Float_t)adclin,ii);
2003          if ( debug ) printf(" %i dEdxHe<=0 \n",ii);
2004          continue;
2005        };
2006    
2007      if(ii==9 && S115B_break==1)  dEdx = f_desatBB5B( adclin );      if(ii==9 && S115B_break==1)  dEdx = f_desatBB5B( adclin );
2008      else  dEdx = f_desatBB((parDesatBB[ii]), adclin );      else  dEdx = f_desatBB((parDesatBB[ii]), adclin );
2009    
2010      if(dEdx<=0)    continue;      if(dEdx<=0){
2011          eDEDXpmt->AddAt((Float_t)adclin,ii);
2012          if ( debug ) printf(" %i dEdx<=0 \n",ii);
2013          continue;
2014        };
2015    
2016      eDEDXpmt[ii]=(Float_t)dEdx;      if ( debug ) printf(" dEdx %f \n",dEdx);
2017        eDEDXpmt->AddAt((Float_t)dEdx,ii);
2018      //    eDEDXpmt.AddAt((Float_t)dEdx,ii);      //    eDEDXpmt.AddAt((Float_t)dEdx,ii);
2019    
2020      //    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 1838  double ToFdEdx::f_desatBB5B( float x ) Line 2211  double ToFdEdx::f_desatBB5B( float x )
2211      0.009*x*x;      0.009*x*x;
2212  }  }
2213    
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.38

  ViewVC Help
Powered by ViewVC 1.1.23