CMS 3D CMS Logo

HFFlexibleTimeCheck.cc
Go to the documentation of this file.
1 #include <cmath>
2 
6 
7 // Phase 1 rechit status bit assignments
9 
11  const unsigned ianode, const HFQIE10Info& anode,
12  bool* isTimingReliable) const
13 {
14  // Return quickly if this anode has a dataframe error
15  if (!anode.isDataframeOK())
17 
18  // Require minimum charge for reliable timing measurement
19  const float charge = anode.charge();
20  const float minCharge = ianode ? pmtInfo_->minCharge1() :
22  if (charge < minCharge)
23  {
24  *isTimingReliable = false;
25  return HFAnodeStatus::OK;
26  }
27 
28  // Check if the rise time information is meaningful
29  float trise = anode.timeRising();
30  if (HcalSpecialTimes::isSpecial(trise))
32 
33  // Figure out the timing cuts for this PMT
34  const AbsHcalFunctor& minTimeShape = pmtInfo_->cut(
36  const AbsHcalFunctor& maxTimeShape = pmtInfo_->cut(
38 
39  // Apply the timing cuts
40  trise += timeShift();
41  if (minTimeShape(charge) <= trise && trise <= maxTimeShape(charge))
42  return HFAnodeStatus::OK;
43  else
45 }
46 
48  const HcalCalibrations& calibs,
49  const bool flaggedBadInDB[2],
50  const bool expectSingleAnodePMT)
51 {
52  // The algorithm must be configured by now
53  if (!algoConf_)
54  throw cms::Exception("HFPhase1BadConfig")
55  << "In HFFlexibleTimeCheck::reconstruct: algorithm is not configured";
56 
57  // Fetch the algorithm configuration data for this PMT
58  pmtInfo_ = &algoConf_->at(prehit.id());
59 
60  // Run the reconstruction algorithm from the base class
62  prehit, calibs, flaggedBadInDB, expectSingleAnodePMT);
63 
64  if (rh.id().rawId())
65  {
66  // Check the charge asymmetry between the two anodes
67  bool passesAsymmetryCut = true;
68  const std::pair<float,bool> qAsymm =
70  if (qAsymm.second)
71  {
72  const float q = prehit.charge();
73  const float minAsymm = (pmtInfo_->cut(HFPhase1PMTData::ASYMM_MIN))(q);
74  const float maxAsymm = (pmtInfo_->cut(HFPhase1PMTData::ASYMM_MAX))(q);
75  passesAsymmetryCut = minAsymm <= qAsymm.first && qAsymm.first <= maxAsymm;
76  }
77  if (!passesAsymmetryCut)
79  }
80 
81  return rh;
82 }
virtual unsigned determineAnodeStatus(unsigned anodeNumber, const HFQIE10Info &anode, bool *isTimingReliable) const override
float minChargeAsymm() const
float timeRising() const
Definition: HFQIE10Info.h:36
const HFPhase1PMTParams * algoConf_
bool isDataframeOK(bool checkAllTimeSlices=false) const
Definition: HFQIE10Info.cc:66
void setFlagField(uint32_t value, int base, int width=1)
Definition: CaloRecHit.cc:20
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const Item & at(const HcalDetId &id) const
HcalDetId id() const
Definition: HFPreRecHit.h:26
bool isSpecial(const float t)
virtual HFRecHit reconstruct(const HFPreRecHit &prehit, const HcalCalibrations &calibs, const bool flaggedBadInDB[2], bool expectSingleAnodePMT) override
const AbsHcalFunctor & cut(const unsigned which) const
float minCharge0() const
float minCharge1() const
virtual HFRecHit reconstruct(const HFPreRecHit &prehit, const HcalCalibrations &calibs, const bool flaggedBadInDB[2], bool expectSingleAnodePMT) override
float charge() const
Definition: HFPreRecHit.cc:24
float timeShift() const
std::pair< float, bool > chargeAsymmetry(float chargeThreshold) const
Definition: HFPreRecHit.cc:50
HcalDetId id() const
Definition: HFRecHit.h:23
const HFPhase1PMTData * pmtInfo_
float charge() const
Definition: HFQIE10Info.h:34