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

typedef std::unordered_map< unsigned, TrackerGeometry::ModuleTypeModuleTypeCache
 

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 beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &iSetup) override
 
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< unsigned int, std::map< int, float > > &accumulator)
 
 Phase2TrackerDigitizer (const edm::ParameterSet &iConfig, edm::ProducerBase &mixMod, edm::ConsumesCollector &iC)
 
 ~Phase2TrackerDigitizer () override
 
- Public Member Functions inherited from DigiAccumulatorMixMod
virtual void beginRun (edm::Run const &run, edm::EventSetup const &setup)
 
 DigiAccumulatorMixMod ()
 
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)
 
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::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 unsigned int 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 (unsigned int 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< unsigned int, const Phase2TrackerGeomDetUnit * > detectorUnits_
 
bool first_
 
const std::string geometryType_
 
const std::string hitsProducer_
 
const bool isOuterTrackerReadoutAnalog
 
const bool makeDigiSimLinks_
 
ModuleTypeCache moduleTypeCache_
 
edm::ESHandle< TrackerGeometrypDD_
 
const bool premixStage1_
 
edm::ESHandle< MagneticFieldpSetup_
 
edm::ESWatcher< TrackerDigiGeometryRecordtheTkDigiGeomWatcher
 
const vstring trackerContainers_
 
edm::ESHandle< TrackerTopologytTopoHand
 

Detailed Description

Definition at line 50 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 70 of file Phase2TrackerDigitizer.h.

Member Enumeration Documentation

Enumerator
InnerPixel 
PixelinPS 
StripinPS 
TwoStrip 
Unknown 

Definition at line 73 of file Phase2TrackerDigitizer.h.

73  {
74  InnerPixel,
75  PixelinPS,
76  StripinPS,
77  TwoStrip,
78  Unknown
79  };

Constructor & Destructor Documentation

cms::Phase2TrackerDigitizer::Phase2TrackerDigitizer ( const edm::ParameterSet iConfig,
edm::ProducerBase mixMod,
edm::ConsumesCollector iC 
)
explicit

Definition at line 80 of file Phase2TrackerDigitizer.cc.

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

80  :
81  first_(true),
82  hitsProducer_(iConfig.getParameter<std::string>("hitsProducer")),
83  trackerContainers_(iConfig.getParameter<std::vector<std::string> >("ROUList")),
84  geometryType_(iConfig.getParameter<std::string>("GeometryType")),
85  isOuterTrackerReadoutAnalog(iConfig.getParameter<bool>("isOTreadoutAnalog")),
86  premixStage1_(iConfig.getParameter<bool>("premixStage1")),
87  makeDigiSimLinks_(iConfig.getParameter<edm::ParameterSet>("AlgorithmCommon").getUntrackedParameter<bool>("makeDigiSimLinks"))
88  {
89  //edm::LogInfo("Phase2TrackerDigitizer") << "Initialize Digitizer Algorithms";
90  const std::string alias1("simSiPixelDigis");
91  mixMod.produces<edm::DetSetVector<PixelDigi> >("Pixel").setBranchAlias(alias1);
92  if(makeDigiSimLinks_) {
93  mixMod.produces<edm::DetSetVector<PixelDigiSimLink> >("Pixel").setBranchAlias(alias1);
94  }
95 
96  if(!iConfig.getParameter<bool>("isOTreadoutAnalog")) {
97  const std::string alias2("simSiTrackerDigis");
98  if(premixStage1_) {
99  // Premixing exploits the ADC field of PixelDigi to store the collected charge
100  // But we still want everything else to be treated like for Phase2TrackerDigi
101  mixMod.produces<edm::DetSetVector<PixelDigi> >("Tracker").setBranchAlias(alias2);
102  }
103  else {
104  mixMod.produces<edm::DetSetVector<Phase2TrackerDigi> >("Tracker").setBranchAlias(alias2);
105  }
106  if(makeDigiSimLinks_) {
107  mixMod.produces<edm::DetSetVector<PixelDigiSimLink> >("Tracker").setBranchAlias(alias2);
108  }
109  }
110  // creating algorithm objects and pushing them into the map
111  algomap_[AlgorithmType::InnerPixel] = std::make_unique<PixelDigitizerAlgorithm>(iConfig);
112  algomap_[AlgorithmType::PixelinPS] = std::make_unique<PSPDigitizerAlgorithm>(iConfig);
113  algomap_[AlgorithmType::StripinPS] = std::make_unique<PSSDigitizerAlgorithm>(iConfig);
114  algomap_[AlgorithmType::TwoStrip] = std::make_unique<SSDigitizerAlgorithm>(iConfig);
115  }
BranchAliasSetterT< ProductType > produces()
declare what type of product will make and with which optional label
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
cms::Phase2TrackerDigitizer::~Phase2TrackerDigitizer ( )
override

Definition at line 139 of file Phase2TrackerDigitizer.cc.

139  {
140  }

Member Function Documentation

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

Implements DigiAccumulatorMixMod.

Definition at line 194 of file Phase2TrackerDigitizer.cc.

References iEvent.

194  {
195  accumulate_local<edm::Event>(iEvent, iSetup);
196  }
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 199 of file Phase2TrackerDigitizer.cc.

References iEvent.

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

Definition at line 204 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.

204  {
205  for (auto const & v : trackerContainers_) {
208  iEvent.getByLabel(tag, simHits);
209 
210  //edm::EDGetTokenT< std::vector<PSimHit> > simHitToken_(consumes< std::vector<PSimHit>(tag));
211  //iEvent.getByToken(simHitToken_, simHits);
212 
213  unsigned int tofBin = PixelDigiSimLink::LowTof;
214  if (v.find(std::string("HighTof")) != std::string::npos) tofBin = PixelDigiSimLink::HighTof;
215  accumulatePixelHits(simHits, crossingSimHitIndexOffset_[tag.encode()], tofBin);
216  // Now that the hits have been processed, I'll add the amount of hits in this crossing on to
217  // the global counter. Next time accumulateStripHits() is called it will count the sim hits
218  // as though they were on the end of this collection.
219  // Note that this is only used for creating digi-sim links (if configured to do so).
220  if (simHits.isValid()) crossingSimHitIndexOffset_[tag.encode()] += simHits->size();
221  }
222  }
void accumulatePixelHits(edm::Handle< std::vector< PSimHit > >, size_t globalSimHitIndex, const unsigned int 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. ...
bool isValid() const
Definition: HandleBase.h:74
void cms::Phase2TrackerDigitizer::accumulatePixelHits ( edm::Handle< std::vector< PSimHit > >  hSimHits,
size_t  globalSimHitIndex,
const unsigned int  tofBin 
)
private

Definition at line 142 of file Phase2TrackerDigitizer.cc.

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

Referenced by accumulate_local().

143  {
144  if (hSimHits.isValid()) {
145  std::set<unsigned int> detIds;
146  std::vector<PSimHit> const& simHits = *hSimHits.product();
147  int indx = 0;
148  for (auto it = simHits.begin(), itEnd = simHits.end(); it != itEnd; ++it, ++globalSimHitIndex) {
149  unsigned int detId_raw = (*it).detUnitId();
150  if (detectorUnits_.find(detId_raw) == detectorUnits_.end()) continue;
151  if (detIds.insert(detId_raw).second) {
152  // The insert succeeded, so this detector element has not yet been processed.
153  AlgorithmType algotype = getAlgoType(detId_raw);
154  const Phase2TrackerGeomDetUnit* phase2det = detectorUnits_[detId_raw];
155  // access to magnetic field in global coordinates
156  GlobalVector bfield = pSetup_->inTesla(phase2det->surface().position());
157  LogDebug("PixelDigitizer") << "B-field(T) at " << phase2det->surface().position() << "(cm): "
158  << pSetup_->inTesla(phase2det->surface().position());
159  if (algomap_.find(algotype) != algomap_.end()) {
160  algomap_[algotype]->accumulateSimHits(it, itEnd, globalSimHitIndex, tofBin, phase2det, bfield);
161  } else
162  edm::LogInfo("Phase2TrackerDigitizer") << "Unsupported algorithm: ";
163  }
164  indx++;
165  }
166  }
167  }
#define LogDebug(id)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
std::map< unsigned int, const Phase2TrackerGeomDetUnit * > detectorUnits_
bool isValid() const
Definition: HandleBase.h:74
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
T const * product() const
Definition: Handle.h:74
AlgorithmType getAlgoType(unsigned int idet)
edm::ESHandle< MagneticField > pSetup_
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
const PositionType & position() const
template<typename DigiType >
void cms::Phase2TrackerDigitizer::addOuterTrackerCollection ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 346 of file Phase2TrackerDigitizer.cc.

References algomap_, DEFINE_DIGI_ACCUMULATOR, TrackerGeometry::detUnits(), getAlgoType(), info(), InnerPixel, makeDigiSimLinks_, eostools::move(), convertSQLitetoXML_cfg::output, pDD_, edm::ESHandle< T >::product(), edm::Event::put(), DigitizerUtility::DigiSimInfo::simInfoList, and tTopoHand.

346  {
347  const TrackerTopology* tTopo = tTopoHand.product();
348  std::vector<edm::DetSet<DigiType> > digiVector;
349  std::vector<edm::DetSet<PixelDigiSimLink> > digiLinkVector;
350  for (auto const & det_u : pDD_->detUnits()) {
351  DetId detId_raw = DetId(det_u->geographicalId().rawId());
352  AlgorithmType algotype = getAlgoType(detId_raw);
353 
354  if (algomap_.find(algotype) == algomap_.end() || algotype == AlgorithmType::InnerPixel) continue;
355 
356  std::map<int, DigitizerUtility::DigiSimInfo> digi_map;
357  algomap_[algotype]->digitize(dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u),
358  digi_map, tTopo);
359  edm::DetSet<DigiType> collector(det_u->geographicalId().rawId());
360  edm::DetSet<PixelDigiSimLink> linkcollector(det_u->geographicalId().rawId());
361 
362  for (auto const & digi_p : digi_map) {
363  DigitizerUtility::DigiSimInfo info = digi_p.second;
364  addToCollector(collector, digi_p.first, info);
365  for (auto const & sim_p : info.simInfoList) {
366 
367  linkcollector.data.emplace_back(digi_p.first, sim_p.second->trackId(), sim_p.second->hitIndex(), sim_p.second->tofBin(), sim_p.second->eventId(), sim_p.first);
368  }
369  }
370 
371  if (!collector.data.empty()) digiVector.push_back(std::move(collector));
372  if (!linkcollector.data.empty()) digiLinkVector.push_back(std::move(linkcollector));
373  }
374 
375  // Step C: create collection with the cache vector of DetSet
376  std::unique_ptr<edm::DetSetVector<DigiType> >
377  output(new edm::DetSetVector<DigiType>(digiVector));
378  std::unique_ptr<edm::DetSetVector<PixelDigiSimLink> >
379  outputlink(new edm::DetSetVector<PixelDigiSimLink>(digiLinkVector));
380 
381  // Step D: write output to file
382  iEvent.put(std::move(output), "Tracker");
383  if(makeDigiSimLinks_) {
384  iEvent.put(std::move(outputlink), "Tracker");
385  }
386  }
static const TGPicture * info(bool iBackgroundIsBlack)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
edm::ESHandle< TrackerTopology > tTopoHand
edm::ESHandle< TrackerGeometry > pDD_
Definition: DetId.h:18
AlgorithmType getAlgoType(unsigned int idet)
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
std::vector< std::pair< float, SimHitInfoForLinks * > > simInfoList
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511
void cms::Phase2TrackerDigitizer::addPixelCollection ( edm::Event iEvent,
const edm::EventSetup iSetup,
const bool  ot_analog 
)
private

Definition at line 289 of file Phase2TrackerDigitizer.cc.

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

Referenced by finalizeEvent().

289  {
290  const TrackerTopology* tTopo = tTopoHand.product();
291  std::vector<edm::DetSet<PixelDigi> > digiVector;
292  std::vector<edm::DetSet<PixelDigiSimLink> > digiLinkVector;
293  for (auto const & det_u : pDD_->detUnits()) {
294  DetId detId_raw = DetId(det_u->geographicalId().rawId());
295  AlgorithmType algotype = getAlgoType(detId_raw);
296  if (algomap_.find(algotype) == algomap_.end()) continue;
297 
298  //Decide if we want analog readout for Outer Tracker.
299  if( !ot_analog && algotype != AlgorithmType::InnerPixel) continue;
300  std::map<int, DigitizerUtility::DigiSimInfo> digi_map;
301  algomap_[algotype]->digitize(dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u),
302  digi_map,tTopo);
303  edm::DetSet<PixelDigi> collector(det_u->geographicalId().rawId());
304  edm::DetSet<PixelDigiSimLink> linkcollector(det_u->geographicalId().rawId());
305  for (auto const & digi_p : digi_map) {
306  DigitizerUtility::DigiSimInfo info = digi_p.second;
307  std::pair<int,int> 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, sim_p.second->trackId(), sim_p.second->hitIndex(), sim_p.second->tofBin(), sim_p.second->eventId(), sim_p.first);
311  }
312  }
313  if (!collector.data.empty()) digiVector.push_back(std::move(collector));
314  if (!linkcollector.data.empty()) digiLinkVector.push_back(std::move(linkcollector));
315  }
316 
317  // Step C: create collection with the cache vector of DetSet
318  std::unique_ptr<edm::DetSetVector<PixelDigi> >
319  output(new edm::DetSetVector<PixelDigi>(digiVector));
320  std::unique_ptr<edm::DetSetVector<PixelDigiSimLink> >
321  outputlink(new edm::DetSetVector<PixelDigiSimLink>(digiLinkVector));
322 
323  // Step D: write output to file
324  iEvent.put(std::move(output), "Pixel");
325  if(makeDigiSimLinks_) {
326  iEvent.put(std::move(outputlink), "Pixel");
327  }
328  }
static const TGPicture * info(bool iBackgroundIsBlack)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
edm::ESHandle< TrackerTopology > tTopoHand
edm::ESHandle< TrackerGeometry > pDD_
Definition: DetId.h:18
AlgorithmType getAlgoType(unsigned int idet)
static std::pair< int, int > channelToPixel(int ch)
Definition: PixelDigi.h:62
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
std::vector< std::pair< float, SimHitInfoForLinks * > > simInfoList
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511
virtual void cms::Phase2TrackerDigitizer::beginJob ( void  )
inlinevirtual
void cms::Phase2TrackerDigitizer::beginLuminosityBlock ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  iSetup 
)
overridevirtual

Reimplemented from DigiAccumulatorMixMod.

Definition at line 117 of file Phase2TrackerDigitizer.cc.

References edm::ESWatcher< T >::check(), detectorUnits_, TrackerGeometry::detUnits(), geometryType_, edm::EventSetup::get(), moduleTypeCache_, pDD_, pSetup_, theTkDigiGeomWatcher, align::Tracker, and tTopoHand.

Referenced by PreMixingPhase2TrackerWorker::beginLuminosityBlock().

117  {
118 
119  iSetup.get<IdealMagneticFieldRecord>().get(pSetup_);
120  iSetup.get<TrackerTopologyRcd>().get(tTopoHand);
121 
122  if (theTkDigiGeomWatcher.check(iSetup)) {
123  iSetup.get<TrackerDigiGeometryRecord>().get(geometryType_, pDD_);
124  //reset cache
126  detectorUnits_.clear();
127  for (auto const & det_u : pDD_->detUnits()) {
128  unsigned int detId_raw = det_u->geographicalId().rawId();
129  DetId detId = DetId(detId_raw);
130  if (DetId(detId).det() == DetId::Detector::Tracker) {
131  const Phase2TrackerGeomDetUnit* pixdet = dynamic_cast<const Phase2TrackerGeomDetUnit*>(det_u);
132  assert(pixdet);
133  detectorUnits_.insert(std::make_pair(detId_raw, pixdet));
134  }
135  }
136  }
137  }
edm::ESWatcher< TrackerDigiGeometryRecord > theTkDigiGeomWatcher
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
std::unordered_map< unsigned, TrackerGeometry::ModuleType > ModuleTypeCache
std::map< unsigned int, const Phase2TrackerGeomDetUnit * > detectorUnits_
edm::ESHandle< TrackerTopology > tTopoHand
edm::ESHandle< TrackerGeometry > pDD_
Definition: DetId.h:18
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
edm::ESHandle< MagneticField > pSetup_
void cms::Phase2TrackerDigitizer::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 233 of file Phase2TrackerDigitizer.cc.

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

Referenced by PreMixingPhase2TrackerWorker::put().

233  {
234  //Decide if we want analog readout for Outer Tracker.
237  if(premixStage1_) {
238  addOuterTrackerCollection<PixelDigi>(iEvent, iSetup);
239  }
240  else {
241  addOuterTrackerCollection<Phase2TrackerDigi>(iEvent, iSetup);
242  }
243  }
244  }
int iEvent
Definition: GenABIO.cc:224
void addPixelCollection(edm::Event &iEvent, const edm::EventSetup &iSetup, const bool ot_analog)
Phase2TrackerDigitizer::AlgorithmType cms::Phase2TrackerDigitizer::getAlgoType ( unsigned int  idet)
private

Definition at line 245 of file Phase2TrackerDigitizer.cc.

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

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

245  {
246  DetId detId(detId_raw);
247 
249 
250  //get mType either from the geometry or from our cache (faster)
252  auto itr = moduleTypeCache_.find(detId_raw);
253  if( itr != moduleTypeCache_.end() ) {
254  mType = itr->second;
255  } else {
256  mType = pDD_->getDetectorType(detId);
257  moduleTypeCache_.emplace(detId_raw,mType);
258  }
259 
260  switch(mType){
261 
263  algotype = AlgorithmType::InnerPixel;
264  break;
266  algotype = AlgorithmType::InnerPixel;
267  break;
269  algotype = AlgorithmType::InnerPixel;
270  break;
272  algotype = AlgorithmType::InnerPixel;
273  break;
275  algotype = AlgorithmType::PixelinPS;
276  break;
278  algotype = AlgorithmType::StripinPS;
279  break;
281  algotype = AlgorithmType::TwoStrip;
282  break;
283  default:
284  edm::LogError("Phase2TrackerDigitizer")<<"ERROR - Wrong Detector Type, No Algorithm available ";
285  }
286 
287  return algotype;
288  }
edm::ESHandle< TrackerGeometry > pDD_
ModuleType getDetectorType(DetId) const
Definition: DetId.h:18
void cms::Phase2TrackerDigitizer::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 170 of file Phase2TrackerDigitizer.cc.

References algomap_, crossingSimHitIndexOffset_, Exception, first_, edm::RandomNumberGenerator::getEngine(), edm::Service< T >::isAvailable(), and edm::Event::streamID().

Referenced by PreMixingPhase2TrackerWorker::initializeEvent().

170  {
171 
173  if (!rng.isAvailable()) {
174  throw cms::Exception("Configuration")
175  << "Phase2TrackerDigitizer requires the RandomNumberGeneratorService\n"
176  "which is not present in the configuration file. You must add the service\n"
177  "in the configuration file or remove the modules that require it.";
178  }
179 
180  // Must initialize all the algorithms
181  for (auto const & el : algomap_) {
182  if (first_) el.second->init(iSetup);
183 
184  el.second->initializeEvent(rng->getEngine(e.streamID()));
185  }
186  first_ = false;
187  // Make sure that the first crossing processed starts indexing the sim hits from zero.
188  // This variable is used so that the sim hits from all crossing frames have sequential
189  // indices used to create the digi-sim link (if configured to do so) rather than starting
190  // from zero for each crossing.
192  }
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
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. ...
std::map< AlgorithmType, std::unique_ptr< Phase2TrackerDigitizerAlgorithm > > algomap_
void cms::Phase2TrackerDigitizer::loadAccumulator ( const std::map< unsigned int, std::map< int, float > > &  accumulator)

Definition at line 225 of file Phase2TrackerDigitizer.cc.

References mixOne_premix_on_sim_cfi::accumulator, patPFMETCorrections_cff::algo, algomap_, particleFlow_cfi::algoType, and getAlgoType().

Referenced by PreMixingPhase2TrackerWorker::put().

225  {
226  for(const auto& detMap: accumulator) {
227  AlgorithmType algoType = getAlgoType(detMap.first);
228  auto& algo = *(algomap_.at(algoType));
229  algo.loadAccumulator(detMap.first, detMap.second);
230  }
231  }
AlgorithmType getAlgoType(unsigned int 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 102 of file Phase2TrackerDigitizer.h.

Referenced by accumulate_local(), and initializeEvent().

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

Definition at line 109 of file Phase2TrackerDigitizer.h.

Referenced by accumulatePixelHits(), and beginLuminosityBlock().

bool cms::Phase2TrackerDigitizer::first_
private

Definition at line 92 of file Phase2TrackerDigitizer.h.

Referenced by initializeEvent().

const std::string cms::Phase2TrackerDigitizer::geometryType_
private

Definition at line 106 of file Phase2TrackerDigitizer.h.

Referenced by beginLuminosityBlock().

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

Definition at line 104 of file Phase2TrackerDigitizer.h.

Referenced by accumulate_local().

const bool cms::Phase2TrackerDigitizer::isOuterTrackerReadoutAnalog
private

Definition at line 112 of file Phase2TrackerDigitizer.h.

Referenced by finalizeEvent().

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

Definition at line 116 of file Phase2TrackerDigitizer.h.

Referenced by beginLuminosityBlock(), and getAlgoType().

edm::ESHandle<TrackerGeometry> cms::Phase2TrackerDigitizer::pDD_
private
const bool cms::Phase2TrackerDigitizer::premixStage1_
private

Definition at line 113 of file Phase2TrackerDigitizer.h.

Referenced by finalizeEvent(), and Phase2TrackerDigitizer().

edm::ESHandle<MagneticField> cms::Phase2TrackerDigitizer::pSetup_
private

Definition at line 108 of file Phase2TrackerDigitizer.h.

Referenced by accumulatePixelHits(), and beginLuminosityBlock().

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

Definition at line 111 of file Phase2TrackerDigitizer.h.

Referenced by beginLuminosityBlock().

const vstring cms::Phase2TrackerDigitizer::trackerContainers_
private

Definition at line 105 of file Phase2TrackerDigitizer.h.

Referenced by accumulate_local().

edm::ESHandle<TrackerTopology> cms::Phase2TrackerDigitizer::tTopoHand
private