CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
RPCChamberMasker Class Reference

#include <SimMuon/RPCDigitizer/plugins/RPCChamberMasker.cc>

Inheritance diagram for RPCChamberMasker:
edm::stream::EDProducer<>

Public Member Functions

 RPCChamberMasker (const edm::ParameterSet &)
 
 ~RPCChamberMasker () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::ESGetToken
< MuonSystemAging,
MuonSystemAgingRcd
agingObjToken_
 
edm::InputTag digiTag_
 
std::map< RPCDetId, float > m_ChEffs
 
edm::EDGetTokenT
< RPCDigiCollection
m_digiTag
 
edm::ESGetToken< RPCGeometry,
MuonGeometryRecord
rpcGeomToken_
 
bool theRE31_off
 
bool theRE41_off
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description:

Implementation: Class to mask RPC digis on a for single DetIds

Definition at line 52 of file RPCChamberMasker.cc.

Constructor & Destructor Documentation

RPCChamberMasker::RPCChamberMasker ( const edm::ParameterSet iConfig)
explicit

Definition at line 87 of file RPCChamberMasker.cc.

References agingObjToken_, digiTag_, DeDxTools::esConsumes(), edm::ParameterSet::getParameter(), m_digiTag, rpcGeomToken_, theRE31_off, and theRE41_off.

88  : digiTag_(iConfig.getParameter<edm::InputTag>("digiTag")) {
89  m_digiTag = consumes<RPCDigiCollection>(digiTag_);
90  produces<RPCDigiCollection>();
91 
92  theRE31_off = iConfig.getParameter<bool>("descopeRE31");
93  theRE41_off = iConfig.getParameter<bool>("descopeRE41");
96 }
edm::InputTag digiTag_
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeomToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< RPCDigiCollection > m_digiTag
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::ESGetToken< MuonSystemAging, MuonSystemAgingRcd > agingObjToken_
RPCChamberMasker::~RPCChamberMasker ( )
override

Definition at line 98 of file RPCChamberMasker.cc.

98 {}

Member Function Documentation

void RPCChamberMasker::beginRun ( edm::Run const &  run,
edm::EventSetup const &  iSetup 
)
overrideprivate

Definition at line 127 of file RPCChamberMasker.cc.

References agingObjToken_, edm::EventSetup::getHandle(), m_ChEffs, DetId::rawId(), rpcGeomToken_, RPCDetId::station(), theRE31_off, and theRE41_off.

127  {
128  m_ChEffs.clear();
129 
130  auto rpcGeom = iSetup.getHandle(rpcGeomToken_);
131  auto agingObj = iSetup.getHandle(agingObjToken_);
132 
133  const auto rolls = rpcGeom->rolls();
134 
135  for (const auto* roll : rolls) {
136  RPCDetId rollId = roll->id();
137  uint32_t rollRawId = rollId.rawId();
138 
139  Float_t chamberEff = 1.;
140  for (const auto& agingPair : agingObj->m_RPCChambEffs) {
141  if (agingPair.first == rollRawId) {
142  chamberEff = agingPair.second;
143  break;
144  }
145 
146  if (theRE31_off && (roll->isIRPC() && (rollId.station() == 3))) {
147  chamberEff = 0;
148  }
149  if (theRE41_off && (roll->isIRPC() && (rollId.station() == 4))) {
150  chamberEff = 0;
151  }
152  }
153  m_ChEffs[rollId] = chamberEff;
154  }
155 }
std::map< RPCDetId, float > m_ChEffs
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeomToken_
edm::ESGetToken< MuonSystemAging, MuonSystemAgingRcd > agingObjToken_
int station() const
Definition: RPCDetId.h:78
void RPCChamberMasker::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivate

Definition at line 159 of file RPCChamberMasker.cc.

159 {}
void RPCChamberMasker::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 162 of file RPCChamberMasker.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

162  {
164  desc.add<edm::InputTag>("digiTag", edm::InputTag("preRPCDigis"));
165  desc.add<bool>("descopeRE31", false);
166  desc.add<bool>("descopeRE41", false);
167  descriptions.add("rpcChamberMasker", desc);
168 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void RPCChamberMasker::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 105 of file RPCChamberMasker.cc.

References digiTag_, edm::Event::getByToken(), edm::RandomNumberGenerator::getEngine(), edm::InputTag::label(), m_ChEffs, m_digiTag, eostools::move(), edm::Event::put(), and edm::Event::streamID().

105  {
106  using namespace edm;
108  CLHEP::HepRandomEngine& randGen = randGenService->getEngine(iEvent.streamID());
109 
110  std::unique_ptr<RPCDigiCollection> filteredDigis(new RPCDigiCollection());
111  if (!digiTag_.label().empty()) {
113  iEvent.getByToken(m_digiTag, rpcDigis);
114 
115  for (const auto& rpcLayerId : (*rpcDigis)) {
116  int id = (rpcLayerId.first).rawId();
117  auto chEffIt = m_ChEffs.find(id);
118  if ((chEffIt != m_ChEffs.end()) && (randGen.flat() <= chEffIt->second))
119  filteredDigis->put(rpcLayerId.second, rpcLayerId.first);
120  }
121  }
122  iEvent.put(std::move(filteredDigis));
123 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::map< RPCDetId, float > m_ChEffs
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
edm::InputTag digiTag_
MuonDigiCollection< RPCDetId, RPCDigi > RPCDigiCollection
def move
Definition: eostools.py:511
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< RPCDigiCollection > m_digiTag
StreamID streamID() const
Definition: Event.h:98

Member Data Documentation

edm::ESGetToken<MuonSystemAging, MuonSystemAgingRcd> RPCChamberMasker::agingObjToken_
private

Definition at line 73 of file RPCChamberMasker.cc.

Referenced by beginRun(), and RPCChamberMasker().

edm::InputTag RPCChamberMasker::digiTag_
private

Definition at line 66 of file RPCChamberMasker.cc.

Referenced by produce(), and RPCChamberMasker().

std::map<RPCDetId, float> RPCChamberMasker::m_ChEffs
private

Definition at line 68 of file RPCChamberMasker.cc.

Referenced by beginRun(), and produce().

edm::EDGetTokenT<RPCDigiCollection> RPCChamberMasker::m_digiTag
private

Definition at line 67 of file RPCChamberMasker.cc.

Referenced by produce(), and RPCChamberMasker().

edm::ESGetToken<RPCGeometry, MuonGeometryRecord> RPCChamberMasker::rpcGeomToken_
private

Definition at line 72 of file RPCChamberMasker.cc.

Referenced by beginRun(), and RPCChamberMasker().

bool RPCChamberMasker::theRE31_off
private

Definition at line 69 of file RPCChamberMasker.cc.

Referenced by beginRun(), and RPCChamberMasker().

bool RPCChamberMasker::theRE41_off
private

Definition at line 70 of file RPCChamberMasker.cc.

Referenced by beginRun(), and RPCChamberMasker().