CMS 3D CMS Logo

Public Member Functions | Private Attributes

CommonHcalNoiseRBXData Class Reference

#include <HcalNoiseAlgo.h>

List of all members.

Public Member Functions

bool CheckPassFilter (double Charge, double Discriminant, std::vector< std::pair< double, double > > &Cuts, int Side)
 CommonHcalNoiseRBXData (const reco::HcalNoiseRBX &rbx, double minRecHitE, double minLowHitE, double minHighHitE, double TS4TS5EnergyThreshold, std::vector< std::pair< double, double > > &TS4TS5UpperCut, std::vector< std::pair< double, double > > &TS4TS5LowerCut)
double e10ts (void) const
double e2ts (void) const
double energy (void) const
double highEHitTimeSqrd (void) const
double HPDEMF (void) const
double lowEHitTimeSqrd (void) const
double maxHighEHitTime (void) const
double maxLowEHitTime (void) const
double minHighEHitTime (void) const
double minLowEHitTime (void) const
int numHighEHits (void) const
int numHPDHits (void) const
int numHPDNoOtherHits (void) const
int numLowEHits (void) const
int numRBXHits (void) const
int numZeros (void) const
bool PassTS4TS5 (void) const
double ratio (void) const
double RBXEMF (void) const
edm::RefVector
< CaloTowerCollection
rbxTowers (void) const
bool validRatio (void) const
 ~CommonHcalNoiseRBXData ()

Private Attributes

double e10ts_
double e2ts_
double energy_
double highEHitTimeSqrd_
double HPDEMF_
double lowEHitTimeSqrd_
double maxHighEHitTime_
double maxLowEHitTime_
double minHighEHitTime_
double minLowEHitTime_
int numHighEHits_
int numHPDHits_
int numHPDNoOtherHits_
int numLowEHits_
int numRBXHits_
int numZeros_
double RBXEMF_
edm::RefVector
< CaloTowerCollection
rbxtowers_
bool TS4TS5Decision_

Detailed Description

Definition at line 11 of file HcalNoiseAlgo.h.


Constructor & Destructor Documentation

CommonHcalNoiseRBXData::CommonHcalNoiseRBXData ( const reco::HcalNoiseRBX rbx,
double  minRecHitE,
double  minLowHitE,
double  minHighHitE,
double  TS4TS5EnergyThreshold,
std::vector< std::pair< double, double > > &  TS4TS5UpperCut,
std::vector< std::pair< double, double > > &  TS4TS5LowerCut 
)

Definition at line 3 of file HcalNoiseAlgo.cc.

References reco::HcalNoiseRBX::allCharge(), reco::HcalNoiseRBX::allChargeHighest2TS(), reco::HcalNoiseRBX::allChargeTotal(), edm::RefVector< C, T, F >::begin(), reco::HcalNoiseRBX::caloTowerEmE(), CheckPassFilter(), edm::RefVector< C, T, F >::clear(), e10ts_, e2ts_, edm::RefVector< C, T, F >::end(), energy(), energy_, highEHitTimeSqrd_, HPDEMF_, reco::HcalNoiseRBX::HPDsBegin(), reco::HcalNoiseRBX::HPDsEnd(), join(), lowEHitTimeSqrd_, maxHighEHitTime_, maxLowEHitTime_, minHighEHitTime_, minLowEHitTime_, numHighEHits_, numHPDHits_, numHPDNoOtherHits_, numLowEHits_, numRBXHits_, reco::HcalNoiseRBX::numRecHits(), numZeros_, RBXEMF_, rbxtowers_, reco::HcalNoiseRBX::recHitEnergy(), HI_PhotonSkim_cff::rechits, cond::rpcobgas::time, reco::HcalNoiseRBX::totalZeros(), and TS4TS5Decision_.

{
  // energy
  energy_ = rbx.recHitEnergy(minRecHitE); 

  // ratio
  e2ts_ = rbx.allChargeHighest2TS();
  e10ts_ = rbx.allChargeTotal();

  // TS4TS5
  TS4TS5Decision_ = true;
  if(energy_ > TS4TS5EnergyThreshold)   // check filter
  {
     std::vector<float> AllCharge = rbx.allCharge();
     double BaseCharge = AllCharge[4] + AllCharge[5];
     if(BaseCharge < 1)
        BaseCharge = 1;
     double TS4TS5 = (AllCharge[4] - AllCharge[5]) / BaseCharge;

     if(CheckPassFilter(BaseCharge, TS4TS5, TS4TS5UpperCut, 1) == false)
        TS4TS5Decision_ = false;
     if(CheckPassFilter(BaseCharge, TS4TS5, TS4TS5LowerCut, -1) == false)
        TS4TS5Decision_ = false;
  }
  else
     TS4TS5Decision_ = true;

  // # of hits
  numHPDHits_ = 0;
  for(std::vector<reco::HcalNoiseHPD>::const_iterator it1=rbx.HPDsBegin(); it1!=rbx.HPDsEnd(); ++it1) {
    int nhpdhits=it1->numRecHits(minRecHitE);
    if(numHPDHits_ < nhpdhits) numHPDHits_ = nhpdhits;
  }
  numRBXHits_ = rbx.numRecHits(minRecHitE);
  numHPDNoOtherHits_ = (numHPDHits_ == numRBXHits_) ? numHPDHits_ : 0;    

  // # of ADC zeros
  numZeros_ = rbx.totalZeros();

  // timing
  minLowEHitTime_ = minHighEHitTime_ = 99999.;
  maxLowEHitTime_ = maxHighEHitTime_ = -99999.;
  lowEHitTimeSqrd_ = highEHitTimeSqrd_ = 0;
  numLowEHits_ = numHighEHits_ = 0;
  for(std::vector<reco::HcalNoiseHPD>::const_iterator it1=rbx.HPDsBegin(); it1!=rbx.HPDsEnd(); ++it1) {
    edm::RefVector<HBHERecHitCollection> rechits=it1->recHits();
    for(edm::RefVector<HBHERecHitCollection>::const_iterator it2=rechits.begin(); it2!=rechits.end(); ++it2) {
      float energy=(*it2)->energy();
      float time=(*it2)->time();
      if(energy>=minLowHitE) {
        if(minLowEHitTime_ > time) minLowEHitTime_ = time;
        if(maxLowEHitTime_ < time) maxLowEHitTime_ = time;
        lowEHitTimeSqrd_ += time*time;
        ++numLowEHits_;
      }
      if(energy>=minHighHitE) {
        if(minHighEHitTime_ > time) minHighEHitTime_ = time;
        if(maxHighEHitTime_ < time) maxHighEHitTime_ = time;
        highEHitTimeSqrd_ += time*time;
        ++numHighEHits_;
      }
    }
  }

  // emf
  HPDEMF_ = 999.;
  for(std::vector<reco::HcalNoiseHPD>::const_iterator it1=rbx.HPDsBegin(); it1!=rbx.HPDsEnd(); ++it1) {
    double eme=it1->caloTowerEmE();
    double hade=it1->recHitEnergy(minRecHitE);
    double emf=(eme+hade)==0 ? 999 : eme/(eme+hade);
    if(HPDEMF_ > emf) emf = HPDEMF_;
  }
  double eme=rbx.caloTowerEmE();
  RBXEMF_ = (eme+energy_)==0 ? 999 : eme/(eme+energy_);

  // calotowers
  rbxtowers_.clear();
  JoinCaloTowerRefVectorsWithoutDuplicates join;
  for(std::vector<reco::HcalNoiseHPD>::const_iterator it1=rbx.HPDsBegin(); it1!=rbx.HPDsEnd(); ++it1) {
    join(rbxtowers_, it1->caloTowers());
  }

  return;
}
CommonHcalNoiseRBXData::~CommonHcalNoiseRBXData ( ) [inline]

Definition at line 17 of file HcalNoiseAlgo.h.

{}

Member Function Documentation

bool CommonHcalNoiseRBXData::CheckPassFilter ( double  Charge,
double  Discriminant,
std::vector< std::pair< double, double > > &  Cuts,
int  Side 
)

Definition at line 280 of file HcalNoiseAlgo.cc.

References first, i, and MessageLogger_cff::limit.

Referenced by CommonHcalNoiseRBXData().

{
   //
   // Checks whether Discriminant value passes Cuts for the specified Charge.  True if pulse is good.
   //
   // The "Cuts" pairs are assumed to be sorted in terms of size from small to large,
   //    where each "pair" = (Charge, Discriminant)
   // "Side" is either positive or negative, which determines whether to discard the pulse if discriminant
   //    is greater or smaller than the cut value
   //

   if(Cuts.size() == 0)   // safety check that there are some cuts defined
      return true;

   if(Charge <= Cuts[0].first)   // too small to cut on
      return true;

   int IndexLargerThanCharge = -1;   // find the range it is falling in
   for(int i = 1; i < (int)Cuts.size(); i++)
   {
      if(Cuts[i].first > Charge)
      {
         IndexLargerThanCharge = i;
         break;
      }
   }

   double limit = 1000000;

   if(IndexLargerThanCharge == -1)   // if charge is greater than the last entry, assume flat line
      limit = Cuts[Cuts.size()-1].second;
   else   // otherwise, do a linear interpolation to find the cut position
   {
      double C1 = Cuts[IndexLargerThanCharge].first;
      double C2 = Cuts[IndexLargerThanCharge-1].first;
      double L1 = Cuts[IndexLargerThanCharge].second;
      double L2 = Cuts[IndexLargerThanCharge-1].second;

      limit = (Charge - C1) / (C2 - C1) * (L2 - L1) + L1;
   }

   if(Side > 0 && Discriminant > limit)
      return false;
   if(Side < 0 && Discriminant < limit)
      return false;

   return true;
}
double CommonHcalNoiseRBXData::e10ts ( void  ) const [inline]

Definition at line 23 of file HcalNoiseAlgo.h.

References e10ts_.

Referenced by reco::HcalNoiseInfoProducer::fillOtherSummaryVariables().

{ return e10ts_; }
double CommonHcalNoiseRBXData::e2ts ( void  ) const [inline]

Definition at line 22 of file HcalNoiseAlgo.h.

References e2ts_.

Referenced by reco::HcalNoiseInfoProducer::fillOtherSummaryVariables().

{ return e2ts_; }
double CommonHcalNoiseRBXData::energy ( void  ) const [inline]
double CommonHcalNoiseRBXData::highEHitTimeSqrd ( void  ) const [inline]

Definition at line 35 of file HcalNoiseAlgo.h.

References highEHitTimeSqrd_.

Referenced by reco::HcalNoiseInfoProducer::fillOtherSummaryVariables().

{ return highEHitTimeSqrd_; }
double CommonHcalNoiseRBXData::HPDEMF ( void  ) const [inline]
double CommonHcalNoiseRBXData::lowEHitTimeSqrd ( void  ) const [inline]

Definition at line 31 of file HcalNoiseAlgo.h.

References lowEHitTimeSqrd_.

Referenced by reco::HcalNoiseInfoProducer::fillOtherSummaryVariables().

{ return lowEHitTimeSqrd_; }
double CommonHcalNoiseRBXData::maxHighEHitTime ( void  ) const [inline]
double CommonHcalNoiseRBXData::maxLowEHitTime ( void  ) const [inline]
double CommonHcalNoiseRBXData::minHighEHitTime ( void  ) const [inline]
double CommonHcalNoiseRBXData::minLowEHitTime ( void  ) const [inline]
int CommonHcalNoiseRBXData::numHighEHits ( void  ) const [inline]

Definition at line 36 of file HcalNoiseAlgo.h.

References numHighEHits_.

Referenced by reco::HcalNoiseInfoProducer::fillOtherSummaryVariables().

{ return numHighEHits_; }
int CommonHcalNoiseRBXData::numHPDHits ( void  ) const [inline]
int CommonHcalNoiseRBXData::numHPDNoOtherHits ( void  ) const [inline]
int CommonHcalNoiseRBXData::numLowEHits ( void  ) const [inline]

Definition at line 32 of file HcalNoiseAlgo.h.

References numLowEHits_.

Referenced by reco::HcalNoiseInfoProducer::fillOtherSummaryVariables().

{ return numLowEHits_; }
int CommonHcalNoiseRBXData::numRBXHits ( void  ) const [inline]
int CommonHcalNoiseRBXData::numZeros ( void  ) const [inline]
bool CommonHcalNoiseRBXData::PassTS4TS5 ( void  ) const [inline]

Definition at line 39 of file HcalNoiseAlgo.h.

References TS4TS5Decision_.

Referenced by reco::HcalNoiseInfoProducer::fillOtherSummaryVariables().

{ return TS4TS5Decision_; }
double CommonHcalNoiseRBXData::ratio ( void  ) const [inline]
double CommonHcalNoiseRBXData::RBXEMF ( void  ) const [inline]
edm::RefVector<CaloTowerCollection> CommonHcalNoiseRBXData::rbxTowers ( void  ) const [inline]

Definition at line 40 of file HcalNoiseAlgo.h.

References rbxtowers_.

Referenced by reco::HcalNoiseInfoProducer::fillOtherSummaryVariables().

{ return rbxtowers_; }
bool CommonHcalNoiseRBXData::validRatio ( void  ) const [inline]

Member Data Documentation

Definition at line 49 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), e10ts(), ratio(), and validRatio().

Definition at line 48 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), e2ts(), and ratio().

Definition at line 47 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and energy().

Definition at line 60 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and highEHitTimeSqrd().

Definition at line 62 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and HPDEMF().

Definition at line 56 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and lowEHitTimeSqrd().

Definition at line 59 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and maxHighEHitTime().

Definition at line 55 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and maxLowEHitTime().

Definition at line 58 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and minHighEHitTime().

Definition at line 54 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and minLowEHitTime().

Definition at line 61 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numHighEHits().

Definition at line 50 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numHPDHits().

Definition at line 52 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numHPDNoOtherHits().

Definition at line 57 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numLowEHits().

Definition at line 51 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numRBXHits().

Definition at line 53 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numZeros().

Definition at line 63 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and RBXEMF().

Definition at line 65 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and rbxTowers().

Definition at line 64 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and PassTS4TS5().