67 hitsProducer_(iConfig.getParameter<std::
string>(
"hitsProducer")),
68 trackerContainers_(iConfig.getParameter<std::
vector<std::
string> >(
"ROUList")),
72 isOuterTrackerReadoutAnalog_(iConfig.getParameter<bool>(
"isOTreadoutAnalog")),
73 premixStage1_(iConfig.getParameter<bool>(
"premixStage1")),
75 iConfig.getParameter<edm::
ParameterSet>(
"AlgorithmCommon").getUntrackedParameter<bool>(
"makeDigiSimLinks")) {
104 size_t globalSimHitIndex,
105 const uint32_t tofBin) {
106 if (hSimHits.isValid()) {
107 std::set<uint32_t> detIds;
108 auto const&
simHits = *(hSimHits.product());
110 uint32_t detId_raw = (*it).detUnitId();
115 if (detIds.insert(detId_raw).second) {
126 kiter->second->accumulateSimHits(it, itEnd, globalSimHitIndex, tofBin, phase2det, bfield);
128 edm::LogInfo(
"Phase2TrackerDigitizer") <<
"Unsupported algorithm: ";
138 <<
"Phase2TrackerDigitizer requires the RandomNumberGeneratorService\n"
139 "which is not present in the configuration file. You must add the service\n"
140 "in the configuration file or remove the modules that require it.";
153 uint32_t rawId = det_u->geographicalId().rawId();
165 el.second->init(iSetup);
177 accumulate_local<edm::Event>(
iEvent, iSetup);
183 accumulate_local<PileUpEventPrincipal>(
iEvent, iSetup);
191 iEvent.getByLabel(tag, simHits);
197 if (
v.find(
std::string(
"HighTof")) != std::string::npos)
211 for (
const auto& detMap : accumulator) {
214 algo.loadAccumulator(detMap.first, detMap.second);
223 addOuterTrackerCollection<PixelDigi>(
iEvent, iSetup);
225 addOuterTrackerCollection<Phase2TrackerDigi>(
iEvent, iSetup);
278 edm::LogError(
"Phase2TrackerDigitizer") <<
"ERROR - Wrong Detector Type, No Algorithm available ";
285 const bool ot_analog) {
286 std::vector<edm::DetSet<PixelDigi> > digiVector;
287 std::vector<edm::DetSet<PixelDigiSimLink> > digiLinkVector;
289 uint32_t rawId = det_u->geographicalId().rawId();
291 auto fiter =
algomap_.find(algotype);
300 std::map<int, DigitizerUtility::DigiSimInfo> digi_map;
301 fiter->second->digitize(dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u), digi_map,
tTopo_);
305 for (
auto const& digi_p : digi_map) {
308 collector.
data.emplace_back(ip.first, ip.second, info.
sig_tot);
310 linkcollector.
data.emplace_back(digi_p.first,
311 sim_p.second->trackId(),
312 sim_p.second->hitIndex(),
313 sim_p.second->tofBin(),
314 sim_p.second->eventId(),
318 if (!collector.
data.empty())
319 digiVector.push_back(
std::move(collector));
320 if (!linkcollector.
data.empty())
321 digiLinkVector.push_back(
std::move(linkcollector));
325 auto output = std::make_unique<edm::DetSetVector<PixelDigi> >(digiVector);
326 auto outputlink = std::make_unique<edm::DetSetVector<PixelDigiSimLink> >(digiLinkVector);
341 collector.
data.emplace_back(ip.first, ip.second, info.
sig_tot);
347 collector.
data.emplace_back(ip.first, ip.second, info.
ot_bit);
351 template <
typename DigiType>
353 std::vector<edm::DetSet<DigiType> > digiVector;
354 std::vector<edm::DetSet<PixelDigiSimLink> > digiLinkVector;
356 uint32_t rawId = det_u->geographicalId().rawId();
359 auto fiter =
algomap_.find(algotype);
364 std::map<int, DigitizerUtility::DigiSimInfo> digi_map;
365 fiter->second->digitize(dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u), digi_map,
tTopo_);
369 for (
auto const& digi_p : digi_map) {
371 addToCollector(collector, digi_p.first, info);
373 linkcollector.
data.emplace_back(digi_p.first,
374 sim_p.second->trackId(),
375 sim_p.second->hitIndex(),
376 sim_p.second->tofBin(),
377 sim_p.second->eventId(),
382 if (!collector.
data.empty())
383 digiVector.push_back(
std::move(collector));
384 if (!linkcollector.
data.empty())
385 digiLinkVector.push_back(
std::move(linkcollector));
389 auto output = std::make_unique<edm::DetSetVector<DigiType> >(digiVector);
390 auto outputlink = std::make_unique<edm::DetSetVector<PixelDigiSimLink> >(digiLinkVector);
edm::ESWatcher< TrackerDigiGeometryRecord > theTkDigiGeomWatcher_
Phase2TrackerDigitizer(const edm::ParameterSet &iConfig, edm::ProducesCollector, edm::ConsumesCollector &iC)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const MagneticField * pSetup_
const TrackerTopology * tTopo_
void accumulate(edm::Event const &e, edm::EventSetup const &c) override
static std::pair< int, int > channelToPixel(int ch)
ModuleTypeCache moduleTypeCache_
void accumulatePixelHits(edm::Handle< std::vector< PSimHit > >, size_t globalSimHitIndex, const uint32_t tofBin)
void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
AlgorithmType getAlgoType(uint32_t idet)
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
const bool isOuterTrackerReadoutAnalog_
void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
void accumulate_local(T const &iEvent, edm::EventSetup const &iSetup)
Log< level::Error, false > LogError
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
const Plane & surface() const
The nominal surface of the GeomDet.
bool getData(T &iHolder) const
const bool makeDigiSimLinks_
virtual bool isBricked() const =0
std::unordered_map< uint32_t, TrackerGeometry::ModuleType > ModuleTypeCache
ModuleType getDetectorType(DetId) const
void loadAccumulator(const std::map< uint32_t, std::map< int, float > > &accumulator)
std::vector< std::pair< float, SimHitInfo * > > simInfoList
Log< level::Info, false > LogInfo
std::map< uint32_t, const Phase2TrackerGeomDetUnit * > detectorUnits_
void addOuterTrackerCollection(edm::Event &iEvent, const edm::EventSetup &iSetup)
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > pSetupToken_
const TrackerGeometry * pDD_
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
T getParameter(std::string const &) const
bool check(const edm::EventSetup &iSetup)
const vstring trackerContainers_
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
static std::pair< unsigned int, unsigned int > channelToPixel(unsigned int ch)
const std::string hitsProducer_
#define DEFINE_DIGI_ACCUMULATOR(type)
StreamID streamID() const
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
void addPixelCollection(edm::Event &iEvent, const edm::EventSetup &iSetup, const bool ot_analog)
~Phase2TrackerDigitizer() override
const PositionType & position() const
std::map< std::string, size_t > crossingSimHitIndexOffset_
Offset to add to the index of each sim hit to account for which crossing it's in. ...