]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/AliMCAuxHandler.h
AliMCAuxHandler: A class to handle auxillary input (such as hits or digits)
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliMCAuxHandler.h
CommitLineData
2e658fb9 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>
13class TFile;
14class 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 */
22class AliMCAuxHandler : public AliMCEventHandler
23{
24public:
25 /**
26 * Constructor
27 *
28 * @param name Name
29 */
30 AliMCAuxHandler(const char* name="FMD",
31 const char* clsName="AliFMDHit",
32 AliMCEventHandler* parent=0);
33
34 virtual ~AliMCAuxHandler() {}
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() const { return fArray; }
129 Int_t GetNEntry() const;
130 TClonesArray* GetEntryArray(Int_t entry);
131 /**
132 * Static member function to create and attach this handler
133 *
134 * @param name Name of the handler
135 *
136 * @return Newly allocated handler or null
137 */
138 static AliMCAuxHandler* Create(const char* name="FMD",
139 const char* what="Hits");
140 static TClonesArray* GetParticleArray(AliMCAuxHandler* handler,
141 Int_t particle);
142protected:
143 AliMCAuxHandler(const AliMCAuxHandler& o)
144 : AliMCEventHandler(),
145 fParent(o.fParent),
146 fFile(0),
147 fTree(0),
148 fDir(0),
149 fArray(0),
150 fNEvents(0),
151 fNEventsPerFile(0),
152 fNEventsInContainer(0),
153 fEvent(0),
154 fFileNumber(0),
155 fTreeName(""),
156 fFileBase("")
157 {}
158 AliMCAuxHandler& operator=(const AliMCAuxHandler& o)
159 {
160 if (&o == this) return *this;
161 // AliMCEventHandler::operator=(o);
162 fParent = o.fParent;
163 fFile = o.fFile;
164 fTree = o.fTree;
165 return *this;
166 }
167 TString* GetParentPath() const;
168 AliMCEventHandler* fParent; // Parent MC handler
169 TFile* fFile; //!
170 TTree* fTree; //!
171 TDirectory* fDir; //!
172 TClonesArray* fArray; //!
173 Int_t fNEvents; //!
174 Int_t fNEventsPerFile; //!
175 Int_t fNEventsInContainer; //!
176 Int_t fEvent; //!
177 Int_t fFileNumber; //!
178 TString fTreeName; //!
179 TString fFileBase; //!
180 ClassDef(AliMCAuxHandler,1); // Connect FMD hits tree
181};
182
183#endif
184// Local Variables:
185// mode: C++
186// End:
187