CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TBMTFConverter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1TBMTFConverter
4 // Class: L1TBMTFConverter
5 //
13 //
14 // Original Author: Joschka Philip Lingemann,40 3-B01,+41227671598,
15 // Created: Thu Oct 3 10:12:30 CEST 2013
16 // $Id$
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 #include <fstream>
24 
25 // user include files
28 
31 
35 
38 
39 #include <iostream>
40 //
41 // class declaration
42 //
43 using namespace l1t;
44 
46  public:
47  explicit L1TBMTFConverter(const edm::ParameterSet&);
49 
50  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
51 
52  private:
53  virtual void beginJob() override ;
54  virtual void produce(edm::Event&, const edm::EventSetup&) override ;
55  virtual void endJob() override ;
56 
57  virtual void beginRun(const edm::Run&, edm::EventSetup const&) override ;
58  virtual void endRun(const edm::Run&, edm::EventSetup const&) override ;
59  virtual void beginLuminosityBlock(const edm::LuminosityBlock&, edm::EventSetup const&) override ;
60  virtual void endLuminosityBlock(const edm::LuminosityBlock&, edm::EventSetup const&) override ;
61  // ----------member data ---------------------------
64  std::map<int, int> ptMap_;
65 };
66 
67 //
68 // constants, enums and typedefs
69 //
70 
71 
72 //
73 // static data member definitions
74 //
75 
76 //
77 // constructors and destructor
78 //
80 {
81  m_barrelTfInputTag = iConfig.getParameter<edm::InputTag>("barrelTFInput");
82  m_barrelTfInputToken = consumes<RegionalMuonCandBxCollection>(m_barrelTfInputTag);
83  //register your products
84  produces<RegionalMuonCandBxCollection>("ConvBMTFMuons");
85  ptMap_[0] = 0;
86  ptMap_[1] = 0;
87  ptMap_[2] = 3;
88  ptMap_[3] = 4;
89  ptMap_[4] = 5;
90  ptMap_[5] = 6;
91  ptMap_[6] = 7;
92  ptMap_[7] = 8;
93  ptMap_[8] = 9;
94  ptMap_[9] = 10;
95  ptMap_[10] = 12;
96  ptMap_[11] = 14;
97  ptMap_[12] = 16;
98  ptMap_[13] = 20;
99  ptMap_[14] = 24;
100  ptMap_[15] = 28;
101  ptMap_[16] = 32;
102  ptMap_[17] = 36;
103  ptMap_[18] = 40;
104  ptMap_[19] = 50;
105  ptMap_[20] = 60;
106  ptMap_[21] = 70;
107  ptMap_[22] = 80;
108  ptMap_[23] = 90;
109  ptMap_[24] = 100;
110  ptMap_[25] = 120;
111  ptMap_[26] = 140;
112  ptMap_[27] = 160;
113  ptMap_[28] = 180;
114  ptMap_[29] = 200;
115  ptMap_[30] = 240;
116  ptMap_[31] = 280;
117 }
118 
119 
121 {
122  // do anything here that needs to be done at desctruction time
123  // (e.g. close files, deallocate resources etc.)
124 }
125 
126 
127 //
128 // member functions
129 //
130 
131 
132 // ------------ method called to produce the data ------------
133 void
135 {
136  using namespace edm;
137 
138  std::unique_ptr<RegionalMuonCandBxCollection> convMuons (new RegionalMuonCandBxCollection());
139 
141  iEvent.getByToken(m_barrelTfInputToken, bmtfMuons);
142  for (auto mu = bmtfMuons->begin(0); mu != bmtfMuons->end(0); ++mu) {
143  RegionalMuonCand convMu((*mu));
144  // int convPt = ptMap_.at(mu->hwPt());
145  // int convPhi = (mu->hwPhi() * 4) - (mu->processor() * 48);
146  // int convEta = getSigned(mu->hwEta())*3.54;
147  int convEta = (mu->hwEta() - 32)*3.54;
148  // convMu.setHwPt(convPt);
149  // convMu.setHwPhi(convPhi);
150  convMu.setHwEta(convEta);
151  // convMu.setTFIdentifiers(mu->processor()+1, mu->trackFinderType());
152  convMuons->push_back(0, convMu);
153  }
154 
155  iEvent.put(std::move(convMuons), "ConvBMTFMuons");
156 }
157 
158 // ------------ method called once each job just before starting event loop ------------
159 void
161 {
162 }
163 
164 // ------------ method called once each job just after ending the event loop ------------
165 void
167 }
168 
169 // ------------ method called when starting to processes a run ------------
170 void
172 {
173 }
174 
175 // ------------ method called when ending the processing of a run ------------
176 void
178 {
179 }
180 
181 // ------------ method called when starting to processes a luminosity block ------------
182 void
184 {
185 }
186 
187 // ------------ method called when ending the processing of a luminosity block ------------
188 void
190 {
191 }
192 
193 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
194 void
196  //The following says we do not know what parameters are allowed so do no validation
197  // Please change this to state exactly what you do use, even if it is no parameters
199  desc.setUnknown();
200  descriptions.addDefault(desc);
201 }
202 
203 //define this as a plug-in
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
std::map< int, int > ptMap_
virtual void endRun(const edm::Run &, edm::EventSetup const &) override
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, edm::EventSetup const &) override
BXVector< RegionalMuonCand > RegionalMuonCandBxCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
L1TBMTFConverter(const edm::ParameterSet &)
edm::EDGetTokenT< RegionalMuonCandBxCollection > m_barrelTfInputToken
virtual void beginJob() override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void beginJob()
Definition: Breakpoints.cc:15
int iEvent
Definition: GenABIO.cc:230
void addDefault(ParameterSetDescription const &psetDescription)
def move
Definition: eostools.py:510
virtual void beginRun(const edm::Run &, edm::EventSetup const &) override
const int mu
Definition: Constants.h:22
void setHwEta(int bits)
Set compressed eta as transmitted by hardware LSB = 0.010875 (9 bits)
virtual void produce(edm::Event &, const edm::EventSetup &) override
edm::InputTag m_barrelTfInputTag
virtual void endJob() override
virtual void endLuminosityBlock(const edm::LuminosityBlock &, edm::EventSetup const &) override
Definition: Run.h:42