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 HcalCalibDigiCollection &calibdigic, double calibFC2GeV)
 
void processDigi (const HFDigiCollection &hfdigic)
 
void processDigi (const HODigiCollection &hodigic)
 
void processRH (const HBHERecHitCollection &hbherhc, const HBHEDigiCollection &hbhedgc)
 
void processRH (const HFRecHitCollection &hfrhc, const HFDigiCollection &hfdgc)
 
void processRH (const HORecHitCollection &horhc, const HODigiCollection &hodgc)
 
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 
)

Definition at line 42 of file HcalQLPlotAnalAlgos.cc.

42  {
44 
45  mf_ = new TFile(outputFilename, "RECREATE");
46  histos_ = new HcalQLPlotHistoMgr(mf_, histoParams);
47 }

References histos_, mf_, triggerID_, and HcalQLPlotHistoMgr::UNKNOWN.

Member Function Documentation

◆ end()

void HcalQLPlotAnalAlgos::end ( void  )

Definition at line 53 of file HcalQLPlotAnalAlgos.cc.

53 { mf_->Write(); }

References mf_.

Referenced by HcalQLPlotAnal::endJob().

◆ processDigi() [1/4]

void HcalQLPlotAnalAlgos::processDigi ( const HBHEDigiCollection hbhedigic)

Definition at line 151 of file HcalQLPlotAnalAlgos.cc.

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 }

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

Referenced by HcalQLPlotAnal::analyze().

◆ processDigi() [2/4]

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

Definition at line 245 of file HcalQLPlotAnalAlgos.cc.

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 }

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

◆ processDigi() [3/4]

void HcalQLPlotAnalAlgos::processDigi ( const HFDigiCollection hfdigic)

Definition at line 197 of file HcalQLPlotAnalAlgos.cc.

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 }

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

◆ processDigi() [4/4]

void HcalQLPlotAnalAlgos::processDigi ( const HODigiCollection hodigic)

Definition at line 174 of file HcalQLPlotAnalAlgos.cc.

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 }

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

◆ processRH() [1/3]

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

Definition at line 73 of file HcalQLPlotAnalAlgos.cc.

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 }

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

Referenced by HcalQLPlotAnal::analyze().

◆ processRH() [2/3]

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

Definition at line 125 of file HcalQLPlotAnalAlgos.cc.

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 }

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

◆ processRH() [3/3]

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

Definition at line 99 of file HcalQLPlotAnalAlgos.cc.

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 }

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

◆ recoCalib()

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

Definition at line 220 of file HcalQLPlotAnalAlgos.cc.

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 }

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

Referenced by processDigi().

◆ SetEventType()

void HcalQLPlotAnalAlgos::SetEventType ( const HcalTBTriggerData trigd)

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().

RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
HcalTBTriggerData::wasLEDTrigger
bool wasLEDTrigger() const
returns true if this was a LED trigger
Definition: HcalTBTriggerData.h:93
mps_fire.i
i
Definition: mps_fire.py:355
HcalQLPlotHistoMgr::BEAM
Definition: HcalQLPlotHistoMgr.h:15
HcalCalibRecHit::time
float time() const
get the hit time (if available)
Definition: HcalCalibRecHit.h:19
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
HcalQLPlotHistoMgr::ENERGY
Definition: HcalQLPlotHistoMgr.h:14
HcalQLPlotHistoMgr
Definition: HcalQLPlotHistoMgr.h:12
HcalCalibDetId
Definition: HcalCalibDetId.h:45
findQualityFiles.maxI
int maxI
Definition: findQualityFiles.py:182
HcalQLPlotAnalAlgos::recoCalib
HcalCalibRecHit recoCalib(const HcalCalibDataFrame &cdigi, double calibFC2GeV)
Definition: HcalQLPlotAnalAlgos.cc:220
HcalTBTriggerData::wasSpillIgnorantPedestalTrigger
bool wasSpillIgnorantPedestalTrigger() const
returns true if this trigger was a calibration trigger
Definition: HcalTBTriggerData.h:79
FrontierCondition_GT_autoExpress_cfi.t0
t0
Definition: FrontierCondition_GT_autoExpress_cfi.py:148
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
HcalTBTriggerData::wasInSpillPedestalTrigger
bool wasInSpillPedestalTrigger() const
returns true if this was an in-spill pedestal trigger
Definition: HcalTBTriggerData.h:87
HcalElectronicsId
Readout chain identification for Hcal.
Definition: HcalElectronicsId.h:32
HcalCalibRecHit::amplitude
float amplitude() const
get the amplitude (generally fC, but can vary)
Definition: HcalCalibRecHit.h:17
HcalQLPlotAnalAlgos::triggerID_
HcalQLPlotHistoMgr::EventType triggerID_
Definition: HcalQLPlotAnalAlgos.h:35
HcalQLPlotHistoMgr::TIME
Definition: HcalQLPlotHistoMgr.h:14
edm::LogWarning
Definition: MessageLogger.h:141
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
HcalCalibRecHit
Definition: HcalCalibRecHit.h:10
edm::LogError
Definition: MessageLogger.h:183
HcalQLPlotHistoMgr::PULSE
Definition: HcalQLPlotHistoMgr.h:14
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
HcalCalibDataFrame::presamples
int presamples() const
number of samples before the sample from the triggered beam crossing (according to the hardware)
Definition: HcalCalibDataFrame.h:28
HcalDetId
Definition: HcalDetId.h:12
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
HcalQLPlotHistoMgr::LED
Definition: HcalQLPlotHistoMgr.h:15
HcalQLPlotHistoMgr::LASER
Definition: HcalQLPlotHistoMgr.h:15
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
edm::SortedCollection::find
iterator find(key_type k)
Definition: SortedCollection.h:240
HcalTBTriggerData::wasOutSpillPedestalTrigger
bool wasOutSpillPedestalTrigger() const
returns true if this was an out-of-spill pedestal trigger
Definition: HcalTBTriggerData.h:84
HcalQLPlotHistoMgr::UNKNOWN
Definition: HcalQLPlotHistoMgr.h:15
HcalQLPlotAnalAlgos::mf_
TFile * mf_
Definition: HcalQLPlotAnalAlgos.h:37
HcalQLPlotHistoMgr::PEDESTAL
Definition: HcalQLPlotHistoMgr.h:15
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
HcalTBTriggerData::wasLaserTrigger
bool wasLaserTrigger() const
returns true if this was a laser trigger
Definition: HcalTBTriggerData.h:90
HcalCalibDataFrame::size
int size() const
total number of samples in the digi
Definition: HcalCalibDataFrame.h:26
HcalQLPlotHistoMgr::ADC
Definition: HcalQLPlotHistoMgr.h:14
HcalTBTriggerData::wasBeamTrigger
bool wasBeamTrigger() const
returns true if this trigger came from beam data
Definition: HcalTBTriggerData.h:73
ntuplemaker.time
time
Definition: ntuplemaker.py:310
HcalCalibDataFrame::id
const HcalCalibDetId & id() const
Definition: HcalCalibDataFrame.h:22
HcalQLPlotAnalAlgos::histos_
HcalQLPlotHistoMgr * histos_
Definition: HcalQLPlotAnalAlgos.h:36
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
HcalQLPlotHistoMgr::GetAHistogram
TH1 * GetAHistogram(const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
Definition: HcalQLPlotHistoMgr.cc:64