57 #include "CLHEP/Random/RandFlat.h"
62 : gainLabel(conf.getParameter<
std::
string>(
"Gain")),
64 trackerContainers(conf.getParameter<
std::vector<
std::
string>>(
"ROUList")),
70 useConfFromDB(conf.getParameter<
bool>(
"TrackerConfigurationFromDB")),
72 makeDigiSimLinks_(conf.getUntrackedParameter<
bool>(
"makeDigiSimLinks",
false)),
73 includeAPVSimulation_(conf.getParameter<
bool>(
"includeAPVSimulation")),
74 fracOfEventsToSimAPV_(conf.getParameter<double>(
"fracOfEventsToSimAPV")) {
81 .setBranchAlias(
alias +
"StripAmplitudes");
83 .setBranchAlias(
alias +
"StripAmplitudesPostAPV");
85 .setBranchAlias(
alias +
"StripAPVBaselines");
88 producesCollector.
produces<
bool>(
"SimulatedAPVDynamicGain").setBranchAlias(
alias +
"SimulatedAPVDynamicGain");
89 producesCollector.
produces<std::vector<std::pair<int, std::bitset<6>>>>(
"AffectedAPVList")
90 .setBranchAlias(
alias +
"AffectedAPV");
98 <<
"SiStripDigitizer requires the RandomNumberGeneratorService\n"
99 "which is not present in the configuration file. You must add the service\n"
100 "in the configuration file or remove the modules that require it.";
110 size_t globalSimHitIndex,
111 const unsigned int tofBin) {
116 if (hSimHits.isValid()) {
117 std::set<unsigned int> detIds;
118 std::vector<PSimHit>
const&
simHits = *hSimHits.product();
119 for (std::vector<PSimHit>::const_iterator it =
simHits.begin(), itEnd =
simHits.end(); it != itEnd;
120 ++it, ++globalSimHitIndex) {
121 unsigned int detId = (*it).detUnitId();
122 if (detIds.insert(detId).second) {
129 LogDebug(
"Digitizer ") <<
"B-field(T) at " << stripdet->surface().position()
130 <<
"(cm): " <<
pSetup->
inTesla(stripdet->surface().position());
150 if (trackerContainer.find(
std::string(
"HighTof")) != std::string::npos)
179 if (trackerContainer.find(
std::string(
"HighTof")) != std::string::npos)
223 unsigned int detId = iu->geographicalId().rawId();
224 if (iu->type().isTrackerStrip()) {
225 auto stripdet = dynamic_cast<StripGeomDetUnit const*>(iu);
226 assert(stripdet !=
nullptr);
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(
266 theDigiVector.reserve(10000);
267 theDigiVector.clear();
275 auto sgd = dynamic_cast<StripGeomDetUnit const*>(iu);
276 if (sgd !=
nullptr) {
284 unsigned int detID = sgd->geographicalId().rawId();
289 collectorStripAmplitudes,
290 collectorStripAmplitudesPostAPV,
291 collectorStripAPVBaselines,
298 *simulateAPVInThisEvent,
299 apvSimulationParametersHandle,
304 if (!collectorStripAmplitudes.data.empty())
305 theStripAmplitudeVector->insert(collectorStripAmplitudes);
306 if (!collectorStripAmplitudesPostAPV.data.empty())
307 theStripAmplitudeVectorPostAPV->insert(collectorStripAmplitudesPostAPV);
308 if (!collectorStripAPVBaselines.data.empty())
309 theStripAPVBaselines->insert(collectorStripAPVBaselines);
312 if (!collectorZS.data.empty()) {
313 theDigiVector.push_back(collectorZS);
314 if (!collectorLink.data.empty())
315 pOutputDigiSimLink->insert(collectorLink);
318 if (!collectorRaw.data.empty()) {
319 theRawDigiVector.push_back(collectorRaw);
320 if (!collectorLink.data.empty())
321 pOutputDigiSimLink->insert(collectorLink);
332 std::unique_ptr<std::vector<std::pair<int, std::bitset<6>>>> AffectedAPVList(
340 iEvent.put(
std::move(theStripAmplitudeVectorPostAPV),
"StripAmplitudesPostAPV");
344 iEvent.put(
std::move(simulateAPVInThisEvent),
"SimulatedAPVDynamicGain");
350 std::unique_ptr<edm::DetSetVector<SiStripRawDigi>> output_virginraw(
361 iEvent.put(
std::move(theStripAmplitudeVectorPostAPV),
"StripAmplitudesPostAPV");
364 iEvent.put(
std::move(simulateAPVInThisEvent),
"SimulatedAPVDynamicGain");