CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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::endl;
23 using std::ios;
24 using std::string;
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  //now do what ever initialization is needed
45 
46  outFile_.open(outFilename_.c_str(), ios::out);
47 }
48 
50  // do anything here that needs to be done at desctruction time
51  // (e.g. close files, deallocate resources etc.)
52 
53  outFile_.close();
54 }
55 
56 //
57 // member functions
58 //
59 
60 // ------------ method called to produce the data ------------
62  using namespace edm;
63 
64  outFile_ << "Run :" << iEvent.id().run() << " Event :" << iEvent.id().event() << endl;
65 
66  // EM
67  if (doRctEM_ && doHW_) {
68  doRctEM(iEvent, rawLabel_);
69  }
70  if (doRctEM_ && doEmu_) {
71  doRctEM(iEvent, emuRctLabel_);
72  }
73  if (doEM_ && doHW_) {
74  doEM(iEvent, rawLabel_);
75  }
76  if (doEM_ && doEmu_) {
77  doEM(iEvent, emuGctLabel_);
78  }
79 
80  // Jets
81  if (doRegions_ && doHW_) {
82  doRegions(iEvent, rawLabel_);
83  }
84  if (doRegions_ && doEmu_) {
85  doRegions(iEvent, emuRctLabel_);
86  }
87  if (doJets_ && doHW_) {
88  doJets(iEvent, rawLabel_);
89  }
90  if (doJets_ && doEmu_) {
91  doJets(iEvent, emuGctLabel_);
92  }
93 
94  // Energy Sums
95  if (doEnergySums_ && doHW_) {
96  doEnergySums(iEvent, rawLabel_);
97  }
98  if (doEnergySums_ && doEmu_) {
99  doEnergySums(iEvent, emuGctLabel_);
100  }
101 
102  // debugging
103  if (doInternEM_ && doHW_) {
104  doInternEM(iEvent, rawLabel_);
105  }
106  if (doFibres_ && doHW_) {
107  doFibres(iEvent, rawLabel_);
108  }
109 }
110 
112  using namespace edm;
113 
116 
117  L1GctEmCandCollection::const_iterator ie;
118  L1GctEmCandCollection::const_iterator ne;
119 
120  iEvent.getByLabel(label.label(), "isoEm", isoEm);
121  iEvent.getByLabel(label.label(), "nonIsoEm", nonIsoEm);
122 
123  outFile_ << "Iso EM from : " << label.label() << endl;
124  for (ie = isoEm->begin(); ie != isoEm->end(); ie++) {
125  outFile_ << (*ie) << " ieta(detID)=" << ie->regionId().ieta() << " iphi(detID)=" << ie->regionId().iphi() << endl;
126  }
127  outFile_ << endl;
128 
129  outFile_ << "Non-iso EM from : " << label.label() << endl;
130  for (ne = nonIsoEm->begin(); ne != nonIsoEm->end(); ne++) {
131  outFile_ << (*ne) << " ieta(detID)=" << ne->regionId().ieta() << " iphi(detID)=" << ne->regionId().iphi() << endl;
132  }
133  outFile_ << endl;
134 }
135 
137  using namespace edm;
138 
140 
141  L1CaloEmCollection::const_iterator e;
142 
143  iEvent.getByLabel(label, em);
144 
145  outFile_ << "RCT EM from : " << label.label() << endl;
146  for (e = em->begin(); e != em->end(); e++) {
147  if (e->rank() >= rctEmMinRank_) {
148  outFile_ << (*e) << " ieta(detID)=" << e->regionId().ieta() << " iphi(detID)=" << e->regionId().iphi() << endl;
149  }
150  }
151  outFile_ << endl;
152 }
153 
155  using namespace edm;
156 
158 
159  L1CaloRegionCollection::const_iterator r;
160 
161  iEvent.getByLabel(label, rgns);
162 
163  outFile_ << "Regions from : " << label.label() << endl;
164  for (r = rgns->begin(); r != rgns->end(); r++) {
165  outFile_ << (*r) << endl;
166  }
167  outFile_ << endl;
168 }
169 
171  using namespace edm;
172 
176 
177  L1GctJetCandCollection::const_iterator cj;
178  L1GctJetCandCollection::const_iterator fj;
179  L1GctJetCandCollection::const_iterator tj;
180 
181  const std::string& labelStr = label.label();
182 
183  iEvent.getByLabel(labelStr, "cenJets", cenJets);
184  iEvent.getByLabel(labelStr, "forJets", forJets);
185  iEvent.getByLabel(labelStr, "tauJets", tauJets);
186 
187  outFile_ << "Central jets from : " << labelStr << endl;
188  for (cj = cenJets->begin(); cj != cenJets->end(); cj++) {
189  outFile_ << (*cj) << endl;
190  }
191  outFile_ << endl;
192 
193  outFile_ << "Forward jets from : " << labelStr << endl;
194  for (fj = forJets->begin(); fj != forJets->end(); fj++) {
195  outFile_ << (*fj) << endl;
196  }
197  outFile_ << endl;
198 
199  outFile_ << "Tau jets from : " << labelStr << endl;
200  for (tj = tauJets->begin(); tj != tauJets->end(); tj++) {
201  outFile_ << (*tj) << endl;
202  }
203 }
204 
206  using namespace edm;
207 
209 
210  L1GctInternEmCandCollection::const_iterator e;
211 
212  iEvent.getByLabel(label, em);
213 
214  outFile_ << "Internal EM from : " << label.label() << endl;
215  for (e = em->begin(); e != em->end(); e++) {
216  outFile_ << (*e) << " ieta(detID)=" << e->regionId().ieta() << " iphi(detID)=" << e->regionId().iphi() << endl;
217  }
218  outFile_ << endl;
219 }
220 
222  using namespace edm;
223 
225 
226  L1GctFibreCollection::const_iterator f;
227 
228  iEvent.getByLabel(label, fibres);
229 
230  outFile_ << "Fibres from : " << label.label() << endl;
231  for (f = fibres->begin(); f != fibres->end(); f++) {
232  outFile_ << (*f) << endl;
233  }
234  outFile_ << endl;
235 }
236 
238  using namespace edm;
239 
244 
245  iEvent.getByLabel(label, etTotal);
246  iEvent.getByLabel(label, etHad);
247  iEvent.getByLabel(label, etMiss);
248  iEvent.getByLabel(label, htMiss);
249 
250  outFile_ << "Energy sums from: " << label.label() << endl;
251 
252  L1GctEtTotalCollection::const_iterator et;
253  for (et = etTotal->begin(); et != etTotal->end(); et++) {
254  outFile_ << *(et) << endl;
255  }
256 
257  L1GctEtHadCollection::const_iterator ht;
258  for (ht = etHad->begin(); ht != etHad->end(); ht++) {
259  outFile_ << *(ht) << endl;
260  }
261 
262  L1GctEtMissCollection::const_iterator met;
263  for (met = etMiss->begin(); met != etMiss->end(); met++) {
264  outFile_ << *(met) << endl;
265  }
266 
267  L1GctHtMissCollection::const_iterator mht;
268  for (mht = htMiss->begin(); mht != htMiss->end(); mht++) {
269  outFile_ << *(mht) << endl;
270  }
271 }
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
edm::InputTag rawLabel_
Definition: DumpGctDigis.h:52
edm::InputTag emuRctLabel_
Definition: DumpGctDigis.h:53
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: DumpGctDigis.cc:61
DumpGctDigis(const edm::ParameterSet &)
Definition: DumpGctDigis.cc:29
unsigned rctEmMinRank_
Definition: DumpGctDigis.h:67
std::string outFilename_
Definition: DumpGctDigis.h:55
std::ofstream outFile_
Definition: DumpGctDigis.h:69
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:65
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:500
~DumpGctDigis() override
Definition: DumpGctDigis.cc:49
bool doInternEM_
Definition: DumpGctDigis.h:63
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
edm::InputTag emuGctLabel_
Definition: DumpGctDigis.h:54
void doEM(const edm::Event &, const edm::InputTag &label)
void doRctEM(const edm::Event &, const edm::InputTag &label)