CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TotemTestGem Class Reference

#include <SimG4CMS/Forward/interface/TotemTestGem.h>

Inheritance diagram for TotemTestGem:
SimProducer Observer< const BeginOfEvent * > Observer< const EndOfEvent * > SimWatcher

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 
 TotemTestGem (const edm::ParameterSet &p)
 
virtual ~TotemTestGem ()
 
- Public Member Functions inherited from SimProducer
void registerProducts (edm::ProducerBase &iProd)
 
 SimProducer ()
 
- Public Member Functions inherited from SimWatcher
 SimWatcher ()
 
virtual ~SimWatcher ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfEvent * >
 Observer ()
 
void slotForUpdate (const EndOfEvent *iT)
 
virtual ~Observer ()
 

Private Member Functions

void clear ()
 
void fillEvent (TotemTestHistoClass &)
 
void update (const BeginOfEvent *evt)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfEvent *evt)
 This routine will be called when the appropriate signal arrives. More...
 

Private Attributes

int evtnum
 
std::vector< TotemG4Hit * > hits
 
std::vector< std::string > names
 

Additional Inherited Members

- Protected Member Functions inherited from SimProducer
template<class T >
void produces ()
 
template<class T >
void produces (const std::string &instanceName)
 

Detailed Description

Description: Manages Root file creation for Totem Tests

Usage: Used in testing Totem simulation

Definition at line 40 of file TotemTestGem.h.

Constructor & Destructor Documentation

TotemTestGem::TotemTestGem ( const edm::ParameterSet p)

Definition at line 38 of file TotemTestGem.cc.

References edm::ParameterSet::getParameter(), and names.

38  {
39 
40  edm::ParameterSet m_Anal = p.getParameter<edm::ParameterSet>("TotemTestGem");
41  names = m_Anal.getParameter<std::vector<std::string> >("Names");
42 
43  edm::LogInfo("ForwardSim") << "TotemTestGem:: Initialised as observer of "
44  << "begin of job, begin/end events and of G4step";
45 }
T getParameter(std::string const &) const
std::vector< std::string > names
Definition: TotemTestGem.h:62
TotemTestGem::~TotemTestGem ( )
virtual

Definition at line 47 of file TotemTestGem.cc.

47  {
48 }

Member Function Documentation

void TotemTestGem::clear ( void  )
private

Definition at line 123 of file TotemTestGem.cc.

References evtnum, and hits.

Referenced by update().

123  {
124 
125  evtnum = 0;
126  hits.clear();
127 }
std::vector< TotemG4Hit * > hits
Definition: TotemTestGem.h:64
void TotemTestGem::fillEvent ( TotemTestHistoClass product)
private

Definition at line 101 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, y, and z.

Referenced by produce().

101  {
102 
103  product.setEVT(evtnum);
104 
105  for (unsigned ihit = 0; ihit < hits.size(); ihit++) {
106  TotemG4Hit* aHit = hits[ihit];
107  int UID = aHit->getUnitID();
108  int Ptype = aHit->getParticleType();
109  int TID = aHit->getTrackID();
110  int PID = aHit->getParentId();
111  float ELoss = aHit->getEnergyLoss();
112  float PABS = aHit->getPabs();
113  float x = aHit->getEntry().x();
114  float y = aHit->getEntry().y();
115  float z = aHit->getEntry().z();
116  float vx = aHit->getVx();
117  float vy = aHit->getVy();
118  float vz = aHit->getVz();
119  product.fillHit(UID, Ptype, TID, PID, ELoss, PABS, vx, vy, vz, x, y,z);
120  }
121 }
float getEnergyLoss() const
Definition: TotemG4Hit.cc:150
math::XYZPoint getEntry() const
Definition: TotemG4Hit.cc:123
float getPabs() const
Definition: TotemG4Hit.cc:148
float getVy() const
Definition: TotemG4Hit.cc:179
int getTrackID() const
Definition: TotemG4Hit.cc:134
float getVx() const
Definition: TotemG4Hit.cc:176
float getVz() const
Definition: TotemG4Hit.cc:182
int getParentId() const
Definition: TotemG4Hit.cc:173
uint32_t getUnitID() const
Definition: TotemG4Hit.cc:137
std::vector< TotemG4Hit * > hits
Definition: TotemTestGem.h:64
void fillHit(int uID, int pType, int tID, int pID, float eLoss, float pAbs, float vX, float vY, float vZ, float x, float y, float z)
int getParticleType() const
Definition: TotemG4Hit.cc:151
void TotemTestGem::produce ( edm::Event e,
const edm::EventSetup  
)
virtual

Implements SimProducer.

Definition at line 54 of file TotemTestGem.cc.

References fillEvent(), and edm::Event::put().

54  {
55 
56  std::auto_ptr<TotemTestHistoClass> product(new TotemTestHistoClass);
57  fillEvent(*product);
58  e.put(product);
59 }
void fillEvent(TotemTestHistoClass &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
void TotemTestGem::update ( const BeginOfEvent )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 61 of file TotemTestGem.cc.

References clear(), and LogDebug.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

61  {
62 
63  int iev = (*evt)()->GetEventID();
64  LogDebug("ForwardSim") << "TotemTestGem: Begin of event = " << iev;
65  clear();
66 
67 }
#define LogDebug(id)
void TotemTestGem::update ( const EndOfEvent )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfEvent * >.

Definition at line 69 of file TotemTestGem.cc.

References evtnum, hits, recoMuon::in, LogDebug, and names.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

69  {
70 
71  evtnum = (*evt)()->GetEventID();
72  LogDebug("ForwardSim") << "TotemTestGem:: Fill event " << evtnum;
73 
74  // access to the G4 hit collections
75  G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent();
76 
77  int nhit = 0;
78  for (unsigned int in=0; in<names.size(); in++) {
79  int HCid = G4SDManager::GetSDMpointer()->GetCollectionID(names[in]);
80  TotemG4HitCollection* theHC = (TotemG4HitCollection*) allHC->GetHC(HCid);
81  LogDebug("ForwardSim") << "TotemTestGem :: Hit Collection for " <<names[in]
82  << " of ID " << HCid << " is obtained at " << theHC;
83 
84  if (HCid >= 0 && theHC > 0) {
85  int nentries = theHC->entries();
86  LogDebug("ForwardSim") << "TotemTestGem :: " << names[in] << " with "
87  << nentries << " entries";
88  for (int ihit = 0; ihit <nentries; ihit++) {
89  TotemG4Hit* aHit = (*theHC)[ihit];
90  hits.push_back(aHit);
91  }
92  nhit += nentries;
93  }
94  }
95 
96  // Writing the data to the Tree
97  LogDebug("ForwardSim") << "TotemTestGem:: --- after fillTree with " << nhit
98  << " Hits";
99 }
#define LogDebug(id)
std::vector< std::string > names
Definition: TotemTestGem.h:62
std::vector< TotemG4Hit * > hits
Definition: TotemTestGem.h:64

Member Data Documentation

int TotemTestGem::evtnum
private

Definition at line 63 of file TotemTestGem.h.

Referenced by clear(), fillEvent(), and update().

std::vector<TotemG4Hit*> TotemTestGem::hits
private

Definition at line 64 of file TotemTestGem.h.

Referenced by clear(), fillEvent(), and update().

std::vector<std::string> TotemTestGem::names
private

Definition at line 62 of file TotemTestGem.h.

Referenced by TotemTestGem(), and update().