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 
68  for (size_t i = 0; i < emtfShowers->size(0); ++i) {
69  auto shower = emtfShowers->at(0, i);
70  if (shower.isValid()) {
71  // nominal
72  if (shower.isOneNominalInTime())
73  isOneNominalInTime = true;
74  // two loose
75  if (shower.isTwoLooseInTime())
76  isTwoLooseInTime = true;
77  // tight
78  if (shower.isOneTightInTime())
79  isOneTightInTime = true;
80  }
81  }
82 
83  // Check for at least one nominal shower
84  const bool acceptCondition(isOneNominalInTime or isTwoLooseInTime or isOneTightInTime);
85 
86  if (acceptCondition) {
87  MuonShower outShower(isOneNominalInTime, false, isTwoLooseInTime, false, isOneTightInTime, false);
88  outShowers->push_back(0, outShower);
89  }
90  iEvent.put(std::move(outShowers));
91 }
92 
93 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
96  desc.add<edm::InputTag>("showerInput", edm::InputTag("simEmtfShowers", "EMTF"));
97  desc.add<int32_t>("bxMin", 0);
98  desc.add<int32_t>("bxMax", 0);
99  descriptions.add("simGmtShowerDigisDef", desc);
100 }
101 
102 //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