]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALRecoUtils.h
new dielectron tasks from Remi
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALRecoUtils.h
index d2236466ec6749f954b1de7f5a434870d758353b..f063fe4298a8e0335f03dcdba050a8cd1294e2b6 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef ALIEMCALRECOUTILS_H
 #define ALIEMCALRECOUTILS_H
 
-/* $Id: AliEMCALRecoUtils.h 33808 2009-07-15 09:48:08Z gconesab $ */
+/* $Id: AliEMCALRecoUtils.h | Tue Jul 23 09:11:15 2013 +0000 | gconesab  $ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //
@@ -34,6 +34,7 @@ class AliEMCALGeometry;
 class AliEMCALPIDUtils;
 class AliESDtrack;
 class AliExternalTrackParam;
+class AliVTrack;
 
 class AliEMCALRecoUtils : public TNamed {
   
@@ -49,11 +50,11 @@ public:
   void     Print(const Option_t*) const;
 
   //enums
-  enum     NonlinearityFunctions{kPi0MC=0,kPi0GammaGamma=1,kPi0GammaConversion=2,kNoCorrection=3,kBeamTest=4,kBeamTestCorrected=5,kPi0MCv2=6,kPi0MCv3=7};
+  enum     NonlinearityFunctions{kPi0MC=0,kPi0GammaGamma=1,kPi0GammaConversion=2,kNoCorrection=3,kBeamTest=4,kBeamTestCorrected=5,kPi0MCv2=6,kPi0MCv3=7,kBeamTestCorrectedv2=8};
   enum     PositionAlgorithms{kUnchanged=-1,kPosTowerIndex=0, kPosTowerGlobal=1};
   enum     ParticleType{kPhoton=0, kElectron=1,kHadron =2, kUnknown=-1};
-  enum     { kNCuts = 11 }; //track matching
-  enum     TrackCutsType{kTPCOnlyCut=0, kGlobalCut=1, kLooseCut=2};
+  enum     { kNCuts = 12 }; //track matching Marcel
+  enum     TrackCutsType{kTPCOnlyCut=0, kGlobalCut=1, kLooseCut=2, kITSStandAlone=3};  //Marcel
 
   //-----------------------------------------------------
   //Position recalculation
@@ -63,31 +64,31 @@ public:
   void     RecalculateClusterPositionFromTowerIndex (const AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu); 
   void     RecalculateClusterPositionFromTowerGlobal(const AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu); 
   
-  Float_t  GetCellWeight(const Float_t eCell, const Float_t eCluster) const { if (eCell > 0 && eCluster > 0) return TMath::Max( 0., fW0 + TMath::Log( eCell / eCluster )) ;
+  Float_t  GetCellWeight(Float_t eCell, Float_t eCluster) const { if (eCell > 0 && eCluster > 0) return TMath::Max( 0., fW0 + TMath::Log( eCell / eCluster )) ;
                                                                               else                           return 0.                                                    ; }
   
-  Float_t  GetDepth(const Float_t eCluster, const Int_t iParticle, const Int_t iSM) const ; 
+  Float_t  GetDepth(Float_t eCluster, Int_t iParticle, Int_t iSM) const ; 
   
   void     GetMaxEnergyCell(const AliEMCALGeometry *geom, AliVCaloCells* cells, const AliVCluster* clu, 
                             Int_t & absId,  Int_t& iSupMod, Int_t& ieta, Int_t& iphi, Bool_t &shared);
   
-  Float_t  GetMisalTransShift(const Int_t i)       const { if(i < 15 ) { return fMisalTransShift[i] ; }
+  Float_t  GetMisalTransShift(Int_t i)       const { if(i < 15 ) { return fMisalTransShift[i] ; }
                                                            else        { AliInfo(Form("Index %d larger than 15, do nothing\n",i)) ; 
                                                                          return 0.                  ; } }
   Float_t* GetMisalTransShiftArray()                     { return fMisalTransShift ; }
 
-  void     SetMisalTransShift(const Int_t i, const Float_t shift) {
+  void     SetMisalTransShift(Int_t i, Float_t shift) {
                                                            if(i < 15 ) { fMisalTransShift[i] = shift ; }
                                                            else        { AliInfo(Form("Index %d larger than 15, do nothing\n",i)) ; } }
   void     SetMisalTransShiftArray(Float_t * misal)               { for(Int_t i = 0; i < 15; i++) fMisalTransShift[i] = misal[i]  ; }
 
-  Float_t  GetMisalRotShift(const Int_t i)         const { if(i < 15 ) { return fMisalRotShift[i]    ; }
+  Float_t  GetMisalRotShift(Int_t i)         const { if(i < 15 ) { return fMisalRotShift[i]    ; }
                                                            else        { AliInfo(Form("Index %d larger than 15, do nothing\n",i)) ; 
                                                                          return 0.                   ; } }
   
   Float_t* GetMisalRotShiftArray()                       { return fMisalRotShift                     ; }
   
-  void     SetMisalRotShift(const Int_t i, const Float_t shift) {
+  void     SetMisalRotShift(Int_t i, Float_t shift) {
                                                            if(i < 15 ) { fMisalRotShift[i] = shift   ; }
                                                            else        { AliInfo(Form("Index %d larger than 15, do nothing\n",i)) ; } }
   
@@ -108,12 +109,12 @@ public:
 
   Float_t  CorrectClusterEnergyLinearity(AliVCluster* clu) ;
   
-  Float_t  GetNonLinearityParam(const Int_t i)     const { if(i < 7 ){ return fNonLinearityParams[i] ; }
-                                                          else      { AliInfo(Form("Index %d larger than 7, do nothing\n",i)) ; 
+  Float_t  GetNonLinearityParam(Int_t i)     const { if(i < 7 && i >=0 ){ return fNonLinearityParams[i]  ; }
+                                                   else  { AliInfo(Form("Index %d larger than 6 or negative, do nothing\n",i)) ;
                                                                        return 0.                     ; } }
-  void     SetNonLinearityParam(const Int_t i, const Float_t param) {
-                                                          if(i < 7 ){fNonLinearityParams[i] = param ; }
-                                                          else { AliInfo(Form("Index %d larger than 7, do nothing\n",i)) ; } }
+  void     SetNonLinearityParam(Int_t i, Float_t param) {
+                                                           if(i < 7 && i >=0 ){ fNonLinearityParams[i] = param ; }
+                                                           else { AliInfo(Form("Index %d larger than 6 or negative, do nothing\n",i)) ; } }
   void     InitNonLinearityParam();
 
   Int_t    GetNonLinearityFunction() const               { return fNonLinearityFunction    ; }
@@ -135,10 +136,10 @@ public:
   //-----------------------------------------------------
   // Recalibration
   //-----------------------------------------------------
-  Bool_t   AcceptCalibrateCell(const Int_t absId, const Int_t bc,
+  Bool_t   AcceptCalibrateCell(Int_t absId, Int_t bc,
                                Float_t & amp, Double_t & time, AliVCaloCells* cells) ; // Energy and Time
   void     RecalibrateCells(AliVCaloCells * cells, Int_t bc) ; // Energy and Time
-  void     RecalibrateClusterEnergy(const AliEMCALGeometry* geom, AliVCluster* cluster, AliVCaloCells * cells, const Int_t bc=-1) ; // Energy and time
+  void     RecalibrateClusterEnergy(const AliEMCALGeometry* geom, AliVCluster* cluster, AliVCaloCells * cells, Int_t bc=-1) ; // Energy and time
   void     ResetCellsCalibrated()                        { fCellsRecalibrated = kFALSE; }
 
   // Energy recalibration
@@ -169,7 +170,7 @@ public:
   void     SwitchOnRunDepCorrection()                    { fUseRunCorrectionFactors = kTRUE  ; 
                                                            SwitchOnRecalibration()           ; }      
   // Time Recalibration  
-  void     RecalibrateCellTime(const Int_t absId, const Int_t bc, Double_t & time) const;
+  void     RecalibrateCellTime(Int_t absId, Int_t bc, Double_t & time) const;
   
   Bool_t   IsTimeRecalibrationOn()                 const { return fTimeRecalibration   ; }
   void     SwitchOffTimeRecalibration()                  { fTimeRecalibration = kFALSE ; }
@@ -178,18 +179,18 @@ public:
   void     InitEMCALTimeRecalibrationFactors() ;
   TObjArray* GetEMCALTimeRecalibrationFactorsArray() const { return fEMCALTimeRecalibrationFactors ; }
 
-  Float_t  GetEMCALChannelTimeRecalibrationFactor(const Int_t bc, const Int_t absID) const { 
+  Float_t  GetEMCALChannelTimeRecalibrationFactor(Int_t bc, Int_t absID) const { 
     if(fEMCALTimeRecalibrationFactors) 
       return (Float_t) ((TH1F*)fEMCALTimeRecalibrationFactors->At(bc))->GetBinContent(absID); 
     else return 0 ; } 
        
-  void     SetEMCALChannelTimeRecalibrationFactor(const Int_t bc, const Int_t absID, Double_t c = 0) { 
+  void     SetEMCALChannelTimeRecalibrationFactor(Int_t bc, Int_t absID, Double_t c = 0) { 
     if(!fEMCALTimeRecalibrationFactors) InitEMCALTimeRecalibrationFactors() ;
     ((TH1F*)fEMCALTimeRecalibrationFactors->At(bc))->SetBinContent(absID,c) ; }  
   
-  TH1F *   GetEMCALChannelTimeRecalibrationFactors(const Int_t bc)const       { return (TH1F*)fEMCALTimeRecalibrationFactors->At(bc) ; }       
+  TH1F *   GetEMCALChannelTimeRecalibrationFactors(Int_t bc)const       { return (TH1F*)fEMCALTimeRecalibrationFactors->At(bc) ; }     
   void     SetEMCALChannelTimeRecalibrationFactors(TObjArray *map)            { fEMCALTimeRecalibrationFactors = map                 ; }
-  void     SetEMCALChannelTimeRecalibrationFactors(const Int_t bc , TH1F* h)  { fEMCALTimeRecalibrationFactors->AddAt(h,bc)          ; }
+  void     SetEMCALChannelTimeRecalibrationFactors(Int_t bc , TH1F* h)  { fEMCALTimeRecalibrationFactors->AddAt(h,bc)          ; }
   
   //-----------------------------------------------------
   // Modules fiducial region, remove clusters in borders
@@ -198,7 +199,7 @@ public:
   Bool_t   CheckCellFiducialRegion(const AliEMCALGeometry* geom, 
                                    const AliVCluster* cluster, 
                                    AliVCaloCells* cells) ;
-  void     SetNumberOfCellsFromEMCALBorder(const Int_t n){ fNCellsFromEMCALBorder = n      ; }
+  void     SetNumberOfCellsFromEMCALBorder(Int_t n){ fNCellsFromEMCALBorder = n      ; }
   Int_t    GetNumberOfCellsFromEMCALBorder()      const  { return fNCellsFromEMCALBorder   ; }
     
   void     SwitchOnNoFiducialBorderInEMCALEta0()         { fNoEMCALBorderAtEta0 = kTRUE    ; }
@@ -234,7 +235,7 @@ public:
   void     SetEMCALChannelStatusMap(TObjArray *map)      { fEMCALBadChannelMap = map                  ; }
   void     SetEMCALChannelStatusMap(Int_t iSM , TH2I* h) { fEMCALBadChannelMap->AddAt(h,iSM)          ; }
 
-  Bool_t   ClusterContainsBadChannel(const AliEMCALGeometry* geom, const UShort_t* cellList, const Int_t nCells);
+  Bool_t   ClusterContainsBadChannel(const AliEMCALGeometry* geom, const UShort_t* cellList, Int_t nCells);
  
   //-----------------------------------------------------
   // Recalculate other cluster parameters
@@ -263,29 +264,32 @@ public:
                                           AliExternalTrackParam *trkParam, 
                                           const TObjArray * clusterArr, 
                                           Float_t &dEta, Float_t &dPhi);
+
+  static Bool_t ExtrapolateTrackToEMCalSurface(AliVTrack *track, /*note, on success the call will change the track*/
+                                               Double_t emcalR=440, Double_t mass=0.1396, Double_t step=20); 
   
   static Bool_t ExtrapolateTrackToEMCalSurface(AliExternalTrackParam *trkParam, 
-                                               const Double_t emcalR, const Double_t mass, const Double_t step, 
-                                               Float_t &eta, Float_t &phi);
+                                               Double_t emcalR, Double_t mass, Double_t step, 
+                                               Float_t &eta, Float_t &phi, Float_t &pt);
   static Bool_t ExtrapolateTrackToPosition(AliExternalTrackParam *trkParam, const Float_t *clsPos, 
-                                           const Double_t mass, const Double_t step, 
+                                           Double_t mass, Double_t step, 
                                            Float_t &tmpEta, Float_t &tmpPhi);
   static Bool_t ExtrapolateTrackToCluster (AliExternalTrackParam *trkParam, const AliVCluster *cluster, 
-                                           const Double_t mass, const Double_t step,
+                                           Double_t mass, Double_t step,
                                            Float_t &tmpEta, Float_t &tmpPhi);
   Bool_t        ExtrapolateTrackToCluster (AliExternalTrackParam *trkParam, const AliVCluster *cluster, 
                                            Float_t &tmpEta, Float_t &tmpPhi);
 
-  UInt_t   FindMatchedPosForCluster(const Int_t clsIndex) const;
-  UInt_t   FindMatchedPosForTrack  (const Int_t trkIndex) const;
+  UInt_t   FindMatchedPosForCluster(Int_t clsIndex) const;
+  UInt_t   FindMatchedPosForTrack  (Int_t trkIndex) const;
   
-  void     GetMatchedResiduals       (const Int_t clsIndex, Float_t &dEta, Float_t &dPhi);
-  void     GetMatchedClusterResiduals(const Int_t trkIndex, Float_t &dEta, Float_t &dPhi);
+  void     GetMatchedResiduals       (Int_t clsIndex, Float_t &dEta, Float_t &dPhi);
+  void     GetMatchedClusterResiduals(Int_t trkIndex, Float_t &dEta, Float_t &dPhi);
   Int_t    GetMatchedTrackIndex(Int_t clsIndex);
   Int_t    GetMatchedClusterIndex(Int_t trkIndex);
   
-  Bool_t   IsClusterMatched(const Int_t clsIndex)         const;
-  Bool_t   IsTrackMatched  (const Int_t trkIndex)         const;
+  Bool_t   IsClusterMatched(Int_t clsIndex)         const;
+  Bool_t   IsTrackMatched  (Int_t trkIndex)         const;
 
   void     SetClusterMatchedToTrack (const AliVEvent *event);
   void     SetTracksMatchedToCluster(const AliVEvent *event);  
@@ -304,6 +308,7 @@ public:
   void     SetCutPhi(Float_t cutPhi)                  { fCutPhi = cutPhi              ; }
   void     SetClusterWindow(Double_t window)          { fClusterWindow = window       ; }
   void     SetCutZ(Float_t cutZ)                      { printf("Obsolete fucntion of cutZ=%1.1f\n",cutZ) ; } //Obsolete
+  void     SetEMCalSurfaceDistance(Double_t d)        { fEMCalSurfaceDistance = d     ; }
 
   Double_t GetMass()                            const { return fMass                  ; }
   Double_t GetStep()                            const { return fStepCluster           ; }
@@ -312,15 +317,17 @@ public:
   void     SetStep(Double_t step)                     { fStepSurface = step           ; }
   void     SetStepCluster(Double_t step)              { fStepCluster = step           ; }
  
+  void     SetITSTrackSA(Bool_t isITS)                { fITSTrackSA = isITS           ; } //Special Handle of AliExternTrackParam    
+  
   // Exotic cells / clusters
   
-  Bool_t   IsExoticCell(const Int_t absId, AliVCaloCells* cells, const Int_t bc =-1) ;
+  Bool_t   IsExoticCell(Int_t absId, AliVCaloCells* cells, Int_t bc =-1) ;
   void     SwitchOnRejectExoticCell()                 { fRejectExoticCells = kTRUE     ; }
   void     SwitchOffRejectExoticCell()                { fRejectExoticCells = kFALSE    ; } 
   Bool_t   IsRejectExoticCell()                 const { return fRejectExoticCells      ; }
    
-  Float_t  GetECross(const Int_t absID, const Double_t tcell,
-                     AliVCaloCells* cells, const Int_t bc);
+  Float_t  GetECross(Int_t absID, Double_t tcell,
+                     AliVCaloCells* cells, Int_t bc);
   
   Float_t  GetExoticCellFractionCut()           const { return fExoticCellFraction     ; }
   Float_t  GetExoticCellDiffTimeCut()           const { return fExoticCellDiffTime     ; }
@@ -330,7 +337,7 @@ public:
   void     SetExoticCellDiffTimeCut(Float_t dt)       { fExoticCellDiffTime     = dt   ; }
   void     SetExoticCellMinAmplitudeCut(Float_t ma)   { fExoticCellMinAmplitude = ma   ; }
   
-  Bool_t   IsExoticCluster(const AliVCluster *cluster, AliVCaloCells* cells, const Int_t bc=0) ;
+  Bool_t   IsExoticCluster(const AliVCluster *cluster, AliVCaloCells* cells, Int_t bc=0) ;
   void     SwitchOnRejectExoticCluster()              { fRejectExoticCluster = kTRUE   ;
                                                         fRejectExoticCells   = kTRUE   ; }
   void     SwitchOffRejectExoticCluster()             { fRejectExoticCluster = kFALSE  ; }
@@ -338,7 +345,7 @@ public:
   
   //Cluster cut
   Bool_t   IsGoodCluster(AliVCluster *cluster, const AliEMCALGeometry *geom, 
-                         AliVCaloCells* cells, const Int_t bc =-1);
+                         AliVCaloCells* cells, Int_t bc =-1);
 
   //Track Cuts 
   Bool_t   IsAccepted(AliESDtrack *track);
@@ -347,7 +354,15 @@ public:
                                                        InitTrackCuts()                 ; }
   Int_t    GetTrackCutsType() const                  { return fTrackCutsType; }
 
-  // track quality cut setters  
+  // Define AOD track type for matching
+  void     SwitchOffAODHybridTracksMatch()           { fAODHybridTracks         = kFALSE ; }
+  void     SwitchOffAODTPCOnlyTracksMatch()          { fAODTPCOnlyTracks        = kFALSE ; }
+  void     SwitchOnAODHybridTracksMatch()            { fAODHybridTracks         = kTRUE  ; SwitchOffAODTPCOnlyTracksMatch() ; }
+  void     SwitchOnAODTPCOnlyTracksMatch()           { fAODTPCOnlyTracks        = kTRUE  ; SwitchOffAODHybridTracksMatch()  ; }
+  void     SetAODTrackFilterMask( UInt_t mask)       { fAODFilterMask           = mask   ;
+                                                       SwitchOffAODTPCOnlyTracksMatch()  ; SwitchOffAODHybridTracksMatch()  ; }
+  
+  // track quality cut setters
   void     SetMinTrackPt(Double_t pt=0)              { fCutMinTrackPt           = pt   ; }
   void     SetMinNClustersTPC(Int_t min=-1)          { fCutMinNClusterTPC       = min  ; }
   void     SetMinNClustersITS(Int_t min=-1)          { fCutMinNClusterITS       = min  ; }
@@ -359,7 +374,9 @@ public:
   void     SetMaxDCAToVertexXY(Float_t dist=1e10)    { fCutMaxDCAToVertexXY     = dist ; }
   void     SetMaxDCAToVertexZ(Float_t dist=1e10)     { fCutMaxDCAToVertexZ      = dist ; }
   void     SetDCAToVertex2D(Bool_t b=kFALSE)         { fCutDCAToVertex2D        = b    ; }
-
+  void     SetRequireITSStandAlone(Bool_t b=kFALSE)    {fCutRequireITSStandAlone = b;} //Marcel
+  void     SetRequireITSPureStandAlone(Bool_t b=kFALSE){fCutRequireITSpureSA     = b;}
+  
   // getters                                                           
   Double_t GetMinTrackPt()                     const { return fCutMinTrackPt           ; }
   Int_t    GetMinNClusterTPC()                 const { return fCutMinNClusterTPC       ; }
@@ -372,7 +389,7 @@ public:
   Float_t  GetMaxDCAToVertexXY()               const { return fCutMaxDCAToVertexXY     ; }
   Float_t  GetMaxDCAToVertexZ()                const { return fCutMaxDCAToVertexZ      ; }
   Bool_t   GetDCAToVertex2D()                  const { return fCutDCAToVertex2D        ; }
-
+  Bool_t   GetRequireITSStandAlone()           const { return fCutRequireITSStandAlone ; } //Marcel    
 
 private:  
   //Position recalculation
@@ -425,6 +442,9 @@ private:
     
   //Track matching
   UInt_t     fAODFilterMask;             // Filter mask to select AOD tracks. Refer to $ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C
+  Bool_t     fAODHybridTracks;           // Match with hybrid
+  Bool_t     fAODTPCOnlyTracks;          // Match with TPC only tracks
+  
   TArrayI  * fMatchedTrackIndex;         // Array that stores indexes of matched tracks      
   TArrayI  * fMatchedClusterIndex;       // Array that stores indexes of matched clusters
   TArrayF  * fResidualEta;               // Array that stores the residual eta
@@ -438,7 +458,9 @@ private:
   Double_t   fMass;                      // Mass hypothesis of the track
   Double_t   fStepSurface;               // Length of step to extrapolate tracks to EMCal surface
   Double_t   fStepCluster;               // Length of step to extrapolate tracks to clusters
-
+  Bool_t     fITSTrackSA;                // If track matching is to be done with ITS tracks standing alone     
+  Double_t   fEMCalSurfaceDistance;      // EMCal surface distance (= 430 by default, the last 10 cm are propagated on a cluster-track pair basis)
   // Track cuts  
   Int_t      fTrackCutsType;             // Esd track cuts type for matching
   Double_t   fCutMinTrackPt;             // Cut on track pT
@@ -452,8 +474,11 @@ private:
   Float_t    fCutMaxDCAToVertexXY;       // Track-to-vertex cut in max absolute distance in xy-plane
   Float_t    fCutMaxDCAToVertexZ;        // Track-to-vertex cut in max absolute distance in z-plane
   Bool_t     fCutDCAToVertex2D;          // If true a 2D DCA cut is made.
+  Bool_t     fCutRequireITSStandAlone;   // Require ITSStandAlone
+  Bool_t     fCutRequireITSpureSA;      // ITS pure standalone tracks
+  
   
-  ClassDef(AliEMCALRecoUtils, 18)
+  ClassDef(AliEMCALRecoUtils, 21)
   
 };