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 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::InnerPixelBricked, 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,
TrackerDigiGeometryRecord
pDDToken_
 
const bool premixStage1_
 
const MagneticFieldpSetup_ = nullptr
 
const edm::ESGetToken
< MagneticField,
IdealMagneticFieldRecord
pSetupToken_
 
edm::ESWatcher
< TrackerDigiGeometryRecord
theTkDigiGeomWatcher_
 
const vstring trackerContainers_
 
const TrackerTopologytTopo_ = nullptr
 
const edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
tTopoToken_
 

Detailed Description

Definition at line 51 of file Phase2TrackerDigitizer.h.

Member Typedef Documentation

Definition at line 53 of file Phase2TrackerDigitizer.h.

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

Definition at line 73 of file Phase2TrackerDigitizer.h.

Member Enumeration Documentation

Enumerator
InnerPixel 
InnerPixelBricked 
InnerPixel3D 
PixelinPS 
StripinPS 
TwoStrip 
Unknown 

Definition at line 76 of file Phase2TrackerDigitizer.h.

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

Constructor & Destructor Documentation

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

Definition at line 63 of file Phase2TrackerDigitizer.cc.

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

66  : first_(true),
67  hitsProducer_(iConfig.getParameter<std::string>("hitsProducer")),
68  trackerContainers_(iConfig.getParameter<std::vector<std::string> >("ROUList")),
69  pDDToken_(iC.esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("GeometryType")))),
71  tTopoToken_(iC.esConsumes()),
72  isOuterTrackerReadoutAnalog_(iConfig.getParameter<bool>("isOTreadoutAnalog")),
73  premixStage1_(iConfig.getParameter<bool>("premixStage1")),
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::InnerPixelBricked] = std::make_unique<PixelBrickedDigitizerAlgorithm>(iConfig, iC);
96  algomap_[AlgorithmType::InnerPixel3D] = std::make_unique<Pixel3DDigitizerAlgorithm>(iConfig, iC);
97  algomap_[AlgorithmType::PixelinPS] = std::make_unique<PSPDigitizerAlgorithm>(iConfig, iC);
98  algomap_[AlgorithmType::StripinPS] = std::make_unique<PSSDigitizerAlgorithm>(iConfig, iC);
99  algomap_[AlgorithmType::TwoStrip] = std::make_unique<SSDigitizerAlgorithm>(iConfig, iC);
100  }
T getUntrackedParameter(std::string const &, T const &) const
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > pSetupToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
cms::Phase2TrackerDigitizer::~Phase2TrackerDigitizer ( )
override

Definition at line 102 of file Phase2TrackerDigitizer.cc.

102 {}

Member Function Documentation

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

Implements DigiAccumulatorMixMod.

Definition at line 176 of file Phase2TrackerDigitizer.cc.

References iEvent.

176  {
177  accumulate_local<edm::Event>(iEvent, iSetup);
178  }
int iEvent
Definition: GenABIO.cc:224
void cms::Phase2TrackerDigitizer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
edm::StreamID const &   
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 180 of file Phase2TrackerDigitizer.cc.

References iEvent.

182  {
183  accumulate_local<PileUpEventPrincipal>(iEvent, iSetup);
184  }
int iEvent
Definition: GenABIO.cc:224
template<class T >
void cms::Phase2TrackerDigitizer::accumulate_local ( T const &  iEvent,
edm::EventSetup const &  iSetup 
)

Definition at line 187 of file Phase2TrackerDigitizer.cc.

References accumulatePixelHits(), crossingSimHitIndexOffset_, edm::InputTag::encode(), PixelDigiSimLink::HighTof, hitsProducer_, edm::HandleBase::isValid(), PixelDigiSimLink::LowTof, trackerHits::simHits, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, trackerContainers_, and findQualityFiles::v.

187  {
188  for (auto const& v : trackerContainers_) {
191  iEvent.getByLabel(tag, simHits);
192 
193  //edm::EDGetTokenT< std::vector<PSimHit> > simHitToken_(consumes< std::vector<PSimHit>(tag));
194  //iEvent.getByToken(simHitToken_, simHits);
195 
196  uint32_t tofBin = PixelDigiSimLink::LowTof;
197  if (v.find(std::string("HighTof")) != std::string::npos)
198  tofBin = PixelDigiSimLink::HighTof;
199  accumulatePixelHits(simHits, crossingSimHitIndexOffset_[tag.encode()], tofBin);
200  // Now that the hits have been processed, I'll add the amount of hits in this crossing on to
201  // the global counter. Next time accumulateStripHits() is called it will count the sim hits
202  // as though they were on the end of this collection.
203  // Note that this is only used for creating digi-sim links (if configured to do so).
204  if (simHits.isValid())
205  crossingSimHitIndexOffset_[tag.encode()] += simHits->size();
206  }
207  }
void accumulatePixelHits(edm::Handle< std::vector< PSimHit > >, size_t globalSimHitIndex, const uint32_t tofBin)
int iEvent
Definition: GenABIO.cc:224
bool isValid() const
Definition: HandleBase.h:70
tuple simHits
Definition: trackerHits.py:16
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. ...
void cms::Phase2TrackerDigitizer::accumulatePixelHits ( edm::Handle< std::vector< PSimHit > >  hSimHits,
size_t  globalSimHitIndex,
const uint32_t  tofBin 
)
private

Definition at line 103 of file Phase2TrackerDigitizer.cc.

References algomap_, SplitLinear::begin, detectorUnits_, dataset::end, getAlgoType(), MagneticField::inTesla(), LogDebug, GloballyPositioned< T >::position(), pSetup_, trackerHits::simHits, and GeomDet::surface().

Referenced by accumulate_local().

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

Definition at line 352 of file Phase2TrackerDigitizer.cc.

References algomap_, edm::DetSet< T >::data, TrackerGeometry::detUnits(), getAlgoType(), InnerPixel, InnerPixel3D, InnerPixelBricked, makeDigiSimLinks_, eostools::move(), convertSQLitetoXML_cfg::output, pDD_, edm::Event::put(), DigitizerUtility::DigiSimInfo::simInfoList, and tTopo_.

352  {
353  std::vector<edm::DetSet<DigiType> > digiVector;
354  std::vector<edm::DetSet<PixelDigiSimLink> > digiLinkVector;
355  for (auto const& det_u : pDD_->detUnits()) {
356  uint32_t rawId = det_u->geographicalId().rawId();
357  auto algotype = getAlgoType(rawId);
358 
359  auto fiter = algomap_.find(algotype);
360  if (fiter == algomap_.end() || algotype == AlgorithmType::InnerPixel || algotype == AlgorithmType::InnerPixel3D ||
362  continue;
363 
364  std::map<int, DigitizerUtility::DigiSimInfo> digi_map;
365  fiter->second->digitize(dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u), digi_map, tTopo_);
366 
367  edm::DetSet<DigiType> collector(rawId);
368  edm::DetSet<PixelDigiSimLink> linkcollector(rawId);
369  for (auto const& digi_p : digi_map) {
370  DigitizerUtility::DigiSimInfo info = digi_p.second;
371  addToCollector(collector, digi_p.first, info);
372  for (auto const& sim_p : info.simInfoList) {
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(),
378  sim_p.first);
379  }
380  }
381 
382  if (!collector.data.empty())
383  digiVector.push_back(std::move(collector));
384  if (!linkcollector.data.empty())
385  digiLinkVector.push_back(std::move(linkcollector));
386  }
387 
388  // Step C: create collection with the cache vector of DetSet
389  auto output = std::make_unique<edm::DetSetVector<DigiType> >(digiVector);
390  auto outputlink = std::make_unique<edm::DetSetVector<PixelDigiSimLink> >(digiLinkVector);
391 
392  // Step D: write output to file
393  iEvent.put(std::move(output), "Tracker");
394  if (makeDigiSimLinks_)
395  iEvent.put(std::move(outputlink), "Tracker");
396  }
static const TGPicture * info(bool iBackgroundIsBlack)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const TrackerTopology * tTopo_
AlgorithmType getAlgoType(uint32_t idet)
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
def move
Definition: eostools.py:511
std::vector< std::pair< float, SimHitInfo * > > simInfoList
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
void cms::Phase2TrackerDigitizer::addPixelCollection ( edm::Event iEvent,
const edm::EventSetup iSetup,
const bool  ot_analog 
)
private

Definition at line 283 of file Phase2TrackerDigitizer.cc.

References algomap_, PixelDigi::channelToPixel(), edm::DetSet< T >::data, TrackerGeometry::detUnits(), getAlgoType(), info(), InnerPixel, InnerPixel3D, InnerPixelBricked, makeDigiSimLinks_, eostools::move(), convertSQLitetoXML_cfg::output, pDD_, edm::Event::put(), DigitizerUtility::DigiSimInfo::sig_tot, DigitizerUtility::DigiSimInfo::simInfoList, and tTopo_.

Referenced by finalizeEvent().

285  {
286  std::vector<edm::DetSet<PixelDigi> > digiVector;
287  std::vector<edm::DetSet<PixelDigiSimLink> > digiLinkVector;
288  for (auto const& det_u : pDD_->detUnits()) {
289  uint32_t rawId = det_u->geographicalId().rawId();
290  auto algotype = getAlgoType(rawId);
291  auto fiter = algomap_.find(algotype);
292  if (fiter == algomap_.end())
293  continue;
294 
295  // Decide if we want analog readout for Outer Tracker.
296  if (!ot_analog && algotype != AlgorithmType::InnerPixel && algotype != AlgorithmType::InnerPixel3D &&
298  continue;
299 
300  std::map<int, DigitizerUtility::DigiSimInfo> digi_map;
301  fiter->second->digitize(dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u), digi_map, tTopo_);
302 
303  edm::DetSet<PixelDigi> collector(rawId);
304  edm::DetSet<PixelDigiSimLink> linkcollector(rawId);
305  for (auto const& digi_p : digi_map) {
306  DigitizerUtility::DigiSimInfo info = digi_p.second;
307  const auto& ip = PixelDigi::channelToPixel(digi_p.first);
308  collector.data.emplace_back(ip.first, ip.second, info.sig_tot);
309  for (auto const& sim_p : info.simInfoList) {
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(),
315  sim_p.first);
316  }
317  }
318  if (!collector.data.empty())
319  digiVector.push_back(std::move(collector));
320  if (!linkcollector.data.empty())
321  digiLinkVector.push_back(std::move(linkcollector));
322  }
323 
324  // Step C: create collection with the cache vector of DetSet
325  auto output = std::make_unique<edm::DetSetVector<PixelDigi> >(digiVector);
326  auto outputlink = std::make_unique<edm::DetSetVector<PixelDigiSimLink> >(digiLinkVector);
327 
328  // Step D: write output to file
329  iEvent.put(std::move(output), "Pixel");
330  if (makeDigiSimLinks_)
331  iEvent.put(std::move(outputlink), "Pixel");
332  }
static const TGPicture * info(bool iBackgroundIsBlack)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
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.
def move
Definition: eostools.py:511
std::vector< std::pair< float, SimHitInfo * > > simInfoList
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
virtual void cms::Phase2TrackerDigitizer::beginJob ( void  )
inlinevirtual

Definition at line 64 of file Phase2TrackerDigitizer.h.

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

Implements DigiAccumulatorMixMod.

Definition at line 218 of file Phase2TrackerDigitizer.cc.

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

Referenced by PreMixingPhase2TrackerWorker::put().

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

Definition at line 228 of file Phase2TrackerDigitizer.cc.

References detectorUnits_, TrackerGeometry::getDetectorType(), InnerPixel, InnerPixel3D, InnerPixelBricked, PixelTopology::isBricked(), moduleTypeCache_, pDD_, TrackerGeometry::Ph1PXB, TrackerGeometry::Ph1PXF, TrackerGeometry::Ph2PSP, TrackerGeometry::Ph2PSS, TrackerGeometry::Ph2PXB, TrackerGeometry::Ph2PXB3D, TrackerGeometry::Ph2PXF, TrackerGeometry::Ph2PXF3D, TrackerGeometry::Ph2SS, PixelinPS, PixelGeomDetUnit::specificTopology(), StripinPS, TwoStrip, TrackerGeometry::UNKNOWN, and Unknown.

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

228  {
229  // get mType either from the geometry or from our cache (faster)
231  auto itr = moduleTypeCache_.find(detId_raw);
232  if (itr != moduleTypeCache_.end()) {
233  mType = itr->second;
234  } else {
235  mType = pDD_->getDetectorType(DetId(detId_raw));
236  moduleTypeCache_.emplace(detId_raw, mType);
237  }
238 
239  auto detUnit = detectorUnits_.find(detId_raw);
240  const Phase2TrackerGeomDetUnit* pixdet = dynamic_cast<const Phase2TrackerGeomDetUnit*>(detUnit->second);
241  const Phase2TrackerTopology* topol = &pixdet->specificTopology();
243  switch (mType) {
245  algotype = AlgorithmType::InnerPixel;
246  break;
248  algotype = AlgorithmType::InnerPixel;
249  break;
251  if (topol->isBricked())
253  else
254  algotype = AlgorithmType::InnerPixel;
255  break;
257  if (topol->isBricked())
259  else
260  algotype = AlgorithmType::InnerPixel;
261  break;
263  algotype = AlgorithmType::InnerPixel3D;
264  break;
266  algotype = AlgorithmType::InnerPixel3D;
267  break;
269  algotype = AlgorithmType::PixelinPS;
270  break;
272  algotype = AlgorithmType::StripinPS;
273  break;
275  algotype = AlgorithmType::TwoStrip;
276  break;
277  default:
278  edm::LogError("Phase2TrackerDigitizer") << "ERROR - Wrong Detector Type, No Algorithm available ";
279  }
280 
281  return algotype;
282  }
Log< level::Error, false > LogError
virtual bool isBricked() const =0
ModuleType getDetectorType(DetId) const
std::map< uint32_t, const Phase2TrackerGeomDetUnit * > detectorUnits_
Definition: DetId.h:17
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
void cms::Phase2TrackerDigitizer::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 134 of file Phase2TrackerDigitizer.cc.

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

Referenced by PreMixingPhase2TrackerWorker::initializeEvent().

134  {
136  if (!rng.isAvailable()) {
137  throw cms::Exception("Configuration")
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.";
141  }
142 
143  pSetup_ = &iSetup.getData(pSetupToken_);
144  tTopo_ = &iSetup.getData(tTopoToken_);
145 
146  if (theTkDigiGeomWatcher_.check(iSetup)) {
147  pDD_ = &iSetup.getData(pDDToken_);
148 
149  // reset cache
151  detectorUnits_.clear();
152  for (auto const& det_u : pDD_->detUnits()) {
153  uint32_t rawId = det_u->geographicalId().rawId();
154  if (DetId(rawId).det() == DetId::Detector::Tracker) {
155  const Phase2TrackerGeomDetUnit* pixdet = dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u);
156  assert(pixdet);
157  detectorUnits_.emplace(rawId, pixdet);
158  }
159  }
160  }
161 
162  // Must initialize all the algorithms
163  for (auto const& el : algomap_) {
164  if (first_)
165  el.second->init(iSetup);
166 
167  el.second->initializeEvent(rng->getEngine(e.streamID()));
168  }
169  first_ = false;
170  // Make sure that the first crossing processed starts indexing the sim hits from zero.
171  // This variable is used so that the sim hits from all crossing frames have sequential
172  // indices used to create the digi-sim link (if configured to do so) rather than starting
173  // from zero for each crossing.
175  }
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.
bool isAvailable() const
Definition: Service.h:40
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_
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. ...
void cms::Phase2TrackerDigitizer::loadAccumulator ( const std::map< uint32_t, std::map< int, float > > &  accumulator)

Definition at line 210 of file Phase2TrackerDigitizer.cc.

References algomap_, and getAlgoType().

Referenced by PreMixingPhase2TrackerWorker::put().

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

Member Data Documentation

std::map<AlgorithmType, std::unique_ptr<Phase2TrackerDigitizerAlgorithm> > cms::Phase2TrackerDigitizer::algomap_
private
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().

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

Definition at line 105 of file Phase2TrackerDigitizer.h.

Referenced by accumulatePixelHits(), getAlgoType(), and initializeEvent().

bool cms::Phase2TrackerDigitizer::first_
private

Definition at line 86 of file Phase2TrackerDigitizer.h.

Referenced by initializeEvent().

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

Definition at line 98 of file Phase2TrackerDigitizer.h.

Referenced by accumulate_local().

const bool cms::Phase2TrackerDigitizer::isOuterTrackerReadoutAnalog_
private

Definition at line 108 of file Phase2TrackerDigitizer.h.

Referenced by finalizeEvent().

const bool cms::Phase2TrackerDigitizer::makeDigiSimLinks_
private
ModuleTypeCache cms::Phase2TrackerDigitizer::moduleTypeCache_
private

Definition at line 112 of file Phase2TrackerDigitizer.h.

Referenced by getAlgoType(), and initializeEvent().

const TrackerGeometry* cms::Phase2TrackerDigitizer::pDD_ = nullptr
private
const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> cms::Phase2TrackerDigitizer::pDDToken_
private

Definition at line 100 of file Phase2TrackerDigitizer.h.

Referenced by initializeEvent().

const bool cms::Phase2TrackerDigitizer::premixStage1_
private

Definition at line 109 of file Phase2TrackerDigitizer.h.

Referenced by finalizeEvent(), and Phase2TrackerDigitizer().

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

Definition at line 104 of file Phase2TrackerDigitizer.h.

Referenced by accumulatePixelHits(), and initializeEvent().

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

Definition at line 101 of file Phase2TrackerDigitizer.h.

Referenced by initializeEvent().

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

Definition at line 107 of file Phase2TrackerDigitizer.h.

Referenced by initializeEvent().

const vstring cms::Phase2TrackerDigitizer::trackerContainers_
private

Definition at line 99 of file Phase2TrackerDigitizer.h.

Referenced by accumulate_local().

const TrackerTopology* cms::Phase2TrackerDigitizer::tTopo_ = nullptr
private
const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> cms::Phase2TrackerDigitizer::tTopoToken_
private

Definition at line 102 of file Phase2TrackerDigitizer.h.

Referenced by initializeEvent().