CMS 3D CMS Logo

DumpMuonScouting.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 // system include files
20 #include <fstream>
21 #include <iomanip>
22 #include <memory>
23 
24 // user include files
25 // base class
27 
34 
36 
39 
40 using namespace edm;
41 using namespace std;
42 
43 // class declaration
45 public:
46  explicit DumpMuonScouting(const edm::ParameterSet&);
47  ~DumpMuonScouting() override{};
48  void analyze(const edm::Event&, const edm::EventSetup&) override;
49 
51 
52  int m_minBx;
53  int m_maxBx;
54 
55 private:
57 };
58 
60  muToken = consumes<l1t::MuonBxCollection>(iConfig.getParameter<InputTag>("muInputTag"));
61 
62  m_minBx = iConfig.getParameter<int>("minBx");
63  m_maxBx = iConfig.getParameter<int>("maxBx");
64 }
65 
66 // loop over events
68  //input
69  Handle<BXVector<l1t::Muon>> muons = iEvent.getHandle(muToken);
70 
71  {
72  cout << " ----------------------------------------------------- " << endl;
73  cout << " *********** Run " << std::dec << iEvent.id().run() << " Event " << iEvent.id().event()
74  << " ************** " << endl;
75  cout << " ----------------------------------------------------- " << endl;
76 
77  //Loop over BX
78  for (int i = m_minBx; i <= m_maxBx; ++i) {
79  //Loop over Muons
80  //cout << " ------ Muons --------" << endl;
81  if (muons.isValid()) {
82  if (i >= muons->getFirstBX() && i <= muons->getLastBX()) {
83  for (std::vector<l1t::Muon>::const_iterator mu = muons->begin(i); mu != muons->end(i); ++mu) {
84  cout << " " << std::dec << std::setw(2) << std::setfill(' ') << std::setfill('0') << ")";
85  cout << " Pt " << std::dec << std::setw(3) << mu->hwPt() << " (0x" << std::hex << std::setw(3)
86  << std::setfill('0') << mu->hwPt() << ")";
87  cout << " EtaAtVtx " << std::dec << std::setw(3) << mu->hwEtaAtVtx() << " (0x" << std::hex << std::setw(3)
88  << std::setfill('0') << (mu->hwEtaAtVtx() & 0x1ff) << ")";
89  cout << " Eta " << std::dec << std::setw(3) << mu->hwEta() << " (0x" << std::hex << std::setw(3)
90  << std::setfill('0') << (mu->hwEta() & 0x1ff) << ")";
91  cout << " PhiAtVtx " << std::dec << std::setw(3) << mu->hwPhiAtVtx() << " (0x" << std::hex << std::setw(3)
92  << std::setfill('0') << mu->hwPhiAtVtx() << ")";
93  cout << " Phi " << std::dec << std::setw(3) << mu->hwPhi() << " (0x" << std::hex << std::setw(3)
94  << std::setfill('0') << mu->hwPhi() << ")";
95  cout << " Iso " << std::dec << std::setw(1) << mu->hwIso();
96  cout << " Qual " << std::dec << std::setw(1) << mu->hwQual();
97  cout << " Chrg " << std::dec << std::setw(1) << mu->hwCharge();
98  cout << endl;
99  }
100  } else {
101  cout << "No Muons stored for this bx " << i << endl;
102  }
103  } else {
104  cout << "No Muon Data in this event " << endl;
105  }
106 
107  } //loop over Bx
108  cout << std::dec << endl;
109  } //if dumpGtRecord
110 }
111 
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
EDGetTokenT< BXVector< l1t::Muon > > muToken
~DumpMuonScouting() override
DumpMuonScouting(const edm::ParameterSet &)
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
HLT enums.
void analyze(const edm::Event &, const edm::EventSetup &) override