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::EDProducer &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 41 of file TotemTestGem.h.

Constructor & Destructor Documentation

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

Definition at line 39 of file TotemTestGem.cc.

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

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

Definition at line 48 of file TotemTestGem.cc.

48  {
49 }

Member Function Documentation

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 detailsBasic3DVector::z.

Referenced by produce().

102  {
103 
104  product.setEVT(evtnum);
105 
106  for (unsigned ihit = 0; ihit < hits.size(); ihit++) {
107  TotemG4Hit* aHit = hits[ihit];
108  int UID = aHit->getUnitID();
109  int Ptype = aHit->getParticleType();
110  int TID = aHit->getTrackID();
111  int PID = aHit->getParentId();
112  float ELoss = aHit->getEnergyLoss();
113  float PABS = aHit->getPabs();
114  float x = aHit->getEntry().x();
115  float y = aHit->getEntry().y();
116  float z = aHit->getEntry().z();
117  float vx = aHit->getVx();
118  float vy = aHit->getVy();
119  float vz = aHit->getVz();
120  product.fillHit(UID, Ptype, TID, PID, ELoss, PABS, vx, vy, vz, x, y,z);
121  }
122 }
float getEnergyLoss() const
Definition: TotemG4Hit.cc:151
math::XYZPoint getEntry() const
Definition: TotemG4Hit.cc:124
float getPabs() const
Definition: TotemG4Hit.cc:149
float getVy() const
Definition: TotemG4Hit.cc:180
double double double z
int getTrackID() const
Definition: TotemG4Hit.cc:135
float getVx() const
Definition: TotemG4Hit.cc:177
float getVz() const
Definition: TotemG4Hit.cc:183
int getParentId() const
Definition: TotemG4Hit.cc:174
uint32_t getUnitID() const
Definition: TotemG4Hit.cc:138
std::vector< TotemG4Hit * > hits
Definition: TotemTestGem.h:65
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:152
Definition: DDAxes.h:10
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().

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

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 62 of file TotemTestGem.cc.

References clear(), and LogDebug.

Referenced by python.Vispa.Gui.VispaWidget.VispaWidget::autosize(), python.Vispa.Views.LineDecayView.LineDecayContainer::createObject(), python.Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), python.Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), python.Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), python.Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), python.Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), python.Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), python.Vispa.Gui.FindDialog.FindDialog::reset(), python.Vispa.Gui.PortConnection.PointToPointConnection::select(), python.Vispa.Gui.VispaWidget.VispaWidget::select(), python.Vispa.Views.LineDecayView.LineDecayContainer::select(), python.Vispa.Gui.VispaWidget.VispaWidget::setText(), python.Vispa.Gui.VispaWidget.VispaWidget::setTitle(), python.Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), python.Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and python.Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

62  {
63 
64  int iev = (*evt)()->GetEventID();
65  LogDebug("ForwardSim") << "TotemTestGem: Begin of event = " << iev;
66  clear();
67 
68 }
#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 70 of file TotemTestGem.cc.

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

Referenced by python.Vispa.Gui.VispaWidget.VispaWidget::autosize(), python.Vispa.Views.LineDecayView.LineDecayContainer::createObject(), python.Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), python.Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), python.Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), python.Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), python.Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), python.Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), python.Vispa.Gui.FindDialog.FindDialog::reset(), python.Vispa.Gui.PortConnection.PointToPointConnection::select(), python.Vispa.Gui.VispaWidget.VispaWidget::select(), python.Vispa.Views.LineDecayView.LineDecayContainer::select(), python.Vispa.Gui.VispaWidget.VispaWidget::setText(), python.Vispa.Gui.VispaWidget.VispaWidget::setTitle(), python.Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), python.Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and python.Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

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

Member Data Documentation

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().