]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliFMDMCHitHandler.h
A better way to specify the Nch axis for the MultDists task.
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDMCHitHandler.h
1 /**
2  * @file   AliFMDMCHitHandler.h
3  * @author Christian Holm Christensen <cholm@master.hehi.nbi.dk>
4  * @date   Thu Feb  7 12:04:02 2013
5  * 
6  * @brief  
7  * 
8  * 
9  */
10 #ifndef ALIFMDMCHITHANDLER_H
11 #define ALIFMDMCHITHANDLER_H
12 #include <AliMCEventHandler.h>
13 class TFile;
14 class TTree;
15
16 /**
17  * This class defines an input handler for simulated data which will
18  * connect the FMD Hit tree.  It is intended to be added to the global
19  * MC input handler using AliMCEventHandler::AddSubsidiaryHandler
20  * 
21  */
22 class AliFMDMCHitHandler : public AliMCEventHandler
23 {
24 public:
25   /** 
26    * Constructor 
27    * 
28    * @param name Name 
29    */
30   AliFMDMCHitHandler(const char* name="FMD",
31                      const char* clsName="AliFMDHit",
32                      AliMCEventHandler* parent=0);
33
34   virtual ~AliFMDMCHitHandler() {}
35   /** 
36    * @{
37    * @name Interface member functions 
38    */
39   /** 
40    * Intialize 
41    * 
42    * @param t Not used
43    * @param o Not used
44    * 
45    * @return always true 
46    */  
47   virtual Bool_t Init(TTree* t,Option_t* o) { return AliMCEventHandler::Init(t,o); }
48   /** 
49    * Initialize the input
50    * 
51    * @param opt Options 
52    * 
53    * @return true on success 
54    */
55   virtual Bool_t Init(Option_t* opt);
56   /**
57    * Called at the beginning of an event 
58    * 
59    * @param entry Entry in tree 
60    * 
61    * @return true on success
62    */
63   virtual Bool_t BeginEvent(Long64_t entry);
64   /** 
65    * Called when the input file is changed 
66    * 
67    * @param path New path 
68    *
69    * @return true on success
70    */
71   virtual Bool_t Notify() { return AliMCEventHandler::Notify(); }
72   /** 
73    * Called when the input file is changed 
74    * 
75    * @param path New path 
76    *
77    * @return true on success
78    */
79   virtual Bool_t Notify(const char* path);
80   /** 
81    * Called at the end of an event 
82    * 
83    * @return true on success
84    */
85   virtual Bool_t FinishEvent();
86   /** 
87    * Called at the end of a job 
88    * 
89    * @return true on success 
90    */
91   virtual Bool_t Terminate();
92   /** 
93    * Called at the end of a sub-job
94    * 
95    * @return true on success
96    */  
97   virtual Bool_t TerminateIO();
98   /** 
99    * Reset the I/O
100    * 
101    */
102   virtual void ResetIO();
103   /** 
104    * Load an event 
105    * 
106    * @param iev Event number 
107    * 
108    * @return true on success 
109    */
110   virtual Bool_t LoadEvent(Int_t iev);
111   /** 
112    * Set the number of events in the container 
113    * 
114    * @param nev Number of events 
115    */
116   virtual void  SetNumberOfEventsInContainer(Int_t nev) {
117     this->fNEventsInContainer = nev;}
118   virtual Bool_t OpenFile(Int_t ev);
119   /* @} */
120
121   AliMCEventHandler* GetParent() { return fParent; }
122   /** 
123    * Get the tree 
124    * 
125    * @return The connected hits tree
126    */
127   virtual TTree*  GetTree() const { return fTree;}  
128   TClonesArray*      GetArray() { return fArray; }
129   /** 
130    * Static member function to create and attach this handler 
131    * 
132    * @param name Name of the handler 
133    * 
134    * @return Newly allocated handler or null
135    */
136   static AliFMDMCHitHandler* Create(const char* name="FMD",
137                                     const char* what="Hits");
138   static TClonesArray* GetParticleArray(AliFMDMCHitHandler* handler, 
139                                         Int_t particle);
140 protected:
141   AliFMDMCHitHandler(const AliFMDMCHitHandler& o)
142     : AliMCEventHandler(), 
143       fParent(o.fParent),
144       fFile(0), 
145       fTree(0), 
146       fDir(0),
147       fArray(0),
148       fNEvents(0), 
149       fNEventsPerFile(0),
150       fNEventsInContainer(0),
151       fEvent(0), 
152       fFileNumber(0), 
153       fTreeName(""),
154       fFileBase("")
155   {}
156   AliFMDMCHitHandler& operator=(const AliFMDMCHitHandler& o)
157   {
158     if (&o == this) return *this;
159     // AliMCEventHandler::operator=(o);
160     fParent = o.fParent;
161     fFile   = o.fFile;
162     fTree   = o.fTree;
163     return *this;
164   }
165   TString* GetParentPath() const;
166   AliMCEventHandler* fParent; // Parent MC handler 
167   TFile*             fFile;                //!
168   TTree*             fTree;                //!
169   TDirectory*        fDir;                 //!
170   TClonesArray*      fArray;               //!
171   Int_t              fNEvents;             //!
172   Int_t              fNEventsPerFile;      //!
173   Int_t              fNEventsInContainer;  //!
174   Int_t              fEvent;               //!
175   Int_t              fFileNumber;          //!
176   TString            fTreeName;            //!
177   TString            fFileBase;            //! 
178   ClassDef(AliFMDMCHitHandler,1); // Connect FMD hits tree
179 };
180
181 #endif
182 // Local Variables:
183 //  mode: C++
184 // End:
185