CMS 3D CMS Logo

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 // system include files
21 #include <memory>
22 #include <fstream>
23 
24 // user include files
29 
32 
36 
44 
48 
49 #include <iostream>
50 //
51 // class declaration
52 //
53 using namespace l1t;
54 
55 class L1TMicroGMTLUTDumper : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
56 public:
57  explicit L1TMicroGMTLUTDumper(const edm::ParameterSet&);
58  ~L1TMicroGMTLUTDumper() override;
59  void analyze(const edm::Event&, const edm::EventSetup&) override;
60 
61 private:
62  void beginRun(edm::Run const&, edm::EventSetup const&) override;
63  void endRun(edm::Run const&, edm::EventSetup const&) override;
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 // static data member definitions
103 //
104 
105 //
106 // constructors and destructor
107 //
109  //now do what ever other initialization is needed
110  m_foldername = iConfig.getParameter<std::string>("out_directory");
111 
112  microGMTParamsHelper = std::make_unique<L1TMuonGlobalParamsHelper>();
113 }
114 
116  // do anything here that needs to be done at desctruction time
117  // (e.g. close files, deallocate resources etc.)
118 }
119 
120 //
121 // member functions
122 //
124  std::ofstream fStream(m_foldername + oName);
125  lut->save(fStream);
126  fStream.close();
127 }
128 
129 // ------------ method called to produce the data ------------
131  using namespace edm;
132  dumpLut(m_rankLUT.get(), std::string("/SortRank.txt"));
133  dumpLut(m_absIsoCheckMemLUT.get(), std::string("/AbsIsoCheckMem.txt"));
134  dumpLut(m_relIsoCheckMemLUT.get(), std::string("/RelIsoCheckMem.txt"));
135  dumpLut(m_idxSelMemPhiLUT.get(), std::string("/IdxSelMemPhi.txt"));
136  dumpLut(m_idxSelMemEtaLUT.get(), std::string("/IdxSelMemEta.txt"));
137  dumpLut(m_bPhiExtrapolationLUT.get(), std::string("/BPhiExtrapolation.txt"));
138  dumpLut(m_oPhiExtrapolationLUT.get(), std::string("/OPhiExtrapolation.txt"));
139  dumpLut(m_fPhiExtrapolationLUT.get(), std::string("/EPhiExtrapolation.txt"));
140  dumpLut(m_bEtaExtrapolationLUT.get(), std::string("/BEtaExtrapolation.txt"));
141  dumpLut(m_oEtaExtrapolationLUT.get(), std::string("/OEtaExtrapolation.txt"));
142  dumpLut(m_fEtaExtrapolationLUT.get(), std::string("/EEtaExtrapolation.txt"));
143  dumpLut(m_boPosMatchQualLUT.get(), std::string("/BOPosMatchQual.txt"));
144  dumpLut(m_boNegMatchQualLUT.get(), std::string("/BONegMatchQual.txt"));
145  dumpLut(m_foPosMatchQualLUT.get(), std::string("/EOPosMatchQual.txt"));
146  dumpLut(m_foNegMatchQualLUT.get(), std::string("/EONegMatchQual.txt"));
147  //dumpLut(m_brlSingleMatchQualLUT.get(), std::string("/BmtfSingleMatchQual.txt"));
148  dumpLut(m_ovlPosSingleMatchQualLUT.get(), std::string("/OmtfPosSingleMatchQual.txt"));
149  dumpLut(m_ovlNegSingleMatchQualLUT.get(), std::string("/OmtfNegSingleMatchQual.txt"));
150  dumpLut(m_fwdPosSingleMatchQualLUT.get(), std::string("/EmtfPosSingleMatchQual.txt"));
151  dumpLut(m_fwdNegSingleMatchQualLUT.get(), std::string("/EmtfNegSingleMatchQual.txt"));
152 }
153 
154 // ------------ method called when starting to processes a run ------------
156  const L1TMuonGlobalParamsRcd& microGMTParamsRcd = iSetup.get<L1TMuonGlobalParamsRcd>();
157  edm::ESHandle<L1TMuonGlobalParams> microGMTParamsHandle;
158  microGMTParamsRcd.get(microGMTParamsHandle);
159 
160  microGMTParamsHelper = std::make_unique<L1TMuonGlobalParamsHelper>(*microGMTParamsHandle.product());
161  if (!microGMTParamsHelper) {
162  edm::LogError("L1TMicroGMTLUTDumper") << "Could not retrieve parameters from Event Setup" << std::endl;
163  }
164 
165  int fwVersion = microGMTParamsHelper->fwVersion();
166  m_rankLUT = MicroGMTRankPtQualLUTFactory::create(microGMTParamsHelper->sortRankLUT(), fwVersion);
167 
168  m_absIsoCheckMemLUT =
169  MicroGMTAbsoluteIsolationCheckLUTFactory::create(microGMTParamsHelper->absIsoCheckMemLUT(), fwVersion);
170  m_relIsoCheckMemLUT =
171  MicroGMTRelativeIsolationCheckLUTFactory::create(microGMTParamsHelper->relIsoCheckMemLUT(), fwVersion);
173  microGMTParamsHelper->idxSelMemPhiLUT(), l1t::MicroGMTConfiguration::PHI, fwVersion);
175  microGMTParamsHelper->idxSelMemEtaLUT(), l1t::MicroGMTConfiguration::ETA, fwVersion);
176 
177  m_bPhiExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(
178  microGMTParamsHelper->bPhiExtrapolationLUT(), l1t::MicroGMTConfiguration::PHI_OUT, fwVersion);
179  m_oPhiExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(
180  microGMTParamsHelper->oPhiExtrapolationLUT(), l1t::MicroGMTConfiguration::PHI_OUT, fwVersion);
181  m_fPhiExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(
182  microGMTParamsHelper->fPhiExtrapolationLUT(), l1t::MicroGMTConfiguration::PHI_OUT, fwVersion);
183  m_bEtaExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(
184  microGMTParamsHelper->bEtaExtrapolationLUT(), l1t::MicroGMTConfiguration::ETA_OUT, fwVersion);
185  m_oEtaExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(
186  microGMTParamsHelper->oEtaExtrapolationLUT(), l1t::MicroGMTConfiguration::ETA_OUT, fwVersion);
187  m_fEtaExtrapolationLUT = MicroGMTExtrapolationLUTFactory::create(
188  microGMTParamsHelper->fEtaExtrapolationLUT(), l1t::MicroGMTConfiguration::ETA_OUT, fwVersion);
189 
190  m_boPosMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(
191  microGMTParamsHelper->bOPosMatchQualLUT(), cancel_t::omtf_bmtf_pos, fwVersion);
192  m_boNegMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(
193  microGMTParamsHelper->bONegMatchQualLUT(), cancel_t::omtf_bmtf_neg, fwVersion);
194  m_foPosMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(
195  microGMTParamsHelper->fOPosMatchQualLUT(), cancel_t::omtf_emtf_pos, fwVersion);
196  m_foNegMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(
197  microGMTParamsHelper->fONegMatchQualLUT(), cancel_t::omtf_emtf_neg, fwVersion);
198  //m_brlSingleMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(microGMTParamsHelper->brlSingleMatchQualLUT(), cancel_t::bmtf_bmtf, fwVersion);
199  m_ovlPosSingleMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(
200  microGMTParamsHelper->ovlPosSingleMatchQualLUT(), cancel_t::omtf_omtf_pos, fwVersion);
201  m_ovlNegSingleMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(
202  microGMTParamsHelper->ovlNegSingleMatchQualLUT(), cancel_t::omtf_omtf_neg, fwVersion);
203  m_fwdPosSingleMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(
204  microGMTParamsHelper->fwdPosSingleMatchQualLUT(), cancel_t::emtf_emtf_pos, fwVersion);
205  m_fwdNegSingleMatchQualLUT = l1t::MicroGMTMatchQualLUTFactory::create(
206  microGMTParamsHelper->fwdNegSingleMatchQualLUT(), cancel_t::emtf_emtf_neg, fwVersion);
207 }
208 
209 // ------------ method called when ending to processes a run ------------
211 
212 //define this as a plug-in
L1TMicroGMTLUTDumper::m_fPhiExtrapolationLUT
std::shared_ptr< MicroGMTExtrapolationLUT > m_fPhiExtrapolationLUT
Definition: L1TMicroGMTLUTDumper.cc:81
Ecal2004TBTDCRanges_v1_cff.endRun
endRun
Definition: Ecal2004TBTDCRanges_v1_cff.py:4
amcDumpToRaw_cfi.fwVersion
fwVersion
Definition: amcDumpToRaw_cfi.py:11
L1TMicroGMTLUTDumper::dumpLut
void dumpLut(MicroGMTLUT *, const std::string &)
Definition: L1TMicroGMTLUTDumper.cc:123
l1t::emtf_emtf_pos
Definition: MicroGMTMatchQualLUT.h:16
EDAnalyzer.h
L1TMicroGMTLUTDumper::m_foldername
std::string m_foldername
Definition: L1TMicroGMTLUTDumper.cc:69
L1TMicroGMTLUTDumper::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: L1TMicroGMTLUTDumper.cc:155
L1TMicroGMTLUTDumper::m_foPosMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_foPosMatchQualLUT
Definition: L1TMicroGMTLUTDumper.cc:88
MessageLogger.h
L1TMicroGMTLUTDumper::m_foNegMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_foNegMatchQualLUT
Definition: L1TMicroGMTLUTDumper.cc:89
l1t::MicroGMTConfiguration::PHI
Definition: MicroGMTConfiguration.h:22
L1TMicroGMTLUTDumper::m_rankLUT
std::shared_ptr< MicroGMTRankPtQualLUT > m_rankLUT
Definition: L1TMicroGMTLUTDumper.cc:71
ESHandle.h
L1TMicroGMTLUTDumper::m_bPhiExtrapolationLUT
std::shared_ptr< MicroGMTExtrapolationLUT > m_bPhiExtrapolationLUT
Definition: L1TMicroGMTLUTDumper.cc:79
l1t::MicroGMTAbsoluteIsolationCheckLUTFactory::create
static ReturnType create(const std::string &filename, const int fwVersion)
Definition: MicroGMTAbsoluteIsolationCheckLUTFactory.cc:18
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
L1TMicroGMTLUTDumper::m_oEtaExtrapolationLUT
std::shared_ptr< MicroGMTExtrapolationLUT > m_oEtaExtrapolationLUT
Definition: L1TMicroGMTLUTDumper.cc:83
L1TMicroGMTLUTDumper::m_fEtaExtrapolationLUT
std::shared_ptr< MicroGMTExtrapolationLUT > m_fEtaExtrapolationLUT
Definition: L1TMicroGMTLUTDumper.cc:84
L1TMicroGMTLUTDumper::m_oPhiExtrapolationLUT
std::shared_ptr< MicroGMTExtrapolationLUT > m_oPhiExtrapolationLUT
Definition: L1TMicroGMTLUTDumper.cc:80
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
L1TMicroGMTLUTDumper::m_absIsoCheckMemLUT
std::shared_ptr< MicroGMTAbsoluteIsolationCheckLUT > m_absIsoCheckMemLUT
Definition: L1TMicroGMTLUTDumper.cc:73
L1TMicroGMTLUTDumper::m_relIsoCheckMemLUT
std::shared_ptr< MicroGMTRelativeIsolationCheckLUT > m_relIsoCheckMemLUT
Definition: L1TMicroGMTLUTDumper.cc:74
L1TMicroGMTLUTDumper::~L1TMicroGMTLUTDumper
~L1TMicroGMTLUTDumper() override
Definition: L1TMicroGMTLUTDumper.cc:115
L1TMicroGMTLUTDumper::m_ovlNegSingleMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_ovlNegSingleMatchQualLUT
Definition: L1TMicroGMTLUTDumper.cc:92
L1TMicroGMTLUTDumper::m_fwdPosSingleMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_fwdPosSingleMatchQualLUT
Definition: L1TMicroGMTLUTDumper.cc:93
l1t::MicroGMTCaloIndexSelectionLUTFactory::create
static ReturnType create(const std::string &filename, const int type, const int fwVersion)
Definition: MicroGMTCaloIndexSelectionLUTFactory.cc:18
MicroGMTRankPtQualLUT.h
l1t::MicroGMTLUT::save
void save(std::ofstream &output)
Definition: MicroGMTLUT.cc:13
MakerMacros.h
l1t::MicroGMTRankPtQualLUTFactory::create
static ReturnType create(const std::string &filename, const int fwVersion, const unsigned ptFactor, const unsigned qualFactor)
Definition: MicroGMTRankPtQualLUTFactory.cc:18
l1t::MicroGMTExtrapolationLUTFactory::create
static ReturnType create(const std::string &filename, const int type, const int fwVersion)
Definition: MicroGMTExtrapolationLUTFactory.cc:18
L1TMicroGMTLUTDumper::L1TMicroGMTLUTDumper
L1TMicroGMTLUTDumper(const edm::ParameterSet &)
Definition: L1TMicroGMTLUTDumper.cc:108
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
L1TMicroGMTLUTDumper::m_boNegMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_boNegMatchQualLUT
Definition: L1TMicroGMTLUTDumper.cc:87
l1t::emtf_emtf_neg
Definition: MicroGMTMatchQualLUT.h:20
edm::ESHandle
Definition: DTSurvey.h:22
l1t::MicroGMTRelativeIsolationCheckLUTFactory::create
static ReturnType create(const std::string &filename, const int fwVersion)
Definition: MicroGMTRelativeIsolationCheckLUTFactory.cc:18
MicroGMTExtrapolationLUT.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
l1t::omtf_omtf_neg
Definition: MicroGMTMatchQualLUT.h:19
Event.h
l1t
delete x;
Definition: CaloConfig.h:22
MicroGMTLUTFactories.h
L1TMuonGlobalParams.h
l1t::MicroGMTConfiguration::ETA_OUT
Definition: MicroGMTConfiguration.h:31
L1TMicroGMTLUTDumper::m_fwdNegSingleMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_fwdNegSingleMatchQualLUT
Definition: L1TMicroGMTLUTDumper.cc:94
l1t::MicroGMTLUT
Definition: MicroGMTLUT.h:14
MicroGMTRelativeIsolationCheckLUT.h
L1TMicroGMTLUTDumper::m_bEtaExtrapolationLUT
std::shared_ptr< MicroGMTExtrapolationLUT > m_bEtaExtrapolationLUT
Definition: L1TMicroGMTLUTDumper.cc:82
MicroGMTAbsoluteIsolationCheckLUT.h
iEvent
int iEvent
Definition: GenABIO.cc:224
MicroGMTMatchQualLUT.h
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
MicroGMTCaloIndexSelectionLUT.h
L1TMicroGMTLUTDumper::m_idxSelMemEtaLUT
std::shared_ptr< MicroGMTCaloIndexSelectionLUT > m_idxSelMemEtaLUT
Definition: L1TMicroGMTLUTDumper.cc:77
l1t::omtf_omtf_pos
Definition: MicroGMTMatchQualLUT.h:15
edm::EventSetup
Definition: EventSetup.h:57
L1TMicroGMTLUTDumper::m_idxSelMemPhiLUT
std::shared_ptr< MicroGMTCaloIndexSelectionLUT > m_idxSelMemPhiLUT
Definition: L1TMicroGMTLUTDumper.cc:76
L1TMuonGlobalParamsRcd
Definition: L1TMuonGlobalParamsRcd.h:23
l1t::MicroGMTMatchQualLUTFactory::create
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)
Definition: MicroGMTMatchQualLUTFactory.cc:18
l1t::omtf_bmtf_neg
Definition: MicroGMTMatchQualLUT.h:17
L1TMuonGlobalParamsHelper.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
writedatasetfile.run
run
Definition: writedatasetfile.py:27
l1t::omtf_bmtf_pos
Definition: MicroGMTMatchQualLUT.h:13
Frameworkfwd.h
l1t::omtf_emtf_pos
Definition: MicroGMTMatchQualLUT.h:14
L1TMicroGMTLUTDumper
Definition: L1TMicroGMTLUTDumper.cc:55
EventSetup.h
Exception.h
l1t::omtf_emtf_neg
Definition: MicroGMTMatchQualLUT.h:18
edm::eventsetup::EventSetupRecordImplementation::get
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
Definition: EventSetupRecordImplementation.h:74
L1TMicroGMTLUTDumper::m_ovlPosSingleMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_ovlPosSingleMatchQualLUT
Definition: L1TMicroGMTLUTDumper.cc:91
L1TMicroGMTLUTDumper::endRun
void endRun(edm::Run const &, edm::EventSetup const &) override
Definition: L1TMicroGMTLUTDumper.cc:210
ParameterSet.h
edm::Event
Definition: Event.h:73
L1TMicroGMTLUTDumper::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: L1TMicroGMTLUTDumper.cc:130
L1TMuonGlobalParamsRcd.h
L1TMicroGMTLUTDumper::microGMTParamsHelper
std::unique_ptr< L1TMuonGlobalParamsHelper > microGMTParamsHelper
Definition: L1TMicroGMTLUTDumper.cc:68
l1t::MicroGMTConfiguration::PHI_OUT
Definition: MicroGMTConfiguration.h:31
l1t::MicroGMTConfiguration::ETA
Definition: MicroGMTConfiguration.h:23
L1TMicroGMTLUTDumper::m_boPosMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_boPosMatchQualLUT
Definition: L1TMicroGMTLUTDumper.cc:86