CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
cms::Phase2TrackerDigitizer Class Reference

#include <Phase2TrackerDigitizer.h>

Inheritance diagram for cms::Phase2TrackerDigitizer:
DigiAccumulatorMixMod

Public Types

using ModuleTypeCache = std::unordered_map< uint32_t, TrackerGeometry::ModuleType >
 

Public Member Functions

void accumulate (edm::Event const &e, edm::EventSetup const &c) override
 
void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c, edm::StreamID const &) override
 
template<class T >
void accumulate_local (T const &iEvent, edm::EventSetup const &iSetup)
 
virtual void beginJob ()
 
void finalizeEvent (edm::Event &e, edm::EventSetup const &c) override
 
void initializeEvent (edm::Event const &e, edm::EventSetup const &c) override
 
void loadAccumulator (const std::map< uint32_t, std::map< int, float > > &accumulator)
 
 Phase2TrackerDigitizer (const edm::ParameterSet &iConfig, edm::ProducesCollector, edm::ConsumesCollector &iC)
 
 ~Phase2TrackerDigitizer () override
 
- Public Member Functions inherited from DigiAccumulatorMixMod
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void beginRun (edm::Run const &run, edm::EventSetup const &setup)
 
 DigiAccumulatorMixMod ()
 
 DigiAccumulatorMixMod (DigiAccumulatorMixMod const &)=delete
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void endRun (edm::Run const &run, edm::EventSetup const &setup)
 
virtual void finalizeBunchCrossing (edm::Event &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual PileupMixingContentgetEventPileupInfo ()
 
virtual void initializeBunchCrossing (edm::Event const &event, edm::EventSetup const &setup, int bunchCrossing)
 
DigiAccumulatorMixMod const & operator= (DigiAccumulatorMixMod const &)=delete
 
virtual void StorePileupInformation (std::vector< int > &numInteractionList, std::vector< int > &bunchCrossingList, std::vector< float > &TrueInteractionList, std::vector< edm::EventID > &eventList, int bunchSpace)
 
virtual ~DigiAccumulatorMixMod ()
 

Private Types

enum  AlgorithmType {
  AlgorithmType::InnerPixel, AlgorithmType::InnerPixel3D, AlgorithmType::PixelinPS, AlgorithmType::StripinPS,
  AlgorithmType::TwoStrip, AlgorithmType::Unknown
}
 
using vstring = std::vector< std::string >
 

Private Member Functions

void accumulatePixelHits (edm::Handle< std::vector< PSimHit > >, size_t globalSimHitIndex, const uint32_t tofBin)
 
template<typename DigiType >
void addOuterTrackerCollection (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
void addPixelCollection (edm::Event &iEvent, const edm::EventSetup &iSetup, const bool ot_analog)
 
AlgorithmType getAlgoType (uint32_t idet)
 

Private Attributes

std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
 
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. More...
 
std::map< uint32_t, const Phase2TrackerGeomDetUnit * > detectorUnits_
 
bool first_
 
const std::string hitsProducer_
 
const bool isOuterTrackerReadoutAnalog_
 
const bool makeDigiSimLinks_
 
ModuleTypeCache moduleTypeCache_
 
const TrackerGeometrypDD_ = nullptr
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordpDDToken_
 
const bool premixStage1_
 
const MagneticFieldpSetup_ = nullptr
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordpSetupToken_
 
edm::ESWatcher< TrackerDigiGeometryRecordtheTkDigiGeomWatcher_
 
const vstring trackerContainers_
 
const TrackerTopologytTopo_ = nullptr
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken_
 
const bool usePseudoPixel3DAlgo_
 

Detailed Description

Definition at line 51 of file Phase2TrackerDigitizer.h.

Member Typedef Documentation

◆ ModuleTypeCache

Definition at line 53 of file Phase2TrackerDigitizer.h.

◆ vstring

using cms::Phase2TrackerDigitizer::vstring = std::vector<std::string>
private

Definition at line 73 of file Phase2TrackerDigitizer.h.

Member Enumeration Documentation

◆ AlgorithmType

Enumerator
InnerPixel 
InnerPixel3D 
PixelinPS 
StripinPS 
TwoStrip 
Unknown 

Definition at line 76 of file Phase2TrackerDigitizer.h.

76 { InnerPixel, InnerPixel3D, PixelinPS, StripinPS, TwoStrip, Unknown };

Constructor & Destructor Documentation

◆ Phase2TrackerDigitizer()

cms::Phase2TrackerDigitizer::Phase2TrackerDigitizer ( const edm::ParameterSet iConfig,
edm::ProducesCollector  producesCollector,
edm::ConsumesCollector iC 
)
explicit

Definition at line 61 of file Phase2TrackerDigitizer.cc.

References algomap_, edm::ParameterSet::getParameter(), InnerPixel, InnerPixel3D, makeDigiSimLinks_, PixelinPS, premixStage1_, edm::ProducesCollector::produces(), AlCaHLTBitMon_QueryRunRegistry::string, StripinPS, and TwoStrip.

64  : first_(true),
65  hitsProducer_(iConfig.getParameter<std::string>("hitsProducer")),
66  trackerContainers_(iConfig.getParameter<std::vector<std::string> >("ROUList")),
67  pDDToken_(iC.esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("GeometryType")))),
69  tTopoToken_(iC.esConsumes()),
70  isOuterTrackerReadoutAnalog_(iConfig.getParameter<bool>("isOTreadoutAnalog")),
71  usePseudoPixel3DAlgo_(iConfig.getParameter<bool>("usePseudoPixel3DAlgo")),
72  premixStage1_(iConfig.getParameter<bool>("premixStage1")),
73 
75  iConfig.getParameter<edm::ParameterSet>("AlgorithmCommon").getUntrackedParameter<bool>("makeDigiSimLinks")) {
76  const std::string alias1("simSiPixelDigis");
77  producesCollector.produces<edm::DetSetVector<PixelDigi> >("Pixel").setBranchAlias(alias1);
79  producesCollector.produces<edm::DetSetVector<PixelDigiSimLink> >("Pixel").setBranchAlias(alias1);
80 
81  if (!iConfig.getParameter<bool>("isOTreadoutAnalog")) {
82  const std::string alias2("simSiTrackerDigis");
83  if (premixStage1_) {
84  // Premixing exploits the ADC field of PixelDigi to store the collected charge
85  // But we still want everything else to be treated like for Phase2TrackerDigi
86  producesCollector.produces<edm::DetSetVector<PixelDigi> >("Tracker").setBranchAlias(alias2);
87  } else {
88  producesCollector.produces<edm::DetSetVector<Phase2TrackerDigi> >("Tracker").setBranchAlias(alias2);
89  }
91  producesCollector.produces<edm::DetSetVector<PixelDigiSimLink> >("Tracker").setBranchAlias(alias2);
92  }
93  // creating algorithm objects and pushing them into the map
94  algomap_[AlgorithmType::InnerPixel] = std::make_unique<PixelDigitizerAlgorithm>(iConfig, iC);
95  algomap_[AlgorithmType::InnerPixel3D] = std::make_unique<Pixel3DDigitizerAlgorithm>(iConfig, iC);
96  algomap_[AlgorithmType::PixelinPS] = std::make_unique<PSPDigitizerAlgorithm>(iConfig, iC);
97  algomap_[AlgorithmType::StripinPS] = std::make_unique<PSSDigitizerAlgorithm>(iConfig, iC);
98  algomap_[AlgorithmType::TwoStrip] = std::make_unique<SSDigitizerAlgorithm>(iConfig, iC);
99  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > pSetupToken_
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_

◆ ~Phase2TrackerDigitizer()

cms::Phase2TrackerDigitizer::~Phase2TrackerDigitizer ( )
override

Definition at line 101 of file Phase2TrackerDigitizer.cc.

101 {}

Member Function Documentation

◆ accumulate() [1/2]

void cms::Phase2TrackerDigitizer::accumulate ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 175 of file Phase2TrackerDigitizer.cc.

References iEvent.

175  {
176  accumulate_local<edm::Event>(iEvent, iSetup);
177  }
int iEvent
Definition: GenABIO.cc:224

◆ accumulate() [2/2]

void cms::Phase2TrackerDigitizer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
edm::StreamID const &   
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 179 of file Phase2TrackerDigitizer.cc.

References iEvent.

181  {
182  accumulate_local<PileUpEventPrincipal>(iEvent, iSetup);
183  }
int iEvent
Definition: GenABIO.cc:224

◆ accumulate_local()

template<class T >
void cms::Phase2TrackerDigitizer::accumulate_local ( T const &  iEvent,
edm::EventSetup const &  iSetup 
)

Definition at line 186 of file Phase2TrackerDigitizer.cc.

References accumulatePixelHits(), crossingSimHitIndexOffset_, PixelDigiSimLink::HighTof, hitsProducer_, iEvent, PixelDigiSimLink::LowTof, FastTrackerRecHitCombiner_cfi::simHits, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, trackerContainers_, and findQualityFiles::v.

186  {
187  for (auto const& v : trackerContainers_) {
190  iEvent.getByLabel(tag, simHits);
191 
192  //edm::EDGetTokenT< std::vector<PSimHit> > simHitToken_(consumes< std::vector<PSimHit>(tag));
193  //iEvent.getByToken(simHitToken_, simHits);
194 
195  uint32_t tofBin = PixelDigiSimLink::LowTof;
196  if (v.find(std::string("HighTof")) != std::string::npos)
197  tofBin = PixelDigiSimLink::HighTof;
199  // Now that the hits have been processed, I'll add the amount of hits in this crossing on to
200  // the global counter. Next time accumulateStripHits() is called it will count the sim hits
201  // as though they were on the end of this collection.
202  // Note that this is only used for creating digi-sim links (if configured to do so).
203  if (simHits.isValid())
204  crossingSimHitIndexOffset_[tag.encode()] += simHits->size();
205  }
206  }
void accumulatePixelHits(edm::Handle< std::vector< PSimHit > >, size_t globalSimHitIndex, const uint32_t tofBin)
int iEvent
Definition: GenABIO.cc:224
std::map< std::string, size_t > crossingSimHitIndexOffset_
Offset to add to the index of each sim hit to account for which crossing it&#39;s in. ...

◆ accumulatePixelHits()

void cms::Phase2TrackerDigitizer::accumulatePixelHits ( edm::Handle< std::vector< PSimHit > >  hSimHits,
size_t  globalSimHitIndex,
const uint32_t  tofBin 
)
private

Definition at line 102 of file Phase2TrackerDigitizer.cc.

References algomap_, detectorUnits_, getAlgoType(), MagneticField::inTesla(), LogDebug, GloballyPositioned< T >::position(), pSetup_, FastTrackerRecHitCombiner_cfi::simHits, and GeomDet::surface().

Referenced by accumulate_local().

104  {
105  if (hSimHits.isValid()) {
106  std::set<uint32_t> detIds;
107  auto const& simHits = *(hSimHits.product());
108  for (auto it = std::begin(simHits), itEnd = std::end(simHits); it != itEnd; ++it, ++globalSimHitIndex) {
109  uint32_t detId_raw = (*it).detUnitId();
110  auto fiter = detectorUnits_.find(detId_raw);
111  if (fiter == detectorUnits_.end())
112  continue;
113 
114  if (detIds.insert(detId_raw).second) {
115  // The insert succeeded, so this detector element has not yet been processed.
116  const Phase2TrackerGeomDetUnit* phase2det = fiter->second;
117 
118  // access to magnetic field in global coordinates
119  GlobalVector bfield = pSetup_->inTesla(phase2det->surface().position());
120  LogDebug("PixelDigitizer") << "B-field(T) at " << phase2det->surface().position()
121  << " (cm): " << pSetup_->inTesla(phase2det->surface().position());
122 
123  auto kiter = algomap_.find(getAlgoType(detId_raw));
124  if (kiter != algomap_.end())
125  kiter->second->accumulateSimHits(it, itEnd, globalSimHitIndex, tofBin, phase2det, bfield);
126  else
127  edm::LogInfo("Phase2TrackerDigitizer") << "Unsupported algorithm: ";
128  }
129  }
130  }
131  }
AlgorithmType getAlgoType(uint32_t idet)
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
T const * product() const
Definition: Handle.h:70
Log< level::Info, false > LogInfo
std::map< uint32_t, const Phase2TrackerGeomDetUnit * > detectorUnits_
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const PositionType & position() const
bool isValid() const
Definition: HandleBase.h:70
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
#define LogDebug(id)

◆ addOuterTrackerCollection()

template<typename DigiType >
void cms::Phase2TrackerDigitizer::addOuterTrackerCollection ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 341 of file Phase2TrackerDigitizer.cc.

References algomap_, edm::DetSet< T >::data, TrackerGeometry::detUnits(), getAlgoType(), iEvent, info(), InnerPixel, InnerPixel3D, makeDigiSimLinks_, eostools::move(), pDD_, nano_mu_digi_cff::rawId, and tTopo_.

341  {
342  std::vector<edm::DetSet<DigiType> > digiVector;
343  std::vector<edm::DetSet<PixelDigiSimLink> > digiLinkVector;
344  for (auto const& det_u : pDD_->detUnits()) {
345  uint32_t rawId = det_u->geographicalId().rawId();
346  auto algotype = getAlgoType(rawId);
347 
348  auto fiter = algomap_.find(algotype);
349  if (fiter == algomap_.end() || algotype == AlgorithmType::InnerPixel || algotype == AlgorithmType::InnerPixel3D)
350  continue;
351 
352  std::map<int, digitizerUtility::DigiSimInfo> digi_map;
353  fiter->second->digitize(dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u), digi_map, tTopo_);
354 
355  edm::DetSet<DigiType> collector(rawId);
356  edm::DetSet<PixelDigiSimLink> linkcollector(rawId);
357  for (auto const& digi_p : digi_map) {
358  digitizerUtility::DigiSimInfo info = digi_p.second;
359  addToCollector(collector, digi_p.first, info);
360  for (auto const& sim_p : info.simInfoList) {
361  linkcollector.data.emplace_back(digi_p.first,
362  sim_p.second->trackId(),
363  sim_p.second->hitIndex(),
364  sim_p.second->tofBin(),
365  sim_p.second->eventId(),
366  sim_p.first);
367  }
368  }
369 
370  if (!collector.data.empty())
371  digiVector.push_back(std::move(collector));
372  if (!linkcollector.data.empty())
373  digiLinkVector.push_back(std::move(linkcollector));
374  }
375 
376  // Step C: create collection with the cache vector of DetSet
377  auto output = std::make_unique<edm::DetSetVector<DigiType> >(digiVector);
378  auto outputlink = std::make_unique<edm::DetSetVector<PixelDigiSimLink> >(digiLinkVector);
379 
380  // Step D: write output to file
381  iEvent.put(std::move(output), "Tracker");
382  if (makeDigiSimLinks_)
383  iEvent.put(std::move(outputlink), "Tracker");
384  }
static const TGPicture * info(bool iBackgroundIsBlack)
const TrackerTopology * tTopo_
AlgorithmType getAlgoType(uint32_t idet)
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
int iEvent
Definition: GenABIO.cc:224
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
Definition: output.py:1
def move(src, dest)
Definition: eostools.py:511

◆ addPixelCollection()

void cms::Phase2TrackerDigitizer::addPixelCollection ( edm::Event iEvent,
const edm::EventSetup iSetup,
const bool  ot_analog 
)
private

Definition at line 273 of file Phase2TrackerDigitizer.cc.

References algomap_, PixelDigi::channelToPixel(), edm::DetSet< T >::data, TrackerGeometry::detUnits(), getAlgoType(), iEvent, info(), InnerPixel, InnerPixel3D, makeDigiSimLinks_, eostools::move(), pDD_, nano_mu_digi_cff::rawId, and tTopo_.

Referenced by finalizeEvent().

275  {
276  std::vector<edm::DetSet<PixelDigi> > digiVector;
277  std::vector<edm::DetSet<PixelDigiSimLink> > digiLinkVector;
278  for (auto const& det_u : pDD_->detUnits()) {
279  uint32_t rawId = det_u->geographicalId().rawId();
280  auto algotype = getAlgoType(rawId);
281  auto fiter = algomap_.find(algotype);
282  if (fiter == algomap_.end())
283  continue;
284 
285  // Decide if we want analog readout for Outer Tracker.
286  if (!ot_analog && algotype != AlgorithmType::InnerPixel && algotype != AlgorithmType::InnerPixel3D)
287  continue;
288 
289  std::map<int, digitizerUtility::DigiSimInfo> digi_map;
290  fiter->second->digitize(dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u), digi_map, tTopo_);
291 
292  edm::DetSet<PixelDigi> collector(rawId);
293  edm::DetSet<PixelDigiSimLink> linkcollector(rawId);
294  for (auto const& digi_p : digi_map) {
295  digitizerUtility::DigiSimInfo info = digi_p.second;
296  const auto& ip = PixelDigi::channelToPixel(digi_p.first);
297  collector.data.emplace_back(ip.first, ip.second, info.sig_tot);
298  for (auto const& sim_p : info.simInfoList) {
299  linkcollector.data.emplace_back(digi_p.first,
300  sim_p.second->trackId(),
301  sim_p.second->hitIndex(),
302  sim_p.second->tofBin(),
303  sim_p.second->eventId(),
304  sim_p.first);
305  }
306  }
307  if (!collector.data.empty())
308  digiVector.push_back(std::move(collector));
309  if (!linkcollector.data.empty())
310  digiLinkVector.push_back(std::move(linkcollector));
311  }
312 
313  // Step C: create collection with the cache vector of DetSet
314  auto output = std::make_unique<edm::DetSetVector<PixelDigi> >(digiVector);
315  auto outputlink = std::make_unique<edm::DetSetVector<PixelDigiSimLink> >(digiLinkVector);
316 
317  // Step D: write output to file
318  iEvent.put(std::move(output), "Pixel");
319  if (makeDigiSimLinks_)
320  iEvent.put(std::move(outputlink), "Pixel");
321  }
static const TGPicture * info(bool iBackgroundIsBlack)
const TrackerTopology * tTopo_
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:69
AlgorithmType getAlgoType(uint32_t idet)
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
int iEvent
Definition: GenABIO.cc:224
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
Definition: output.py:1
def move(src, dest)
Definition: eostools.py:511

◆ beginJob()

virtual void cms::Phase2TrackerDigitizer::beginJob ( void  )
inlinevirtual

Definition at line 64 of file Phase2TrackerDigitizer.h.

64 {}

◆ finalizeEvent()

void cms::Phase2TrackerDigitizer::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 217 of file Phase2TrackerDigitizer.cc.

References addPixelCollection(), iEvent, isOuterTrackerReadoutAnalog_, and premixStage1_.

Referenced by PreMixingPhase2TrackerWorker::put().

217  {
218  //Decide if we want analog readout for Outer Tracker.
221  if (premixStage1_)
222  addOuterTrackerCollection<PixelDigi>(iEvent, iSetup);
223  else
224  addOuterTrackerCollection<Phase2TrackerDigi>(iEvent, iSetup);
225  }
226  }
int iEvent
Definition: GenABIO.cc:224
void addPixelCollection(edm::Event &iEvent, const edm::EventSetup &iSetup, const bool ot_analog)

◆ getAlgoType()

Phase2TrackerDigitizer::AlgorithmType cms::Phase2TrackerDigitizer::getAlgoType ( uint32_t  idet)
private

Definition at line 227 of file Phase2TrackerDigitizer.cc.

References TrackerGeometry::getDetectorType(), InnerPixel, InnerPixel3D, moduleTypeCache_, pDD_, TrackerGeometry::Ph1PXB, TrackerGeometry::Ph1PXF, TrackerGeometry::Ph2PSP, TrackerGeometry::Ph2PSS, TrackerGeometry::Ph2PXB, TrackerGeometry::Ph2PXB3D, TrackerGeometry::Ph2PXF, TrackerGeometry::Ph2PXF3D, TrackerGeometry::Ph2SS, PixelinPS, StripinPS, TwoStrip, TrackerGeometry::UNKNOWN, Unknown, and usePseudoPixel3DAlgo_.

Referenced by accumulatePixelHits(), addOuterTrackerCollection(), addPixelCollection(), and loadAccumulator().

227  {
228  // get mType either from the geometry or from our cache (faster)
230  auto itr = moduleTypeCache_.find(detId_raw);
231  if (itr != moduleTypeCache_.end()) {
232  mType = itr->second;
233  } else {
234  mType = pDD_->getDetectorType(DetId(detId_raw));
235  moduleTypeCache_.emplace(detId_raw, mType);
236  }
237 
239  switch (mType) {
241  algotype = AlgorithmType::InnerPixel;
242  break;
244  algotype = AlgorithmType::InnerPixel;
245  break;
247  algotype = AlgorithmType::InnerPixel;
248  break;
250  algotype = AlgorithmType::InnerPixel;
251  break;
254  } break;
257  } break;
259  algotype = AlgorithmType::PixelinPS;
260  break;
262  algotype = AlgorithmType::StripinPS;
263  break;
265  algotype = AlgorithmType::TwoStrip;
266  break;
267  default:
268  edm::LogError("Phase2TrackerDigitizer") << "ERROR - Wrong Detector Type, No Algorithm available ";
269  }
270 
271  return algotype;
272  }
Log< level::Error, false > LogError
ModuleType getDetectorType(DetId) const
Definition: DetId.h:17

◆ initializeEvent()

void cms::Phase2TrackerDigitizer::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 133 of file Phase2TrackerDigitizer.cc.

References algomap_, cms::cuda::assert(), edm::ESWatcher< T >::check(), crossingSimHitIndexOffset_, detectorUnits_, TrackerGeometry::detUnits(), MillePedeFileConverter_cfg::e, Exception, first_, edm::EventSetup::getData(), edm::RandomNumberGenerator::getEngine(), edm::Service< T >::isAvailable(), moduleTypeCache_, pDD_, pDDToken_, pSetup_, pSetupToken_, nano_mu_digi_cff::rawId, theTkDigiGeomWatcher_, align::Tracker, tTopo_, and tTopoToken_.

Referenced by PreMixingPhase2TrackerWorker::initializeEvent().

133  {
135  if (!rng.isAvailable()) {
136  throw cms::Exception("Configuration")
137  << "Phase2TrackerDigitizer requires the RandomNumberGeneratorService\n"
138  "which is not present in the configuration file. You must add the service\n"
139  "in the configuration file or remove the modules that require it.";
140  }
141 
142  pSetup_ = &iSetup.getData(pSetupToken_);
143  tTopo_ = &iSetup.getData(tTopoToken_);
144 
145  if (theTkDigiGeomWatcher_.check(iSetup)) {
146  pDD_ = &iSetup.getData(pDDToken_);
147 
148  // reset cache
150  detectorUnits_.clear();
151  for (auto const& det_u : pDD_->detUnits()) {
152  uint32_t rawId = det_u->geographicalId().rawId();
153  if (DetId(rawId).det() == DetId::Detector::Tracker) {
154  const Phase2TrackerGeomDetUnit* pixdet = dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u);
155  assert(pixdet);
156  detectorUnits_.emplace(rawId, pixdet);
157  }
158  }
159  }
160 
161  // Must initialize all the algorithms
162  for (auto const& el : algomap_) {
163  if (first_)
164  el.second->init(iSetup);
165 
166  el.second->initializeEvent(rng->getEngine(e.streamID()));
167  }
168  first_ = false;
169  // Make sure that the first crossing processed starts indexing the sim hits from zero.
170  // This variable is used so that the sim hits from all crossing frames have sequential
171  // indices used to create the digi-sim link (if configured to do so) rather than starting
172  // from zero for each crossing.
174  }
edm::ESWatcher< TrackerDigiGeometryRecord > theTkDigiGeomWatcher_
const TrackerTopology * tTopo_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
assert(be >=bs)
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
std::unordered_map< uint32_t, TrackerGeometry::ModuleType > ModuleTypeCache
std::map< uint32_t, const Phase2TrackerGeomDetUnit * > detectorUnits_
Definition: DetId.h:17
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > pSetupToken_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
bool isAvailable() const
Definition: Service.h:40
std::map< std::string, size_t > crossingSimHitIndexOffset_
Offset to add to the index of each sim hit to account for which crossing it&#39;s in. ...

◆ loadAccumulator()

void cms::Phase2TrackerDigitizer::loadAccumulator ( const std::map< uint32_t, std::map< int, float > > &  accumulator)

Definition at line 209 of file Phase2TrackerDigitizer.cc.

References mixOne_premix_on_sim_cfi::accumulator, algomap_, and getAlgoType().

Referenced by PreMixingPhase2TrackerWorker::put().

209  {
210  for (const auto& detMap : accumulator) {
211  AlgorithmType algoType = getAlgoType(detMap.first);
212  auto& algo = *(algomap_.at(algoType));
213  algo.loadAccumulator(detMap.first, detMap.second);
214  }
215  }
AlgorithmType getAlgoType(uint32_t idet)
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_

Member Data Documentation

◆ algomap_

std::map<AlgorithmType, std::unique_ptr<Phase2TrackerDigitizerAlgorithm> > cms::Phase2TrackerDigitizer::algomap_
private

◆ crossingSimHitIndexOffset_

std::map<std::string, size_t> cms::Phase2TrackerDigitizer::crossingSimHitIndexOffset_
private

Offset to add to the index of each sim hit to account for which crossing it's in.

I need to know what each sim hit index will be when the hits from all crossing frames are merged into one collection (assuming the MixingModule is configured to create the crossing frame for all sim hits). To do this I'll record how many hits were in each crossing, and then add that on to the index for a given hit in a given crossing. This assumes that the crossings are processed in the same order here as they are put into the crossing frame, which I'm pretty sure is true.
The key is the name of the sim hit collection.

Definition at line 96 of file Phase2TrackerDigitizer.h.

Referenced by accumulate_local(), and initializeEvent().

◆ detectorUnits_

std::map<uint32_t, const Phase2TrackerGeomDetUnit*> cms::Phase2TrackerDigitizer::detectorUnits_
private

Definition at line 105 of file Phase2TrackerDigitizer.h.

Referenced by accumulatePixelHits(), and initializeEvent().

◆ first_

bool cms::Phase2TrackerDigitizer::first_
private

Definition at line 86 of file Phase2TrackerDigitizer.h.

Referenced by initializeEvent().

◆ hitsProducer_

const std::string cms::Phase2TrackerDigitizer::hitsProducer_
private

Definition at line 98 of file Phase2TrackerDigitizer.h.

Referenced by accumulate_local().

◆ isOuterTrackerReadoutAnalog_

const bool cms::Phase2TrackerDigitizer::isOuterTrackerReadoutAnalog_
private

Definition at line 108 of file Phase2TrackerDigitizer.h.

Referenced by finalizeEvent().

◆ makeDigiSimLinks_

const bool cms::Phase2TrackerDigitizer::makeDigiSimLinks_
private

◆ moduleTypeCache_

ModuleTypeCache cms::Phase2TrackerDigitizer::moduleTypeCache_
private

Definition at line 113 of file Phase2TrackerDigitizer.h.

Referenced by getAlgoType(), and initializeEvent().

◆ pDD_

const TrackerGeometry* cms::Phase2TrackerDigitizer::pDD_ = nullptr
private

◆ pDDToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> cms::Phase2TrackerDigitizer::pDDToken_
private

Definition at line 100 of file Phase2TrackerDigitizer.h.

Referenced by initializeEvent().

◆ premixStage1_

const bool cms::Phase2TrackerDigitizer::premixStage1_
private

Definition at line 110 of file Phase2TrackerDigitizer.h.

Referenced by finalizeEvent(), and Phase2TrackerDigitizer().

◆ pSetup_

const MagneticField* cms::Phase2TrackerDigitizer::pSetup_ = nullptr
private

Definition at line 104 of file Phase2TrackerDigitizer.h.

Referenced by accumulatePixelHits(), and initializeEvent().

◆ pSetupToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> cms::Phase2TrackerDigitizer::pSetupToken_
private

Definition at line 101 of file Phase2TrackerDigitizer.h.

Referenced by initializeEvent().

◆ theTkDigiGeomWatcher_

edm::ESWatcher<TrackerDigiGeometryRecord> cms::Phase2TrackerDigitizer::theTkDigiGeomWatcher_
private

Definition at line 107 of file Phase2TrackerDigitizer.h.

Referenced by initializeEvent().

◆ trackerContainers_

const vstring cms::Phase2TrackerDigitizer::trackerContainers_
private

Definition at line 99 of file Phase2TrackerDigitizer.h.

Referenced by accumulate_local().

◆ tTopo_

const TrackerTopology* cms::Phase2TrackerDigitizer::tTopo_ = nullptr
private

◆ tTopoToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> cms::Phase2TrackerDigitizer::tTopoToken_
private

Definition at line 102 of file Phase2TrackerDigitizer.h.

Referenced by initializeEvent().

◆ usePseudoPixel3DAlgo_

const bool cms::Phase2TrackerDigitizer::usePseudoPixel3DAlgo_
private

Definition at line 109 of file Phase2TrackerDigitizer.h.

Referenced by getAlgoType().