30 #include "CLHEP/Random/RandFlat.h" 69 typedef std::multimap<int, PixelDigi>
115 LogDebug(
"PreMixingSiPixelWorker") <<
"===============> adding MC signals for " <<
e.id();
122 for (; DSViter !=
input->end(); DSViter++) {
124 LogDebug(
"PreMixingSiPixelWorker") <<
"Processing DetID " << DSViter->id;
127 uint32_t detID = DSViter->id;
134 for (icopy = begin; icopy !=
end; icopy++) {
144 LogDebug(
"PreMixingSiPixelWorker") <<
"\n===============> adding pileups from event " << pep.
principal().
id()
153 const auto&
input = *inputHandle;
157 for (; DSViter !=
input.end(); DSViter++) {
159 LogDebug(
"PreMixingSiPixelWorker") <<
"Pileups: Processing DetID " << DSViter->id;
162 uint32_t detID = DSViter->id;
169 SiGlobalIndex::const_iterator itest;
178 for (icopy = begin; icopy !=
end; icopy++) {
188 for (icopy = begin; icopy !=
end; icopy++) {
200 std::vector<PileupSummaryInfo>
const& ps,
204 std::vector<edm::DetSet<PixelDigi>> vPixelDigi;
212 uint32_t detID = IDet->first;
220 int formerPixel = -1;
224 OneDetectorMap::const_iterator iLocalchk;
226 for (OneDetectorMap::const_iterator iLocal = LocalMap.begin(); iLocal != LocalMap.end(); ++iLocal) {
227 currentPixel = iLocal->first;
229 if (currentPixel == formerPixel) {
230 ADCSum += (iLocal->second).
adc();
232 if (formerPixel != -1) {
235 else if (ADCSum > 253 && ADCSum < 512)
238 Signals.insert(std::make_pair(formerPixel, ADCSum));
241 formerPixel = currentPixel;
242 ADCSum = (iLocal->second).
adc();
246 if ((++iLocalchk) == LocalMap.end()) {
249 else if (ADCSum > 253 && ADCSum < 512)
251 Signals.insert(std::make_pair(formerPixel, ADCSum));
257 signal.insert(std::make_pair(detID, Signals));
262 edm::LogInfo(
"PreMixingSiPixelWorker") <<
"total # Merged Pixels: " << signal.size();
264 std::vector<edm::DetSet<PixelDigi>> theDigiVector;
276 CLHEP::HepRandomEngine* engine = &rng->
getEngine(
e.streamID());
283 if (PixelFEDChannelCollection_ ==
nullptr) {
284 throw cms::Exception(
"NullPointerError") <<
"PixelFEDChannelCollection not set in chooseScenario function.\n";
289 for (
const auto& iu : pDD.detUnits()) {
290 if (iu->type().isTrackerPixel()) {
293 iu->geographicalId().rawId());
295 digitizer_.
digitize(dynamic_cast<const PixelGeomDetUnit*>(iu), collector.data, linkcollector.data, tTopo, engine);
296 if (!collector.data.empty()) {
297 theDigiVector.push_back(
std::move(collector));
void init(const edm::EventSetup &es)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
T getParameter(std::string const &) const
void put(edm::Event &e, edm::EventSetup const &iSetup, std::vector< PileupSummaryInfo > const &ps, int bs) override
std::multimap< int, PixelDigi > OneDetectorMap
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > PixelDigiPToken_
void addPileups(PileUpEventPrincipal const &, edm::EventSetup const &es) override
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
edm::InputTag pixeldigi_collectionSig_
edm::InputTag pixeldigi_collectionPile_
PreMixingSiPixelWorker(const edm::ParameterSet &ps, edm::ProducesCollector, edm::ConsumesCollector &&iC)
int bunchCrossing() const
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
bool firstInitializeEvent_
static std::string const input
edm::EventPrincipal const & principal()
Container::value_type value_type
~PreMixingSiPixelWorker() override=default
edm::EDGetTokenT< edm::DetSetVector< PixelDigi > > PixelDigiToken_
SiPixelDigitizerAlgorithm digitizer_
void digitize(const PixelGeomDetUnit *pixdet, std::vector< PixelDigi > &digis, std::vector< PixelDigiSimLink > &simlinks, const TrackerTopology *tTopo, CLHEP::HepRandomEngine *)
std::string PixelDigiCollectionDM_
bool getData(T &iHolder) const
void init_DynIneffDB(const edm::EventSetup &)
std::unique_ptr< PixelFEDChannelCollection > chooseScenario(PileupMixingContent *puInfo, CLHEP::HepRandomEngine *)
void addSignals(edm::Event const &e, edm::EventSetup const &es) override
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pDDToken_
void setSimAccumulator(const std::map< uint32_t, std::map< int, int > > &signalMap)
Log< level::Info, false > LogInfo
void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
void calculateInstlumiFactor(PileupMixingContent *puInfo)
std::map< uint32_t, signal_map_type > signalMaps
std::map< int, Amplitude, std::less< int > > signal_map_type
bool killBadFEDChannels() const
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
EventID const & id() const
#define DEFINE_PREMIXING_WORKER(TYPE)
SiGlobalIndex SiHitStorage_
uint16_t *__restrict__ uint16_t const *__restrict__ adc
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
std::map< uint32_t, OneDetectorMap > SiGlobalIndex