CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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, 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,
edm::ParameterSet  histoParams 
)

Definition at line 44 of file HcalQLPlotAnalAlgos.cc.

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

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

Member Function Documentation

void HcalQLPlotAnalAlgos::end ( void  )

Definition at line 58 of file HcalQLPlotAnalAlgos.cc.

References mf_.

Referenced by HcalQLPlotAnal::endJob().

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

Definition at line 174 of file HcalQLPlotAnalAlgos.cc.

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

Referenced by HcalQLPlotAnal::analyze().

175 {
177 
178  for (it = hbhedigic.begin();
179  it != hbhedigic.end();
180  it++) {
181  HcalDetId id (it->id());
182  HcalElectronicsId eid (it->elecId());
183 
185  if (phist){
186  for (int bin=0; bin<it->size(); bin++)
187  phist->Fill(bin*1.0,(*it)[bin].nominal_fC());
188  }
189 
192  if (phist){
193  for (int bin=0; bin<it->size(); bin++)
194  phist->Fill((*it)[bin].adc());
195  }
196  }
197  }
198 }
std::vector< T >::const_iterator const_iterator
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 [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
const_iterator begin() const
void HcalQLPlotAnalAlgos::processDigi ( const HODigiCollection hodigic)

Definition at line 200 of file HcalQLPlotAnalAlgos.cc.

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

201 {
203 
204  for (it = hodigic.begin();
205  it != hodigic.end();
206  it++) {
207  HcalDetId id (it->id());
208  HcalElectronicsId eid (it->elecId());
209 
211  if (phist){
212  for (int bin=0; bin<it->size(); bin++)
213  phist->Fill(bin*1.0,(*it)[bin].nominal_fC());
214  }
215 
218  if (phist){
219  for (int bin=0; bin<it->size(); bin++)
220  phist->Fill((*it)[bin].adc());
221  }
222  }
223  }
224 }
std::vector< T >::const_iterator const_iterator
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 [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
const_iterator begin() const
void HcalQLPlotAnalAlgos::processDigi ( const HFDigiCollection hfdigic)

Definition at line 226 of file HcalQLPlotAnalAlgos.cc.

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

227 {
229 
230  for (it = hfdigic.begin();
231  it != hfdigic.end();
232  it++) {
233  HcalDetId id (it->id());
234  HcalElectronicsId eid (it->elecId());
235 
237  if (phist){
238  for (int bin=0; bin<it->size(); bin++)
239  phist->Fill(bin*1.0,(*it)[bin].nominal_fC());
240  }
241 
244  if (phist){
245  for (int bin=0; bin<it->size(); bin++)
246  phist->Fill((*it)[bin].adc());
247  }
248  }
249  }
250 }
std::vector< T >::const_iterator const_iterator
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 [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
const_iterator begin() const
void HcalQLPlotAnalAlgos::processDigi ( const HcalCalibDigiCollection calibdigic,
double  calibFC2GeV 
)

Definition at line 279 of file HcalQLPlotAnalAlgos.cc.

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

281 {
283 
284  for (it = calibdigic.begin();
285  it != calibdigic.end();
286  it++) {
287  HcalCalibDetId id (it->id());
288  HcalElectronicsId eid (it->elecId());
289 
291  if (phist){
292  for (int bin=0; bin<it->size(); bin++)
293  phist->Fill(bin*1.0,(*it)[bin].nominal_fC());
294  }
295 
296  // HACK-reco the calib digi into a rechit:
297  //
298  HcalCalibRecHit rh = recoCalib(*it, calibFC2GeV);
299 
301  if (ehist){
302  ehist->Fill(rh.amplitude());
303  }
304 
306  if (thist){
307  thist->Fill(rh.time());
308  }
309  }
310 }
float amplitude() const
get the amplitude (generally fC, but can vary)
std::vector< T >::const_iterator const_iterator
HcalCalibRecHit recoCalib(const HcalCalibDataFrame &cdigi, double calibFC2GeV)
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 [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
const_iterator begin() const
void HcalQLPlotAnalAlgos::processRH ( const HBHERecHitCollection hbherhc,
const HBHEDigiCollection hbhedgc 
)

Definition at line 81 of file HcalQLPlotAnalAlgos.cc.

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

Referenced by HcalQLPlotAnal::analyze().

83 {
85 
86  for (it = hbherhc.begin();
87  it != hbherhc.end();
88  it++) {
89  HcalDetId id (it->id());
91  HBHEDigiCollection::const_iterator dit = hbhedgc.find(id);
92  if (dit != hbhedgc.end())
93  eid = dit->elecId();
94  else {
95  edm::LogWarning("HcalQLPlotAnalAlgos::processRH") <<
96  "No digi found for id" << id;
97  continue;
98  }
99 
101  if (ehist){
102  ehist->Fill(it->energy());
103  }
104 
106  if (thist){
107  thist->Fill(it->time());
108  }
109  }
110 }
std::vector< T >::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 [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
const_iterator begin() const
void HcalQLPlotAnalAlgos::processRH ( const HORecHitCollection horhc,
const HODigiCollection hodgc 
)

Definition at line 112 of file HcalQLPlotAnalAlgos.cc.

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

114 {
116 
117  for (it = horhc.begin();
118  it != horhc.end();
119  it++) {
120  HcalDetId id (it->id());
121  HcalElectronicsId eid;
122  HODigiCollection::const_iterator dit = hodgc.find(id);
123  if (dit != hodgc.end())
124  eid = dit->elecId();
125  else {
126  edm::LogWarning("HcalQLPlotAnalAlgos::processRH") <<
127  "No digi found for id" << id;
128  continue;
129  }
130 
132  if (ehist){
133  ehist->Fill(it->energy());
134  }
135 
137  if (thist){
138  thist->Fill(it->time());
139  }
140  }
141 }
std::vector< T >::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 [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
const_iterator begin() const
void HcalQLPlotAnalAlgos::processRH ( const HFRecHitCollection hfrhc,
const HFDigiCollection hfdgc 
)

Definition at line 143 of file HcalQLPlotAnalAlgos.cc.

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

145 {
147 
148  for (it = hfrhc.begin();
149  it != hfrhc.end();
150  it++) {
151  HcalDetId id (it->id());
152  HcalElectronicsId eid;
153  HFDigiCollection::const_iterator dit = hfdgc.find(id);
154  if (dit != hfdgc.end())
155  eid = dit->elecId();
156  else {
157  edm::LogWarning("HcalQLPlotAnalAlgos::processRH") <<
158  "No digi found for id" << id;
159  continue;
160  }
161 
163  if (ehist){
164  ehist->Fill(it->energy());
165  }
166 
168  if (thist){
169  thist->Fill(it->time());
170  }
171  }
172 }
std::vector< T >::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 [31:26] Unused (so far) [25] Trigger-chain id flag [24:20] Read...
const_iterator begin() const
HcalCalibRecHit HcalQLPlotAnalAlgos::recoCalib ( const HcalCalibDataFrame cdigi,
double  calibFC2GeV 
)
private

Definition at line 252 of file HcalQLPlotAnalAlgos.cc.

References i, HcalCalibDataFrame::id(), findQualityFiles::maxI, HcalCalibDataFrame::presamples(), HcalCalibDataFrame::size(), and cond::rpcobgas::time.

Referenced by processDigi().

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

Definition at line 63 of file HcalQLPlotAnalAlgos.cc.

References HcalQLPlotHistoMgr::BEAM, alignCSCRings::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().

64 {
65  if( trigd.wasInSpillPedestalTrigger() ||
72 
74  edm::LogError("HcalQLPlotAnalAlgos::begin") <<
75  "Trigger Type unrecognized, aborting";
77  throw e;
78  }
79 }
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().