CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // $Id: GctTimingAnalyzer.cc,v 1.9 2008/11/05 20:34:17 tapper Exp $
15 //
16 //
17 
18 // Include file
20 
22  m_outputFileName(iConfig.getUntrackedParameter<std::string>("outFile", "gctTiming.txt")),
23  m_gctSource(iConfig.getUntrackedParameter<edm::InputTag>("gctSource")),
24  m_isoEmSource(iConfig.getUntrackedParameter<edm::InputTag>("isoEmSource")),
25  m_nonIsoEmSource(iConfig.getUntrackedParameter<edm::InputTag>("nonIsoEmSource")),
26  m_cenJetsSource(iConfig.getUntrackedParameter<edm::InputTag>("cenJetsSource")),
27  m_forJetsSource(iConfig.getUntrackedParameter<edm::InputTag>("forJetsSource")),
28  m_tauJetsSource(iConfig.getUntrackedParameter<edm::InputTag>("tauJetsSource")),
29  m_doInternal(iConfig.getUntrackedParameter<bool>("doInternal")),
30  m_doElectrons(iConfig.getUntrackedParameter<bool>("doElectrons")),
31  m_doJets(iConfig.getUntrackedParameter<bool>("doJets")),
32  m_doHFRings(iConfig.getUntrackedParameter<bool>("doHFRings")),
33  m_doESums(iConfig.getUntrackedParameter<bool>("doESums")),
34  m_evtNum(0)
35 {
36  m_outputFile.open(m_outputFileName.c_str());
37 }
38 
40 {
41  m_outputFile.close();
42 }
43 
45 {
46  using namespace edm;
47  using namespace std;
48 
49  // Electrons
50  if(m_doElectrons){
51 
52  // Isolated EM cands in GCT output
54  iEvent.getByLabel(m_isoEmSource,isoEm);
55 
56  for (L1GctEmCandCollection::const_iterator em=isoEm->begin(); em!=isoEm->end(); em++){
57  if (em->rank()>0) {
58  m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl;
59  }
60  }
61 
62  // Non-Isolated EM cands in GCT output
64  iEvent.getByLabel(m_nonIsoEmSource,nonIsoEm);
65 
66  for (L1GctEmCandCollection::const_iterator em=nonIsoEm->begin(); em!=nonIsoEm->end(); em++){
67  if (em->rank()>0) {
68  m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl;
69  }
70  }
71 
72  if (m_doInternal){
73  // Internal GCT EM cands
75  iEvent.getByLabel(m_gctSource,internEm);
76 
77  if (internEm.isValid()) {
78  for (L1GctInternEmCandCollection::const_iterator em=internEm->begin(); em!=internEm->end(); em++){
79  if (em->rank()>0) {
80  m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl;
81  }
82  }
83  }
84  }
85 
86  // RCT EM cands
88  iEvent.getByLabel(m_gctSource,rctEm);
89 
90  for (L1CaloEmCollection::const_iterator em=rctEm->begin(); em!=rctEm->end(); em++){
91  if (em->rank()>0) {
92  m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl;
93  }
94  }
95  }
96 
97  // Jets
98  if (m_doJets){
99 
100  // Central jet cands in GCT output
102  iEvent.getByLabel(m_cenJetsSource,cenJets);
103 
104  for (L1GctJetCandCollection::const_iterator cj=cenJets->begin(); cj!=cenJets->end(); cj++){
105  if (cj->rank()>0) {
106  m_outputFile << "BX = " << dec << m_evtNum << " " << (*cj) << std::endl;
107  }
108  }
109 
110  // Forward jet cands in GCT output
112  iEvent.getByLabel(m_forJetsSource,forJets);
113 
114  for (L1GctJetCandCollection::const_iterator fj=forJets->begin(); fj!=forJets->end(); fj++){
115  if (fj->rank()>0) {
116  m_outputFile << "BX = " << dec << m_evtNum << " " << (*fj) << std::endl;
117  }
118  }
119 
120  // Tau jet cands in GCT output
122  iEvent.getByLabel(m_tauJetsSource,tauJets);
123 
124  for (L1GctJetCandCollection::const_iterator tj=tauJets->begin(); tj!=tauJets->end(); tj++){
125  if (tj->rank()>0) {
126  m_outputFile << "BX = " << dec << m_evtNum << " " << (*tj) << std::endl;
127  }
128  }
129 
130  if (m_doInternal){
131 
132  // Internal GCT jet cands
134  iEvent.getByLabel(m_gctSource,internJets);
135 
136  if (internJets.isValid()){
137  for (L1GctInternJetDataCollection::const_iterator j=internJets->begin(); j!=internJets->end(); j++){
138  if ((j->et()>0) || (j->rank()>0)) {
139  m_outputFile << "BX = " << dec << m_evtNum << " " << (*j) << std::endl;
140  }
141  }
142  }
143  }
144  }
145 
146  // RCT regions
148  iEvent.getByLabel(m_gctSource,rctRn);
149 
150  for (L1CaloRegionCollection::const_iterator rn=rctRn->begin(); rn!=rctRn->end(); rn++){
151  if (rn->et()>0) {
152  m_outputFile << "BX = " << dec << m_evtNum << " " << (*rn) << std::endl;
153  }
154  }
155 
156  // HF Rings
157  if (m_doHFRings){
158 
159  // HFRing counts
161  iEvent.getByLabel(m_gctSource,hfBitCnt);
162 
163  for (L1GctHFBitCountsCollection::const_iterator jc=hfBitCnt->begin(); jc!=hfBitCnt->end(); jc++){
164  if (jc->bitCount(0) || jc->bitCount(1) || jc->bitCount(2) || jc->bitCount(3)){
165  m_outputFile << "BX = " << dec << m_evtNum << " " << (*jc) << std::endl;
166  }
167  }
168 
169  // HFRing Et sums
171  iEvent.getByLabel(m_gctSource,hfEtSums);
172 
173  for (L1GctHFRingEtSumsCollection::const_iterator js=hfEtSums->begin(); js!=hfEtSums->end(); js++){
174  if (js->etSum(0) || js->etSum(1) || js->etSum(2) || js->etSum(3)){
175  m_outputFile << "BX = " << dec << m_evtNum << " " << (*js) << std::endl;
176  }
177  }
178 
179  if (m_doInternal){
180  // Internal HF data
182  iEvent.getByLabel(m_gctSource,internHF);
183 
184  if (internHF.isValid()){
185  for (L1GctInternHFDataCollection::const_iterator hf=internHF->begin(); hf!=internHF->end(); hf++){
186  if (hf->value(0) || hf->value(1) || hf->value(2) || hf->value(3)){
187  m_outputFile << "BX = " << dec << m_evtNum << " " << (*hf) << std::endl;
188  }
189  }
190  }
191  }
192  }
193 
194  // HT, MET and ET
195  if (m_doESums){
196 
197  // MET
199  iEvent.getByLabel(m_gctSource,missEt);
200 
201  for (L1GctEtMissCollection::const_iterator met=missEt->begin(); met!=missEt->end(); met++){
202  if (met->et()>0){
203  m_outputFile << "BX = " << dec << m_evtNum << " " << (*met) << std::endl;
204  }
205  }
206 
207  // Total Et
209  iEvent.getByLabel(m_gctSource,totEt);
210 
211  for (L1GctEtTotalCollection::const_iterator tet=totEt->begin(); tet!=totEt->end(); tet++){
212  if (tet->et()>0){
213  m_outputFile << "BX = " << dec << m_evtNum << " " << (*tet) << std::endl;
214  }
215  }
216 
217  // Ht
219  iEvent.getByLabel(m_gctSource,hadEt);
220 
221  for (L1GctEtHadCollection::const_iterator ht=hadEt->begin(); ht!=hadEt->end(); ht++){
222  if (ht->et()>0){
223  m_outputFile << "BX = " << dec << m_evtNum << " " << (*ht) << std::endl;
224  }
225  }
226 
227  if (m_doInternal){
228  // Internal GCT Et sums
230  iEvent.getByLabel(m_gctSource,Et);
231 
232  if (Et.isValid()){
233  for (L1GctInternEtSumCollection::const_iterator e=Et->begin(); e!=Et->end(); e++){
234  if (e->et()>0){
235  m_outputFile << "BX = " << dec << m_evtNum << " " << (*e) << std::endl;
236  }
237  }
238  }
239  }
240  }
241 
242  m_evtNum++;
243 
244 }
edm::InputTag m_tauJetsSource
edm::InputTag m_cenJetsSource
virtual void analyze(const edm::Event &, const edm::EventSetup &)
edm::InputTag m_gctSource
std::string m_outputFileName
edm::InputTag m_isoEmSource
int iEvent
Definition: GenABIO.cc:243
GctTimingAnalyzer(const edm::ParameterSet &)
int j
Definition: DBlmapReader.cc:9
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
edm::InputTag m_nonIsoEmSource
edm::InputTag m_forJetsSource
std::ofstream m_outputFile