1 #include <TVirtualMC.h>
2 #include <TDatabasePDG.h>
5 #include "AliGenReaderHepMC.h"
12 ClassImp(AliGenReaderHepMC)
15 AliGenReaderHepMC& AliGenReaderHepMC::operator=(const AliGenReaderHepMC& rhs)
17 // Assignment operator
22 void AliGenReaderHepMC::Copy(TObject&) const
27 Fatal("Copy","Not implemented!\n");
30 void AliGenReaderHepMC::Init()
33 fEventsHandle = new HepMC::IO_GenEvent(fFileName, std::ios::in);
34 fParticleArray = new TClonesArray("TParticle");
35 fParticleIterator = new TIter(fParticleArray);
41 Int_t AliGenReaderHepMC::NextEvent()
43 // Read the next event
44 if ((fGenEvent = fEventsHandle->read_next_event())) {
45 THepMCParser::ParseGenEvent2TCloneArray(fGenEvent,fParticleArray,false);
46 fParticleIterator->Reset();
49 // implement header... somewhere
51 return fGenEvent->particles_size();
56 TParticle* AliGenReaderHepMC::NextParticle()
59 TParticle * particle = (TParticle*)fParticleIterator->Next();
60 if (particle && particle->GetStatusCode()==1) {
61 particle->SetBit(kTransportBit);
66 void AliGenReaderHepMC::RewindEvent()
68 fParticleIterator->Reset();