51 #include "CLHEP/Random/RandFlat.h" 62 useConfFromDB(conf.getParameter<
bool>(
"TrackerConfigurationFromDB")),
64 makeDigiSimLinks_(conf.getUntrackedParameter<
bool>(
"makeDigiSimLinks",
false)),
65 includeAPVSimulation_(conf.getParameter<
bool>(
"includeAPVSimulation")),
66 fracOfEventsToSimAPV_(conf.getParameter<double>(
"fracOfEventsToSimAPV")),
88 .setBranchAlias(
alias +
"StripAmplitudes");
90 .setBranchAlias(
alias +
"StripAmplitudesPostAPV");
92 .setBranchAlias(
alias +
"StripAPVBaselines");
95 producesCollector.
produces<
bool>(
"SimulatedAPVDynamicGain").setBranchAlias(
alias +
"SimulatedAPVDynamicGain");
96 producesCollector.
produces<std::vector<std::pair<int, std::bitset<6>>>>(
"AffectedAPVList")
97 .setBranchAlias(
alias +
"AffectedAPV");
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.";
109 theDigiAlgo = std::make_unique<SiStripDigitizerAlgorithm>(conf, iC);
117 size_t globalSimHitIndex,
118 const unsigned int tofBin) {
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) {
136 LogDebug(
"Digitizer ") <<
"B-field(T) at " << stripdet->surface().position()
137 <<
"(cm): " <<
pSetup->
inTesla(stripdet->surface().position());
155 if (trackerContainer.find(
std::string(
"HighTof")) != std::string::npos)
182 if (trackerContainer.find(
std::string(
"HighTof")) != std::string::npos)
228 unsigned int detId = iu->geographicalId().rawId();
229 if (iu->type().isTrackerStrip()) {
231 assert(stripdet !=
nullptr);
233 theDigiAlgo->initializeDetUnit(stripdet, deadChannel);
246 std::unique_ptr<bool> simulateAPVInThisEvent = std::make_unique<bool>(
false);
249 *simulateAPVInThisEvent =
true;
253 std::vector<edm::DetSet<SiStripDigi>> theDigiVector;
254 std::vector<edm::DetSet<SiStripRawDigi>> theRawDigiVector;
256 std::unique_ptr<edm::DetSetVector<SiStripRawDigi>> theStripAmplitudeVectorPostAPV(
264 theDigiVector.reserve(10000);
265 theDigiVector.clear();
274 if (sgd !=
nullptr) {
282 unsigned int detID = sgd->geographicalId().rawId();
287 collectorStripAmplitudes,
288 collectorStripAmplitudesPostAPV,
289 collectorStripAPVBaselines,
296 *simulateAPVInThisEvent,
297 apvSimulationParameters,
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);
310 if (!collectorZS.data.empty()) {
311 theDigiVector.push_back(collectorZS);
312 if (!collectorLink.data.empty())
313 pOutputDigiSimLink->insert(collectorLink);
316 if (!collectorRaw.data.empty()) {
317 theRawDigiVector.push_back(collectorRaw);
318 if (!collectorLink.data.empty())
319 pOutputDigiSimLink->insert(collectorLink);
330 std::unique_ptr<std::vector<std::pair<int, std::bitset<6>>>> AffectedAPVList(
338 iEvent.put(
std::move(theStripAmplitudeVectorPostAPV),
"StripAmplitudesPostAPV");
342 iEvent.put(
std::move(simulateAPVInThisEvent),
"SimulatedAPVDynamicGain");
348 std::unique_ptr<edm::DetSetVector<SiStripRawDigi>> output_virginraw(
359 iEvent.put(
std::move(theStripAmplitudeVectorPostAPV),
"StripAmplitudesPostAPV");
362 iEvent.put(
std::move(simulateAPVInThisEvent),
"SimulatedAPVDynamicGain");
const vstring trackerContainers
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
unsigned long long deadChannelCacheID_
Whether or not to create the association to sim truth collection. Set in configuration.
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
const bool zeroSuppression
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
const std::string hitsProducer
edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd > detCablingToken_
void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override
void accumulate(edm::Event const &e, edm::EventSetup const &c) override
std::map< unsigned int, StripGeomDetUnit const * > detectorUnits
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
const MagneticField * pSetup
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
std::map< uint32_t, std::vector< int > > theDetIdList
const edm::ESGetToken< SiStripBadStrip, SiStripBadChannelRcd > deadChannelToken_
edm::ESGetToken< SiStripApvSimulationParameters, SiStripApvSimulationParametersRcd > apvSimulationParametersToken_
CLHEP::HepRandomEngine * randomEngine_
const bool includeAPVSimulation_
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
const TrackerGeometry * pDD
void accumulateStripHits(edm::Handle< std::vector< PSimHit >>, const TrackerTopology *tTopo, size_t globalSimHitIndex, const unsigned int tofBin)
const edm::ESGetToken< SiStripPedestals, SiStripPedestalsRcd > pedestalToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
bool getData(T &iHolder) const
bool isTrackerStrip(GeomDetEnumerators::SubDetector m)
~SiStripDigitizer() override
std::unique_ptr< SiStripDigitizerAlgorithm > theDigiAlgo
std::vector< std::pair< int, std::bitset< 6 > > > theAffectedAPVvector
unsigned long long ddCacheID_
const double fracOfEventsToSimAPV_
const edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noiseToken_
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's in. ...
const edm::ESGetToken< SiStripThreshold, SiStripThresholdRcd > thresholdToken_
const bool makeDigiSimLinks_
SiStripDigitizer(const edm::ParameterSet &conf, edm::ProducesCollector, edm::ConsumesCollector &iC)
const edm::ESGetToken< SiStripGain, SiStripGainSimRcd > gainToken_
std::unique_ptr< PileupMixingContent > PileupInfo_