Raw2SDigits() restored and improved.
authorpolicheh <policheh@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Feb 2009 12:05:09 +0000 (12:05 +0000)
committerpolicheh <policheh@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Feb 2009 12:05:09 +0000 (12:05 +0000)
PHOS/AliPHOS.cxx
PHOS/AliPHOS.h
PHOS/AliPHOSSimParam.cxx
PHOS/AliPHOSSimParam.h

index 702c2c8..7cbced5 100644 (file)
@@ -95,6 +95,7 @@ class TFile;
 #include "AliPHOSPulseGenerator.h"
 #include "AliDAQ.h"
 #include "AliPHOSRawDecoder.h"
+#include "AliPHOSRawDecoderv1.h"
 #include "AliPHOSCalibData.h"
 #include "AliPHOSRawDigiProducer.h"
 #include "AliPHOSQAChecker.h"
@@ -629,3 +630,50 @@ void AliPHOS::SetTreeAddress()
   }
 }
 
+//____________________________________________________________________________          
+Bool_t AliPHOS::Raw2SDigits(AliRawReader* rawReader)    
+{       
+                
+  AliPHOSLoader * loader = dynamic_cast<AliPHOSLoader*>(fLoader) ;      
+                
+  TTree * tree = 0 ;    
+  tree = loader->TreeS() ;      
+  if ( !tree ) {        
+    loader->MakeTree("S");      
+    tree = loader->TreeS() ;    
+  }     
+                
+  TClonesArray * sdigits = loader->SDigits() ;          
+  if(!sdigits) {        
+    loader->MakeSDigitsArray();         
+    sdigits = loader->SDigits();        
+  }     
+  sdigits->Clear();     
+                
+  const TObjArray* maps = AliPHOSRecoParam::GetMappings();
+  if(!maps) AliFatal("Cannot retrieve ALTRO mappings!!");
+
+  AliAltroMapping *mapping[4];
+  for(Int_t i = 0; i < 4; i++) {
+    mapping[i] = (AliAltroMapping*)maps->At(i);
+  }
+
+  AliPHOSRawDecoderv1 dc(rawReader,mapping);    
+
+  dc.SubtractPedestals(AliPHOSSimParam::GetInstance()->EMCSubtractPedestals());
+  dc.SetAmpOffset(AliPHOSSimParam::GetInstance()->GetGlobalAltroOffset());
+  dc.SetAmpThreshold(AliPHOSSimParam::GetInstance()->GetGlobalAltroThreshold());
+
+  AliPHOSRawDigiProducer pr;
+  pr.SetSampleQualityCut(AliPHOSSimParam::GetInstance()->GetEMCSampleQualityCut());     
+  pr.MakeDigits(sdigits,&dc);   
+                
+  Int_t bufferSize = 32000 ;    
+  // TBranch * sdigitsBranch = tree->Branch("PHOS",&sdigits,bufferSize);        
+  tree->Branch("PHOS",&sdigits,bufferSize);     
+  tree->Fill();         
+                
+  fLoader->WriteSDigits("OVERWRITE");   
+  return kTRUE;         
+  
+}
index fd0769a..079ed45 100644 (file)
@@ -86,6 +86,7 @@ public:
   virtual AliDigitizer* CreateDigitizer(AliRunDigitizer* manager) const;
   virtual void  CreateMaterials() ;            
   virtual void  Digits2Raw();
+  virtual Bool_t Raw2SDigits(AliRawReader* rawReader);
   virtual void  FinishRun() {;}
   virtual AliPHOSGeometry * GetGeometry() const 
   {return AliPHOSGeometry::GetInstance(GetTitle(),"") ;  }
index 3e76327..14684e0 100644 (file)
@@ -31,6 +31,8 @@ AliPHOSSimParam::AliPHOSSimParam() :
   fLightFactor(0.),fAPDFactor(0.),         
   fAPDNoise(0.),fEMCDigitThreshold(0.),
   fEMCADCchannel(0.),fTOFa(0.),fTOFb(0.),
+  fEMCSubtractPedestals(kFALSE),
+  fGlobalAltroOffset(0),fGlobalAltroThreshold(0),fEMCSampleQualityCut(0),
   fADCpedestalCpv(0.),fADCchanelCpv(0.),
   fCPVNoise(0.),fCPVDigitThreshold(0.),fNADCcpv(0),
   fDigitizeE(0)
@@ -46,6 +48,8 @@ AliPHOSSimParam::AliPHOSSimParam(Int_t) :
   fLightFactor(0.),fAPDFactor(0.),         
   fAPDNoise(0.),fEMCDigitThreshold(0.),
   fEMCADCchannel(0.),fTOFa(0.),fTOFb(0.),
+  fEMCSubtractPedestals(kFALSE),
+  fGlobalAltroOffset(0),fGlobalAltroThreshold(0),fEMCSampleQualityCut(0),
   fADCpedestalCpv(0.),fADCchanelCpv(0.),
   fCPVNoise(0.),fCPVDigitThreshold(0.),
   fNADCcpv(0),
@@ -89,6 +93,10 @@ AliPHOSSimParam::AliPHOSSimParam(Int_t) :
   fCPVDigitThreshold  = 0.09 ;   // [aux units]
   fNADCcpv  =  (Int_t)TMath::Power(2,12) ;
 
+  fGlobalAltroOffset = 10;
+  fGlobalAltroThreshold = 5;
+  fEMCSampleQualityCut = 4.;
+
   //Imput streams for merging. If true => this stream contains digits (and thus noise) and not SDigits.
   for(Int_t i=0; i<10; i++){
     fDStream[i] = 0 ;
@@ -103,6 +111,8 @@ AliPHOSSimParam::AliPHOSSimParam(const AliPHOSSimParam& ):
   fLightFactor(0.),fAPDFactor(0.),         
   fAPDNoise(0.),fEMCDigitThreshold(0.),
   fEMCADCchannel(0.),fTOFa(0.),fTOFb(0.),
+  fEMCSubtractPedestals(kFALSE),
+  fGlobalAltroOffset(0),fGlobalAltroThreshold(0),fEMCSampleQualityCut(1.),
   fADCpedestalCpv(0.),fADCchanelCpv(0.),
   fCPVNoise(0.),fCPVDigitThreshold(0.),fNADCcpv(0),
   fDigitizeE(0)
index 8ed3516..4bf1745 100644 (file)
@@ -71,6 +71,19 @@ public:
   void    SetStreamDigits(Int_t i){if(i<10)fDStream[i]=kTRUE;}
   Bool_t  IsStreamDigits(Int_t i){return fDStream[i]; }
 
+  //Parameters for RAW embedding
+  void SetEMCSubtractPedestals(Bool_t subtract) { fEMCSubtractPedestals = subtract;}
+  Bool_t  EMCSubtractPedestals()      const { return fEMCSubtractPedestals;    }
+
+  void SetGlobalAltroOffset(Int_t offset)  { fGlobalAltroOffset = offset ; }
+  Int_t   GetGlobalAltroOffset()      const { return fGlobalAltroOffset ;  }
+
+  void SetGlobalAltroThreshold(Int_t ZSth) { fGlobalAltroThreshold = ZSth; }
+  Int_t   GetGlobalAltroThreshold()   const { return fGlobalAltroThreshold;}
+
+  void SetSampleQualityCut(Float_t qcut) { fEMCSampleQualityCut=qcut; }
+  Float_t GetEMCSampleQualityCut()    const { return fEMCSampleQualityCut; }
+
 private:
 
   AliPHOSSimParam(Int_t i); //True constructor which should be called by GetInstance()
@@ -90,6 +103,12 @@ private:
   Float_t fTOFa  ;              //constant term of TOF resolution 
   Float_t fTOFb  ;              //stohastic term of TOF resolution 
 
+  //Parameters used for RAW embedding
+  Bool_t  fEMCSubtractPedestals;   // true if pedestal should be subtracted (in non-ZS)
+  Int_t   fGlobalAltroOffset ;     // Offset used in ALTRO chips in SZ runs
+  Int_t   fGlobalAltroThreshold ;  // Threshold used in ALTRO chips in SZ runs
+  Float_t fEMCSampleQualityCut;    // Cut on pulse shape fit quality
+
   //CPV parameters
   Float_t fADCpedestalCpv ;    //Pedestal value
   Float_t fADCchanelCpv ;      //ADC channel width
@@ -102,7 +121,7 @@ private:
 
   static AliPHOSSimParam * fgSimParam ; // pointer to the unique instance of the class
 
-  ClassDef(AliPHOSSimParam,1)
+  ClassDef(AliPHOSSimParam,2)
 };
 
 #endif