]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/hfe/AliHFEsecVtx.h
Fixes for the TPC PID electron selection and the contamination
[u/mrichter/AliRoot.git] / PWG3 / hfe / AliHFEsecVtx.h
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15 //
16 //  Secondary vertexing construction Class
17 //  Construct secondary vertex from Beauty hadron with electron and
18 //  hadrons, then apply selection criteria
19 //
20
21 #ifndef ALIHFESECVTX_H
22 #define ALIHFESECVTX_H
23
24 #ifndef ROOT_TObject
25 //#include <TObject.h>
26 #endif
27
28 #ifndef ROOT_THnSparse
29 #include <THnSparse.h>
30 #endif
31
32 class TH1F;
33 class TH2F;
34 class TString;
35 class AliESDEvent;
36 class AliAODEvent;
37 class AliVTrack;
38 class AliESDtrack;
39 class AliAODTrack;
40 class AliMCEvent;
41 class AliHFEtrackFilter;
42 class AliHFEpairs;
43 class AliHFEsecVtxs;
44 class AliKFParticle;
45
46 //________________________________________________________________
47 class AliHFEsecVtx : public TObject {
48
49   public: 
50     AliHFEsecVtx();
51     AliHFEsecVtx(const AliHFEsecVtx &p); // copy constructor
52     AliHFEsecVtx &operator=(const AliHFEsecVtx &); // assignment operator
53     virtual ~AliHFEsecVtx();
54
55     void CreateHistograms(TList * const qaList);
56
57     void Process(AliVTrack *track);
58
59     Bool_t HasMCData() const { return TestBit(kHasMCData); };
60     Bool_t IsAODanalysis() const { return TestBit(kAODanalysis); };
61     Bool_t IsESDanalysis() const { return !TestBit(kAODanalysis); };
62
63                 void SetHasMCData(Bool_t hasMCdata = kTRUE) { SetBit(kHasMCData,hasMCdata); };
64     void SetAODAnalysis() { SetBit(kAODanalysis, kTRUE); };
65     void SetESDAnalysis() { SetBit(kAODanalysis, kFALSE); };
66     void SetEvent(AliESDEvent* const ESD){fESD1=ESD;};    // set ESD pointer
67     void SetEventAOD(AliAODEvent* const AOD){fAOD1=AOD;}; // set ESD pointer
68     void SetMCEvent(AliMCEvent* const mcEvent){fMCEvent=mcEvent;};  // set stack pointer
69     void SetMCArray(TClonesArray* const mcarry){fMCArray=mcarry;} // set mcarray pointer
70     void SetUseMCPID(Bool_t usemcpid){fUseMCPID=usemcpid;};
71
72
73     Int_t GetMCPID(AliESDtrack *track); // return MC pid
74                 Int_t GetMCPDG(AliVTrack *track);   // return MC pid
75     Int_t GetPairOriginESD(AliESDtrack* track1, AliESDtrack* track2); // return pair origin as a pdg code
76     Int_t GetPairOriginAOD(AliAODTrack* track1, AliAODTrack* track2); // return pair origin as a pdg code
77     Int_t GetPairCode(const AliVTrack* const track1, const AliVTrack* const track2); // return corresponding pair code to pdg code
78     Int_t GetElectronSource(Int_t mclabel); // return origin of the electron
79     Int_t GetPDG(AliVTrack *track);     // return pdg 
80                 void GetESDPID(AliESDtrack *track, Int_t &recpid, Double_t &recprob); //return esd pid likelihood
81     void GetPrimaryCondition();
82     void RecalcPrimvtx(Int_t nkftrk, Int_t * const, AliKFParticle * const); //recalculate primary vertex
83
84     TClonesArray *HFEpairs();
85     TClonesArray *HFEsecvtxs();
86
87     void AddHFEpairToArray(const AliHFEpairs* const pair);
88     void AddHFEsecvtxToArray(const AliHFEsecVtxs* const secvtx);
89
90     void InitHFEpairs();
91     void InitHFEsecvtxs();
92
93     void DeleteHFEpairs();
94     void DeleteHFEsecvtxs();
95
96     Bool_t SingleTrackCut(AliESDtrack* track1) const; // single track cut
97     void PairAnalysis(AliVTrack* ESDtrack1, AliVTrack* ESDtrack2, Int_t index2); // do e-h analysis
98     void RunSECVTX(AliVTrack *track); // run secondary vertexing algorithm
99
100     void MakeContainer(); // make containers
101
102   protected:
103     void Init();
104     void FindSECVTXCandid(AliVTrack *track);
105     void CalcSECVTXProperty(AliVTrack* track1, AliVTrack* track2, AliVTrack* track3); // calculated distinctive variables
106     void CalcSECVTXProperty(AliVTrack* track1, AliVTrack* track2, AliVTrack* track3, AliVTrack* track4); // calculated distinctive variables
107
108     void Fill4TrkSECVTX(AliVTrack* track, Int_t ipair, Int_t jpair, Int_t kpair);
109     void Fill3TrkSECVTX(AliVTrack* track, Int_t ipair, Int_t jpair);
110     void Fill2TrkSECVTX(AliVTrack* track, AliHFEpairs *pair);
111
112   private:
113     enum{
114       kHasMCData = BIT(15),     // bitset for mc data usage
115       kAODanalysis = BIT(16)    // bitset for aod analysis
116     };
117     enum {kAll, kDirectCharm, kDirectBeauty, kBeautyCharm, kGamma, kPi0, kElse, kBeautyGamma, kBeautyPi0, kBeautyElse, kMisID}; // electron origin 
118     enum {kCharm=4, kBeauty=5}; // quark flavor
119
120     AliHFEtrackFilter *fFilter; // filter Tracks to combine the signal track with
121     AliESDEvent* fESD1; // ESD pointer             
122     AliAODEvent* fAOD1; // AOD pointer             
123     AliMCEvent* fMCEvent;   // MCEvent pointer              
124
125     Bool_t fUseMCPID;   // if use MC pid 
126
127     TString fkSourceLabel[10]; // electron source label
128
129     Int_t fNparents;           // number of heavy hadrons to be considered
130     Int_t fParentSelect[2][7]; // heavy hadron species
131                 Double_t fPtRng[7];        // pt ranges to consider pt dependant dca cut
132                 Double_t fDcaCut[6];       // pt dependant dca cut
133
134     Int_t fNoOfHFEpairs;       // number of e-h pairs  
135     Int_t fNoOfHFEsecvtxs;     // number of secondary vertexes
136     Int_t fArethereSecVtx;     // checker
137
138     TClonesArray *fHFEpairs;   //! Array of pair 
139     TClonesArray *fHFEsecvtxs; //! Array of secondary vertexes 
140     TClonesArray *fMCArray;    //! mc array pointer
141
142                 Double_t fPVx;          // primary vertex copy x 
143                 Double_t fPVy;          // primary vertex copy y
144                 Double_t fPVx2;         // recalculated primary vertex x 
145                 Double_t fPVy2;         // recalculated primary vertex y
146     Double_t fCosPhi;       // cos of opening angle of two pair vertex
147     Double_t fSignedLxy;    // signed Lxy of secondary vertex
148     Double_t fSignedLxy2;   // signed Lxy of secondary vertex based on recalculated primary vertex
149     Double_t fKFchi2;       // chi2 of secondary vertex
150     Double_t fInvmass;      // invariant mass of secondary vertex
151     Double_t fInvmassSigma; // invariant mass sigma of secondary vertex
152     Double_t fKFip;         // impact parameter of secondary vertex track
153     Double_t fKFip2;        // impact parameter of secondary vertex track based on recalculated primary vertex
154
155     Int_t fNsectrk2prim;    // # of secvtx tracks contributing to primvtx calculation
156
157     Double_t fVtxchi2Tightcut; // pair vertex chi2 cut
158     Double_t fVtxchi2Loosecut; // secvtx vertex chi2 cut
159
160     THnSparseF *fPairQA;    // qa histos for pair analysis 
161     THnSparseF *fSecvtxQA;  // qa histos for secvtx
162     TList *fSecVtxList;     // list for secondary vertexing outputs
163
164   ClassDef(AliHFEsecVtx,0);
165 };
166
167 #endif