File indexing completed on 2024-09-07 04:36:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include "FWCore/Framework/interface/MakerMacros.h"
0018
0019
0020
0021
0022 #include <iomanip>
0023
0024
0025
0026 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0027
0028 #include "FWCore/Framework/interface/Event.h"
0029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0030 #include "FWCore/Utilities/interface/EDGetToken.h"
0031 #include "FWCore/Utilities/interface/InputTag.h"
0032 #include "FWCore/Framework/interface/EventSetup.h"
0033 #include "FWCore/Framework/interface/Frameworkfwd.h"
0034
0035 #include "DataFormats/L1Trigger/interface/EGamma.h"
0036 #include "DataFormats/L1Trigger/interface/Muon.h"
0037 #include "DataFormats/L1Trigger/interface/Tau.h"
0038 #include "DataFormats/L1Trigger/interface/Jet.h"
0039 #include "DataFormats/L1Trigger/interface/EtSum.h"
0040
0041 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0042 #include "FWCore/MessageLogger/interface/MessageDrop.h"
0043
0044 using namespace edm;
0045 using namespace std;
0046
0047 namespace l1t {
0048
0049
0050 class GtInputDump : public edm::one::EDAnalyzer<> {
0051 public:
0052 explicit GtInputDump(const edm::ParameterSet&);
0053 ~GtInputDump() override {}
0054 void analyze(const edm::Event&, const edm::EventSetup&) override;
0055
0056 EDGetToken egToken;
0057 EDGetToken muToken;
0058 EDGetToken tauToken;
0059 EDGetToken jetToken;
0060 EDGetToken etsumToken;
0061
0062 int m_minBx;
0063 int m_maxBx;
0064 };
0065
0066 GtInputDump::GtInputDump(const edm::ParameterSet& iConfig) {
0067 egToken = consumes<BXVector<l1t::EGamma>>(iConfig.getParameter<InputTag>("egInputTag"));
0068 muToken = consumes<BXVector<l1t::Muon>>(iConfig.getParameter<InputTag>("muInputTag"));
0069 tauToken = consumes<BXVector<l1t::Tau>>(iConfig.getParameter<InputTag>("tauInputTag"));
0070 jetToken = consumes<BXVector<l1t::Jet>>(iConfig.getParameter<InputTag>("jetInputTag"));
0071 etsumToken = consumes<BXVector<l1t::EtSum>>(iConfig.getParameter<InputTag>("etsumInputTag"));
0072
0073 m_minBx = iConfig.getParameter<int>("minBx");
0074 m_maxBx = iConfig.getParameter<int>("maxBx");
0075 }
0076
0077
0078 void GtInputDump::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
0079
0080 Handle<BXVector<l1t::EGamma>> egammas;
0081 iEvent.getByToken(egToken, egammas);
0082
0083 Handle<BXVector<l1t::Muon>> muons;
0084 iEvent.getByToken(muToken, muons);
0085
0086 Handle<BXVector<l1t::Tau>> taus;
0087 iEvent.getByToken(tauToken, taus);
0088
0089 Handle<BXVector<l1t::Jet>> jets;
0090 iEvent.getByToken(jetToken, jets);
0091
0092 Handle<BXVector<l1t::EtSum>> etsums;
0093 iEvent.getByToken(etsumToken, etsums);
0094
0095 printf("\n -------------------------------------- \n");
0096 printf(" *********** New Event ************** \n");
0097 printf(" -------------------------------------- \n");
0098
0099
0100 for (int i = m_minBx; i <= m_maxBx; ++i) {
0101 cout << " ========== BX = " << std::dec << i << " =============================" << endl;
0102
0103
0104 int nObj = 0;
0105 cout << " ------ EGammas -------- " << endl;
0106 if (egammas.isValid()) {
0107 if (i >= egammas->getFirstBX() && i <= egammas->getLastBX()) {
0108 for (std::vector<l1t::EGamma>::const_iterator eg = egammas->begin(i); eg != egammas->end(i); ++eg) {
0109 cout << " " << std::dec << std::setw(2) << std::setfill(' ') << nObj << std::setfill('0') << ")";
0110 cout << " Pt " << std::dec << std::setw(3) << eg->hwPt() << " (0x" << std::hex << std::setw(3)
0111 << std::setfill('0') << eg->hwPt() << ")";
0112 cout << " Eta " << std::dec << std::setw(3) << eg->hwEta() << " (0x" << std::hex << std::setw(2)
0113 << std::setfill('0') << (eg->hwEta() & 0xff) << ")";
0114 cout << " Phi " << std::dec << std::setw(3) << eg->hwPhi() << " (0x" << std::hex << std::setw(2)
0115 << std::setfill('0') << eg->hwPhi() << ")";
0116 cout << " Iso " << std::dec << std::setw(1) << eg->hwIso();
0117 cout << " Qual " << std::dec << std::setw(1) << eg->hwQual();
0118 cout << endl;
0119 nObj++;
0120 }
0121 } else {
0122 cout << "No EG stored for this bx " << i << endl;
0123 }
0124 } else {
0125 cout << "No EG Data in this event " << endl;
0126 }
0127
0128
0129 nObj = 0;
0130 cout << " ------ Muons --------" << endl;
0131 if (muons.isValid()) {
0132 if (i >= muons->getFirstBX() && i <= muons->getLastBX()) {
0133 for (std::vector<l1t::Muon>::const_iterator mu = muons->begin(i); mu != muons->end(i); ++mu) {
0134 cout << " " << std::dec << std::setw(2) << std::setfill(' ') << nObj << std::setfill('0') << ")";
0135 cout << " Pt " << std::dec << std::setw(3) << mu->hwPt() << " (0x" << std::hex << std::setw(3)
0136 << std::setfill('0') << mu->hwPt() << ")";
0137 cout << " EtaAtVtx " << std::dec << std::setw(3) << mu->hwEtaAtVtx() << " (0x" << std::hex << std::setw(3)
0138 << std::setfill('0') << (mu->hwEtaAtVtx() & 0x1ff) << ")";
0139 cout << " Eta " << std::dec << std::setw(3) << mu->hwEta() << " (0x" << std::hex << std::setw(3)
0140 << std::setfill('0') << (mu->hwEta() & 0x1ff) << ")";
0141 cout << " PhiAtVtx " << std::dec << std::setw(3) << mu->hwPhiAtVtx() << " (0x" << std::hex << std::setw(3)
0142 << std::setfill('0') << mu->hwPhiAtVtx() << ")";
0143 cout << " Phi " << std::dec << std::setw(3) << mu->hwPhi() << " (0x" << std::hex << std::setw(3)
0144 << std::setfill('0') << mu->hwPhi() << ")";
0145 cout << " Iso " << std::dec << std::setw(1) << mu->hwIso();
0146 cout << " Qual " << std::dec << std::setw(1) << mu->hwQual();
0147 cout << endl;
0148 nObj++;
0149 }
0150 } else {
0151 cout << "No Muons stored for this bx " << i << endl;
0152 }
0153 } else {
0154 cout << "No Muon Data in this event " << endl;
0155 }
0156
0157
0158 nObj = 0;
0159 cout << " ------ Taus ----------" << endl;
0160 if (taus.isValid()) {
0161 if (i >= taus->getFirstBX() && i <= taus->getLastBX()) {
0162 for (std::vector<l1t::Tau>::const_iterator tau = taus->begin(i); tau != taus->end(i); ++tau) {
0163 cout << " " << std::dec << std::setw(2) << std::setfill(' ') << nObj << std::setfill('0') << ")";
0164 cout << " Pt " << std::dec << std::setw(3) << tau->hwPt() << " (0x" << std::hex << std::setw(3)
0165 << std::setfill('0') << tau->hwPt() << ")";
0166 cout << " Eta " << std::dec << std::setw(3) << tau->hwEta() << " (0x" << std::hex << std::setw(2)
0167 << std::setfill('0') << (tau->hwEta() & 0xff) << ")";
0168 cout << " Phi " << std::dec << std::setw(3) << tau->hwPhi() << " (0x" << std::hex << std::setw(2)
0169 << std::setfill('0') << tau->hwPhi() << ")";
0170 cout << " Iso " << std::dec << std::setw(1) << tau->hwIso();
0171 cout << " Qual " << std::dec << std::setw(1) << tau->hwQual();
0172 cout << endl;
0173 nObj++;
0174 }
0175 } else {
0176 cout << "No Taus stored for this bx " << i << endl;
0177 }
0178 } else {
0179 cout << "No Tau Data in this event " << endl;
0180 }
0181
0182
0183 nObj = 0;
0184 cout << " ------ Jets ----------" << endl;
0185 if (jets.isValid()) {
0186 if (i >= jets->getFirstBX() && i <= jets->getLastBX()) {
0187 for (std::vector<l1t::Jet>::const_iterator jet = jets->begin(i); jet != jets->end(i); ++jet) {
0188 cout << " " << std::dec << std::setw(2) << std::setfill(' ') << nObj << std::setfill('0') << ")";
0189 cout << " Pt " << std::dec << std::setw(3) << jet->hwPt() << " (0x" << std::hex << std::setw(3)
0190 << std::setfill('0') << jet->hwPt() << ")";
0191 cout << " Eta " << std::dec << std::setw(3) << jet->hwEta() << " (0x" << std::hex << std::setw(2)
0192 << std::setfill('0') << (jet->hwEta() & 0xff) << ")";
0193 cout << " Phi " << std::dec << std::setw(3) << jet->hwPhi() << " (0x" << std::hex << std::setw(2)
0194 << std::setfill('0') << jet->hwPhi() << ")";
0195 cout << " Qual " << std::dec << std::setw(1) << jet->hwQual();
0196 cout << endl;
0197 nObj++;
0198 }
0199 } else {
0200 cout << "No Jets stored for this bx " << i << endl;
0201 }
0202 } else {
0203 cout << "No jet Data in this event " << endl;
0204 }
0205
0206
0207 cout << " ------ EtSums ----------" << endl;
0208 if (etsums.isValid()) {
0209 if (i >= etsums->getFirstBX() && i <= etsums->getLastBX()) {
0210 for (std::vector<l1t::EtSum>::const_iterator etsum = etsums->begin(i); etsum != etsums->end(i); ++etsum) {
0211 switch (etsum->getType()) {
0212 case l1t::EtSum::EtSumType::kMissingEt:
0213 cout << " ETM: ";
0214 break;
0215 case l1t::EtSum::EtSumType::kMissingHt:
0216 cout << " HTM: ";
0217 break;
0218 case l1t::EtSum::EtSumType::kTotalEt:
0219 cout << " ETT: ";
0220 break;
0221 case l1t::EtSum::EtSumType::kTotalHt:
0222 cout << " HTT: ";
0223 break;
0224 default:
0225 cout << " Unknown: ";
0226 break;
0227 }
0228 cout << " Et " << std::dec << std::setw(3) << etsum->hwPt() << " (0x" << std::hex << std::setw(3)
0229 << std::setfill('0') << etsum->hwPt() << ")";
0230 if (etsum->getType() == l1t::EtSum::EtSumType::kMissingEt ||
0231 etsum->getType() == l1t::EtSum::EtSumType::kMissingHt)
0232 cout << " Phi " << std::dec << std::setw(3) << etsum->hwPhi() << " (0x" << std::hex << std::setw(2)
0233 << std::setfill('0') << etsum->hwPhi() << ")";
0234 cout << endl;
0235 }
0236 } else {
0237 cout << "No EtSums stored for this bx " << i << endl;
0238 }
0239 } else {
0240 cout << "No EtSum Data in this event " << endl;
0241 }
0242 }
0243 printf("\n");
0244 }
0245
0246 }
0247
0248 DEFINE_FWK_MODULE(l1t::GtInputDump);