Possibility to set offset in SZ runs
authorprsnko <prsnko@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Sep 2008 16:53:44 +0000 (16:53 +0000)
committerprsnko <prsnko@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Sep 2008 16:53:44 +0000 (16:53 +0000)
PHOS/AliPHOSRawDecoder.cxx
PHOS/AliPHOSRawDecoder.h
PHOS/AliPHOSRawDecoderv1.cxx

index 6f376cc4dfe8ba9e2a6ec967a15cb3e77b626a34..60ba100b13325a2acfbf2f82657ea913f7afb9a6 100644 (file)
@@ -49,7 +49,7 @@ ClassImp(AliPHOSRawDecoder)
 //-----------------------------------------------------------------------------
 AliPHOSRawDecoder::AliPHOSRawDecoder():
   fRawReader(0),fCaloStream(0),fPedSubtract(kFALSE),fEnergy(-111),fTime(-111),fQuality(0.),fPedestalRMS(0.),
-  fModule(-1),fColumn(-1),fRow(-1),fNewModule(-1),fNewColumn(-1),fNewRow(-1),fNewAmp(0),fNewTime(0), 
+  fAmpOffset(0),fModule(-1),fColumn(-1),fRow(-1),fNewModule(-1),fNewColumn(-1),fNewRow(-1),fNewAmp(0),fNewTime(0), 
   fLowGainFlag(kFALSE),fNewLowGainFlag(kFALSE),fOverflow(kFALSE),fSamples(0),fTimes(0)
 {
   //Default constructor.
@@ -58,7 +58,7 @@ AliPHOSRawDecoder::AliPHOSRawDecoder():
 //-----------------------------------------------------------------------------
 AliPHOSRawDecoder::AliPHOSRawDecoder(AliRawReader* rawReader,  AliAltroMapping **mapping):
   fRawReader(0),fCaloStream(0),fPedSubtract(kFALSE),fEnergy(-111),fTime(-111),fQuality(0.),fPedestalRMS(0.),
-  fModule(-1),fColumn(-1),fRow(-1),fNewModule(-1),fNewColumn(-1),fNewRow(-1),fNewAmp(0),fNewTime(0),
+  fAmpOffset(0),fModule(-1),fColumn(-1),fRow(-1),fNewModule(-1),fNewColumn(-1),fNewRow(-1),fNewAmp(0),fNewTime(0),
   fLowGainFlag(kFALSE),fNewLowGainFlag(kFALSE),fOverflow(kFALSE),fSamples(0),fTimes(0)
 {
   //Construct a decoder object.
@@ -86,7 +86,7 @@ AliPHOSRawDecoder::AliPHOSRawDecoder(const AliPHOSRawDecoder &phosDecoder ):
   fRawReader(phosDecoder.fRawReader),fCaloStream(phosDecoder.fCaloStream),
   fPedSubtract(phosDecoder.fPedSubtract),
   fEnergy(phosDecoder.fEnergy),fTime(phosDecoder.fTime),fQuality(phosDecoder.fQuality),fPedestalRMS(phosDecoder.fPedestalRMS),
-  fModule(phosDecoder.fModule),fColumn(phosDecoder.fColumn),
+  fAmpOffset(phosDecoder.fAmpOffset),fModule(phosDecoder.fModule),fColumn(phosDecoder.fColumn),
   fRow(phosDecoder.fRow),fNewModule(phosDecoder.fNewModule),fNewColumn(phosDecoder.fNewColumn),
   fNewRow(phosDecoder.fNewRow),fNewAmp(phosDecoder.fNewAmp),fNewTime(phosDecoder.fNewTime),
   fLowGainFlag(phosDecoder.fLowGainFlag),fNewLowGainFlag(phosDecoder.fNewLowGainFlag),
@@ -110,6 +110,8 @@ AliPHOSRawDecoder& AliPHOSRawDecoder::operator = (const AliPHOSRawDecoder &phosD
     fEnergy = phosDecode.fEnergy;
     fTime = phosDecode.fTime;
     fQuality = phosDecode.fQuality ;
+    fPedestalRMS = phosDecode.fPedestalRMS ;
+    fAmpOffset = phosDecode.fAmpOffset ;
     fModule = phosDecode.fModule;
     fColumn = phosDecode.fColumn;
     fRow = phosDecode.fRow;
@@ -179,7 +181,7 @@ Bool_t AliPHOSRawDecoder::NextDigit()
        // Time is not evaluated for the moment (12.01.2007). 
        // Take is as a first time bin multiplied by the sample tick time
        
-       if(fPedSubtract) 
+       if(fPedSubtract) {
         if (nPed > 0){
            fPedestalRMS=(pedRMS-pedMean*pedMean/nPed)/nPed ;
            if(fPedestalRMS > 0.) 
@@ -188,6 +190,10 @@ Bool_t AliPHOSRawDecoder::NextDigit()
          }
         else
           return kFALSE;
+       }
+       else{
+         fEnergy-=fAmpOffset ;
+       }
        if (fEnergy < baseLine) fEnergy = 0;
 
        return kTRUE;
index 8bfaee6d264d644a1238fddb5d4f467128c7e72a..e3bfff0681f704d3c8d7b31dc20acf9fd54188d3 100644 (file)
@@ -27,6 +27,7 @@ public:
   virtual Bool_t NextDigit();
 
   void SubtractPedestals(Bool_t subtract) {fPedSubtract=subtract;}
+  void SetAmpOffset(Int_t extPed=5){fAmpOffset=extPed ;}
 
   const Double_t GetEnergy() const { return fEnergy; }
   const Double_t GetTime() const { return fTime; }
@@ -51,6 +52,7 @@ protected:
   Double_t fTime;   // "digit" time
   Double_t fQuality ; //Sample quality
   Double_t fPedestalRMS; //calciulated RMS of pedestal (non-ZS runs)
+  Int_t fAmpOffset ; //Pedestal offset from ALTRO chips
   Int_t fModule;    // PHOS module number (1-5)
   Int_t fColumn;    // column in the module
   Int_t fRow;       // row
index c0714303ac26b2876cc83bf176507639c9898ded..38bb48855abc9d61af11af488d61ac24fe6c506b 100644 (file)
@@ -215,6 +215,9 @@ Bool_t AliPHOSRawDecoderv1::NextDigit()
        else
          return kFALSE;
       }
+      else{
+        pedestal = fAmpOffset ;
+      }
 
       //calculate time and energy
       Int_t maxBin=0 ;
@@ -224,7 +227,7 @@ Bool_t AliPHOSRawDecoderv1::NextDigit()
       Double_t wts=0 ;                                                                                                                       
       Int_t tStart = 0 ;                                                                                                                   
       for(Int_t i=iBin; i<fSamples->GetSize(); i++){
-        if(fSamples->At(i)>0){                                                                                                             
+        if(fSamples->At(i)>pedestal){                                                                                                             
           Double_t de=fSamples->At(i)-pedestal ;                                                                                           
           if(de>1.){
             aMean+=de*i ;                                                                                                                      
@@ -293,7 +296,7 @@ Bool_t AliPHOSRawDecoderv1::NextDigit()
        gMinuit->SetFCN(AliPHOSRawDecoderv1::UnfoldingChiSquare) ;  
        // To set the address of the minimization function 
        
-       fToFit->Clear() ;
+       fToFit->Clear("nodelete") ;
        Double_t b,bmin,bmax ;
        if(fLowGainFlag){
          fSampleParamsLow->AddAt(pedestal,4) ;
@@ -483,7 +486,7 @@ Bool_t AliPHOSRawDecoderv1::NextDigit()
       pedRMS += in->GetSignal()*in->GetSignal() ;
       nPed++;
     }
-    fSamples->AddAt(in->GetSignal(),iBin);
+    fSamples->AddAt(in->GetSignal()-10,iBin);
     fTimes->AddAt(in->GetTime(),iBin);
  
 //Debug==============