CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
mtd_digitizer::MTDDigitizer< Traits > Class Template Reference

#include <MTDDigitizer.h>

Inheritance diagram for mtd_digitizer::MTDDigitizer< Traits >:
MTDDigitizerBase

Public Types

typedef Traits::DeviceSim DeviceSim
 
typedef Traits::DigiCollection DigiCollection
 
typedef Traits::ElectronicsSim ElectronicsSim
 

Public Member Functions

void accumulate (edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre) override
 handle SimHit accumulation More...
 
void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre) override
 
void accumulate (edm::Handle< edm::PSimHitContainer > const &hits, int bxCrossing, CLHEP::HepRandomEngine *hre) override
 
void accumulate (const PMTDSimAccumulator &simAccumulator) override
 
void beginRun (const edm::EventSetup &es) override
 actions at the start/end of run More...
 
void endRun () override
 
void finalizeEvent (edm::Event &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre) override
 
void initializeEvent (edm::Event const &e, edm::EventSetup const &c) override
 actions at the start/end of event More...
 
 MTDDigitizer (const edm::ParameterSet &config, edm::ProducesCollector producesCollector, edm::ConsumesCollector &iC)
 
 ~MTDDigitizer () override
 
- Public Member Functions inherited from MTDDigitizerBase
 MTDDigitizerBase (const edm::ParameterSet &config, edm::ProducesCollector producesCollector, edm::ConsumesCollector &iC)
 
const std::string & name () const
 
virtual ~MTDDigitizerBase ()
 

Private Member Functions

void resetSimHitDataAccumulator ()
 

Private Attributes

DeviceSim deviceSim_
 
ElectronicsSim electronicsSim_
 
const MTDGeometrygeom_
 
const int maxSimHitsAccTime_
 
MTDSimHitDataAccumulator simHitAccumulator_
 

Additional Inherited Members

- Protected Attributes inherited from MTDDigitizerBase
const std::string digiCollection_
 
const edm::InputTag inputSimHits_
 
const bool premixStage1_
 
double premixStage1MaxCharge_
 
double premixStage1MinCharge_
 
const float refSpeed_
 
const uint32_t verbosity_
 

Detailed Description

template<class Traits>
class mtd_digitizer::MTDDigitizer< Traits >

Definition at line 127 of file MTDDigitizer.h.

Member Typedef Documentation

template<class Traits >
typedef Traits::DeviceSim mtd_digitizer::MTDDigitizer< Traits >::DeviceSim

Definition at line 129 of file MTDDigitizer.h.

template<class Traits >
typedef Traits::DigiCollection mtd_digitizer::MTDDigitizer< Traits >::DigiCollection

Definition at line 131 of file MTDDigitizer.h.

template<class Traits >
typedef Traits::ElectronicsSim mtd_digitizer::MTDDigitizer< Traits >::ElectronicsSim

Definition at line 130 of file MTDDigitizer.h.

Constructor & Destructor Documentation

template<class Traits >
mtd_digitizer::MTDDigitizer< Traits >::MTDDigitizer ( const edm::ParameterSet config,
edm::ProducesCollector  producesCollector,
edm::ConsumesCollector iC 
)
inline

Definition at line 133 of file MTDDigitizer.h.

134  : MTDDigitizerBase(config, producesCollector, iC),
135  geom_(nullptr),
136  deviceSim_(config.getParameterSet("DeviceSimulation")),
137  electronicsSim_(config.getParameterSet("ElectronicsSimulation")),
138  maxSimHitsAccTime_(config.getParameter<uint32_t>("maxSimHitsAccTime")) {}
T getParameter(std::string const &) const
ParameterSet const & getParameterSet(std::string const &) const
MTDDigitizerBase(const edm::ParameterSet &config, edm::ProducesCollector producesCollector, edm::ConsumesCollector &iC)
const MTDGeometry * geom_
Definition: MTDDigitizer.h:168
ElectronicsSim electronicsSim_
Definition: MTDDigitizer.h:172
template<class Traits >
mtd_digitizer::MTDDigitizer< Traits >::~MTDDigitizer ( )
inlineoverride

Member Function Documentation

template<class Traits >
void mtd_digitizer::MTDDigitizer< Traits >::accumulate ( edm::Event const &  e,
edm::EventSetup const &  c,
CLHEP::HepRandomEngine *  hre 
)
overridevirtual

handle SimHit accumulation

Implements MTDDigitizerBase.

Definition at line 180 of file MTDDigitizer.h.

References edm::Event::getByLabel(), and FastTrackerRecHitCombiner_cfi::simHits.

180  {
182  e.getByLabel(inputSimHits_, simHits);
183  accumulate(simHits, 0, hre);
184  }
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre) override
handle SimHit accumulation
Definition: MTDDigitizer.h:180
const edm::InputTag inputSimHits_
template<class Traits >
void mtd_digitizer::MTDDigitizer< Traits >::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
CLHEP::HepRandomEngine *  hre 
)
overridevirtual

Implements MTDDigitizerBase.

Definition at line 187 of file MTDDigitizer.h.

References PileUpEventPrincipal::bunchCrossing(), PileUpEventPrincipal::getByLabel(), and FastTrackerRecHitCombiner_cfi::simHits.

189  {
191  e.getByLabel(inputSimHits_, simHits);
192  accumulate(simHits, e.bunchCrossing(), hre);
193  }
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre) override
handle SimHit accumulation
Definition: MTDDigitizer.h:180
const edm::InputTag inputSimHits_
template<class Traits >
void mtd_digitizer::MTDDigitizer< Traits >::accumulate ( edm::Handle< edm::PSimHitContainer > const &  hits,
int  bxCrossing,
CLHEP::HepRandomEngine *  hre 
)
overridevirtual

Implements MTDDigitizerBase.

Definition at line 196 of file MTDDigitizer.h.

References TauDecayModes::dec, mps_fire::i, createfilelist::int, and mtd_digitizer::MTDHelpers::orderByDetIdThenTime().

198  {
199  using namespace MTDHelpers;
200 
201  //create list of tuples (pos in container, RECO DetId, time) to be sorted first
202  int nchits = (int)hits->size();
203  std::vector<MTDCaloHitTuple_t> hitRefs;
204  hitRefs.reserve(nchits);
205  for (int i = 0; i < nchits; ++i) {
206  const auto& the_hit = hits->at(i);
207 
208  DetId id = the_hit.detUnitId();
209 
210  if (verbosity_ > 0) {
211  edm::LogInfo("MTDDigitizer") << " i/p " << std::hex << the_hit.detUnitId() << std::dec << " o/p " << id.rawId()
212  << std::endl;
213  }
214 
215  if (0 != id.rawId()) {
216  hitRefs.emplace_back(i, id.rawId(), the_hit.tof());
217  }
218  }
219  std::sort(hitRefs.begin(), hitRefs.end(), MTDHelpers::orderByDetIdThenTime);
220 
221  deviceSim_.getHitsResponse(hitRefs, hits, &simHitAccumulator_, hre);
222 
223  hitRefs.clear();
224  }
MTDSimHitDataAccumulator simHitAccumulator_
Definition: MTDDigitizer.h:176
const uint32_t verbosity_
Definition: DetId.h:17
bool orderByDetIdThenTime(const MTDCaloHitTuple_t &a, const MTDCaloHitTuple_t &b)
Definition: MTDDigitizer.h:41
template<class Traits >
void mtd_digitizer::MTDDigitizer< Traits >::accumulate ( const PMTDSimAccumulator simAccumulator)
overridevirtual

Implements MTDDigitizerBase.

Definition at line 227 of file MTDDigitizer.h.

References mtd_digitizer::loadSimHitAccumulator().

227  {
229  }
MTDSimHitDataAccumulator simHitAccumulator_
Definition: MTDDigitizer.h:176
void loadSimHitAccumulator(MTDSimHitDataAccumulator &simData, const PMTDSimAccumulator &simAccumulator, const float minCharge, const float maxCharge)
Definition: MTDDigitizer.h:93
template<class Traits >
void mtd_digitizer::MTDDigitizer< Traits >::beginRun ( const edm::EventSetup es)
overridevirtual

actions at the start/end of run

Implements MTDDigitizerBase.

Definition at line 256 of file MTDDigitizer.h.

References relativeConstraints::geom, edm::EventSetup::get(), and edm::ESHandle< T >::product().

256  {
258  es.get<MTDDigiGeometryRecord>().get(geom);
259  geom_ = geom.product();
260 
261  deviceSim_.getEventSetup(es);
262  if (not premixStage1_) {
263  electronicsSim_.getEventSetup(es);
264  }
265  }
const bool premixStage1_
const MTDGeometry * geom_
Definition: MTDDigitizer.h:168
T get() const
Definition: EventSetup.h:73
ElectronicsSim electronicsSim_
Definition: MTDDigitizer.h:172
T const * product() const
Definition: ESHandle.h:86
template<class Traits >
void mtd_digitizer::MTDDigitizer< Traits >::endRun ( )
inlineoverridevirtual

Implements MTDDigitizerBase.

Definition at line 163 of file MTDDigitizer.h.

163 {}
template<class Traits >
void mtd_digitizer::MTDDigitizer< Traits >::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c,
CLHEP::HepRandomEngine *  hre 
)
overridevirtual

Implements MTDDigitizerBase.

Definition at line 240 of file MTDDigitizer.h.

References apvshotsanalyzer_cfi::digiCollection, eostools::move(), edm::Event::put(), and mtd_digitizer::saveSimHitAccumulator().

240  {
241  if (premixStage1_) {
242  auto simResult = std::make_unique<PMTDSimAccumulator>();
244  e.put(std::move(simResult), digiCollection_);
245  } else {
246  auto digiCollection = std::make_unique<DigiCollection>();
249  }
250 
251  //release memory for next event
253  }
const bool premixStage1_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
void saveSimHitAccumulator(PMTDSimAccumulator &simResult, const MTDSimHitDataAccumulator &simData, const float minCharge, const float maxCharge)
Definition: MTDDigitizer.h:57
MTDSimHitDataAccumulator simHitAccumulator_
Definition: MTDDigitizer.h:176
const std::string digiCollection_
ElectronicsSim electronicsSim_
Definition: MTDDigitizer.h:172
def move(src, dest)
Definition: eostools.py:511
template<class Traits >
void mtd_digitizer::MTDDigitizer< Traits >::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

actions at the start/end of event

Implements MTDDigitizerBase.

Definition at line 232 of file MTDDigitizer.h.

232  {
233  deviceSim_.getEvent(e);
234  if (not premixStage1_) {
235  electronicsSim_.getEvent(e);
236  }
237  }
const bool premixStage1_
ElectronicsSim electronicsSim_
Definition: MTDDigitizer.h:172
template<class Traits >
void mtd_digitizer::MTDDigitizer< Traits >::resetSimHitDataAccumulator ( )
inlineprivate

Definition at line 166 of file MTDDigitizer.h.

MTDSimHitDataAccumulator simHitAccumulator_
Definition: MTDDigitizer.h:176
std::unordered_map< MTDCellId, MTDCellInfo > MTDSimHitDataAccumulator

Member Data Documentation

template<class Traits >
DeviceSim mtd_digitizer::MTDDigitizer< Traits >::deviceSim_
private

Definition at line 171 of file MTDDigitizer.h.

template<class Traits >
ElectronicsSim mtd_digitizer::MTDDigitizer< Traits >::electronicsSim_
private

Definition at line 172 of file MTDDigitizer.h.

template<class Traits >
const MTDGeometry* mtd_digitizer::MTDDigitizer< Traits >::geom_
private

Definition at line 168 of file MTDDigitizer.h.

template<class Traits >
const int mtd_digitizer::MTDDigitizer< Traits >::maxSimHitsAccTime_
private

Definition at line 175 of file MTDDigitizer.h.

template<class Traits >
MTDSimHitDataAccumulator mtd_digitizer::MTDDigitizer< Traits >::simHitAccumulator_
private

Definition at line 176 of file MTDDigitizer.h.