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 Attributes
HBHEStatusBitSetter Class Reference

#include <HBHEStatusBitSetter.h>

Public Member Functions

void Clear ()
 
 HBHEStatusBitSetter ()
 
 HBHEStatusBitSetter (double nominalPedestal, double hitEnergyMinimum, int hitMultiplicityThreshold, std::vector< edm::ParameterSet > pulseShapeParameterSets)
 
void SetFlagsFromDigi (HBHERecHit &hbhe, const HBHEDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib, int firstSample=3, int samplesToAdd=4)
 
void SetFlagsFromRecHits (HBHERecHitCollection &rec)
 
 ~HBHEStatusBitSetter ()
 

Private Attributes

unsigned int firstSample_
 
double hitEnergyMinimum_
 
int hitMultiplicityThreshold_
 
std::vector< int > hpdMultiplicity_
 
HcalLogicalMaplogicalMap_
 
double nominalPedestal_
 
std::vector< std::vector
< double > > 
pulseShapeParameters_
 
unsigned int samplesToAdd_
 

Detailed Description

Definition at line 14 of file HBHEStatusBitSetter.h.

Constructor & Destructor Documentation

HBHEStatusBitSetter::HBHEStatusBitSetter ( )
HBHEStatusBitSetter::HBHEStatusBitSetter ( double  nominalPedestal,
double  hitEnergyMinimum,
int  hitMultiplicityThreshold,
std::vector< edm::ParameterSet pulseShapeParameterSets 
)

Definition at line 20 of file HBHEStatusBitSetter.cc.

References HcalLogicalMapGenerator::createMap(), relval_steps::gen(), edm::ParameterSet::getParameter(), hitEnergyMinimum_, hitMultiplicityThreshold_, hpdMultiplicity_, logicalMap_, HcalFrontEndId::maxRmIndex, nominalPedestal_, and pulseShapeParameters_.

25 {
28 
29  for (int iRm=0;iRm<HcalFrontEndId::maxRmIndex;iRm++) {
30  hpdMultiplicity_.push_back(0);
31  }
32 
33  nominalPedestal_=nominalPedestal;
34  hitEnergyMinimum_=hitEnergyMinimum;
35  hitMultiplicityThreshold_=hitMultiplicityThreshold;
36 
37  for (unsigned int iPSet=0;iPSet<pulseShapeParameterSets.size();iPSet++) {
38  edm::ParameterSet pset=pulseShapeParameterSets.at(iPSet);
39  std::vector<double> params=pset.getParameter<std::vector<double> >("pulseShapeParameters");
40  pulseShapeParameters_.push_back(params);
41  }
42 
43 }
T getParameter(std::string const &) const
HcalLogicalMap createMap(unsigned int mapIOV=5)
std::vector< int > hpdMultiplicity_
static const int maxRmIndex
std::vector< std::vector< double > > pulseShapeParameters_
HcalLogicalMap * logicalMap_
HBHEStatusBitSetter::~HBHEStatusBitSetter ( )

Definition at line 45 of file HBHEStatusBitSetter.cc.

References logicalMap_.

45  {
46  delete logicalMap_;
47 }
HcalLogicalMap * logicalMap_

Member Function Documentation

void HBHEStatusBitSetter::Clear ( )

Definition at line 49 of file HBHEStatusBitSetter.cc.

References hpdMultiplicity_, and i.

Referenced by HcalHitReconstructor::produce().

50 {
51  for (unsigned int i=0;i<hpdMultiplicity_.size();i++) hpdMultiplicity_[i]=0;
52 }
int i
Definition: DBlmapReader.cc:9
std::vector< int > hpdMultiplicity_
void HBHEStatusBitSetter::SetFlagsFromDigi ( HBHERecHit hbhe,
const HBHEDataFrame digi,
const HcalCoder coder,
const HcalCalibrations calib,
int  firstSample = 3,
int  samplesToAdd = 4 
)

Definition at line 54 of file HBHEStatusBitSetter.cc.

References HcalCoder::adc2fC(), asciidump::at, CaloRecHit::detid(), CaloRecHit::energy(), castor_dqm_sourceclient_file_cfg::firstSample, firstSample_, HcalLogicalMap::getHcalFrontEndId(), HcalCaloFlagLabels::HBHEPulseShape, hitEnergyMinimum_, hpdMultiplicity_, getHLTprescales::index, logicalMap_, nominalPedestal_, pulseShapeParameters_, samplesToAdd_, CaloRecHit::setFlagField(), HBHEDataFrame::size(), and findQualityFiles::size.

Referenced by HcalHitReconstructor::produce().

61 {
62  // get firstSample, samplesToAdd from database for each hit
64  samplesToAdd_ = samplesToAdd;
65 
66  //increment hit multiplicity
67  if (hbhe.energy()>hitEnergyMinimum_) {
68  int index=logicalMap_->getHcalFrontEndId(hbhe.detid()).rmIndex();
69  hpdMultiplicity_.at(index)++;
70  }
71 
72  //set pulse shape bits
73  // Shuichi's algorithm uses the "correct" charge & pedestals, while Ted's uses "nominal" values.
74  // Perhaps we should correct Ted's algorithm in the future, though that will mean re-tuning thresholds for his cuts. -- Jeff, 28 May 2010
75  //double shuichi_charge_total=0.0;
76  double nominal_charge_total=0.0;
77  double charge_max3=-100.0;
78  double charge_late3=-100.0;
79  unsigned int slice_max3=0;
80  unsigned int size=digi.size();
81 
82  CaloSamples tool;
83  coder.adc2fC(digi,tool);
84 
85  // int capid=-1;
86  for (unsigned int iSlice=0;iSlice<size;iSlice++)
87  {
88  // capid = digi.sample(iSlice).capid();
89  //shuichi_charge_total+=tool[iSlice]-calib.pedestal(capid);
90  nominal_charge_total+=digi[iSlice].nominal_fC()-nominalPedestal_;
91 
92  if (iSlice<2) continue;
93  // digi[i].nominal_fC() could be replaced by tool[iSlice], I think... -- Jeff, 11 April 2011
94  double qsum3=digi[iSlice].nominal_fC() + digi[iSlice-1].nominal_fC() + digi[iSlice-2].nominal_fC() - 3*nominalPedestal_;
95  if (qsum3>charge_max3) {
96  charge_max3=qsum3;
97  slice_max3=iSlice;
98  }
99  }
100 
101  if ((4+slice_max3)>size) return;
102  charge_late3=digi[slice_max3+1].nominal_fC() + digi[slice_max3+2].nominal_fC() + digi[slice_max3+3].nominal_fC() - 3*nominalPedestal_;
103 
104  for (unsigned int iCut=0;iCut<pulseShapeParameters_.size();iCut++) {
105  if (pulseShapeParameters_[iCut].size()!=6) continue;
106  if (nominal_charge_total<pulseShapeParameters_[iCut].at(0) || nominal_charge_total>=pulseShapeParameters_[iCut].at(1)) continue;
107  if ( charge_late3< (pulseShapeParameters_[iCut].at(2)+nominal_charge_total*pulseShapeParameters_[iCut].at(3)) ) continue;
108  if ( charge_late3>=(pulseShapeParameters_[iCut].at(4)+nominal_charge_total*pulseShapeParameters_[iCut].at(5)) ) continue;
110  return;
111  }
112 
113 }
const DetId & detid() const
Definition: CaloRecHit.h:22
int size() const
total number of samples in the digi
Definition: HBHEDataFrame.h:26
std::vector< int > hpdMultiplicity_
void setFlagField(uint32_t value, int base, int width=1)
Definition: CaloRecHit.cc:20
float energy() const
Definition: CaloRecHit.h:19
const HcalFrontEndId getHcalFrontEndId(const DetId &)
std::vector< std::vector< double > > pulseShapeParameters_
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const =0
HcalLogicalMap * logicalMap_
tuple size
Write out results.
list at
Definition: asciidump.py:428
void HBHEStatusBitSetter::SetFlagsFromRecHits ( HBHERecHitCollection rec)

Definition at line 115 of file HBHEStatusBitSetter.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), HcalLogicalMap::getHcalFrontEndId(), HcalCaloFlagLabels::HBHEHpdHitMultiplicity, hitMultiplicityThreshold_, hpdMultiplicity_, getHLTprescales::index, and logicalMap_.

Referenced by HcalHitReconstructor::produce().

115  {
116  for (HBHERecHitCollection::iterator iHBHE=rec.begin();iHBHE!=rec.end();++iHBHE) {
117  int index=logicalMap_->getHcalFrontEndId(iHBHE->detid()).rmIndex();
118  if (hpdMultiplicity_.at(index)<hitMultiplicityThreshold_) continue;
119  iHBHE->setFlagField(1,HcalCaloFlagLabels::HBHEHpdHitMultiplicity);
120  }
121 }
std::vector< int > hpdMultiplicity_
std::vector< T >::iterator iterator
const_iterator end() const
const HcalFrontEndId getHcalFrontEndId(const DetId &)
HcalLogicalMap * logicalMap_
const_iterator begin() const

Member Data Documentation

unsigned int HBHEStatusBitSetter::firstSample_
private

Definition at line 29 of file HBHEStatusBitSetter.h.

Referenced by SetFlagsFromDigi().

double HBHEStatusBitSetter::hitEnergyMinimum_
private

Definition at line 27 of file HBHEStatusBitSetter.h.

Referenced by HBHEStatusBitSetter(), and SetFlagsFromDigi().

int HBHEStatusBitSetter::hitMultiplicityThreshold_
private

Definition at line 28 of file HBHEStatusBitSetter.h.

Referenced by HBHEStatusBitSetter(), and SetFlagsFromRecHits().

std::vector<int> HBHEStatusBitSetter::hpdMultiplicity_
private
HcalLogicalMap* HBHEStatusBitSetter::logicalMap_
private
double HBHEStatusBitSetter::nominalPedestal_
private

Definition at line 31 of file HBHEStatusBitSetter.h.

Referenced by HBHEStatusBitSetter(), and SetFlagsFromDigi().

std::vector< std::vector<double> > HBHEStatusBitSetter::pulseShapeParameters_
private

Definition at line 34 of file HBHEStatusBitSetter.h.

Referenced by HBHEStatusBitSetter(), and SetFlagsFromDigi().

unsigned int HBHEStatusBitSetter::samplesToAdd_
private

Definition at line 30 of file HBHEStatusBitSetter.h.

Referenced by SetFlagsFromDigi().