]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliMCAuxHandler.h
Fix some documentation issues
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliMCAuxHandler.h
1 /**
2  * @file   AliMCAuxHandler.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 AliMCAuxHandler : public AliMCEventHandler
23 {
24 public:
25   /** 
26    * Constructor 
27    * 
28    * @param name    Name 
29    * @param clsName Class name of hits 
30    * @param parent  Parent event handler 
31    */
32   AliMCAuxHandler(const char* name="FMD",
33                      const char* clsName="AliFMDHit",
34                      AliMCEventHandler* parent=0);
35   /** Destructor */
36   virtual ~AliMCAuxHandler() {}
37   /** 
38    * @{
39    * @name Interface member functions 
40    */
41   /** 
42    * Intialize 
43    * 
44    * @param t Not used
45    * @param o Not used
46    * 
47    * @return always true 
48    */  
49   virtual Bool_t Init(TTree* t,Option_t* o) { return AliMCEventHandler::Init(t,o); }
50   /** 
51    * Initialize the input
52    * 
53    * @param opt Options 
54    * 
55    * @return true on success 
56    */
57   virtual Bool_t Init(Option_t* opt);
58   /**
59    * Called at the beginning of an event 
60    * 
61    * @param entry Entry in tree 
62    * 
63    * @return true on success
64    */
65   virtual Bool_t BeginEvent(Long64_t entry);
66   /** 
67    * Called when the input file is changed 
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   /** 
119    * Open a file 
120    * 
121    * @param ev event number 
122    * 
123    * @return true on success
124    */
125   virtual Bool_t OpenFile(Int_t ev);
126   /* @} */
127
128   /** 
129    * Get the parent handler 
130    * 
131    * @return Parent handler
132    */
133   AliMCEventHandler* GetParent() { return fParent; }
134   /** 
135    * Get the tree 
136    * 
137    * @return The connected hits tree
138    */
139   virtual TTree*  GetTree() const { return fTree;}  
140   /** 
141    * Get array of hits 
142    * 
143    * @return Array of hits
144    */
145   TClonesArray*  GetArray() const { return fArray; }
146   /** 
147    * Get the number of entries
148    * 
149    * @return Entries in array 
150    */
151   Int_t         GetNEntry() const;
152   /** 
153    * Get array of track-refs for an entry 
154    * 
155    * @param entry Entry number 
156    * 
157    * @return Array 
158    */
159   TClonesArray* GetEntryArray(Int_t entry);
160   /** 
161    * Static member function to create and attach this handler 
162    * 
163    * @param name Name of the handler 
164    * @param what What to get 
165    * 
166    * @return Newly allocated handler or null
167    */
168   static AliMCAuxHandler* Create(const char* name="FMD",
169                                     const char* what="Hits");
170   /** 
171    * Static member function to get the kinamtics array
172    * 
173    * @param handler   Unput handler
174    * @param particle  Particle number 
175    * 
176    * @return Array of hits 
177    */
178   static TClonesArray* GetParticleArray(AliMCAuxHandler* handler, 
179                                         Int_t particle);
180 protected:
181   /** 
182    * Copy constructor
183    * 
184    * @param o Object to copy from
185    */
186   AliMCAuxHandler(const AliMCAuxHandler& o)
187     : AliMCEventHandler(), 
188       fParent(o.fParent),
189       fFile(0), 
190       fTree(0), 
191       fDir(0),
192       fArray(0),
193       fNEvents(0), 
194       fNEventsPerFile(0),
195       fNEventsInContainer(0),
196       fEvent(0), 
197       fFileNumber(0), 
198       fTreeName(""),
199       fFileBase("")
200   {}
201   /** 
202    * Assignment operator
203    * 
204    * @param o Object to assign from 
205    * 
206    * @return reference to this object 
207    */
208   AliMCAuxHandler& operator=(const AliMCAuxHandler& o)
209   {
210     if (&o == this) return *this;
211     // AliMCEventHandler::operator=(o);
212     fParent = o.fParent;
213     fFile   = o.fFile;
214     fTree   = o.fTree;
215     return *this;
216   }
217   /** 
218    * Get the parent path 
219    * 
220    * @return Parent path
221    */
222   TString* GetParentPath() const;
223   AliMCEventHandler* fParent; // Parent MC handler 
224   TFile*             fFile;                //!
225   TTree*             fTree;                //!
226   TDirectory*        fDir;                 //!
227   TClonesArray*      fArray;               //!
228   Int_t              fNEvents;             //!
229   Int_t              fNEventsPerFile;      //!
230   Int_t              fNEventsInContainer;  //!
231   Int_t              fEvent;               //!
232   Int_t              fFileNumber;          //!
233   TString            fTreeName;            //!
234   TString            fFileBase;            //! 
235   ClassDef(AliMCAuxHandler,1); // Connect FMD hits tree
236 };
237
238 #endif
239 // Local Variables:
240 //  mode: C++
241 // End:
242