]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Add possibility to apply non-linearity to cells
authorprsnko <prsnko@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 9 Oct 2011 17:59:48 +0000 (17:59 +0000)
committerprsnko <prsnko@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 9 Oct 2011 17:59:48 +0000 (17:59 +0000)
PHOS/AliPHOSDigitizer.cxx
PHOS/AliPHOSSimParam.cxx
PHOS/AliPHOSSimParam.h

index 93d09754cc627b991ea47eb811504205da1e1ba3..b2c279cc27dd7d264b0aeff74b50c08e075e475c 100644 (file)
@@ -508,6 +508,20 @@ void AliPHOSDigitizer::Digitize(Int_t event)
     }
   }
 
+
+  //Apply non-linearity
+  if(AliPHOSSimParam::GetInstance()->IsCellNonlinearityOn()){ //Apply non-lineairyt on cell level
+    const Double_t aNL = AliPHOSSimParam::GetInstance()->GetCellNonLineairyA() ;
+    const Double_t bNL = AliPHOSSimParam::GetInstance()->GetCellNonLineairyB() ;
+    for(Int_t i = 0 ; i < nEMC ; i++){
+      digit = static_cast<AliPHOSDigit*>( digits->At(i) ) ;
+      Double_t e= digit->GetEnergy() ;
+      // version(1)      digit->SetEnergy(e*(1+a*TMath::Exp(-e/b))) ;
+      digit->SetEnergy(e*(1.+aNL*TMath::Exp(-e*e/2./bNL/bNL))) ; //Better agreement with data...
+    }  
+  }
+
+
   //distretize energy if necessary
   if(AliPHOSSimParam::GetInstance()->IsEDigitizationOn()){
     Float_t adcW=AliPHOSSimParam::GetInstance()->GetADCchannelW() ;
@@ -516,12 +530,12 @@ void AliPHOSDigitizer::Digitize(Int_t event)
       digit->SetEnergy(adcW*ceil(digit->GetEnergy()/adcW)) ;
     } 
   }
   //Apply decalibration if necessary
   for(Int_t i = 0 ; i < nEMC ; i++){
     digit = static_cast<AliPHOSDigit*>( digits->At(i) ) ;
     Decalibrate(digit) ;
   }
   
 //  ticks->Delete() ;
 //  delete ticks ;
@@ -610,7 +624,7 @@ void AliPHOSDigitizer::Digitize(Int_t event)
 
     geom->AbsToRelNumbering(digit->GetId(),relId);
 
-    digit->SetEnergy(TMath::Ceil(digit->GetEnergy())-0.9999) ;
+//    digit->SetEnergy(TMath::Ceil(digit->GetEnergy())-0.9999) ;
 
     Float_t tres = TimeResolution(digit->GetEnergy()) ; 
     digit->SetTime(gRandom->Gaus(digit->GetTime(), tres) ) ;
@@ -676,8 +690,7 @@ void AliPHOSDigitizer::Decalibrate(AliPHOSDigit *digit)
   Int_t row   =relId[2];
   Int_t column=relId[3];
   if(relId[1]==0){ //This Is EMC
-    Float_t decalib     = fcdb->GetADCchannelEmcDecalib(module,column,row); // O(1)
-    Float_t calibration = fcdb->GetADCchannelEmc(module,column,row)*decalib;
+    Float_t calibration = fcdb->GetADCchannelEmc(module,column,row);
     Float_t energy = digit->GetEnergy()/calibration;
     digit->SetEnergy(energy); //Now digit measures E in ADC counts
     Float_t time = digit->GetTime() ;
index 14684e09635ee7d5363d117cba7ded6d378ff711..49df1895697fb19b080ed902da8773e8146694fa 100644 (file)
@@ -31,11 +31,12 @@ AliPHOSSimParam::AliPHOSSimParam() :
   fLightFactor(0.),fAPDFactor(0.),         
   fAPDNoise(0.),fEMCDigitThreshold(0.),
   fEMCADCchannel(0.),fTOFa(0.),fTOFb(0.),
+  fCellNonLineaityA(0.),fCellNonLineaityB(1.),
   fEMCSubtractPedestals(kFALSE),
   fGlobalAltroOffset(0),fGlobalAltroThreshold(0),fEMCSampleQualityCut(0),
   fADCpedestalCpv(0.),fADCchanelCpv(0.),
   fCPVNoise(0.),fCPVDigitThreshold(0.),fNADCcpv(0),
-  fDigitizeE(0)
+  fDigitizeE(0),fCellNonLineaityOn(0)
 {
   //Default constructor.
   for(Int_t i=0; i<10; i++) fDStream[i] = 0 ;
@@ -48,12 +49,13 @@ AliPHOSSimParam::AliPHOSSimParam(Int_t) :
   fLightFactor(0.),fAPDFactor(0.),         
   fAPDNoise(0.),fEMCDigitThreshold(0.),
   fEMCADCchannel(0.),fTOFa(0.),fTOFb(0.),
+  fCellNonLineaityA(0.),fCellNonLineaityB(1.),
   fEMCSubtractPedestals(kFALSE),
   fGlobalAltroOffset(0),fGlobalAltroThreshold(0),fEMCSampleQualityCut(0),
   fADCpedestalCpv(0.),fADCchanelCpv(0.),
   fCPVNoise(0.),fCPVDigitThreshold(0.),
   fNADCcpv(0),
-  fDigitizeE(0)
+  fDigitizeE(0),fCellNonLineaityOn(0)
 {
   //Real (private) constructor 
   //Set default parameters
@@ -86,6 +88,8 @@ AliPHOSSimParam::AliPHOSSimParam(Int_t) :
   fEMCADCchannel      = 0.005 ;  // [GeV]
   fTOFa               = 0.5e-9 ; // [sec] constant term
   fTOFb               = 1.e-9 ;  // [sec/sqrt(GeV)]] stohastic term
+  fCellNonLineaityA   = 0.30 ;   //Amp of non-linearity of cell responce
+  fCellNonLineaityB   = 0.109;   //Scale of non-linearity of cell responce
 
   fADCpedestalCpv     = 0.012 ;  // [aux units]
   fADCchanelCpv       = 0.0012;  // [aux units]    
@@ -111,11 +115,12 @@ AliPHOSSimParam::AliPHOSSimParam(const AliPHOSSimParam& ):
   fLightFactor(0.),fAPDFactor(0.),         
   fAPDNoise(0.),fEMCDigitThreshold(0.),
   fEMCADCchannel(0.),fTOFa(0.),fTOFb(0.),
+  fCellNonLineaityA(0.),fCellNonLineaityB(1.),
   fEMCSubtractPedestals(kFALSE),
   fGlobalAltroOffset(0),fGlobalAltroThreshold(0),fEMCSampleQualityCut(1.),
   fADCpedestalCpv(0.),fADCchanelCpv(0.),
   fCPVNoise(0.),fCPVDigitThreshold(0.),fNADCcpv(0),
-  fDigitizeE(0)
+  fDigitizeE(0),fCellNonLineaityOn(0)
 {
   //Copy constructor.
   AliError("Should not use copy constructor for singleton") ;
index 4bf1745e3c13682c9e8be46a77abb99ba8701013..f0436f1067da1ee1d32ccb4ba6ccf2422f51e1ec 100644 (file)
@@ -35,6 +35,16 @@ public:
   Float_t GetAPDNoise() const { return fAPDNoise;  }          //RMS of APD noise
   void SetAPDNoise(Float_t noise=0.012){fAPDNoise = noise;  }
 
+  //Parameters to apply non-lineary on cell level
+  Bool_t IsCellNonlinearityOn() const {return fCellNonLineaityOn;}
+  void SetCellNonLinearity(Bool_t on=kTRUE){fCellNonLineaityOn=on;} //default: on=kFALSE
+  Double_t GetCellNonLineairyA(void) const {return fCellNonLineaityA; }
+  Double_t GetCellNonLineairyB(void) const {return fCellNonLineaityB; }
+  void SetCellNonLineairyA(Double_t a=0.30) {fCellNonLineaityA = a; }
+  void SetCellNonLineairyB(Double_t b=0.109){fCellNonLineaityB = b; }
+
+
+
   Float_t GetEmcDigitsThreshold() const { return fEMCDigitThreshold ; }  //Minimal energy to keep digit
   void SetEMCDigitsThreshold(Float_t thresh=0.01){fEMCDigitThreshold=thresh;} 
 
@@ -102,6 +112,8 @@ private:
   Float_t fEMCADCchannel ;      //width of ADC channel in GeV
   Float_t fTOFa  ;              //constant term of TOF resolution 
   Float_t fTOFb  ;              //stohastic term of TOF resolution 
+  Float_t fCellNonLineaityA ;   //Amp of cel non-linearity
+  Float_t fCellNonLineaityB ;   //Energy scale of cel non-linearity
 
   //Parameters used for RAW embedding
   Bool_t  fEMCSubtractPedestals;   // true if pedestal should be subtracted (in non-ZS)
@@ -118,7 +130,8 @@ private:
  
   Bool_t fDStream[10] ;   //Mark mixing stream contains digits or SDigits
   Bool_t fDigitizeE ;     //Use energy digitization in simulation or left to Digits2Raw()
-
+  Bool_t fCellNonLineaityOn ;  //Model scintillator non-linearity in AliPHOSDigitizer
+  
   static AliPHOSSimParam * fgSimParam ; // pointer to the unique instance of the class
 
   ClassDef(AliPHOSSimParam,2)