31 #include "CLHEP/Random/RandFlat.h" 119 LogDebug(
"PreMixingSiPixelWorker")<<
"===============> adding MC signals for "<<e.
id();
127 for (; DSViter!=input->end();DSViter++){
130 LogDebug(
"PreMixingSiPixelWorker") <<
"Processing DetID " << DSViter->id;
133 uint32_t detID = DSViter->id;
140 for (icopy=begin; icopy!=
end; icopy++) {
162 const auto&
input = *inputHandle;
166 for (; DSViter!=
input.end();DSViter++){
169 LogDebug(
"PreMixingSiPixelWorker") <<
"Pileups: Processing DetID " << DSViter->id;
172 uint32_t detID = DSViter->id;
179 SiGlobalIndex::const_iterator itest;
188 for (icopy=begin; icopy!=
end; icopy++) {
199 for (icopy=begin; icopy!=
end; icopy++) {
216 std::vector< edm::DetSet<PixelDigi> > vPixelDigi;
223 for(SiGlobalIndex::const_iterator IDet =
SiHitStorage_.begin();
226 uint32_t detID = IDet->first;
234 int formerPixel = -1;
239 OneDetectorMap::const_iterator iLocalchk;
241 for(OneDetectorMap::const_iterator iLocal = LocalMap.begin();
242 iLocal != LocalMap.end(); ++iLocal) {
244 currentPixel = iLocal->first;
246 if (currentPixel == formerPixel) {
247 ADCSum+=(iLocal->second).
adc();
251 if (ADCSum > 511) ADCSum = 255;
252 else if (ADCSum > 253 && ADCSum < 512) ADCSum = 254;
254 Signals.insert( std::make_pair(formerPixel, ADCSum));
257 formerPixel = currentPixel;
258 ADCSum = (iLocal->second).
adc();
262 if((++iLocalchk) == LocalMap.end()) {
263 if (ADCSum > 511) ADCSum = 255;
264 else if (ADCSum > 253 && ADCSum < 512) ADCSum = 254;
265 Signals.insert( std::make_pair(formerPixel, ADCSum));
271 signal.insert( std::make_pair( detID, Signals));
276 edm::LogInfo(
"PreMixingSiPixelWorker") <<
"total # Merged Pixels: " << signal.size() ;
279 std::vector<edm::DetSet<PixelDigi> > theDigiVector;
300 if (PixelFEDChannelCollection_ ==
nullptr) {
301 throw cms::Exception(
"NullPointerError") <<
"PixelFEDChannelCollection not set in chooseScenario function.\n";
307 if (iu->type().isTrackerPixel()) {
316 if(!collector.data.empty()) {
317 theDigiVector.push_back(
std::move(collector));
BranchAliasSetterT< ProductType > produces()
declare what type of product will make and with which optional label
void init(const edm::EventSetup &es)
int bunchCrossing() const
const std::string geometryType_
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void init_DynIneffDB(const edm::EventSetup &, const unsigned int &)
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
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::InputTag pixeldigi_collectionSig_
edm::InputTag pixeldigi_collectionPile_
EventID const & id() const
bool killBadFEDChannels() 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_
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
std::unique_ptr< PixelFEDChannelCollection > chooseScenario(PileupMixingContent *puInfo, CLHEP::HepRandomEngine *)
void addSignals(edm::Event const &e, edm::EventSetup const &es) override
void setSimAccumulator(const std::map< uint32_t, std::map< int, int > > &signalMap)
void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
void calculateInstlumiFactor(PileupMixingContent *puInfo)
std::map< uint32_t, signal_map_type > signalMaps
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
edm::ESHandle< TrackerGeometry > pDD
StreamID streamID() const
std::map< int, Amplitude, std::less< int > > signal_map_type
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
#define DEFINE_PREMIXING_WORKER(TYPE)
T const * product() const
SiGlobalIndex SiHitStorage_
PreMixingSiPixelWorker(const edm::ParameterSet &ps, edm::ProducerBase &producer, edm::ConsumesCollector &&iC)
std::map< uint32_t, OneDetectorMap > SiGlobalIndex