CMS 3D CMS Logo

Public Member Functions | Private Attributes

HcalHF_PETalgorithm Class Reference

#include <HcalHF_PETalgorithm.h>

List of all members.

Public Member Functions

double bit ()
double CalcThreshold (double abs_energy, std::vector< double > params)
std::vector< double > GetLong_Energy_Thresh ()
std::vector< double > GetLong_ET_Thresh ()
std::vector< double > GetLong_R ()
std::vector< double > GetShort_Energy_Thresh ()
std::vector< double > GetShort_ET_Thresh ()
std::vector< double > GetShort_R ()
 HcalHF_PETalgorithm ()
 HcalHF_PETalgorithm (std::vector< double > short_R, std::vector< double > short_Energy, std::vector< double > short_ET, std::vector< double > long_R, std::vector< double > long_Energy, std::vector< double > long_ET, int HcalAcceptSeverityLevel, std::vector< double > short_R_29, std::vector< double > long_R_29)
void HFSetFlagFromPET (HFRecHit &hf, HFRecHitCollection &rec, HcalChannelQuality *myqual, const HcalSeverityLevelComputer *mySeverity)
void SetLong_Energy_Thresh (std::vector< double > x)
void SetLong_ET_Thresh (std::vector< double > x)
void SetLong_R (std::vector< double > x)
void SetShort_Energy_Thresh (std::vector< double > x)
void SetShort_ET_Thresh (std::vector< double > x)
void SetShort_R (std::vector< double > x)
 ~HcalHF_PETalgorithm ()

Private Attributes

int HcalAcceptSeverityLevel_
std::vector< double > long_Energy_Thresh
std::vector< double > long_ET_Thresh
std::vector< double > long_R
std::vector< double > long_R_29
std::vector< double > short_Energy_Thresh
std::vector< double > short_ET_Thresh
std::vector< double > short_R
std::vector< double > short_R_29

Detailed Description

Class evaluates the ratio |(L-S)/(L+S)| for a given cell, and flags the cell if the threshold exceeds a given maximum value R(Energy). Each cell must also pass ieta-dependent energy and ET cuts to be considered for flagging.

Date:
2011/04/15 19:11:48
Revision:
1.3
Author:
J. Temple and D. Ferencek

Definition at line 24 of file HcalHF_PETalgorithm.h.


Constructor & Destructor Documentation

HcalHF_PETalgorithm::HcalHF_PETalgorithm ( )

Constructors

Definition at line 13 of file HcalHF_PETalgorithm.cc.

References HcalAcceptSeverityLevel_, long_Energy_Thresh, long_ET_Thresh, long_R, long_R_29, short_Energy_Thresh, short_ET_Thresh, short_R, and short_R_29.

{
  // no params given; revert to old 'algo 1' fixed settings
  short_R.clear();
  short_R.push_back(0.995);
  short_R_29.clear();
  short_R_29.push_back(0.995);
  short_Energy_Thresh.clear();
  short_Energy_Thresh.push_back(50);
  short_ET_Thresh.clear();
  short_ET_Thresh.push_back(0);
  
  long_R.clear();
  long_R.push_back(0.995);
  long_R_29.clear();
  long_R_29.push_back(0.995);
  long_Energy_Thresh.clear();
  long_Energy_Thresh.push_back(50);
  long_ET_Thresh.clear();
  long_ET_Thresh.push_back(0);
  HcalAcceptSeverityLevel_=0;
}
HcalHF_PETalgorithm::HcalHF_PETalgorithm ( std::vector< double >  short_R,
std::vector< double >  short_Energy,
std::vector< double >  short_ET,
std::vector< double >  long_R,
std::vector< double >  long_Energy,
std::vector< double >  long_ET,
int  HcalAcceptSeverityLevel,
std::vector< double >  short_R_29,
std::vector< double >  long_R_29 
)

Definition at line 36 of file HcalHF_PETalgorithm.cc.

References HcalAcceptSeverityLevel_, long_Energy_Thresh, long_ET_Thresh, long_R, long_R_29, short_Energy_Thresh, short_ET_Thresh, short_R, and short_R_29.

{
  // R is parameterized depending on the energy of the cells, so just store the parameters here
  short_R    = shortR;
  long_R     = longR;
  short_R_29 = shortR29;
  long_R_29  = longR29;

  // Energy and ET cuts are ieta-dependent, and only need to be calculated once!
  short_Energy_Thresh.clear();
  short_ET_Thresh.clear();
  long_Energy_Thresh.clear();
  long_ET_Thresh.clear();

  //separate short, long cuts provided for each ieta 
  short_Energy_Thresh=shortEnergyParams;
  short_ET_Thresh=shortETParams;
  long_Energy_Thresh=longEnergyParams;
  long_ET_Thresh=longETParams;

  HcalAcceptSeverityLevel_=HcalAcceptSeverityLevel;
}
HcalHF_PETalgorithm::~HcalHF_PETalgorithm ( )

Definition at line 67 of file HcalHF_PETalgorithm.cc.

{}

Member Function Documentation

double HcalHF_PETalgorithm::bit ( ) [inline]
double HcalHF_PETalgorithm::CalcThreshold ( double  abs_energy,
std::vector< double >  params 
)

Definition at line 161 of file HcalHF_PETalgorithm.cc.

References i, funct::pow(), and dtDQMClient_cfg::threshold.

Referenced by HFSetFlagFromPET().

{
  /* CalcEnergyThreshold calculates the polynomial [0]+[1]*x + [2]*x^2 + ....,
     where x is an integer provided by the first argument (int double abs_x),
     and [0],[1],[2] is a vector of doubles provided by the second (std::vector<double> params).
     The output of the polynomial calculation (threshold) is returned by the function.
  */
  double threshold=0;
  for (std::vector<double>::size_type i=0;i<params.size();++i)
    {
      threshold+=params[i]*pow(abs_x, (int)i);
    }
  return threshold;
} //double HcalHF_PETalgorithm::CalcThreshold(double abs_x,std::vector<double> params)
std::vector<double> HcalHF_PETalgorithm::GetLong_Energy_Thresh ( ) [inline]

Definition at line 61 of file HcalHF_PETalgorithm.h.

References long_Energy_Thresh.

std::vector<double> HcalHF_PETalgorithm::GetLong_ET_Thresh ( ) [inline]

Definition at line 60 of file HcalHF_PETalgorithm.h.

References long_ET_Thresh.

{return long_ET_Thresh;}
std::vector<double> HcalHF_PETalgorithm::GetLong_R ( ) [inline]

Definition at line 59 of file HcalHF_PETalgorithm.h.

References long_R.

{return long_R;}
std::vector<double> HcalHF_PETalgorithm::GetShort_Energy_Thresh ( ) [inline]

Definition at line 58 of file HcalHF_PETalgorithm.h.

References short_Energy_Thresh.

std::vector<double> HcalHF_PETalgorithm::GetShort_ET_Thresh ( ) [inline]

Definition at line 57 of file HcalHF_PETalgorithm.h.

References short_ET_Thresh.

{return short_ET_Thresh;}
std::vector<double> HcalHF_PETalgorithm::GetShort_R ( ) [inline]

Definition at line 56 of file HcalHF_PETalgorithm.h.

References short_R.

{return short_R;}
void HcalHF_PETalgorithm::HFSetFlagFromPET ( HFRecHit hf,
HFRecHitCollection rec,
HcalChannelQuality myqual,
const HcalSeverityLevelComputer mySeverity 
)

Definition at line 71 of file HcalHF_PETalgorithm.cc.

References abs, CalcThreshold(), HcalDetId::depth(), HcalSeverityLevelComputer::dropChannel(), edm::SortedCollection< T, SORT >::end(), CaloRecHit::energy(), relval_parameters_module::energy, ET, edm::SortedCollection< T, SORT >::find(), HcalSeverityLevelComputer::getSeverityLevel(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), HcalAcceptSeverityLevel_, HcalForward, HcalCaloFlagLabels::HFLongShort, HcalCaloFlagLabels::HFPET, HFRecHit::id(), HcalDetId::ieta(), HcalDetId::iphi(), long_Energy_Thresh, long_ET_Thresh, long_R, long_R_29, DetId::rawId(), CaloRecHit::setFlagField(), short_Energy_Thresh, short_ET_Thresh, short_R, short_R_29, and theHFEtaBounds.

Referenced by HcalHitReconstructor::produce().

{
  /*  Set the HFLongShort flag by comparing the ratio |L-S|/|L+S|.  Channels must first pass energy and ET cuts, and channels whose partners are known to be dead are skipped, since those channels can never satisfy the ratio cut.  */

  int ieta=hf.id().ieta(); // get coordinates of rechit being checked
  int depth=hf.id().depth();
  int iphi=hf.id().iphi();
  double fEta = 0.5*(theHFEtaBounds[abs(ieta)-29] + theHFEtaBounds[abs(ieta)-28]); // calculate eta as average of eta values at ieta boundaries
  double energy=hf.energy();
  double ET = energy/fabs(cosh(fEta));

  // Step 1:  Check energy and ET cuts
  double ETthresh=0, Energythresh=0; // set ET, energy thresholds

  if (depth==1)  // set thresholds for long fibers
    {
      Energythresh = long_Energy_Thresh[abs(ieta)-29];
      ETthresh     = long_ET_Thresh[abs(ieta)-29];
    }
  else if (depth==2) // short fibers
    {
      Energythresh = short_Energy_Thresh[abs(ieta)-29];
      ETthresh     = short_ET_Thresh[abs(ieta)-29];
    }
  
  if (energy<Energythresh || ET < ETthresh)
    {
      hf.setFlagField(0, HcalCaloFlagLabels::HFLongShort); // shouldn't be necessary, but set bit to 0 just to be sure
      hf.setFlagField(0, HcalCaloFlagLabels::HFPET);
      return;
    }

  // Step 2:  Get partner info, check if partner is excluded from rechits already
  HcalDetId partner(HcalForward, ieta, iphi, 3-depth); //  if depth=1, 3-depth=2, and vice versa
  DetId detpartner=DetId(partner);
  const HcalChannelStatus* partnerstatus=myqual->getValues(detpartner.rawId());

  // Don't set the bit if the partner has been dropped from the rechit collection ('dead' or 'off')
  if (mySeverity->dropChannel(partnerstatus->getValue() ) )
    {
      hf.setFlagField(0, HcalCaloFlagLabels::HFLongShort); // shouldn't be necessary, but set bit to 0 just to be sure
      hf.setFlagField(0, HcalCaloFlagLabels::HFPET);
      return;
    }

  // Step 3:  Compute ratio
  double Ratio=1;
  HFRecHitCollection::const_iterator part=rec.find(partner);
  if (part!=rec.end())
    {
      HcalDetId neighbor(part->detid().rawId());
      const uint32_t chanstat = myqual->getValues(neighbor)->getValue();
      int SeverityLevel=mySeverity->getSeverityLevel(neighbor, part->flags(),
                                                     chanstat);


      if (SeverityLevel<=HcalAcceptSeverityLevel_) 
        Ratio=(energy-part->energy())/(energy+part->energy());
    }

  double RatioThresh=0;
  // Allow for the ratio cut to be parameterized in terms of energy
  if (abs(ieta)==29)
    {
      if (depth==1) RatioThresh=CalcThreshold(energy,long_R_29);
      else if (depth==2) RatioThresh=CalcThreshold(energy,short_R_29);
    }
  else
    {
      if (depth==1) RatioThresh=CalcThreshold(energy,long_R);
      else if (depth==2) RatioThresh=CalcThreshold(energy,short_R);
    }
  if (Ratio<=RatioThresh)
    {
      hf.setFlagField(0, HcalCaloFlagLabels::HFLongShort); // shouldn't be necessary, but set bit to 0 just to be sure
      hf.setFlagField(0, HcalCaloFlagLabels::HFPET);
      return;
    }
  // Made it this far -- ratio is > threshold, and cell should be flagged!
  // 'HFLongShort' is overall topological flag, and 'HFPET' is the flag for this
  // specific test
  hf.setFlagField(1, HcalCaloFlagLabels::HFLongShort);
  hf.setFlagField(1, HcalCaloFlagLabels::HFPET);
}//void HcalHF_PETalgorithm::HFSetFlagFromPET
void HcalHF_PETalgorithm::SetLong_Energy_Thresh ( std::vector< double >  x) [inline]

Definition at line 54 of file HcalHF_PETalgorithm.h.

References long_Energy_Thresh, and x.

void HcalHF_PETalgorithm::SetLong_ET_Thresh ( std::vector< double >  x) [inline]

Definition at line 53 of file HcalHF_PETalgorithm.h.

References long_ET_Thresh, and x.

void HcalHF_PETalgorithm::SetLong_R ( std::vector< double >  x) [inline]

Definition at line 52 of file HcalHF_PETalgorithm.h.

References x.

{long_R=x;}
void HcalHF_PETalgorithm::SetShort_Energy_Thresh ( std::vector< double >  x) [inline]

Definition at line 51 of file HcalHF_PETalgorithm.h.

References short_Energy_Thresh, and x.

void HcalHF_PETalgorithm::SetShort_ET_Thresh ( std::vector< double >  x) [inline]

Definition at line 50 of file HcalHF_PETalgorithm.h.

References short_ET_Thresh, and x.

void HcalHF_PETalgorithm::SetShort_R ( std::vector< double >  x) [inline]

Definition at line 49 of file HcalHF_PETalgorithm.h.

References x.


Member Data Documentation

Definition at line 73 of file HcalHF_PETalgorithm.h.

Referenced by HcalHF_PETalgorithm(), and HFSetFlagFromPET().

std::vector<double> HcalHF_PETalgorithm::long_Energy_Thresh [private]
std::vector<double> HcalHF_PETalgorithm::long_ET_Thresh [private]
std::vector<double> HcalHF_PETalgorithm::long_R [private]

Definition at line 70 of file HcalHF_PETalgorithm.h.

Referenced by GetLong_R(), HcalHF_PETalgorithm(), and HFSetFlagFromPET().

std::vector<double> HcalHF_PETalgorithm::long_R_29 [private]

Definition at line 75 of file HcalHF_PETalgorithm.h.

Referenced by HcalHF_PETalgorithm(), and HFSetFlagFromPET().

std::vector<double> HcalHF_PETalgorithm::short_Energy_Thresh [private]
std::vector<double> HcalHF_PETalgorithm::short_ET_Thresh [private]
std::vector<double> HcalHF_PETalgorithm::short_R [private]

Definition at line 66 of file HcalHF_PETalgorithm.h.

Referenced by GetShort_R(), HcalHF_PETalgorithm(), and HFSetFlagFromPET().

std::vector<double> HcalHF_PETalgorithm::short_R_29 [private]

Definition at line 74 of file HcalHF_PETalgorithm.h.

Referenced by HcalHF_PETalgorithm(), and HFSetFlagFromPET().