CMS 3D CMS Logo

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&);
48  ~L1TBMTFConverter() override;
49 
50  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
51 
52  private:
53  void produce(edm::Event&, const edm::EventSetup&) override ;
54 
55  void beginRun(const edm::Run&, edm::EventSetup const&) override ;
56  void endRun(const edm::Run&, edm::EventSetup const&) override ;
57  void beginLuminosityBlock(const edm::LuminosityBlock&, edm::EventSetup const&) override ;
58  void endLuminosityBlock(const edm::LuminosityBlock&, edm::EventSetup const&) override ;
59  // ----------member data ---------------------------
62  std::map<int, int> ptMap_;
63 };
64 
65 //
66 // constants, enums and typedefs
67 //
68 
69 
70 //
71 // static data member definitions
72 //
73 
74 //
75 // constructors and destructor
76 //
78 {
79  m_barrelTfInputTag = iConfig.getParameter<edm::InputTag>("barrelTFInput");
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::unique_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(std::move(convMuons), "ConvBMTFMuons");
154 }
155 
156 // ------------ method called when starting to processes a run ------------
157 void
159 {
160 }
161 
162 // ------------ method called when ending the processing of a run ------------
163 void
165 {
166 }
167 
168 // ------------ method called when starting to processes a luminosity block ------------
169 void
171 {
172 }
173 
174 // ------------ method called when ending the processing of a luminosity block ------------
175 void
177 {
178 }
179 
180 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
181 void
183  //The following says we do not know what parameters are allowed so do no validation
184  // Please change this to state exactly what you do use, even if it is no parameters
186  desc.setUnknown();
187  descriptions.addDefault(desc);
188 }
189 
190 //define this as a plug-in
const_iterator end(int bx) const
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
std::map< int, int > ptMap_
void endRun(const edm::Run &, edm::EventSetup const &) override
void beginLuminosityBlock(const edm::LuminosityBlock &, edm::EventSetup const &) override
BXVector< RegionalMuonCand > RegionalMuonCandBxCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
~L1TBMTFConverter() override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
L1TBMTFConverter(const edm::ParameterSet &)
edm::EDGetTokenT< RegionalMuonCandBxCollection > m_barrelTfInputToken
delete x;
Definition: CaloConfig.h:22
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int iEvent
Definition: GenABIO.cc:230
void addDefault(ParameterSetDescription const &psetDescription)
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)
void produce(edm::Event &, const edm::EventSetup &) override
HLT enums.
edm::InputTag m_barrelTfInputTag
const_iterator begin(int bx) const
void endLuminosityBlock(const edm::LuminosityBlock &, edm::EventSetup const &) override
def move(src, dest)
Definition: eostools.py:510
Definition: Run.h:43