![]() |
![]() |
#include <FastSimulation/PileUpProducer/interface/PileUpSimulator.h>
Public Member Functions | |
PileUpSimulator (FSimEvent *aSimEvent) | |
Constructor. | |
void | produce (const HepMC::GenEvent *pu) |
Produce N minimum bias events, and add them to the FSimEvent. | |
~PileUpSimulator () | |
Default Destructor. | |
Private Attributes | |
double | averageNumber_ |
std::string | inputFile |
unsigned | myOutputBuffer |
std::ofstream | myOutputFile |
FSimEvent * | mySimEvent |
std::vector< TBranch * > | theBranches |
std::vector< unsigned > | theCurrentEntry |
std::vector< unsigned > | theCurrentMinBiasEvt |
std::vector< std::string > | theFileNames |
std::vector< TFile * > | theFiles |
std::vector< unsigned > | theNumberOfEntries |
unsigned | theNumberOfFiles |
std::vector< unsigned > | theNumberOfMinBiasEvts |
std::vector< PUEvent * > | thePUEvents |
std::vector< TTree * > | theTrees |
Definition at line 33 of file PileUpSimulator.h.
PileUpSimulator::PileUpSimulator | ( | FSimEvent * | aSimEvent | ) |
Constructor.
Definition at line 9 of file PileUpSimulator.cc.
00010 : 00011 mySimEvent(aSimEvent) 00012 {}
PileUpSimulator::~PileUpSimulator | ( | ) |
void PileUpSimulator::produce | ( | const HepMC::GenEvent * | pu | ) |
Produce N minimum bias events, and add them to the FSimEvent.
Definition at line 16 of file PileUpSimulator.cc.
References FBaseSimEvent::addSimTrack(), FBaseSimEvent::addSimVertex(), mySimEvent, RawParticle::setID(), v, vbegin, and vend.
Referenced by FamosManager::reconstruct().
00017 { 00018 00019 // There might be no pile-up event to process (Poisson and/or flag) 00020 if ( !myGenEvent ) return; 00021 00022 // Pile-up event iterator 00023 HepMC::GenEvent::vertex_const_iterator viter; 00024 HepMC::GenEvent::vertex_const_iterator vbegin = myGenEvent->vertices_begin(); 00025 HepMC::GenEvent::vertex_const_iterator vend = myGenEvent->vertices_end(); 00026 00027 int ievt = 0; 00028 // Loop on all pile-up events 00029 for ( viter=vbegin; viter!=vend; ++viter ) { 00030 00031 // std::cout << "Vertex n0 " << ievt << std::endl; 00032 00033 // The origin vertex (turn it to cm's from GenEvent mm's) 00034 HepMC::GenVertex* v = *viter; 00035 XYZTLorentzVector smearedVertex = 00036 XYZTLorentzVector(v->position().x()/10.,v->position().y()/10., 00037 v->position().z()/10.,v->position().t()/10.); 00038 00039 // std::cout << "Vertex position " << smearedVertex << std::endl; 00040 00041 // Add it to the FBaseSimEvent 00042 int mainVertex = mySimEvent->addSimVertex(smearedVertex); 00043 00044 // Particles iterator 00045 HepMC::GenVertex::particles_out_const_iterator firstDaughterIt = v->particles_out_const_begin(); 00046 HepMC::GenVertex::particles_out_const_iterator lastDaughterIt = v->particles_out_const_end(); 00047 00048 // Loop on particles 00049 for ( ; firstDaughterIt != lastDaughterIt ; ++firstDaughterIt ) { 00050 00051 // A particle 00052 HepMC::GenParticle* daugh = *firstDaughterIt; 00053 RawParticle myPart(XYZTLorentzVector(daugh->momentum().px(), 00054 daugh->momentum().py(), 00055 daugh->momentum().pz(), 00056 daugh->momentum().e()), 00057 smearedVertex); 00058 00059 // Add it to the FBaseSimEvent 00060 myPart.setID(daugh->pdg_id()); 00061 // myPart.print(); 00062 00063 // Add the particle to the event (with a genpartIndex 00064 // indicating the pileup event index) 00065 mySimEvent->addSimTrack(&myPart,mainVertex,-ievt-2); 00066 00067 // End particle loop 00068 } 00069 00070 // Increment the number of pile-up events 00071 ++ievt; 00072 // End vertex loop 00073 } 00074 // Pile-up events now inserted 00075 00076 }
double PileUpSimulator::averageNumber_ [private] |
Definition at line 48 of file PileUpSimulator.h.
std::string PileUpSimulator::inputFile [private] |
Definition at line 51 of file PileUpSimulator.h.
unsigned PileUpSimulator::myOutputBuffer [private] |
Definition at line 64 of file PileUpSimulator.h.
std::ofstream PileUpSimulator::myOutputFile [private] |
Definition at line 63 of file PileUpSimulator.h.
FSimEvent* PileUpSimulator::mySimEvent [private] |
std::vector<TBranch*> PileUpSimulator::theBranches [private] |
Definition at line 56 of file PileUpSimulator.h.
std::vector<unsigned> PileUpSimulator::theCurrentEntry [private] |
Definition at line 58 of file PileUpSimulator.h.
std::vector<unsigned> PileUpSimulator::theCurrentMinBiasEvt [private] |
Definition at line 59 of file PileUpSimulator.h.
std::vector<std::string> PileUpSimulator::theFileNames [private] |
Definition at line 50 of file PileUpSimulator.h.
std::vector<TFile*> PileUpSimulator::theFiles [private] |
Definition at line 54 of file PileUpSimulator.h.
std::vector<unsigned> PileUpSimulator::theNumberOfEntries [private] |
Definition at line 60 of file PileUpSimulator.h.
unsigned PileUpSimulator::theNumberOfFiles [private] |
Definition at line 52 of file PileUpSimulator.h.
std::vector<unsigned> PileUpSimulator::theNumberOfMinBiasEvts [private] |
Definition at line 61 of file PileUpSimulator.h.
std::vector<PUEvent*> PileUpSimulator::thePUEvents [private] |
Definition at line 57 of file PileUpSimulator.h.
std::vector<TTree*> PileUpSimulator::theTrees [private] |
Definition at line 55 of file PileUpSimulator.h.