ROOT logo
/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/
//
//  Secondary vertexing construction Class
//  Construct secondary vertex from Beauty hadron with electron and
//  hadrons, then apply selection criteria
//

#ifndef ALIHFEELECBACKGROUND_H
#define ALIHFEELECBACKGROUND_H

#ifndef ROOT_TObject
//#include <TObject.h>
#endif

class AliESDEvent;
class AliESDpid;
class AliESDVertex;
class AliAODEvent;
class AliESDtrack;
class AliAODTrack;
class AliMCEvent;

class AliHFEpid;


//________________________________________________________________
class AliHFEelecbackground : public TObject {
  public: 
    AliHFEelecbackground();
    AliHFEelecbackground(const AliHFEelecbackground &p);
    AliHFEelecbackground &operator=(const AliHFEelecbackground &);
    virtual ~AliHFEelecbackground();
		virtual Bool_t Load(const Char_t *filename);
		virtual Bool_t Load(TList * const outputlist);

    void CreateHistograms(TList * const qaList);
		void Reset();

    Bool_t HasMCData() const { return TestBit(kHasMCData); };
    Bool_t IsAODanalysis() const { return TestBit(kAODanalysis); };
    Bool_t IsESDanalysis() const { return !TestBit(kAODanalysis); };

    void SetHasMCData(Bool_t hasMCdata = kTRUE) { SetBit(kHasMCData,hasMCdata); };
    void SetAODAnalysis() { SetBit(kAODanalysis, kTRUE); };
    void SetESDAnalysis() { SetBit(kAODanalysis, kFALSE); };
    void SetEvent(AliESDEvent* const ESD); 
    void SetEventAOD(AliAODEvent* const AOD){fAOD1=AOD;}; 
    void SetMCEvent(AliMCEvent* const mcEvent){fMCEvent=mcEvent;};  
    
    void SetOpeningAngleCut(Double_t openingAngleCut){fOpeningAngleCut = openingAngleCut;};
    void SetInvMassCut(Double_t invMassCut){fInvMassCut = invMassCut;};
    void SetChi2NdfCut(Double_t chi2NdfCut){fChi2NdfCut = chi2NdfCut;};
    void SetUseAliKFCode(Bool_t useAliKFCode){fUseAliKFCode = useAliKFCode;};    
    void SetSharedClusterCut(Bool_t sharedClusterCut){fSharedClusterCut = sharedClusterCut;};
    void SetRequireITSStandalone(Short_t requireITSStandalone){fRequireITSStandalone = requireITSStandalone;};
    void SetMinITSChi2(Double_t minITSChi2) {fMinITSChi2 = minITSChi2;};
    void SetMinNbCls(Int_t minNbCls){fMinNbCls = minNbCls;};
    void SetMinNbClsSDDSPD(Int_t minNbClsSDDSPD){fMinNbClsSDDSPD = minNbClsSDDSPD;};
    void SetPIDPartner();
    void SetPIDMethodPartner(AliHFEpid * const pid) {fPIDMethodPartner = pid;};
    void SetPIDMethodPartnerITS(AliESDpid * const pid) {fPIDMethodPartnerITS = pid;};
    void SetDebugLevel(Short_t debugLevel) { fDebugLevel = debugLevel;};
    
    Double_t GetOpeningAngleCut() const { return fOpeningAngleCut; };
    Double_t GetInvMassCut() const { return fInvMassCut; };
    Double_t GetChi2NdfCut() const { return fChi2NdfCut; };
    Bool_t GetUseAliKFCode() const { return fUseAliKFCode; };
    Bool_t GetSharedClusterCut() const { return fSharedClusterCut; };
    Short_t GetRequireITSStandalone() const { return fRequireITSStandalone; };
    Int_t GetMinNbCls() const { return fMinNbCls;};
    Double_t GetMinITSChi2() const { return fMinITSChi2; };
    Int_t GetMinNbClsSDDSPD() const { return fMinNbClsSDDSPD;};
    Bool_t GetPIDPartner() const { return fPIDPartner;};
    
    TList *GetList()  const           { return fList; };
    TList *GetListPostProcess() const { return fListPostProcess; };
    
    Bool_t SingleTrackCut(const AliESDtrack* const trackPart) const;
    Bool_t ShareCluster(AliESDtrack * const track1,AliESDtrack * const track2); 
    Bool_t PIDTrackCut(AliESDtrack* const trackPart);
    void PairAnalysis(AliESDtrack* const track, AliESDtrack* const trackpart); 
    void FillOutput(const Double_t *results,const Double_t *resultsr, Int_t sign); 
    void PostProcess();
    void Plot() const;
    
 private:
    enum{
      kHasMCData = BIT(15),             // bitset for mc data usage
	kAODanalysis = BIT(16)            // bitset for aod analysis
	};
    enum {kDatai=0, kDatar=1, kDatadca=2, kDatachi2Ndf=3, kMCo=4, kMCr=5, kMCdca=6, kMCchi2Ndf=7, kMCe=8, kMCcutPart0=9, kMCcutPart1=10, kMCcutPart2=11, kMCcutPart3=12};   // In the fList Data/MC
    enum {kOs=0, kPp=1, kNn=2, kR=3};            // In the last dimension Charge
    enum {kOos=0, kOss=1, kOr=2, kOdiff=3};      // outputs 
    enum {kNOutput=4,kNMCInfo=5};                // Nb of outputs
    enum{
      kElectronFromBackground = 0,
	kElectronFromGamma = 1,
	kElectronFromPi0 = 2,
	kElectronFromEta = 3,
	kElectronFromC = 4,
	kElectronFromB = 5		  
	};                                // MC: Origin 
    enum {kNotSplitted=0, kSplittedOs=1, kSplittedSs=2}; // MC: splitted 
    
    Bool_t CalculateMotherVariable(AliESDtrack* const track, AliESDtrack* const trackpart, Double_t *results);
    void CalculateMotherVariableR(AliESDtrack* const track, AliESDtrack* const trackpart, Double_t *results);
    Int_t IsMotherGamma(Int_t tr);
    Int_t IsMotherPi0(Int_t tr);
    Int_t IsMotherEta(Int_t tr);
    Int_t IsMotherC(Int_t tr);
    Int_t IsMotherB(Int_t tr);
    Int_t GetPdg(Int_t tr);
    Int_t GetLabMother(Int_t tr);
    
    static Double_t BetheBlochElectronITS(const Double_t *x, const Double_t * /*par*/);
    static Double_t BetheBlochMuonITS(const Double_t *x, const Double_t * /*par*/);
    static Double_t BetheBlochPionITS(const Double_t *x, const Double_t * /*par*/);
    static Double_t BetheBlochKaonITS(const Double_t *x, const Double_t * /*par*/);
    static Double_t BetheBlochProtonITS(const Double_t *x, const Double_t * /*par*/); 
    
    static Double_t BetheBlochElectronTPC(const Double_t *x, const Double_t * /*par*/);
    static Double_t BetheBlochMuonTPC(const Double_t *x, const Double_t * /*par*/);
    static Double_t BetheBlochPionTPC(const Double_t *x, const Double_t * /*par*/);
    static Double_t BetheBlochKaonTPC(const Double_t *x, const Double_t * /*par*/);
    static Double_t BetheBlochProtonTPC(const Double_t *x, const Double_t * /*par*/); 
    
    THnSparseF *fhtmp;     // Only to avoid coverity problem
    TH2F *fhtmpf;          // Only to avoid coverity problem
    TH1F *fhtmpp;          // Only to avoid coverity problem
    
    AliESDEvent* fESD1;              //! ESD pointer             
    AliAODEvent* fAOD1;              //! AOD pointer             
    AliMCEvent*  fMCEvent;           //! MC event             
    Double_t fBz;                    // Magnetic field 
    const AliESDVertex *fkVertex;    //! Primary vertex
    static const Double_t fgkMe;     //!  Mass of the electron
    Double_t fPtESD;                 //! pt of tagged electron
    Int_t fIndexTrack;               //! index track
    Int_t fPdg;                      //! pdg code track 
    Int_t fLabMother;                //! label first mother track 
    Int_t fIsFrom;                   //! is track from
    Int_t fMotherGamma;              //! Gamma, mother of track
    Int_t fMotherPi0;                //! Pi0, mother of track
    Int_t fMotherC;                  //! C, mother of track
    Int_t fMotherB;                  //! B, mother of track
    Int_t fMotherEta;                //! eta, mother of track
    Bool_t fIsPartner;               //! Are partners
    Bool_t fIsSplittedTrack;         //! Are splitted track
    
    Double_t fOpeningAngleCut;       //! Opening angle cut
    Double_t fInvMassCut;            //! Inv mass cut
    Double_t fChi2NdfCut;            //! chi2ndf cut for KF code
    
    Bool_t   fUseAliKFCode;          //! Use AliKF code to calculate the pair properties
    
    Bool_t  fSharedClusterCut;       //! Shared Cluster Cut
    Short_t fRequireITSStandalone;   //! ITS standalone: 1 and 2 (pureITSStandalone)
    Int_t  fMinNbCls;                //! Min Nb of clusters ITS or TPC
    Double_t fMinITSChi2;            //! ITS chi2 min
    Int_t  fMinNbClsSDDSPD;          //! Min Nb of clusters ITS SDD&SPD
    Bool_t fPIDPartner;              //! PID partner
    AliHFEpid *fPIDMethodPartner;    //! PID cuts
    AliESDpid *fPIDMethodPartnerITS; //! PID cuts ITS
    
    Short_t fDebugLevel;             //! Debug Level
    
    Bool_t   fCuts[10];               //! Cut passed already
    
    TList *fList;                    //! list for outputs
    TList *fListPostProcess;         //! list for postprocess
    
    static Bool_t  fgUseMCPID;       // flag to use MC PID for tagged electron
    
    ClassDef(AliHFEelecbackground,0);
};

#endif
 AliHFEelecbackground.h:1
 AliHFEelecbackground.h:2
 AliHFEelecbackground.h:3
 AliHFEelecbackground.h:4
 AliHFEelecbackground.h:5
 AliHFEelecbackground.h:6
 AliHFEelecbackground.h:7
 AliHFEelecbackground.h:8
 AliHFEelecbackground.h:9
 AliHFEelecbackground.h:10
 AliHFEelecbackground.h:11
 AliHFEelecbackground.h:12
 AliHFEelecbackground.h:13
 AliHFEelecbackground.h:14
 AliHFEelecbackground.h:15
 AliHFEelecbackground.h:16
 AliHFEelecbackground.h:17
 AliHFEelecbackground.h:18
 AliHFEelecbackground.h:19
 AliHFEelecbackground.h:20
 AliHFEelecbackground.h:21
 AliHFEelecbackground.h:22
 AliHFEelecbackground.h:23
 AliHFEelecbackground.h:24
 AliHFEelecbackground.h:25
 AliHFEelecbackground.h:26
 AliHFEelecbackground.h:27
 AliHFEelecbackground.h:28
 AliHFEelecbackground.h:29
 AliHFEelecbackground.h:30
 AliHFEelecbackground.h:31
 AliHFEelecbackground.h:32
 AliHFEelecbackground.h:33
 AliHFEelecbackground.h:34
 AliHFEelecbackground.h:35
 AliHFEelecbackground.h:36
 AliHFEelecbackground.h:37
 AliHFEelecbackground.h:38
 AliHFEelecbackground.h:39
 AliHFEelecbackground.h:40
 AliHFEelecbackground.h:41
 AliHFEelecbackground.h:42
 AliHFEelecbackground.h:43
 AliHFEelecbackground.h:44
 AliHFEelecbackground.h:45
 AliHFEelecbackground.h:46
 AliHFEelecbackground.h:47
 AliHFEelecbackground.h:48
 AliHFEelecbackground.h:49
 AliHFEelecbackground.h:50
 AliHFEelecbackground.h:51
 AliHFEelecbackground.h:52
 AliHFEelecbackground.h:53
 AliHFEelecbackground.h:54
 AliHFEelecbackground.h:55
 AliHFEelecbackground.h:56
 AliHFEelecbackground.h:57
 AliHFEelecbackground.h:58
 AliHFEelecbackground.h:59
 AliHFEelecbackground.h:60
 AliHFEelecbackground.h:61
 AliHFEelecbackground.h:62
 AliHFEelecbackground.h:63
 AliHFEelecbackground.h:64
 AliHFEelecbackground.h:65
 AliHFEelecbackground.h:66
 AliHFEelecbackground.h:67
 AliHFEelecbackground.h:68
 AliHFEelecbackground.h:69
 AliHFEelecbackground.h:70
 AliHFEelecbackground.h:71
 AliHFEelecbackground.h:72
 AliHFEelecbackground.h:73
 AliHFEelecbackground.h:74
 AliHFEelecbackground.h:75
 AliHFEelecbackground.h:76
 AliHFEelecbackground.h:77
 AliHFEelecbackground.h:78
 AliHFEelecbackground.h:79
 AliHFEelecbackground.h:80
 AliHFEelecbackground.h:81
 AliHFEelecbackground.h:82
 AliHFEelecbackground.h:83
 AliHFEelecbackground.h:84
 AliHFEelecbackground.h:85
 AliHFEelecbackground.h:86
 AliHFEelecbackground.h:87
 AliHFEelecbackground.h:88
 AliHFEelecbackground.h:89
 AliHFEelecbackground.h:90
 AliHFEelecbackground.h:91
 AliHFEelecbackground.h:92
 AliHFEelecbackground.h:93
 AliHFEelecbackground.h:94
 AliHFEelecbackground.h:95
 AliHFEelecbackground.h:96
 AliHFEelecbackground.h:97
 AliHFEelecbackground.h:98
 AliHFEelecbackground.h:99
 AliHFEelecbackground.h:100
 AliHFEelecbackground.h:101
 AliHFEelecbackground.h:102
 AliHFEelecbackground.h:103
 AliHFEelecbackground.h:104
 AliHFEelecbackground.h:105
 AliHFEelecbackground.h:106
 AliHFEelecbackground.h:107
 AliHFEelecbackground.h:108
 AliHFEelecbackground.h:109
 AliHFEelecbackground.h:110
 AliHFEelecbackground.h:111
 AliHFEelecbackground.h:112
 AliHFEelecbackground.h:113
 AliHFEelecbackground.h:114
 AliHFEelecbackground.h:115
 AliHFEelecbackground.h:116
 AliHFEelecbackground.h:117
 AliHFEelecbackground.h:118
 AliHFEelecbackground.h:119
 AliHFEelecbackground.h:120
 AliHFEelecbackground.h:121
 AliHFEelecbackground.h:122
 AliHFEelecbackground.h:123
 AliHFEelecbackground.h:124
 AliHFEelecbackground.h:125
 AliHFEelecbackground.h:126
 AliHFEelecbackground.h:127
 AliHFEelecbackground.h:128
 AliHFEelecbackground.h:129
 AliHFEelecbackground.h:130
 AliHFEelecbackground.h:131
 AliHFEelecbackground.h:132
 AliHFEelecbackground.h:133
 AliHFEelecbackground.h:134
 AliHFEelecbackground.h:135
 AliHFEelecbackground.h:136
 AliHFEelecbackground.h:137
 AliHFEelecbackground.h:138
 AliHFEelecbackground.h:139
 AliHFEelecbackground.h:140
 AliHFEelecbackground.h:141
 AliHFEelecbackground.h:142
 AliHFEelecbackground.h:143
 AliHFEelecbackground.h:144
 AliHFEelecbackground.h:145
 AliHFEelecbackground.h:146
 AliHFEelecbackground.h:147
 AliHFEelecbackground.h:148
 AliHFEelecbackground.h:149
 AliHFEelecbackground.h:150
 AliHFEelecbackground.h:151
 AliHFEelecbackground.h:152
 AliHFEelecbackground.h:153
 AliHFEelecbackground.h:154
 AliHFEelecbackground.h:155
 AliHFEelecbackground.h:156
 AliHFEelecbackground.h:157
 AliHFEelecbackground.h:158
 AliHFEelecbackground.h:159
 AliHFEelecbackground.h:160
 AliHFEelecbackground.h:161
 AliHFEelecbackground.h:162
 AliHFEelecbackground.h:163
 AliHFEelecbackground.h:164
 AliHFEelecbackground.h:165
 AliHFEelecbackground.h:166
 AliHFEelecbackground.h:167
 AliHFEelecbackground.h:168
 AliHFEelecbackground.h:169
 AliHFEelecbackground.h:170
 AliHFEelecbackground.h:171
 AliHFEelecbackground.h:172
 AliHFEelecbackground.h:173
 AliHFEelecbackground.h:174
 AliHFEelecbackground.h:175
 AliHFEelecbackground.h:176
 AliHFEelecbackground.h:177
 AliHFEelecbackground.h:178
 AliHFEelecbackground.h:179
 AliHFEelecbackground.h:180
 AliHFEelecbackground.h:181
 AliHFEelecbackground.h:182
 AliHFEelecbackground.h:183
 AliHFEelecbackground.h:184
 AliHFEelecbackground.h:185
 AliHFEelecbackground.h:186
 AliHFEelecbackground.h:187
 AliHFEelecbackground.h:188
 AliHFEelecbackground.h:189
 AliHFEelecbackground.h:190