1 #ifndef FastTimingSimProducers_FastTimingCommon_MTDDigitizer_h 2 #define FastTimingSimProducers_FastTimingCommon_MTDDigitizer_h 18 #include <unordered_map> 19 #include <unordered_set> 26 namespace MTDHelpers {
32 unsigned int detId_a(std::get<1>(a)), detId_b(std::get<1>(b));
34 if(detId_a<detId_b)
return true;
35 if(detId_a>detId_b)
return false;
37 double time_a(std::get<2>(a)), time_b(std::get<2>(b));
38 if(time_a<time_b)
return true;
44 template<
class Traits>
59 maxSimHitsAccTime_( config.getParameter< uint32_t >(
"maxSimHitsAccTime") ) { }
98 template<
class Traits>
101 CLHEP::HepRandomEngine* hre) {
104 accumulate(simHits,0,hre);
107 template<
class Traits>
110 CLHEP::HepRandomEngine* hre){
116 template<
class Traits>
119 CLHEP::HepRandomEngine* hre) {
120 using namespace MTDHelpers;
123 int nchits=(
int)hits->size();
124 std::vector< MTDCaloHitTuple_t > hitRefs;
125 hitRefs.reserve(nchits);
126 for(
int i=0;
i<nchits; ++
i) {
127 const auto& the_hit = hits->at(
i);
129 DetId id = the_hit.detUnitId();
133 <<
" o/p " <<
id.rawId() << std::endl;
136 if( 0 !=
id.rawId() ) {
137 hitRefs.emplace_back(
i,
id.rawId(), the_hit.tof() );
142 deviceSim_.getHitsResponse(hitRefs, hits, &simHitAccumulator_, hre);
148 template<
class Traits>
150 deviceSim_.getEvent(e);
151 electronicsSim_.getEvent(e);
154 template<
class Traits>
156 CLHEP::HepRandomEngine* hre) {
163 resetSimHitDataAccumulator();
167 template<
class Traits>
169 deviceSim_.getEventSetup(es);
170 electronicsSim_.getEventSetup(es);
int bunchCrossing() const
void accumulate(edm::Event const &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre) override
handle SimHit accumulation
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ParameterSet const & getParameterSet(ParameterSetID const &id)
MTDSimHitDataAccumulator simHitAccumulator_
void finalizeEvent(edm::Event &e, edm::EventSetup const &c, CLHEP::HepRandomEngine *hre) override
const int maxSimHitsAccTime_
void beginRun(const edm::EventSetup &es) override
actions at the start/end of run
Traits::ElectronicsSim ElectronicsSim
Traits::DigiCollection DigiCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
actions at the start/end of event
bool orderByDetIdThenTime(const MTDCaloHitTuple_t &a, const MTDCaloHitTuple_t &b)
std::tuple< int, uint32_t, float > MTDCaloHitTuple_t
std::unordered_map< uint32_t, MTDCellInfo > MTDSimHitDataAccumulator
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
MTDDigitizer(const edm::ParameterSet &config, edm::ConsumesCollector &iC, edm::ProducerBase &parent)
ElectronicsSim electronicsSim_
void resetSimHitDataAccumulator()
Traits::DeviceSim DeviceSim