]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/util/AliHLTMCEvent.h
* Added Component "AliHLTMCGeneratorComponent" -> Creates Pthyias events in HLT aliro...
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTMCEvent.h
1 //-*- Mode: C++ -*-
2
3 // $Id:  $
4
5 #ifndef ALIHLTMCEVENT_H
6 #define ALIHLTMCEVENT_H
7
8 /* This file is property of and copyright by the ALICE HLT Project        * 
9  * ALICE Experiment at CERN, All rights reserved.                         *
10  * See cxx source for full Copyright notice                               */
11
12 /** @file   AliHLTMCEvent.h
13     @author Jochen Thaeder
14     @date   
15     @brief  Container class for an AliMCEvent
16 */
17
18 #include "TObject.h"
19 #include "TParticle.h"
20 #include "TClonesArray.h"
21
22 #include "AliGenPythiaEventHeader.h"
23 #include "AliMCEvent.h"
24 #include "AliAODJet.h"
25 #include "AliStack.h"
26 #include "AliHeader.h"
27
28 #include "AliHLTLogging.h"
29
30 /**
31  * @class  AliHLTMCEvent
32  * Container class for off-line AliMCEvent, as the class AliMCEvent 
33  * is coupled to TTrees and can not be easily copied and send via 
34  * the HLT chain.
35  *
36  * This class as the complete functionality as the off-line class,
37  * only the ones needed so far.
38  *
39  * There is no extra "stack" class, the stack is included in this class 
40  * a TClonesArray of TParticles
41  *
42  */
43
44 class AliHLTMCEvent : public TObject, public AliHLTLogging  {
45   
46 public:
47
48   /*
49    * ---------------------------------------------------------------------------------
50    *                            Constructor / Destructor
51    * ---------------------------------------------------------------------------------
52    */
53
54   /** standard constructor */
55   AliHLTMCEvent();
56   
57   /** destructor */
58   virtual ~AliHLTMCEvent();
59
60   /*
61    * ---------------------------------------------------------------------------------
62    *                               Setter - public
63    * ---------------------------------------------------------------------------------
64    */
65
66   /** Fill the off-line MC event in to this class
67    *  @param stack  ptr to AliStack
68    *  @param header ptr to AliHeader
69    *  @return 0 on sucess, <0 on error
70    */
71   Int_t FillMCEvent( AliStack *stack, AliHeader *header );
72
73   /** Fill the off-line MC event in to this class
74    *  @param pMCEvent ptr to off-line AliMCEvent
75    *  @return 0 on sucess, <0 on error
76    */
77   Int_t FillMCEvent( AliMCEvent *pMCEvent );
78
79   /*
80    * ---------------------------------------------------------------------------------
81    *                                     Getter
82    * ---------------------------------------------------------------------------------
83    */
84
85   // -- Particles
86   // --------------
87
88   /** Get number of particles
89    *  @return number of particles
90    */
91   Int_t GetNumberOfTracks() const { return fNParticles; }
92
93   /** Return particle at index iParticle
94    *  @param iParticle Particle index in local stack
95    *  @return ptr on success, NULL on failure
96    */
97   TParticle* Particle( Int_t iParticle );
98   
99   /** Return next particle
100    *  @return ptr on success, NULL on failure
101    */
102   TParticle* NextParticle();
103
104   /** Get Index of current particle 
105    *  @return Index of current particle
106    */
107   Int_t GetIndex() { return fCurrentParticleIndex; }
108
109   // -- Generated jets
110   // -------------------
111
112   /** Get number of generated jets
113    *  @return number of generated jets
114    */
115   Int_t GetNumberOfGenJets() const { return fNGenJets; }
116
117   /** Return generated jets at index iJet
118    *  @param iJet Generated jet index in local array
119    *  @return ptr on success, NULL on failure
120    */
121   AliAODJet* GenJet( Int_t iJet ) const;
122   
123   /** Return next generated jet
124    *  @return ptr on success, NULL on failure
125    */
126   AliAODJet* NextGenJet() ;
127
128   /*
129    * ---------------------------------------------------------------------------------
130    *                                    Helper
131    * ---------------------------------------------------------------------------------
132    */
133
134   /** Compress the TClonesArray fStack */
135   void Compress();
136
137   /** Reset index for next particle */
138   void Reset();
139
140   ///////////////////////////////////////////////////////////////////////////////////
141
142 private:
143
144   /** copy constructor prohibited */
145   AliHLTMCEvent (const AliHLTMCEvent&);
146
147   /** assignment operator prohibited */
148   AliHLTMCEvent& operator= (const AliHLTMCEvent&);
149
150   /*
151    * ---------------------------------------------------------------------------------
152    *                               Setter - private
153    * ---------------------------------------------------------------------------------
154    */
155
156   // -- Particles
157   // --------------
158  
159   /** Fill the particles in into the local stack
160    *  @param stack ptr to off-line AliStack
161    *  @return         0 on sucess, <0 on error
162    */
163   Int_t FillMCTracks( AliStack *stack );
164   
165   /** Add a particle to this container
166    *  @param particle ptr to TParticle classs
167    */
168   void AddParticle( const TParticle* particle);
169   
170   // -- Generated jets
171   // -------------------
172   
173   /** Fill the jets into local array
174    *  @param stack ptr to off-line AliGenPythiaEventHeader
175    *  @return         0 on sucess, <0 on error
176    */
177   Int_t FillMCJets( AliGenPythiaEventHeader* header );
178
179   /** Add a jet to his container 
180    *  @param stack    ptr to off-line AliGenPythiaEventHeader
181    *  @param iterJet  idx of jet in event
182    */
183   void AddGenJet( AliGenPythiaEventHeader* header, Int_t iterJet );
184
185   /*
186    * ---------------------------------------------------------------------------------
187    *                           Pythia jets - private
188    * ---------------------------------------------------------------------------------
189    */
190
191   /** Retrieve pythia event header out of an AliMCEvent 
192    *  @param mcEvent   ptr to AliMCEvent
193    *  @return          ptr on sucess, NULL on error   
194    */
195   AliGenPythiaEventHeader* GetPythiaEventHeader(AliMCEvent *mcEvent);
196
197   /*
198    * ---------------------------------------------------------------------------------
199    *                             Members - private
200    * ---------------------------------------------------------------------------------
201    */
202
203   // -- Particles
204   // --------------
205
206   /** Current particle */
207   Int_t           fCurrentParticleIndex;         // see above
208
209   /** Number of particles */
210   Int_t           fNParticles;                   // see above
211
212   /** Stack of particles [TParticle]*/
213   TClonesArray   *fStack;                        // see above
214
215   // -- Generated jets
216   // -------------------
217
218   /** Current generated jet */
219   Int_t           fCurrentGenJetIndex;           // see above
220
221   /** Number of generated jets */
222   Int_t           fNGenJets;                     // see above
223   
224   /** Array of generated jets [AliAODJet]*/
225   TClonesArray   *fGenJets;                      // see above
226
227   ClassDef(AliHLTMCEvent, 1)
228
229 };
230 #endif
231