#include <SimG4CMS/Forward/interface/TotemTestGem.h>
Public Member Functions | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
TotemTestGem (const edm::ParameterSet &p) | |
virtual | ~TotemTestGem () |
Private Member Functions | |
void | clear () |
void | fillEvent (TotemTestHistoClass &) |
void | update (const BeginOfEvent *evt) |
This routine will be called when the appropriate signal arrives. | |
void | update (const EndOfEvent *evt) |
This routine will be called when the appropriate signal arrives. | |
Private Attributes | |
int | evtnum |
std::vector< TotemG4Hit * > | hits |
std::vector< std::string > | names |
Description: Manages Root file creation for Totem Tests
Usage: Used in testing Totem simulation
Definition at line 41 of file TotemTestGem.h.
TotemTestGem::TotemTestGem | ( | const edm::ParameterSet & | p | ) |
Definition at line 39 of file TotemTestGem.cc.
References edm::ParameterSet::getParameter(), and names.
{ edm::ParameterSet m_Anal = p.getParameter<edm::ParameterSet>("TotemTestGem"); names = m_Anal.getParameter<std::vector<std::string> >("Names"); edm::LogInfo("ForwardSim") << "TotemTestGem:: Initialised as observer of " << "begin of job, begin/end events and of G4step"; }
TotemTestGem::~TotemTestGem | ( | ) | [virtual] |
Definition at line 48 of file TotemTestGem.cc.
{ }
void TotemTestGem::clear | ( | void | ) | [private] |
void TotemTestGem::fillEvent | ( | TotemTestHistoClass & | product | ) | [private] |
Definition at line 102 of file TotemTestGem.cc.
References evtnum, TotemTestHistoClass::fillHit(), TotemG4Hit::getEnergyLoss(), TotemG4Hit::getEntry(), TotemG4Hit::getPabs(), TotemG4Hit::getParentId(), TotemG4Hit::getParticleType(), TotemG4Hit::getTrackID(), TotemG4Hit::getUnitID(), TotemG4Hit::getVx(), TotemG4Hit::getVy(), TotemG4Hit::getVz(), hits, TotemTestHistoClass::setEVT(), sistripsummary::TID, x, detailsBasic3DVector::y, and z.
Referenced by produce().
{ product.setEVT(evtnum); for (unsigned ihit = 0; ihit < hits.size(); ihit++) { TotemG4Hit* aHit = hits[ihit]; int UID = aHit->getUnitID(); int Ptype = aHit->getParticleType(); int TID = aHit->getTrackID(); int PID = aHit->getParentId(); float ELoss = aHit->getEnergyLoss(); float PABS = aHit->getPabs(); float x = aHit->getEntry().x(); float y = aHit->getEntry().y(); float z = aHit->getEntry().z(); float vx = aHit->getVx(); float vy = aHit->getVy(); float vz = aHit->getVz(); product.fillHit(UID, Ptype, TID, PID, ELoss, PABS, vx, vy, vz, x, y,z); } }
void TotemTestGem::produce | ( | edm::Event & | e, |
const edm::EventSetup & | |||
) | [virtual] |
Implements SimProducer.
Definition at line 55 of file TotemTestGem.cc.
References fillEvent(), and edm::Event::put().
{ std::auto_ptr<TotemTestHistoClass> product(new TotemTestHistoClass); fillEvent(*product); e.put(product); }
void TotemTestGem::update | ( | const EndOfEvent * | ) | [private, virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const EndOfEvent * >.
Definition at line 70 of file TotemTestGem.cc.
References evtnum, hits, recoMuon::in, LogDebug, and names.
{ evtnum = (*evt)()->GetEventID(); LogDebug("ForwardSim") << "TotemTestGem:: Fill event " << evtnum; // access to the G4 hit collections G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent(); int nhit = 0; for (unsigned int in=0; in<names.size(); in++) { int HCid = G4SDManager::GetSDMpointer()->GetCollectionID(names[in]); TotemG4HitCollection* theHC = (TotemG4HitCollection*) allHC->GetHC(HCid); LogDebug("ForwardSim") << "TotemTestGem :: Hit Collection for " <<names[in] << " of ID " << HCid << " is obtained at " << theHC; if (HCid >= 0 && theHC > 0) { int nentries = theHC->entries(); LogDebug("ForwardSim") << "TotemTestGem :: " << names[in] << " with " << nentries << " entries"; for (int ihit = 0; ihit <nentries; ihit++) { TotemG4Hit* aHit = (*theHC)[ihit]; hits.push_back(aHit); } nhit += nentries; } } // Writing the data to the Tree LogDebug("ForwardSim") << "TotemTestGem:: --- after fillTree with " << nhit << " Hits"; }
void TotemTestGem::update | ( | const BeginOfEvent * | ) | [private, virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const BeginOfEvent * >.
Definition at line 62 of file TotemTestGem.cc.
int TotemTestGem::evtnum [private] |
Definition at line 64 of file TotemTestGem.h.
Referenced by clear(), fillEvent(), and update().
std::vector<TotemG4Hit*> TotemTestGem::hits [private] |
Definition at line 65 of file TotemTestGem.h.
Referenced by clear(), fillEvent(), and update().
std::vector<std::string> TotemTestGem::names [private] |
Definition at line 63 of file TotemTestGem.h.
Referenced by TotemTestGem(), and update().