CMS 3D CMS Logo

L1GtRunSettingsViewer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1GtRunSettingsViewer
4 // Class: L1GtRunSettingsViewer
5 //
13 //
14 // Original Author: Werner Man-Li Sun
15 // Created: Thu May 19 04:32:54 CEST 2011
16 //
17 //
18 
19 // system include files
20 #include <iostream>
21 #include <memory>
22 #include <sstream>
23 
24 // user include files
27 
32 
34 
39 
48 
51 
52 //
53 // class decleration
54 //
55 
57 public:
59  ~L1GtRunSettingsViewer() override;
60 
61 private:
62  void beginJob() override;
63  void analyze(const edm::Event&, const edm::EventSetup&) override;
64  void endJob() override;
65 
66  // ----------member data ---------------------------
72 };
73 
74 //
75 // constants, enums and typedefs
76 //
77 
78 //
79 // static data member definitions
80 //
81 
82 //
83 // constructors and destructor
84 //
86  : m_prescalesKey(iConfig.getParameter<std::string>("prescalesKey")),
87  m_maskAlgoKey(iConfig.getParameter<std::string>("maskAlgoKey")),
88  m_maskTechKey(iConfig.getParameter<std::string>("maskTechKey")),
89  m_maskVetoAlgoKey(iConfig.getParameter<std::string>("maskVetoAlgoKey")),
90  m_maskVetoTechKey(iConfig.getParameter<std::string>("maskVetoTechKey")) {
91  //now do what ever initialization is needed
92 }
93 
95  // do anything here that needs to be done at desctruction time
96  // (e.g. close files, deallocate resources etc.)
97 }
98 
99 //
100 // member functions
101 //
102 
103 // ------------ method called to for each event ------------
105  using namespace edm;
106 
107  // Utility class
108  l1t::DataWriter dataWriter;
109 
110  // Get most recent L1TriggerKeyList
111  L1TriggerKeyList keyList;
112  dataWriter.fillLastTriggerKeyList(keyList);
113 
114  // For the given GTRS key, find the corresponding payload tokens.
115  // Use the payload tokens to retrieve the corresponding objects.
116  // Call the print functions for these objects.
117 
118  if (!m_prescalesKey.empty()) {
119  std::string pfAlgoToken = keyList.token("L1GtPrescaleFactorsAlgoTrigRcd", "L1GtPrescaleFactors", m_prescalesKey);
120  if (pfAlgoToken.empty()) {
121  edm::LogError("L1-O2O") << "No payload for L1GtPrescaleFactorsAlgoTrigRcd with key " << m_prescalesKey;
122  } else {
124  dataWriter.readObject(pfAlgoToken, pfAlgo);
125  pfAlgo.print(std::cout);
126  }
127 
128  std::string pfTechToken = keyList.token("L1GtPrescaleFactorsTechTrigRcd", "L1GtPrescaleFactors", m_prescalesKey);
129  if (pfTechToken.empty()) {
130  edm::LogError("L1-O2O") << "No payload for L1GtPrescaleFactorsTechTrigRcd with key " << m_prescalesKey;
131  } else {
132  L1GtPrescaleFactors pfTech;
133  dataWriter.readObject(pfTechToken, pfTech);
134  pfTech.print(std::cout);
135  }
136  }
137 
138  if (!m_maskAlgoKey.empty()) {
139  std::string token = keyList.token("L1GtTriggerMaskAlgoTrigRcd", "L1GtTriggerMask", m_maskAlgoKey);
140  if (token.empty()) {
141  edm::LogError("L1-O2O") << "No payload for L1GtTriggerMaskAlgoTrigRcd with key " << m_maskAlgoKey;
142  } else {
144  dataWriter.readObject(token, mask);
145  mask.print(std::cout);
146  }
147  }
148 
149  if (!m_maskTechKey.empty()) {
150  std::string token = keyList.token("L1GtTriggerMaskTechTrigRcd", "L1GtTriggerMask", m_maskTechKey);
151  if (token.empty()) {
152  edm::LogError("L1-O2O") << "No payload for L1GtTriggerMaskTechTrigRcd with key " << m_maskTechKey;
153  } else {
155  dataWriter.readObject(token, mask);
156  mask.print(std::cout);
157  }
158  }
159 
160  if (!m_maskVetoAlgoKey.empty()) {
161  std::string token = keyList.token("L1GtTriggerMaskVetoAlgoTrigRcd", "L1GtTriggerMask", m_maskVetoAlgoKey);
162  if (token.empty()) {
163  edm::LogError("L1-O2O") << "No payload for L1GtTriggerMaskVetoAlgoTrigRcd with key " << m_maskVetoAlgoKey;
164  } else {
166  dataWriter.readObject(token, mask);
167  mask.print(std::cout);
168  }
169  }
170 
171  if (!m_maskVetoTechKey.empty()) {
172  std::string token = keyList.token("L1GtTriggerMaskVetoTechTrigRcd", "L1GtTriggerMask", m_maskVetoTechKey);
173  if (token.empty()) {
174  edm::LogError("L1-O2O") << "No payload for L1GtTriggerMaskVetoTechTrigRcd with key " << m_maskVetoTechKey;
175  } else {
177  dataWriter.readObject(token, mask);
178  mask.print(std::cout);
179  }
180  }
181 }
182 
183 // ------------ method called once each job just before starting event loop ------------
185 
186 // ------------ method called once each job just after ending the event loop ------------
188 
189 //define this as a plug-in
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::string token(const std::string &tscKey) const
Log< level::Error, false > LogError
constexpr uint32_t mask
Definition: gpuClustering.h:24
int iEvent
Definition: GenABIO.cc:224
bool fillLastTriggerKeyList(L1TriggerKeyList &output)
Definition: DataWriter.cc:147
void readObject(const std::string &payloadToken, T &outputObject)
Definition: DataWriter.h:72
void analyze(const edm::Event &, const edm::EventSetup &) override
void print(std::ostream &) const
print the prescale factors
HLT enums.
L1GtRunSettingsViewer(const edm::ParameterSet &)