]>
Commit | Line | Data |
---|---|---|
b897d37f | 1 | #ifndef ALIGENREADERHEPMC_H |
2 | #define ALIGENREADERHEPMC_H | |
3 | // Realisations of the AliGenReader interface to be used with AliGenExFile. | |
4 | // NextEvent() loops over events | |
5 | // and NextParticle() loops over particles. | |
6 | // This implementation reads HepMC output formats | |
7 | // Author: brian.peter.thorsbro@cern.ch, brian@thorsbro.dk | |
8 | // Based on AliGenReaderSL by andreas.morsch@cern.ch | |
9 | ||
10 | #include <TClonesArray.h> | |
11 | ||
12 | #include "AliGenReader.h" | |
13 | #include "AliGenEventHeader.h" | |
14 | #include "THepMCParser.h" | |
15 | #include "HepMC/IO_BaseClass.h" | |
16 | #include "HepMC/GenEvent.h" | |
17 | ||
18 | class TParticle; | |
19 | ||
20 | class AliGenReaderHepMC : public AliGenReader | |
21 | { | |
22 | public: | |
23 | inline AliGenReaderHepMC():fEventsHandle(0), fGenEvent(0), fParticleArray(0), fParticleIterator(0), fGenEventHeader(0) {;} | |
24 | AliGenReaderHepMC(const AliGenReaderHepMC &reader) | |
25 | :AliGenReader(reader), fEventsHandle(0), fGenEvent(0), fParticleArray(0), fParticleIterator(0), fGenEventHeader(0) {reader.Copy(*this);} | |
26 | inline virtual ~AliGenReaderHepMC(){ delete fEventsHandle; delete fGenEvent; delete fParticleArray; delete fParticleIterator;} // not deleting fGenEventHeader as it is returned out | |
27 | AliGenEventHeader * GetGenEventHeader() const {return fGenEventHeader;}; | |
28 | virtual void Init(); | |
29 | virtual Int_t NextEvent(); | |
30 | virtual TParticle* NextParticle(); | |
31 | virtual void RewindEvent(); | |
32 | AliGenReaderHepMC & operator=(const AliGenReaderHepMC & rhs); | |
33 | ||
34 | protected: | |
35 | HepMC::IO_BaseClass * fEventsHandle; // pointer to the HepMC file handler | |
36 | HepMC::GenEvent * fGenEvent; // pointer to a generated event | |
37 | TClonesArray * fParticleArray; // pointer to array containing particles of current event | |
38 | TIter * fParticleIterator; // iterator coupled to the array | |
39 | AliGenEventHeader * fGenEventHeader; // AliGenEventHeader | |
40 | ||
41 | private: | |
42 | void Copy(TObject&) const; | |
43 | ||
44 | ClassDef(AliGenReaderHepMC, 1) //Generate particles from external file | |
45 | }; | |
46 | #endif | |
47 | ||
48 | ||
49 |