CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HFFlexibleTimeCheck.cc
Go to the documentation of this file.
1 #include <cmath>
2 
8 
9 // Phase 1 rechit status bit assignments
11 
12 unsigned HFFlexibleTimeCheck::determineAnodeStatus(const unsigned ianode,
13  const HFQIE10Info& anode,
14  bool* isTimingReliable) const {
15  // Return quickly if this anode has a dataframe error
16  if (!anode.isDataframeOK())
18 
19  // Require minimum charge for reliable timing measurement
20  const float charge = anode.charge();
21  const float minCharge = ianode ? pmtInfo_->minCharge1() : pmtInfo_->minCharge0();
22  if (charge < minCharge) {
23  *isTimingReliable = false;
24  return HFAnodeStatus::OK;
25  }
26 
27  // Special handling of under/overshoot TDC values, as well
28  // as of DLL failures
29  float trise = anode.timeRising();
33  *isTimingReliable = false;
34  return HFAnodeStatus::OK;
35  }
36 
37  // Check if the rise time information is meaningful
38  if (HcalSpecialTimes::isSpecial(trise))
40 
41  // Figure out the timing cuts for this PMT
44 
45  // Apply the timing cuts
46  trise += timeShift();
47  if (minTimeShape(charge) <= trise && trise <= maxTimeShape(charge))
48  return HFAnodeStatus::OK;
49  else
51 }
52 
54  const HcalCalibrations& calibs,
55  const bool flaggedBadInDB[2],
56  const bool expectSingleAnodePMT) {
57  // The algorithm must be configured by now
58  if (!algoConf_)
59  throw cms::Exception("HFPhase1BadConfig") << "In HFFlexibleTimeCheck::reconstruct: algorithm is not configured";
60 
61  // Fetch the algorithm configuration data for this PMT
62  pmtInfo_ = &algoConf_->at(prehit.id());
63 
64  // Run the reconstruction algorithm from the base class
65  HFRecHit rh = HFSimpleTimeCheck::reconstruct(prehit, calibs, flaggedBadInDB, expectSingleAnodePMT);
66 
67  if (rh.id().rawId()) {
68  // Check the charge asymmetry between the two anodes
69  bool setAsymmetryFlag = true;
70  if (!alwaysCalculatingQAsym()) {
71  using namespace CaloRecHitAuxSetter;
72 
75  setAsymmetryFlag = st0 == HFAnodeStatus::OK && st1 == HFAnodeStatus::OK;
76  }
77 
78  if (setAsymmetryFlag) {
79  bool passesAsymmetryCut = true;
80  const std::pair<float, bool> qAsymm = prehit.chargeAsymmetry(pmtInfo_->minChargeAsymm());
81  if (qAsymm.second) {
82  const float q = prehit.charge();
83  const float minAsymm = (pmtInfo_->cut(HFPhase1PMTData::ASYMM_MIN))(q);
84  const float maxAsymm = (pmtInfo_->cut(HFPhase1PMTData::ASYMM_MAX))(q);
85  passesAsymmetryCut = minAsymm <= qAsymm.first && qAsymm.first <= maxAsymm;
86  }
87  if (!passesAsymmetryCut)
89  }
90  }
91 
92  return rh;
93 }
float minChargeForOvershoot() const
unsigned determineAnodeStatus(unsigned anodeNumber, const HFQIE10Info &anode, bool *isTimingReliable) const override
float minChargeAsymm() const
constexpr float UNKNOWN_T_DLL_FAILURE
const HFPhase1PMTParams * algoConf_
bool isDataframeOK(bool checkAllTimeSlices=false) const
Definition: HFQIE10Info.h:94
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
bool alwaysCalculatingQAsym() const
constexpr void setFlagField(uint32_t value, int base, int width=1)
Definition: CaloRecHit.h:36
constexpr float UNKNOWN_T_UNDERSHOOT
static const unsigned OFF_STATUS
const Item & at(const HcalDetId &id) const
constexpr HcalDetId id() const
Definition: HFPreRecHit.h:34
constexpr float UNKNOWN_T_OVERSHOOT
HFRecHit reconstruct(const HFPreRecHit &prehit, const HcalCalibrations &calibs, const bool flaggedBadInDB[2], bool expectSingleAnodePMT) override
static const unsigned MASK_STATUS
const AbsHcalFunctor & cut(const unsigned which) const
float minCharge0() const
constexpr float timeRising() const
Definition: HFQIE10Info.h:81
constexpr unsigned getField(const uint32_t u, const unsigned mask, const unsigned offset)
constexpr bool isSpecial(const float t)
constexpr uint32_t getAuxHF() const
Definition: HFRecHit.h:29
float minCharge1() const
constexpr float charge() const
Definition: HFQIE10Info.h:79
HFRecHit reconstruct(const HFPreRecHit &prehit, const HcalCalibrations &calibs, const bool flaggedBadInDB[2], bool expectSingleAnodePMT) override
constexpr float charge() const
Definition: HFPreRecHit.h:47
float timeShift() const
constexpr uint32_t aux() const
Definition: CaloRecHit.h:50
std::pair< float, bool > chargeAsymmetry(float chargeThreshold) const
Definition: HFPreRecHit.cc:3
constexpr HcalDetId id() const
Definition: HFRecHit.h:26
const HFPhase1PMTData * pmtInfo_
float minChargeForUndershoot() const