CMS 3D CMS Logo

DumpGctDigis.cc
Go to the documentation of this file.
2 
3 // system include files
4 #include <memory>
5 #include <iostream>
6 
7 // user include files
10 
13 
16 
18 
21 
22 using std::string;
23 using std::ios;
24 using std::endl;
25 
26 //
27 // constructors and destructor
28 //
30  rawLabel_( iConfig.getUntrackedParameter<edm::InputTag>("rawInput", edm::InputTag("L1GctRawDigis") ) ),
31  emuRctLabel_( iConfig.getUntrackedParameter<edm::InputTag>("emuRctInput", edm::InputTag("L1RctEmuDigis") ) ),
32  emuGctLabel_( iConfig.getUntrackedParameter<edm::InputTag>("emuGctInput", edm::InputTag("L1GctEmuDigis") ) ),
33  outFilename_( iConfig.getUntrackedParameter<string>("outFile", "gctAnalyzer.txt") ),
34  doHW_( iConfig.getUntrackedParameter<bool>("doHardware", true) ),
35  doEmu_( iConfig.getUntrackedParameter<bool>("doEmulated", true) ),
36  doRctEM_( iConfig.getUntrackedParameter<bool>("doRctEm", true) ),
37  doEM_( iConfig.getUntrackedParameter<bool>("doEm", true) ),
38  doRegions_( iConfig.getUntrackedParameter<bool>("doRegions", false) ),
39  doJets_( iConfig.getUntrackedParameter<bool>("doJets", false) ),
40  doInternEM_( iConfig.getUntrackedParameter<bool>("doInternEm", true) ),
41  doFibres_( iConfig.getUntrackedParameter<bool>("doFibres", false) ),
42  doEnergySums_( iConfig.getUntrackedParameter<bool>("doEnergySums", false) ),
43  rctEmMinRank_( iConfig.getUntrackedParameter<unsigned>("rctEmMinRank", 0) )
44 {
45  //now do what ever initialization is needed
46 
47  outFile_.open(outFilename_.c_str(), ios::out);
48 
49 }
50 
51 
53 {
54 
55  // do anything here that needs to be done at desctruction time
56  // (e.g. close files, deallocate resources etc.)
57 
58  outFile_.close();
59 
60 }
61 
62 
63 //
64 // member functions
65 //
66 
67 // ------------ method called to produce the data ------------
68 void
70 {
71  using namespace edm;
72 
73  outFile_ << "Run :" << iEvent.id().run() << " Event :" << iEvent.id().event() << endl;
74 
75  // EM
76  if (doRctEM_ && doHW_) { doRctEM(iEvent, rawLabel_); }
77  if (doRctEM_ && doEmu_) { doRctEM(iEvent, emuRctLabel_); }
78  if (doEM_ && doHW_) { doEM(iEvent, rawLabel_); }
79  if (doEM_ && doEmu_){ doEM(iEvent, emuGctLabel_); }
80 
81  // Jets
82  if (doRegions_ && doHW_) { doRegions(iEvent, rawLabel_); }
83  if (doRegions_ && doEmu_) { doRegions(iEvent, emuRctLabel_); }
84  if (doJets_ && doHW_) { doJets(iEvent, rawLabel_); }
85  if (doJets_ && doEmu_) { doJets(iEvent, emuGctLabel_); }
86 
87  // Energy Sums
88  if (doEnergySums_ && doHW_) { doEnergySums(iEvent, rawLabel_); }
89  if (doEnergySums_ && doEmu_) { doEnergySums(iEvent, emuGctLabel_); }
90 
91  // debugging
92  if (doInternEM_ && doHW_) { doInternEM(iEvent, rawLabel_); }
93  if (doFibres_ && doHW_) { doFibres(iEvent, rawLabel_); }
94 
95 }
96 
98 
99  using namespace edm;
100 
103 
104  L1GctEmCandCollection::const_iterator ie;
105  L1GctEmCandCollection::const_iterator ne;
106 
107  iEvent.getByLabel(label.label(),"isoEm",isoEm);
108  iEvent.getByLabel(label.label(),"nonIsoEm",nonIsoEm);
109 
110  outFile_ << "Iso EM from : " << label.label() << endl;
111  for (ie=isoEm->begin(); ie!=isoEm->end(); ie++) {
112  outFile_ << (*ie)
113  << " ieta(detID)=" << ie->regionId().ieta()
114  << " iphi(detID)=" << ie->regionId().iphi()
115  << endl;
116  }
117  outFile_ << endl;
118 
119  outFile_ << "Non-iso EM from : " << label.label() << endl;
120  for (ne=nonIsoEm->begin(); ne!=nonIsoEm->end(); ne++) {
121  outFile_ << (*ne)
122  << " ieta(detID)=" << ne->regionId().ieta()
123  << " iphi(detID)=" << ne->regionId().iphi()
124  << endl;
125  }
126  outFile_ << endl;
127 
128 }
129 
131 
132  using namespace edm;
133 
135 
136  L1CaloEmCollection::const_iterator e;
137 
138  iEvent.getByLabel(label, em);
139 
140  outFile_ << "RCT EM from : " << label.label() << endl;
141  for (e=em->begin(); e!=em->end(); e++) {
142  if (e->rank() >= rctEmMinRank_) {
143  outFile_ << (*e)
144  << " ieta(detID)=" << e->regionId().ieta()
145  << " iphi(detID)=" << e->regionId().iphi()
146  << endl;
147  }
148  }
149  outFile_ << endl;
150 
151 }
152 
153 
155 
156  using namespace edm;
157 
159 
160  L1CaloRegionCollection::const_iterator r;
161 
162  iEvent.getByLabel(label, rgns);
163 
164  outFile_ << "Regions from : " << label.label() << endl;
165  for (r=rgns->begin(); r!=rgns->end(); r++) {
166  outFile_ << (*r) << endl;
167  }
168  outFile_ << endl;
169 
170 }
171 
172 
174 
175  using namespace edm;
176 
180 
181  L1GctJetCandCollection::const_iterator cj;
182  L1GctJetCandCollection::const_iterator fj;
183  L1GctJetCandCollection::const_iterator tj;
184 
185  const std::string& labelStr = label.label();
186 
187  iEvent.getByLabel(labelStr,"cenJets",cenJets);
188  iEvent.getByLabel(labelStr,"forJets",forJets);
189  iEvent.getByLabel(labelStr,"tauJets",tauJets);
190 
191  outFile_ << "Central jets from : " << labelStr << endl;
192  for (cj=cenJets->begin(); cj!=cenJets->end(); cj++) {
193  outFile_ << (*cj) << endl;
194  }
195  outFile_ << endl;
196 
197  outFile_ << "Forward jets from : " << labelStr << endl;
198  for (fj=forJets->begin(); fj!=forJets->end(); fj++) {
199  outFile_ << (*fj) << endl;
200  }
201  outFile_ << endl;
202 
203  outFile_ << "Tau jets from : " << labelStr << endl;
204  for (tj=tauJets->begin(); tj!=tauJets->end(); tj++) {
205  outFile_ << (*tj) << endl;
206  }
207 }
208 
209 
211 
212  using namespace edm;
213 
215 
216  L1GctInternEmCandCollection::const_iterator e;
217 
218  iEvent.getByLabel(label, em);
219 
220  outFile_ << "Internal EM from : " << label.label() << endl;
221  for (e=em->begin(); e!=em->end(); e++) {
222  outFile_ << (*e)
223  << " ieta(detID)=" << e->regionId().ieta()
224  << " iphi(detID)=" << e->regionId().iphi()
225  << endl;
226  }
227  outFile_ << endl;
228 
229 }
230 
231 
233 
234  using namespace edm;
235 
237 
238  L1GctFibreCollection::const_iterator f;
239 
240  iEvent.getByLabel(label, fibres);
241 
242  outFile_ << "Fibres from : " << label.label() << endl;
243  for (f=fibres->begin(); f!=fibres->end(); f++) {
244  outFile_ << (*f) << endl;
245  }
246  outFile_ << endl;
247 
248 }
249 
251 {
252  using namespace edm;
253 
258 
259  iEvent.getByLabel(label, etTotal);
260  iEvent.getByLabel(label, etHad);
261  iEvent.getByLabel(label, etMiss);
262  iEvent.getByLabel(label, htMiss);
263 
264  outFile_ << "Energy sums from: " << label.label() << endl;
265 
266  L1GctEtTotalCollection::const_iterator et;
267  for (et=etTotal->begin(); et!=etTotal->end(); et++){
268  outFile_ << *(et) << endl;
269  }
270 
271  L1GctEtHadCollection::const_iterator ht;
272  for (ht=etHad->begin(); ht!=etHad->end(); ht++){
273  outFile_ << *(ht) << endl;
274  }
275 
276  L1GctEtMissCollection::const_iterator met;
277  for (met=etMiss->begin(); met!=etMiss->end(); met++){
278  outFile_ << *(met) << endl;
279  }
280 
281  L1GctHtMissCollection::const_iterator mht;
282  for (mht=htMiss->begin(); mht!=htMiss->end(); mht++){
283  outFile_ << *(mht) << endl;
284  }
285 
286 }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
edm::InputTag rawLabel_
Definition: DumpGctDigis.h:53
edm::InputTag emuRctLabel_
Definition: DumpGctDigis.h:54
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: DumpGctDigis.cc:69
DumpGctDigis(const edm::ParameterSet &)
Definition: DumpGctDigis.cc:29
unsigned rctEmMinRank_
Definition: DumpGctDigis.h:68
std::string outFilename_
Definition: DumpGctDigis.h:56
std::ofstream outFile_
Definition: DumpGctDigis.h:70
void doRegions(const edm::Event &, const edm::InputTag &label)
void doJets(const edm::Event &, const edm::InputTag &label)
char const * label
int iEvent
Definition: GenABIO.cc:224
void doEnergySums(const edm::Event &, const edm::InputTag &label)
void doFibres(const edm::Event &, const edm::InputTag &label)
bool doEnergySums_
Definition: DumpGctDigis.h:66
double f[11][100]
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
~DumpGctDigis() override
Definition: DumpGctDigis.cc:52
met
===> hadronic RAZOR
bool doInternEM_
Definition: DumpGctDigis.h:64
et
define resolution functions of each parameter
void doInternEM(const edm::Event &, const edm::InputTag &label)
std::string const & label() const
Definition: InputTag.h:36
edm::EventID id() const
Definition: EventBase.h:59
HLT enums.
edm::InputTag emuGctLabel_
Definition: DumpGctDigis.h:55
void doEM(const edm::Event &, const edm::InputTag &label)
Definition: DumpGctDigis.cc:97
void doRctEM(const edm::Event &, const edm::InputTag &label)