CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
SiStripDigitizer Class Reference

Accumulator to perform digitisation on the strip tracker sim hits. More...

#include <SiStripDigitizer.h>

Inheritance diagram for SiStripDigitizer:
DigiAccumulatorMixMod

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
 
void finalizeEvent (edm::Event &e, edm::EventSetup const &c) override
 
PileupMixingContentgetEventPileupInfo () override
 
void initializeEvent (edm::Event const &e, edm::EventSetup const &c) override
 
 SiStripDigitizer (const edm::ParameterSet &conf, edm::ProducesCollector, edm::ConsumesCollector &iC)
 
void StorePileupInformation (std::vector< int > &numInteractionList, std::vector< int > &bunchCrossingList, std::vector< float > &TrueInteractionList, std::vector< edm::EventID > &eventInfoList, int bunchSpacing) override
 
 ~SiStripDigitizer () 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 void initializeBunchCrossing (edm::Event const &event, edm::EventSetup const &setup, int bunchCrossing)
 
DigiAccumulatorMixMod const & operator= (DigiAccumulatorMixMod const &)=delete
 
virtual ~DigiAccumulatorMixMod ()
 

Private Types

typedef std::map< unsigned int, std::vector< std::pair< const PSimHit *, int > >, std::less< unsigned int > > simhit_map
 
typedef simhit_map::iterator simhit_map_iterator
 
typedef std::vector< std::string > vstring
 

Private Member Functions

void accumulateStripHits (edm::Handle< std::vector< PSimHit >>, const TrackerTopology *tTopo, size_t globalSimHitIndex, const unsigned int tofBin)
 

Private Attributes

edm::ESGetToken< SiStripApvSimulationParameters, SiStripApvSimulationParametersRcdapvSimulationParametersToken_
 Whether or not to create the association to sim truth collection. Set in configuration. More...
 
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...
 
edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcddetCablingToken_
 
std::map< unsigned int, StripGeomDetUnit const * > detectorUnits
 
const double fracOfEventsToSimAPV_
 
const edm::ESGetToken< SiStripGain, SiStripGainSimRcdgainToken_
 
const std::string hitsProducer
 
const bool includeAPVSimulation_
 
const bool makeDigiSimLinks_
 
const edm::ESGetToken< SiStripNoises, SiStripNoisesRcdnoiseToken_
 
const TrackerGeometrypDD = nullptr
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordpDDToken_
 
const edm::ESGetToken< SiStripPedestals, SiStripPedestalsRcdpedestalToken_
 
std::unique_ptr< PileupMixingContentPileupInfo_
 
const std::string PRDigi
 
const MagneticFieldpSetup = nullptr
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordpSetupToken_
 
CLHEP::HepRandomEngine * randomEngine_ = nullptr
 
const std::string SCDigi
 
std::vector< std::pair< int, std::bitset< 6 > > > theAffectedAPVvector
 
std::map< uint32_t, std::vector< int > > theDetIdList
 
std::unique_ptr< SiStripDigitizerAlgorithmtheDigiAlgo
 
const edm::ESGetToken< SiStripThreshold, SiStripThresholdRcdthresholdToken_
 
const vstring trackerContainers
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken_
 
const bool useConfFromDB
 
const std::string VRDigi
 
const bool zeroSuppression
 
const std::string ZSDigi
 

Detailed Description

Accumulator to perform digitisation on the strip tracker sim hits.

Author
original author unknown; converted from a producer to a MixingModule accumulator by Bill Tanenbaum; functionality to create digi-sim links moved from Bill's DigiSimLinkProducer into here by Mark Grimes (mark..nosp@m.grim.nosp@m.es@br.nosp@m.isto.nosp@m.l.ac..nosp@m.uk).
Date
original date unknown; moved into a MixingModule accumulator mid to late 2012; digi sim links eventually finished May 2013

Definition at line 56 of file SiStripDigitizer.h.

Member Typedef Documentation

◆ simhit_map

typedef std::map<unsigned int, std::vector<std::pair<const PSimHit*, int> >, std::less<unsigned int> > SiStripDigitizer::simhit_map
private

Definition at line 85 of file SiStripDigitizer.h.

◆ simhit_map_iterator

typedef simhit_map::iterator SiStripDigitizer::simhit_map_iterator
private

Definition at line 86 of file SiStripDigitizer.h.

◆ vstring

typedef std::vector<std::string> SiStripDigitizer::vstring
private

Definition at line 84 of file SiStripDigitizer.h.

Constructor & Destructor Documentation

◆ SiStripDigitizer()

SiStripDigitizer::SiStripDigitizer ( const edm::ParameterSet conf,
edm::ProducesCollector  producesCollector,
edm::ConsumesCollector iC 
)
explicit

Definition at line 53 of file SiStripDigitizer.cc.

References SiStripOfflineCRack_cfg::alias, apvSimulationParametersToken_, edm::ConsumesCollector::consumes(), detCablingToken_, edm::ConsumesCollector::esConsumes(), Exception, hitsProducer, includeAPVSimulation_, HLT_2022v11_cff::InputTag, edm::Service< T >::isAvailable(), PRDigi, edm::ProducesCollector::produces(), SCDigi, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, theDigiAlgo, trackerContainers, useConfFromDB, VRDigi, and ZSDigi.

56  : hitsProducer(conf.getParameter<std::string>("hitsProducer")),
57  trackerContainers(conf.getParameter<std::vector<std::string>>("ROUList")),
58  ZSDigi(conf.getParameter<edm::ParameterSet>("DigiModeList").getParameter<std::string>("ZSDigi")),
59  SCDigi(conf.getParameter<edm::ParameterSet>("DigiModeList").getParameter<std::string>("SCDigi")),
60  VRDigi(conf.getParameter<edm::ParameterSet>("DigiModeList").getParameter<std::string>("VRDigi")),
61  PRDigi(conf.getParameter<edm::ParameterSet>("DigiModeList").getParameter<std::string>("PRDigi")),
62  useConfFromDB(conf.getParameter<bool>("TrackerConfigurationFromDB")),
63  zeroSuppression(conf.getParameter<bool>("ZeroSuppression")),
64  makeDigiSimLinks_(conf.getUntrackedParameter<bool>("makeDigiSimLinks", false)),
65  includeAPVSimulation_(conf.getParameter<bool>("includeAPVSimulation")),
66  fracOfEventsToSimAPV_(conf.getParameter<double>("fracOfEventsToSimAPV")),
67  tTopoToken_(iC.esConsumes()),
68  pDDToken_(iC.esConsumes(edm::ESInputTag("", conf.getParameter<std::string>("GeometryType")))),
71  noiseToken_(iC.esConsumes()),
74  if (useConfFromDB) {
76  }
79  }
80 
81  const std::string alias("simSiStripDigis");
82 
83  producesCollector.produces<edm::DetSetVector<SiStripDigi>>(ZSDigi).setBranchAlias(ZSDigi);
84  producesCollector.produces<edm::DetSetVector<SiStripRawDigi>>(SCDigi).setBranchAlias(alias + SCDigi);
85  producesCollector.produces<edm::DetSetVector<SiStripRawDigi>>(VRDigi).setBranchAlias(alias + VRDigi);
86  producesCollector.produces<edm::DetSetVector<SiStripRawDigi>>("StripAmplitudes")
87  .setBranchAlias(alias + "StripAmplitudes");
88  producesCollector.produces<edm::DetSetVector<SiStripRawDigi>>("StripAmplitudesPostAPV")
89  .setBranchAlias(alias + "StripAmplitudesPostAPV");
90  producesCollector.produces<edm::DetSetVector<SiStripRawDigi>>("StripAPVBaselines")
91  .setBranchAlias(alias + "StripAPVBaselines");
92  producesCollector.produces<edm::DetSetVector<SiStripRawDigi>>(PRDigi).setBranchAlias(alias + PRDigi);
93  producesCollector.produces<edm::DetSetVector<StripDigiSimLink>>().setBranchAlias(alias + "siStripDigiSimLink");
94  producesCollector.produces<bool>("SimulatedAPVDynamicGain").setBranchAlias(alias + "SimulatedAPVDynamicGain");
95  producesCollector.produces<std::vector<std::pair<int, std::bitset<6>>>>("AffectedAPVList")
96  .setBranchAlias(alias + "AffectedAPV");
97  for (auto const& trackerContainer : trackerContainers) {
98  edm::InputTag tag(hitsProducer, trackerContainer);
99  iC.consumes<std::vector<PSimHit>>(edm::InputTag(hitsProducer, trackerContainer));
100  }
102  if (!rng.isAvailable()) {
103  throw cms::Exception("Configuration")
104  << "SiStripDigitizer requires the RandomNumberGeneratorService\n"
105  "which is not present in the configuration file. You must add the service\n"
106  "in the configuration file or remove the modules that require it.";
107  }
108  theDigiAlgo = std::make_unique<SiStripDigitizerAlgorithm>(conf, iC);
109 }
const vstring trackerContainers
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const std::string ZSDigi
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
const bool zeroSuppression
const std::string hitsProducer
edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd > detCablingToken_
const bool useConfFromDB
T getUntrackedParameter(std::string const &, T const &) const
edm::ESGetToken< SiStripApvSimulationParameters, SiStripApvSimulationParametersRcd > apvSimulationParametersToken_
Whether or not to create the association to sim truth collection. Set in configuration.
const bool includeAPVSimulation_
const edm::ESGetToken< SiStripPedestals, SiStripPedestalsRcd > pedestalToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
std::unique_ptr< SiStripDigitizerAlgorithm > theDigiAlgo
const std::string VRDigi
const std::string PRDigi
const edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noiseToken_
const double fracOfEventsToSimAPV_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > pSetupToken_
const edm::ESGetToken< SiStripThreshold, SiStripThresholdRcd > thresholdToken_
bool isAvailable() const
Definition: Service.h:40
const bool makeDigiSimLinks_
const edm::ESGetToken< SiStripGain, SiStripGainSimRcd > gainToken_
const std::string SCDigi

◆ ~SiStripDigitizer()

SiStripDigitizer::~SiStripDigitizer ( )
override

Definition at line 112 of file SiStripDigitizer.cc.

112 {}

Member Function Documentation

◆ accumulate() [1/2]

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

Implements DigiAccumulatorMixMod.

Definition at line 145 of file SiStripDigitizer.cc.

References accumulateStripHits(), crossingSimHitIndexOffset_, edm::EventSetup::getData(), StripDigiSimLink::HighTof, hitsProducer, iEvent, StripDigiSimLink::LowTof, FastTrackerRecHitCombiner_cfi::simHits, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, trackerContainers, and tTopoToken_.

145  {
146  //Retrieve tracker topology from geometry
147  const TrackerTopology* tTopo = &iSetup.getData(tTopoToken_);
148 
149  // Step A: Get Inputs
150  for (auto const& trackerContainer : trackerContainers) {
152  edm::InputTag tag(hitsProducer, trackerContainer);
153  unsigned int tofBin = StripDigiSimLink::LowTof;
154  if (trackerContainer.find(std::string("HighTof")) != std::string::npos)
155  tofBin = StripDigiSimLink::HighTof;
156 
157  iEvent.getByLabel(tag, simHits);
158  accumulateStripHits(simHits, tTopo, crossingSimHitIndexOffset_[tag.encode()], tofBin);
159  // Now that the hits have been processed, I'll add the amount of hits in this crossing on to
160  // the global counter. Next time accumulateStripHits() is called it will count the sim hits
161  // as though they were on the end of this collection.
162  // Note that this is only used for creating digi-sim links (if configured to do so).
163  if (simHits.isValid())
164  crossingSimHitIndexOffset_[tag.encode()] += simHits->size();
165  }
166 }
const vstring trackerContainers
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
const std::string hitsProducer
int iEvent
Definition: GenABIO.cc:224
void accumulateStripHits(edm::Handle< std::vector< PSimHit >>, const TrackerTopology *tTopo, size_t globalSimHitIndex, const unsigned int tofBin)
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. ...

◆ accumulate() [2/2]

void SiStripDigitizer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
edm::StreamID const &  streamID 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 168 of file SiStripDigitizer.cc.

References accumulateStripHits(), crossingSimHitIndexOffset_, edm::EventSetup::getData(), StripDigiSimLink::HighTof, hitsProducer, iEvent, StripDigiSimLink::LowTof, PileupInfo_, FastTrackerRecHitCombiner_cfi::simHits, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, theDigiAlgo, trackerContainers, and tTopoToken_.

170  {
171  const TrackerTopology* tTopo = &iSetup.getData(tTopoToken_);
172 
173  //Re-compute luminosity for accumulation for HIP effects
174  theDigiAlgo->calculateInstlumiScale(PileupInfo_.get());
175 
176  // Step A: Get Inputs
177  for (auto const& trackerContainer : trackerContainers) {
179  edm::InputTag tag(hitsProducer, trackerContainer);
180  unsigned int tofBin = StripDigiSimLink::LowTof;
181  if (trackerContainer.find(std::string("HighTof")) != std::string::npos)
182  tofBin = StripDigiSimLink::HighTof;
183 
184  iEvent.getByLabel(tag, simHits);
185  accumulateStripHits(simHits, tTopo, crossingSimHitIndexOffset_[tag.encode()], tofBin);
186  // Now that the hits have been processed, I'll add the amount of hits in this crossing on to
187  // the global counter. Next time accumulateStripHits() is called it will count the sim hits
188  // as though they were on the end of this collection.
189  // Note that this is only used for creating digi-sim links (if configured to do so).
190  if (simHits.isValid())
191  crossingSimHitIndexOffset_[tag.encode()] += simHits->size();
192  }
193 }
const vstring trackerContainers
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
const std::string hitsProducer
int iEvent
Definition: GenABIO.cc:224
void accumulateStripHits(edm::Handle< std::vector< PSimHit >>, const TrackerTopology *tTopo, size_t globalSimHitIndex, const unsigned int tofBin)
std::unique_ptr< SiStripDigitizerAlgorithm > theDigiAlgo
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::unique_ptr< PileupMixingContent > PileupInfo_

◆ accumulateStripHits()

void SiStripDigitizer::accumulateStripHits ( edm::Handle< std::vector< PSimHit >>  hSimHits,
const TrackerTopology tTopo,
size_t  globalSimHitIndex,
const unsigned int  tofBin 
)
private

Definition at line 114 of file SiStripDigitizer.cc.

References cms::cuda::assert(), detectorUnits, MagneticField::inTesla(), GeomDetEnumerators::isTrackerStrip(), LogDebug, pSetup, randomEngine_, FastTrackerRecHitCombiner_cfi::simHits, and theDigiAlgo.

Referenced by accumulate().

117  {
118  // globalSimHitIndex is the index the sim hit will have when it is put in a collection
119  // of sim hits for all crossings. This is only used when creating digi-sim links if
120  // configured to do so.
121 
122  if (hSimHits.isValid()) {
123  std::set<unsigned int> detIds;
124  std::vector<PSimHit> const& simHits = *hSimHits.product();
125  for (std::vector<PSimHit>::const_iterator it = simHits.begin(), itEnd = simHits.end(); it != itEnd;
126  ++it, ++globalSimHitIndex) {
127  unsigned int detId = (*it).detUnitId();
128  if (detIds.insert(detId).second) {
129  // The insert succeeded, so this detector element has not yet been processed.
130  assert(detectorUnits[detId]);
131  if (detectorUnits[detId]->type().isTrackerStrip()) { // this test can be removed and replaced by stripdet!=0
132  auto stripdet = detectorUnits[detId];
133  //access to magnetic field in global coordinates
134  GlobalVector bfield = pSetup->inTesla(stripdet->surface().position());
135  LogDebug("Digitizer ") << "B-field(T) at " << stripdet->surface().position()
136  << "(cm): " << pSetup->inTesla(stripdet->surface().position());
137  theDigiAlgo->accumulateSimHits(it, itEnd, globalSimHitIndex, tofBin, stripdet, bfield, tTopo, randomEngine_);
138  }
139  }
140  } // end of loop over sim hits
141  }
142 }
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
T const * product() const
Definition: Handle.h:70
std::map< unsigned int, StripGeomDetUnit const * > detectorUnits
assert(be >=bs)
const MagneticField * pSetup
CLHEP::HepRandomEngine * randomEngine_
bool isTrackerStrip(GeomDetEnumerators::SubDetector m)
std::unique_ptr< SiStripDigitizerAlgorithm > theDigiAlgo
bool isValid() const
Definition: HandleBase.h:70
#define LogDebug(id)

◆ finalizeEvent()

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

Implements DigiAccumulatorMixMod.

Definition at line 235 of file SiStripDigitizer.cc.

References apvSimulationParametersToken_, runTheMatrix::const, TrackerGeometry::detUnits(), fracOfEventsToSimAPV_, PedestalClient_cfi::gain, gainToken_, edm::EventSetup::getData(), iEvent, includeAPVSimulation_, makeDigiSimLinks_, eostools::move(), hgchebackDigitizer_cfi::noise, noiseToken_, convertSQLitetoXML_cfg::output, pDD, EcalCondDBWriter_cfi::pedestal, pedestalToken_, PRDigi, randomEngine_, SCDigi, theAffectedAPVvector, theDetIdList, theDigiAlgo, remoteMonitoring_LASER_era2018_cfg::threshold, thresholdToken_, tTopoToken_, useConfFromDB, trackerHitRTTI::vector, VRDigi, zeroSuppression, and ZSDigi.

235  {
236  auto const& gain = iSetup.getData(gainToken_);
237  auto const& noise = iSetup.getData(noiseToken_);
238  auto const& threshold = iSetup.getData(thresholdToken_);
239  auto const& pedestal = iSetup.getData(pedestalToken_);
240  SiStripApvSimulationParameters const* apvSimulationParameters = nullptr;
241 
242  std::unique_ptr<bool> simulateAPVInThisEvent = std::make_unique<bool>(false);
243  if (includeAPVSimulation_) {
244  if (CLHEP::RandFlat::shoot(randomEngine_) < fracOfEventsToSimAPV_) {
245  *simulateAPVInThisEvent = true;
246  apvSimulationParameters = &iSetup.getData(apvSimulationParametersToken_);
247  }
248  }
249  std::vector<edm::DetSet<SiStripDigi>> theDigiVector;
250  std::vector<edm::DetSet<SiStripRawDigi>> theRawDigiVector;
251  std::unique_ptr<edm::DetSetVector<SiStripRawDigi>> theStripAmplitudeVector(new edm::DetSetVector<SiStripRawDigi>());
252  std::unique_ptr<edm::DetSetVector<SiStripRawDigi>> theStripAmplitudeVectorPostAPV(
254  std::unique_ptr<edm::DetSetVector<SiStripRawDigi>> theStripAPVBaselines(new edm::DetSetVector<SiStripRawDigi>());
255  std::unique_ptr<edm::DetSetVector<StripDigiSimLink>> pOutputDigiSimLink(new edm::DetSetVector<StripDigiSimLink>);
256 
257  const TrackerTopology* tTopo = &iSetup.getData(tTopoToken_);
258 
259  // Step B: LOOP on StripGeomDetUnit
260  theDigiVector.reserve(10000);
261  theDigiVector.clear();
262 
263  for (const auto& iu : pDD->detUnits()) {
264  if (useConfFromDB) {
265  //apply the cable map _before_ digitization: consider only the detis that are connected
266  if (theDetIdList.find(iu->geographicalId().rawId()) == theDetIdList.end())
267  continue;
268  }
269  auto sgd = dynamic_cast<StripGeomDetUnit const*>(iu);
270  if (sgd != nullptr) {
271  edm::DetSet<SiStripDigi> collectorZS(iu->geographicalId().rawId());
272  edm::DetSet<SiStripRawDigi> collectorRaw(iu->geographicalId().rawId());
273  edm::DetSet<SiStripRawDigi> collectorStripAmplitudes(iu->geographicalId().rawId());
274  edm::DetSet<SiStripRawDigi> collectorStripAmplitudesPostAPV(iu->geographicalId().rawId());
275  edm::DetSet<SiStripRawDigi> collectorStripAPVBaselines(iu->geographicalId().rawId());
276  edm::DetSet<StripDigiSimLink> collectorLink(iu->geographicalId().rawId());
277 
278  unsigned int detID = sgd->geographicalId().rawId();
279  DetId detId(detID);
280 
281  theDigiAlgo->digitize(collectorZS,
282  collectorRaw,
283  collectorStripAmplitudes,
284  collectorStripAmplitudesPostAPV,
285  collectorStripAPVBaselines,
286  collectorLink,
287  sgd,
288  gain,
289  threshold,
290  noise,
291  pedestal,
292  *simulateAPVInThisEvent,
293  apvSimulationParameters,
296  tTopo);
297 
298  if (!collectorStripAmplitudes.data.empty())
299  theStripAmplitudeVector->insert(collectorStripAmplitudes);
300  if (!collectorStripAmplitudesPostAPV.data.empty())
301  theStripAmplitudeVectorPostAPV->insert(collectorStripAmplitudesPostAPV);
302  if (!collectorStripAPVBaselines.data.empty())
303  theStripAPVBaselines->insert(collectorStripAPVBaselines);
304 
305  if (zeroSuppression) {
306  if (!collectorZS.data.empty()) {
307  theDigiVector.push_back(collectorZS);
308  if (!collectorLink.data.empty())
309  pOutputDigiSimLink->insert(collectorLink);
310  }
311  } else {
312  if (!collectorRaw.data.empty()) {
313  theRawDigiVector.push_back(collectorRaw);
314  if (!collectorLink.data.empty())
315  pOutputDigiSimLink->insert(collectorLink);
316  }
317  }
318  }
319  }
320  if (zeroSuppression) {
321  // Step C: create output collection
322  std::unique_ptr<edm::DetSetVector<SiStripRawDigi>> output_virginraw(new edm::DetSetVector<SiStripRawDigi>());
323  std::unique_ptr<edm::DetSetVector<SiStripRawDigi>> output_scopemode(new edm::DetSetVector<SiStripRawDigi>());
324  std::unique_ptr<edm::DetSetVector<SiStripRawDigi>> output_processedraw(new edm::DetSetVector<SiStripRawDigi>());
325  std::unique_ptr<edm::DetSetVector<SiStripDigi>> output(new edm::DetSetVector<SiStripDigi>(theDigiVector));
326  std::unique_ptr<std::vector<std::pair<int, std::bitset<6>>>> AffectedAPVList(
327  new std::vector<std::pair<int, std::bitset<6>>>(theAffectedAPVvector));
328 
329  // Step D: write output to file
330  iEvent.put(std::move(output), ZSDigi);
331  iEvent.put(std::move(output_scopemode), SCDigi);
332  iEvent.put(std::move(output_virginraw), VRDigi);
333  iEvent.put(std::move(theStripAmplitudeVector), "StripAmplitudes");
334  iEvent.put(std::move(theStripAmplitudeVectorPostAPV), "StripAmplitudesPostAPV");
335  iEvent.put(std::move(theStripAPVBaselines), "StripAPVBaselines");
336  iEvent.put(std::move(output_processedraw), PRDigi);
337  iEvent.put(std::move(AffectedAPVList), "AffectedAPVList");
338  iEvent.put(std::move(simulateAPVInThisEvent), "SimulatedAPVDynamicGain");
339  if (makeDigiSimLinks_)
340  iEvent.put(
341  std::move(pOutputDigiSimLink)); // The previous EDProducer didn't name this collection so I won't either
342  } else {
343  // Step C: create output collection
344  std::unique_ptr<edm::DetSetVector<SiStripRawDigi>> output_virginraw(
345  new edm::DetSetVector<SiStripRawDigi>(theRawDigiVector));
346  std::unique_ptr<edm::DetSetVector<SiStripRawDigi>> output_scopemode(new edm::DetSetVector<SiStripRawDigi>());
347  std::unique_ptr<edm::DetSetVector<SiStripRawDigi>> output_processedraw(new edm::DetSetVector<SiStripRawDigi>());
348  std::unique_ptr<edm::DetSetVector<SiStripDigi>> output(new edm::DetSetVector<SiStripDigi>());
349 
350  // Step D: write output to file
351  iEvent.put(std::move(output), ZSDigi);
352  iEvent.put(std::move(output_scopemode), SCDigi);
353  iEvent.put(std::move(output_virginraw), VRDigi);
354  iEvent.put(std::move(theStripAmplitudeVector), "StripAmplitudes");
355  iEvent.put(std::move(theStripAmplitudeVectorPostAPV), "StripAmplitudesPostAPV");
356  iEvent.put(std::move(theStripAPVBaselines), "StripAPVBaselines");
357  iEvent.put(std::move(output_processedraw), PRDigi);
358  iEvent.put(std::move(simulateAPVInThisEvent), "SimulatedAPVDynamicGain");
359  if (makeDigiSimLinks_)
360  iEvent.put(
361  std::move(pOutputDigiSimLink)); // The previous EDProducer didn't name this collection so I won't either
362  }
363  randomEngine_ = nullptr; // to prevent access outside event
364 }
const std::string ZSDigi
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
const bool zeroSuppression
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
const bool useConfFromDB
std::map< uint32_t, std::vector< int > > theDetIdList
edm::ESGetToken< SiStripApvSimulationParameters, SiStripApvSimulationParametersRcd > apvSimulationParametersToken_
Whether or not to create the association to sim truth collection. Set in configuration.
CLHEP::HepRandomEngine * randomEngine_
int iEvent
Definition: GenABIO.cc:224
const bool includeAPVSimulation_
const TrackerGeometry * pDD
const edm::ESGetToken< SiStripPedestals, SiStripPedestalsRcd > pedestalToken_
Definition: DetId.h:17
std::unique_ptr< SiStripDigitizerAlgorithm > theDigiAlgo
const std::string VRDigi
const std::string PRDigi
std::vector< std::pair< int, std::bitset< 6 > > > theAffectedAPVvector
const double fracOfEventsToSimAPV_
const edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noiseToken_
const edm::ESGetToken< SiStripThreshold, SiStripThresholdRcd > thresholdToken_
const bool makeDigiSimLinks_
const edm::ESGetToken< SiStripGain, SiStripGainSimRcd > gainToken_
def move(src, dest)
Definition: eostools.py:511
const std::string SCDigi

◆ getEventPileupInfo()

PileupMixingContent* SiStripDigitizer::getEventPileupInfo ( )
inlineoverridevirtual

Reimplemented from DigiAccumulatorMixMod.

Definition at line 76 of file SiStripDigitizer.h.

References PileupInfo_.

76 { return PileupInfo_.get(); }
std::unique_ptr< PileupMixingContent > PileupInfo_

◆ initializeEvent()

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

Implements DigiAccumulatorMixMod.

Definition at line 195 of file SiStripDigitizer.cc.

References cms::cuda::assert(), runTheMatrix::const, crossingSimHitIndexOffset_, detCablingToken_, detectorUnits, TrackerGeometry::detUnits(), edm::EventSetup::getData(), edm::RandomNumberGenerator::getEngine(), iEvent, pDD, pDDToken_, pSetup, pSetupToken_, randomEngine_, theAffectedAPVvector, theDetIdList, theDigiAlgo, and useConfFromDB.

195  {
196  // Make sure that the first crossing processed starts indexing the sim hits from zero.
197  // This variable is used so that the sim hits from all crossing frames have sequential
198  // indices used to create the digi-sim link (if configured to do so) rather than starting
199  // from zero for each crossing.
201  theAffectedAPVvector.clear();
202  // Step A: Get Inputs
203 
204  if (useConfFromDB) {
205  iSetup.getData(detCablingToken_).addConnected(theDetIdList);
206  }
207 
208  // Cache random number engine
210  randomEngine_ = &rng->getEngine(iEvent.streamID());
211 
212  theDigiAlgo->initializeEvent(iSetup);
213 
214  pDD = &iSetup.getData(pDDToken_);
215  pSetup = &iSetup.getData(pSetupToken_);
216 
217  // FIX THIS! We only need to clear and (re)fill detectorUnits when the geometry type IOV changes. Use ESWatcher to determine this.
218  bool changes = true;
219  if (changes) { // Replace with ESWatcher
220  detectorUnits.clear();
221  }
222  for (const auto& iu : pDD->detUnits()) {
223  unsigned int detId = iu->geographicalId().rawId();
224  if (iu->type().isTrackerStrip()) {
225  auto stripdet = dynamic_cast<StripGeomDetUnit const*>(iu);
226  assert(stripdet != nullptr);
227  if (changes) { // Replace with ESWatcher
228  detectorUnits.insert(std::make_pair(detId, stripdet));
229  }
230  theDigiAlgo->initializeDetUnit(stripdet, iSetup);
231  }
232  }
233 }
edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd > detCablingToken_
std::map< unsigned int, StripGeomDetUnit const * > detectorUnits
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
assert(be >=bs)
const MagneticField * pSetup
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
const bool useConfFromDB
std::map< uint32_t, std::vector< int > > theDetIdList
CLHEP::HepRandomEngine * randomEngine_
int iEvent
Definition: GenABIO.cc:224
const TrackerGeometry * pDD
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
std::unique_ptr< SiStripDigitizerAlgorithm > theDigiAlgo
std::vector< std::pair< int, std::bitset< 6 > > > theAffectedAPVvector
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > pSetupToken_
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. ...

◆ StorePileupInformation()

void SiStripDigitizer::StorePileupInformation ( std::vector< int > &  numInteractionList,
std::vector< int > &  bunchCrossingList,
std::vector< float > &  TrueInteractionList,
std::vector< edm::EventID > &  eventInfoList,
int  bunchSpacing 
)
inlineoverridevirtual

Reimplemented from DigiAccumulatorMixMod.

Definition at line 67 of file SiStripDigitizer.h.

References genPUProtons_cfi::bunchCrossingList, hltParticleFlowClusterECALL1Seeded_cfi::bunchSpacing, and PileupInfo_.

71  {
72  PileupInfo_ = std::make_unique<PileupMixingContent>(
73  numInteractionList, bunchCrossingList, TrueInteractionList, eventInfoList, bunchSpacing);
74  }
std::unique_ptr< PileupMixingContent > PileupInfo_

Member Data Documentation

◆ apvSimulationParametersToken_

edm::ESGetToken<SiStripApvSimulationParameters, SiStripApvSimulationParametersRcd> SiStripDigitizer::apvSimulationParametersToken_
private

Whether or not to create the association to sim truth collection. Set in configuration.

Definition at line 107 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and SiStripDigitizer().

◆ crossingSimHitIndexOffset_

std::map<std::string, size_t> SiStripDigitizer::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 118 of file SiStripDigitizer.h.

Referenced by accumulate(), and initializeEvent().

◆ detCablingToken_

edm::ESGetToken<SiStripDetCabling, SiStripDetCablingRcd> SiStripDigitizer::detCablingToken_
private

Definition at line 106 of file SiStripDigitizer.h.

Referenced by initializeEvent(), and SiStripDigitizer().

◆ detectorUnits

std::map<unsigned int, StripGeomDetUnit const*> SiStripDigitizer::detectorUnits
private

Definition at line 124 of file SiStripDigitizer.h.

Referenced by accumulateStripHits(), and initializeEvent().

◆ fracOfEventsToSimAPV_

const double SiStripDigitizer::fracOfEventsToSimAPV_
private

Definition at line 98 of file SiStripDigitizer.h.

Referenced by finalizeEvent().

◆ gainToken_

const edm::ESGetToken<SiStripGain, SiStripGainSimRcd> SiStripDigitizer::gainToken_
private

Definition at line 102 of file SiStripDigitizer.h.

Referenced by finalizeEvent().

◆ hitsProducer

const std::string SiStripDigitizer::hitsProducer
private

Definition at line 88 of file SiStripDigitizer.h.

Referenced by accumulate(), and SiStripDigitizer().

◆ includeAPVSimulation_

const bool SiStripDigitizer::includeAPVSimulation_
private

Definition at line 97 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and SiStripDigitizer().

◆ makeDigiSimLinks_

const bool SiStripDigitizer::makeDigiSimLinks_
private

Definition at line 96 of file SiStripDigitizer.h.

Referenced by finalizeEvent().

◆ noiseToken_

const edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> SiStripDigitizer::noiseToken_
private

Definition at line 103 of file SiStripDigitizer.h.

Referenced by finalizeEvent().

◆ pDD

const TrackerGeometry* SiStripDigitizer::pDD = nullptr
private

Definition at line 122 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and initializeEvent().

◆ pDDToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiStripDigitizer::pDDToken_
private

Definition at line 100 of file SiStripDigitizer.h.

Referenced by initializeEvent().

◆ pedestalToken_

const edm::ESGetToken<SiStripPedestals, SiStripPedestalsRcd> SiStripDigitizer::pedestalToken_
private

Definition at line 105 of file SiStripDigitizer.h.

Referenced by finalizeEvent().

◆ PileupInfo_

std::unique_ptr<PileupMixingContent> SiStripDigitizer::PileupInfo_
private

Definition at line 128 of file SiStripDigitizer.h.

Referenced by accumulate(), getEventPileupInfo(), and StorePileupInformation().

◆ PRDigi

const std::string SiStripDigitizer::PRDigi
private

Definition at line 93 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and SiStripDigitizer().

◆ pSetup

const MagneticField* SiStripDigitizer::pSetup = nullptr
private

Definition at line 123 of file SiStripDigitizer.h.

Referenced by accumulateStripHits(), and initializeEvent().

◆ pSetupToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> SiStripDigitizer::pSetupToken_
private

Definition at line 101 of file SiStripDigitizer.h.

Referenced by initializeEvent().

◆ randomEngine_

CLHEP::HepRandomEngine* SiStripDigitizer::randomEngine_ = nullptr
private

Definition at line 125 of file SiStripDigitizer.h.

Referenced by accumulateStripHits(), finalizeEvent(), and initializeEvent().

◆ SCDigi

const std::string SiStripDigitizer::SCDigi
private

Definition at line 91 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and SiStripDigitizer().

◆ theAffectedAPVvector

std::vector<std::pair<int, std::bitset<6> > > SiStripDigitizer::theAffectedAPVvector
private

Definition at line 126 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and initializeEvent().

◆ theDetIdList

std::map<uint32_t, std::vector<int> > SiStripDigitizer::theDetIdList
private

Definition at line 121 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and initializeEvent().

◆ theDigiAlgo

std::unique_ptr<SiStripDigitizerAlgorithm> SiStripDigitizer::theDigiAlgo
private

◆ thresholdToken_

const edm::ESGetToken<SiStripThreshold, SiStripThresholdRcd> SiStripDigitizer::thresholdToken_
private

Definition at line 104 of file SiStripDigitizer.h.

Referenced by finalizeEvent().

◆ trackerContainers

const vstring SiStripDigitizer::trackerContainers
private

Definition at line 89 of file SiStripDigitizer.h.

Referenced by accumulate(), and SiStripDigitizer().

◆ tTopoToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiStripDigitizer::tTopoToken_
private

Definition at line 99 of file SiStripDigitizer.h.

Referenced by accumulate(), and finalizeEvent().

◆ useConfFromDB

const bool SiStripDigitizer::useConfFromDB
private

Definition at line 94 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), initializeEvent(), and SiStripDigitizer().

◆ VRDigi

const std::string SiStripDigitizer::VRDigi
private

Definition at line 92 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and SiStripDigitizer().

◆ zeroSuppression

const bool SiStripDigitizer::zeroSuppression
private

Definition at line 95 of file SiStripDigitizer.h.

Referenced by finalizeEvent().

◆ ZSDigi

const std::string SiStripDigitizer::ZSDigi
private

Definition at line 90 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and SiStripDigitizer().