add possibility to smear the shower shape in simulation
authorgconesab <gustavo.conesa.balbastre@cern.ch>
Wed, 29 Oct 2014 16:57:38 +0000 (17:57 +0100)
committergconesab <gustavo.conesa.balbastre@cern.ch>
Wed, 29 Oct 2014 16:58:01 +0000 (17:58 +0100)
PWGGA/CaloTrackCorrelations/AliAnaPhoton.cxx
PWGGA/CaloTrackCorrelations/AliAnaPhoton.h

index 41def4a..d6c8a58 100755 (executable)
@@ -62,6 +62,7 @@ fNLMCutMin(-1),               fNLMCutMax(10),
 fFillSSHistograms(kFALSE),    fFillOnlySimpleSSHisto(1),
 fNOriginHistograms(8),        fNPrimaryHistograms(4),
 fMomentum(),                  fPrimaryMom(),
+fSmearShowerShape(0),         fSmearShowerShapeWidth(0),    fRandom(0),
 // Histograms
 
 // Control histograms
@@ -109,7 +110,8 @@ fhPtPhotonNPileUpSPDVtxTimeCut(0),    fhPtPhotonNPileUpTrkVtxTimeCut(0),
 fhPtPhotonNPileUpSPDVtxTimeCut2(0),   fhPtPhotonNPileUpTrkVtxTimeCut2(0),
 
 fhEClusterSM(0),                      fhEPhotonSM(0),
-fhPtClusterSM(0),                     fhPtPhotonSM(0)
+fhPtClusterSM(0),                     fhPtPhotonSM(0),
+fhLam0ESmeared(0)
 {
   //default ctor
   
@@ -1276,6 +1278,14 @@ TList *  AliAnaPhoton::GetCreateOutputObjects()
     fhLam0E->SetYTitle("#lambda_{0}^{2}");
     fhLam0E->SetXTitle("#it{E} (GeV)");
     outputContainer->Add(fhLam0E);
+
+    if(fSmearShowerShape && IsDataMC())
+    {
+      fhLam0ESmeared  = new TH2F ("hLam0ESmeared",Form("#lambda_{0}^{2} vs E, smeared width %2.4f",fSmearShowerShapeWidth), nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
+      fhLam0ESmeared->SetYTitle("#lambda_{0}^{2}");
+      fhLam0ESmeared->SetXTitle("#it{E} (GeV)");
+      outputContainer->Add(fhLam0ESmeared);
+    }
     
     fhLam1E  = new TH2F ("hLam1E","#lambda_{1}^{2} vs E", nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
     fhLam1E->SetYTitle("#lambda_{1}^{2}");
@@ -2204,6 +2214,8 @@ void AliAnaPhoton::InitParameters()
        
   fRejectTrackMatch       = kTRUE ;
        
+  fSmearShowerShapeWidth = 0.002;
+  
 }
 
 //__________________________________________________________________
@@ -2369,7 +2381,25 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
     
     FillShowerShapeHistograms(calo,tag,maxCellFraction);
     
-    aodph.SetM02(calo->GetM02());
+    Float_t l0 = calo->GetM02();
+    
+    // Smear the SS to try to match data and simulations,
+    // do it only for simulations.
+    if(fSmearShowerShape && IsDataMC())
+    {
+      // Smear non merged clusters
+//      if( !GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0) &&
+//          !GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEta))
+//      {
+        //printf("Width %f, L0: Before l0 %2.2f ",fSmearShowerShapeWidth, l0);
+        l0 = fRandom.Landau(l0, fSmearShowerShapeWidth);
+        //printf("After %2.2f \n",l0);
+//      }
+      
+      if(fFillSSHistograms) fhLam0ESmeared->Fill(fMomentum.E(),l0);
+    }
+    
+    aodph.SetM02(l0);
     aodph.SetNLM(nMaxima);
     aodph.SetTime(calo->GetTOF()*1e9);
     aodph.SetNCells(calo->GetNCells());
index cd81d8d..61e2fe4 100755 (executable)
@@ -92,7 +92,13 @@ class AliAnaPhoton : public AliAnaCaloTrackCorrBaseClass {
   Bool_t       IsTrackMatchRejectionOn()        const { return fRejectTrackMatch   ; }
   void         SwitchOnTrackMatchRejection()          { fRejectTrackMatch = kTRUE  ; }
   void         SwitchOffTrackMatchRejection()         { fRejectTrackMatch = kFALSE ; }  
-         
+
+  Bool_t       IsShowerShapeSmeared()           const { return fSmearShowerShape   ; }
+  void         SwitchOnShowerShapeSmearing()          { fSmearShowerShape = kTRUE  ; }
+  void         SwitchOffShowerShapeSmearing()         { fSmearShowerShape = kFALSE ; }
+  
+  void         SetShowerShapeSmearWidth(Float_t w )   { fSmearShowerShapeWidth = w ; }
+  
   void         FillNOriginHistograms(Int_t n)         { fNOriginHistograms = n ; 
     if(n > 14) fNOriginHistograms = 14; }
   void         FillNPrimaryHistograms(Int_t n)        { fNPrimaryHistograms= n ;
@@ -131,6 +137,11 @@ class AliAnaPhoton : public AliAnaCaloTrackCorrBaseClass {
   TLorentzVector fMomentum;                         //! Cluster momentum
   TLorentzVector fPrimaryMom;                       //! Primary MC momentum
   
+  Bool_t   fSmearShowerShape;                       // Smear shower shape (use in MC)
+  Float_t  fSmearShowerShapeWidth;                  // Smear shower shape landau function "width" (use in MC)
+  TRandom3 fRandom ;                                //! Random generator
+
+  
   //Histograms 
   TH1F * fhClusterCutsE [10];                       //! control histogram on the different photon selection cuts, E
   TH1F * fhClusterCutsPt[10];                       //! control histogram on the different photon selection cuts, pT
@@ -312,10 +323,13 @@ class AliAnaPhoton : public AliAnaCaloTrackCorrBaseClass {
   TH2F * fhPtClusterSM;                             //! cluster E distribution per SM, before any selection, after reader
   TH2F * fhPtPhotonSM ;                             //! photon-like cluster E distribution per SM
   
+  TH2F * fhLam0ESmeared;                            //! cluster lambda0 vs  E after smearing
+
+  
   AliAnaPhoton(              const AliAnaPhoton & g) ; // cpy ctor
   AliAnaPhoton & operator = (const AliAnaPhoton & g) ; // cpy assignment
   
-  ClassDef(AliAnaPhoton,38)
+  ClassDef(AliAnaPhoton,39)
 
 } ;