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, int firstSample=0, int samplesToAdd=10)
void SetFlagsFromDigi (HBHERecHit &hbhe, const HBHEDataFrame &digi, const HcalCoder &coder, const HcalCalibrations &calib)
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,
int  firstSample = 0,
int  samplesToAdd = 10 
)

Definition at line 20 of file HBHEStatusBitSetter.cc.

References HcalLogicalMapGenerator::createMap(), ExpressReco_HICollisions_FallBack::firstSample, firstSample_, cmsDownloadME::gen, edm::ParameterSet::getParameter(), hitEnergyMinimum_, hitMultiplicityThreshold_, hpdMultiplicity_, logicalMap_, HcalFrontEndId::maxRmIndex, nominalPedestal_, CrabTask::pset, pulseShapeParameters_, ExpressReco_HICollisions_FallBack::samplesToAdd, and samplesToAdd_.

{
  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;
  firstSample_ = firstSample;
  samplesToAdd_ = samplesToAdd;

  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 48 of file HBHEStatusBitSetter.cc.

References logicalMap_.

                                          {
  delete logicalMap_;
}

Member Function Documentation

void HBHEStatusBitSetter::Clear ( )

Definition at line 52 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 
)

Definition at line 57 of file HBHEStatusBitSetter.cc.

References HcalCoder::adc2fC(), asciidump::at, HcalQIESample::capid(), CaloRecHit::detid(), CaloRecHit::energy(), firstSample_, HcalCaloFlagLabels::Fraction2TS, HcalLogicalMap::getHcalFrontEndId(), HcalCaloFlagLabels::HBHEPulseShape, hitEnergyMinimum_, hpdMultiplicity_, getHLTprescales::index, logicalMap_, nominalPedestal_, HcalCalibrations::pedestal(), pulseShapeParameters_, HBHEDataFrame::sample(), samplesToAdd_, CaloRecHit::setFlagField(), findQualityFiles::size, and HBHEDataFrame::size().

Referenced by HcalHitReconstructor::produce().

{
  //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 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);

  double max2TS=-99.; // largest 2-TS sum found in reco window so far
  int max2TS_counter=1; // default value is 1
  double running2TS=0; // tracks current 2-TS sum, using "correct" charge and pedestal
  int capid=-1, capid2=-1;
  for (unsigned int iSlice=0;iSlice<size;iSlice++) 
    {
      capid  = digi.sample(iSlice).capid();
      charge_total+=tool[iSlice]-calib.pedestal(capid);
      nominal_charge_total+=digi[iSlice].nominal_fC()-nominalPedestal_;
      if (iSlice>=firstSample_ && 
          iSlice<(firstSample_ + samplesToAdd_-1) && 
          iSlice<(size-1))
        {
          capid2 = digi.sample(iSlice+1).capid();
          running2TS=tool[iSlice]+tool[iSlice+1]-calib.pedestal(capid)-calib.pedestal(capid2);
          if (running2TS>max2TS)
            max2TS=running2TS;
        }
      if (iSlice<2) continue;
      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;
      }
    }

  // max2TS counter will be set from 1->63, indicating the fraction of total charge
  // contained within the largest 2 time slices within the reco window.

  if (charge_total<0 && max2TS>0)
    max2TS_counter=63;
      
  else if (charge_total>0)
    {
      max2TS_counter=int(100*(max2TS/charge_total-0.5))+1;
      if (max2TS_counter<1) max2TS_counter=1;
      if (max2TS_counter>63) max2TS_counter=63;
    }
      
  hbhe.setFlagField(max2TS_counter, HcalCaloFlagLabels::Fraction2TS,6);
  
  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 28 of file HBHEStatusBitSetter.h.

Referenced by HBHEStatusBitSetter(), and SetFlagsFromDigi().

Definition at line 26 of file HBHEStatusBitSetter.h.

Referenced by HBHEStatusBitSetter(), and SetFlagsFromDigi().

Definition at line 27 of file HBHEStatusBitSetter.h.

Referenced by HBHEStatusBitSetter(), and SetFlagsFromRecHits().

std::vector<int> HBHEStatusBitSetter::hpdMultiplicity_ [private]

Definition at line 30 of file HBHEStatusBitSetter.h.

Referenced by HBHEStatusBitSetter(), and SetFlagsFromDigi().

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

Definition at line 33 of file HBHEStatusBitSetter.h.

Referenced by HBHEStatusBitSetter(), and SetFlagsFromDigi().

unsigned int HBHEStatusBitSetter::samplesToAdd_ [private]

Definition at line 29 of file HBHEStatusBitSetter.h.

Referenced by HBHEStatusBitSetter(), and SetFlagsFromDigi().