CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CSCChamberMasker Class Reference

#include <CSCChamberMasker.cc>

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

Public Member Functions

 CSCChamberMasker (const edm::ParameterSet &)
 
 ~CSCChamberMasker () 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 &)
 

Private Member Functions

template<typename T , typename C = MuonDigiCollection<CSCDetId, T>>
void ageDigis (edm::Event &event, edm::EDGetTokenT< C > &digiToken, CLHEP::HepRandomEngine &randGen, std::unique_ptr< C > &filteredDigis)
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
template<typename T , typename C = MuonDigiCollection<CSCDetId, T>>
void copyDigis (edm::Event &event, edm::EDGetTokenT< C > &digiToken, std::unique_ptr< C > &filteredDigis)
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::ESGetToken< MuonSystemAging, MuonSystemAgingRcdm_agingObjToken
 
edm::EDGetTokenT< CSCALCTDigiCollectionm_alctDigiToken
 
edm::EDGetTokenT< CSCCLCTDigiCollectionm_clctDigiToken
 
std::map< CSCDetId, std::pair< unsigned int, float > > m_CSCEffs
 
edm::ESGetToken< CSCGeometry, MuonGeometryRecordm_cscGeomToken
 
edm::EDGetTokenT< CSCStripDigiCollectionm_stripDigiToken
 
edm::EDGetTokenT< CSCWireDigiCollectionm_wireDigiToken
 

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

SimMuon/CSCDigitizer/plugins/CSCChamberMasker.cc

Description: Class to mask CSC digis on a chamber by chamber basis

Definition at line 69 of file CSCChamberMasker.cc.

Constructor & Destructor Documentation

◆ CSCChamberMasker()

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

Definition at line 112 of file CSCChamberMasker.cc.

113  : m_stripDigiToken(consumes<CSCStripDigiCollection>(iConfig.getParameter<edm::InputTag>("stripDigiTag"))),
114  m_wireDigiToken(consumes<CSCWireDigiCollection>(iConfig.getParameter<edm::InputTag>("wireDigiTag"))),
115  m_clctDigiToken(consumes<CSCCLCTDigiCollection>(iConfig.getParameter<edm::InputTag>("clctDigiTag"))),
116  m_alctDigiToken(consumes<CSCALCTDigiCollection>(iConfig.getParameter<edm::InputTag>("alctDigiTag"))),
117  m_cscGeomToken(esConsumes<CSCGeometry, MuonGeometryRecord>()),
118  m_agingObjToken(esConsumes<MuonSystemAging, MuonSystemAgingRcd>()) {
119  produces<CSCStripDigiCollection>("MuonCSCStripDigi");
120  produces<CSCWireDigiCollection>("MuonCSCWireDigi");
121  produces<CSCCLCTDigiCollection>("MuonCSCCLCTDigi");
122  produces<CSCALCTDigiCollection>("MuonCSCALCTDigi");
123 }

◆ ~CSCChamberMasker()

CSCChamberMasker::~CSCChamberMasker ( )
override

Definition at line 125 of file CSCChamberMasker.cc.

125 {}

Member Function Documentation

◆ ageDigis()

template<typename T , typename C >
void CSCChamberMasker::ageDigis ( edm::Event event,
edm::EDGetTokenT< C > &  digiToken,
CLHEP::HepRandomEngine &  randGen,
std::unique_ptr< C > &  filteredDigis 
)
private

Definition at line 176 of file CSCChamberMasker.cc.

179  {
180  if (!digiToken.isUninitialized()) {
181  edm::Handle<C> digis;
182  event.getByToken(digiToken, digis);
183 
184  for (const auto &j : (*digis)) {
185  auto digiItr = j.second.first;
186  auto last = j.second.second;
187 
188  CSCDetId const cscDetId = j.first;
189 
190  // Since lookups are chamber-centric, make new DetId with layer=0
191  CSCDetId chId = CSCDetId(cscDetId.endcap(), cscDetId.station(), cscDetId.ring(), cscDetId.chamber(), 0);
192 
193  for (; digiItr != last; ++digiItr) {
194  auto chEffIt = m_CSCEffs.find(chId);
195 
196  if (chEffIt != m_CSCEffs.end()) {
197  std::pair<unsigned int, float> typeEff = chEffIt->second;
198  int type = typeEff.first % 10; // second digit gives type of inefficiency
199  int layer = typeEff.first / 10; // first digit gives layer (0 = chamber level)
200 
201  bool doRandomize = false;
204  (layer == 0 || cscDetId.layer() == layer))
205  doRandomize = true;
206 
207  if (!doRandomize || (randGen.flat() <= typeEff.second)) {
208  filteredDigis->insertDigi(cscDetId, *digiItr);
209  }
210  }
211  }
212  }
213  }
214 }

References CSCDetId::chamber(), EFF_CHAMBER, EFF_STRIPS, EFF_WIRES, CSCDetId::endcap(), edm::EDGetTokenT< T >::isUninitialized(), dqmiolumiharvest::j, dqmdumpme::last, CSCDetId::layer(), phase1PixelTopology::layer, m_CSCEffs, CSCDetId::ring(), CSCDetId::station(), and relativeConstraints::value.

◆ beginRun()

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

Definition at line 217 of file CSCChamberMasker.cc.

217  {
218  m_CSCEffs.clear();
219 
220  edm::ESHandle<CSCGeometry> cscGeom = iSetup.getHandle(m_cscGeomToken);
221 
222  edm::ESHandle<MuonSystemAging> agingObj = iSetup.getHandle(m_agingObjToken);
223 
224  const auto chambers = cscGeom->chambers();
225 
226  for (const auto *ch : chambers) {
227  CSCDetId chId = ch->id();
228  unsigned int rawId = chId.rawIdMaker(chId.endcap(), chId.station(), chId.ring(), chId.chamber(), 0);
229  float eff = 1.;
230  int type = 0;
231  for (auto &agingPair : agingObj->m_CSCChambEffs) {
232  if (agingPair.first != rawId)
233  continue;
234 
235  type = agingPair.second.first;
236  eff = agingPair.second.second;
237  m_CSCEffs[chId] = std::make_pair(type, eff);
238  break;
239  }
240  }
241 }

References CSCDetId::chamber(), CSCGeometry::chambers(), chambers, CSCDetId::endcap(), edm::EventSetup::getHandle(), m_agingObjToken, MuonSystemAging::m_CSCChambEffs, m_CSCEffs, m_cscGeomToken, CSCDetId::rawIdMaker(), CSCDetId::ring(), and CSCDetId::station().

◆ copyDigis()

template<typename T , typename C >
void CSCChamberMasker::copyDigis ( edm::Event event,
edm::EDGetTokenT< C > &  digiToken,
std::unique_ptr< C > &  filteredDigis 
)
private

Definition at line 157 of file CSCChamberMasker.cc.

157  {
158  if (!digiToken.isUninitialized()) {
159  edm::Handle<C> digis;
160  event.getByToken(digiToken, digis);
161  for (const auto &j : (*digis)) {
162  auto digiItr = j.second.first;
163  auto last = j.second.second;
164 
165  CSCDetId const cscDetId = j.first;
166 
167  for (; digiItr != last; ++digiItr) {
168  filteredDigis->insertDigi(cscDetId, *digiItr);
169  }
170  }
171  }
172 }

References edm::EDGetTokenT< T >::isUninitialized(), dqmiolumiharvest::j, and dqmdumpme::last.

◆ fillDescriptions()

void CSCChamberMasker::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 245 of file CSCChamberMasker.cc.

245  {
247  desc.add<edm::InputTag>("stripDigiTag", edm::InputTag("simMuonCSCDigis:MuonCSCStripDigi"));
248  desc.add<edm::InputTag>("wireDigiTag", edm::InputTag("simMuonCSCDigis:MuonCSCWireDigi"));
249  desc.add<edm::InputTag>("comparatorDigiTag", edm::InputTag("simMuonCSCDigis:MuonCSCComparatorDigi"));
250  desc.add<edm::InputTag>("rpcDigiTag", edm::InputTag("simMuonCSCDigis:MuonCSCRPCDigi"));
251  desc.add<edm::InputTag>("alctDigiTag", edm::InputTag("simMuonCSCDigis:MuonCSCALCTDigi"));
252  desc.add<edm::InputTag>("clctDigiTag", edm::InputTag("simMuonCSCDigis:MuonCSCCLCTDigi"));
253  descriptions.add("cscChamberMasker", desc);
254 }

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

◆ produce()

void CSCChamberMasker::produce ( edm::Event event,
const edm::EventSetup conditions 
)
overrideprivate

Definition at line 132 of file CSCChamberMasker.cc.

132  {
134  CLHEP::HepRandomEngine &randGen = randGenService->getEngine(event.streamID());
135 
136  std::unique_ptr<CSCStripDigiCollection> filteredStripDigis(new CSCStripDigiCollection());
137  std::unique_ptr<CSCWireDigiCollection> filteredWireDigis(new CSCWireDigiCollection());
138  std::unique_ptr<CSCCLCTDigiCollection> filteredCLCTDigis(new CSCCLCTDigiCollection());
139  std::unique_ptr<CSCALCTDigiCollection> filteredALCTDigis(new CSCALCTDigiCollection());
140 
141  // Handle wire and strip digis
142  ageDigis<CSCStripDigi>(event, m_stripDigiToken, randGen, filteredStripDigis);
143  ageDigis<CSCWireDigi>(event, m_wireDigiToken, randGen, filteredWireDigis);
144 
145  // Don't touch CLCT or ALCT digis
146  copyDigis<CSCCLCTDigi>(event, m_clctDigiToken, filteredCLCTDigis);
147  copyDigis<CSCALCTDigi>(event, m_alctDigiToken, filteredALCTDigis);
148 
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");
153 }

References edm::RandomNumberGenerator::getEngine(), m_alctDigiToken, m_clctDigiToken, m_stripDigiToken, m_wireDigiToken, and eostools::move().

Member Data Documentation

◆ m_agingObjToken

edm::ESGetToken<MuonSystemAging, MuonSystemAgingRcd> CSCChamberMasker::m_agingObjToken
private

Definition at line 97 of file CSCChamberMasker.cc.

Referenced by beginRun().

◆ m_alctDigiToken

edm::EDGetTokenT<CSCALCTDigiCollection> CSCChamberMasker::m_alctDigiToken
private

Definition at line 95 of file CSCChamberMasker.cc.

Referenced by produce().

◆ m_clctDigiToken

edm::EDGetTokenT<CSCCLCTDigiCollection> CSCChamberMasker::m_clctDigiToken
private

Definition at line 94 of file CSCChamberMasker.cc.

Referenced by produce().

◆ m_CSCEffs

std::map<CSCDetId, std::pair<unsigned int, float> > CSCChamberMasker::m_CSCEffs
private

Definition at line 98 of file CSCChamberMasker.cc.

Referenced by ageDigis(), and beginRun().

◆ m_cscGeomToken

edm::ESGetToken<CSCGeometry, MuonGeometryRecord> CSCChamberMasker::m_cscGeomToken
private

Definition at line 96 of file CSCChamberMasker.cc.

Referenced by beginRun().

◆ m_stripDigiToken

edm::EDGetTokenT<CSCStripDigiCollection> CSCChamberMasker::m_stripDigiToken
private

Definition at line 92 of file CSCChamberMasker.cc.

Referenced by produce().

◆ m_wireDigiToken

edm::EDGetTokenT<CSCWireDigiCollection> CSCChamberMasker::m_wireDigiToken
private

Definition at line 93 of file CSCChamberMasker.cc.

Referenced by produce().

EFF_STRIPS
Definition: MuonSystemAging.h:11
edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
CSCChamberMasker::m_CSCEffs
std::map< CSCDetId, std::pair< unsigned int, float > > m_CSCEffs
Definition: CSCChamberMasker.cc:98
EFF_WIRES
Definition: MuonSystemAging.h:11
CSCDetId::ring
int ring() const
Definition: CSCDetId.h:68
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::EDGetTokenT::isUninitialized
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:99
CSCDetId::rawIdMaker
static int rawIdMaker(int iendcap, int istation, int iring, int ichamber, int ilayer)
Definition: CSCDetId.h:146
CSCChamberMasker::m_wireDigiToken
edm::EDGetTokenT< CSCWireDigiCollection > m_wireDigiToken
Definition: CSCChamberMasker.cc:93
edm::Handle
Definition: AssociativeIterator.h:50
CSCStripDigiCollection
MuonDigiCollection< CSCDetId, CSCStripDigi > CSCStripDigiCollection
Definition: CSCStripDigiCollection.h:14
dqmdumpme.last
last
Definition: dqmdumpme.py:56
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
CSCDetId::layer
int layer() const
Definition: CSCDetId.h:56
edm::ESHandle< CSCGeometry >
MuonSystemAging::m_CSCChambEffs
std::map< unsigned int, std::pair< unsigned int, float > > m_CSCChambEffs
Definition: MuonSystemAging.h:20
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
CSCChamberMasker::m_alctDigiToken
edm::EDGetTokenT< CSCALCTDigiCollection > m_alctDigiToken
Definition: CSCChamberMasker.cc:95
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
CSCChamberMasker::m_agingObjToken
edm::ESGetToken< MuonSystemAging, MuonSystemAgingRcd > m_agingObjToken
Definition: CSCChamberMasker.cc:97
CSCDetId
Definition: CSCDetId.h:26
edm::Service< edm::RandomNumberGenerator >
CSCChamberMasker::m_clctDigiToken
edm::EDGetTokenT< CSCCLCTDigiCollection > m_clctDigiToken
Definition: CSCChamberMasker.cc:94
CSCALCTDigiCollection
MuonDigiCollection< CSCDetId, CSCALCTDigi > CSCALCTDigiCollection
Definition: CSCALCTDigiCollection.h:15
chambers
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
CSCDetId::chamber
int chamber() const
Definition: CSCDetId.h:62
CSCChamberMasker::m_cscGeomToken
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > m_cscGeomToken
Definition: CSCChamberMasker.cc:96
EFF_CHAMBER
Definition: MuonSystemAging.h:11
CSCWireDigiCollection
MuonDigiCollection< CSCDetId, CSCWireDigi > CSCWireDigiCollection
Definition: CSCWireDigiCollection.h:15
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
CSCCLCTDigiCollection
MuonDigiCollection< CSCDetId, CSCCLCTDigi > CSCCLCTDigiCollection
Definition: CSCCLCTDigiCollection.h:15
CSCDetId::endcap
int endcap() const
Definition: CSCDetId.h:85
relativeConstraints.value
value
Definition: relativeConstraints.py:53
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CSCGeometry::chambers
const ChamberContainer & chambers() const
Return a vector of all chambers.
Definition: CSCGeometry.cc:96
CSCChamberMasker::m_stripDigiToken
edm::EDGetTokenT< CSCStripDigiCollection > m_stripDigiToken
Definition: CSCChamberMasker.cc:92
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
event
Definition: event.py:1
edm::InputTag
Definition: InputTag.h:15