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::ConsumesCollector &iC, edm::ProducerBase &parent)
 
 ~MTDDigitizer () override
 
- Public Member Functions inherited from MTDDigitizerBase
 MTDDigitizerBase (const edm::ParameterSet &config, edm::ConsumesCollector &iC, edm::ProducerBase &parent)
 
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 123 of file MTDDigitizer.h.

Member Typedef Documentation

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

Definition at line 127 of file MTDDigitizer.h.

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

Definition at line 129 of file MTDDigitizer.h.

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

Definition at line 128 of file MTDDigitizer.h.

Constructor & Destructor Documentation

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

Definition at line 131 of file MTDDigitizer.h.

133  :
134  MTDDigitizerBase(config,iC,parent),
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
const MTDGeometry * geom_
Definition: MTDDigitizer.h:169
ElectronicsSim electronicsSim_
Definition: MTDDigitizer.h:173
MTDDigitizerBase(const edm::ParameterSet &config, edm::ConsumesCollector &iC, edm::ProducerBase &parent)
template<class Traits >
mtd_digitizer::MTDDigitizer< Traits >::~MTDDigitizer ( )
inlineoverride

Definition at line 140 of file MTDDigitizer.h.

References EnergyCorrector::c, MillePedeFileConverter_cfg::e, and hfClusterShapes_cfi::hits.

140 { }

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

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

184  {
186  e.getByLabel(inputSimHits_, simHits);
187  accumulate(simHits,0,hre);
188  }
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre) override
handle SimHit accumulation
Definition: MTDDigitizer.h:182
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 191 of file MTDDigitizer.h.

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

193  {
195  e.getByLabel(inputSimHits_, simHits);
196  accumulate(simHits,e.bunchCrossing(),hre);
197  }
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre) override
handle SimHit accumulation
Definition: MTDDigitizer.h:182
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 200 of file MTDDigitizer.h.

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

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

References mtd_digitizer::loadSimHitAccumulator().

232  {
234  }
MTDSimHitDataAccumulator simHitAccumulator_
Definition: MTDDigitizer.h:177
void loadSimHitAccumulator(MTDSimHitDataAccumulator &simData, const PMTDSimAccumulator &simAccumulator, const float minCharge, const float maxCharge)
Definition: MTDDigitizer.h:90
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 264 of file MTDDigitizer.h.

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

264  {
265 
267  es.get<MTDDigiGeometryRecord>().get(geom);
268  geom_ = geom.product();
269 
270  deviceSim_.getEventSetup(es);
271  if(not premixStage1_) {
272  electronicsSim_.getEventSetup(es);
273  }
274 
275  }
const bool premixStage1_
const MTDGeometry * geom_
Definition: MTDDigitizer.h:169
T get() const
Definition: EventSetup.h:71
ElectronicsSim electronicsSim_
Definition: MTDDigitizer.h:173
T const * product() const
Definition: ESHandle.h:86
template<class Traits >
void mtd_digitizer::MTDDigitizer< Traits >::endRun ( )
inlineoverridevirtual

Implements MTDDigitizerBase.

Definition at line 161 of file MTDDigitizer.h.

161 {}
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 245 of file MTDDigitizer.h.

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

246  {
247  if(premixStage1_) {
248  auto simResult = std::make_unique<PMTDSimAccumulator>();
250  e.put(std::move(simResult), digiCollection_);
251  }
252  else {
253  auto digiCollection = std::make_unique<DigiCollection>();
256  }
257 
258  //release memory for next event
260  }
const bool premixStage1_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
void saveSimHitAccumulator(PMTDSimAccumulator &simResult, const MTDSimHitDataAccumulator &simData, const float minCharge, const float maxCharge)
Definition: MTDDigitizer.h:56
MTDSimHitDataAccumulator simHitAccumulator_
Definition: MTDDigitizer.h:177
const std::string digiCollection_
ElectronicsSim electronicsSim_
Definition: MTDDigitizer.h:173
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 237 of file MTDDigitizer.h.

237  {
238  deviceSim_.getEvent(e);
239  if(not premixStage1_) {
240  electronicsSim_.getEvent(e);
241  }
242  }
const bool premixStage1_
ElectronicsSim electronicsSim_
Definition: MTDDigitizer.h:173
template<class Traits >
void mtd_digitizer::MTDDigitizer< Traits >::resetSimHitDataAccumulator ( )
inlineprivate

Definition at line 165 of file MTDDigitizer.h.

165  {
167  }
MTDSimHitDataAccumulator simHitAccumulator_
Definition: MTDDigitizer.h:177
std::unordered_map< MTDCellId, MTDCellInfo > MTDSimHitDataAccumulator

Member Data Documentation

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

Definition at line 172 of file MTDDigitizer.h.

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

Definition at line 173 of file MTDDigitizer.h.

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

Definition at line 169 of file MTDDigitizer.h.

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

Definition at line 176 of file MTDDigitizer.h.

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

Definition at line 177 of file MTDDigitizer.h.