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 ( const char *  outputFilename,
const edm::ParameterSet histoParams 
)

Definition at line 43 of file HcalQLPlotAnalAlgos.cc.

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

45 {
47 
48  mf_ = new TFile(outputFilename,"RECREATE");
49  histos_ = new HcalQLPlotHistoMgr(mf_,histoParams);
50 }
HcalQLPlotHistoMgr * histos_
HcalQLPlotHistoMgr::EventType triggerID_

Member Function Documentation

void HcalQLPlotAnalAlgos::end ( void  )

Definition at line 57 of file HcalQLPlotAnalAlgos.cc.

References mf_.

Referenced by HcalQLPlotAnal::endJob().

58 {
59  mf_->Write();
60 }
void HcalQLPlotAnalAlgos::processDigi ( const HBHEDigiCollection hbhedigic)

Definition at line 173 of file HcalQLPlotAnalAlgos.cc.

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

Referenced by HcalQLPlotAnal::analyze().

174 {
176 
177  for (it = hbhedigic.begin();
178  it != hbhedigic.end();
179  it++) {
180  HcalDetId id (it->id());
181  HcalElectronicsId eid (it->elecId());
182 
184  if (phist){
185  for (int bin=0; bin<it->size(); bin++)
186  phist->Fill(bin*1.0,(*it)[bin].nominal_fC());
187  }
188 
191  if (phist){
192  for (int bin=0; bin<it->size(); bin++)
193  phist->Fill((*it)[bin].adc());
194  }
195  }
196  }
197 }
std::vector< HBHEDataFrame >::const_iterator const_iterator
bin
set the eta bin as selection string.
HcalQLPlotHistoMgr * histos_
const_iterator end() const
TH1 * GetAHistogram(const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
HcalQLPlotHistoMgr::EventType triggerID_
Readout chain identification for Hcal.
const_iterator begin() const
void HcalQLPlotAnalAlgos::processDigi ( const HODigiCollection hodigic)

Definition at line 199 of file HcalQLPlotAnalAlgos.cc.

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

200 {
202 
203  for (it = hodigic.begin();
204  it != hodigic.end();
205  it++) {
206  HcalDetId id (it->id());
207  HcalElectronicsId eid (it->elecId());
208 
210  if (phist){
211  for (int bin=0; bin<it->size(); bin++)
212  phist->Fill(bin*1.0,(*it)[bin].nominal_fC());
213  }
214 
217  if (phist){
218  for (int bin=0; bin<it->size(); bin++)
219  phist->Fill((*it)[bin].adc());
220  }
221  }
222  }
223 }
std::vector< HODataFrame >::const_iterator const_iterator
bin
set the eta bin as selection string.
HcalQLPlotHistoMgr * histos_
const_iterator end() const
TH1 * GetAHistogram(const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
HcalQLPlotHistoMgr::EventType triggerID_
Readout chain identification for Hcal.
const_iterator begin() const
void HcalQLPlotAnalAlgos::processDigi ( const HFDigiCollection hfdigic)

Definition at line 225 of file HcalQLPlotAnalAlgos.cc.

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

226 {
228 
229  for (it = hfdigic.begin();
230  it != hfdigic.end();
231  it++) {
232  HcalDetId id (it->id());
233  HcalElectronicsId eid (it->elecId());
234 
236  if (phist){
237  for (int bin=0; bin<it->size(); bin++)
238  phist->Fill(bin*1.0,(*it)[bin].nominal_fC());
239  }
240 
243  if (phist){
244  for (int bin=0; bin<it->size(); bin++)
245  phist->Fill((*it)[bin].adc());
246  }
247  }
248  }
249 }
std::vector< HFDataFrame >::const_iterator const_iterator
bin
set the eta bin as selection string.
HcalQLPlotHistoMgr * histos_
const_iterator end() const
TH1 * GetAHistogram(const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
HcalQLPlotHistoMgr::EventType triggerID_
Readout chain identification for Hcal.
const_iterator begin() const
void HcalQLPlotAnalAlgos::processDigi ( const HcalCalibDigiCollection calibdigic,
double  calibFC2GeV 
)

Definition at line 278 of file HcalQLPlotAnalAlgos.cc.

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

280 {
282 
283  for (it = calibdigic.begin();
284  it != calibdigic.end();
285  it++) {
286  HcalCalibDetId id (it->id());
287  HcalElectronicsId eid (it->elecId());
288 
290  if (phist){
291  for (int bin=0; bin<it->size(); bin++)
292  phist->Fill(bin*1.0,(*it)[bin].nominal_fC());
293  }
294 
295  // HACK-reco the calib digi into a rechit:
296  //
297  HcalCalibRecHit rh = recoCalib(*it, calibFC2GeV);
298 
300  if (ehist){
301  ehist->Fill(rh.amplitude());
302  }
303 
305  if (thist){
306  thist->Fill(rh.time());
307  }
308  }
309 }
float amplitude() const
get the amplitude (generally fC, but can vary)
std::vector< HcalCalibDataFrame >::const_iterator const_iterator
HcalCalibRecHit recoCalib(const HcalCalibDataFrame &cdigi, double calibFC2GeV)
bin
set the eta bin as selection string.
HcalQLPlotHistoMgr * histos_
const_iterator end() const
TH1 * GetAHistogram(const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
float time() const
get the hit time (if available)
HcalQLPlotHistoMgr::EventType triggerID_
Readout chain identification for Hcal.
const_iterator begin() const
void HcalQLPlotAnalAlgos::processRH ( const HBHERecHitCollection hbherhc,
const HBHEDigiCollection hbhedgc 
)

Definition at line 80 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_, hcalTTPDigis_cfi::id, HcalQLPlotHistoMgr::TIME, and triggerID_.

Referenced by HcalQLPlotAnal::analyze().

82 {
84 
85  for (it = hbherhc.begin();
86  it != hbherhc.end();
87  it++) {
88  HcalDetId id (it->id());
90  HBHEDigiCollection::const_iterator dit = hbhedgc.find(id);
91  if (dit != hbhedgc.end())
92  eid = dit->elecId();
93  else {
94  edm::LogWarning("HcalQLPlotAnalAlgos::processRH") <<
95  "No digi found for id" << id;
96  continue;
97  }
98 
100  if (ehist){
101  ehist->Fill(it->energy());
102  }
103 
105  if (thist){
106  thist->Fill(it->time());
107  }
108  }
109 }
std::vector< HBHERecHit >::const_iterator const_iterator
HcalQLPlotHistoMgr * histos_
const_iterator end() const
TH1 * GetAHistogram(const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
iterator find(key_type k)
HcalQLPlotHistoMgr::EventType triggerID_
Readout chain identification for Hcal.
const_iterator begin() const
void HcalQLPlotAnalAlgos::processRH ( const HORecHitCollection horhc,
const HODigiCollection hodgc 
)

Definition at line 111 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_, hcalTTPDigis_cfi::id, HcalQLPlotHistoMgr::TIME, and triggerID_.

113 {
115 
116  for (it = horhc.begin();
117  it != horhc.end();
118  it++) {
119  HcalDetId id (it->id());
121  HODigiCollection::const_iterator dit = hodgc.find(id);
122  if (dit != hodgc.end())
123  eid = dit->elecId();
124  else {
125  edm::LogWarning("HcalQLPlotAnalAlgos::processRH") <<
126  "No digi found for id" << id;
127  continue;
128  }
129 
131  if (ehist){
132  ehist->Fill(it->energy());
133  }
134 
136  if (thist){
137  thist->Fill(it->time());
138  }
139  }
140 }
std::vector< HORecHit >::const_iterator const_iterator
HcalQLPlotHistoMgr * histos_
const_iterator end() const
TH1 * GetAHistogram(const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
iterator find(key_type k)
HcalQLPlotHistoMgr::EventType triggerID_
Readout chain identification for Hcal.
const_iterator begin() const
void HcalQLPlotAnalAlgos::processRH ( const HFRecHitCollection hfrhc,
const HFDigiCollection hfdgc 
)

Definition at line 142 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_, hcalTTPDigis_cfi::id, HcalQLPlotHistoMgr::TIME, and triggerID_.

144 {
146 
147  for (it = hfrhc.begin();
148  it != hfrhc.end();
149  it++) {
150  HcalDetId id (it->id());
152  HFDigiCollection::const_iterator dit = hfdgc.find(id);
153  if (dit != hfdgc.end())
154  eid = dit->elecId();
155  else {
156  edm::LogWarning("HcalQLPlotAnalAlgos::processRH") <<
157  "No digi found for id" << id;
158  continue;
159  }
160 
162  if (ehist){
163  ehist->Fill(it->energy());
164  }
165 
167  if (thist){
168  thist->Fill(it->time());
169  }
170  }
171 }
std::vector< HFRecHit >::const_iterator const_iterator
HcalQLPlotHistoMgr * histos_
const_iterator end() const
TH1 * GetAHistogram(const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
iterator find(key_type k)
HcalQLPlotHistoMgr::EventType triggerID_
Readout chain identification for Hcal.
const_iterator begin() const
HcalCalibRecHit HcalQLPlotAnalAlgos::recoCalib ( const HcalCalibDataFrame cdigi,
double  calibFC2GeV 
)
private

Definition at line 251 of file HcalQLPlotAnalAlgos.cc.

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

Referenced by processDigi().

253 {
254  double nominal_ped = (cdigi[0].nominal_fC() + cdigi[1].nominal_fC())/2.0;
255 
256  double totamp = 0.0;
257  double maxA = -1e99;
258  int maxI = -1;
259  for (int i=0; i<cdigi.size(); i++) {
260  double ampl = (cdigi[i].nominal_fC()-nominal_ped)*calibFC2GeV;
261  totamp += ampl;
262 
263  if (ampl > maxA) {
264  maxA = ampl;
265  maxI = i;
266  }
267  }
268 
269  maxA=fabs(maxA);
270  float t0 = (maxI > 0) ? (fabs((cdigi[maxI-1].nominal_fC()-nominal_ped))*calibFC2GeV):0.0;
271  float t2 = fabs((cdigi[maxI+1].nominal_fC()-nominal_ped)*calibFC2GeV);
272  float wpksamp = (maxA + 2.0*t2) / (t0 + maxA + t2);
273  float time = (maxI - cdigi.presamples() + wpksamp)*25.0;
274 
275  return HcalCalibRecHit(cdigi.id(),totamp,time);
276 }
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
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:16
const HcalCalibDetId & id() const
void HcalQLPlotAnalAlgos::SetEventType ( const HcalTBTriggerData trigd)

Definition at line 62 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().

63 {
64  if( trigd.wasInSpillPedestalTrigger() ||
71 
73  edm::LogError("HcalQLPlotAnalAlgos::begin") <<
74  "Trigger Type unrecognized, aborting";
76  throw e;
77  }
78 }
bool wasLEDTrigger() const
returns true if this was a LED trigger
bool wasOutSpillPedestalTrigger() const
returns true if this was an out-of-spill pedestal trigger
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 wasBeamTrigger() const
returns true if this trigger came from beam data
bool wasLaserTrigger() const
returns true if this was a laser trigger
HcalQLPlotHistoMgr::EventType triggerID_

Member Data Documentation

HcalQLPlotHistoMgr* HcalQLPlotAnalAlgos::histos_
private

Definition at line 41 of file HcalQLPlotAnalAlgos.h.

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

TFile* HcalQLPlotAnalAlgos::mf_
private

Definition at line 42 of file HcalQLPlotAnalAlgos.h.

Referenced by end(), and HcalQLPlotAnalAlgos().

HcalQLPlotHistoMgr::EventType HcalQLPlotAnalAlgos::triggerID_
private

Definition at line 40 of file HcalQLPlotAnalAlgos.h.

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