CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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,
MTDDigiGeometryRecord
geomToken_
 
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

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

Definition at line 132 of file MTDDigitizer.h.

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

Definition at line 134 of file MTDDigitizer.h.

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

Definition at line 133 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 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")) {}
ParameterSet const & getParameterSet(std::string const &) const
const edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > geomToken_
Definition: MTDDigitizer.h:166
MTDDigitizerBase(const edm::ParameterSet &config, edm::ProducesCollector producesCollector, edm::ConsumesCollector &iC)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const MTDGeometry * geom_
Definition: MTDDigitizer.h:167
ElectronicsSim electronicsSim_
Definition: MTDDigitizer.h:171
template<class Traits >
mtd_digitizer::MTDDigitizer< Traits >::~MTDDigitizer ( )
inlineoverride

Definition at line 144 of file MTDDigitizer.h.

144 {}

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

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

179  {
181  e.getByLabel(inputSimHits_, simHits);
182  accumulate(simHits, 0, hre);
183  }
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_
tuple simHits
Definition: trackerHits.py:16
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 186 of file MTDDigitizer.h.

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

188  {
190  e.getByLabel(inputSimHits_, simHits);
191  accumulate(simHits, e.bunchCrossing(), hre);
192  }
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_
tuple simHits
Definition: trackerHits.py:16
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 195 of file MTDDigitizer.h.

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

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

Implements MTDDigitizerBase.

Definition at line 226 of file MTDDigitizer.h.

References mtd_digitizer::loadSimHitAccumulator().

226  {
228  }
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_
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 243 of file MTDDigitizer.h.

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

243  {
244  if (premixStage1_) {
245  auto simResult = std::make_unique<PMTDSimAccumulator>();
247  e.put(std::move(simResult), digiCollection_);
248  } else {
249  auto digiCollection = std::make_unique<DigiCollection>();
252  }
253 
254  //release memory for next event
256  }
const bool premixStage1_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
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_
def move
Definition: eostools.py:511
ElectronicsSim electronicsSim_
Definition: MTDDigitizer.h:171
double premixStage1MaxCharge_
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 231 of file MTDDigitizer.h.

References edm::EventSetup::getData().

231  {
233 
234  deviceSim_.getEvent(e);
235  deviceSim_.getEventSetup(c);
236  if (not premixStage1_) {
237  electronicsSim_.getEvent(e);
238  electronicsSim_.getEventSetup(c);
239  }
240  }
const bool premixStage1_
const edm::EventSetup & c
bool getData(T &iHolder) const
Definition: EventSetup.h:128
const edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > geomToken_
Definition: MTDDigitizer.h:166
const MTDGeometry * geom_
Definition: MTDDigitizer.h:167
ElectronicsSim electronicsSim_
Definition: MTDDigitizer.h:171
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

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

Definition at line 170 of file MTDDigitizer.h.

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

Definition at line 171 of file MTDDigitizer.h.

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

Definition at line 167 of file MTDDigitizer.h.

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

Definition at line 166 of file MTDDigitizer.h.

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

Definition at line 174 of file MTDDigitizer.h.

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