CMS 3D CMS Logo

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 > > const &Cuts, int Side)
 
 CommonHcalNoiseRBXData (const reco::HcalNoiseRBX &rbx, double minRecHitE, double minLowHitE, double minHighHitE, double TS4TS5EnergyThreshold, std::vector< std::pair< double, double > > const &TS4TS5UpperCut, std::vector< std::pair< double, double > > const &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< CaloTowerCollectionrbxTowers (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< CaloTowerCollectionrbxtowers_
 
bool TS4TS5Decision_
 

Detailed Description

Definition at line 11 of file HcalNoiseAlgo.h.

Constructor & Destructor Documentation

◆ CommonHcalNoiseRBXData()

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

Definition at line 3 of file HcalNoiseAlgo.cc.

References reco::HcalNoiseRBX::allCharge(), reco::HcalNoiseRBX::allChargeHighest2TS(), reco::HcalNoiseRBX::allChargeTotal(), reco::HcalNoiseRBX::caloTowerEmE(), CheckPassFilter(), e10ts_, e2ts_, custom_jme_cff::emf, 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, hcalRecHitTable_cff::time, reco::HcalNoiseRBX::totalZeros(), TS4TS5Decision_, HLT_2023v12_cff::TS4TS5LowerCut, and HLT_2023v12_cff::TS4TS5UpperCut.

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)
73  if (maxLowEHitTime_ < time)
76  ++numLowEHits_;
77  }
78  if (energy >= minHighHitE) {
79  if (minHighEHitTime_ > time)
81  if (maxHighEHitTime_ < 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 }
std::vector< HcalNoiseHPD >::const_iterator HPDsBegin(void) const
Definition: HcalNoiseRBX.h:57
bool CheckPassFilter(double Charge, double Discriminant, std::vector< std::pair< double, double > > const &Cuts, int Side)
double recHitEnergy(double theshold=1.5) const
Definition: HcalNoiseRBX.cc:76
int totalZeros(void) const
Definition: HcalNoiseRBX.cc:61
int numRecHits(double threshold=1.5) const
edm::RefVector< CaloTowerCollection > rbxtowers_
Definition: HcalNoiseAlgo.h:74
float allChargeTotal(void) const
Definition: HcalNoiseRBX.cc:40
double energy(void) const
Definition: HcalNoiseAlgo.h:24
float allChargeHighest2TS(unsigned int firstts=4) const
Definition: HcalNoiseRBX.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
double caloTowerEmE(void) const
std::vector< HcalNoiseHPD >::const_iterator HPDsEnd(void) const
Definition: HcalNoiseRBX.h:58
int numRecHitsFailR45(double threshold=1.5) const
const std::vector< float > allCharge(void) const
Definition: HcalNoiseRBX.cc:38
double recHitEnergyFailR45(double threshold=1.5) const
Definition: HcalNoiseRBX.cc:83

◆ ~CommonHcalNoiseRBXData()

CommonHcalNoiseRBXData::~CommonHcalNoiseRBXData ( )
inline

Definition at line 21 of file HcalNoiseAlgo.h.

21 {}

Member Function Documentation

◆ CheckPassFilter()

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

Definition at line 383 of file HcalNoiseAlgo.cc.

References PixelTestBeamValidation_cfi::Charge, dqmdumpme::first, mps_fire::i, createfilelist::int, PixelRegions::L1, PixelRegions::L2, and remoteMonitoring_LASER_era2018_cfg::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 }

◆ e10ts()

double CommonHcalNoiseRBXData::e10ts ( void  ) const
inline

Definition at line 27 of file HcalNoiseAlgo.h.

References e10ts_.

27 { return e10ts_; }

◆ e2ts()

double CommonHcalNoiseRBXData::e2ts ( void  ) const
inline

Definition at line 26 of file HcalNoiseAlgo.h.

References e2ts_.

26 { return e2ts_; }

◆ energy()

double CommonHcalNoiseRBXData::energy ( void  ) const
inline

Definition at line 24 of file HcalNoiseAlgo.h.

References energy_.

Referenced by CommonHcalNoiseRBXData(), and Jet.Jet::rawEnergy().

24 { return energy_; }

◆ highEHitTimeSqrd()

double CommonHcalNoiseRBXData::highEHitTimeSqrd ( void  ) const
inline

Definition at line 39 of file HcalNoiseAlgo.h.

References highEHitTimeSqrd_.

39 { return highEHitTimeSqrd_; }

◆ HPDEMF()

double CommonHcalNoiseRBXData::HPDEMF ( void  ) const
inline

Definition at line 42 of file HcalNoiseAlgo.h.

References HPDEMF_.

42 { return HPDEMF_; }

◆ lowEHitTimeSqrd()

double CommonHcalNoiseRBXData::lowEHitTimeSqrd ( void  ) const
inline

Definition at line 35 of file HcalNoiseAlgo.h.

References lowEHitTimeSqrd_.

35 { return lowEHitTimeSqrd_; }

◆ maxHighEHitTime()

double CommonHcalNoiseRBXData::maxHighEHitTime ( void  ) const
inline

Definition at line 38 of file HcalNoiseAlgo.h.

References maxHighEHitTime_.

38 { return maxHighEHitTime_; }

◆ maxLowEHitTime()

double CommonHcalNoiseRBXData::maxLowEHitTime ( void  ) const
inline

Definition at line 34 of file HcalNoiseAlgo.h.

References maxLowEHitTime_.

34 { return maxLowEHitTime_; }

◆ minHighEHitTime()

double CommonHcalNoiseRBXData::minHighEHitTime ( void  ) const
inline

Definition at line 37 of file HcalNoiseAlgo.h.

References minHighEHitTime_.

37 { return minHighEHitTime_; }

◆ minLowEHitTime()

double CommonHcalNoiseRBXData::minLowEHitTime ( void  ) const
inline

Definition at line 33 of file HcalNoiseAlgo.h.

References minLowEHitTime_.

33 { return minLowEHitTime_; }

◆ numHighEHits()

int CommonHcalNoiseRBXData::numHighEHits ( void  ) const
inline

Definition at line 40 of file HcalNoiseAlgo.h.

References numHighEHits_.

40 { return numHighEHits_; }

◆ numHPDHits()

int CommonHcalNoiseRBXData::numHPDHits ( void  ) const
inline

Definition at line 29 of file HcalNoiseAlgo.h.

References numHPDHits_.

29 { return numHPDHits_; }

◆ numHPDNoOtherHits()

int CommonHcalNoiseRBXData::numHPDNoOtherHits ( void  ) const
inline

Definition at line 31 of file HcalNoiseAlgo.h.

References numHPDNoOtherHits_.

31 { return numHPDNoOtherHits_; }

◆ numLowEHits()

int CommonHcalNoiseRBXData::numLowEHits ( void  ) const
inline

Definition at line 36 of file HcalNoiseAlgo.h.

References numLowEHits_.

36 { return numLowEHits_; }

◆ numRBXHits()

int CommonHcalNoiseRBXData::numRBXHits ( void  ) const
inline

Definition at line 30 of file HcalNoiseAlgo.h.

References numRBXHits_.

30 { return numRBXHits_; }

◆ numZeros()

int CommonHcalNoiseRBXData::numZeros ( void  ) const
inline

Definition at line 32 of file HcalNoiseAlgo.h.

References numZeros_.

32 { return numZeros_; }

◆ PassTS4TS5()

bool CommonHcalNoiseRBXData::PassTS4TS5 ( void  ) const
inline

Definition at line 43 of file HcalNoiseAlgo.h.

References TS4TS5Decision_.

43 { return TS4TS5Decision_; }

◆ r45Count()

int CommonHcalNoiseRBXData::r45Count ( void  ) const
inline

Definition at line 45 of file HcalNoiseAlgo.h.

References r45Count_.

45 { return r45Count_; }

◆ r45EnergyFraction()

double CommonHcalNoiseRBXData::r45EnergyFraction ( void  ) const
inline

Definition at line 47 of file HcalNoiseAlgo.h.

References r45EnergyFraction_.

47 { return r45EnergyFraction_; }

◆ r45Fraction()

double CommonHcalNoiseRBXData::r45Fraction ( void  ) const
inline

Definition at line 46 of file HcalNoiseAlgo.h.

References r45Fraction_.

46 { return r45Fraction_; }

◆ ratio()

double CommonHcalNoiseRBXData::ratio ( void  ) const
inline

Definition at line 25 of file HcalNoiseAlgo.h.

References e10ts_, and e2ts_.

25 { return e2ts_ / e10ts_; }

◆ RBXEMF()

double CommonHcalNoiseRBXData::RBXEMF ( void  ) const
inline

Definition at line 41 of file HcalNoiseAlgo.h.

References RBXEMF_.

41 { return RBXEMF_; }

◆ rbxTowers()

edm::RefVector<CaloTowerCollection> CommonHcalNoiseRBXData::rbxTowers ( void  ) const
inline

Definition at line 44 of file HcalNoiseAlgo.h.

References rbxtowers_.

44 { return rbxtowers_; }
edm::RefVector< CaloTowerCollection > rbxtowers_
Definition: HcalNoiseAlgo.h:74

◆ validRatio()

bool CommonHcalNoiseRBXData::validRatio ( void  ) const
inline

Definition at line 28 of file HcalNoiseAlgo.h.

References e10ts_.

28 { return e10ts_ != 0.0; }

Member Data Documentation

◆ e10ts_

double CommonHcalNoiseRBXData::e10ts_
private

Definition at line 58 of file HcalNoiseAlgo.h.

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

◆ e2ts_

double CommonHcalNoiseRBXData::e2ts_
private

Definition at line 57 of file HcalNoiseAlgo.h.

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

◆ energy_

double CommonHcalNoiseRBXData::energy_
private

Definition at line 56 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and energy().

◆ highEHitTimeSqrd_

double CommonHcalNoiseRBXData::highEHitTimeSqrd_
private

Definition at line 69 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and highEHitTimeSqrd().

◆ HPDEMF_

double CommonHcalNoiseRBXData::HPDEMF_
private

Definition at line 71 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and HPDEMF().

◆ lowEHitTimeSqrd_

double CommonHcalNoiseRBXData::lowEHitTimeSqrd_
private

Definition at line 65 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and lowEHitTimeSqrd().

◆ maxHighEHitTime_

double CommonHcalNoiseRBXData::maxHighEHitTime_
private

Definition at line 68 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and maxHighEHitTime().

◆ maxLowEHitTime_

double CommonHcalNoiseRBXData::maxLowEHitTime_
private

Definition at line 64 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and maxLowEHitTime().

◆ minHighEHitTime_

double CommonHcalNoiseRBXData::minHighEHitTime_
private

Definition at line 67 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and minHighEHitTime().

◆ minLowEHitTime_

double CommonHcalNoiseRBXData::minLowEHitTime_
private

Definition at line 63 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and minLowEHitTime().

◆ numHighEHits_

int CommonHcalNoiseRBXData::numHighEHits_
private

Definition at line 70 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numHighEHits().

◆ numHPDHits_

int CommonHcalNoiseRBXData::numHPDHits_
private

Definition at line 59 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numHPDHits().

◆ numHPDNoOtherHits_

int CommonHcalNoiseRBXData::numHPDNoOtherHits_
private

Definition at line 61 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numHPDNoOtherHits().

◆ numLowEHits_

int CommonHcalNoiseRBXData::numLowEHits_
private

Definition at line 66 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numLowEHits().

◆ numRBXHits_

int CommonHcalNoiseRBXData::numRBXHits_
private

Definition at line 60 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numRBXHits().

◆ numZeros_

int CommonHcalNoiseRBXData::numZeros_
private

Definition at line 62 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numZeros().

◆ r45Count_

int CommonHcalNoiseRBXData::r45Count_
private

Definition at line 75 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and r45Count().

◆ r45EnergyFraction_

double CommonHcalNoiseRBXData::r45EnergyFraction_
private

Definition at line 77 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and r45EnergyFraction().

◆ r45Fraction_

double CommonHcalNoiseRBXData::r45Fraction_
private

Definition at line 76 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and r45Fraction().

◆ RBXEMF_

double CommonHcalNoiseRBXData::RBXEMF_
private

Definition at line 72 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and RBXEMF().

◆ rbxtowers_

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

Definition at line 74 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and rbxTowers().

◆ TS4TS5Decision_

bool CommonHcalNoiseRBXData::TS4TS5Decision_
private

Definition at line 73 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and PassTS4TS5().