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 
37 
38 #include <iostream>
39 //
40 // class declaration
41 //
42 using namespace l1t;
43 
45  public:
46  explicit L1TBMTFConverter(const edm::ParameterSet&);
48 
49  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
50 
51  private:
52  virtual void beginJob() ;
53  virtual void produce(edm::Event&, const edm::EventSetup&);
54  virtual void endJob() ;
55 
56  virtual void beginRun(edm::Run&, edm::EventSetup const&);
57  virtual void endRun(edm::Run&, edm::EventSetup const&);
58  virtual void beginLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&);
59  virtual void endLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&);
60  // ----------member data ---------------------------
63  std::map<int, int> ptMap_;
64 };
65 
66 //
67 // constants, enums and typedefs
68 //
69 
70 
71 //
72 // static data member definitions
73 //
74 
75 //
76 // constructors and destructor
77 //
78 L1TBMTFConverter::L1TBMTFConverter(const edm::ParameterSet& iConfig) : m_barrelTfInputTag("bmtfEmulator", "BM")
79 {
80  m_barrelTfInputToken = consumes<RegionalMuonCandBxCollection>(m_barrelTfInputTag);
81  //register your products
82  produces<RegionalMuonCandBxCollection>("ConvBMTFMuons");
83  ptMap_[0] = 0;
84  ptMap_[1] = 0;
85  ptMap_[2] = 3;
86  ptMap_[3] = 4;
87  ptMap_[4] = 5;
88  ptMap_[5] = 6;
89  ptMap_[6] = 7;
90  ptMap_[7] = 8;
91  ptMap_[8] = 9;
92  ptMap_[9] = 10;
93  ptMap_[10] = 12;
94  ptMap_[11] = 14;
95  ptMap_[12] = 16;
96  ptMap_[13] = 20;
97  ptMap_[14] = 24;
98  ptMap_[15] = 28;
99  ptMap_[16] = 32;
100  ptMap_[17] = 36;
101  ptMap_[18] = 40;
102  ptMap_[19] = 50;
103  ptMap_[20] = 60;
104  ptMap_[21] = 70;
105  ptMap_[22] = 80;
106  ptMap_[23] = 90;
107  ptMap_[24] = 100;
108  ptMap_[25] = 120;
109  ptMap_[26] = 140;
110  ptMap_[27] = 160;
111  ptMap_[28] = 180;
112  ptMap_[29] = 200;
113  ptMap_[30] = 240;
114  ptMap_[31] = 280;
115 }
116 
117 
119 {
120  // do anything here that needs to be done at desctruction time
121  // (e.g. close files, deallocate resources etc.)
122 }
123 
124 
125 //
126 // member functions
127 //
128 
129 
130 // ------------ method called to produce the data ------------
131 void
133 {
134  using namespace edm;
135 
136  std::auto_ptr<RegionalMuonCandBxCollection> convMuons (new RegionalMuonCandBxCollection());
137 
139  iEvent.getByToken(m_barrelTfInputToken, bmtfMuons);
140  for (auto mu = bmtfMuons->begin(0); mu != bmtfMuons->end(0); ++mu) {
141  RegionalMuonCand convMu((*mu));
142  // int convPt = ptMap_.at(mu->hwPt());
143  // int convPhi = (mu->hwPhi() * 4) - (mu->processor() * 48);
144  // int convEta = getSigned(mu->hwEta())*3.54;
145  int convEta = (mu->hwEta() - 32)*3.54;
146  // convMu.setHwPt(convPt);
147  // convMu.setHwPhi(convPhi);
148  convMu.setHwEta(convEta);
149  // convMu.setTFIdentifiers(mu->processor()+1, mu->trackFinderType());
150  convMuons->push_back(0, convMu);
151  }
152 
153  iEvent.put(convMuons, "ConvBMTFMuons");
154 }
155 
156 // ------------ method called once each job just before starting event loop ------------
157 void
159 {
160 }
161 
162 // ------------ method called once each job just after ending the event loop ------------
163 void
165 }
166 
167 // ------------ method called when starting to processes a run ------------
168 void
170 {
171 }
172 
173 // ------------ method called when ending the processing of a run ------------
174 void
176 {
177 }
178 
179 // ------------ method called when starting to processes a luminosity block ------------
180 void
182 {
183 }
184 
185 // ------------ method called when ending the processing of a luminosity block ------------
186 void
188 {
189 }
190 
191 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
192 void
194  //The following says we do not know what parameters are allowed so do no validation
195  // Please change this to state exactly what you do use, even if it is no parameters
197  desc.setUnknown();
198  descriptions.addDefault(desc);
199 }
200 
201 //define this as a plug-in
virtual void beginJob()
std::map< int, int > ptMap_
virtual void beginLuminosityBlock(edm::LuminosityBlock &, edm::EventSetup const &)
BXVector< RegionalMuonCand > RegionalMuonCandBxCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
L1TBMTFConverter(const edm::ParameterSet &)
edm::EDGetTokenT< RegionalMuonCandBxCollection > m_barrelTfInputToken
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void beginJob()
Definition: Breakpoints.cc:15
int iEvent
Definition: GenABIO.cc:230
void addDefault(ParameterSetDescription const &psetDescription)
virtual void endJob()
virtual void endRun(edm::Run &, edm::EventSetup const &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
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 beginRun(edm::Run &, edm::EventSetup const &)
virtual void endLuminosityBlock(edm::LuminosityBlock &, edm::EventSetup const &)
edm::InputTag m_barrelTfInputTag
virtual void produce(edm::Event &, const edm::EventSetup &)
Definition: Run.h:43