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 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 edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecordgeomToken_
 
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 130 of file MTDDigitizer.h.

Member Typedef Documentation

◆ DeviceSim

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

Definition at line 132 of file MTDDigitizer.h.

◆ DigiCollection

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

Definition at line 134 of file MTDDigitizer.h.

◆ ElectronicsSim

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

Definition at line 133 of file MTDDigitizer.h.

Constructor & Destructor Documentation

◆ MTDDigitizer()

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

Definition at line 136 of file MTDDigitizer.h.

137  : MTDDigitizerBase(config, producesCollector, iC),
138  geomToken_(iC.esConsumes()),
139  geom_(nullptr),
140  deviceSim_(config.getParameterSet("DeviceSimulation"), iC),
141  electronicsSim_(config.getParameterSet("ElectronicsSimulation"), iC),
142  maxSimHitsAccTime_(config.getParameter<uint32_t>("maxSimHitsAccTime")) {}
Definition: config.py:1
const edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > geomToken_
Definition: MTDDigitizer.h:166
MTDDigitizerBase(const edm::ParameterSet &config, edm::ProducesCollector producesCollector, edm::ConsumesCollector &iC)
const MTDGeometry * geom_
Definition: MTDDigitizer.h:167
ElectronicsSim electronicsSim_
Definition: MTDDigitizer.h:171

◆ ~MTDDigitizer()

template<class Traits >
mtd_digitizer::MTDDigitizer< Traits >::~MTDDigitizer ( )
inlineoverride

Definition at line 144 of file MTDDigitizer.h.

144 {}

Member Function Documentation

◆ accumulate() [1/4]

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 179 of file MTDDigitizer.h.

References MillePedeFileConverter_cfg::e, and FastTrackerRecHitCombiner_cfi::simHits.

179  {
181  e.getByLabel(inputSimHits_, simHits);
182  if (simHits.isValid())
183  accumulate(simHits, 0, hre);
184  else
185  edm::LogWarning("MTDMix") << "MTDDigitizer:: Cannot find hits for " << inputSimHits_;
186  }
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre) override
handle SimHit accumulation
Definition: MTDDigitizer.h:179
const edm::InputTag inputSimHits_
Log< level::Warning, false > LogWarning

◆ accumulate() [2/4]

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 189 of file MTDDigitizer.h.

References MillePedeFileConverter_cfg::e, and FastTrackerRecHitCombiner_cfi::simHits.

191  {
193  e.getByLabel(inputSimHits_, simHits);
194  if (simHits.isValid())
195  accumulate(simHits, e.bunchCrossing(), hre);
196  else
197  edm::LogWarning("MTDMix") << "MTDDigitizer:: Cannot find hits for " << inputSimHits_;
198  }
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre) override
handle SimHit accumulation
Definition: MTDDigitizer.h:179
const edm::InputTag inputSimHits_
Log< level::Warning, false > LogWarning

◆ accumulate() [3/4]

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 201 of file MTDDigitizer.h.

References TauDecayModes::dec, hfClusterShapes_cfi::hits, mps_fire::i, createfilelist::int, mtd_digitizer::MTDHelpers::orderByDetIdThenTime(), nano_mu_digi_cff::rawId, and jetUpdater_cfi::sort.

203  {
204  using namespace MTDHelpers;
205 
206  //create list of tuples (pos in container, RECO DetId, time) to be sorted first
207  int nchits = (int)hits->size();
208  std::vector<MTDCaloHitTuple_t> hitRefs;
209  hitRefs.reserve(nchits);
210  for (int i = 0; i < nchits; ++i) {
211  const auto& the_hit = hits->at(i);
212 
213  DetId id = the_hit.detUnitId();
214 
215  if (verbosity_ > 0) {
216  edm::LogInfo("MTDDigitizer") << " i/p " << std::hex << the_hit.detUnitId() << std::dec << " o/p " << id.rawId()
217  << std::endl;
218  }
219 
220  if (0 != id.rawId()) {
221  hitRefs.emplace_back(i, id.rawId(), the_hit.tof());
222  }
223  }
224  std::sort(hitRefs.begin(), hitRefs.end(), MTDHelpers::orderByDetIdThenTime);
225 
226  deviceSim_.getHitsResponse(hitRefs, hits, &simHitAccumulator_, hre);
227 
228  hitRefs.clear();
229  }
MTDSimHitDataAccumulator simHitAccumulator_
Definition: MTDDigitizer.h:175
const uint32_t verbosity_
Log< level::Info, false > LogInfo
Definition: DetId.h:17
bool orderByDetIdThenTime(const MTDCaloHitTuple_t &a, const MTDCaloHitTuple_t &b)
Definition: MTDDigitizer.h:40

◆ accumulate() [4/4]

template<class Traits >
void mtd_digitizer::MTDDigitizer< Traits >::accumulate ( const PMTDSimAccumulator simAccumulator)
overridevirtual

Implements MTDDigitizerBase.

Definition at line 232 of file MTDDigitizer.h.

References mtd_digitizer::loadSimHitAccumulator().

232  {
234  }
MTDSimHitDataAccumulator simHitAccumulator_
Definition: MTDDigitizer.h:175
double premixStage1MinCharge_
void loadSimHitAccumulator(MTDSimHitDataAccumulator &simData, const PMTDSimAccumulator &simAccumulator, const float minCharge, const float maxCharge)
Definition: MTDDigitizer.h:92
double premixStage1MaxCharge_

◆ finalizeEvent()

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 249 of file MTDDigitizer.h.

References apvshotsanalyzer_cfi::digiCollection, MillePedeFileConverter_cfg::e, eostools::move(), and mtd_digitizer::saveSimHitAccumulator().

249  {
250  if (premixStage1_) {
251  auto simResult = std::make_unique<PMTDSimAccumulator>();
253  e.put(std::move(simResult), digiCollection_);
254  } else {
255  auto digiCollection = std::make_unique<DigiCollection>();
258  }
259 
260  //release memory for next event
262  }
const bool premixStage1_
void saveSimHitAccumulator(PMTDSimAccumulator &simResult, const MTDSimHitDataAccumulator &simData, const float minCharge, const float maxCharge)
Definition: MTDDigitizer.h:56
MTDSimHitDataAccumulator simHitAccumulator_
Definition: MTDDigitizer.h:175
const std::string digiCollection_
double premixStage1MinCharge_
ElectronicsSim electronicsSim_
Definition: MTDDigitizer.h:171
double premixStage1MaxCharge_
def move(src, dest)
Definition: eostools.py:511

◆ initializeEvent()

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 237 of file MTDDigitizer.h.

References DummyCfis::c, and MillePedeFileConverter_cfg::e.

237  {
238  geom_ = &c.getData(geomToken_);
239 
240  deviceSim_.getEvent(e);
241  deviceSim_.getEventSetup(c);
242  if (not premixStage1_) {
243  electronicsSim_.getEvent(e);
244  electronicsSim_.getEventSetup(c);
245  }
246  }
const bool premixStage1_
const edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > geomToken_
Definition: MTDDigitizer.h:166
const MTDGeometry * geom_
Definition: MTDDigitizer.h:167
ElectronicsSim electronicsSim_
Definition: MTDDigitizer.h:171

◆ resetSimHitDataAccumulator()

template<class Traits >
void mtd_digitizer::MTDDigitizer< Traits >::resetSimHitDataAccumulator ( )
inlineprivate

Definition at line 164 of file MTDDigitizer.h.

References mtd_digitizer::MTDDigitizer< Traits >::simHitAccumulator_.

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

Member Data Documentation

◆ deviceSim_

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

Definition at line 170 of file MTDDigitizer.h.

◆ electronicsSim_

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

Definition at line 171 of file MTDDigitizer.h.

◆ geom_

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

Definition at line 167 of file MTDDigitizer.h.

◆ geomToken_

template<class Traits >
const edm::ESGetToken<MTDGeometry, MTDDigiGeometryRecord> mtd_digitizer::MTDDigitizer< Traits >::geomToken_
private

Definition at line 166 of file MTDDigitizer.h.

◆ maxSimHitsAccTime_

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

Definition at line 174 of file MTDDigitizer.h.

◆ simHitAccumulator_

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