CMS 3D CMS Logo

GEMChamberMasker.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 #include <string>
4 #include <vector>
5 #include <iostream>
6 #include <algorithm>
7 #include <regex>
8 
9 // user include files
19 
25 
26 //
27 // class declaration
28 //
29 
31 public:
32  explicit GEMChamberMasker(const edm::ParameterSet&);
33 
34  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
35 
36 private:
37  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
38 
39  // ----------member data ---------------------------
41  const bool ge11Minus_;
42  const bool ge11Plus_;
43  const bool ge21Minus_;
44  const bool ge21Plus_;
45 
49 };
50 
51 //
52 // constants, enums and typedefs
53 //
54 
55 //
56 // static data member definitions
57 //
58 
59 //
60 // constructors and destructor
61 //
63  : digiTag_(iConfig.getParameter<edm::InputTag>("digiTag")),
64  ge11Minus_(iConfig.getParameter<bool>("ge11Minus")),
65  ge11Plus_(iConfig.getParameter<bool>("ge11Plus")),
66  ge21Minus_(iConfig.getParameter<bool>("ge21Minus")),
67  ge21Plus_(iConfig.getParameter<bool>("ge21Plus")),
68  m_digiTag(consumes(digiTag_)),
69  m_putToken(produces()),
70  m_agingObj(esConsumes()) {}
71 
72 //
73 // member functions
74 //
75 
76 // ------------ method called to produce the data ------------
78  using namespace edm;
79  GEMDigiCollection filteredDigis;
80 
81  auto const& agingObj = iSetup.getData(m_agingObj);
82 
83  auto const& maskedGEMIDs = agingObj.m_GEMChambEffs;
84 
85  if (!digiTag_.label().empty()) {
86  GEMDigiCollection const& gemDigis = iEvent.get(m_digiTag);
87 
88  for (const auto& gemLayerId : gemDigis) {
89  auto chambId = gemLayerId.first.chamberId();
90 
91  bool keepDigi = (!ge11Minus_ && chambId.station() == 1 && chambId.region() < 0) ||
92  (!ge11Plus_ && chambId.station() == 1 && chambId.region() > 0) ||
93  (!ge21Minus_ && chambId.station() == 2 && chambId.region() < 0) ||
94  (!ge21Plus_ && chambId.station() == 2 && chambId.region() > 0);
95 
96  uint32_t rawId = chambId.rawId();
97  if (keepDigi || maskedGEMIDs.find(rawId) == maskedGEMIDs.end()) {
98  filteredDigis.put(gemLayerId.second, gemLayerId.first);
99  }
100  }
101  }
102 
103  iEvent.emplace(m_putToken, std::move(filteredDigis));
104 }
105 
108  desc.add<edm::InputTag>("digiTag", edm::InputTag("simMuonGEMDigis"));
109  desc.add<bool>("ge11Minus", true);
110  desc.add<bool>("ge11Plus", true);
111  desc.add<bool>("ge21Minus", true);
112  desc.add<bool>("ge21Plus", true);
113 
114  descriptions.add("gemChamberMasker", desc);
115 }
116 
117 //define this as a plug-in
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::string const & label() const
Definition: InputTag.h:36
int iEvent
Definition: GenABIO.cc:224
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::ESGetToken< MuonSystemAging, MuonSystemAgingRcd > m_agingObj
const edm::EDGetTokenT< GEMDigiCollection > m_digiTag
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const edm::EDPutTokenT< GEMDigiCollection > m_putToken
HLT enums.
GEMChamberMasker(const edm::ParameterSet &)
def move(src, dest)
Definition: eostools.py:511
const edm::InputTag digiTag_