File indexing completed on 2023-03-17 11:00:28
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 #include <fstream>
0021 #include <iomanip>
0022 #include <memory>
0023
0024
0025
0026 #include "FWCore/Framework/interface/stream/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/Muon.h"
0036
0037 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0038 #include "FWCore/MessageLogger/interface/MessageDrop.h"
0039
0040 using namespace edm;
0041 using namespace std;
0042
0043
0044 class DumpMuonScouting : public edm::stream::EDAnalyzer<> {
0045 public:
0046 explicit DumpMuonScouting(const edm::ParameterSet&);
0047 ~DumpMuonScouting() override{};
0048 void analyze(const edm::Event&, const edm::EventSetup&) override;
0049
0050 EDGetTokenT<BXVector<l1t::Muon>> muToken;
0051
0052 int m_minBx;
0053 int m_maxBx;
0054
0055 private:
0056 int m_tvVersion;
0057 };
0058
0059 DumpMuonScouting::DumpMuonScouting(const edm::ParameterSet& iConfig) {
0060 muToken = consumes<l1t::MuonBxCollection>(iConfig.getParameter<InputTag>("muInputTag"));
0061
0062 m_minBx = iConfig.getParameter<int>("minBx");
0063 m_maxBx = iConfig.getParameter<int>("maxBx");
0064 }
0065
0066
0067 void DumpMuonScouting::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
0068
0069 Handle<BXVector<l1t::Muon>> muons = iEvent.getHandle(muToken);
0070
0071 {
0072 cout << " ----------------------------------------------------- " << endl;
0073 cout << " *********** Run " << std::dec << iEvent.id().run() << " Event " << iEvent.id().event()
0074 << " ************** " << endl;
0075 cout << " ----------------------------------------------------- " << endl;
0076
0077
0078 for (int i = m_minBx; i <= m_maxBx; ++i) {
0079
0080
0081 if (muons.isValid()) {
0082 if (i >= muons->getFirstBX() && i <= muons->getLastBX()) {
0083 for (std::vector<l1t::Muon>::const_iterator mu = muons->begin(i); mu != muons->end(i); ++mu) {
0084 cout << " " << std::dec << std::setw(2) << std::setfill(' ') << std::setfill('0') << ")";
0085 cout << " Pt " << std::dec << std::setw(3) << mu->hwPt() << " (0x" << std::hex << std::setw(3)
0086 << std::setfill('0') << mu->hwPt() << ")";
0087 cout << " EtaAtVtx " << std::dec << std::setw(3) << mu->hwEtaAtVtx() << " (0x" << std::hex << std::setw(3)
0088 << std::setfill('0') << (mu->hwEtaAtVtx() & 0x1ff) << ")";
0089 cout << " Eta " << std::dec << std::setw(3) << mu->hwEta() << " (0x" << std::hex << std::setw(3)
0090 << std::setfill('0') << (mu->hwEta() & 0x1ff) << ")";
0091 cout << " PhiAtVtx " << std::dec << std::setw(3) << mu->hwPhiAtVtx() << " (0x" << std::hex << std::setw(3)
0092 << std::setfill('0') << mu->hwPhiAtVtx() << ")";
0093 cout << " Phi " << std::dec << std::setw(3) << mu->hwPhi() << " (0x" << std::hex << std::setw(3)
0094 << std::setfill('0') << mu->hwPhi() << ")";
0095 cout << " Iso " << std::dec << std::setw(1) << mu->hwIso();
0096 cout << " Qual " << std::dec << std::setw(1) << mu->hwQual();
0097 cout << " Chrg " << std::dec << std::setw(1) << mu->hwCharge();
0098 cout << endl;
0099 }
0100 } else {
0101 cout << "No Muons stored for this bx " << i << endl;
0102 }
0103 } else {
0104 cout << "No Muon Data in this event " << endl;
0105 }
0106
0107 }
0108 cout << std::dec << endl;
0109 }
0110 }
0111
0112 DEFINE_FWK_MODULE(DumpMuonScouting);