CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
CommonHcalNoiseRBXData Class Reference

#include <HcalNoiseAlgo.h>

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 MinRBXRechitR45E)
 
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
 
int r45Count (void) const
 
double r45EnergyFraction (void) const
 
double r45Fraction (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_
 
int r45Count_
 
double r45EnergyFraction_
 
double r45Fraction_
 
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,
double  MinRBXRechitR45E 
)

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(), 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(), reco::HcalNoiseRBX::numRecHitsFailR45(), numZeros_, r45Count_, r45EnergyFraction_, r45Fraction_, RBXEMF_, rbxtowers_, reco::HcalNoiseRBX::recHitEnergy(), reco::HcalNoiseRBX::recHitEnergyFailR45(), HI_PhotonSkim_cff::rechits, reco::HcalNoiseRBX::totalZeros(), and TS4TS5Decision_.

12  // energy
13  energy_ = rbx.recHitEnergy(minRecHitE);
14 
15  // ratio
16  e2ts_ = rbx.allChargeHighest2TS();
17  e10ts_ = rbx.allChargeTotal();
18 
19  // TS4TS5
20  TS4TS5Decision_ = true;
21  if (energy_ > TS4TS5EnergyThreshold) // check filter
22  {
23  std::vector<float> AllCharge = rbx.allCharge();
24  double BaseCharge = AllCharge[4] + AllCharge[5];
25  if (BaseCharge < 1)
26  BaseCharge = 1;
27  double TS4TS5 = (AllCharge[4] - AllCharge[5]) / BaseCharge;
28 
29  if (CheckPassFilter(BaseCharge, TS4TS5, TS4TS5UpperCut, 1) == false)
30  TS4TS5Decision_ = false;
31  if (CheckPassFilter(BaseCharge, TS4TS5, TS4TS5LowerCut, -1) == false)
32  TS4TS5Decision_ = false;
33  } else
34  TS4TS5Decision_ = true;
35 
36  // Rechit-wide R45
37  int rbxHitCount = rbx.numRecHits(minRBXRechitR45E);
38  r45Count_ = 0;
39  r45Fraction_ = 0;
41  if (rbxHitCount > 0) {
42  r45Count_ = rbx.numRecHitsFailR45(minRBXRechitR45E);
43  r45Fraction_ = (double)(r45Count_) / (double)(rbxHitCount);
44  r45EnergyFraction_ = rbx.recHitEnergyFailR45(minRBXRechitR45E) / rbx.recHitEnergy(minRBXRechitR45E);
45  }
46 
47  // # of hits
48  numHPDHits_ = 0;
49  for (std::vector<reco::HcalNoiseHPD>::const_iterator it1 = rbx.HPDsBegin(); it1 != rbx.HPDsEnd(); ++it1) {
50  int nhpdhits = it1->numRecHits(minRecHitE);
51  if (numHPDHits_ < nhpdhits)
52  numHPDHits_ = nhpdhits;
53  }
54  numRBXHits_ = rbx.numRecHits(minRecHitE);
56 
57  // # of ADC zeros
58  numZeros_ = rbx.totalZeros();
59 
60  // timing
65  for (std::vector<reco::HcalNoiseHPD>::const_iterator it1 = rbx.HPDsBegin(); it1 != rbx.HPDsEnd(); ++it1) {
67  for (edm::RefVector<HBHERecHitCollection>::const_iterator it2 = rechits.begin(); it2 != rechits.end(); ++it2) {
68  float energy = (*it2)->energy();
69  float time = (*it2)->time();
70  if (energy >= minLowHitE) {
71  if (minLowEHitTime_ > time)
72  minLowEHitTime_ = time;
73  if (maxLowEHitTime_ < time)
74  maxLowEHitTime_ = time;
75  lowEHitTimeSqrd_ += time * time;
76  ++numLowEHits_;
77  }
78  if (energy >= minHighHitE) {
79  if (minHighEHitTime_ > time)
80  minHighEHitTime_ = time;
81  if (maxHighEHitTime_ < time)
82  maxHighEHitTime_ = time;
83  highEHitTimeSqrd_ += time * time;
84  ++numHighEHits_;
85  }
86  }
87  }
88 
89  // emf (get the one with minimum value)
90  HPDEMF_ = 999.;
91  for (std::vector<reco::HcalNoiseHPD>::const_iterator it1 = rbx.HPDsBegin(); it1 != rbx.HPDsEnd(); ++it1) {
92  double eme = it1->caloTowerEmE();
93  double hade = it1->recHitEnergy(minRecHitE);
94  double emf = (eme + hade) == 0 ? 999 : eme / (eme + hade);
95  if (HPDEMF_ > emf)
96  HPDEMF_ = emf;
97  }
98  double eme = rbx.caloTowerEmE();
99  RBXEMF_ = (eme + energy_) == 0 ? 999 : eme / (eme + energy_);
100 
101  // calotowers
102  rbxtowers_.clear();
104  for (std::vector<reco::HcalNoiseHPD>::const_iterator it1 = rbx.HPDsBegin(); it1 != rbx.HPDsEnd(); ++it1) {
105  join(rbxtowers_, it1->caloTowers());
106  }
107 
108  return;
109 }
bool CheckPassFilter(double Charge, double Discriminant, std::vector< std::pair< double, double > > &Cuts, int Side)
int numRecHitsFailR45(double threshold=1.5) const
float allChargeHighest2TS(unsigned int firstts=4) const
Definition: HcalNoiseRBX.cc:47
std::vector< HcalNoiseHPD >::const_iterator HPDsBegin(void) const
Definition: HcalNoiseRBX.h:57
int numRecHits(double threshold=1.5) const
std::vector< HcalNoiseHPD >::const_iterator HPDsEnd(void) const
Definition: HcalNoiseRBX.h:58
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
edm::RefVector< CaloTowerCollection > rbxtowers_
Definition: HcalNoiseAlgo.h:71
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
double caloTowerEmE(void) const
double recHitEnergy(double theshold=1.5) const
Definition: HcalNoiseRBX.cc:76
float allChargeTotal(void) const
Definition: HcalNoiseRBX.cc:40
int totalZeros(void) const
Definition: HcalNoiseRBX.cc:61
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
double recHitEnergyFailR45(double threshold=1.5) const
Definition: HcalNoiseRBX.cc:83
double energy(void) const
Definition: HcalNoiseAlgo.h:24
const std::vector< float > allCharge(void) const
Definition: HcalNoiseRBX.cc:38
CommonHcalNoiseRBXData::~CommonHcalNoiseRBXData ( )
inline

Definition at line 21 of file HcalNoiseAlgo.h.

21 {}

Member Function Documentation

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

Definition at line 383 of file HcalNoiseAlgo.cc.

References first, mps_fire::i, PixelRegions::L1, PixelRegions::L2, and MessageLogger_cff::limit.

Referenced by CommonHcalNoiseRBXData().

386  {
387  //
388  // Checks whether Discriminant value passes Cuts for the specified Charge. True if pulse is good.
389  //
390  // The "Cuts" pairs are assumed to be sorted in terms of size from small to large,
391  // where each "pair" = (Charge, Discriminant)
392  // "Side" is either positive or negative, which determines whether to discard the pulse if discriminant
393  // is greater or smaller than the cut value
394  //
395 
396  if (Cuts.empty()) // safety check that there are some cuts defined
397  return true;
398 
399  if (Charge <= Cuts[0].first) // too small to cut on
400  return true;
401 
402  int IndexLargerThanCharge = -1; // find the range it is falling in
403  for (int i = 1; i < (int)Cuts.size(); i++) {
404  if (Cuts[i].first > Charge) {
405  IndexLargerThanCharge = i;
406  break;
407  }
408  }
409 
410  double limit = 1000000;
411 
412  if (IndexLargerThanCharge == -1) // if charge is greater than the last entry, assume flat line
413  limit = Cuts[Cuts.size() - 1].second;
414  else // otherwise, do a linear interpolation to find the cut position
415  {
416  double C1 = Cuts[IndexLargerThanCharge].first;
417  double C2 = Cuts[IndexLargerThanCharge - 1].first;
418  double L1 = Cuts[IndexLargerThanCharge].second;
419  double L2 = Cuts[IndexLargerThanCharge - 1].second;
420 
421  limit = (Charge - C1) / (C2 - C1) * (L2 - L1) + L1;
422  }
423 
424  if (Side > 0 && Discriminant > limit)
425  return false;
426  if (Side < 0 && Discriminant < limit)
427  return false;
428 
429  return true;
430 }
double CommonHcalNoiseRBXData::e10ts ( void  ) const
inline

Definition at line 27 of file HcalNoiseAlgo.h.

References e10ts_.

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

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

Definition at line 26 of file HcalNoiseAlgo.h.

References e2ts_.

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

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

Definition at line 39 of file HcalNoiseAlgo.h.

References highEHitTimeSqrd_.

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

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

Definition at line 35 of file HcalNoiseAlgo.h.

References lowEHitTimeSqrd_.

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

35 { 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 40 of file HcalNoiseAlgo.h.

References numHighEHits_.

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

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

Definition at line 36 of file HcalNoiseAlgo.h.

References numLowEHits_.

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

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

Definition at line 43 of file HcalNoiseAlgo.h.

References TS4TS5Decision_.

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

43 { return TS4TS5Decision_; }
int CommonHcalNoiseRBXData::r45Count ( void  ) const
inline
double CommonHcalNoiseRBXData::r45EnergyFraction ( void  ) const
inline
double CommonHcalNoiseRBXData::r45Fraction ( void  ) const
inline
double CommonHcalNoiseRBXData::ratio ( void  ) const
inline
double CommonHcalNoiseRBXData::RBXEMF ( void  ) const
inline
edm::RefVector<CaloTowerCollection> CommonHcalNoiseRBXData::rbxTowers ( void  ) const
inline

Definition at line 44 of file HcalNoiseAlgo.h.

References rbxtowers_.

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

44 { return rbxtowers_; }
edm::RefVector< CaloTowerCollection > rbxtowers_
Definition: HcalNoiseAlgo.h:71
bool CommonHcalNoiseRBXData::validRatio ( void  ) const
inline

Member Data Documentation

double CommonHcalNoiseRBXData::e10ts_
private

Definition at line 55 of file HcalNoiseAlgo.h.

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

double CommonHcalNoiseRBXData::e2ts_
private

Definition at line 54 of file HcalNoiseAlgo.h.

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

double CommonHcalNoiseRBXData::energy_
private

Definition at line 53 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and energy().

double CommonHcalNoiseRBXData::highEHitTimeSqrd_
private

Definition at line 66 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and highEHitTimeSqrd().

double CommonHcalNoiseRBXData::HPDEMF_
private

Definition at line 68 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and HPDEMF().

double CommonHcalNoiseRBXData::lowEHitTimeSqrd_
private

Definition at line 62 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and lowEHitTimeSqrd().

double CommonHcalNoiseRBXData::maxHighEHitTime_
private

Definition at line 65 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and maxHighEHitTime().

double CommonHcalNoiseRBXData::maxLowEHitTime_
private

Definition at line 61 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and maxLowEHitTime().

double CommonHcalNoiseRBXData::minHighEHitTime_
private

Definition at line 64 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and minHighEHitTime().

double CommonHcalNoiseRBXData::minLowEHitTime_
private

Definition at line 60 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and minLowEHitTime().

int CommonHcalNoiseRBXData::numHighEHits_
private

Definition at line 67 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numHighEHits().

int CommonHcalNoiseRBXData::numHPDHits_
private

Definition at line 56 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numHPDHits().

int CommonHcalNoiseRBXData::numHPDNoOtherHits_
private

Definition at line 58 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numHPDNoOtherHits().

int CommonHcalNoiseRBXData::numLowEHits_
private

Definition at line 63 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numLowEHits().

int CommonHcalNoiseRBXData::numRBXHits_
private

Definition at line 57 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numRBXHits().

int CommonHcalNoiseRBXData::numZeros_
private

Definition at line 59 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numZeros().

int CommonHcalNoiseRBXData::r45Count_
private

Definition at line 72 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and r45Count().

double CommonHcalNoiseRBXData::r45EnergyFraction_
private

Definition at line 74 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and r45EnergyFraction().

double CommonHcalNoiseRBXData::r45Fraction_
private

Definition at line 73 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and r45Fraction().

double CommonHcalNoiseRBXData::RBXEMF_
private

Definition at line 69 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and RBXEMF().

edm::RefVector<CaloTowerCollection> CommonHcalNoiseRBXData::rbxtowers_
private

Definition at line 71 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and rbxTowers().

bool CommonHcalNoiseRBXData::TS4TS5Decision_
private

Definition at line 70 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and PassTS4TS5().