]>
Commit | Line | Data |
---|---|---|
b897d37f | 1 | #include <TVirtualMC.h> |
2 | #include <TDatabasePDG.h> | |
3 | #include <TParticle.h> | |
4 | ||
5 | #include "AliGenReaderHepMC.h" | |
6 | #include "AliRun.h" | |
7 | #include "AliStack.h" | |
8 | ||
9 | ||
10 | ||
11 | ||
12 | ClassImp(AliGenReaderHepMC) | |
13 | ||
14 | ||
15 | AliGenReaderHepMC& AliGenReaderHepMC::operator=(const AliGenReaderHepMC& rhs) | |
16 | { | |
17 | // Assignment operator | |
18 | rhs.Copy(*this); | |
19 | return *this; | |
20 | } | |
21 | ||
22 | void AliGenReaderHepMC::Copy(TObject&) const | |
23 | { | |
24 | // | |
25 | // Copy | |
26 | // | |
27 | Fatal("Copy","Not implemented!\n"); | |
28 | } | |
29 | ||
30 | void AliGenReaderHepMC::Init() | |
31 | { | |
32 | // Initialisation | |
33 | fEventsHandle = new HepMC::IO_GenEvent(fFileName, std::ios::in); | |
34 | fParticleArray = new TClonesArray("TParticle"); | |
35 | fParticleIterator = new TIter(fParticleArray); | |
36 | ||
37 | ||
38 | ||
39 | } | |
40 | ||
41 | Int_t AliGenReaderHepMC::NextEvent() | |
42 | { | |
43 | // Read the next event | |
44 | if ((fGenEvent = fEventsHandle->read_next_event())) { | |
45 | THepMCParser::ParseGenEvent2TCloneArray(fGenEvent,fParticleArray,false); | |
46 | fParticleIterator->Reset(); | |
47 | ||
48 | ||
49 | // implement header... somewhere | |
50 | ||
51 | return fGenEvent->particles_size(); | |
52 | } | |
53 | return 0; | |
54 | } | |
55 | ||
56 | TParticle* AliGenReaderHepMC::NextParticle() | |
57 | { | |
58 | // Read next particle | |
59 | TParticle * particle = (TParticle*)fParticleIterator->Next(); | |
60 | if (particle && particle->GetStatusCode()==1) { | |
61 | particle->SetBit(kTransportBit); | |
62 | } | |
63 | return particle; | |
64 | } | |
65 | ||
66 | void AliGenReaderHepMC::RewindEvent() | |
67 | { | |
68 | fParticleIterator->Reset(); | |
69 | } |