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