CMS 3D CMS Logo

GctTimingAnalyzer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: GctTimingAnalyzer
4 // Class: GctTimingAnalyzer
5 //
11 //
12 // Original Author: Alex Tapper
13 // Created: Mon Apr 21 14:21:06 CEST 2008
14 //
15 //
16 
17 // Include file
19 
21  : m_outputFileName(iConfig.getUntrackedParameter<std::string>("outFile", "gctTiming.txt")),
22  m_gctSource(iConfig.getUntrackedParameter<edm::InputTag>("gctSource")),
23  m_isoEmSource(iConfig.getUntrackedParameter<edm::InputTag>("isoEmSource")),
24  m_nonIsoEmSource(iConfig.getUntrackedParameter<edm::InputTag>("nonIsoEmSource")),
25  m_cenJetsSource(iConfig.getUntrackedParameter<edm::InputTag>("cenJetsSource")),
26  m_forJetsSource(iConfig.getUntrackedParameter<edm::InputTag>("forJetsSource")),
27  m_tauJetsSource(iConfig.getUntrackedParameter<edm::InputTag>("tauJetsSource")),
28  m_doInternal(iConfig.getUntrackedParameter<bool>("doInternal")),
29  m_doElectrons(iConfig.getUntrackedParameter<bool>("doElectrons")),
30  m_doJets(iConfig.getUntrackedParameter<bool>("doJets")),
31  m_doHFRings(iConfig.getUntrackedParameter<bool>("doHFRings")),
32  m_doESums(iConfig.getUntrackedParameter<bool>("doESums")),
33  m_evtNum(0) {
34  m_outputFile.open(m_outputFileName.c_str());
35 }
36 
38 
40  using namespace edm;
41  using namespace std;
42 
43  // Electrons
44  if (m_doElectrons) {
45  // Isolated EM cands in GCT output
47  iEvent.getByLabel(m_isoEmSource, isoEm);
48 
49  for (L1GctEmCandCollection::const_iterator em = isoEm->begin(); em != isoEm->end(); em++) {
50  if (em->rank() > 0) {
51  m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl;
52  }
53  }
54 
55  // Non-Isolated EM cands in GCT output
57  iEvent.getByLabel(m_nonIsoEmSource, nonIsoEm);
58 
59  for (L1GctEmCandCollection::const_iterator em = nonIsoEm->begin(); em != nonIsoEm->end(); em++) {
60  if (em->rank() > 0) {
61  m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl;
62  }
63  }
64 
65  if (m_doInternal) {
66  // Internal GCT EM cands
68  iEvent.getByLabel(m_gctSource, internEm);
69 
70  if (internEm.isValid()) {
71  for (L1GctInternEmCandCollection::const_iterator em = internEm->begin(); em != internEm->end(); em++) {
72  if (em->rank() > 0) {
73  m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl;
74  }
75  }
76  }
77  }
78 
79  // RCT EM cands
81  iEvent.getByLabel(m_gctSource, rctEm);
82 
83  for (L1CaloEmCollection::const_iterator em = rctEm->begin(); em != rctEm->end(); em++) {
84  if (em->rank() > 0) {
85  m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl;
86  }
87  }
88  }
89 
90  // Jets
91  if (m_doJets) {
92  // Central jet cands in GCT output
94  iEvent.getByLabel(m_cenJetsSource, cenJets);
95 
96  for (L1GctJetCandCollection::const_iterator cj = cenJets->begin(); cj != cenJets->end(); cj++) {
97  if (cj->rank() > 0) {
98  m_outputFile << "BX = " << dec << m_evtNum << " " << (*cj) << std::endl;
99  }
100  }
101 
102  // Forward jet cands in GCT output
104  iEvent.getByLabel(m_forJetsSource, forJets);
105 
106  for (L1GctJetCandCollection::const_iterator fj = forJets->begin(); fj != forJets->end(); fj++) {
107  if (fj->rank() > 0) {
108  m_outputFile << "BX = " << dec << m_evtNum << " " << (*fj) << std::endl;
109  }
110  }
111 
112  // Tau jet cands in GCT output
114  iEvent.getByLabel(m_tauJetsSource, tauJets);
115 
116  for (L1GctJetCandCollection::const_iterator tj = tauJets->begin(); tj != tauJets->end(); tj++) {
117  if (tj->rank() > 0) {
118  m_outputFile << "BX = " << dec << m_evtNum << " " << (*tj) << std::endl;
119  }
120  }
121 
122  if (m_doInternal) {
123  // Internal GCT jet cands
125  iEvent.getByLabel(m_gctSource, internJets);
126 
127  if (internJets.isValid()) {
128  for (L1GctInternJetDataCollection::const_iterator j = internJets->begin(); j != internJets->end(); j++) {
129  if ((j->et() > 0) || (j->rank() > 0)) {
130  m_outputFile << "BX = " << dec << m_evtNum << " " << (*j) << std::endl;
131  }
132  }
133  }
134  }
135  }
136 
137  // RCT regions
139  iEvent.getByLabel(m_gctSource, rctRn);
140 
141  for (L1CaloRegionCollection::const_iterator rn = rctRn->begin(); rn != rctRn->end(); rn++) {
142  if (rn->et() > 0) {
143  m_outputFile << "BX = " << dec << m_evtNum << " " << (*rn) << std::endl;
144  }
145  }
146 
147  // HF Rings
148  if (m_doHFRings) {
149  // HFRing counts
151  iEvent.getByLabel(m_gctSource, hfBitCnt);
152 
153  for (L1GctHFBitCountsCollection::const_iterator jc = hfBitCnt->begin(); jc != hfBitCnt->end(); jc++) {
154  if (jc->bitCount(0) || jc->bitCount(1) || jc->bitCount(2) || jc->bitCount(3)) {
155  m_outputFile << "BX = " << dec << m_evtNum << " " << (*jc) << std::endl;
156  }
157  }
158 
159  // HFRing Et sums
161  iEvent.getByLabel(m_gctSource, hfEtSums);
162 
163  for (L1GctHFRingEtSumsCollection::const_iterator js = hfEtSums->begin(); js != hfEtSums->end(); js++) {
164  if (js->etSum(0) || js->etSum(1) || js->etSum(2) || js->etSum(3)) {
165  m_outputFile << "BX = " << dec << m_evtNum << " " << (*js) << std::endl;
166  }
167  }
168 
169  if (m_doInternal) {
170  // Internal HF data
172  iEvent.getByLabel(m_gctSource, internHF);
173 
174  if (internHF.isValid()) {
175  for (L1GctInternHFDataCollection::const_iterator hf = internHF->begin(); hf != internHF->end(); hf++) {
176  if (hf->value(0) || hf->value(1) || hf->value(2) || hf->value(3)) {
177  m_outputFile << "BX = " << dec << m_evtNum << " " << (*hf) << std::endl;
178  }
179  }
180  }
181  }
182  }
183 
184  // HT, MET and ET
185  if (m_doESums) {
186  // MET
188  iEvent.getByLabel(m_gctSource, missEt);
189 
190  for (L1GctEtMissCollection::const_iterator met = missEt->begin(); met != missEt->end(); met++) {
191  if (met->et() > 0) {
192  m_outputFile << "BX = " << dec << m_evtNum << " " << (*met) << std::endl;
193  }
194  }
195 
196  // Total Et
198  iEvent.getByLabel(m_gctSource, totEt);
199 
200  for (L1GctEtTotalCollection::const_iterator tet = totEt->begin(); tet != totEt->end(); tet++) {
201  if (tet->et() > 0) {
202  m_outputFile << "BX = " << dec << m_evtNum << " " << (*tet) << std::endl;
203  }
204  }
205 
206  // Ht
208  iEvent.getByLabel(m_gctSource, hadEt);
209 
210  for (L1GctEtHadCollection::const_iterator ht = hadEt->begin(); ht != hadEt->end(); ht++) {
211  if (ht->et() > 0) {
212  m_outputFile << "BX = " << dec << m_evtNum << " " << (*ht) << std::endl;
213  }
214  }
215 
216  if (m_doInternal) {
217  // Internal GCT Et sums
219  iEvent.getByLabel(m_gctSource, Et);
220 
221  if (Et.isValid()) {
222  for (L1GctInternEtSumCollection::const_iterator e = Et->begin(); e != Et->end(); e++) {
223  if (e->et() > 0) {
224  m_outputFile << "BX = " << dec << m_evtNum << " " << (*e) << std::endl;
225  }
226  }
227  }
228  }
229  }
230 
231  m_evtNum++;
232 }
edm::InputTag m_tauJetsSource
edm::InputTag m_cenJetsSource
~GctTimingAnalyzer() override
edm::InputTag m_gctSource
std::string m_outputFileName
edm::InputTag m_isoEmSource
int iEvent
Definition: GenABIO.cc:224
GctTimingAnalyzer(const edm::ParameterSet &)
edm::InputTag m_nonIsoEmSource
edm::InputTag m_forJetsSource
void analyze(const edm::Event &, const edm::EventSetup &) override
bool isValid() const
Definition: HandleBase.h:70
HLT enums.
std::ofstream m_outputFile