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 > > &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< 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 ( 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(), edm::RefVector< C, T, F >::clear(), e10ts_, e2ts_, jetCorrFactors_cfi::emf, 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(), TrackInfoProducer_cfi::rechits, ntuplemaker::time, reco::HcalNoiseRBX::totalZeros(), TS4TS5Decision_, HBHEPulseShapeFlagSetter_cfi::TS4TS5LowerCut, and HBHEPulseShapeFlagSetter_cfi::TS4TS5UpperCut.

8  :r45Count_(0)
9  ,r45Fraction_(0)
11 {
12  // energy
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  }
34  else
35  TS4TS5Decision_ = true;
36 
37  // Rechit-wide R45
38  int rbxHitCount = rbx.numRecHits(minRBXRechitR45E);
39  r45Count_ = 0;
40  r45Fraction_ = 0;
42  if(rbxHitCount > 0)
43  {
44  r45Count_ = rbx.numRecHitsFailR45(minRBXRechitR45E);
45  r45Fraction_ = (double)(r45Count_) / (double)(rbxHitCount);
46  r45EnergyFraction_ = rbx.recHitEnergyFailR45(minRBXRechitR45E) / rbx.recHitEnergy(minRBXRechitR45E);
47  }
48 
49  // # of hits
50  numHPDHits_ = 0;
51  for(std::vector<reco::HcalNoiseHPD>::const_iterator it1=rbx.HPDsBegin(); it1!=rbx.HPDsEnd(); ++it1) {
52  int nhpdhits=it1->numRecHits(minRecHitE);
53  if(numHPDHits_ < nhpdhits) numHPDHits_ = nhpdhits;
54  }
57 
58  // # of ADC zeros
59  numZeros_ = rbx.totalZeros();
60 
61  // timing
66  for(std::vector<reco::HcalNoiseHPD>::const_iterator it1=rbx.HPDsBegin(); it1!=rbx.HPDsEnd(); ++it1) {
68  for(edm::RefVector<HBHERecHitCollection>::const_iterator it2=rechits.begin(); it2!=rechits.end(); ++it2) {
69  float energy=(*it2)->energy();
70  float time=(*it2)->time();
71  if(energy>=minLowHitE) {
74  lowEHitTimeSqrd_ += time*time;
75  ++numLowEHits_;
76  }
77  if(energy>=minHighHitE) {
80  highEHitTimeSqrd_ += time*time;
81  ++numHighEHits_;
82  }
83  }
84  }
85 
86  // emf
87  HPDEMF_ = 999.;
88  for(std::vector<reco::HcalNoiseHPD>::const_iterator it1=rbx.HPDsBegin(); it1!=rbx.HPDsEnd(); ++it1) {
89  double eme=it1->caloTowerEmE();
90  double hade=it1->recHitEnergy(minRecHitE);
91  double emf=(eme+hade)==0 ? 999 : eme/(eme+hade);
92  if(HPDEMF_ > emf) emf = HPDEMF_;
93  }
94  double eme=rbx.caloTowerEmE();
95  RBXEMF_ = (eme+energy_)==0 ? 999 : eme/(eme+energy_);
96 
97  // calotowers
98  rbxtowers_.clear();
100  for(std::vector<reco::HcalNoiseHPD>::const_iterator it1=rbx.HPDsBegin(); it1!=rbx.HPDsEnd(); ++it1) {
101  join(rbxtowers_, it1->caloTowers());
102  }
103 
104  return;
105 }
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:65
std::vector< HcalNoiseHPD >::const_iterator HPDsBegin(void) const
Definition: HcalNoiseRBX.h:61
int numRecHits(double threshold=1.5) const
std::vector< HcalNoiseHPD >::const_iterator HPDsEnd(void) const
Definition: HcalNoiseRBX.h:62
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:253
edm::RefVector< CaloTowerCollection > rbxtowers_
Definition: HcalNoiseAlgo.h:68
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:248
double caloTowerEmE(void) const
double recHitEnergy(double theshold=1.5) const
Definition: HcalNoiseRBX.cc:99
float allChargeTotal(void) const
Definition: HcalNoiseRBX.cc:57
emf
the use of emf in the JEC is not yet implemented
int totalZeros(void) const
Definition: HcalNoiseRBX.cc:82
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
void clear()
Clear the vector.
Definition: RefVector.h:147
double recHitEnergyFailR45(double threshold=1.5) const
double energy(void) const
Definition: HcalNoiseAlgo.h:20
const std::vector< float > allCharge(void) const
Definition: HcalNoiseRBX.cc:52
CommonHcalNoiseRBXData::~CommonHcalNoiseRBXData ( )
inline

Definition at line 17 of file HcalNoiseAlgo.h.

17 {}

Member Function Documentation

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

Definition at line 362 of file HcalNoiseAlgo.cc.

References plotBeamSpotDB::first, mps_fire::i, createfilelist::int, and MessageLogger_cfi::limit.

Referenced by CommonHcalNoiseRBXData(), and r45EnergyFraction().

364 {
365  //
366  // Checks whether Discriminant value passes Cuts for the specified Charge. True if pulse is good.
367  //
368  // The "Cuts" pairs are assumed to be sorted in terms of size from small to large,
369  // where each "pair" = (Charge, Discriminant)
370  // "Side" is either positive or negative, which determines whether to discard the pulse if discriminant
371  // is greater or smaller than the cut value
372  //
373 
374  if(Cuts.size() == 0) // safety check that there are some cuts defined
375  return true;
376 
377  if(Charge <= Cuts[0].first) // too small to cut on
378  return true;
379 
380  int IndexLargerThanCharge = -1; // find the range it is falling in
381  for(int i = 1; i < (int)Cuts.size(); i++)
382  {
383  if(Cuts[i].first > Charge)
384  {
385  IndexLargerThanCharge = i;
386  break;
387  }
388  }
389 
390  double limit = 1000000;
391 
392  if(IndexLargerThanCharge == -1) // if charge is greater than the last entry, assume flat line
393  limit = Cuts[Cuts.size()-1].second;
394  else // otherwise, do a linear interpolation to find the cut position
395  {
396  double C1 = Cuts[IndexLargerThanCharge].first;
397  double C2 = Cuts[IndexLargerThanCharge-1].first;
398  double L1 = Cuts[IndexLargerThanCharge].second;
399  double L2 = Cuts[IndexLargerThanCharge-1].second;
400 
401  limit = (Charge - C1) / (C2 - C1) * (L2 - L1) + L1;
402  }
403 
404  if(Side > 0 && Discriminant > limit)
405  return false;
406  if(Side < 0 && Discriminant < limit)
407  return false;
408 
409  return true;
410 }
double CommonHcalNoiseRBXData::e10ts ( void  ) const
inline

Definition at line 23 of file HcalNoiseAlgo.h.

References e10ts_.

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

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

Definition at line 22 of file HcalNoiseAlgo.h.

References e2ts_.

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

22 { 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().

35 { 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().

31 { 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().

36 { 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().

32 { 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().

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

References rbxtowers_.

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

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

Member Data Documentation

double CommonHcalNoiseRBXData::e10ts_
private

Definition at line 52 of file HcalNoiseAlgo.h.

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

double CommonHcalNoiseRBXData::e2ts_
private

Definition at line 51 of file HcalNoiseAlgo.h.

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

double CommonHcalNoiseRBXData::energy_
private

Definition at line 50 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and energy().

double CommonHcalNoiseRBXData::highEHitTimeSqrd_
private

Definition at line 63 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and highEHitTimeSqrd().

double CommonHcalNoiseRBXData::HPDEMF_
private

Definition at line 65 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and HPDEMF().

double CommonHcalNoiseRBXData::lowEHitTimeSqrd_
private

Definition at line 59 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and lowEHitTimeSqrd().

double CommonHcalNoiseRBXData::maxHighEHitTime_
private

Definition at line 62 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and maxHighEHitTime().

double CommonHcalNoiseRBXData::maxLowEHitTime_
private

Definition at line 58 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and maxLowEHitTime().

double CommonHcalNoiseRBXData::minHighEHitTime_
private

Definition at line 61 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and minHighEHitTime().

double CommonHcalNoiseRBXData::minLowEHitTime_
private

Definition at line 57 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and minLowEHitTime().

int CommonHcalNoiseRBXData::numHighEHits_
private

Definition at line 64 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numHighEHits().

int CommonHcalNoiseRBXData::numHPDHits_
private

Definition at line 53 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numHPDHits().

int CommonHcalNoiseRBXData::numHPDNoOtherHits_
private

Definition at line 55 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numHPDNoOtherHits().

int CommonHcalNoiseRBXData::numLowEHits_
private

Definition at line 60 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numLowEHits().

int CommonHcalNoiseRBXData::numRBXHits_
private

Definition at line 54 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numRBXHits().

int CommonHcalNoiseRBXData::numZeros_
private

Definition at line 56 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and numZeros().

int CommonHcalNoiseRBXData::r45Count_
private

Definition at line 69 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and r45Count().

double CommonHcalNoiseRBXData::r45EnergyFraction_
private

Definition at line 71 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and r45EnergyFraction().

double CommonHcalNoiseRBXData::r45Fraction_
private

Definition at line 70 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and r45Fraction().

double CommonHcalNoiseRBXData::RBXEMF_
private

Definition at line 66 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and RBXEMF().

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

Definition at line 68 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and rbxTowers().

bool CommonHcalNoiseRBXData::TS4TS5Decision_
private

Definition at line 67 of file HcalNoiseAlgo.h.

Referenced by CommonHcalNoiseRBXData(), and PassTS4TS5().