CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TMicroGMTLUTDumper.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1TMicroGMTLUTDumper
4 // Class: L1TMicroGMTLUTDumper
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
30 
33 
37 
45 
49 
50 #include <iostream>
51 //
52 // class declaration
53 //
54 using namespace l1t;
55 
57  public:
58  explicit L1TMicroGMTLUTDumper(const edm::ParameterSet&);
60  virtual void analyze(const edm::Event&, const edm::EventSetup&);
61 
62  private:
63  virtual void beginRun(edm::Run const&, edm::EventSetup const&);
64 
65  void dumpLut(MicroGMTLUT*, const std::string&);
66 
67  // ----------member data ---------------------------
68  std::unique_ptr<L1TMuonGlobalParamsHelper> microGMTParamsHelper;
70 
71  std::shared_ptr<MicroGMTRankPtQualLUT> m_rankLUT;
72 
73  std::shared_ptr<MicroGMTAbsoluteIsolationCheckLUT> m_absIsoCheckMemLUT;
74  std::shared_ptr<MicroGMTRelativeIsolationCheckLUT> m_relIsoCheckMemLUT;
75 
76  std::shared_ptr<MicroGMTCaloIndexSelectionLUT> m_idxSelMemPhiLUT;
77  std::shared_ptr<MicroGMTCaloIndexSelectionLUT> m_idxSelMemEtaLUT;
78 
79  std::shared_ptr<MicroGMTExtrapolationLUT> m_bPhiExtrapolationLUT;
80  std::shared_ptr<MicroGMTExtrapolationLUT> m_oPhiExtrapolationLUT;
81  std::shared_ptr<MicroGMTExtrapolationLUT> m_fPhiExtrapolationLUT;
82  std::shared_ptr<MicroGMTExtrapolationLUT> m_bEtaExtrapolationLUT;
83  std::shared_ptr<MicroGMTExtrapolationLUT> m_oEtaExtrapolationLUT;
84  std::shared_ptr<MicroGMTExtrapolationLUT> m_fEtaExtrapolationLUT;
85 
86  std::shared_ptr<MicroGMTMatchQualLUT> m_boPosMatchQualLUT;
87  std::shared_ptr<MicroGMTMatchQualLUT> m_boNegMatchQualLUT;
88  std::shared_ptr<MicroGMTMatchQualLUT> m_foPosMatchQualLUT;
89  std::shared_ptr<MicroGMTMatchQualLUT> m_foNegMatchQualLUT;
90  //std::shared_ptr<MicroGMTMatchQualLUT> m_brlSingleMatchQualLUT;
91  std::shared_ptr<MicroGMTMatchQualLUT> m_ovlPosSingleMatchQualLUT;
92  std::shared_ptr<MicroGMTMatchQualLUT> m_ovlNegSingleMatchQualLUT;
93  std::shared_ptr<MicroGMTMatchQualLUT> m_fwdPosSingleMatchQualLUT;
94  std::shared_ptr<MicroGMTMatchQualLUT> m_fwdNegSingleMatchQualLUT;
95 };
96 
97 //
98 // constants, enums and typedefs
99 //
100 
101 
102 //
103 // static data member definitions
104 //
105 
106 //
107 // constructors and destructor
108 //
110 {
111  //now do what ever other initialization is needed
112  m_foldername = iConfig.getParameter<std::string> ("out_directory");
113 
114  microGMTParamsHelper = std::unique_ptr<L1TMuonGlobalParamsHelper>(new L1TMuonGlobalParamsHelper());
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 void
130  std::ofstream fStream(m_foldername+oName);
131  lut->save(fStream);
132  fStream.close();
133 }
134 
135 
136 
137 // ------------ method called to produce the data ------------
138 void
140 {
141  using namespace edm;
142  dumpLut(m_rankLUT.get(), std::string("/SortRank.txt"));
143  dumpLut(m_absIsoCheckMemLUT.get(), std::string("/AbsIsoCheckMem.txt"));
144  dumpLut(m_relIsoCheckMemLUT.get(), std::string("/RelIsoCheckMem.txt"));
145  dumpLut(m_idxSelMemPhiLUT.get(), std::string("/IdxSelMemPhi.txt"));
146  dumpLut(m_idxSelMemEtaLUT.get(), std::string("/IdxSelMemEta.txt"));
147  dumpLut(m_bPhiExtrapolationLUT.get(), std::string("/BPhiExtrapolation.txt"));
148  dumpLut(m_oPhiExtrapolationLUT.get(), std::string("/OPhiExtrapolation.txt"));
149  dumpLut(m_fPhiExtrapolationLUT.get(), std::string("/EPhiExtrapolation.txt"));
150  dumpLut(m_bEtaExtrapolationLUT.get(), std::string("/BEtaExtrapolation.txt"));
151  dumpLut(m_oEtaExtrapolationLUT.get(), std::string("/OEtaExtrapolation.txt"));
152  dumpLut(m_fEtaExtrapolationLUT.get(), std::string("/EEtaExtrapolation.txt"));
153  dumpLut(m_boPosMatchQualLUT.get(), std::string("/BOPosMatchQual.txt"));
154  dumpLut(m_boNegMatchQualLUT.get(), std::string("/BONegMatchQual.txt"));
155  dumpLut(m_foPosMatchQualLUT.get(), std::string("/EOPosMatchQual.txt"));
156  dumpLut(m_foNegMatchQualLUT.get(), std::string("/EONegMatchQual.txt"));
157  //dumpLut(m_brlSingleMatchQualLUT.get(), std::string("/BmtfSingleMatchQual.txt"));
158  dumpLut(m_ovlPosSingleMatchQualLUT.get(), std::string("/OmtfPosSingleMatchQual.txt"));
159  dumpLut(m_ovlNegSingleMatchQualLUT.get(), std::string("/OmtfNegSingleMatchQual.txt"));
160  dumpLut(m_fwdPosSingleMatchQualLUT.get(), std::string("/EmtfPosSingleMatchQual.txt"));
161  dumpLut(m_fwdNegSingleMatchQualLUT.get(), std::string("/EmtfNegSingleMatchQual.txt"));
162 
163 }
164 
165 // ------------ method called when starting to processes a run ------------
166 void
168 {
169  const L1TMuonGlobalParamsRcd& microGMTParamsRcd = iSetup.get<L1TMuonGlobalParamsRcd>();
170  edm::ESHandle<L1TMuonGlobalParams> microGMTParamsHandle;
171  microGMTParamsRcd.get(microGMTParamsHandle);
172 
173  microGMTParamsHelper = std::unique_ptr<L1TMuonGlobalParamsHelper>(new L1TMuonGlobalParamsHelper(*microGMTParamsHandle.product()));
174  if (!microGMTParamsHelper) {
175  edm::LogError("L1TMicroGMTLUTDumper") << "Could not retrieve parameters from Event Setup" << std::endl;
176  }
177 
178  int fwVersion = microGMTParamsHelper->fwVersion();
179  m_rankLUT = MicroGMTRankPtQualLUTFactory::create(microGMTParamsHelper->sortRankLUT(), fwVersion);
180 
181  m_absIsoCheckMemLUT = MicroGMTAbsoluteIsolationCheckLUTFactory::create(microGMTParamsHelper->absIsoCheckMemLUT(), fwVersion);
182  m_relIsoCheckMemLUT = MicroGMTRelativeIsolationCheckLUTFactory::create(microGMTParamsHelper->relIsoCheckMemLUT(), fwVersion);
183  m_idxSelMemPhiLUT = MicroGMTCaloIndexSelectionLUTFactory::create(microGMTParamsHelper->idxSelMemPhiLUT(), l1t::MicroGMTConfiguration::PHI, fwVersion);
184  m_idxSelMemEtaLUT = MicroGMTCaloIndexSelectionLUTFactory::create(microGMTParamsHelper->idxSelMemEtaLUT(), l1t::MicroGMTConfiguration::ETA, fwVersion);
185 
186  m_bPhiExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(microGMTParamsHelper->bPhiExtrapolationLUT(), l1t::MicroGMTConfiguration::PHI_OUT, fwVersion);
187  m_oPhiExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(microGMTParamsHelper->oPhiExtrapolationLUT(), l1t::MicroGMTConfiguration::PHI_OUT, fwVersion);
188  m_fPhiExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(microGMTParamsHelper->fPhiExtrapolationLUT(), l1t::MicroGMTConfiguration::PHI_OUT, fwVersion);
189  m_bEtaExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(microGMTParamsHelper->bEtaExtrapolationLUT(), l1t::MicroGMTConfiguration::ETA_OUT, fwVersion);
190  m_oEtaExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(microGMTParamsHelper->oEtaExtrapolationLUT(), l1t::MicroGMTConfiguration::ETA_OUT, fwVersion);
191  m_fEtaExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(microGMTParamsHelper->fEtaExtrapolationLUT(), l1t::MicroGMTConfiguration::ETA_OUT, fwVersion);
192 
193  m_boPosMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParamsHelper->bOPosMatchQualLUT(), cancel_t::omtf_bmtf_pos, fwVersion);
194  m_boNegMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParamsHelper->bONegMatchQualLUT(), cancel_t::omtf_bmtf_neg, fwVersion);
195  m_foPosMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParamsHelper->fOPosMatchQualLUT(), cancel_t::omtf_emtf_pos, fwVersion);
196  m_foNegMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParamsHelper->fONegMatchQualLUT(), cancel_t::omtf_emtf_neg, fwVersion);
197  //m_brlSingleMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParamsHelper->brlSingleMatchQualLUT(), cancel_t::bmtf_bmtf, fwVersion);
198  m_ovlPosSingleMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParamsHelper->ovlPosSingleMatchQualLUT(), cancel_t::omtf_omtf_pos, fwVersion);
199  m_ovlNegSingleMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParamsHelper->ovlNegSingleMatchQualLUT(), cancel_t::omtf_omtf_neg, fwVersion);
200  m_fwdPosSingleMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParamsHelper->fwdPosSingleMatchQualLUT(), cancel_t::emtf_emtf_pos, fwVersion);
201  m_fwdNegSingleMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParamsHelper->fwdNegSingleMatchQualLUT(), cancel_t::emtf_emtf_neg, fwVersion);
202 }
203 
204 //define this as a plug-in
T getParameter(std::string const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::shared_ptr< MicroGMTExtrapolationLUT > m_oEtaExtrapolationLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_fwdPosSingleMatchQualLUT
static ReturnType create(const std::string &filename, const int fwVersion)
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
std::shared_ptr< MicroGMTMatchQualLUT > m_boNegMatchQualLUT
static ReturnType create(const std::string &filename, const int type, const int fwVersion)
std::shared_ptr< MicroGMTMatchQualLUT > m_foPosMatchQualLUT
static ReturnType create(const std::string &filename, const int fwVersion, const unsigned ptFactor, const unsigned qualFactor)
int iEvent
Definition: GenABIO.cc:230
static ReturnType create(const std::string &filename, const int fwVersion)
std::shared_ptr< MicroGMTExtrapolationLUT > m_bPhiExtrapolationLUT
std::shared_ptr< MicroGMTCaloIndexSelectionLUT > m_idxSelMemPhiLUT
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::shared_ptr< MicroGMTRankPtQualLUT > m_rankLUT
void get(HolderT &iHolder) const
void dumpLut(MicroGMTLUT *, const std::string &)
tuple lut
Definition: lumiPlot.py:244
L1TMicroGMTLUTDumper(const edm::ParameterSet &)
std::unique_ptr< L1TMuonGlobalParamsHelper > microGMTParamsHelper
std::shared_ptr< MicroGMTMatchQualLUT > m_foNegMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_ovlNegSingleMatchQualLUT
std::shared_ptr< MicroGMTAbsoluteIsolationCheckLUT > m_absIsoCheckMemLUT
std::shared_ptr< MicroGMTRelativeIsolationCheckLUT > m_relIsoCheckMemLUT
std::shared_ptr< MicroGMTExtrapolationLUT > m_bEtaExtrapolationLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_ovlPosSingleMatchQualLUT
const T & get() const
Definition: EventSetup.h:56
std::shared_ptr< MicroGMTMatchQualLUT > m_boPosMatchQualLUT
void save(std::ofstream &output)
Definition: MicroGMTLUT.cc:15
static ReturnType create(const std::string &filename, const double maxDR, const double fEta, const double fEtaCoarse, const double fPhi, cancel_t cancelType, const int fwVersion)
std::shared_ptr< MicroGMTCaloIndexSelectionLUT > m_idxSelMemEtaLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_fwdNegSingleMatchQualLUT
std::shared_ptr< MicroGMTExtrapolationLUT > m_fPhiExtrapolationLUT
std::shared_ptr< MicroGMTExtrapolationLUT > m_fEtaExtrapolationLUT
std::shared_ptr< MicroGMTExtrapolationLUT > m_oPhiExtrapolationLUT
Definition: Run.h:43
static ReturnType create(const std::string &filename, const int type, const int fwVersion)