CMS 3D CMS Logo

Public Member Functions | Private Attributes

HBHEStatusBitSetter Class Reference

#include <HBHEStatusBitSetter.h>

List of all members.

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(), cmsDownloadME::gen, edm::ParameterSet::getParameter(), hitEnergyMinimum_, hitMultiplicityThreshold_, hpdMultiplicity_, logicalMap_, HcalFrontEndId::maxRmIndex, nominalPedestal_, and pulseShapeParameters_.

{
  HcalLogicalMapGenerator gen;
  logicalMap_=new HcalLogicalMap(gen.createMap());
  
  for (int iRm=0;iRm<HcalFrontEndId::maxRmIndex;iRm++) {
    hpdMultiplicity_.push_back(0);
  }

  nominalPedestal_=nominalPedestal;
  hitEnergyMinimum_=hitEnergyMinimum;
  hitMultiplicityThreshold_=hitMultiplicityThreshold;

  for (unsigned int iPSet=0;iPSet<pulseShapeParameterSets.size();iPSet++) {
    edm::ParameterSet pset=pulseShapeParameterSets.at(iPSet);
    std::vector<double> params=pset.getParameter<std::vector<double> >("pulseShapeParameters");
    pulseShapeParameters_.push_back(params);
  }

}
HBHEStatusBitSetter::~HBHEStatusBitSetter ( )

Definition at line 45 of file HBHEStatusBitSetter.cc.

References logicalMap_.

                                          {
  delete logicalMap_;
}

Member Function Documentation

void HBHEStatusBitSetter::Clear ( )

Definition at line 49 of file HBHEStatusBitSetter.cc.

References hpdMultiplicity_, and i.

Referenced by HcalHitReconstructor::produce().

{
  for (unsigned int i=0;i<hpdMultiplicity_.size();i++) hpdMultiplicity_[i]=0;
}
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(), findQualityFiles::size, and HBHEDataFrame::size().

Referenced by HcalHitReconstructor::produce().

{
  // get firstSample, samplesToAdd from database for each hit
  firstSample_ = firstSample;
  samplesToAdd_ = samplesToAdd;

  //increment hit multiplicity
  if (hbhe.energy()>hitEnergyMinimum_) {
    int index=logicalMap_->getHcalFrontEndId(hbhe.detid()).rmIndex();
    hpdMultiplicity_.at(index)++;
  }

  //set pulse shape bits
  // Shuichi's algorithm uses the "correct" charge & pedestals, while Ted's uses "nominal" values.
  // Perhaps we should correct Ted's algorithm in the future, though that will mean re-tuning thresholds for his cuts. -- Jeff, 28 May 2010
  //double shuichi_charge_total=0.0;
  double nominal_charge_total=0.0;  
  double charge_max3=-100.0;
  double charge_late3=-100.0;
  unsigned int slice_max3=0;
  unsigned int size=digi.size();
 
  CaloSamples tool;
  coder.adc2fC(digi,tool);

  //  int capid=-1;
  for (unsigned int iSlice=0;iSlice<size;iSlice++) 
    {
      //      capid  = digi.sample(iSlice).capid();
      //shuichi_charge_total+=tool[iSlice]-calib.pedestal(capid);
      nominal_charge_total+=digi[iSlice].nominal_fC()-nominalPedestal_;

      if (iSlice<2) continue;
      // digi[i].nominal_fC() could be replaced by tool[iSlice], I think...  -- Jeff, 11 April 2011
      double qsum3=digi[iSlice].nominal_fC() + digi[iSlice-1].nominal_fC() + digi[iSlice-2].nominal_fC() - 3*nominalPedestal_;
      if (qsum3>charge_max3) {
        charge_max3=qsum3;
        slice_max3=iSlice;
      }
    }

  if ((4+slice_max3)>size) return;
  charge_late3=digi[slice_max3+1].nominal_fC() + digi[slice_max3+2].nominal_fC() + digi[slice_max3+3].nominal_fC() - 3*nominalPedestal_;

  for (unsigned int iCut=0;iCut<pulseShapeParameters_.size();iCut++) {
    if (pulseShapeParameters_[iCut].size()!=6) continue;
    if (nominal_charge_total<pulseShapeParameters_[iCut].at(0) || nominal_charge_total>=pulseShapeParameters_[iCut].at(1)) continue;
    if ( charge_late3< (pulseShapeParameters_[iCut].at(2)+nominal_charge_total*pulseShapeParameters_[iCut].at(3)) ) continue;
    if ( charge_late3>=(pulseShapeParameters_[iCut].at(4)+nominal_charge_total*pulseShapeParameters_[iCut].at(5)) ) continue;
    hbhe.setFlagField(1,HcalCaloFlagLabels::HBHEPulseShape);
    return;
  }
  
}
void HBHEStatusBitSetter::SetFlagsFromRecHits ( HBHERecHitCollection rec)

Member Data Documentation

unsigned int HBHEStatusBitSetter::firstSample_ [private]

Definition at line 29 of file HBHEStatusBitSetter.h.

Referenced by SetFlagsFromDigi().

Definition at line 27 of file HBHEStatusBitSetter.h.

Referenced by HBHEStatusBitSetter(), and SetFlagsFromDigi().

Definition at line 28 of file HBHEStatusBitSetter.h.

Referenced by HBHEStatusBitSetter(), and SetFlagsFromRecHits().

std::vector<int> HBHEStatusBitSetter::hpdMultiplicity_ [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().