/[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.22 by pamela, Fri Jun 20 12:23:26 2008 UTC revision 1.25 by pamelats, Wed Apr 15 10:05:22 2009 UTC
# Line 1  Line 1 
1  /**  /**
2   * \file ToFLevel2.cpp   * \file ToFLevel2.cpp
3   * \author Gianfranca DeRosa, Wolfgang Menn   * \author Gianfranca DeRosa, Wolfgang Menn
4     *
5     * WM dec 2008: Description of "GetdEdx" changed
6     * WM dec 2008: "GetdEdxPaddle" modified: Now includes saturation limit
7     *              PMTs higher than the saturation limit are not used for dEdx
8     * WM apr 2009: bug found by Nicola in method "GetPaddlePlane"
9   */   */
10    
11  #include <ToFLevel2.h>  #include <ToFLevel2.h>
   
12  using namespace std;  using namespace std;
   
13  ClassImp(ToFPMT);  ClassImp(ToFPMT);
14  ClassImp(ToFTrkVar);  ClassImp(ToFTrkVar);
15  ClassImp(ToFLevel2);  ClassImp(ToFLevel2);
# Line 216  Int_t ToFLevel2::GetNHitPaddles(Int_t pl Line 219  Int_t ToFLevel2::GetNHitPaddles(Int_t pl
219      return npad;      return npad;
220  };  };
221    
222    //wm Nov 08
223  //gf Apr 07  //gf Apr 07
224  /**  /**
225   * Method to get the mean dEdx from a given ToF plane. This current version   * Method to get the mean dEdx from a ToF layer - ATTENTION:
226   * is just summing up all PMT signals, which will not give proper results,   * It will sum up the dEdx of all the paddles, but since by definition
227   *  and needs a revision.   * only the paddle hitted by the track gets a dEdx value and the other
228     * paddles are set to zero, the output is just the dEdx of the hitted
229     * paddle in each layer!
230     * The "adcfl" option is not very useful (an artificial dEdx is per
231     * definition= 1 mip and not a real measurement), anyway left in the code
232   * @param notrack Track Number   * @param notrack Track Number
233   * @param plane Plane index (0,1,2,3,4,5)   * @param plane Plane index (0,1,2,3,4,5)
234   * @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; )
# Line 381  void ToFLevel2::GetPMTIndex(Int_t ind, I Line 388  void ToFLevel2::GetPMTIndex(Int_t ind, I
388    
389    
390    
391    //  wm Nov 08 revision - saturation values included
392  /// gf Apr 07  /// gf Apr 07
   
393  /**  /**
394   * Method to get the dEdx from a given ToF paddle.   * Method to get the dEdx from a given ToF paddle.
395     * If two PMTs are good, the mean dEdx of both PMTs is taken, otherwise
396     * just the dEdx of the "good" PMT. If both PMTs are above saturation => dEdx=1000
397   * @param notrack Track Number   * @param notrack Track Number
398   * @param Paddle index (0,1,...,23).   * @param Paddle index (0,1,...,23).
399   * @param adcflag in the paddle (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; )   * @param adcflag in the paddle (100<-> independent of the adcflag; !=0&&!=100 <-> at least one PMT with adcflag!=0; )
# Line 394  void ToFLevel2::GetPMTIndex(Int_t ind, I Line 402  void ToFLevel2::GetPMTIndex(Int_t ind, I
402   */   */
403  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){
404    
405    /*
406    Float_t  PMTsat[48] = {
407    3162.14, 3165.48, 3153.85, 3085.73, 3089.65, 3107.64, 3097.52, 3078.37,
408    3130.05, 3087.07, 3112.22, 3102.92, 3080.58, 3092.55, 3087.94, 3125.03,
409    3094.09, 3143.16, 3125.51, 3181.27, 3092.09, 3124.98, 3069.3, 3095.53,
410    3097.11, 3133.53, 3114.73, 3113.01, 3091.19, 3097.99, 3033.84, 3134.98,
411    3081.37, 3111.04, 3066.77, 3108.17, 3133, 3111.06, 3052.52, 3140.66,
412    3106.33, 3094.85, 3150.85, 3118.8, 3096.24, 3118.47,3111.36, 3117.11 } ;
413    */
414    
415    // new values from Napoli dec 2008
416    Float_t  PMTsat[48] = {
417    3176.35,3178.19,3167.38,3099.73,3117.00,3126.29,3111.44,3092.27,
418    3146.48,3094.41,3132.13,3115.37,3099.32,3110.97,3111.80,3143.14,
419    3106.72,3153.44,3136.00,3188.96,3104.73,3140.45,3073.18,3106.62,
420    3112.48,3146.92,3127.24,3136.52,3109.59,3112.89,3045.15,3147.26,
421    3095.92,3121.05,3083.25,3123.62,3150.92,3125.30,3067.60,3160.18,
422    3119.36,3108.92,3164.77,3133.64,3111.47,3131.98,3128.87,3135.56 };
423    
424    for (Int_t i=0; i<48;i++) PMTsat[i] = PMTsat[i] - 5.;  // safety margin
425    
426    
427    PadEdx = 0.;    PadEdx = 0.;
428    SatWarning = 1000;  //  SatWarning = 1000;
429      SatWarning = 0;   // 0=good, increase for each bad PMT
430    
431    Float_t dEdx[48] = {0};    Float_t dEdx[48] = {0};
432    Int_t pmt_id = -1;    Int_t pmt_id = -1;
# Line 427  void ToFLevel2::GetdEdxPaddle(Int_t notr Line 458  void ToFLevel2::GetdEdxPaddle(Int_t notr
458        adcraw[pmtright] = pmt->adc;        adcraw[pmtright] = pmt->adc;
459      }      }
460    }    }
461    
462        
463    for (Int_t i=0; i<trk->npmtadc; i++){    for (Int_t i=0; i<trk->npmtadc; i++){
464    
# Line 439  void ToFLevel2::GetdEdxPaddle(Int_t notr Line 471  void ToFLevel2::GetdEdxPaddle(Int_t notr
471      }      }
472    }    }
473    
474    if( adcraw[pmtleft] >3000 || adcraw[pmtright] >3000)SatWarning=1;  
475        //  if( adcraw[pmtleft] >3000 || adcraw[pmtright] >3000)SatWarning=1;  //old version
476    if(dEdx[pmtleft]!=0 && dEdx[pmtright]!=0){  
477      PadEdx = (dEdx[pmtleft]+dEdx[pmtright])*0.5;  // Increase SatWarning Counter for each PMT>Sat
478    }    if( adcraw[pmtleft] > PMTsat[pmtleft])SatWarning++;  
479    if(dEdx[pmtleft]==0 && dEdx[pmtright]!=0){    if( adcraw[pmtright] > PMTsat[pmtright])SatWarning++;
480      PadEdx = dEdx[pmtright];  
481    }  // if ADC  > sat set dEdx=1000
482    if(dEdx[pmtleft]!=0 && dEdx[pmtright]==0){    if( adcraw[pmtleft] > PMTsat[pmtleft]) dEdx[pmtleft] = 1000.;
483      PadEdx = dEdx[pmtleft];    if( adcraw[pmtright] > PMTsat[pmtright]) dEdx[pmtright] = 1000. ;
484    }  
485    // if two PMT are good, take mean dEdx, otherwise only the good dEdx
486      if(dEdx[pmtleft]<1000 && dEdx[pmtright]<1000) PadEdx = (dEdx[pmtleft]+dEdx[pmtright])*0.5;
487      if(dEdx[pmtleft]==1000 && dEdx[pmtright]<1000) PadEdx = dEdx[pmtright];  
488      if(dEdx[pmtleft]<1000 && dEdx[pmtright]==1000) PadEdx = dEdx[pmtleft];
489        
   return;  
490  };  };
491  //  //
492    
# Line 514  return GetPaddleIdOfTrack(xtr ,ytr ,plan Line 549  return GetPaddleIdOfTrack(xtr ,ytr ,plan
549  }  }
550    
551  // gf Apr 07  // gf Apr 07
 // wm jun 08  introduced a margin as input parameter  
552  Int_t ToFLevel2::GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane, Float_t margin){  Int_t ToFLevel2::GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane, Float_t margin){
553      
554    Double_t xt,yt,xl,xh,yl,yh;    Double_t xt,yt,xl,xh,yl,yh;
555        
556    Float_t tof11_x[8] = {-17.85,-12.75,-7.65,-2.55,2.55,7.65,12.75,17.85};    Float_t tof11_x[8] = {-17.85,-12.75,-7.65,-2.55,2.55,7.65,12.75,17.85};
# Line 702  void ToFLevel2::GetPMTPaddle(Int_t pmt_i Line 736  void ToFLevel2::GetPMTPaddle(Int_t pmt_i
736    
737  void ToFLevel2::GetPaddlePMT(Int_t paddle, Int_t &pmtleft, Int_t &pmtright){  void ToFLevel2::GetPaddlePMT(Int_t paddle, Int_t &pmtleft, Int_t &pmtright){
738    pmtleft=paddle*2;    pmtleft=paddle*2;
739    pmtright= pmtleft+1;    pmtright= pmtleft+1;  
740    return;    return;
741  }  }
742    
# Line 826  Int_t ToFLevel2::GetPaddleid(Int_t plane Line 860  Int_t ToFLevel2::GetPaddleid(Int_t plane
860    }    }
861    padid=paddle+somma;    padid=paddle+somma;
862    return padid;    return padid;
863    
864  }  }
865    
866    
# Line 854  void ToFLevel2::GetPaddlePlane(Int_t pad Line 889  void ToFLevel2::GetPaddlePlane(Int_t pad
889      return;      return;
890    }    }
891    
892    if(7<pad<14){    if((7<pad)&&(pad<14)){
893      plane=1;      plane=1;
894      paddle=pad-pads11;      paddle=pad-pads11;
895      return;      return;
896    }    }
897        
898    if(13<pad<16){    if((13<pad)&&(pad<16)){
899      plane=2;      plane=2;
900      paddle=pad-pads11-pads12;      paddle=pad-pads11-pads12;
901      return;      return;
902    }    }
903    
904    if(15<pad<18){    if((15<pad)&&(pad<18)){
905      plane=3;      plane=3;
906      paddle=pad-pads11-pads12-pads21;      paddle=pad-pads11-pads12-pads21;
907      return;      return;
908    }    }
909    
910    if(17<pad<21){    if((17<pad)&&(pad<21)){
911      plane=4;      plane=4;
912      paddle=pad-pads11-pads12-pads21-pads22;      paddle=pad-pads11-pads12-pads21-pads22;
913      return;      return;
914    }    }
915    
916    if(20<pad<24){    if((20<pad)&&(pad<24)){
917      plane=5;      plane=5;
918      paddle=pad-pads11-pads12-pads21-pads22-pads31;      paddle=pad-pads11-pads12-pads21-pads22-pads31;
919      return;      return;
# Line 909  Int_t ToFLevel2::GetNPaddle(Int_t plane) Line 944  Int_t ToFLevel2::GetNPaddle(Int_t plane)
944    
945  }  }
946    
947    
948    
949  /// wm feb 08  /// wm feb 08
950    
951  /**  /**
# Line 1055  Int_t ibot[12] = {4,5,4,5,4,5,4,5,2,3,2, Line 1092  Int_t ibot[12] = {4,5,4,5,4,5,4,5,2,3,2,
1092  ////////////////////////////////////////////////////  ////////////////////////////////////////////////////
1093    
1094    
   
1095  /**  /**
1096   * Fills a struct cToFLevel2 with values from a ToFLevel2 object (to put data into a F77 common).   * Fills a struct cToFLevel2 with values from a ToFLevel2 object (to put data into a F77 common).
1097   */   */

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.25

  ViewVC Help
Powered by ViewVC 1.1.23