CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HcalQLPlotAnalAlgos Class Reference

#include <HcalQLPlotAnalAlgos.h>

Public Member Functions

void end (void)
 
 HcalQLPlotAnalAlgos (const char *outputFilename, const edm::ParameterSet &histoParams)
 
void processDigi (const HBHEDigiCollection &hbhedigic)
 
void processDigi (const HODigiCollection &hodigic)
 
void processDigi (const HFDigiCollection &hfdigic)
 
void processDigi (const HcalCalibDigiCollection &calibdigic, double calibFC2GeV)
 
void processRH (const HBHERecHitCollection &hbherhc, const HBHEDigiCollection &hbhedgc)
 
void processRH (const HORecHitCollection &horhc, const HODigiCollection &hodgc)
 
void processRH (const HFRecHitCollection &hfrhc, const HFDigiCollection &hfdgc)
 
void SetEventType (const HcalTBTriggerData &trigd)
 

Private Member Functions

HcalCalibRecHit recoCalib (const HcalCalibDataFrame &cdigi, double calibFC2GeV)
 

Private Attributes

HcalQLPlotHistoMgrhistos_
 
TFile * mf_
 
HcalQLPlotHistoMgr::EventType triggerID_
 

Detailed Description

Definition at line 17 of file HcalQLPlotAnalAlgos.h.

Constructor & Destructor Documentation

◆ HcalQLPlotAnalAlgos()

HcalQLPlotAnalAlgos::HcalQLPlotAnalAlgos ( const char *  outputFilename,
const edm::ParameterSet histoParams 
)

Member Function Documentation

◆ end()

void HcalQLPlotAnalAlgos::end ( void  )

Definition at line 53 of file HcalQLPlotAnalAlgos.cc.

References mf_.

Referenced by HcalQLPlotAnal::endJob().

53 { mf_->Write(); }

◆ processDigi() [1/4]

void HcalQLPlotAnalAlgos::processDigi ( const HBHEDigiCollection hbhedigic)

Definition at line 151 of file HcalQLPlotAnalAlgos.cc.

References HcalQLPlotHistoMgr::ADC, edm::SortedCollection< T, SORT >::begin(), newFWLiteAna::bin, runTauDisplay::eid, edm::SortedCollection< T, SORT >::end(), HcalQLPlotHistoMgr::GetAHistogram(), histos_, l1ctLayer2EG_cff::id, HcalQLPlotHistoMgr::PEDESTAL, HcalQLPlotHistoMgr::PULSE, and triggerID_.

Referenced by HcalQLPlotAnal::analyze().

151  {
153 
154  for (it = hbhedigic.begin(); it != hbhedigic.end(); it++) {
155  HcalDetId id(it->id());
156  HcalElectronicsId eid(it->elecId());
157 
159  if (phist) {
160  for (int bin = 0; bin < it->size(); bin++)
161  phist->Fill(bin * 1.0, (*it)[bin].nominal_fC());
162  }
163 
166  if (phist) {
167  for (int bin = 0; bin < it->size(); bin++)
168  phist->Fill((*it)[bin].adc());
169  }
170  }
171  }
172 }
std::vector< T >::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
HcalQLPlotHistoMgr * histos_
TH1 * GetAHistogram(const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
HcalQLPlotHistoMgr::EventType triggerID_
Readout chain identification for Hcal.

◆ processDigi() [2/4]

void HcalQLPlotAnalAlgos::processDigi ( const HODigiCollection hodigic)

Definition at line 174 of file HcalQLPlotAnalAlgos.cc.

References HcalQLPlotHistoMgr::ADC, edm::SortedCollection< T, SORT >::begin(), newFWLiteAna::bin, runTauDisplay::eid, edm::SortedCollection< T, SORT >::end(), HcalQLPlotHistoMgr::GetAHistogram(), histos_, l1ctLayer2EG_cff::id, HcalQLPlotHistoMgr::PEDESTAL, HcalQLPlotHistoMgr::PULSE, and triggerID_.

174  {
176 
177  for (it = hodigic.begin(); it != hodigic.end(); it++) {
178  HcalDetId id(it->id());
179  HcalElectronicsId eid(it->elecId());
180 
182  if (phist) {
183  for (int bin = 0; bin < it->size(); bin++)
184  phist->Fill(bin * 1.0, (*it)[bin].nominal_fC());
185  }
186 
189  if (phist) {
190  for (int bin = 0; bin < it->size(); bin++)
191  phist->Fill((*it)[bin].adc());
192  }
193  }
194  }
195 }
std::vector< T >::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
HcalQLPlotHistoMgr * histos_
TH1 * GetAHistogram(const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
HcalQLPlotHistoMgr::EventType triggerID_
Readout chain identification for Hcal.

◆ processDigi() [3/4]

void HcalQLPlotAnalAlgos::processDigi ( const HFDigiCollection hfdigic)

Definition at line 197 of file HcalQLPlotAnalAlgos.cc.

References HcalQLPlotHistoMgr::ADC, edm::SortedCollection< T, SORT >::begin(), newFWLiteAna::bin, runTauDisplay::eid, edm::SortedCollection< T, SORT >::end(), HcalQLPlotHistoMgr::GetAHistogram(), histos_, l1ctLayer2EG_cff::id, HcalQLPlotHistoMgr::PEDESTAL, HcalQLPlotHistoMgr::PULSE, and triggerID_.

197  {
199 
200  for (it = hfdigic.begin(); it != hfdigic.end(); it++) {
201  HcalDetId id(it->id());
202  HcalElectronicsId eid(it->elecId());
203 
205  if (phist) {
206  for (int bin = 0; bin < it->size(); bin++)
207  phist->Fill(bin * 1.0, (*it)[bin].nominal_fC());
208  }
209 
212  if (phist) {
213  for (int bin = 0; bin < it->size(); bin++)
214  phist->Fill((*it)[bin].adc());
215  }
216  }
217  }
218 }
std::vector< T >::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
HcalQLPlotHistoMgr * histos_
TH1 * GetAHistogram(const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
HcalQLPlotHistoMgr::EventType triggerID_
Readout chain identification for Hcal.

◆ processDigi() [4/4]

void HcalQLPlotAnalAlgos::processDigi ( const HcalCalibDigiCollection calibdigic,
double  calibFC2GeV 
)

Definition at line 245 of file HcalQLPlotAnalAlgos.cc.

References HcalCalibRecHit::amplitude(), edm::SortedCollection< T, SORT >::begin(), newFWLiteAna::bin, runTauDisplay::eid, edm::SortedCollection< T, SORT >::end(), HcalQLPlotHistoMgr::ENERGY, HcalQLPlotHistoMgr::GetAHistogram(), histos_, l1ctLayer2EG_cff::id, HcalQLPlotHistoMgr::PULSE, recoCalib(), HcalQLPlotHistoMgr::TIME, HcalCalibRecHit::time(), and triggerID_.

245  {
247 
248  for (it = calibdigic.begin(); it != calibdigic.end(); it++) {
249  HcalCalibDetId id(it->id());
250  HcalElectronicsId eid(it->elecId());
251 
253  if (phist) {
254  for (int bin = 0; bin < it->size(); bin++)
255  phist->Fill(bin * 1.0, (*it)[bin].nominal_fC());
256  }
257 
258  // HACK-reco the calib digi into a rechit:
259  //
260  HcalCalibRecHit rh = recoCalib(*it, calibFC2GeV);
261 
263  if (ehist) {
264  ehist->Fill(rh.amplitude());
265  }
266 
268  if (thist) {
269  thist->Fill(rh.time());
270  }
271  }
272 }
std::vector< T >::const_iterator const_iterator
HcalCalibRecHit recoCalib(const HcalCalibDataFrame &cdigi, double calibFC2GeV)
float time() const
get the hit time (if available)
float amplitude() const
get the amplitude (generally fC, but can vary)
const_iterator begin() const
const_iterator end() const
HcalQLPlotHistoMgr * histos_
TH1 * GetAHistogram(const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
HcalQLPlotHistoMgr::EventType triggerID_
Readout chain identification for Hcal.

◆ processRH() [1/3]

void HcalQLPlotAnalAlgos::processRH ( const HBHERecHitCollection hbherhc,
const HBHEDigiCollection hbhedgc 
)

Definition at line 73 of file HcalQLPlotAnalAlgos.cc.

References edm::SortedCollection< T, SORT >::begin(), runTauDisplay::eid, edm::SortedCollection< T, SORT >::end(), HcalQLPlotHistoMgr::ENERGY, edm::SortedCollection< T, SORT >::find(), HcalQLPlotHistoMgr::GetAHistogram(), histos_, l1ctLayer2EG_cff::id, HcalQLPlotHistoMgr::TIME, and triggerID_.

Referenced by HcalQLPlotAnal::analyze().

73  {
75 
76  for (it = hbherhc.begin(); it != hbherhc.end(); it++) {
77  HcalDetId id(it->id());
79  HBHEDigiCollection::const_iterator dit = hbhedgc.find(id);
80  if (dit != hbhedgc.end())
81  eid = dit->elecId();
82  else {
83  edm::LogWarning("HcalQLPlotAnalAlgos::processRH") << "No digi found for id" << id;
84  continue;
85  }
86 
88  if (ehist) {
89  ehist->Fill(it->energy());
90  }
91 
93  if (thist) {
94  thist->Fill(it->time());
95  }
96  }
97 }
std::vector< T >::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
HcalQLPlotHistoMgr * histos_
TH1 * GetAHistogram(const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
iterator find(key_type k)
Log< level::Warning, false > LogWarning
HcalQLPlotHistoMgr::EventType triggerID_
Readout chain identification for Hcal.

◆ processRH() [2/3]

void HcalQLPlotAnalAlgos::processRH ( const HORecHitCollection horhc,
const HODigiCollection hodgc 
)

Definition at line 99 of file HcalQLPlotAnalAlgos.cc.

References edm::SortedCollection< T, SORT >::begin(), runTauDisplay::eid, edm::SortedCollection< T, SORT >::end(), HcalQLPlotHistoMgr::ENERGY, edm::SortedCollection< T, SORT >::find(), HcalQLPlotHistoMgr::GetAHistogram(), histos_, l1ctLayer2EG_cff::id, HcalQLPlotHistoMgr::TIME, and triggerID_.

99  {
101 
102  for (it = horhc.begin(); it != horhc.end(); it++) {
103  HcalDetId id(it->id());
105  HODigiCollection::const_iterator dit = hodgc.find(id);
106  if (dit != hodgc.end())
107  eid = dit->elecId();
108  else {
109  edm::LogWarning("HcalQLPlotAnalAlgos::processRH") << "No digi found for id" << id;
110  continue;
111  }
112 
114  if (ehist) {
115  ehist->Fill(it->energy());
116  }
117 
119  if (thist) {
120  thist->Fill(it->time());
121  }
122  }
123 }
std::vector< T >::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
HcalQLPlotHistoMgr * histos_
TH1 * GetAHistogram(const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
iterator find(key_type k)
Log< level::Warning, false > LogWarning
HcalQLPlotHistoMgr::EventType triggerID_
Readout chain identification for Hcal.

◆ processRH() [3/3]

void HcalQLPlotAnalAlgos::processRH ( const HFRecHitCollection hfrhc,
const HFDigiCollection hfdgc 
)

Definition at line 125 of file HcalQLPlotAnalAlgos.cc.

References edm::SortedCollection< T, SORT >::begin(), runTauDisplay::eid, edm::SortedCollection< T, SORT >::end(), HcalQLPlotHistoMgr::ENERGY, edm::SortedCollection< T, SORT >::find(), HcalQLPlotHistoMgr::GetAHistogram(), histos_, l1ctLayer2EG_cff::id, HcalQLPlotHistoMgr::TIME, and triggerID_.

125  {
127 
128  for (it = hfrhc.begin(); it != hfrhc.end(); it++) {
129  HcalDetId id(it->id());
131  HFDigiCollection::const_iterator dit = hfdgc.find(id);
132  if (dit != hfdgc.end())
133  eid = dit->elecId();
134  else {
135  edm::LogWarning("HcalQLPlotAnalAlgos::processRH") << "No digi found for id" << id;
136  continue;
137  }
138 
140  if (ehist) {
141  ehist->Fill(it->energy());
142  }
143 
145  if (thist) {
146  thist->Fill(it->time());
147  }
148  }
149 }
std::vector< T >::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
HcalQLPlotHistoMgr * histos_
TH1 * GetAHistogram(const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
iterator find(key_type k)
Log< level::Warning, false > LogWarning
HcalQLPlotHistoMgr::EventType triggerID_
Readout chain identification for Hcal.

◆ recoCalib()

HcalCalibRecHit HcalQLPlotAnalAlgos::recoCalib ( const HcalCalibDataFrame cdigi,
double  calibFC2GeV 
)
private

Definition at line 220 of file HcalQLPlotAnalAlgos.cc.

References mps_fire::i, HcalCalibDataFrame::id(), findQualityFiles::maxI, HcalCalibDataFrame::presamples(), HcalCalibDataFrame::size(), FrontierCondition_GT_autoExpress_cfi::t0, RandomServiceHelper::t2, and hcalRecHitTable_cff::time.

Referenced by processDigi().

220  {
221  double nominal_ped = (cdigi[0].nominal_fC() + cdigi[1].nominal_fC()) / 2.0;
222 
223  double totamp = 0.0;
224  double maxA = -1e99;
225  int maxI = -1;
226  for (int i = 0; i < cdigi.size(); i++) {
227  double ampl = (cdigi[i].nominal_fC() - nominal_ped) * calibFC2GeV;
228  totamp += ampl;
229 
230  if (ampl > maxA) {
231  maxA = ampl;
232  maxI = i;
233  }
234  }
235 
236  maxA = fabs(maxA);
237  float t0 = (maxI > 0) ? (fabs((cdigi[maxI - 1].nominal_fC() - nominal_ped)) * calibFC2GeV) : 0.0;
238  float t2 = fabs((cdigi[maxI + 1].nominal_fC() - nominal_ped) * calibFC2GeV);
239  float wpksamp = (maxA + 2.0 * t2) / (t0 + maxA + t2);
240  float time = (maxI - cdigi.presamples() + wpksamp) * 25.0;
241 
242  return HcalCalibRecHit(cdigi.id(), totamp, time);
243 }
int presamples() const
number of samples before the sample from the triggered beam crossing (according to the hardware) ...
int size() const
total number of samples in the digi
const HcalCalibDetId & id() const

◆ SetEventType()

void HcalQLPlotAnalAlgos::SetEventType ( const HcalTBTriggerData trigd)

Definition at line 55 of file HcalQLPlotAnalAlgos.cc.

References HcalQLPlotHistoMgr::BEAM, MillePedeFileConverter_cfg::e, cppFunctionSkipper::exception, HcalQLPlotHistoMgr::LASER, HcalQLPlotHistoMgr::LED, HcalQLPlotHistoMgr::PEDESTAL, triggerID_, HcalQLPlotHistoMgr::UNKNOWN, HcalTBTriggerData::wasBeamTrigger(), HcalTBTriggerData::wasInSpillPedestalTrigger(), HcalTBTriggerData::wasLaserTrigger(), HcalTBTriggerData::wasLEDTrigger(), HcalTBTriggerData::wasOutSpillPedestalTrigger(), and HcalTBTriggerData::wasSpillIgnorantPedestalTrigger().

Referenced by HcalQLPlotAnal::analyze().

55  {
59  if (trigd.wasLEDTrigger())
61  if (trigd.wasLaserTrigger())
63  if (trigd.wasBeamTrigger())
65 
67  edm::LogError("HcalQLPlotAnalAlgos::begin") << "Trigger Type unrecognized, aborting";
69  throw e;
70  }
71 }
bool wasLEDTrigger() const
returns true if this was a LED trigger
Log< level::Error, false > LogError
bool wasSpillIgnorantPedestalTrigger() const
returns true if this trigger was a calibration trigger
bool wasInSpillPedestalTrigger() const
returns true if this was an in-spill pedestal trigger
bool wasOutSpillPedestalTrigger() const
returns true if this was an out-of-spill pedestal trigger
bool wasLaserTrigger() const
returns true if this was a laser trigger
bool wasBeamTrigger() const
returns true if this trigger came from beam data
HcalQLPlotHistoMgr::EventType triggerID_

Member Data Documentation

◆ histos_

HcalQLPlotHistoMgr* HcalQLPlotAnalAlgos::histos_
private

Definition at line 36 of file HcalQLPlotAnalAlgos.h.

Referenced by HcalQLPlotAnalAlgos(), processDigi(), and processRH().

◆ mf_

TFile* HcalQLPlotAnalAlgos::mf_
private

Definition at line 37 of file HcalQLPlotAnalAlgos.h.

Referenced by end(), and HcalQLPlotAnalAlgos().

◆ triggerID_

HcalQLPlotHistoMgr::EventType HcalQLPlotAnalAlgos::triggerID_
private

Definition at line 35 of file HcalQLPlotAnalAlgos.h.

Referenced by HcalQLPlotAnalAlgos(), processDigi(), processRH(), and SetEventType().