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 //
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 {
35  m_outputFile.open(m_outputFileName.c_str());
36 }
37 
39 {
40  m_outputFile.close();
41 }
42 
44 {
45  using namespace edm;
46  using namespace std;
47 
48  // Electrons
49  if(m_doElectrons){
50 
51  // Isolated EM cands in GCT output
53  iEvent.getByLabel(m_isoEmSource,isoEm);
54 
55  for (L1GctEmCandCollection::const_iterator em=isoEm->begin(); em!=isoEm->end(); em++){
56  if (em->rank()>0) {
57  m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl;
58  }
59  }
60 
61  // Non-Isolated EM cands in GCT output
63  iEvent.getByLabel(m_nonIsoEmSource,nonIsoEm);
64 
65  for (L1GctEmCandCollection::const_iterator em=nonIsoEm->begin(); em!=nonIsoEm->end(); em++){
66  if (em->rank()>0) {
67  m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl;
68  }
69  }
70 
71  if (m_doInternal){
72  // Internal GCT EM cands
74  iEvent.getByLabel(m_gctSource,internEm);
75 
76  if (internEm.isValid()) {
77  for (L1GctInternEmCandCollection::const_iterator em=internEm->begin(); em!=internEm->end(); em++){
78  if (em->rank()>0) {
79  m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl;
80  }
81  }
82  }
83  }
84 
85  // RCT EM cands
87  iEvent.getByLabel(m_gctSource,rctEm);
88 
89  for (L1CaloEmCollection::const_iterator em=rctEm->begin(); em!=rctEm->end(); em++){
90  if (em->rank()>0) {
91  m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl;
92  }
93  }
94  }
95 
96  // Jets
97  if (m_doJets){
98 
99  // Central jet cands in GCT output
101  iEvent.getByLabel(m_cenJetsSource,cenJets);
102 
103  for (L1GctJetCandCollection::const_iterator cj=cenJets->begin(); cj!=cenJets->end(); cj++){
104  if (cj->rank()>0) {
105  m_outputFile << "BX = " << dec << m_evtNum << " " << (*cj) << std::endl;
106  }
107  }
108 
109  // Forward jet cands in GCT output
111  iEvent.getByLabel(m_forJetsSource,forJets);
112 
113  for (L1GctJetCandCollection::const_iterator fj=forJets->begin(); fj!=forJets->end(); fj++){
114  if (fj->rank()>0) {
115  m_outputFile << "BX = " << dec << m_evtNum << " " << (*fj) << std::endl;
116  }
117  }
118 
119  // Tau jet cands in GCT output
121  iEvent.getByLabel(m_tauJetsSource,tauJets);
122 
123  for (L1GctJetCandCollection::const_iterator tj=tauJets->begin(); tj!=tauJets->end(); tj++){
124  if (tj->rank()>0) {
125  m_outputFile << "BX = " << dec << m_evtNum << " " << (*tj) << std::endl;
126  }
127  }
128 
129  if (m_doInternal){
130 
131  // Internal GCT jet cands
133  iEvent.getByLabel(m_gctSource,internJets);
134 
135  if (internJets.isValid()){
136  for (L1GctInternJetDataCollection::const_iterator j=internJets->begin(); j!=internJets->end(); j++){
137  if ((j->et()>0) || (j->rank()>0)) {
138  m_outputFile << "BX = " << dec << m_evtNum << " " << (*j) << std::endl;
139  }
140  }
141  }
142  }
143  }
144 
145  // RCT regions
147  iEvent.getByLabel(m_gctSource,rctRn);
148 
149  for (L1CaloRegionCollection::const_iterator rn=rctRn->begin(); rn!=rctRn->end(); rn++){
150  if (rn->et()>0) {
151  m_outputFile << "BX = " << dec << m_evtNum << " " << (*rn) << std::endl;
152  }
153  }
154 
155  // HF Rings
156  if (m_doHFRings){
157 
158  // HFRing counts
160  iEvent.getByLabel(m_gctSource,hfBitCnt);
161 
162  for (L1GctHFBitCountsCollection::const_iterator jc=hfBitCnt->begin(); jc!=hfBitCnt->end(); jc++){
163  if (jc->bitCount(0) || jc->bitCount(1) || jc->bitCount(2) || jc->bitCount(3)){
164  m_outputFile << "BX = " << dec << m_evtNum << " " << (*jc) << std::endl;
165  }
166  }
167 
168  // HFRing Et sums
170  iEvent.getByLabel(m_gctSource,hfEtSums);
171 
172  for (L1GctHFRingEtSumsCollection::const_iterator js=hfEtSums->begin(); js!=hfEtSums->end(); js++){
173  if (js->etSum(0) || js->etSum(1) || js->etSum(2) || js->etSum(3)){
174  m_outputFile << "BX = " << dec << m_evtNum << " " << (*js) << std::endl;
175  }
176  }
177 
178  if (m_doInternal){
179  // Internal HF data
181  iEvent.getByLabel(m_gctSource,internHF);
182 
183  if (internHF.isValid()){
184  for (L1GctInternHFDataCollection::const_iterator hf=internHF->begin(); hf!=internHF->end(); hf++){
185  if (hf->value(0) || hf->value(1) || hf->value(2) || hf->value(3)){
186  m_outputFile << "BX = " << dec << m_evtNum << " " << (*hf) << std::endl;
187  }
188  }
189  }
190  }
191  }
192 
193  // HT, MET and ET
194  if (m_doESums){
195 
196  // MET
198  iEvent.getByLabel(m_gctSource,missEt);
199 
200  for (L1GctEtMissCollection::const_iterator met=missEt->begin(); met!=missEt->end(); met++){
201  if (met->et()>0){
202  m_outputFile << "BX = " << dec << m_evtNum << " " << (*met) << std::endl;
203  }
204  }
205 
206  // Total Et
208  iEvent.getByLabel(m_gctSource,totEt);
209 
210  for (L1GctEtTotalCollection::const_iterator tet=totEt->begin(); tet!=totEt->end(); tet++){
211  if (tet->et()>0){
212  m_outputFile << "BX = " << dec << m_evtNum << " " << (*tet) << std::endl;
213  }
214  }
215 
216  // Ht
218  iEvent.getByLabel(m_gctSource,hadEt);
219 
220  for (L1GctEtHadCollection::const_iterator ht=hadEt->begin(); ht!=hadEt->end(); ht++){
221  if (ht->et()>0){
222  m_outputFile << "BX = " << dec << m_evtNum << " " << (*ht) << std::endl;
223  }
224  }
225 
226  if (m_doInternal){
227  // Internal GCT Et sums
229  iEvent.getByLabel(m_gctSource,Et);
230 
231  if (Et.isValid()){
232  for (L1GctInternEtSumCollection::const_iterator e=Et->begin(); e!=Et->end(); e++){
233  if (e->et()>0){
234  m_outputFile << "BX = " << dec << m_evtNum << " " << (*e) << std::endl;
235  }
236  }
237  }
238  }
239  }
240 
241  m_evtNum++;
242 
243 }
tuple met
____________________________________________________________________________||
Definition: CaloMET_cfi.py:4
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:230
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:390
edm::InputTag m_nonIsoEmSource
edm::InputTag m_forJetsSource
std::ofstream m_outputFile