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")),
87 .setBranchAlias(
alias +
"StripAmplitudes");
89 .setBranchAlias(
alias +
"StripAmplitudesPostAPV");
91 .setBranchAlias(
alias +
"StripAPVBaselines");
94 producesCollector.
produces<
bool>(
"SimulatedAPVDynamicGain").setBranchAlias(
alias +
"SimulatedAPVDynamicGain");
95 producesCollector.
produces<std::vector<std::pair<int, std::bitset<6>>>>(
"AffectedAPVList")
96 .setBranchAlias(
alias +
"AffectedAPV");
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.";
108 theDigiAlgo = std::make_unique<SiStripDigitizerAlgorithm>(conf, iC);
116 size_t globalSimHitIndex,
117 const unsigned int tofBin) {
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) {
135 LogDebug(
"Digitizer ") <<
"B-field(T) at " << stripdet->surface().position()
136 <<
"(cm): " <<
pSetup->
inTesla(stripdet->surface().position());
154 if (trackerContainer.find(
std::string(
"HighTof")) != std::string::npos)
181 if (trackerContainer.find(
std::string(
"HighTof")) != std::string::npos)
223 unsigned int detId = iu->geographicalId().rawId();
224 if (iu->type().isTrackerStrip()) {
226 assert(stripdet !=
nullptr);
242 std::unique_ptr<bool> simulateAPVInThisEvent = std::make_unique<bool>(
false);
245 *simulateAPVInThisEvent =
true;
249 std::vector<edm::DetSet<SiStripDigi>> theDigiVector;
250 std::vector<edm::DetSet<SiStripRawDigi>> theRawDigiVector;
252 std::unique_ptr<edm::DetSetVector<SiStripRawDigi>> theStripAmplitudeVectorPostAPV(
260 theDigiVector.reserve(10000);
261 theDigiVector.clear();
270 if (sgd !=
nullptr) {
278 unsigned int detID = sgd->geographicalId().rawId();
283 collectorStripAmplitudes,
284 collectorStripAmplitudesPostAPV,
285 collectorStripAPVBaselines,
292 *simulateAPVInThisEvent,
293 apvSimulationParameters,
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);
306 if (!collectorZS.data.empty()) {
307 theDigiVector.push_back(collectorZS);
308 if (!collectorLink.data.empty())
309 pOutputDigiSimLink->insert(collectorLink);
312 if (!collectorRaw.data.empty()) {
313 theRawDigiVector.push_back(collectorRaw);
314 if (!collectorLink.data.empty())
315 pOutputDigiSimLink->insert(collectorLink);
326 std::unique_ptr<std::vector<std::pair<int, std::bitset<6>>>> AffectedAPVList(
334 iEvent.put(
std::move(theStripAmplitudeVectorPostAPV),
"StripAmplitudesPostAPV");
338 iEvent.put(
std::move(simulateAPVInThisEvent),
"SimulatedAPVDynamicGain");
344 std::unique_ptr<edm::DetSetVector<SiStripRawDigi>> output_virginraw(
355 iEvent.put(
std::move(theStripAmplitudeVectorPostAPV),
"StripAmplitudesPostAPV");
358 iEvent.put(
std::move(simulateAPVInThisEvent),
"SimulatedAPVDynamicGain");
const vstring trackerContainers
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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
edm::ESGetToken< SiStripApvSimulationParameters, SiStripApvSimulationParametersRcd > apvSimulationParametersToken_
Whether or not to create the association to sim truth collection. Set in configuration.
CLHEP::HepRandomEngine * randomEngine_
const bool includeAPVSimulation_
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
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_