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_
 
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...
 
unsigned long long ddCacheID_ = 0
 
unsigned long long deadChannelCacheID_ = 0
 Whether or not to create the association to sim truth collection. Set in configuration. More...
 
const edm::ESGetToken< SiStripBadStrip, SiStripBadChannelRcddeadChannelToken_
 
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 57 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 86 of file SiStripDigitizer.h.

◆ simhit_map_iterator

typedef simhit_map::iterator SiStripDigitizer::simhit_map_iterator
private

Definition at line 87 of file SiStripDigitizer.h.

◆ vstring

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

Definition at line 85 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_, ProducerED_cfi::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()),
75  if (useConfFromDB) {
77  }
80  }
81 
82  const std::string alias("simSiStripDigis");
83 
84  producesCollector.produces<edm::DetSetVector<SiStripDigi>>(ZSDigi).setBranchAlias(ZSDigi);
85  producesCollector.produces<edm::DetSetVector<SiStripRawDigi>>(SCDigi).setBranchAlias(alias + SCDigi);
86  producesCollector.produces<edm::DetSetVector<SiStripRawDigi>>(VRDigi).setBranchAlias(alias + VRDigi);
87  producesCollector.produces<edm::DetSetVector<SiStripRawDigi>>("StripAmplitudes")
88  .setBranchAlias(alias + "StripAmplitudes");
89  producesCollector.produces<edm::DetSetVector<SiStripRawDigi>>("StripAmplitudesPostAPV")
90  .setBranchAlias(alias + "StripAmplitudesPostAPV");
91  producesCollector.produces<edm::DetSetVector<SiStripRawDigi>>("StripAPVBaselines")
92  .setBranchAlias(alias + "StripAPVBaselines");
93  producesCollector.produces<edm::DetSetVector<SiStripRawDigi>>(PRDigi).setBranchAlias(alias + PRDigi);
94  producesCollector.produces<edm::DetSetVector<StripDigiSimLink>>().setBranchAlias(alias + "siStripDigiSimLink");
95  producesCollector.produces<bool>("SimulatedAPVDynamicGain").setBranchAlias(alias + "SimulatedAPVDynamicGain");
96  producesCollector.produces<std::vector<std::pair<int, std::bitset<6>>>>("AffectedAPVList")
97  .setBranchAlias(alias + "AffectedAPV");
98  for (auto const& trackerContainer : trackerContainers) {
99  edm::InputTag tag(hitsProducer, trackerContainer);
100  iC.consumes<std::vector<PSimHit>>(edm::InputTag(hitsProducer, trackerContainer));
101  }
103  if (!rng.isAvailable()) {
104  throw cms::Exception("Configuration")
105  << "SiStripDigitizer requires the RandomNumberGeneratorService\n"
106  "which is not present in the configuration file. You must add the service\n"
107  "in the configuration file or remove the modules that require it.";
108  }
109  theDigiAlgo = std::make_unique<SiStripDigitizerAlgorithm>(conf, iC);
110 }
const vstring trackerContainers
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const std::string ZSDigi
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
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
const edm::ESGetToken< SiStripBadStrip, SiStripBadChannelRcd > deadChannelToken_
T getUntrackedParameter(std::string const &, T const &) const
edm::ESGetToken< SiStripApvSimulationParameters, SiStripApvSimulationParametersRcd > apvSimulationParametersToken_
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 113 of file SiStripDigitizer.cc.

113 {}

Member Function Documentation

◆ accumulate() [1/2]

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

Implements DigiAccumulatorMixMod.

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

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

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

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

Referenced by accumulate().

118  {
119  // globalSimHitIndex is the index the sim hit will have when it is put in a collection
120  // of sim hits for all crossings. This is only used when creating digi-sim links if
121  // configured to do so.
122 
123  if (hSimHits.isValid()) {
124  std::set<unsigned int> detIds;
125  std::vector<PSimHit> const& simHits = *hSimHits.product();
126  for (std::vector<PSimHit>::const_iterator it = simHits.begin(), itEnd = simHits.end(); it != itEnd;
127  ++it, ++globalSimHitIndex) {
128  unsigned int detId = (*it).detUnitId();
129  if (detIds.insert(detId).second) {
130  // The insert succeeded, so this detector element has not yet been processed.
132  if (detectorUnits[detId]->type().isTrackerStrip()) { // this test can be removed and replaced by stripdet!=0
133  auto stripdet = detectorUnits[detId];
134  //access to magnetic field in global coordinates
135  GlobalVector bfield = pSetup->inTesla(stripdet->surface().position());
136  LogDebug("Digitizer ") << "B-field(T) at " << stripdet->surface().position()
137  << "(cm): " << pSetup->inTesla(stripdet->surface().position());
138  theDigiAlgo->accumulateSimHits(it, itEnd, globalSimHitIndex, tofBin, stripdet, bfield, tTopo, randomEngine_);
139  }
140  }
141  } // end of loop over sim hits
142  }
143 }
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 239 of file SiStripDigitizer.cc.

References apvSimulationParametersToken_, runTheMatrix::const, hcalRecHitTable_cff::detId, 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, DiMuonV_cfg::threshold, thresholdToken_, tTopoToken_, useConfFromDB, trackerHitRTTI::vector, VRDigi, zeroSuppression, and ZSDigi.

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

References PileupInfo_.

77 { 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 196 of file SiStripDigitizer.cc.

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

196  {
197  // Make sure that the first crossing processed starts indexing the sim hits from zero.
198  // This variable is used so that the sim hits from all crossing frames have sequential
199  // indices used to create the digi-sim link (if configured to do so) rather than starting
200  // from zero for each crossing.
202  theAffectedAPVvector.clear();
203  // Step A: Get Inputs
204 
205  if (useConfFromDB) {
206  iSetup.getData(detCablingToken_).addConnected(theDetIdList);
207  }
208 
209  // Cache random number engine
211  randomEngine_ = &rng->getEngine(iEvent.streamID());
212 
213  theDigiAlgo->initializeEvent(iSetup);
214 
215  pDD = &iSetup.getData(pDDToken_);
216  pSetup = &iSetup.getData(pSetupToken_);
217 
218  // We only need to clear and (re)fill detectorUnits when the geometry type IOV changes.
219  auto ddCache = iSetup.get<TrackerDigiGeometryRecord>().cacheIdentifier();
220  auto deadChannelCache = iSetup.get<SiStripBadChannelRcd>().cacheIdentifier();
221  if (ddCache != ddCacheID_ or deadChannelCache != deadChannelCacheID_) {
222  ddCacheID_ = ddCache;
223  deadChannelCacheID_ = deadChannelCache;
224  detectorUnits.clear();
225 
226  auto const& deadChannel = iSetup.getData(deadChannelToken_);
227  for (const auto& iu : pDD->detUnits()) {
228  unsigned int detId = iu->geographicalId().rawId();
229  if (iu->type().isTrackerStrip()) {
230  auto stripdet = dynamic_cast<StripGeomDetUnit const*>(iu);
231  assert(stripdet != nullptr);
232  detectorUnits.insert(std::make_pair(detId, stripdet));
233  theDigiAlgo->initializeDetUnit(stripdet, deadChannel);
234  }
235  }
236  }
237 }
unsigned long long deadChannelCacheID_
Whether or not to create the association to sim truth collection. Set in configuration.
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
const edm::ESGetToken< SiStripBadStrip, SiStripBadChannelRcd > deadChannelToken_
CLHEP::HepRandomEngine * randomEngine_
int iEvent
Definition: GenABIO.cc:224
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
const TrackerGeometry * pDD
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
std::unique_ptr< SiStripDigitizerAlgorithm > theDigiAlgo
std::vector< std::pair< int, std::bitset< 6 > > > theAffectedAPVvector
unsigned long long ddCacheID_
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 68 of file SiStripDigitizer.h.

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

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

Member Data Documentation

◆ apvSimulationParametersToken_

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

Definition at line 109 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 123 of file SiStripDigitizer.h.

Referenced by accumulate(), and initializeEvent().

◆ ddCacheID_

unsigned long long SiStripDigitizer::ddCacheID_ = 0
private

Definition at line 111 of file SiStripDigitizer.h.

Referenced by initializeEvent().

◆ deadChannelCacheID_

unsigned long long SiStripDigitizer::deadChannelCacheID_ = 0
private

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

Definition at line 112 of file SiStripDigitizer.h.

Referenced by initializeEvent().

◆ deadChannelToken_

const edm::ESGetToken<SiStripBadStrip, SiStripBadChannelRcd> SiStripDigitizer::deadChannelToken_
private

Definition at line 107 of file SiStripDigitizer.h.

Referenced by initializeEvent().

◆ detCablingToken_

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

Definition at line 108 of file SiStripDigitizer.h.

Referenced by initializeEvent(), and SiStripDigitizer().

◆ detectorUnits

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

Definition at line 129 of file SiStripDigitizer.h.

Referenced by accumulateStripHits(), and initializeEvent().

◆ fracOfEventsToSimAPV_

const double SiStripDigitizer::fracOfEventsToSimAPV_
private

Definition at line 99 of file SiStripDigitizer.h.

Referenced by finalizeEvent().

◆ gainToken_

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

Definition at line 103 of file SiStripDigitizer.h.

Referenced by finalizeEvent().

◆ hitsProducer

const std::string SiStripDigitizer::hitsProducer
private

Definition at line 89 of file SiStripDigitizer.h.

Referenced by accumulate(), and SiStripDigitizer().

◆ includeAPVSimulation_

const bool SiStripDigitizer::includeAPVSimulation_
private

Definition at line 98 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and SiStripDigitizer().

◆ makeDigiSimLinks_

const bool SiStripDigitizer::makeDigiSimLinks_
private

Definition at line 97 of file SiStripDigitizer.h.

Referenced by finalizeEvent().

◆ noiseToken_

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

Definition at line 104 of file SiStripDigitizer.h.

Referenced by finalizeEvent().

◆ pDD

const TrackerGeometry* SiStripDigitizer::pDD = nullptr
private

Definition at line 127 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and initializeEvent().

◆ pDDToken_

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

Definition at line 101 of file SiStripDigitizer.h.

Referenced by initializeEvent().

◆ pedestalToken_

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

Definition at line 106 of file SiStripDigitizer.h.

Referenced by finalizeEvent().

◆ PileupInfo_

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

Definition at line 133 of file SiStripDigitizer.h.

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

◆ PRDigi

const std::string SiStripDigitizer::PRDigi
private

Definition at line 94 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and SiStripDigitizer().

◆ pSetup

const MagneticField* SiStripDigitizer::pSetup = nullptr
private

Definition at line 128 of file SiStripDigitizer.h.

Referenced by accumulateStripHits(), and initializeEvent().

◆ pSetupToken_

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

Definition at line 102 of file SiStripDigitizer.h.

Referenced by initializeEvent().

◆ randomEngine_

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

Definition at line 130 of file SiStripDigitizer.h.

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

◆ SCDigi

const std::string SiStripDigitizer::SCDigi
private

Definition at line 92 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and SiStripDigitizer().

◆ theAffectedAPVvector

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

Definition at line 131 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and initializeEvent().

◆ theDetIdList

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

Definition at line 126 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 105 of file SiStripDigitizer.h.

Referenced by finalizeEvent().

◆ trackerContainers

const vstring SiStripDigitizer::trackerContainers
private

Definition at line 90 of file SiStripDigitizer.h.

Referenced by accumulate(), and SiStripDigitizer().

◆ tTopoToken_

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

Definition at line 100 of file SiStripDigitizer.h.

Referenced by accumulate(), and finalizeEvent().

◆ useConfFromDB

const bool SiStripDigitizer::useConfFromDB
private

Definition at line 95 of file SiStripDigitizer.h.

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

◆ VRDigi

const std::string SiStripDigitizer::VRDigi
private

Definition at line 93 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and SiStripDigitizer().

◆ zeroSuppression

const bool SiStripDigitizer::zeroSuppression
private

Definition at line 96 of file SiStripDigitizer.h.

Referenced by finalizeEvent().

◆ ZSDigi

const std::string SiStripDigitizer::ZSDigi
private

Definition at line 91 of file SiStripDigitizer.h.

Referenced by finalizeEvent(), and SiStripDigitizer().