61 #include "CLHEP/Random/RandomEngine.h"
81 template <
typename T,
typename C = MuonDigiCollection<CSCDetId, T>>
84 CLHEP::HepRandomEngine &randGen,
85 std::unique_ptr<C> &filteredDigis);
87 template <
typename T,
typename C = MuonDigiCollection<CSCDetId, T>>
98 std::map<CSCDetId, std::pair<unsigned int, float>>
m_CSCEffs;
119 produces<CSCStripDigiCollection>(
"MuonCSCStripDigi");
120 produces<CSCWireDigiCollection>(
"MuonCSCWireDigi");
121 produces<CSCCLCTDigiCollection>(
"MuonCSCCLCTDigi");
122 produces<CSCALCTDigiCollection>(
"MuonCSCALCTDigi");
149 event.put(
std::move(filteredStripDigis),
"MuonCSCStripDigi");
150 event.put(
std::move(filteredWireDigis),
"MuonCSCWireDigi");
151 event.put(
std::move(filteredCLCTDigis),
"MuonCSCCLCTDigi");
152 event.put(
std::move(filteredALCTDigis),
"MuonCSCALCTDigi");
156 template <
typename T,
typename C>
160 event.getByToken(digiToken, digis);
161 for (
const auto &
j : (*digis)) {
162 auto digiItr =
j.second.first;
163 auto last =
j.second.second;
167 for (; digiItr !=
last; ++digiItr) {
168 filteredDigis->insertDigi(cscDetId, *digiItr);
175 template <
typename T,
typename C>
178 CLHEP::HepRandomEngine &randGen,
179 std::unique_ptr<C> &filteredDigis) {
182 event.getByToken(digiToken, digis);
184 for (
const auto &
j : (*digis)) {
185 auto digiItr =
j.second.first;
186 auto last =
j.second.second;
193 for (; digiItr !=
last; ++digiItr) {
197 std::pair<unsigned int, float> typeEff = chEffIt->second;
198 int type = typeEff.first % 10;
199 int layer = typeEff.first / 10;
201 bool doRandomize =
false;
207 if (!doRandomize || (randGen.flat() <= typeEff.second)) {
208 filteredDigis->insertDigi(cscDetId, *digiItr);
224 const auto chambers = cscGeom->chambers();
231 for (
auto &agingPair : agingObj->m_CSCChambEffs) {
232 if (agingPair.first != rawId)
235 type = agingPair.second.first;
236 eff = agingPair.second.second;
237 m_CSCEffs[chId] = std::make_pair(type, eff);
253 descriptions.
add(
"cscChamberMasker", desc);
void copyDigis(edm::Event &event, edm::EDGetTokenT< C > &digiToken, std::unique_ptr< C > &filteredDigis)
void ageDigis(edm::Event &event, edm::EDGetTokenT< C > &digiToken, CLHEP::HepRandomEngine &randGen, std::unique_ptr< C > &filteredDigis)
edm::EDGetTokenT< CSCWireDigiCollection > m_wireDigiToken
#define DEFINE_FWK_MODULE(type)
static int rawIdMaker(int iendcap, int istation, int iring, int ichamber, int ilayer)
constexpr bool isUninitialized() const noexcept
MuonDigiCollection< CSCDetId, CSCStripDigi > CSCStripDigiCollection
edm::EDGetTokenT< CSCStripDigiCollection > m_stripDigiToken
MuonDigiCollection< CSCDetId, CSCCLCTDigi > CSCCLCTDigiCollection
edm::EDGetTokenT< CSCCLCTDigiCollection > m_clctDigiToken
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > m_cscGeomToken
edm::ESGetToken< MuonSystemAging, MuonSystemAgingRcd > m_agingObjToken
constexpr std::array< uint8_t, layerIndexSize > layer
std::map< CSCDetId, std::pair< unsigned int, float > > m_CSCEffs
~CSCChamberMasker() override
void beginRun(edm::Run const &, edm::EventSetup const &) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void produce(edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< CSCALCTDigiCollection > m_alctDigiToken
MuonDigiCollection< CSCDetId, CSCWireDigi > CSCWireDigiCollection
CSCChamberMasker(const edm::ParameterSet &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
StreamID streamID() const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
static char chambers[264][20]
static void fillDescriptions(edm::ConfigurationDescriptions &)
MuonDigiCollection< CSCDetId, CSCALCTDigi > CSCALCTDigiCollection