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 <stdio.h>
9 #include <stdlib.h>
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 
20 
28 
29 
32 
33 using namespace edm;
34 using namespace std;
35 using namespace tmeventsetup;
36 
38 public:
39  explicit L1TUtmTriggerMenuDumper(const ParameterSet&);
41 
42  static void fillDescriptions(ConfigurationDescriptions& descriptions);
43 
44 private:
45  virtual void beginJob();
46  virtual void analyze(Event const&, EventSetup const&);
47  virtual void endJob();
48 
49  virtual void beginRun(Run const&, EventSetup const&);
50  virtual void endRun(Run const&, EventSetup const&);
51  virtual void beginLuminosityBlock(LuminosityBlock const&, EventSetup const&);
52  virtual void endLuminosityBlock(LuminosityBlock const&, EventSetup const&);
53 
54 
55 };
56 
58 
60 
61 
62 void
64 
65 void
67 {
68  cout << "INFO: L1TUtmTriggerMenuDumper module beginJob called.\n";
69 }
70 
71 void
73  cout << "INFO: L1TUtmTriggerMenuDumper module endJob called.\n";
74 }
75 
76 void
78 {
79 
81  iSetup.get<L1TUtmTriggerMenuRcd>().get(hmenu);
82  const esTriggerMenu* menu = reinterpret_cast<const esTriggerMenu*> (hmenu.product());
83 
84  const std::map<std::string, esAlgorithm>& algoMap = menu->getAlgorithmMap();
85  const std::map<std::string, esCondition>& condMap = menu->getConditionMap();
86  const std::map<std::string, esScale>& scaleMap = menu->getScaleMap();
87 
88  bool hasPrecision = false;
89  std::map<std::string, unsigned int> precisions;
90  getPrecisions(precisions, scaleMap);
91  for (std::map<std::string, unsigned int>::const_iterator cit = precisions.begin(); cit != precisions.end(); cit++)
92  {
93  std::cout << cit->first << " = " << cit->second << "\n";
94  hasPrecision = true;
95  }
96 
97 
98  if (hasPrecision)
99  {
100  std::map<std::string, esScale>::iterator it1, it2;
101  const esScale* scale1 = &scaleMap.find("EG-ETA")->second;
102  const esScale* scale2 = &scaleMap.find("MU-ETA")->second;
103 
104  std::vector<long long> lut_eg_2_mu_eta;
105  getCaloMuonEtaConversionLut(lut_eg_2_mu_eta, scale1, scale2);
106 
107 
108  scale1 = &scaleMap.find("EG-PHI")->second;
109  scale2 = &scaleMap.find("MU-PHI")->second;
110 
111  std::vector<long long> lut_eg_2_mu_phi;
112  getCaloMuonPhiConversionLut(lut_eg_2_mu_phi, scale1, scale2);
113 
114 
115  scale1 = &scaleMap.find("EG-ETA")->second;
116  scale2 = &scaleMap.find("MU-ETA")->second;
117 
118  std::vector<double> eg_mu_delta_eta;
119  std::vector<long long> lut_eg_mu_delta_eta;
120  size_t n = getDeltaVector(eg_mu_delta_eta, scale1, scale2);
121  setLut(lut_eg_mu_delta_eta, eg_mu_delta_eta, precisions["PRECISION-EG-MU-Delta"]);
122 
123  std::vector<long long> lut_eg_mu_cosh;
124  applyCosh(eg_mu_delta_eta, n);
125  setLut(lut_eg_mu_cosh, eg_mu_delta_eta, precisions["PRECISION-EG-MU-Math"]);
126 
127 
128  scale1 = &scaleMap.find("EG-PHI")->second;
129  scale2 = &scaleMap.find("MU-PHI")->second;
130 
131  std::vector<double> eg_mu_delta_phi;
132  std::vector<long long> lut_eg_mu_delta_phi;
133  n = getDeltaVector(eg_mu_delta_phi, scale1, scale2);
134  setLut(lut_eg_mu_delta_phi, eg_mu_delta_phi, precisions["PRECISION-EG-MU-Delta"]);
135 
136  std::vector<long long> lut_eg_mu_cos;
137  applyCos(eg_mu_delta_phi, n);
138  setLut(lut_eg_mu_cos, eg_mu_delta_phi, precisions["PRECISION-EG-MU-Math"]);
139 
140 
141  scale1 = &scaleMap.find("EG-ET")->second;
142  std::vector<long long> lut_eg_et;
143  getLut(lut_eg_et, scale1, precisions["PRECISION-EG-MU-MassPt"]);
144 
145 
146  scale1 = &scaleMap.find("MU-ET")->second;
147  std::vector<long long> lut_mu_et;
148  getLut(lut_mu_et, scale1, precisions["PRECISION-EG-MU-MassPt"]);
149  for (size_t ii = 0; ii < lut_mu_et.size(); ii++)
150  {
151  std::cout << lut_mu_et.at(ii) << "\n";
152  }
153  }
154 
155 
156  for (std::map<std::string, esAlgorithm>::const_iterator cit = algoMap.begin();
157  cit != algoMap.end(); cit++)
158  {
159  const esAlgorithm& algo = cit->second;
160  std::cout << "algo name = " << algo.getName() << "\n";
161  std::cout << "algo exp. = " << algo.getExpression() << "\n";
162  std::cout << "algo exp. in cond. = " << algo.getExpressionInCondition() << "\n";
163 
164  const std::vector<std::string>& rpn_vec = algo.getRpnVector();
165  for (size_t ii = 0; ii < rpn_vec.size(); ii++)
166  {
167  const std::string& token = rpn_vec.at(ii);
168  if (Algorithm::isGate(token)) continue;
169  const esCondition& condition = condMap.find(token)->second;
170  std::cout << " cond type = " << condition.getType() << "\n";
171 
172  const std::vector<esCut>& cuts = condition.getCuts();
173  for (size_t jj = 0; jj < cuts.size(); jj++)
174  {
175  const esCut& cut = cuts.at(jj);
176  std::cout << " cut name = " << cut.getName() << "\n";
177  std::cout << " cut target = " << cut.getObjectType() << "\n";
178  std::cout << " cut type = " << cut.getCutType() << "\n";
179  std::cout << " cut min. value index = " << cut.getMinimum().value << " " << cut.getMinimum().index << "\n";
180  std::cout << " cut max. value index = " << cut.getMaximum().value << " " << cut.getMaximum().index << "\n";
181  std::cout << " cut data = " << cut.getData() << "\n";
182  }
183 
184  const std::vector<esObject>& objects = condition.getObjects();
185  for (size_t jj = 0; jj < objects.size(); jj++)
186  {
187  const esObject& object = objects.at(jj);
188  std::cout << " obj name = " << object.getName() << "\n";
189  std::cout << " obj type = " << object.getType() << "\n";
190  std::cout << " obj op = " << object.getComparisonOperator() << "\n";
191  std::cout << " obj bx = " << object.getBxOffset() << "\n";
192  if (object.getType() == esObjectType::EXT)
193  {
194  std::cout << " ext name = " << object.getExternalSignalName() << "\n";
195  std::cout << " ext ch id = " << object.getExternalChannelId() << "\n";
196  }
197 
198  const std::vector<esCut>& cuts = object.getCuts();
199  for (size_t kk = 0; kk < cuts.size(); kk++)
200  {
201  const esCut& cut = cuts.at(kk);
202  std::cout << " cut name = " << cut.getName() << "\n";
203  std::cout << " cut target = " << cut.getObjectType() << "\n";
204  std::cout << " cut type = " << cut.getCutType() << "\n";
205  std::cout << " cut min. value index = " << cut.getMinimum().value << " " << cut.getMinimum().index << "\n";
206  std::cout << " cut max. value index = " << cut.getMaximum().value << " " << cut.getMaximum().index << "\n";
207  std::cout << " cut data = " << cut.getData() << "\n";
208  }
209  }
210  }
211  }
212 }
213 
214 void
216 {
217 }
218 
219 void
221 {
222 }
223 
224 void
226 {
227 }
228 
229 void
231  //The following says we do not know what parameters are allowed so do no validation
232  // Please change this to state exactly what you do use, even if it is no parameters
234  desc.setUnknown();
235  descriptions.addDefault(desc);
236 }
237 
238 
def analyze(function, filename, filter=None)
Definition: Profiling.py:11
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
static void fillDescriptions(ConfigurationDescriptions &descriptions)
void beginJob()
Definition: Breakpoints.cc:15
virtual void endRun(Run const &, EventSetup const &)
int iEvent
Definition: GenABIO.cc:230
void addDefault(ParameterSetDescription const &psetDescription)
L1TUtmTriggerMenuDumper(const ParameterSet &)
ii
Definition: cuy.py:588
virtual void beginRun(Run const &, EventSetup const &)
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &)
const T & get() const
Definition: EventSetup.h:56
virtual void analyze(Event const &, EventSetup const &)
HLT enums.
virtual void endLuminosityBlock(LuminosityBlock const &, EventSetup const &)
T const * product() const
Definition: ESHandle.h:86
Definition: Run.h:42