if (fGenEvent) delete fGenEvent;
// Read the next event
if ((fGenEvent = fEventsHandle->read_next_event())) {
- THepMCParser::ParseGenEvent2TCloneArray(fGenEvent,fParticleArray,false);
+ THepMCParser::ParseGenEvent2TCloneArray(fGenEvent,fParticleArray,"GEV","CM",false);
fParticleIterator->Reset();
THepMCParser::HeavyIonHeader_t heavyIonHeader;
THepMCParser::PdfHeader_t pdfHeader;
#include <time.h>
#include "THepMCParser.h"
-#include "HepMC/IO_GenEvent.h"
#include "TObject.h"
#include "TTree.h"
#include "TClonesArray.h"
#include "TDatabasePDG.h"
#include "HepMC/IO_GenEvent.h"
+
using namespace std;
}
-string THepMCParser::ParseGenEvent2TCloneArray(HepMC::GenEvent * genEvent, TClonesArray * array, bool requireSecondMotherBeforeDaughters)
+string THepMCParser::ParseGenEvent2TCloneArray(HepMC::GenEvent * genEvent, TClonesArray * array, string momUnit, string lenUnit, bool requireSecondMotherBeforeDaughters)
{
if (requireSecondMotherBeforeDaughters) {
return "requireSecondMotherBeforeDaughters not implemented yet!";
}
+ genEvent->use_units(momUnit, lenUnit);
array->Clear();
ostringstream errMsgStream;
map<int,Int_t> partonMemory; // unordered_map in c++11 - but probably not much performance gain from that: log(n) vs log(1) where constant can be high
// ***** The constructors will parse all the events with this function for you *****
// The work horse of the parser, takes one event and generates the corresponding TClonesArray of TParticles,
+ // Units links directly to HepMC library which governs which units are available
+ // The default momentum unit is GEV, other option is MEV
+ // The default length unit is CM, other option is MM
// requireSecondMotherBeforeDaughters defaults to false
// - Success if length of return string is 0, the provided TClonesArray has been filled
// - Failure otherwise and the return string then contains the error message
// - 2 = transitory particle
// - 4 = beam particle
// The function is static to enable customized wrappers around it
- static std::string ParseGenEvent2TCloneArray(HepMC::GenEvent *, TClonesArray *, bool requireSecondMotherBeforeDaughters = false);
+ static std::string ParseGenEvent2TCloneArray(HepMC::GenEvent *, TClonesArray *, std::string momUnit = "GEV", std::string lenUnit = "CM", bool requireSecondMotherBeforeDaughters = false);
// Depending on the implementation of HepMC::IO_BaseClass there may be information on