CMS 3D CMS Logo

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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 RPCChamberMasker (const edm::ParameterSet &)
 
 ~RPCChamberMasker ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

edm::InputTag digiTag_
 
std::map< RPCDetId, float > m_ChEffs
 
edm::EDGetTokenT< RPCDigiCollectionm_digiTag
 
bool theRE31_off
 
bool theRE41_off
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description:

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

Definition at line 53 of file RPCChamberMasker.cc.

Constructor & Destructor Documentation

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

Definition at line 88 of file RPCChamberMasker.cc.

References digiTag_, edm::ParameterSet::getParameter(), m_digiTag, theRE31_off, and theRE41_off.

88  :
89  digiTag_(iConfig.getParameter<edm::InputTag>("digiTag") )
90 {
91 
92  m_digiTag = consumes<RPCDigiCollection>(digiTag_);
93  produces<RPCDigiCollection>();
94 
95  theRE31_off = iConfig.getParameter<bool>("descopeRE31");
96  theRE41_off =iConfig.getParameter<bool>("descopeRE41");
97 
98 }
T getParameter(std::string const &) const
edm::InputTag digiTag_
edm::EDGetTokenT< RPCDigiCollection > m_digiTag
RPCChamberMasker::~RPCChamberMasker ( )

Definition at line 101 of file RPCChamberMasker.cc.

102 {
103 
104 }

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 142 of file RPCChamberMasker.cc.

References edm::EventSetup::get(), m_ChEffs, MuonSystemAging::m_RPCChambEffs, DetId::rawId(), RPCGeometry::rolls(), RPCDetId::station(), theRE31_off, and theRE41_off.

143 {
144 
145  m_ChEffs.clear();
146 
148  iSetup.get<MuonGeometryRecord>().get(rpcGeom);
149 
151  iSetup.get<MuonSystemAgingRcd>().get(agingObj);
152 
153  const auto rolls = rpcGeom->rolls();
154 
155  for ( const auto * roll : rolls)
156  {
157  RPCDetId rollId = roll->id();
158  uint32_t rollRawId = rollId.rawId();
159 
160  Float_t chamberEff = 1.;
161  for ( const auto & agingPair : agingObj->m_RPCChambEffs)
162  {
163 
164  if ( agingPair.first == rollRawId)
165  {
166  chamberEff = agingPair.second;
167  break;
168  }
169 
170  if(theRE31_off && ( roll->isIRPC() && (rollId.station()==3) ) ){
171  chamberEff = 0;
172  }
173  if(theRE41_off && ( roll->isIRPC() && (rollId.station()==4) ) ){
174  chamberEff = 0;
175  }
176  }
177  m_ChEffs[rollId] = chamberEff;
178  }
179 
180 }
std::map< RPCDetId, float > m_ChEffs
const std::vector< const RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
Definition: RPCGeometry.cc:67
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
std::map< unsigned int, float > m_RPCChambEffs
int station() const
Definition: RPCDetId.h:96
void RPCChamberMasker::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 186 of file RPCChamberMasker.cc.

187 {
188 
189 }
void RPCChamberMasker::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 193 of file RPCChamberMasker.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and DEFINE_FWK_MODULE.

194 {
195 
197  desc.add<edm::InputTag>("digiTag", edm::InputTag("preRPCDigis"));
198  desc.add<bool>("descopeRE31", false);
199  desc.add<bool>("descopeRE41", false);
200  descriptions.add("rpcChamberMasker",desc);
201 
202 }
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 
)
overrideprivatevirtual

Definition at line 113 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().

114 {
115 
116  using namespace edm;
118  CLHEP::HepRandomEngine& randGen = randGenService->getEngine(iEvent.streamID());
119 
120 
121  std::unique_ptr<RPCDigiCollection> filteredDigis(new RPCDigiCollection());
122  if (!digiTag_.label().empty())
123  {
125  iEvent.getByToken(m_digiTag, rpcDigis);
126 
127  for ( const auto & rpcLayerId : (*rpcDigis) )
128  {
129  int id = (rpcLayerId.first).rawId();
130  auto chEffIt = m_ChEffs.find(id);
131  if ((chEffIt != m_ChEffs.end()) && (randGen.flat() <= chEffIt->second))
132  filteredDigis->put(rpcLayerId.second,rpcLayerId.first);
133  }
134  }
135  iEvent.put(std::move(filteredDigis));
136 
137 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
std::map< RPCDetId, float > m_ChEffs
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
edm::InputTag digiTag_
MuonDigiCollection< RPCDetId, RPCDigi > RPCDigiCollection
std::string const & label() const
Definition: InputTag.h:36
HLT enums.
edm::EDGetTokenT< RPCDigiCollection > m_digiTag
StreamID streamID() const
Definition: Event.h:81
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::InputTag RPCChamberMasker::digiTag_
private

Definition at line 69 of file RPCChamberMasker.cc.

Referenced by produce(), and RPCChamberMasker().

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

Definition at line 71 of file RPCChamberMasker.cc.

Referenced by beginRun(), and produce().

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

Definition at line 70 of file RPCChamberMasker.cc.

Referenced by produce(), and RPCChamberMasker().

bool RPCChamberMasker::theRE31_off
private

Definition at line 72 of file RPCChamberMasker.cc.

Referenced by beginRun(), and RPCChamberMasker().

bool RPCChamberMasker::theRE41_off
private

Definition at line 73 of file RPCChamberMasker.cc.

Referenced by beginRun(), and RPCChamberMasker().