CMS 3D CMS Logo

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