44 : DumpLevel(cfg.getParameter<
string>(
"DumpLevel")),
45 CaloJetAlg(cfg.getParameter<
string>(
"CaloJetAlg")),
46 DebugLevel(cfg.getParameter<int>(
"DebugLevel")),
47 ShowECal(cfg.getParameter<bool>(
"ShowECal")) {}
51 cout <<
"Dump of Jets" << endl;
54 cout <<
"Dump of Jets and constituent CaloTowers" << endl;
57 cout <<
"Dump of Jets, constituent CaloTowers, and constituent RecHits" << endl;
60 cout <<
"Dump of Jets, constituent CaloTowers, constituent RecHits and associated Digis" << endl;
89 cout <<
"Getting caloJets" << endl;
96 cout <<
"Getting recHits" << endl;
100 evt.
getByLabel(
"ecalRecHit",
"EcalRecHitsEB", EBRecHits);
101 evt.
getByLabel(
"ecalRecHit",
"EcalRecHitsEE", EERecHits);
103 cout <<
"# of hits gotten - HBHE: " << HBHERecHits->size() << endl;
108 cout <<
"# of digis gotten - HBHE: " << HBHEDigis->size() << endl;
110 evt.
getByLabel(
"ecalDigis",
"ebDigis", EBDigis);
111 evt.
getByLabel(
"ecalDigis",
"eeDigis", EEDigis);
115 cout << endl <<
"Evt: " <<
evtCount <<
", Num Jets=" << caloJets->end() - caloJets->begin() << endl;
117 cout <<
" *********************************************************" << endl;
120 for (CaloJetCollection::const_iterator
jet = caloJets->begin();
jet != caloJets->end(); ++
jet) {
123 std::vector<CaloTowerPtr>
towers =
jet->getCaloConstituents();
124 int nConstituents = towers.size();
125 cout <<
" Jet: " << jetInd <<
", eta=" <<
jet->eta() <<
", phi=" <<
jet->phi() <<
", pt=" <<
jet->pt()
126 <<
",E=" <<
jet->energy() <<
", EB E=" <<
jet->emEnergyInEB() <<
" ,HB E=" <<
jet->hadEnergyInHB()
127 <<
", HO E=" <<
jet->hadEnergyInHO() <<
" ,EE E=" <<
jet->emEnergyInEE() <<
", HE E=" <<
jet->hadEnergyInHE()
128 <<
", HF E=" <<
jet->hadEnergyInHF() +
jet->emEnergyInHF() <<
", Num Towers=" << nConstituents << endl;
130 cout <<
" =====================================================" << endl;
131 float sumTowerE = 0.0;
133 for (
int i = 0;
i < nConstituents;
i++) {
135 caloTowers->find(towers[
i]->
id());
136 if (theTower == caloTowers->end()) {
137 cerr <<
"Bug? Can't find the tower" << endl;
140 int ietaTower = towers[
i]->id().ieta();
141 int iphiTower = towers[
i]->id().iphi();
142 sumTowerE += theTower->energy();
143 size_t numRecHits = theTower->constituentsSize();
144 cout <<
" Tower " <<
i <<
": ieta=" << ietaTower <<
", eta=" << theTower->eta() <<
", iphi=" << iphiTower
145 <<
", phi=" << theTower->phi() <<
", energy=" << theTower->energy() <<
", EM=" << theTower->emEnergy()
146 <<
", HAD=" << theTower->hadEnergy() <<
", HO=" << theTower->outerEnergy()
147 <<
", Num Rec Hits =" << numRecHits << endl;
149 cout <<
" ------------------------------------------------" << endl;
150 float sumRecHitE = 0.0;
152 for (
size_t j = 0;
j < numRecHits;
j++) {
153 DetId RecHitDetID = theTower->constituent(
j);
161 sumRecHitE += theRecHit->energy();
163 cout <<
" RecHit: " <<
j <<
": HB, ieta=" << HcalID.
ieta() <<
", iphi=" << HcalID.
iphi()
164 <<
", depth=" << HcalID.
depth() <<
", energy=" << theRecHit->energy()
165 <<
", time=" << theRecHit->time() <<
", All Digis=" << theDigis->size()
166 <<
", presamples =" << theDigis->presamples() << endl;
172 float SumDigiCharge = 0.0;
173 float EstimatedPedestal = 0.0;
174 int SamplesToAdd = 4;
176 cout <<
" ......................................" << endl;
178 for (
int k = 0;
k < theDigis->size();
k++) {
180 if (
k >= theDigis->presamples() &&
k < theDigis->presamples() + SamplesToAdd)
182 if (k < theDigis->presamples() - 1)
183 EstimatedPedestal += QIE.
nominal_fC() * SamplesToAdd / (theDigis->presamples() - 1);
184 cout <<
" Digi: " <<
k <<
", cap ID = " << QIE.
capid()
185 <<
": ADC Counts = " << QIE.
adc() <<
", nominal fC = " << QIE.
nominal_fC() << endl;
188 cout <<
" 4 Digi fC =" << SumDigiCharge <<
", est. ped. fC=" << EstimatedPedestal
189 <<
", est. GeV/fc=" << theRecHit->energy() / (SumDigiCharge - EstimatedPedestal) << endl;
191 cout <<
" ......................................" << endl;
195 sumRecHitE += theRecHit->energy() / 2;
197 sumRecHitE += theRecHit->energy();
200 cout <<
" RecHit: " <<
j <<
": HE, ieta=" << HcalID.
ieta() <<
", iphi=" << HcalID.
iphi()
201 <<
", depth=" << HcalID.
depth() <<
", energy=" << theRecHit->energy()
202 <<
", time=" << theRecHit->time() <<
", All Digis=" << theDigis->size()
203 <<
", presamples =" << theDigis->presamples() << endl;
204 float SumDigiCharge = 0.0;
205 float EstimatedPedestal = 0.0;
206 int SamplesToAdd = 4;
208 cout <<
" ......................................" << endl;
210 for (
int k = 0;
k < theDigis->size();
k++) {
212 if (
k >= theDigis->presamples() &&
k < theDigis->presamples() + SamplesToAdd)
214 if (k < theDigis->presamples() - 1)
215 EstimatedPedestal += QIE.
nominal_fC() * SamplesToAdd / (theDigis->presamples() - 1);
216 cout <<
" Digi: " <<
k <<
", cap ID = " << QIE.
capid()
217 <<
": ADC Counts = " << QIE.
adc() <<
", nominal fC = " << QIE.
nominal_fC() << endl;
220 cout <<
" 4 Digi fC =" << SumDigiCharge <<
", est. ped. fC=" << EstimatedPedestal
221 <<
", est. GeV/fc=" << theRecHit->energy() / (SumDigiCharge - EstimatedPedestal) << endl;
223 cout <<
" ......................................" << endl;
226 sumRecHitE += theRecHit->energy();
228 cout <<
" RecHit: " <<
j <<
": HO, ieta=" << HcalID.
ieta() <<
", iphi=" << HcalID.
iphi()
229 <<
", depth=" << HcalID.
depth() <<
", energy=" << theRecHit->energy()
230 <<
", time=" << theRecHit->time() <<
", All Digis=" << theDigis->size()
231 <<
", presamples =" << theDigis->presamples() << endl;
232 float SumDigiCharge = 0.0;
233 float EstimatedPedestal = 0.0;
234 int SamplesToAdd = 4;
236 cout <<
" ......................................" << endl;
238 for (
int k = 0;
k < theDigis->size();
k++) {
240 if (
k >= theDigis->presamples() &&
k < theDigis->presamples() + SamplesToAdd)
242 if (k < theDigis->presamples() - 1)
243 EstimatedPedestal += QIE.
nominal_fC() * SamplesToAdd / (theDigis->presamples() - 1);
244 cout <<
" Digi: " <<
k <<
", cap ID = " << QIE.
capid()
245 <<
": ADC Counts = " << QIE.
adc() <<
", nominal fC = " << QIE.
nominal_fC() << endl;
248 cout <<
" 4 Digi fC =" << SumDigiCharge <<
", est. ped. fC=" << EstimatedPedestal
249 <<
", est. GeV/fc=" << theRecHit->energy() / (SumDigiCharge - EstimatedPedestal) << endl;
251 cout <<
" ......................................" << endl;
254 sumRecHitE += theRecHit->energy();
256 cout <<
" RecHit: " <<
j <<
": HF, ieta=" << HcalID.
ieta() <<
", iphi=" << HcalID.
iphi()
257 <<
", depth=" << HcalID.
depth() <<
", energy=" << theRecHit->energy()
258 <<
", time=" << theRecHit->time() <<
", All Digis=" << theDigis->size()
259 <<
", presamples =" << theDigis->presamples() << endl;
260 float SumDigiCharge = 0.0;
261 float EstimatedPedestal = 0.0;
262 int SamplesToAdd = 1;
264 cout <<
" ......................................" << endl;
266 for (
int k = 0;
k < theDigis->size();
k++) {
268 if (
k >= theDigis->presamples() &&
k < theDigis->presamples() + SamplesToAdd)
270 if (k < theDigis->presamples() - 1)
271 EstimatedPedestal += QIE.
nominal_fC() * SamplesToAdd / (theDigis->presamples() - 1);
272 cout <<
" Digi: " <<
k <<
", cap ID = " << QIE.
capid()
273 <<
": ADC Counts = " << QIE.
adc() <<
", nominal fC = " << QIE.
nominal_fC() << endl;
276 cout <<
" 1 Digi fC =" << SumDigiCharge <<
", est. ped. fC=" << EstimatedPedestal
277 <<
", est. GeV/fc=" << theRecHit->energy() / (SumDigiCharge - EstimatedPedestal) << endl;
279 cout <<
" ......................................" << endl;
283 int EcalNum = RecHitDetID.
subdetId();
288 sumRecHitE += theRecHit->energy();
289 cout <<
" RecHit " <<
j <<
": EB, ieta=" << EcalID.
ieta() <<
", iphi=" << EcalID.
iphi()
290 <<
", SM=" << EcalID.
ism() <<
", energy=" << theRecHit->energy()
291 <<
", All Digis=" << theDigis->size() << endl;
293 cout <<
" ......................................" << endl;
295 for (
unsigned int k = 0;
k < theDigis->size();
k++) {
298 cout <<
" Digi: " <<
k <<
": ADC Sample = " << MGPA.
adc()
299 <<
", Gain ID = " << MGPA.
gainId() << endl;
302 cout <<
" ......................................" << endl;
303 }
else if (EcalNum == 2) {
307 sumRecHitE += theRecHit->energy();
308 cout <<
" RecHit " <<
j <<
": EE, ix=" << EcalID.
ix() <<
", iy=" << EcalID.
iy()
309 <<
", energy=" << theRecHit->energy() <<
", All Digis=" << theDigis->size() << endl;
311 cout <<
" ......................................" << endl;
313 for (
unsigned int k = 0;
k < theDigis->size();
k++) {
316 cout <<
" Digi: " <<
k <<
": ADC Sample = " << MGPA.
adc()
317 <<
", Gain ID = " << MGPA.
gainId() << endl;
320 cout <<
" ......................................" << endl;
325 if (
abs(ietaTower) == 28 ||
abs(ietaTower) == 29) {
326 cout <<
" Splitted Sum of RecHit Energies=" << sumRecHitE
327 <<
", CaloTower energy=" << theTower->energy() << endl;
329 cout <<
" Sum of RecHit Energies=" << sumRecHitE <<
", CaloTower energy=" << theTower->energy()
334 cout <<
" ------------------------------------------------" << endl;
337 cout <<
" Sum of tower energies=" << sumTowerE <<
", CaloJet energy=" <<
jet->energy() << endl;
340 cout <<
" =====================================================" << endl;
344 cout <<
" *********************************************************" << endl;
void analyze(const edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
std::vector< CaloTower >::const_iterator const_iterator
EcalMGPASample sample(int i) const
int gainId() const
get the gainId (2 bits)
int ism() const
get the ECAL/SM id
int iphi() const
get the crystal iphi
constexpr HcalSubdetector subdet() const
get the subdetector
constexpr int iphi() const
get the cell iphi
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
Abs< T >::type abs(const T &t)
constexpr int ieta() const
get the cell ieta
int ieta() const
get the crystal ieta
constexpr double nominal_fC() const
get the nominal FC (no calibrations applied)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
constexpr int adc() const
get the ADC sample
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
constexpr int capid() const
get the Capacitor id
constexpr int depth() const
get the tower depth
JetToDigiDump(const edm::ParameterSet &)
int adc() const
get the ADC sample (12 bits)
constexpr Detector det() const
get the detector field from this detid