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 
48 
49 #include <iostream>
50 //
51 // class declaration
52 //
53 using namespace l1t;
54 
56  public:
57  explicit L1TMicroGMTLUTDumper(const edm::ParameterSet&);
59  virtual void analyze(const edm::Event&, const edm::EventSetup&);
60 
61  private:
62  virtual void beginRun(edm::Run const&, edm::EventSetup const&);
63 
64  void dumpLut(MicroGMTLUT*, const std::string&);
65 
66  // ----------member data ---------------------------
67  std::unique_ptr<L1TMuonGlobalParams> microGMTParams;
69 
70  std::shared_ptr<MicroGMTRankPtQualLUT> m_rankLUT;
71 
72  std::shared_ptr<MicroGMTAbsoluteIsolationCheckLUT> m_absIsoCheckMemLUT;
73  std::shared_ptr<MicroGMTRelativeIsolationCheckLUT> m_relIsoCheckMemLUT;
74 
75  std::shared_ptr<MicroGMTCaloIndexSelectionLUT> m_idxSelMemPhiLUT;
76  std::shared_ptr<MicroGMTCaloIndexSelectionLUT> m_idxSelMemEtaLUT;
77 
78  std::shared_ptr<MicroGMTExtrapolationLUT> m_bPhiExtrapolationLUT;
79  std::shared_ptr<MicroGMTExtrapolationLUT> m_oPhiExtrapolationLUT;
80  std::shared_ptr<MicroGMTExtrapolationLUT> m_fPhiExtrapolationLUT;
81  std::shared_ptr<MicroGMTExtrapolationLUT> m_bEtaExtrapolationLUT;
82  std::shared_ptr<MicroGMTExtrapolationLUT> m_oEtaExtrapolationLUT;
83  std::shared_ptr<MicroGMTExtrapolationLUT> m_fEtaExtrapolationLUT;
84 
85  std::shared_ptr<MicroGMTMatchQualLUT> m_boPosMatchQualLUT;
86  std::shared_ptr<MicroGMTMatchQualLUT> m_boNegMatchQualLUT;
87  std::shared_ptr<MicroGMTMatchQualLUT> m_foPosMatchQualLUT;
88  std::shared_ptr<MicroGMTMatchQualLUT> m_foNegMatchQualLUT;
89  //std::shared_ptr<MicroGMTMatchQualLUT> m_brlSingleMatchQualLUT;
90  std::shared_ptr<MicroGMTMatchQualLUT> m_ovlPosSingleMatchQualLUT;
91  std::shared_ptr<MicroGMTMatchQualLUT> m_ovlNegSingleMatchQualLUT;
92  std::shared_ptr<MicroGMTMatchQualLUT> m_fwdPosSingleMatchQualLUT;
93  std::shared_ptr<MicroGMTMatchQualLUT> m_fwdNegSingleMatchQualLUT;
94 };
95 
96 //
97 // constants, enums and typedefs
98 //
99 
100 
101 //
102 // static data member definitions
103 //
104 
105 //
106 // constructors and destructor
107 //
109 {
110  //now do what ever other initialization is needed
111  m_foldername = iConfig.getParameter<std::string> ("out_directory");
112 
113  microGMTParams = std::unique_ptr<L1TMuonGlobalParams>(new L1TMuonGlobalParams());
114 }
115 
116 
118 {
119  // do anything here that needs to be done at desctruction time
120  // (e.g. close files, deallocate resources etc.)
121 }
122 
123 
124 //
125 // member functions
126 //
127 void
129  std::ofstream fStream(m_foldername+oName);
130  lut->save(fStream);
131  fStream.close();
132 }
133 
134 
135 
136 // ------------ method called to produce the data ------------
137 void
139 {
140  using namespace edm;
141  dumpLut(m_rankLUT.get(), std::string("/SortRank.txt"));
142  dumpLut(m_absIsoCheckMemLUT.get(), std::string("/AbsIsoCheckMem.txt"));
143  dumpLut(m_relIsoCheckMemLUT.get(), std::string("/RelIsoCheckMem.txt"));
144  dumpLut(m_idxSelMemPhiLUT.get(), std::string("/IdxSelMemPhi.txt"));
145  dumpLut(m_idxSelMemEtaLUT.get(), std::string("/IdxSelMemEta.txt"));
146  dumpLut(m_bPhiExtrapolationLUT.get(), std::string("/BPhiExtrapolation.txt"));
147  dumpLut(m_oPhiExtrapolationLUT.get(), std::string("/OPhiExtrapolation.txt"));
148  dumpLut(m_fPhiExtrapolationLUT.get(), std::string("/EPhiExtrapolation.txt"));
149  dumpLut(m_bEtaExtrapolationLUT.get(), std::string("/BEtaExtrapolation.txt"));
150  dumpLut(m_oEtaExtrapolationLUT.get(), std::string("/OEtaExtrapolation.txt"));
151  dumpLut(m_fEtaExtrapolationLUT.get(), std::string("/EEtaExtrapolation.txt"));
152  dumpLut(m_boPosMatchQualLUT.get(), std::string("/BOPosMatchQual.txt"));
153  dumpLut(m_boNegMatchQualLUT.get(), std::string("/BONegMatchQual.txt"));
154  dumpLut(m_foPosMatchQualLUT.get(), std::string("/EOPosMatchQual.txt"));
155  dumpLut(m_foNegMatchQualLUT.get(), std::string("/EONegMatchQual.txt"));
156  //dumpLut(m_brlSingleMatchQualLUT.get(), std::string("/BmtfSingleMatchQual.txt"));
157  dumpLut(m_ovlPosSingleMatchQualLUT.get(), std::string("/OmtfPosSingleMatchQual.txt"));
158  dumpLut(m_ovlNegSingleMatchQualLUT.get(), std::string("/OmtfNegSingleMatchQual.txt"));
159  dumpLut(m_fwdPosSingleMatchQualLUT.get(), std::string("/EmtfPosSingleMatchQual.txt"));
160  dumpLut(m_fwdNegSingleMatchQualLUT.get(), std::string("/EmtfNegSingleMatchQual.txt"));
161 
162 }
163 
164 // ------------ method called when starting to processes a run ------------
165 void
167 {
168  const L1TMuonGlobalParamsRcd& microGMTParamsRcd = iSetup.get<L1TMuonGlobalParamsRcd>();
169  edm::ESHandle<L1TMuonGlobalParams> microGMTParamsHandle;
170  microGMTParamsRcd.get(microGMTParamsHandle);
171 
172  microGMTParams = std::unique_ptr<L1TMuonGlobalParams>(new L1TMuonGlobalParams(*microGMTParamsHandle.product()));
173  if (!microGMTParams) {
174  edm::LogError("L1TMicroGMTLUTDumper") << "Could not retrieve parameters from Event Setup" << std::endl;
175  }
176 
177  int fwVersion = microGMTParams->fwVersion();
178  m_rankLUT = MicroGMTRankPtQualLUTFactory::create(microGMTParams->sortRankLUTPath(), fwVersion, microGMTParams->sortRankLUTPtFactor(), microGMTParams->sortRankLUTQualFactor());
179 
180  m_absIsoCheckMemLUT = MicroGMTAbsoluteIsolationCheckLUTFactory::create(microGMTParams->absIsoCheckMemLUTPath(), fwVersion);
181  m_relIsoCheckMemLUT = MicroGMTRelativeIsolationCheckLUTFactory::create(microGMTParams->relIsoCheckMemLUTPath(), fwVersion);
182  m_idxSelMemPhiLUT = MicroGMTCaloIndexSelectionLUTFactory::create(microGMTParams->idxSelMemPhiLUTPath(), l1t::MicroGMTConfiguration::PHI, fwVersion);
183  m_idxSelMemEtaLUT = MicroGMTCaloIndexSelectionLUTFactory::create(microGMTParams->idxSelMemEtaLUTPath(), l1t::MicroGMTConfiguration::ETA, fwVersion);
184 
185  m_bPhiExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(microGMTParams->bPhiExtrapolationLUTPath(), l1t::MicroGMTConfiguration::PHI_OUT, fwVersion);
186  m_oPhiExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(microGMTParams->oPhiExtrapolationLUTPath(), l1t::MicroGMTConfiguration::PHI_OUT, fwVersion);
187  m_fPhiExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(microGMTParams->fPhiExtrapolationLUTPath(), l1t::MicroGMTConfiguration::PHI_OUT, fwVersion);
188  m_bEtaExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(microGMTParams->bEtaExtrapolationLUTPath(), l1t::MicroGMTConfiguration::ETA_OUT, fwVersion);
189  m_oEtaExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(microGMTParams->oEtaExtrapolationLUTPath(), l1t::MicroGMTConfiguration::ETA_OUT, fwVersion);
190  m_fEtaExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(microGMTParams->fEtaExtrapolationLUTPath(), l1t::MicroGMTConfiguration::ETA_OUT, fwVersion);
191 
192  m_boPosMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParams->bOPosMatchQualLUTPath(), microGMTParams->bOPosMatchQualLUTMaxDR(), cancel_t::omtf_bmtf_pos, fwVersion);
193  m_boNegMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParams->bONegMatchQualLUTPath(), microGMTParams->bONegMatchQualLUTMaxDR(), cancel_t::omtf_bmtf_neg, fwVersion);
194  m_foPosMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParams->fOPosMatchQualLUTPath(), microGMTParams->fOPosMatchQualLUTMaxDR(), cancel_t::omtf_emtf_pos, fwVersion);
195  m_foNegMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParams->fONegMatchQualLUTPath(), microGMTParams->fONegMatchQualLUTMaxDR(), cancel_t::omtf_emtf_neg, fwVersion);
196  //m_brlSingleMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParams->brlSingleMatchQualLUTPath(), microGMTParams->brlSingleMatchQualLUTMaxDR(), cancel_t::bmtf_bmtf, fwVersion);
197  m_ovlPosSingleMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParams->ovlPosSingleMatchQualLUTPath(), microGMTParams->ovlPosSingleMatchQualLUTMaxDR(), cancel_t::omtf_omtf_pos, fwVersion);
198  m_ovlNegSingleMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParams->ovlNegSingleMatchQualLUTPath(), microGMTParams->ovlNegSingleMatchQualLUTMaxDR(), cancel_t::omtf_omtf_neg, fwVersion);
199  m_fwdPosSingleMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParams->fwdPosSingleMatchQualLUTPath(), microGMTParams->fwdPosSingleMatchQualLUTMaxDR(), cancel_t::emtf_emtf_pos, fwVersion);
200  m_fwdNegSingleMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParams->fwdNegSingleMatchQualLUTPath(), microGMTParams->fwdNegSingleMatchQualLUTMaxDR(), cancel_t::emtf_emtf_neg, fwVersion);
201 }
202 
203 //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 double maxDR, cancel_t cancelType, const int fwVersion)
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::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
std::unique_ptr< L1TMuonGlobalParams > microGMTParams
const T & get() const
Definition: EventSetup.h:56
std::shared_ptr< MicroGMTMatchQualLUT > m_boPosMatchQualLUT
void save(std::ofstream &output)
Definition: MicroGMTLUT.cc:8
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)