CMS 3D CMS Logo

GtInputDump.cc
Go to the documentation of this file.
1 
12 //
13 // This simple module simply retreives the YellowParams object from the event
14 // setup, and sends its payload as an INFO message, for debugging purposes.
15 //
16 
18 
19 //#include "FWCore/ParameterSet/interface/InputTag.h"
20 
21 // system include files
22 #include <iomanip>
23 
24 // user include files
25 // base class
27 
34 
40 
43 
44 using namespace edm;
45 using namespace std;
46 
47 namespace l1t {
48 
49  // class declaration
50  class GtInputDump : public edm::one::EDAnalyzer<> {
51  public:
52  explicit GtInputDump(const edm::ParameterSet&);
53  ~GtInputDump() override{};
54  void analyze(const edm::Event&, const edm::EventSetup&) override;
55 
61 
62  int m_minBx;
63  int m_maxBx;
64  };
65 
66  GtInputDump::GtInputDump(const edm::ParameterSet& iConfig) {
67  egToken = consumes<BXVector<l1t::EGamma>>(iConfig.getParameter<InputTag>("egInputTag"));
68  muToken = consumes<BXVector<l1t::Muon>>(iConfig.getParameter<InputTag>("muInputTag"));
69  tauToken = consumes<BXVector<l1t::Tau>>(iConfig.getParameter<InputTag>("tauInputTag"));
70  jetToken = consumes<BXVector<l1t::Jet>>(iConfig.getParameter<InputTag>("jetInputTag"));
71  etsumToken = consumes<BXVector<l1t::EtSum>>(iConfig.getParameter<InputTag>("etsumInputTag"));
72 
73  m_minBx = iConfig.getParameter<int>("minBx");
74  m_maxBx = iConfig.getParameter<int>("maxBx");
75  }
76 
77  // loop over events
78  void GtInputDump::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
79  //inputs
81  iEvent.getByToken(egToken, egammas);
82 
84  iEvent.getByToken(muToken, muons);
85 
87  iEvent.getByToken(tauToken, taus);
88 
90  iEvent.getByToken(jetToken, jets);
91 
93  iEvent.getByToken(etsumToken, etsums);
94 
95  printf("\n -------------------------------------- \n");
96  printf(" *********** New Event ************** \n");
97  printf(" -------------------------------------- \n");
98  //Loop over BX
99  //Loop over BX
100  for (int i = m_minBx; i <= m_maxBx; ++i) {
101  cout << " ========== BX = " << std::dec << i << " =============================" << endl;
102 
103  //Loop over EGamma
104  int nObj = 0;
105  cout << " ------ EGammas -------- " << endl;
106  if (egammas.isValid()) {
107  if (i >= egammas->getFirstBX() && i <= egammas->getLastBX()) {
108  for (std::vector<l1t::EGamma>::const_iterator eg = egammas->begin(i); eg != egammas->end(i); ++eg) {
109  cout << " " << std::dec << std::setw(2) << std::setfill(' ') << nObj << std::setfill('0') << ")";
110  cout << " Pt " << std::dec << std::setw(3) << eg->hwPt() << " (0x" << std::hex << std::setw(3)
111  << std::setfill('0') << eg->hwPt() << ")";
112  cout << " Eta " << std::dec << std::setw(3) << eg->hwEta() << " (0x" << std::hex << std::setw(2)
113  << std::setfill('0') << (eg->hwEta() & 0xff) << ")";
114  cout << " Phi " << std::dec << std::setw(3) << eg->hwPhi() << " (0x" << std::hex << std::setw(2)
115  << std::setfill('0') << eg->hwPhi() << ")";
116  cout << " Iso " << std::dec << std::setw(1) << eg->hwIso();
117  cout << " Qual " << std::dec << std::setw(1) << eg->hwQual();
118  cout << endl;
119  nObj++;
120  }
121  } else {
122  cout << "No EG stored for this bx " << i << endl;
123  }
124  } else {
125  cout << "No EG Data in this event " << endl;
126  }
127 
128  //Loop over Muons
129  nObj = 0;
130  cout << " ------ Muons --------" << endl;
131  if (muons.isValid()) {
132  if (i >= muons->getFirstBX() && i <= muons->getLastBX()) {
133  for (std::vector<l1t::Muon>::const_iterator mu = muons->begin(i); mu != muons->end(i); ++mu) {
134  cout << " " << std::dec << std::setw(2) << std::setfill(' ') << nObj << std::setfill('0') << ")";
135  cout << " Pt " << std::dec << std::setw(3) << mu->hwPt() << " (0x" << std::hex << std::setw(3)
136  << std::setfill('0') << mu->hwPt() << ")";
137  cout << " EtaAtVtx " << std::dec << std::setw(3) << mu->hwEtaAtVtx() << " (0x" << std::hex << std::setw(3)
138  << std::setfill('0') << (mu->hwEtaAtVtx() & 0x1ff) << ")";
139  cout << " Eta " << std::dec << std::setw(3) << mu->hwEta() << " (0x" << std::hex << std::setw(3)
140  << std::setfill('0') << (mu->hwEta() & 0x1ff) << ")";
141  cout << " PhiAtVtx " << std::dec << std::setw(3) << mu->hwPhiAtVtx() << " (0x" << std::hex << std::setw(3)
142  << std::setfill('0') << mu->hwPhiAtVtx() << ")";
143  cout << " Phi " << std::dec << std::setw(3) << mu->hwPhi() << " (0x" << std::hex << std::setw(3)
144  << std::setfill('0') << mu->hwPhi() << ")";
145  cout << " Iso " << std::dec << std::setw(1) << mu->hwIso();
146  cout << " Qual " << std::dec << std::setw(1) << mu->hwQual();
147  cout << endl;
148  nObj++;
149  }
150  } else {
151  cout << "No Muons stored for this bx " << i << endl;
152  }
153  } else {
154  cout << "No Muon Data in this event " << endl;
155  }
156 
157  //Loop over Taus
158  nObj = 0;
159  cout << " ------ Taus ----------" << endl;
160  if (taus.isValid()) {
161  if (i >= taus->getFirstBX() && i <= taus->getLastBX()) {
162  for (std::vector<l1t::Tau>::const_iterator tau = taus->begin(i); tau != taus->end(i); ++tau) {
163  cout << " " << std::dec << std::setw(2) << std::setfill(' ') << nObj << std::setfill('0') << ")";
164  cout << " Pt " << std::dec << std::setw(3) << tau->hwPt() << " (0x" << std::hex << std::setw(3)
165  << std::setfill('0') << tau->hwPt() << ")";
166  cout << " Eta " << std::dec << std::setw(3) << tau->hwEta() << " (0x" << std::hex << std::setw(2)
167  << std::setfill('0') << (tau->hwEta() & 0xff) << ")";
168  cout << " Phi " << std::dec << std::setw(3) << tau->hwPhi() << " (0x" << std::hex << std::setw(2)
169  << std::setfill('0') << tau->hwPhi() << ")";
170  cout << " Iso " << std::dec << std::setw(1) << tau->hwIso();
171  cout << " Qual " << std::dec << std::setw(1) << tau->hwQual();
172  cout << endl;
173  nObj++;
174  }
175  } else {
176  cout << "No Taus stored for this bx " << i << endl;
177  }
178  } else {
179  cout << "No Tau Data in this event " << endl;
180  }
181 
182  //Loop over Jets
183  nObj = 0;
184  cout << " ------ Jets ----------" << endl;
185  if (jets.isValid()) {
186  if (i >= jets->getFirstBX() && i <= jets->getLastBX()) {
187  for (std::vector<l1t::Jet>::const_iterator jet = jets->begin(i); jet != jets->end(i); ++jet) {
188  cout << " " << std::dec << std::setw(2) << std::setfill(' ') << nObj << std::setfill('0') << ")";
189  cout << " Pt " << std::dec << std::setw(3) << jet->hwPt() << " (0x" << std::hex << std::setw(3)
190  << std::setfill('0') << jet->hwPt() << ")";
191  cout << " Eta " << std::dec << std::setw(3) << jet->hwEta() << " (0x" << std::hex << std::setw(2)
192  << std::setfill('0') << (jet->hwEta() & 0xff) << ")";
193  cout << " Phi " << std::dec << std::setw(3) << jet->hwPhi() << " (0x" << std::hex << std::setw(2)
194  << std::setfill('0') << jet->hwPhi() << ")";
195  cout << " Qual " << std::dec << std::setw(1) << jet->hwQual();
196  cout << endl;
197  nObj++;
198  }
199  } else {
200  cout << "No Jets stored for this bx " << i << endl;
201  }
202  } else {
203  cout << "No jet Data in this event " << endl;
204  }
205 
206  //Dump Content
207  cout << " ------ EtSums ----------" << endl;
208  if (etsums.isValid()) {
209  if (i >= etsums->getFirstBX() && i <= etsums->getLastBX()) {
210  for (std::vector<l1t::EtSum>::const_iterator etsum = etsums->begin(i); etsum != etsums->end(i); ++etsum) {
211  switch (etsum->getType()) {
213  cout << " ETM: ";
214  break;
216  cout << " HTM: ";
217  break;
219  cout << " ETT: ";
220  break;
222  cout << " HTT: ";
223  break;
224  default:
225  cout << " Unknown: ";
226  break;
227  }
228  cout << " Et " << std::dec << std::setw(3) << etsum->hwPt() << " (0x" << std::hex << std::setw(3)
229  << std::setfill('0') << etsum->hwPt() << ")";
230  if (etsum->getType() == l1t::EtSum::EtSumType::kMissingEt ||
231  etsum->getType() == l1t::EtSum::EtSumType::kMissingHt)
232  cout << " Phi " << std::dec << std::setw(3) << etsum->hwPhi() << " (0x" << std::hex << std::setw(2)
233  << std::setfill('0') << etsum->hwPhi() << ")";
234  cout << endl;
235  }
236  } else {
237  cout << "No EtSums stored for this bx " << i << endl;
238  }
239  } else {
240  cout << "No EtSum Data in this event " << endl;
241  }
242  }
243  printf("\n");
244  }
245 
246 } // namespace l1t
247 
EDGetToken muToken
Definition: GtInputDump.cc:57
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EDGetToken jetToken
Definition: GtInputDump.cc:59
delete x;
Definition: CaloConfig.h:22
~GtInputDump() override
Definition: GtInputDump.cc:53
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool isValid() const
Definition: HandleBase.h:70
HLT enums.
EDGetToken egToken
Definition: GtInputDump.cc:56
EDGetToken tauToken
Definition: GtInputDump.cc:58
EDGetToken etsumToken
Definition: GtInputDump.cc:60