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