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  can either be in-time or out-of-time. The minimal implementation
60  only considers the "at least 1-nominal shower" case.
61  */
62  bool isOneNominalInTime = false;
63  bool isOneNominalOutOfTime = false;
64  bool isTwoLooseInTime = false;
65  bool isTwoLooseOutOfTime = false;
66  for (size_t i = 0; i < emtfShowers->size(0); ++i) {
67  auto shower = emtfShowers->at(0, i);
68  if (shower.isValid()) {
69  // nominal
70  if (shower.isOneNominalInTime())
71  isOneNominalInTime = true;
72  if (shower.isOneNominalOutOfTime())
73  isOneNominalOutOfTime = true;
74  // two loose
75  if (shower.isTwoLooseInTime())
76  isTwoLooseInTime = true;
77  if (shower.isTwoLooseOutOfTime())
78  isTwoLooseOutOfTime = true;
79  }
80  }
81 
82  // Check for at least one nominal shower
83  const bool acceptCondition(isOneNominalInTime or isOneNominalOutOfTime or isTwoLooseInTime or isTwoLooseOutOfTime);
84  if (acceptCondition) {
85  MuonShower outShower(isOneNominalInTime, isOneNominalOutOfTime, isTwoLooseInTime, isTwoLooseOutOfTime);
86  outShowers->push_back(0, outShower);
87  }
88  iEvent.put(std::move(outShowers));
89 }
90 
91 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
94  desc.add<edm::InputTag>("showerInput", edm::InputTag("simEmtfShowers", "EMTF"));
95  desc.add<int32_t>("bxMin", 0);
96  desc.add<int32_t>("bxMax", 0);
97  desc.add<uint32_t>("minNominalShowers", 1);
98  desc.add<uint32_t>("minTwoLooseShowers", 0);
99  descriptions.add("simGmtShowerDigisDef", desc);
100 }
101 
102 //define this as a plug-in
mps_fire.i
i
Definition: mps_fire.py:428
L1TMuonShowerProducer::~L1TMuonShowerProducer
~L1TMuonShowerProducer() override
Definition: L1TMuonShowerProducer.cc:46
ESHandle.h
L1TMuonShowerProducer::L1TMuonShowerProducer
L1TMuonShowerProducer(const edm::ParameterSet &)
Definition: L1TMuonShowerProducer.cc:38
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDProducer.h
l1t::MuonShowerBxCollection
BXVector< MuonShower > MuonShowerBxCollection
Definition: MuonShower.h:18
edm::Handle
Definition: AssociativeIterator.h:50
ESGetToken.h
L1TMuonShowerProducer::showerInputToken_
edm::EDGetTokenT< l1t::RegionalMuonShowerBxCollection > showerInputToken_
Definition: L1TMuonShowerProducer.cc:33
BXVector
Definition: BXVector.h:15
MakerMacros.h
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
L1TMuonShowerProducer::bxMax_
int bxMax_
Definition: L1TMuonShowerProducer.cc:35
RegionalMuonShower.h
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
L1TMuonShowerProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: L1TMuonShowerProducer.cc:49
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
L1TMuonShowerProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: L1TMuonShowerProducer.cc:92
l1t
delete x;
Definition: CaloConfig.h:22
BXVector::at
const T & at(int bx, unsigned i) const
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
MuonShower.h
edm::stream::EDProducer
Definition: EDProducer.h:36
edm::EventSetup
Definition: EventSetup.h:58
L1TMuonShowerProducer::showerInputTag_
edm::InputTag showerInputTag_
Definition: L1TMuonShowerProducer.cc:32
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
Frameworkfwd.h
L1TMuonShowerProducer::bxMin_
int bxMin_
Definition: L1TMuonShowerProducer.cc:34
EventSetup.h
or
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
BXVector::size
unsigned size(int bx) const
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
L1TMuonShowerProducer
Definition: L1TMuonShowerProducer.cc:22
l1t::MuonShower
Definition: MuonShower.h:28