CMS 3D CMS Logo

HFPreRecHit.h
Go to the documentation of this file.
1 #ifndef DATAFORMATS_HCALRECHIT_HFPRERECHIT_H
2 #define DATAFORMATS_HCALRECHIT_HFPRERECHIT_H
3 
4 #include <utility>
5 
7 
14 class HFPreRecHit {
15 public:
17 
18  constexpr HFPreRecHit() : hasInfo_{false, false} {}
19 
20  // In the constructor below, either "first" or "second"
21  // pointer can be nullptr
22  constexpr HFPreRecHit(const HcalDetId& id, const HFQIE10Info* first, const HFQIE10Info* second)
23  : id_(id), hasInfo_{false, false} {
24  if (first) {
25  hfQIE10Info_[0] = *first;
26  hasInfo_[0] = true;
27  }
28  if (second) {
29  hfQIE10Info_[1] = *second;
30  hasInfo_[1] = true;
31  }
32  }
33 
34  constexpr HcalDetId id() const { return id_; }
35 
36  // Get a pointer to the QIE10 info. nullptr will be returned
37  // if the info with the given index does not exist or if the
38  // index is out of range.
39  constexpr HFQIE10Info const* getHFQIE10Info(unsigned index) const {
40  if (index < 2 && hasInfo_[index])
41  return &hfQIE10Info_[index];
42  else
43  return nullptr;
44  }
45 
46  // Quantities simply added from both anodes
47  constexpr float charge() const {
48  float q = 0.f;
49  for (unsigned i = 0; i < 2; ++i)
50  if (hasInfo_[i])
51  q += hfQIE10Info_[i].charge();
52  return q;
53  }
54  constexpr float energy() const {
55  float e = 0.f;
56  for (unsigned i = 0; i < 2; ++i)
57  if (hasInfo_[i])
58  e += hfQIE10Info_[i].energy();
59  return e;
60  }
61 
62  // The following function returns a pair.
63  // The first element of the pair is the charge asymmetry,
64  // if calculated. The second element of the pair indicates
65  // whether the asymmetry is actually calculated. "true"
66  // means yes, it is. The asymmetry is calculated if all
67  // of the following conditions are satisfied:
68  //
69  // 1) The data is available for both PMT anodes.
70  // 2) The sum of the charges is positive.
71  // 3) The sum of the charges is at least "chargeThreshold".
72  //
73  // If the asymmetry is not calculated, the first element of
74  // the pair is set to 0 and the second to "false".
75  //
76  std::pair<float, bool> chargeAsymmetry(float chargeThreshold) const;
77 
78  // Similar function for the energy asymmetry
79  std::pair<float, bool> energyAsymmetry(float energyThreshold) const;
80 
81 private:
83 
85  bool hasInfo_[2];
86 };
87 
88 #endif // DATAFORMATS_HCALRECHIT_HFPRERECHIT_H
mps_fire.i
i
Definition: mps_fire.py:428
HFPreRecHit::HFPreRecHit
constexpr HFPreRecHit(const HcalDetId &id, const HFQIE10Info *first, const HFQIE10Info *second)
Definition: HFPreRecHit.h:22
HFPreRecHit::energyAsymmetry
std::pair< float, bool > energyAsymmetry(float energyThreshold) const
Definition: HFPreRecHit.cc:17
HFPreRecHit::chargeAsymmetry
std::pair< float, bool > chargeAsymmetry(float chargeThreshold) const
Definition: HFPreRecHit.cc:3
HFQIE10Info
Definition: HFQIE10Info.h:15
HFQIE10Info::energy
constexpr float energy() const
Definition: HFQIE10Info.h:80
HFPreRecHit::getHFQIE10Info
constexpr HFQIE10Info const * getHFQIE10Info(unsigned index) const
Definition: HFPreRecHit.h:39
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
HFQIE10Info::charge
constexpr float charge() const
Definition: HFQIE10Info.h:79
HFPreRecHit::key_type
HcalDetId key_type
Definition: HFPreRecHit.h:16
HFPreRecHit::HFPreRecHit
constexpr HFPreRecHit()
Definition: HFPreRecHit.h:18
HFPreRecHit::id_
HcalDetId id_
Definition: HFPreRecHit.h:82
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
HFPreRecHit::energy
constexpr float energy() const
Definition: HFPreRecHit.h:54
HFPreRecHit::charge
constexpr float charge() const
Definition: HFPreRecHit.h:47
HcalDetId
Definition: HcalDetId.h:12
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
HFPreRecHit::hasInfo_
bool hasInfo_[2]
Definition: HFPreRecHit.h:85
HFPreRecHit::id
constexpr HcalDetId id() const
Definition: HFPreRecHit.h:34
HFPreRecHit::hfQIE10Info_
HFQIE10Info hfQIE10Info_[2]
Definition: HFPreRecHit.h:84
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
ClusterTask_cfi.energyThreshold
energyThreshold
Definition: ClusterTask_cfi.py:3
HFQIE10Info.h
HFPreRecHit
Definition: HFPreRecHit.h:14
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37