CMS 3D CMS Logo

L1TMuonShowerProducer.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 #include <fstream>
4 
5 // user include files
10 
13 
16 
19 
20 using namespace l1t;
21 
23 public:
25  ~L1TMuonShowerProducer() override;
26 
27  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
28 
29 private:
30  void produce(edm::Event&, const edm::EventSetup&) override;
31 
34  int bxMin_;
35  int bxMax_;
36 };
37 
39  : showerInputTag_(iConfig.getParameter<edm::InputTag>("showerInput")),
40  showerInputToken_(consumes<l1t::RegionalMuonShowerBxCollection>(showerInputTag_)),
41  bxMin_(iConfig.getParameter<int>("bxMin")),
42  bxMax_(iConfig.getParameter<int>("bxMax")) {
43  produces<MuonShowerBxCollection>();
44 }
45 
47 
48 // ------------ method called to produce the data ------------
50  using namespace edm;
51  std::unique_ptr<MuonShowerBxCollection> outShowers(new MuonShowerBxCollection());
52 
54  iEvent.getByToken(showerInputToken_, emtfShowers);
55  outShowers->setBXRange(bxMin_, bxMax_);
56 
57  /*
58  Check each sector for a valid EMTF shower. A valid EMTF shower
59  for startup Run-3 can either be "one nominal shower" or "one tight shower".
60  The case "two loose showers" is under consideration but needs more study.
61  Showers that arrive out-of-time are also under consideration, but are not
62  going be to enabled at startup Run-3. So all showers should be in-time.
63  */
64  bool isOneNominalInTime{false};
65  bool isTwoLooseInTime{false};
66  bool isOneTightInTime{false};
67  bool isTwoLooseDifferentSectorsInTime{false};
68 
69  bool foundOneLoose{false};
70  for (size_t i = 0; i < emtfShowers->size(0); ++i) {
71  auto shower = emtfShowers->at(0, i);
72  if (shower.isValid()) {
73  // nominal
74  if (shower.isOneNominalInTime()) {
75  isOneNominalInTime = true;
76  }
77  // two loose
78  if (shower.isTwoLooseInTime()) {
79  isTwoLooseInTime = true;
80  }
81  // tight
82  if (shower.isOneTightInTime()) {
83  isOneTightInTime = true;
84  }
85  // two loose in different sectors
86  if (shower.isOneLooseInTime()) {
87  if (foundOneLoose) {
88  isTwoLooseDifferentSectorsInTime = true;
89  } else {
90  foundOneLoose = true;
91  }
92  }
93  }
94  }
95 
96  // Check for at least one nominal shower
97  const bool acceptCondition{isOneNominalInTime or isTwoLooseInTime or isOneTightInTime or
98  isTwoLooseDifferentSectorsInTime};
99 
100  if (acceptCondition) {
101  MuonShower outShower(
102  isOneNominalInTime, false, isTwoLooseInTime, false, isOneTightInTime, false, isTwoLooseDifferentSectorsInTime);
103  outShowers->push_back(0, outShower);
104  }
105  iEvent.put(std::move(outShowers));
106 }
107 
108 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
111  desc.add<edm::InputTag>("showerInput", edm::InputTag("simEmtfShowers", "EMTF"));
112  desc.add<int32_t>("bxMin", 0);
113  desc.add<int32_t>("bxMax", 0);
114  descriptions.add("simGmtShowerDigisDef", desc);
115 }
116 
117 //define this as a plug-in
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
L1TMuonShowerProducer(const edm::ParameterSet &)
delete x;
Definition: CaloConfig.h:22
unsigned size(int bx) const
int iEvent
Definition: GenABIO.cc:224
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void produce(edm::Event &, const edm::EventSetup &) override
BXVector< MuonShower > MuonShowerBxCollection
Definition: MuonShower.h:18
const T & at(int bx, unsigned i) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< l1t::RegionalMuonShowerBxCollection > showerInputToken_
HLT enums.
def move(src, dest)
Definition: eostools.py:511