CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
HFSimpleTimeCheck Class Reference

#include <HFSimpleTimeCheck.h>

Inheritance diagram for HFSimpleTimeCheck:
AbsHFPhase1Algo HFFlexibleTimeCheck

Public Member Functions

bool alwaysCalculatingQAsym () const
 
 HFSimpleTimeCheck (const std::pair< float, float > tlimits[2], const float energyWeights[2 *HFAnodeStatus::N_POSSIBLE_STATES - 1][2], unsigned soiPhase, float timeShift, float triseIfNoTDC, float tfallIfNoTDC, float minChargeForUndershoot, float minChargeForOvershoot, bool rejectAllFailures=true, bool alwaysCalculateChargeAsymmetry=true)
 
bool isConfigurable () const override
 
float minChargeForOvershoot () const
 
float minChargeForUndershoot () const
 
HFRecHit reconstruct (const HFPreRecHit &prehit, const HcalCalibrations &calibs, const bool flaggedBadInDB[2], bool expectSingleAnodePMT) override
 
bool rejectingAllFailures () const
 
unsigned soiPhase () const
 
float tfallIfNoTDC () const
 
float timeShift () const
 
float triseIfNoTDC () const
 
 ~HFSimpleTimeCheck () override
 
- Public Member Functions inherited from AbsHFPhase1Algo
virtual bool configure (const AbsHcalAlgoData *)
 
virtual ~AbsHFPhase1Algo ()
 

Protected Member Functions

virtual unsigned determineAnodeStatus (unsigned anodeNumber, const HFQIE10Info &anode, bool *isTimingReliable) const
 

Private Member Functions

unsigned mapStatusIntoIndex (const unsigned states[2]) const
 

Private Attributes

bool alwaysQAsym_
 
float energyWeights_ [2 *HFAnodeStatus::N_POSSIBLE_STATES - 1][2]
 
float minChargeForOvershoot_
 
float minChargeForUndershoot_
 
bool rejectAllFailures_
 
unsigned soiPhase_
 
float tfallIfNoTDC_
 
float timeShift_
 
std::pair< float, float > tlimits_ [2]
 
float triseIfNoTDC_
 

Detailed Description

Definition at line 9 of file HFSimpleTimeCheck.h.

Constructor & Destructor Documentation

◆ HFSimpleTimeCheck()

HFSimpleTimeCheck::HFSimpleTimeCheck ( const std::pair< float, float >  tlimits[2],
const float  energyWeights[2 *HFAnodeStatus::N_POSSIBLE_STATES - 1][2],
unsigned  soiPhase,
float  timeShift,
float  triseIfNoTDC,
float  tfallIfNoTDC,
float  minChargeForUndershoot,
float  minChargeForOvershoot,
bool  rejectAllFailures = true,
bool  alwaysCalculateChargeAsymmetry = true 
)

Definition at line 32 of file HFSimpleTimeCheck.cc.

42  : soiPhase_(i_soiPhase),
43  timeShift_(i_timeShift),
44  triseIfNoTDC_(i_triseIfNoTDC),
45  tfallIfNoTDC_(i_tfallIfNoTDC),
46  minChargeForUndershoot_(i_minChargeForUndershoot),
47  minChargeForOvershoot_(i_minChargeForOvershoot),
50  tlimits_[0] = tlimits[0];
51  tlimits_[1] = tlimits[1];
52  float* to = &energyWeights_[0][0];
53  const float* from = &energyWeights[0][0];
54  memcpy(to, from, sizeof(energyWeights_));
55 }

References HLT_2018_cff::energyWeights, energyWeights_, HLT_2018_cff::tlimits, and tlimits_.

◆ ~HFSimpleTimeCheck()

HFSimpleTimeCheck::~HFSimpleTimeCheck ( )
inlineoverride

Definition at line 71 of file HFSimpleTimeCheck.h.

71 {}

Member Function Documentation

◆ alwaysCalculatingQAsym()

bool HFSimpleTimeCheck::alwaysCalculatingQAsym ( ) const
inline

Definition at line 87 of file HFSimpleTimeCheck.h.

87 { return alwaysQAsym_; }

References alwaysQAsym_.

Referenced by HFFlexibleTimeCheck::reconstruct().

◆ determineAnodeStatus()

unsigned HFSimpleTimeCheck::determineAnodeStatus ( unsigned  anodeNumber,
const HFQIE10Info anode,
bool *  isTimingReliable 
) const
protectedvirtual

Reimplemented in HFFlexibleTimeCheck.

Definition at line 57 of file HFSimpleTimeCheck.cc.

57  {
58  // Check if this anode has a dataframe error
59  if (!anode.isDataframeOK())
61 
62  // Check the time limits
63  float trise = anode.timeRising();
64  const bool timeIsKnown = !HcalSpecialTimes::isSpecial(trise);
65  trise += timeShift_;
66  if (timeIsKnown && tlimits_[ianode].first <= trise && trise <= tlimits_[ianode].second)
67  return HFAnodeStatus::OK;
68  else
70 }

References HFAnodeStatus::FAILED_TIMING, dqmdumpme::first, HFAnodeStatus::HARDWARE_ERROR, HFQIE10Info::isDataframeOK(), HcalSpecialTimes::isSpecial(), HFAnodeStatus::OK, edm::second(), HFQIE10Info::timeRising(), timeShift_, and tlimits_.

Referenced by reconstruct().

◆ isConfigurable()

bool HFSimpleTimeCheck::isConfigurable ( ) const
inlineoverridevirtual

Implements AbsHFPhase1Algo.

Definition at line 73 of file HFSimpleTimeCheck.h.

73 { return false; }

◆ mapStatusIntoIndex()

unsigned HFSimpleTimeCheck::mapStatusIntoIndex ( const unsigned  states[2]) const
private

Definition at line 72 of file HFSimpleTimeCheck.cc.

72  {
73  unsigned eStates[2];
74  eStates[0] = states[0];
75  eStates[1] = states[1];
76  if (!rejectAllFailures_)
77  for (unsigned i = 0; i < 2; ++i)
78  if (eStates[i] == HFAnodeStatus::FAILED_TIMING || eStates[i] == HFAnodeStatus::FAILED_OTHER)
79  eStates[i] = HFAnodeStatus::OK;
80  if (eStates[0] == HFAnodeStatus::OK)
81  return eStates[1];
82  else if (eStates[1] == HFAnodeStatus::OK)
83  return HFAnodeStatus::N_POSSIBLE_STATES + eStates[0] - 1;
84  else
85  return UINT_MAX;
86 }

References HFAnodeStatus::FAILED_OTHER, HFAnodeStatus::FAILED_TIMING, mps_fire::i, HFAnodeStatus::N_POSSIBLE_STATES, HFAnodeStatus::OK, and rejectAllFailures_.

Referenced by reconstruct().

◆ minChargeForOvershoot()

float HFSimpleTimeCheck::minChargeForOvershoot ( ) const
inline

Definition at line 85 of file HFSimpleTimeCheck.h.

85 { return minChargeForOvershoot_; }

References minChargeForOvershoot_.

Referenced by HFFlexibleTimeCheck::determineAnodeStatus().

◆ minChargeForUndershoot()

float HFSimpleTimeCheck::minChargeForUndershoot ( ) const
inline

Definition at line 84 of file HFSimpleTimeCheck.h.

84 { return minChargeForUndershoot_; }

References minChargeForUndershoot_.

Referenced by HFFlexibleTimeCheck::determineAnodeStatus().

◆ reconstruct()

HFRecHit HFSimpleTimeCheck::reconstruct ( const HFPreRecHit prehit,
const HcalCalibrations calibs,
const bool  flaggedBadInDB[2],
bool  expectSingleAnodePMT 
)
overridevirtual

Implements AbsHFPhase1Algo.

Definition at line 88 of file HFSimpleTimeCheck.cc.

91  {
92  HFRecHit rh;
93 
94  // Determine the status of each anode
96  if (expectSingleAnodePMT)
97  states[1] = HFAnodeStatus::NOT_DUAL;
98 
99  bool isTimingReliable[2] = {true, true};
100  for (unsigned ianode = 0; ianode < 2; ++ianode) {
101  if (flaggedBadInDB[ianode])
102  states[ianode] = HFAnodeStatus::FLAGGED_BAD;
103  else {
104  const HFQIE10Info* anodeInfo = prehit.getHFQIE10Info(ianode);
105  if (anodeInfo)
106  states[ianode] = determineAnodeStatus(ianode, *anodeInfo, &isTimingReliable[ianode]);
107  }
108  }
109 
110  // Reconstruct energy and time
111  const unsigned lookupInd = mapStatusIntoIndex(states);
112  if (lookupInd != UINT_MAX) {
113  // In this scope, at least one of states[i] is HFAnodeStatus::OK
114  // or was mapped into that status by "mapStatusIntoIndex" method
115  //
116  const float* weights = &energyWeights_[lookupInd][0];
117  float energy = 0.f, tfallWeightedEnergySum = 0.f, triseWeightedEnergySum = 0.f;
118  float tfallWeightedSum = 0.f, triseWeightedSum = 0.f;
119  float tfallSum = 0.f, triseSum = 0.f;
120  unsigned tfallCount = 0, triseCount = 0;
121 
122  for (unsigned ianode = 0; ianode < 2; ++ianode) {
123  const HFQIE10Info* anodeInfo = prehit.getHFQIE10Info(ianode);
124  if (anodeInfo && weights[ianode] > 0.f) {
125  const float weightedEnergy = weights[ianode] * anodeInfo->energy();
126  energy += weightedEnergy;
127 
128  if (isTimingReliable[ianode] && states[ianode] != HFAnodeStatus::FAILED_TIMING) {
129  float trise = anodeInfo->timeRising();
130  if (!HcalSpecialTimes::isSpecial(trise)) {
131  trise += timeShift_;
132  triseSum += trise;
133  ++triseCount;
134  if (weightedEnergy > 0.f) {
135  triseWeightedSum += trise * weightedEnergy;
136  triseWeightedEnergySum += weightedEnergy;
137  }
138  }
139 
140  float tfall = anodeInfo->timeFalling();
141  if (!HcalSpecialTimes::isSpecial(tfall)) {
142  tfall += timeShift_;
143  tfallSum += tfall;
144  ++tfallCount;
145  if (weightedEnergy > 0.f) {
146  tfallWeightedSum += tfall * weightedEnergy;
147  tfallWeightedEnergySum += weightedEnergy;
148  }
149  }
150  }
151  }
152  }
153 
154  bool triseFromTDC = false;
155  const float trise =
156  build_rechit_time(triseWeightedEnergySum, triseWeightedSum, triseSum, triseCount, triseIfNoTDC_, &triseFromTDC);
157 
158  bool tfallFromTDC = false;
159  const float tfall =
160  build_rechit_time(tfallWeightedEnergySum, tfallWeightedSum, tfallSum, tfallCount, tfallIfNoTDC_, &tfallFromTDC);
161 
162  rh = HFRecHit(prehit.id(), energy, trise, tfall);
163  HFRecHitAuxSetter::setAux(prehit, states, soiPhase_, &rh);
164 
165  // Set the "timing from TDC" flag
166  const uint32_t flag = triseFromTDC ? 1U : 0U;
168  }
169 
170  return rh;
171 }

References determineAnodeStatus(), HCALHighEnergyHPDFilter_cfi::energy, HFQIE10Info::energy(), energyWeights_, f, HFAnodeStatus::FAILED_TIMING, RemoveAddSevLevel::flag, HFAnodeStatus::FLAGGED_BAD, HFPreRecHit::getHFQIE10Info(), HFPreRecHit::id(), HcalSpecialTimes::isSpecial(), mapStatusIntoIndex(), HFAnodeStatus::NOT_DUAL, HFAnodeStatus::NOT_READ_OUT, HFRecHitAuxSetter::setAux(), CaloRecHit::setFlagField(), soiPhase_, tfallIfNoTDC_, HFQIE10Info::timeFalling(), HFQIE10Info::timeRising(), timeShift_, HcalPhase1FlagLabels::TimingFromTDC, triseIfNoTDC_, mitigatedMETSequence_cff::U, and HLT_2018_cff::weights.

Referenced by HFFlexibleTimeCheck::reconstruct().

◆ rejectingAllFailures()

bool HFSimpleTimeCheck::rejectingAllFailures ( ) const
inline

Definition at line 86 of file HFSimpleTimeCheck.h.

86 { return rejectAllFailures_; }

References rejectAllFailures_.

◆ soiPhase()

unsigned HFSimpleTimeCheck::soiPhase ( ) const
inline

Definition at line 80 of file HFSimpleTimeCheck.h.

80 { return soiPhase_; }

References soiPhase_.

◆ tfallIfNoTDC()

float HFSimpleTimeCheck::tfallIfNoTDC ( ) const
inline

Definition at line 83 of file HFSimpleTimeCheck.h.

83 { return tfallIfNoTDC_; }

References tfallIfNoTDC_.

◆ timeShift()

float HFSimpleTimeCheck::timeShift ( ) const
inline

Definition at line 81 of file HFSimpleTimeCheck.h.

81 { return timeShift_; }

References timeShift_.

Referenced by HFFlexibleTimeCheck::determineAnodeStatus().

◆ triseIfNoTDC()

float HFSimpleTimeCheck::triseIfNoTDC ( ) const
inline

Definition at line 82 of file HFSimpleTimeCheck.h.

82 { return triseIfNoTDC_; }

References triseIfNoTDC_.

Member Data Documentation

◆ alwaysQAsym_

bool HFSimpleTimeCheck::alwaysQAsym_
private

Definition at line 105 of file HFSimpleTimeCheck.h.

Referenced by alwaysCalculatingQAsym().

◆ energyWeights_

float HFSimpleTimeCheck::energyWeights_[2 *HFAnodeStatus::N_POSSIBLE_STATES - 1][2]
private

Definition at line 97 of file HFSimpleTimeCheck.h.

Referenced by HFSimpleTimeCheck(), and reconstruct().

◆ minChargeForOvershoot_

float HFSimpleTimeCheck::minChargeForOvershoot_
private

Definition at line 103 of file HFSimpleTimeCheck.h.

Referenced by minChargeForOvershoot().

◆ minChargeForUndershoot_

float HFSimpleTimeCheck::minChargeForUndershoot_
private

Definition at line 102 of file HFSimpleTimeCheck.h.

Referenced by minChargeForUndershoot().

◆ rejectAllFailures_

bool HFSimpleTimeCheck::rejectAllFailures_
private

Definition at line 104 of file HFSimpleTimeCheck.h.

Referenced by mapStatusIntoIndex(), and rejectingAllFailures().

◆ soiPhase_

unsigned HFSimpleTimeCheck::soiPhase_
private

Definition at line 98 of file HFSimpleTimeCheck.h.

Referenced by reconstruct(), and soiPhase().

◆ tfallIfNoTDC_

float HFSimpleTimeCheck::tfallIfNoTDC_
private

Definition at line 101 of file HFSimpleTimeCheck.h.

Referenced by reconstruct(), and tfallIfNoTDC().

◆ timeShift_

float HFSimpleTimeCheck::timeShift_
private

Definition at line 99 of file HFSimpleTimeCheck.h.

Referenced by determineAnodeStatus(), reconstruct(), and timeShift().

◆ tlimits_

std::pair<float, float> HFSimpleTimeCheck::tlimits_[2]
private

Definition at line 96 of file HFSimpleTimeCheck.h.

Referenced by determineAnodeStatus(), and HFSimpleTimeCheck().

◆ triseIfNoTDC_

float HFSimpleTimeCheck::triseIfNoTDC_
private

Definition at line 100 of file HFSimpleTimeCheck.h.

Referenced by reconstruct(), and triseIfNoTDC().

HLT_2018_cff.weights
weights
Definition: HLT_2018_cff.py:87167
mps_fire.i
i
Definition: mps_fire.py:355
HcalSpecialTimes::isSpecial
constexpr bool isSpecial(const float t)
Definition: HcalSpecialTimes.h:53
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
HFSimpleTimeCheck::determineAnodeStatus
virtual unsigned determineAnodeStatus(unsigned anodeNumber, const HFQIE10Info &anode, bool *isTimingReliable) const
Definition: HFSimpleTimeCheck.cc:57
HFQIE10Info
Definition: HFQIE10Info.h:15
HFSimpleTimeCheck::tfallIfNoTDC_
float tfallIfNoTDC_
Definition: HFSimpleTimeCheck.h:101
HLT_2018_cff.tlimits
tlimits
Definition: HLT_2018_cff.py:7170
HFAnodeStatus::FLAGGED_BAD
Definition: HFAnodeStatus.h:11
HFQIE10Info::energy
constexpr float energy() const
Definition: HFQIE10Info.h:80
HFPreRecHit::getHFQIE10Info
constexpr HFQIE10Info const * getHFQIE10Info(unsigned index) const
Definition: HFPreRecHit.h:39
to
HFAnodeStatus::FAILED_OTHER
Definition: HFAnodeStatus.h:13
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
dqmdumpme.first
first
Definition: dqmdumpme.py:55
HLT_2018_cff.rejectAllFailures
rejectAllFailures
Definition: HLT_2018_cff.py:7166
HFQIE10Info::timeRising
constexpr float timeRising() const
Definition: HFQIE10Info.h:81
HFRecHit
Definition: HFRecHit.h:11
HFAnodeStatus::HARDWARE_ERROR
Definition: HFAnodeStatus.h:10
HFAnodeStatus::N_POSSIBLE_STATES
Definition: HFAnodeStatus.h:14
HFSimpleTimeCheck::minChargeForOvershoot_
float minChargeForOvershoot_
Definition: HFSimpleTimeCheck.h:103
HFSimpleTimeCheck::mapStatusIntoIndex
unsigned mapStatusIntoIndex(const unsigned states[2]) const
Definition: HFSimpleTimeCheck.cc:72
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
HFSimpleTimeCheck::energyWeights_
float energyWeights_[2 *HFAnodeStatus::N_POSSIBLE_STATES - 1][2]
Definition: HFSimpleTimeCheck.h:97
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
HFSimpleTimeCheck::alwaysQAsym_
bool alwaysQAsym_
Definition: HFSimpleTimeCheck.h:105
HFSimpleTimeCheck::rejectAllFailures_
bool rejectAllFailures_
Definition: HFSimpleTimeCheck.h:104
HFAnodeStatus::OK
Definition: HFAnodeStatus.h:7
HFSimpleTimeCheck::soiPhase_
unsigned soiPhase_
Definition: HFSimpleTimeCheck.h:98
HFQIE10Info::timeFalling
constexpr float timeFalling() const
Definition: HFQIE10Info.h:82
HFSimpleTimeCheck::timeShift_
float timeShift_
Definition: HFSimpleTimeCheck.h:99
HFAnodeStatus::NOT_READ_OUT
Definition: HFAnodeStatus.h:9
HFPreRecHit::id
constexpr HcalDetId id() const
Definition: HFPreRecHit.h:34
HFSimpleTimeCheck::tlimits_
std::pair< float, float > tlimits_[2]
Definition: HFSimpleTimeCheck.h:96
HLT_2018_cff.energyWeights
energyWeights
Definition: HLT_2018_cff.py:7167
HFPhase1Reconstructor_cfi.alwaysCalculateQAsymmetry
alwaysCalculateQAsymmetry
Definition: HFPhase1Reconstructor_cfi.py:78
HFQIE10Info::isDataframeOK
bool isDataframeOK(bool checkAllTimeSlices=false) const
Definition: HFQIE10Info.h:94
HFSimpleTimeCheck::minChargeForUndershoot_
float minChargeForUndershoot_
Definition: HFSimpleTimeCheck.h:102
CaloRecHit::setFlagField
constexpr void setFlagField(uint32_t value, int base, int width=1)
Definition: CaloRecHit.h:36
HcalPhase1FlagLabels::TimingFromTDC
Definition: HcalPhase1FlagLabels.h:27
HFAnodeStatus::FAILED_TIMING
Definition: HFAnodeStatus.h:12
HFSimpleTimeCheck::triseIfNoTDC_
float triseIfNoTDC_
Definition: HFSimpleTimeCheck.h:100
HFAnodeStatus::NOT_DUAL
Definition: HFAnodeStatus.h:8
HFRecHitAuxSetter::setAux
static void setAux(const HFPreRecHit &prehit, const unsigned anodeStates[2], unsigned soiPhase, HFRecHit *rechit)
Definition: HFRecHitAuxSetter.cc:9
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116