CMS 3D CMS Logo

ME0ChamberMasker.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Class: ME0ChamberMasker
3 //
4 
5 // system include files
6 #include <memory>
7 #include <string>
8 #include <vector>
9 #include <iostream>
10 #include <algorithm>
11 #include <regex>
12 
13 // user include files
23 
30 //
31 // class declaration
32 //
33 
35 public:
36  explicit ME0ChamberMasker(const edm::ParameterSet&);
37  ~ME0ChamberMasker() override;
38 
39  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
40 
41 private:
42  void produce(edm::Event&, const edm::EventSetup&) override;
43 
44  void beginRun(edm::Run const&, edm::EventSetup const&) override;
45  void endRun(edm::Run const&, edm::EventSetup const&) override;
46 
47  // ----------member data ---------------------------
48  bool me0Minus_;
49  bool me0Plus_;
53  std::map<unsigned int, float> m_maskedME0IDs;
54 };
55 
56 //
57 // constants, enums and typedefs
58 //
59 
60 //
61 // static data member definitions
62 //
63 
64 //
65 // constructors and destructor
66 //
68  : me0Minus_(iConfig.getParameter<bool>("me0Minus")),
69  me0Plus_(iConfig.getParameter<bool>("me0Plus")),
70  digiTag_(iConfig.getParameter<edm::InputTag>("digiTag")) {
71  m_digiTag = consumes<ME0DigiPreRecoCollection>(digiTag_);
72  m_agingObjTag = esConsumes<MuonSystemAging, MuonSystemAgingRcd, edm::Transition::BeginRun>();
73  produces<ME0DigiPreRecoCollection>();
74 }
75 
77 
78 //
79 // member functions
80 //
81 
82 // ------------ method called to produce the data ------------
84  using namespace edm;
85  std::unique_ptr<ME0DigiPreRecoCollection> filteredDigis(new ME0DigiPreRecoCollection());
86 
87  if (!digiTag_.label().empty()) {
89  iEvent.getByToken(m_digiTag, me0Digis);
90 
91  for (const auto& me0LayerId : (*me0Digis)) {
92  auto chambId = me0LayerId.first.chamberId();
93 
94  bool keepDigi = (!me0Minus_ && chambId.region() < 0) || (!me0Plus_ && chambId.region() > 0);
95 
96  uint32_t rawId = chambId.rawId();
97  if (keepDigi || m_maskedME0IDs.find(rawId) == m_maskedME0IDs.end()) {
98  filteredDigis->put(me0LayerId.second, me0LayerId.first);
99  }
100  }
101  }
102 
103  iEvent.put(std::move(filteredDigis));
104 }
105 
106 // ------------ method called when starting to processes a run ------------
107 
110 
111  m_maskedME0IDs = agingObj->m_ME0ChambEffs;
112 }
113 
114 // ------------ method called when ending the processing of a run ------------
115 
117 
118 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
121  desc.add<edm::InputTag>("digiTag", edm::InputTag("simMuonME0Digis"));
122  desc.add<bool>("me0Minus", true);
123  desc.add<bool>("me0Plus", true);
124  descriptions.add("me0ChamberMasker", desc);
125 }
126 
127 //define this as a plug-in
electrons_cff.bool
bool
Definition: electrons_cff.py:366
ESHandle.h
MuonSystemAging.h
edm::Run
Definition: Run.h:45
edm::EDGetTokenT< ME0DigiPreRecoCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ME0ChamberMasker::m_agingObjTag
edm::ESGetToken< MuonSystemAging, MuonSystemAgingRcd > m_agingObjTag
Definition: ME0ChamberMasker.cc:52
ME0ChamberMasker::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: ME0ChamberMasker.cc:83
EDProducer.h
ME0EtaPartitionSpecs.h
edm::Handle
Definition: AssociativeIterator.h:50
ME0ChamberMasker::me0Minus_
bool me0Minus_
Definition: ME0ChamberMasker.cc:48
ESGetToken.h
ME0ChamberMasker::m_digiTag
edm::EDGetTokenT< ME0DigiPreRecoCollection > m_digiTag
Definition: ME0ChamberMasker.cc:51
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
MakerMacros.h
ME0ChamberMasker::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: ME0ChamberMasker.cc:119
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
ME0ChamberMasker::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: ME0ChamberMasker.cc:108
edm::ESHandle
Definition: DTSurvey.h:22
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
ME0ChamberMasker::~ME0ChamberMasker
~ME0ChamberMasker() override
Definition: ME0ChamberMasker.cc:76
MuonSystemAgingRcd.h
edm::ParameterSet
Definition: ParameterSet.h:47
ME0ChamberMasker::ME0ChamberMasker
ME0ChamberMasker(const edm::ParameterSet &)
Definition: ME0ChamberMasker.cc:67
Event.h
ME0ChamberMasker::endRun
void endRun(edm::Run const &, edm::EventSetup const &) override
Definition: ME0ChamberMasker.cc:116
ME0ChamberMasker
Definition: ME0ChamberMasker.cc:34
MuonSystemAging::m_ME0ChambEffs
std::map< unsigned int, float > m_ME0ChambEffs
Definition: MuonSystemAging.h:23
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:58
ME0ChamberMasker::me0Plus_
bool me0Plus_
Definition: ME0ChamberMasker.cc:49
edm::ESGetToken< MuonSystemAging, MuonSystemAgingRcd >
ME0Geometry.h
GeomDet.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
ME0ChamberMasker::digiTag_
edm::InputTag digiTag_
Definition: ME0ChamberMasker.cc:50
writedatasetfile.run
run
Definition: writedatasetfile.py:27
ME0DigiPreRecoCollection.h
Frameworkfwd.h
EventSetup.h
ConsumesCollector.h
ParameterSet.h
edm::Event
Definition: Event.h:73
ME0ChamberMasker::m_maskedME0IDs
std::map< unsigned int, float > m_maskedME0IDs
Definition: ME0ChamberMasker.cc:53
edm::InputTag
Definition: InputTag.h:15
ME0DigiPreRecoCollection
MuonDigiCollection< ME0DetId, ME0DigiPreReco > ME0DigiPreRecoCollection
Definition: ME0DigiPreRecoCollection.h:13