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()) {
225 auto stripdet = dynamic_cast<StripGeomDetUnit const*>(iu);
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();
269 auto sgd = dynamic_cast<StripGeomDetUnit const*>(iu);
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");