31 #include "CLHEP/Random/RandFlat.h"
70 typedef std::multimap<int, PixelDigi>
86 : digitizer_(ps), geometryType_(ps.getParameter<
std::
string>(
"PixGeometryType")) {
117 LogDebug(
"PreMixingSiPixelWorker") <<
"===============> adding MC signals for " <<
e.id();
124 for (; DSViter !=
input->end(); DSViter++) {
126 LogDebug(
"PreMixingSiPixelWorker") <<
"Processing DetID " << DSViter->id;
129 uint32_t detID = DSViter->id;
136 for (icopy = begin; icopy !=
end; icopy++) {
146 LogDebug(
"PreMixingSiPixelWorker") <<
"\n===============> adding pileups from event " << pep.
principal().
id()
155 const auto&
input = *inputHandle;
159 for (; DSViter !=
input.end(); DSViter++) {
161 LogDebug(
"PreMixingSiPixelWorker") <<
"Pileups: Processing DetID " << DSViter->id;
164 uint32_t detID = DSViter->id;
171 SiGlobalIndex::const_iterator itest;
180 for (icopy = begin; icopy !=
end; icopy++) {
190 for (icopy = begin; icopy !=
end; icopy++) {
202 std::vector<PileupSummaryInfo>
const& ps,
206 std::vector<edm::DetSet<PixelDigi>> vPixelDigi;
214 uint32_t detID = IDet->first;
222 int formerPixel = -1;
226 OneDetectorMap::const_iterator iLocalchk;
228 for (OneDetectorMap::const_iterator iLocal = LocalMap.begin(); iLocal != LocalMap.end(); ++iLocal) {
229 currentPixel = iLocal->first;
231 if (currentPixel == formerPixel) {
232 ADCSum += (iLocal->second).
adc();
234 if (formerPixel != -1) {
237 else if (ADCSum > 253 && ADCSum < 512)
240 Signals.insert(std::make_pair(formerPixel, ADCSum));
243 formerPixel = currentPixel;
244 ADCSum = (iLocal->second).
adc();
248 if ((++iLocalchk) == LocalMap.end()) {
251 else if (ADCSum > 253 && ADCSum < 512)
253 Signals.insert(std::make_pair(formerPixel, ADCSum));
259 signal.insert(std::make_pair(detID, Signals));
264 edm::LogInfo(
"PreMixingSiPixelWorker") <<
"total # Merged Pixels: " << signal.size();
266 std::vector<edm::DetSet<PixelDigi>> theDigiVector;
278 CLHEP::HepRandomEngine* engine = &rng->
getEngine(
e.streamID());
286 if (PixelFEDChannelCollection_ ==
nullptr) {
287 throw cms::Exception(
"NullPointerError") <<
"PixelFEDChannelCollection not set in chooseScenario function.\n";
293 if (iu->type().isTrackerPixel()) {
296 iu->geographicalId().rawId());
298 digitizer_.
digitize(dynamic_cast<const PixelGeomDetUnit*>(iu), collector.data, linkcollector.data, tTopo, engine);
299 if (!collector.data.empty()) {
300 theDigiVector.push_back(
std::move(collector));