LCOV - code coverage report
Current view: top level - EMCAL/EMCALUtils - AliEMCALRecoUtils.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 175 0.6 %
Date: 2016-06-14 17:26:59 Functions: 1 146 0.7 %

          Line data    Source code
       1             : #ifndef ALIEMCALRECOUTILS_H
       2             : #define ALIEMCALRECOUTILS_H
       3             : 
       4             : ///////////////////////////////////////////////////////////////////////////////
       5             : ///
       6             : /// \class AliEMCALRecoUtils
       7             : /// \brief Some utilities for cluster and cell treatment.
       8             : ///
       9             : /// This class contains methods to correct and select the clusters and cells:
      10             : ///   * Calibration of cells/clusters
      11             : ///      * Energy
      12             : ///      * Time
      13             : ///      * Temperature
      14             : ///   * Cluster energy non linearity
      15             : ///   * Rejection of clusters close to borders
      16             : ///   * Rejection of clusters/cells containing/considered bad channels
      17             : ///   * Recalculation of clusters
      18             : ///      * Shower shape
      19             : ///      * Position
      20             : ///      * Matching to tracks
      21             : ///
      22             : /// Plus other helper methods.
      23             : ///
      24             : /// \author:  Gustavo Conesa Balbastre, <Gustavo.Conesa.Balbastre@cern.ch>, LPSC- Grenoble 
      25             : /// \author:  Rongrong Ma, Yale. Track matching part
      26             : ///
      27             : ///////////////////////////////////////////////////////////////////////////////
      28             : 
      29             : // Root includes
      30             : #include <TNamed.h>
      31             : #include <TMath.h>
      32             : class TObjArray;
      33             : class TArrayI;
      34             : class TArrayF;
      35             : #include <TH2I.h>
      36             : class TH2F;
      37             : #include <TRandom3.h>
      38             : 
      39             : // AliRoot includes
      40             : class AliVCluster;
      41             : class AliVCaloCells;
      42             : class AliVEvent;
      43             : #include "AliLog.h"
      44             : 
      45             : // EMCAL includes
      46             : class AliEMCALGeometry;
      47             : class AliEMCALPIDUtils;
      48             : class AliESDtrack;
      49             : class AliExternalTrackParam;
      50             : class AliVTrack;
      51             : 
      52             : class AliEMCALRecoUtils : public TNamed {
      53             :   
      54             : public:
      55             :   
      56             :   AliEMCALRecoUtils();
      57             :   AliEMCALRecoUtils(           const AliEMCALRecoUtils&); 
      58             :   AliEMCALRecoUtils& operator=(const AliEMCALRecoUtils&); 
      59             :   virtual ~AliEMCALRecoUtils() ;  
      60             :   
      61             :   void     InitParameters();
      62             :   void     Print(const Option_t*) const;
      63             : 
      64             :   /// Non linearity enum list of possible parametrizations. 
      65             :   /// Recomended for data kBeamTestCorrectedv3 and for simulation kPi0MCv3
      66             :   enum     NonlinearityFunctions{ kPi0MC   = 0, kPi0GammaGamma = 1,
      67             :                                   kPi0GammaConversion = 2, kNoCorrection = 3,
      68             :                                   kBeamTest= 4, kBeamTestCorrected = 5,
      69             :                                   kPi0MCv2 = 6, kPi0MCv3 = 7,
      70             :                                   kBeamTestCorrectedv2   = 8,
      71             :                                   kSDMv5   = 9, kPi0MCv5 = 10,
      72             :                                   kSDMv6   =11, kPi0MCv6 = 12,
      73             :                                   kBeamTestCorrectedv3   = 13};
      74             : 
      75             :   /// Cluster position enum list of possible algoritms
      76             :   enum     PositionAlgorithms{kUnchanged=-1,kPosTowerIndex=0, kPosTowerGlobal=1};
      77             : 
      78             :   /// Position depth enum list of possible particle types
      79             :   enum     ParticleType{kPhoton=0, kElectron=1, kHadron =2, kUnknown=-1};
      80             :   
      81             :   /// Track matching, Marcel
      82             :   enum     { kNCuts = 12 }; 
      83             :   
      84             :   /// Track matching cuts enum list 
      85             :   enum     TrackCutsType{ kTPCOnlyCut = 0, kGlobalCut = 1, kLooseCut = 2, kITSStandAlone = 3, 
      86             :                           kGlobalCut2011 = 4, kLooseCutWithITSrefit = 5};  
      87             : 
      88             :   //-----------------------------------------------------
      89             :   // Position recalculation
      90             :   //-----------------------------------------------------
      91             :   void     RecalculateClusterPosition               (const AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu); 
      92             :   void     RecalculateClusterPositionFromTowerIndex (const AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu); 
      93             :   void     RecalculateClusterPositionFromTowerGlobal(const AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu); 
      94           0 :   Float_t  GetCellWeight(Float_t eCell, Float_t eCluster) const { if (eCell > 0 && eCluster > 0) return TMath::Max( 0., fW0 + TMath::Log( eCell / eCluster )) ;
      95           0 :                                                                   else                           return 0.                                                    ; }
      96             :   Float_t  GetDepth(Float_t eCluster, Int_t iParticle, Int_t iSM) const; 
      97             :   void     GetMaxEnergyCell(const AliEMCALGeometry *geom, AliVCaloCells* cells, const AliVCluster* clu, 
      98             :                             Int_t & absId,  Int_t& iSupMod, Int_t& ieta, Int_t& iphi, Bool_t &shared);
      99             :   
     100           0 :   Float_t  GetMisalTransShift(Int_t i)       const { if(i < 15 ) { return fMisalTransShift[i] ; }
     101           0 :                                                      else        { AliInfo(Form("Index %d larger than 15, do nothing\n",i)) ; 
     102           0 :                                                                    return 0.                  ; } }
     103           0 :   Float_t* GetMisalTransShiftArray()                  { return fMisalTransShift ; }
     104           0 :   void     SetMisalTransShift(Int_t i, Float_t shift) { if(i < 15 ) { fMisalTransShift[i] = shift ; }
     105           0 :                                                         else        { AliInfo(Form("Index %d larger than 15, do nothing\n",i)) ; } }
     106           0 :   void     SetMisalTransShiftArray(Float_t * misal)   { for(Int_t i = 0; i < 15; i++) fMisalTransShift[i] = misal[i]  ; }
     107           0 :   Float_t  GetMisalRotShift(Int_t i)         const    { if(i < 15 ) { return fMisalRotShift[i]    ; }
     108           0 :                                                         else        { AliInfo(Form("Index %d larger than 15, do nothing\n",i)) ; 
     109           0 :                                                                       return 0.                   ; } }
     110           0 :   Float_t* GetMisalRotShiftArray()                    { return fMisalRotShift                     ; }
     111           0 :   void     SetMisalRotShift(Int_t i, Float_t shift)   { if(i < 15 ) { fMisalRotShift[i] = shift   ; }
     112           0 :                                                         else        { AliInfo(Form("Index %d larger than 15, do nothing\n",i)) ; } }
     113           0 :   void     SetMisalRotShiftArray(Float_t * misal)     { for(Int_t i = 0; i < 15; i++)fMisalRotShift[i] = misal[i] ; }
     114           0 :   Int_t    GetParticleType()                       const { return  fParticleType    ; }
     115           0 :   void     SetParticleType(Int_t particle)               { fParticleType = particle ; }
     116           0 :   Int_t    GetPositionAlgorithm()                  const { return fPosAlgo          ; }
     117           0 :   void     SetPositionAlgorithm(Int_t alg)               { fPosAlgo = alg           ; }
     118           0 :   Float_t  GetW0()                                 const { return fW0               ; }
     119           0 :   void     SetW0(Float_t w0)                             { fW0  = w0                ; }
     120             : 
     121             :   //-----------------------------------------------------
     122             :   // Non Linearity
     123             :   //-----------------------------------------------------
     124             :   Float_t  CorrectClusterEnergyLinearity(AliVCluster* clu) ;
     125           0 :   Float_t  GetNonLinearityParam(Int_t i)     const { if(i < 7 && i >=0 ){ return fNonLinearityParams[i]  ; }
     126           0 :                                                      else  { AliInfo(Form("Index %d larger than 6 or negative, do nothing\n",i)) ;
     127           0 :                                                                          return 0.                     ; } }
     128           0 :   void     SetNonLinearityParam(Int_t i, Float_t param)  { if(i < 7 && i >=0 ){ fNonLinearityParams[i] = param ; }
     129           0 :                                                            else { AliInfo(Form("Index %d larger than 6 or negative, do nothing\n",i)) ; } }
     130             :   void     InitNonLinearityParam();
     131           0 :   Int_t    GetNonLinearityFunction() const               { return fNonLinearityFunction    ; }
     132           0 :   void     SetNonLinearityFunction(Int_t fun)            { fNonLinearityFunction = fun     ; InitNonLinearityParam() ; }
     133           0 :   void     SetNonLinearityThreshold(Int_t threshold)     { fNonLinearThreshold = threshold ; } //only for Alexie's non linearity correction
     134           0 :   Int_t    GetNonLinearityThreshold()              const { return fNonLinearThreshold      ; }
     135             : 
     136             :   //-----------------------------------------------------
     137             :   // MC clusters energy smearing
     138             :   //-----------------------------------------------------
     139             :   Float_t  SmearClusterEnergy(const AliVCluster* clu) ;
     140           0 :   void     SwitchOnClusterEnergySmearing()               { fSmearClusterEnergy = kTRUE         ; }
     141           0 :   void     SwitchOffClusterEnergySmearing()              { fSmearClusterEnergy = kFALSE        ; }
     142           0 :   Bool_t   IsClusterEnergySmeared()                const { return fSmearClusterEnergy          ; }   
     143           0 :   void     SetSmearingParameters(Int_t i, Float_t param) { if(i < 3){ fSmearClusterParam[i] = param ; }
     144           0 :                                                            else     { AliInfo(Form("Index %d larger than 2, do nothing\n",i)) ; } }
     145             :   //-----------------------------------------------------
     146             :   // Recalibration
     147             :   //-----------------------------------------------------
     148             :   Bool_t   AcceptCalibrateCell(Int_t absId, Int_t bc,
     149             :                                Float_t & amp, Double_t & time, AliVCaloCells* cells) ; // Energy and Time
     150             :   void     RecalibrateCells(AliVCaloCells * cells, Int_t bc) ; // Energy and Time
     151             :   void     RecalibrateClusterEnergy(const AliEMCALGeometry* geom, AliVCluster* cluster, AliVCaloCells * cells, Int_t bc=-1) ; // Energy and time
     152           0 :   void     ResetCellsCalibrated()                        { fCellsRecalibrated = kFALSE; }
     153             : 
     154             :   // Energy recalibration
     155           0 :   Bool_t   IsRecalibrationOn()                     const { return fRecalibration ; }
     156           0 :   void     SwitchOffRecalibration()                      { fRecalibration = kFALSE ; }
     157           0 :   void     SwitchOnRecalibration()                       { fRecalibration = kTRUE  ; 
     158           0 :                                                            if(!fEMCALRecalibrationFactors)InitEMCALRecalibrationFactors() ; }
     159             :   void     InitEMCALRecalibrationFactors() ;
     160           0 :   TObjArray* GetEMCALRecalibrationFactorsArray()   const { return fEMCALRecalibrationFactors ; }
     161           0 :   TH2F *   GetEMCALChannelRecalibrationFactors(Int_t iSM)     const { return (TH2F*)fEMCALRecalibrationFactors->At(iSM) ; }  
     162           0 :   void     SetEMCALChannelRecalibrationFactors(TObjArray *map)      { fEMCALRecalibrationFactors = map                  ; }
     163           0 :   void     SetEMCALChannelRecalibrationFactors(Int_t iSM , TH2F* h) { fEMCALRecalibrationFactors->AddAt(h,iSM)          ; }
     164             :   Float_t  GetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow) const { 
     165           0 :     if(fEMCALRecalibrationFactors) 
     166           0 :       return (Float_t) ((TH2F*)fEMCALRecalibrationFactors->At(iSM))->GetBinContent(iCol,iRow); 
     167           0 :     else return 1 ; } 
     168             :   void     SetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) { 
     169           0 :     if(!fEMCALRecalibrationFactors) InitEMCALRecalibrationFactors() ;
     170           0 :     ((TH2F*)fEMCALRecalibrationFactors->At(iSM))->SetBinContent(iCol,iRow,c) ; }
     171             :   
     172             :   // Recalibrate channels energy with run dependent corrections
     173           0 :   Bool_t   IsRunDepRecalibrationOn()               const { return fUseRunCorrectionFactors ; }
     174           0 :   void     SwitchOffRunDepCorrection()                   { fUseRunCorrectionFactors = kFALSE ; }
     175           0 :   void     SwitchOnRunDepCorrection()                    { fUseRunCorrectionFactors = kTRUE  ; 
     176           0 :                                                            SwitchOnRecalibration()           ; }      
     177             :   // Time Recalibration  
     178           0 :   void     SetConstantTimeShift(Float_t shift)           { fConstantTimeShift = shift  ; }
     179             : 
     180             :   void     RecalibrateCellTime(Int_t absId, Int_t bc, Double_t & time,Bool_t isLGon = kFALSE) const;
     181             :   
     182           0 :   Bool_t   IsTimeRecalibrationOn()                 const { return fTimeRecalibration   ; }
     183           0 :   void     SwitchOffTimeRecalibration()                  { fTimeRecalibration = kFALSE ; }
     184           0 :   void     SwitchOnTimeRecalibration()                   { fTimeRecalibration = kTRUE  ; 
     185           0 :                                                            if(!fEMCALTimeRecalibrationFactors)InitEMCALTimeRecalibrationFactors() ; }
     186             :   void     InitEMCALTimeRecalibrationFactors() ;
     187           0 :   TObjArray* GetEMCALTimeRecalibrationFactorsArray() const { return fEMCALTimeRecalibrationFactors ; }
     188             : 
     189             :   Float_t  GetEMCALChannelTimeRecalibrationFactor(Int_t bc, Int_t absID, Bool_t isLGon = kFALSE) const { 
     190           0 :     if(fEMCALTimeRecalibrationFactors) 
     191           0 :       return (Float_t) ((TH1F*)fEMCALTimeRecalibrationFactors->At(bc+4*isLGon))->GetBinContent(absID); 
     192           0 :     else return 0 ; } 
     193             :   void     SetEMCALChannelTimeRecalibrationFactor(Int_t bc, Int_t absID, Double_t c = 0, Bool_t isLGon=kFALSE) { 
     194           0 :     if(!fEMCALTimeRecalibrationFactors) InitEMCALTimeRecalibrationFactors() ;
     195           0 :     ((TH1F*)fEMCALTimeRecalibrationFactors->At(bc+4*isLGon))->SetBinContent(absID,c) ; }  
     196             :   
     197           0 :   TH1F *   GetEMCALChannelTimeRecalibrationFactors(Int_t bc)const       { return (TH1F*)fEMCALTimeRecalibrationFactors->At(bc) ; }   
     198           0 :   void     SetEMCALChannelTimeRecalibrationFactors(TObjArray *map)            { fEMCALTimeRecalibrationFactors = map                 ; }
     199           0 :   void     SetEMCALChannelTimeRecalibrationFactors(Int_t bc , TH1F* h)  { fEMCALTimeRecalibrationFactors->AddAt(h,bc)          ; }
     200             : 
     201           0 :   Bool_t   IsLGOn()const { return fLowGain   ; }
     202           0 :   void     SwitchOffLG() { fLowGain = kFALSE ; }
     203           0 :   void     SwitchOnLG()  { fLowGain = kTRUE  ; }
     204             : 
     205             : 
     206             :   // Time Recalibration with L1 phase
     207           0 :   Bool_t   IsL1PhaseInTimeRecalibrationOn()          const { return fUseL1PhaseInTimeRecalibration   ; }
     208           0 :   void     SwitchOffL1PhaseInTimeRecalibration()           { fUseL1PhaseInTimeRecalibration = kFALSE ; }
     209           0 :   void     SwitchOnL1PhaseInTimeRecalibration()            { fUseL1PhaseInTimeRecalibration = kTRUE  ; 
     210           0 :     if(!fEMCALL1PhaseInTimeRecalibration) InitEMCALL1PhaseInTimeRecalibration() ; }
     211             :   void     InitEMCALL1PhaseInTimeRecalibration() ;
     212             : 
     213             :   void     RecalibrateCellTimeL1Phase(Int_t iSM, Int_t bc, Double_t & time) const;
     214           0 :   TObjArray* GetEMCALL1PhaseInTimeRecalibrationArray() const { return fEMCALL1PhaseInTimeRecalibration ; }
     215             :   Int_t  GetEMCALL1PhaseInTimeRecalibrationForSM(Int_t iSM) const { 
     216           0 :     if(fEMCALL1PhaseInTimeRecalibration) 
     217           0 :       return (Int_t) ((TH1C*)fEMCALL1PhaseInTimeRecalibration->At(0))->GetBinContent(iSM); 
     218           0 :     else return 0 ; } 
     219             :   void     SetEMCALL1PhaseInTimeRecalibrationForSM(Int_t iSM, Int_t c = 0) { 
     220           0 :     if(!fEMCALL1PhaseInTimeRecalibration) InitEMCALL1PhaseInTimeRecalibration();
     221           0 :     ((TH1C*)fEMCALL1PhaseInTimeRecalibration->At(0))->SetBinContent(iSM,c) ; }  
     222             :   
     223           0 :   TH1C *   GetEMCALL1PhaseInTimeRecalibrationForAllSM()const       { return (TH1C*)fEMCALL1PhaseInTimeRecalibration->At(0) ; }       
     224           0 :   void     SetEMCALL1PhaseInTimeRecalibrationForAllSM(TObjArray *map)            { fEMCALL1PhaseInTimeRecalibration = map  ; }
     225           0 :   void     SetEMCALL1PhaseInTimeRecalibrationForAllSM(TH1C* h)     { fEMCALL1PhaseInTimeRecalibration->AddAt(h,0)          ; }
     226             : 
     227             :   //-----------------------------------------------------
     228             :   // Modules fiducial region, remove clusters in borders
     229             :   //-----------------------------------------------------
     230             :   Bool_t   CheckCellFiducialRegion(const AliEMCALGeometry* geom, 
     231             :                                    const AliVCluster* cluster, 
     232             :                                    AliVCaloCells* cells) ;
     233           0 :   void     SetNumberOfCellsFromEMCALBorder(Int_t n){ fNCellsFromEMCALBorder = n      ; }
     234           0 :   Int_t    GetNumberOfCellsFromEMCALBorder()      const  { return fNCellsFromEMCALBorder   ; }
     235             :     
     236           0 :   void     SwitchOnNoFiducialBorderInEMCALEta0()         { fNoEMCALBorderAtEta0 = kTRUE    ; }
     237           0 :   void     SwitchOffNoFiducialBorderInEMCALEta0()        { fNoEMCALBorderAtEta0 = kFALSE   ; }
     238           0 :   Bool_t   IsEMCALNoBorderAtEta0()                 const { return fNoEMCALBorderAtEta0     ; }
     239             :   
     240             :   //-----------------------------------------------------
     241             :   // Bad channels
     242             :   //-----------------------------------------------------
     243           0 :   Bool_t   IsBadChannelsRemovalSwitchedOn()        const { return fRemoveBadChannels       ; }
     244           0 :   void     SwitchOffBadChannelsRemoval()                 { fRemoveBadChannels = kFALSE     ; }
     245           0 :   void     SwitchOnBadChannelsRemoval ()                 { fRemoveBadChannels = kTRUE ; 
     246           0 :                                                            if(!fEMCALBadChannelMap)InitEMCALBadChannelStatusMap() ; }
     247           0 :   Bool_t   IsDistanceToBadChannelRecalculated()    const { return fRecalDistToBadChannels   ; }
     248           0 :   void     SwitchOffDistToBadChannelRecalculation()      { fRecalDistToBadChannels = kFALSE ; }
     249           0 :   void     SwitchOnDistToBadChannelRecalculation()       { fRecalDistToBadChannels = kTRUE  ; 
     250           0 :                                                            if(!fEMCALBadChannelMap)InitEMCALBadChannelStatusMap() ; }
     251           0 :   TObjArray* GetEMCALBadChannelStatusMapArray()    const { return fEMCALBadChannelMap ; }
     252             :   void     InitEMCALBadChannelStatusMap() ;
     253             :   Int_t    GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const { 
     254           0 :     if(fEMCALBadChannelMap) return (Int_t) ((TH2I*)fEMCALBadChannelMap->At(iSM))->GetBinContent(iCol,iRow); 
     255           0 :     else return 0;}//Channel is ok by default
     256             :   void     SetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) { 
     257           0 :     if(!fEMCALBadChannelMap)InitEMCALBadChannelStatusMap()               ;
     258           0 :     ((TH2I*)fEMCALBadChannelMap->At(iSM))->SetBinContent(iCol,iRow,c)    ; }
     259           0 :   TH2I *   GetEMCALChannelStatusMap(Int_t iSM)     const { return (TH2I*)fEMCALBadChannelMap->At(iSM) ; }
     260           0 :   void     SetEMCALChannelStatusMap(TObjArray *map)      { fEMCALBadChannelMap = map                  ; }
     261           0 :   void     SetEMCALChannelStatusMap(Int_t iSM , TH2I* h) { fEMCALBadChannelMap->AddAt(h,iSM)          ; }
     262             :   Bool_t   ClusterContainsBadChannel(const AliEMCALGeometry* geom, const UShort_t* cellList, Int_t nCells);
     263             :  
     264             :   //-----------------------------------------------------
     265             :   // Recalculate other cluster parameters
     266             :   //-----------------------------------------------------
     267             :   void     RecalculateClusterDistanceToBadChannel (const AliEMCALGeometry * geom, AliVCaloCells* cells, AliVCluster * cluster);
     268             :   void     RecalculateClusterShowerShapeParameters(const AliEMCALGeometry * geom, AliVCaloCells* cells, AliVCluster * cluster);
     269             :   void     RecalculateClusterShowerShapeParameters(const AliEMCALGeometry * geom, AliVCaloCells* cells, AliVCluster * cluster,
     270             :                                                    Float_t & l0,   Float_t & l1,   
     271             :                                                    Float_t & disp, Float_t & dEta, Float_t & dPhi,
     272             :                                                    Float_t & sEta, Float_t & sPhi, Float_t & sEtaPhi);
     273             :   
     274             :   void     RecalculateClusterShowerShapeParametersWithCellCuts(const AliEMCALGeometry * geom, AliVCaloCells* cells, AliVCluster * cluster, 
     275             :                                                                Float_t cellEcut, Float_t cellTimeCut, Int_t bc, Float_t & enAfterCuts);
     276             : 
     277             :   void     RecalculateClusterShowerShapeParametersWithCellCuts(const AliEMCALGeometry * geom, AliVCaloCells* cells, AliVCluster * cluster,
     278             :                                                                Float_t cellEcut, Float_t cellTimeCut, Int_t bc,
     279             :                                                                Float_t & enAfterCuts, Float_t & l0,   Float_t & l1,   
     280             :                                                                Float_t & disp, Float_t & dEta, Float_t & dPhi,
     281             :                                                                Float_t & sEta, Float_t & sPhi, Float_t & sEtaPhi);
     282             :   void     RecalculateClusterPID(AliVCluster * cluster);
     283           0 :   AliEMCALPIDUtils * GetPIDUtils() { return fPIDUtils;}
     284             : 
     285             :   //----------------------------------------------------
     286             :   // Track matching
     287             :   //----------------------------------------------------
     288             :   void     FindMatches(AliVEvent *event, TObjArray * clusterArr=0x0, const AliEMCALGeometry *geom=0x0);
     289             :   Int_t    FindMatchedClusterInEvent(const AliESDtrack *track, const AliVEvent *event, 
     290             :                                      const AliEMCALGeometry *geom, Float_t &dEta, Float_t &dPhi);
     291             :   Int_t    FindMatchedClusterInClusterArr(const AliExternalTrackParam *emcalParam, 
     292             :                                           AliExternalTrackParam *trkParam, 
     293             :                                           const TObjArray * clusterArr, 
     294             :                                           Float_t &dEta, Float_t &dPhi);
     295             :   static Bool_t ExtrapolateTrackToEMCalSurface(AliVTrack *track, /*note, on success the call will change the track*/
     296             :                                                Double_t emcalR=440, Double_t mass=0.1396,
     297             :                                                Double_t step=20, Double_t minpT=0.35,
     298             :                                                Bool_t useMassForTracking = kFALSE);
     299             :   static Bool_t ExtrapolateTrackToEMCalSurface(AliExternalTrackParam *trkParam, 
     300             :                                                Double_t emcalR, Double_t mass, Double_t step, 
     301             :                                                Float_t &eta, Float_t &phi, Float_t &pt);
     302             :   static Bool_t ExtrapolateTrackToPosition(AliExternalTrackParam *trkParam, const Float_t *clsPos, 
     303             :                                            Double_t mass, Double_t step, 
     304             :                                            Float_t &tmpEta, Float_t &tmpPhi);
     305             :   static Bool_t ExtrapolateTrackToCluster (AliExternalTrackParam *trkParam, const AliVCluster *cluster, 
     306             :                                            Double_t mass, Double_t step,
     307             :                                            Float_t &tmpEta, Float_t &tmpPhi);
     308             :   Bool_t        ExtrapolateTrackToCluster (AliExternalTrackParam *trkParam, const AliVCluster *cluster, 
     309             :                                            Float_t &tmpEta, Float_t &tmpPhi);
     310             :   UInt_t   FindMatchedPosForCluster(Int_t clsIndex) const;
     311             :   UInt_t   FindMatchedPosForTrack  (Int_t trkIndex) const;
     312             :   void     GetMatchedResiduals       (Int_t clsIndex, Float_t &dEta, Float_t &dPhi);
     313             :   void     GetMatchedClusterResiduals(Int_t trkIndex, Float_t &dEta, Float_t &dPhi);
     314             :   Int_t    GetMatchedTrackIndex(Int_t clsIndex);
     315             :   Int_t    GetMatchedClusterIndex(Int_t trkIndex);
     316             :   Bool_t   IsClusterMatched(Int_t clsIndex)         const;
     317             :   Bool_t   IsTrackMatched  (Int_t trkIndex)         const;
     318             :   void     SetClusterMatchedToTrack (const AliVEvent *event);
     319             :   void     SetTracksMatchedToCluster(const AliVEvent *event);  
     320           0 :   void     SwitchOnCutEtaPhiSum()                     { fCutEtaPhiSum      = kTRUE    ; 
     321           0 :                                                         fCutEtaPhiSeparate = kFALSE   ; }
     322           0 :   void     SwitchOnCutEtaPhiSeparate()                { fCutEtaPhiSeparate = kTRUE    ;
     323           0 :                                                         fCutEtaPhiSum      = kFALSE   ; }
     324           0 :   Float_t  GetCutR()                            const { return fCutR                  ; }
     325           0 :   Float_t  GetCutEta()                          const { return fCutEta                ; }
     326           0 :   Float_t  GetCutPhi()                          const { return fCutPhi                ; }
     327           0 :   Double_t GetClusterWindow()                   const { return fClusterWindow         ; }
     328           0 :   void     SetCutR(Float_t cutR)                      { fCutR   = cutR                ; }
     329           0 :   void     SetCutEta(Float_t cutEta)                  { fCutEta = cutEta              ; }
     330           0 :   void     SetCutPhi(Float_t cutPhi)                  { fCutPhi = cutPhi              ; }
     331           0 :   void     SetClusterWindow(Double_t window)          { fClusterWindow = window       ; }
     332           0 :   void     SetCutZ(Float_t cutZ)                      { printf("Obsolete fucntion of cutZ=%1.1f\n",cutZ) ; } //Obsolete
     333           0 :   void     SetEMCalSurfaceDistance(Double_t d)        { fEMCalSurfaceDistance = d     ; }
     334           0 :   Double_t GetMass()                            const { return fMass                  ; }
     335           0 :   Double_t GetStep()                            const { return fStepCluster           ; }
     336           0 :   Double_t GetStepSurface()                     const { return fStepSurface           ; }
     337           0 :   void     SetMass(Double_t mass)                     { fMass = mass                  ; }
     338           0 :   void     SetStep(Double_t step)                     { fStepSurface = step           ; }
     339           0 :   void     SetStepCluster(Double_t step)              { fStepCluster = step           ; }
     340           0 :   void     SetITSTrackSA(Bool_t isITS)                { fITSTrackSA = isITS           ; } //Special Handle of AliExternTrackParam    
     341             :     
     342             :   // Track Cuts 
     343             :   Bool_t   IsAccepted(AliESDtrack *track);
     344             :   void     InitTrackCuts();
     345           0 :   void     SetTrackCutsType(Int_t type)              { fTrackCutsType = type           ; 
     346           0 :                                                        InitTrackCuts()                 ; }
     347           0 :   Int_t    GetTrackCutsType() const                  { return fTrackCutsType; }
     348             : 
     349             :   // Define AOD track type for matching
     350           0 :   void     SwitchOffAODHybridTracksMatch()           { fAODHybridTracks         = kFALSE ; }
     351           0 :   void     SwitchOffAODTPCOnlyTracksMatch()          { fAODTPCOnlyTracks        = kFALSE ; }
     352           0 :   void     SwitchOnAODHybridTracksMatch()            { fAODHybridTracks         = kTRUE  ; SwitchOffAODTPCOnlyTracksMatch() ; }
     353           0 :   void     SwitchOnAODTPCOnlyTracksMatch()           { fAODTPCOnlyTracks        = kTRUE  ; SwitchOffAODHybridTracksMatch()  ; }
     354           0 :   void     SetAODTrackFilterMask( UInt_t mask)       { fAODFilterMask           = mask   ;
     355           0 :                                                        SwitchOffAODTPCOnlyTracksMatch()  ; SwitchOffAODHybridTracksMatch()  ; }
     356             : 
     357             :   // track quality cut setters
     358           0 :   void     SetMinTrackPt(Double_t pt=0)              { fCutMinTrackPt           = pt   ; }
     359           0 :   void     SetMinNClustersTPC(Int_t min=-1)          { fCutMinNClusterTPC       = min  ; }
     360           0 :   void     SetMinNClustersITS(Int_t min=-1)          { fCutMinNClusterITS       = min  ; }
     361           0 :   void     SetMaxChi2PerClusterTPC(Float_t max=1e10) { fCutMaxChi2PerClusterTPC = max  ; }
     362           0 :   void     SetMaxChi2PerClusterITS(Float_t max=1e10) { fCutMaxChi2PerClusterITS = max  ; }
     363           0 :   void     SetRequireTPCRefit(Bool_t b=kFALSE)       { fCutRequireTPCRefit      = b    ; }
     364           0 :   void     SetRequireITSRefit(Bool_t b=kFALSE)       { fCutRequireITSRefit      = b    ; }
     365           0 :   void     SetAcceptKinkDaughters(Bool_t b=kTRUE)    { fCutAcceptKinkDaughters  = b    ; }
     366           0 :   void     SetMaxDCAToVertexXY(Float_t dist=1e10)    { fCutMaxDCAToVertexXY     = dist ; }
     367           0 :   void     SetMaxDCAToVertexZ(Float_t dist=1e10)     { fCutMaxDCAToVertexZ      = dist ; }
     368           0 :   void     SetDCAToVertex2D(Bool_t b=kFALSE)         { fCutDCAToVertex2D        = b    ; }
     369           0 :   void     SetRequireITSStandAlone(Bool_t b=kFALSE)    {fCutRequireITSStandAlone = b;} //Marcel
     370           0 :   void     SetRequireITSPureStandAlone(Bool_t b=kFALSE){fCutRequireITSpureSA     = b;}
     371             :   
     372             :   // getters                                                            
     373           0 :   Double_t GetMinTrackPt()                     const { return fCutMinTrackPt           ; }
     374           0 :   Int_t    GetMinNClusterTPC()                 const { return fCutMinNClusterTPC       ; }
     375           0 :   Int_t    GetMinNClustersITS()                const { return fCutMinNClusterITS       ; }
     376           0 :   Float_t  GetMaxChi2PerClusterTPC()           const { return fCutMaxChi2PerClusterTPC ; }
     377           0 :   Float_t  GetMaxChi2PerClusterITS()           const { return fCutMaxChi2PerClusterITS ; }
     378           0 :   Bool_t   GetRequireTPCRefit()                const { return fCutRequireTPCRefit      ; }
     379           0 :   Bool_t   GetRequireITSRefit()                const { return fCutRequireITSRefit      ; }
     380           0 :   Bool_t   GetAcceptKinkDaughters()            const { return fCutAcceptKinkDaughters  ; }
     381           0 :   Float_t  GetMaxDCAToVertexXY()               const { return fCutMaxDCAToVertexXY     ; }
     382           0 :   Float_t  GetMaxDCAToVertexZ()                const { return fCutMaxDCAToVertexZ      ; }
     383           0 :   Bool_t   GetDCAToVertex2D()                  const { return fCutDCAToVertex2D        ; }
     384           0 :   Bool_t   GetRequireITSStandAlone()           const { return fCutRequireITSStandAlone ; } //Marcel     
     385             : 
     386             :   //----------------------------------------------------
     387             :   // Exotic cells / clusters
     388             :   //----------------------------------------------------
     389             :   
     390             :   Bool_t   IsExoticCell(Int_t absId, AliVCaloCells* cells, Int_t bc =-1) ;
     391           0 :   void     SwitchOnRejectExoticCell()                 { fRejectExoticCells = kTRUE     ; }
     392           0 :   void     SwitchOffRejectExoticCell()                { fRejectExoticCells = kFALSE    ; } 
     393           0 :   Bool_t   IsRejectExoticCell()                 const { return fRejectExoticCells      ; }
     394             :   Float_t  GetECross(Int_t absID, Double_t tcell,
     395             :                      AliVCaloCells* cells, Int_t bc);
     396           0 :   Float_t  GetExoticCellFractionCut()           const { return fExoticCellFraction     ; }
     397           0 :   Float_t  GetExoticCellDiffTimeCut()           const { return fExoticCellDiffTime     ; }
     398           0 :   Float_t  GetExoticCellMinAmplitudeCut()       const { return fExoticCellMinAmplitude ; }
     399           0 :   void     SetExoticCellFractionCut(Float_t f)        { fExoticCellFraction     = f    ; }
     400           0 :   void     SetExoticCellDiffTimeCut(Float_t dt)       { fExoticCellDiffTime     = dt   ; }
     401           0 :   void     SetExoticCellMinAmplitudeCut(Float_t ma)   { fExoticCellMinAmplitude = ma   ; }
     402             :   Bool_t   IsExoticCluster(const AliVCluster *cluster, AliVCaloCells* cells, Int_t bc=0) ;
     403           0 :   void     SwitchOnRejectExoticCluster()              { fRejectExoticCluster = kTRUE   ;
     404           0 :     fRejectExoticCells   = kTRUE   ; }
     405           0 :   void     SwitchOffRejectExoticCluster()             { fRejectExoticCluster = kFALSE  ; }
     406           0 :   Bool_t   IsRejectExoticCluster()              const { return fRejectExoticCluster    ; }
     407             : 
     408             :   // Cluster selection
     409             :   Bool_t   IsGoodCluster(AliVCluster *cluster, const AliEMCALGeometry *geom, 
     410             :                          AliVCaloCells* cells, Int_t bc =-1);
     411             : 
     412             : private:  
     413             :   
     414             :   // Position recalculation
     415             :   Float_t    fMisalTransShift[15];       ///< Cluster position translation shift parameters
     416             :   Float_t    fMisalRotShift[15];         ///< Cluster position rotation shift parameters
     417             :   Int_t      fParticleType;              ///< Particle type for depth calculation, see enum ParticleType
     418             :   Int_t      fPosAlgo;                   ///< Position recalculation algorithm, see enum PositionAlgorithms
     419             :   
     420             :   Float_t    fW0;                        ///< Energy weight used in cluster position and shower shape calculations
     421             :     
     422             :   // Non linearity
     423             :   Int_t      fNonLinearityFunction;      ///< Non linearity function choice, see enum NonlinearityFunctions
     424             :   Float_t    fNonLinearityParams[7];     ///< Parameters for the non linearity function
     425             :   Int_t      fNonLinearThreshold;        ///< Non linearity threshold value for kBeamTest non linearity function 
     426             :   
     427             :   // Energy smearing for MC
     428             :   Bool_t     fSmearClusterEnergy;        ///< Smear cluster energy, to be done only for simulated data to match real data
     429             :   Float_t    fSmearClusterParam[3];      ///< Energy smearing parameters
     430             :   TRandom3   fRandom;                    ///< Random generator for cluster energy smearing
     431             :     
     432             :   // Energy Recalibration 
     433             :   Bool_t     fCellsRecalibrated;         ///< Internal bool to check if cells (time/energy) where recalibrated and not recalibrate them when recalculating different things
     434             :   Bool_t     fRecalibration;             ///< Switch on or off the recalibration
     435             :   TObjArray* fEMCALRecalibrationFactors; ///< Array of histograms with map of recalibration factors, EMCAL
     436             :     
     437             :   // Time Recalibration 
     438             :   Float_t    fConstantTimeShift;         ///< Apply a 600 ns (+15.8) time shift in case of simulation, shift in ns.
     439             :   Bool_t     fTimeRecalibration;         ///< Switch on or off the time recalibration
     440             :   TObjArray* fEMCALTimeRecalibrationFactors;   ///< Array of histograms with map of time recalibration factors, EMCAL
     441             :   Bool_t     fLowGain;                   ///< Switch on or off calibration with low gain channels
     442             : 
     443             :   // Time Recalibration with L1 phase 
     444             :   Bool_t     fUseL1PhaseInTimeRecalibration;   ///< Switch on or off the L1 phase in time recalibration
     445             :   TObjArray* fEMCALL1PhaseInTimeRecalibration; ///< Histogram with map of L1 phase per SM, EMCAL
     446             : 
     447             :   // Recalibrate with run dependent corrections, energy
     448             :   Bool_t     fUseRunCorrectionFactors;   ///< Use Run Dependent Correction
     449             :     
     450             :   // Bad Channels
     451             :   Bool_t     fRemoveBadChannels;         ///< Check the channel status provided and remove clusters with bad channels
     452             :   Bool_t     fRecalDistToBadChannels;    ///< Calculate distance from highest energy tower of cluster to closes bad channel
     453             :   TObjArray* fEMCALBadChannelMap;        ///< Array of histograms with map of bad channels, EMCAL
     454             : 
     455             :   // Border cells
     456             :   Int_t      fNCellsFromEMCALBorder;     ///< Number of cells from EMCAL border the cell with maximum amplitude has to be.
     457             :   Bool_t     fNoEMCALBorderAtEta0;       ///< Do fiducial cut in EMCAL region eta = 0?
     458             :   
     459             :   // Exotic cell / cluster
     460             :   Bool_t     fRejectExoticCluster;       ///< Switch on or off exotic cluster rejection
     461             :   Bool_t     fRejectExoticCells;         ///< Remove exotic cells
     462             :   Float_t    fExoticCellFraction;        ///< Good cell if fraction < 1-ecross/ecell
     463             :   Float_t    fExoticCellDiffTime;        ///< If time of candidate to exotic and close cell is too different (in ns), it must be noisy, set amp to 0
     464             :   Float_t    fExoticCellMinAmplitude;    ///< Check for exotic only if amplitud is larger than this value
     465             :   
     466             :   // PID
     467             :   AliEMCALPIDUtils * fPIDUtils;          ///< Recalculate PID parameters
     468             :     
     469             :   // Track matching
     470             :   UInt_t     fAODFilterMask;             ///< Filter mask to select AOD tracks. Refer to $ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C
     471             :   Bool_t     fAODHybridTracks;           ///< Match with hybrid
     472             :   Bool_t     fAODTPCOnlyTracks;          ///< Match with TPC only tracks
     473             :   
     474             :   TArrayI  * fMatchedTrackIndex;         ///< Array that stores indexes of matched tracks      
     475             :   TArrayI  * fMatchedClusterIndex;       ///< Array that stores indexes of matched clusters
     476             :   TArrayF  * fResidualEta;               ///< Array that stores the residual eta
     477             :   TArrayF  * fResidualPhi;               ///< Array that stores the residual phi
     478             :   Bool_t     fCutEtaPhiSum;              ///< Place cut on sqrt(dEta^2+dPhi^2)
     479             :   Bool_t     fCutEtaPhiSeparate;         ///< Cut on dEta and dPhi separately
     480             :   Float_t    fCutR;                      ///< sqrt(dEta^2+dPhi^2) cut on matching
     481             :   Float_t    fCutEta;                    ///< dEta cut on matching
     482             :   Float_t    fCutPhi;                    ///< dPhi cut on matching
     483             :   Double_t   fClusterWindow;             ///< Select clusters in the window to be matched
     484             :   Double_t   fMass;                      ///< Mass hypothesis of the track
     485             :   Double_t   fStepSurface;               ///< Length of step to extrapolate tracks to EMCal surface
     486             :   Double_t   fStepCluster;               ///< Length of step to extrapolate tracks to clusters
     487             :   Bool_t     fITSTrackSA;                ///< If track matching is to be done with ITS tracks standing alone 
     488             :   Double_t   fEMCalSurfaceDistance;      ///< EMCal surface distance (= 430 by default, the last 10 cm are propagated on a cluster-track pair basis)
     489             :  
     490             :   // Track cuts  
     491             :   Int_t      fTrackCutsType;             ///< ESD track cuts type for matching, see enum TrackCutsType
     492             :   Double_t   fCutMinTrackPt;             ///< Cut on track pT
     493             :   Int_t      fCutMinNClusterTPC;         ///< Min number of tpc clusters
     494             :   Int_t      fCutMinNClusterITS;         ///< Min number of its clusters  
     495             :   Float_t    fCutMaxChi2PerClusterTPC;   ///< Max tpc fit chi2 per tpc cluster
     496             :   Float_t    fCutMaxChi2PerClusterITS;   ///< Max its fit chi2 per its cluster
     497             :   Bool_t     fCutRequireTPCRefit;        ///< Require TPC refit
     498             :   Bool_t     fCutRequireITSRefit;        ///< Require ITS refit
     499             :   Bool_t     fCutAcceptKinkDaughters;    ///< Accepting kink daughters?
     500             :   Float_t    fCutMaxDCAToVertexXY;       ///< Track-to-vertex cut in max absolute distance in xy-plane
     501             :   Float_t    fCutMaxDCAToVertexZ;        ///< Track-to-vertex cut in max absolute distance in z-plane
     502             :   Bool_t     fCutDCAToVertex2D;          ///< If true a 2D DCA cut is made.
     503             :   Bool_t     fCutRequireITSStandAlone;   ///< Require ITSStandAlone
     504             :   Bool_t     fCutRequireITSpureSA;       ///< ITS pure standalone tracks
     505             :   
     506             :   /// \cond CLASSIMP
     507          72 :   ClassDef(AliEMCALRecoUtils, 24) ;
     508             :   /// \endcond
     509             : 
     510             : };
     511             : 
     512             : #endif // ALIEMCALRECOUTILS_H
     513             : 
     514             : 

Generated by: LCOV version 1.11