]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/hfe/AliHFEpidBase.h
Cleanup the code. Fix memory leak. Now inherit from AliAnalysisTaskSE (Antoine, Phili...
[u/mrichter/AliRoot.git] / PWG3 / hfe / AliHFEpidBase.h
1 #ifndef ALIHFEPIDBASE_H
2 #define ALIHFEPIDBASE_H
3  
4 /**************************************************************************
5 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 *                                                                        *
7 * Author: The ALICE Off-line Project.                                    *
8 * Contributors are mentioned in the code where appropriate.              *
9 *                                                                        *
10 * Permission to use, copy, modify and distribute this software and its   *
11 * documentation strictly for non-commercial purposes is hereby granted   *
12 * without fee, provided that the above copyright notice appears in all   *
13 * copies and that both the copyright notice and this permission notice   *
14 * appear in the supporting documentation. The authors make no claims     *
15 * about the suitability of this software for any purpose. It is          *
16 * provided "as is" without express or implied warranty.                  *
17 **************************************************************************/
18
19 /* $Id$ */ 
20
21 //
22 // Base Class for Detector PID Objects
23 // For more information see the implementation file
24 //
25
26  #ifndef ROOT_TNamed
27  #include <TNamed.h>
28  #endif
29
30 class TList;
31 class AliAODpidUtil;
32 class AliESDpid;
33 class AliVParticle;
34 class AliMCParticle;
35 class AliHFEpidQAmanager;
36
37 class AliHFEpidObject{
38   public:
39     typedef enum{ 
40       kESDanalysis,
41       kAODanalysis
42     }AnalysisType_t;
43     AliHFEpidObject():
44       fkRecTrack(NULL), 
45       fAnalysisType(kESDanalysis),
46       fAbInitioPID(-1),
47       fCentrality(99.)
48       {
49       }
50     AliHFEpidObject(const AliHFEpidObject &ref):
51       fkRecTrack(ref.fkRecTrack), 
52       fAnalysisType(ref.fAnalysisType),
53       fAbInitioPID(ref.fAbInitioPID),
54       fCentrality(ref.fCentrality)
55       {
56       }
57     AliHFEpidObject &operator=(const AliHFEpidObject &ref);
58     ~AliHFEpidObject(){};
59
60     void SetRecTrack(const AliVParticle * recTrack) {fkRecTrack = recTrack; }
61     void SetMCTrack(const AliVParticle * mcTrack);
62     void SetAnalysisType(AnalysisType_t type) { fAnalysisType = type; }
63     void SetAbInitioPID(Int_t abInitioPID) { fAbInitioPID = abInitioPID; }
64     void SetCentrality(Float_t centrality) { fCentrality = centrality; }
65
66     const AliVParticle *GetRecTrack() const { return fkRecTrack; }
67     Int_t GetAbInitioPID() const { return fAbInitioPID; }
68     Float_t GetCentrality() const { return fCentrality; }
69     Bool_t IsAODanalysis() const { return fAnalysisType == static_cast<UChar_t>(kAODanalysis); }
70     Bool_t IsESDanalysis() const { return fAnalysisType == static_cast<UChar_t>(kESDanalysis); }
71
72   private:
73     const AliVParticle *fkRecTrack;    // Reconstructed track
74     UChar_t fAnalysisType;      // Analysis Mode (ESD or AOD)
75     Int_t fAbInitioPID;         // AbInitio PID
76     Float_t fCentrality;        // Centrality Information
77 };
78
79 class AliHFEpidBase : public TNamed{
80   public:
81     AliHFEpidBase();
82     AliHFEpidBase(const Char_t *name);
83     AliHFEpidBase(const AliHFEpidBase &c);
84     AliHFEpidBase &operator=(const AliHFEpidBase &c);
85     virtual ~AliHFEpidBase() {};
86     // Framework functions that have to be implemented by the detector PID classes
87     virtual Bool_t InitializePID() = 0;
88     virtual Int_t IsSelected(const AliHFEpidObject *track, AliHFEpidQAmanager *pidqa = NULL) const = 0;
89
90     Bool_t HasMCData() const { return TestBit(kHasMCData); };
91
92     void SetESDpid(AliESDpid * const pid) { fESDpid = pid; }
93     void SetAODpid(AliAODpidUtil * const pid) { fAODpid = pid; }
94     void SetHasMCData(Bool_t hasMCdata = kTRUE) { SetBit(kHasMCData,hasMCdata); };
95
96     AliESDpid *GetESDpid() const { return fESDpid; }; 
97
98   protected:
99     AliESDpid *fESDpid;                         //! ESD PID object
100     AliAODpidUtil *fAODpid;                     //! AOD PID object
101     void Copy(TObject &ref) const;
102
103   private:
104     enum{
105       kHasMCData = BIT(14)
106     };
107
108     ClassDef(AliHFEpidBase, 2)      // Base class for detector Electron ID
109 };
110 #endif