CMS 3D CMS Logo

L1TUtmTriggerMenuDumper.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // L1TUtmTriggerMenuDumper: Dump the menu to screen...
4 //
5 
6 #include <iostream>
7 #include <unistd.h>
8 #include <cstdio>
9 #include <cstdlib>
10 
11 #include "tmEventSetup/tmEventSetup.hh"
12 #include "tmEventSetup/esTriggerMenu.hh"
13 #include "tmEventSetup/esAlgorithm.hh"
14 #include "tmEventSetup/esCondition.hh"
15 #include "tmEventSetup/esObject.hh"
16 #include "tmEventSetup/esCut.hh"
17 #include "tmEventSetup/esScale.hh"
18 #include "tmGrammar/Algorithm.hh"
19 
27 
30 
31 using namespace edm;
32 using namespace std;
33 using namespace tmeventsetup;
34 
36 public:
37  explicit L1TUtmTriggerMenuDumper(const ParameterSet&);
38  ~L1TUtmTriggerMenuDumper() override;
39 
40  static void fillDescriptions(ConfigurationDescriptions& descriptions);
41 
42 private:
43  void beginJob() override;
44  void analyze(Event const&, EventSetup const&) override;
45  void endJob() override;
46 
47  void beginRun(Run const&, EventSetup const&) override;
48  void endRun(Run const&, EventSetup const&) override;
49  void beginLuminosityBlock(LuminosityBlock const&, EventSetup const&) override;
50  void endLuminosityBlock(LuminosityBlock const&, EventSetup const&) override;
51 };
52 
54 
56 
58 
59 void L1TUtmTriggerMenuDumper::beginJob() { cout << "INFO: L1TUtmTriggerMenuDumper module beginJob called.\n"; }
60 
61 void L1TUtmTriggerMenuDumper::endJob() { cout << "INFO: L1TUtmTriggerMenuDumper module endJob called.\n"; }
62 
63 void L1TUtmTriggerMenuDumper::beginRun(Run const& run, EventSetup const& iSetup) {
65  iSetup.get<L1TUtmTriggerMenuRcd>().get(hmenu);
66  const esTriggerMenu* menu = reinterpret_cast<const esTriggerMenu*>(hmenu.product());
67 
68  const std::map<std::string, esAlgorithm>& algoMap = menu->getAlgorithmMap();
69  const std::map<std::string, esCondition>& condMap = menu->getConditionMap();
70  const std::map<std::string, esScale>& scaleMap = menu->getScaleMap();
71 
72  bool hasPrecision = false;
73  std::map<std::string, unsigned int> precisions;
74  getPrecisions(precisions, scaleMap);
75  for (std::map<std::string, unsigned int>::const_iterator cit = precisions.begin(); cit != precisions.end(); cit++) {
76  std::cout << cit->first << " = " << cit->second << "\n";
77  hasPrecision = true;
78  }
79 
80  if (hasPrecision) {
81  std::map<std::string, esScale>::iterator it1, it2;
82  const esScale* scale1 = &scaleMap.find("EG-ETA")->second;
83  const esScale* scale2 = &scaleMap.find("MU-ETA")->second;
84 
85  std::vector<long long> lut_eg_2_mu_eta;
86  getCaloMuonEtaConversionLut(lut_eg_2_mu_eta, scale1, scale2);
87 
88  scale1 = &scaleMap.find("EG-PHI")->second;
89  scale2 = &scaleMap.find("MU-PHI")->second;
90 
91  std::vector<long long> lut_eg_2_mu_phi;
92  getCaloMuonPhiConversionLut(lut_eg_2_mu_phi, scale1, scale2);
93 
94  scale1 = &scaleMap.find("EG-ETA")->second;
95  scale2 = &scaleMap.find("MU-ETA")->second;
96 
97  std::vector<double> eg_mu_delta_eta;
98  std::vector<long long> lut_eg_mu_delta_eta;
99  size_t n = getDeltaVector(eg_mu_delta_eta, scale1, scale2);
100  setLut(lut_eg_mu_delta_eta, eg_mu_delta_eta, precisions["PRECISION-EG-MU-Delta"]);
101 
102  std::vector<long long> lut_eg_mu_cosh;
103  applyCosh(eg_mu_delta_eta, n);
104  setLut(lut_eg_mu_cosh, eg_mu_delta_eta, precisions["PRECISION-EG-MU-Math"]);
105 
106  scale1 = &scaleMap.find("EG-PHI")->second;
107  scale2 = &scaleMap.find("MU-PHI")->second;
108 
109  std::vector<double> eg_mu_delta_phi;
110  std::vector<long long> lut_eg_mu_delta_phi;
111  n = getDeltaVector(eg_mu_delta_phi, scale1, scale2);
112  setLut(lut_eg_mu_delta_phi, eg_mu_delta_phi, precisions["PRECISION-EG-MU-Delta"]);
113 
114  std::vector<long long> lut_eg_mu_cos;
115  applyCos(eg_mu_delta_phi, n);
116  setLut(lut_eg_mu_cos, eg_mu_delta_phi, precisions["PRECISION-EG-MU-Math"]);
117 
118  scale1 = &scaleMap.find("EG-ET")->second;
119  std::vector<long long> lut_eg_et;
120  getLut(lut_eg_et, scale1, precisions["PRECISION-EG-MU-MassPt"]);
121 
122  scale1 = &scaleMap.find("MU-ET")->second;
123  std::vector<long long> lut_mu_et;
124  getLut(lut_mu_et, scale1, precisions["PRECISION-EG-MU-MassPt"]);
125  for (size_t ii = 0; ii < lut_mu_et.size(); ii++) {
126  std::cout << lut_mu_et.at(ii) << "\n";
127  }
128  }
129 
130  for (std::map<std::string, esAlgorithm>::const_iterator cit = algoMap.begin(); cit != algoMap.end(); cit++) {
131  const esAlgorithm& algo = cit->second;
132  std::cout << "algo name = " << algo.getName() << "\n";
133  std::cout << "algo exp. = " << algo.getExpression() << "\n";
134  std::cout << "algo exp. in cond. = " << algo.getExpressionInCondition() << "\n";
135 
136  const std::vector<std::string>& rpn_vec = algo.getRpnVector();
137  for (size_t ii = 0; ii < rpn_vec.size(); ii++) {
138  const std::string& token = rpn_vec.at(ii);
139  if (Algorithm::isGate(token))
140  continue;
141  const esCondition& condition = condMap.find(token)->second;
142  std::cout << " cond type = " << condition.getType() << "\n";
143 
144  const std::vector<esCut>& cuts = condition.getCuts();
145  for (size_t jj = 0; jj < cuts.size(); jj++) {
146  const esCut& cut = cuts.at(jj);
147  std::cout << " cut name = " << cut.getName() << "\n";
148  std::cout << " cut target = " << cut.getObjectType() << "\n";
149  std::cout << " cut type = " << cut.getCutType() << "\n";
150  std::cout << " cut min. value index = " << cut.getMinimum().value << " " << cut.getMinimum().index << "\n";
151  std::cout << " cut max. value index = " << cut.getMaximum().value << " " << cut.getMaximum().index << "\n";
152  std::cout << " cut data = " << cut.getData() << "\n";
153  }
154 
155  const std::vector<esObject>& objects = condition.getObjects();
156  for (size_t jj = 0; jj < objects.size(); jj++) {
157  const esObject& object = objects.at(jj);
158  std::cout << " obj name = " << object.getName() << "\n";
159  std::cout << " obj type = " << object.getType() << "\n";
160  std::cout << " obj op = " << object.getComparisonOperator() << "\n";
161  std::cout << " obj bx = " << object.getBxOffset() << "\n";
162  if (object.getType() == esObjectType::EXT) {
163  std::cout << " ext name = " << object.getExternalSignalName() << "\n";
164  std::cout << " ext ch id = " << object.getExternalChannelId() << "\n";
165  }
166 
167  const std::vector<esCut>& cuts = object.getCuts();
168  for (size_t kk = 0; kk < cuts.size(); kk++) {
169  const esCut& cut = cuts.at(kk);
170  std::cout << " cut name = " << cut.getName() << "\n";
171  std::cout << " cut target = " << cut.getObjectType() << "\n";
172  std::cout << " cut type = " << cut.getCutType() << "\n";
173  std::cout << " cut min. value index = " << cut.getMinimum().value << " " << cut.getMinimum().index
174  << "\n";
175  std::cout << " cut max. value index = " << cut.getMaximum().value << " " << cut.getMaximum().index
176  << "\n";
177  std::cout << " cut data = " << cut.getData() << "\n";
178  }
179  }
180  }
181  }
182 }
183 
185 
187 
189 
191  //The following says we do not know what parameters are allowed so do no validation
192  // Please change this to state exactly what you do use, even if it is no parameters
194  desc.setUnknown();
195  descriptions.addDefault(desc);
196 }
197 
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
Ecal2004TBTDCRanges_v1_cff.endRun
endRun
Definition: Ecal2004TBTDCRanges_v1_cff.py:4
bk::beginJob
void beginJob()
Definition: Breakpoints.cc:14
L1TUtmTriggerMenuDumper::analyze
void analyze(Event const &, EventSetup const &) override
Definition: L1TUtmTriggerMenuDumper.cc:57
L1TUtmTriggerMenuRcd.h
MessageLogger.h
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
TkAlMuonSelectors_cfi.cut
cut
Definition: TkAlMuonSelectors_cfi.py:5
ESHandle.h
L1TUtmTriggerMenuRcd
Definition: L1TUtmTriggerMenuRcd.h:11
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
objects
Definition: __init__.py:1
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDAnalyzer.h
L1TUtmTriggerMenuDumper::fillDescriptions
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: L1TUtmTriggerMenuDumper.cc:190
edm::EDAnalyzer
Definition: EDAnalyzer.h:29
L1TUtmTriggerMenuDumper::endLuminosityBlock
void endLuminosityBlock(LuminosityBlock const &, EventSetup const &) override
Definition: L1TUtmTriggerMenuDumper.cc:188
cmsdt::algo
algo
Definition: constants.h:164
MakerMacros.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
L1TUtmTriggerMenuDumper::L1TUtmTriggerMenuDumper
L1TUtmTriggerMenuDumper(const ParameterSet &)
Definition: L1TUtmTriggerMenuDumper.cc:53
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
L1TUtmTriggerMenuDumper::endRun
void endRun(Run const &, EventSetup const &) override
Definition: L1TUtmTriggerMenuDumper.cc:184
L1TUtmTriggerMenuDumper::~L1TUtmTriggerMenuDumper
~L1TUtmTriggerMenuDumper() override
Definition: L1TUtmTriggerMenuDumper.cc:55
edm::ESHandle
Definition: DTSurvey.h:22
GetRecoTauVFromDQM_MC_cff.kk
kk
Definition: GetRecoTauVFromDQM_MC_cff.py:84
L1TUtmTriggerMenuDumper::beginLuminosityBlock
void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &) override
Definition: L1TUtmTriggerMenuDumper.cc:186
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1TUtmTriggerMenuDumper
Definition: L1TUtmTriggerMenuDumper.cc:35
L1TUtmTriggerMenu.h
optionsL1T.menu
menu
Definition: optionsL1T.py:29
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
edm::get
T const & get(Event const &event, InputTag const &tag) noexcept(false)
Definition: Event.h:669
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition: ParameterSetDescription.cc:39
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EventSetup
Definition: EventSetup.h:57
L1TUtmTriggerMenuDumper::beginRun
void beginRun(Run const &, EventSetup const &) override
Definition: L1TUtmTriggerMenuDumper.cc:63
goodZToMuMu_cfi.condition
condition
Definition: goodZToMuMu_cfi.py:37
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
L1TUtmTriggerMenuDumper::endJob
void endJob() override
Definition: L1TUtmTriggerMenuDumper.cc:61
findQualityFiles.jj
string jj
Definition: findQualityFiles.py:188
EventSetup.h
L1TMuonDQMOffline_cfi.cuts
cuts
Definition: L1TMuonDQMOffline_cfi.py:41
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
cuy.ii
ii
Definition: cuy.py:590
L1TUtmTriggerMenuDumper::beginJob
void beginJob() override
Definition: L1TUtmTriggerMenuDumper.cc:59
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316