CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
TotemTestGem Class Reference
Inheritance diagram for TotemTestGem:
SimProducer Observer< const BeginOfEvent *> Observer< const EndOfEvent *> SimWatcher

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 TotemTestGem (const edm::ParameterSet &p)
 
 ~TotemTestGem () override
 
- Public Member Functions inherited from SimProducer
const SimProduceroperator= (const SimProducer &)=delete
 
void registerProducts (edm::ProducesCollector producesCollector)
 
 SimProducer ()
 
 SimProducer (const SimProducer &)=delete
 
- Public Member Functions inherited from SimWatcher
virtual void beginRun (edm::EventSetup const &)
 
bool isMT () const
 
const SimWatcheroperator= (const SimWatcher &)=delete
 
virtual void registerConsumes (edm::ConsumesCollector)
 
 SimWatcher ()
 
 SimWatcher (const SimWatcher &)=delete
 
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 ()
 

Protected Member Functions

void update (const BeginOfEvent *evt) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfEvent *evt) override
 This routine will be called when the appropriate signal arrives. More...
 
- Protected Member Functions inherited from SimProducer
template<class T >
void produces ()
 
template<class T >
void produces (const std::string &instanceName)
 
- Protected Member Functions inherited from SimWatcher
void setMT (bool val)
 

Private Member Functions

void clear ()
 
void fillEvent (TotemTestHistoClass &)
 

Private Attributes

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

Detailed Description

Definition at line 46 of file TotemTestGem.cc.

Constructor & Destructor Documentation

◆ TotemTestGem()

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

Definition at line 72 of file TotemTestGem.cc.

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

72  {
73  edm::ParameterSet m_Anal = p.getParameter<edm::ParameterSet>("TotemTestGem");
74  names = m_Anal.getParameter<std::vector<std::string> >("Names");
75 
76  edm::LogVerbatim("ForwardSim")
77  << "TotemTestGem:: Initialised as observer of begin of job, begin/end events and of G4step";
78 }
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< std::string > names
Definition: TotemTestGem.cc:63

◆ ~TotemTestGem()

TotemTestGem::~TotemTestGem ( )
override

Definition at line 80 of file TotemTestGem.cc.

80 {}

Member Function Documentation

◆ clear()

void TotemTestGem::clear ( void  )
private

Definition at line 148 of file TotemTestGem.cc.

References evtnum, and hits.

Referenced by update().

148  {
149  evtnum = 0;
150  hits.clear();
151 }
std::vector< TotemG4Hit * > hits
Definition: TotemTestGem.cc:65

◆ fillEvent()

void TotemTestGem::fillEvent ( TotemTestHistoClass product)
private

Definition at line 127 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(), SectorBuilder_Tid_cff::TID, x, y, and z.

Referenced by produce().

127  {
128  product.setEVT(evtnum);
129 
130  for (unsigned ihit = 0; ihit < hits.size(); ihit++) {
131  TotemG4Hit* aHit = hits[ihit];
132  int UID = aHit->getUnitID();
133  int Ptype = aHit->getParticleType();
134  int TID = aHit->getTrackID();
135  int PID = aHit->getParentId();
136  float ELoss = aHit->getEnergyLoss();
137  float PABS = aHit->getPabs();
138  float x = aHit->getEntry().x();
139  float y = aHit->getEntry().y();
140  float z = aHit->getEntry().z();
141  float vx = aHit->getVx();
142  float vy = aHit->getVy();
143  float vz = aHit->getVz();
144  product.fillHit(UID, Ptype, TID, PID, ELoss, PABS, vx, vy, vz, x, y, z);
145  }
146 }
float getPabs() const
Definition: TotemG4Hit.cc:143
float getEnergyLoss() const
Definition: TotemG4Hit.cc:145
uint32_t getUnitID() const
Definition: TotemG4Hit.cc:129
float getVy() const
Definition: TotemG4Hit.cc:174
int getParentId() const
Definition: TotemG4Hit.cc:168
float getVz() const
Definition: TotemG4Hit.cc:177
float getVx() const
Definition: TotemG4Hit.cc:171
std::vector< TotemG4Hit * > hits
Definition: TotemTestGem.cc: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:146
math::XYZPoint getEntry() const
Definition: TotemG4Hit.cc:115
int getTrackID() const
Definition: TotemG4Hit.cc:126

◆ produce()

void TotemTestGem::produce ( edm::Event e,
const edm::EventSetup  
)
overridevirtual

Implements SimProducer.

Definition at line 86 of file TotemTestGem.cc.

References MillePedeFileConverter_cfg::e, fillEvent(), and eostools::move().

86  {
87  std::unique_ptr<TotemTestHistoClass> product(new TotemTestHistoClass);
88  fillEvent(*product);
89  e.put(std::move(product));
90 }
void fillEvent(TotemTestHistoClass &)
def move(src, dest)
Definition: eostools.py:511

◆ update() [1/2]

void TotemTestGem::update ( const BeginOfEvent )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent *>.

Definition at line 92 of file TotemTestGem.cc.

References clear(), caHitNtupletGeneratorKernels::iev, and LogDebug.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

92  {
93  int iev = (*evt)()->GetEventID();
94  LogDebug("ForwardSim") << "TotemTestGem: Begin of event = " << iev;
95  clear();
96 }
TkSoAView< TrackerTraits > HitToTuple< TrackerTraits > const *__restrict__ int32_t int32_t int iev
#define LogDebug(id)

◆ update() [2/2]

void TotemTestGem::update ( const EndOfEvent )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfEvent *>.

Definition at line 98 of file TotemTestGem.cc.

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

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

98  {
99  evtnum = (*evt)()->GetEventID();
100  LogDebug("ForwardSim") << "TotemTestGem:: Fill event " << evtnum;
101 
102  // access to the G4 hit collections
103  G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent();
104 
105  int nhit = 0;
106  for (unsigned int in = 0; in < names.size(); in++) {
107  int HCid = G4SDManager::GetSDMpointer()->GetCollectionID(names[in]);
108  TotemG4HitCollection* theHC = (TotemG4HitCollection*)allHC->GetHC(HCid);
109  LogDebug("ForwardSim") << "TotemTestGem :: Hit Collection for " << names[in] << " of ID " << HCid
110  << " is obtained at " << theHC;
111 
112  if (HCid >= 0 && theHC != nullptr) {
113  int nentries = theHC->entries();
114  LogDebug("ForwardSim") << "TotemTestGem :: " << names[in] << " with " << nentries << " entries";
115  for (int ihit = 0; ihit < nentries; ihit++) {
116  TotemG4Hit* aHit = (*theHC)[ihit];
117  hits.push_back(aHit);
118  }
119  nhit += nentries;
120  }
121  }
122 
123  // Writing the data to the Tree
124  LogDebug("ForwardSim") << "TotemTestGem:: --- after fillTree with " << nhit << " Hits";
125 }
std::vector< std::string > names
Definition: TotemTestGem.cc:63
std::vector< TotemG4Hit * > hits
Definition: TotemTestGem.cc:65
#define LogDebug(id)

Member Data Documentation

◆ evtnum

int TotemTestGem::evtnum
private

Definition at line 64 of file TotemTestGem.cc.

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

◆ hits

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

Definition at line 65 of file TotemTestGem.cc.

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

◆ names

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

Definition at line 63 of file TotemTestGem.cc.

Referenced by TotemTestGem(), and update().