CMS 3D CMS Logo

HFPreRecHit.cc
Go to the documentation of this file.
2 
4  : hasInfo_{false, false}
5 {
6 }
7 
9  const HFQIE10Info* second)
10  : id_(id), hasInfo_{false, false}
11 {
12  if (first)
13  {
14  hfQIE10Info_[0] = *first;
15  hasInfo_[0] = true;
16  }
17  if (second)
18  {
19  hfQIE10Info_[1] = *second;
20  hasInfo_[1] = true;
21  }
22 }
23 
24 float HFPreRecHit::charge() const
25 {
26  float q = 0.f;
27  for (unsigned i=0; i<2; ++i)
28  if (hasInfo_[i])
29  q += hfQIE10Info_[i].charge();
30  return q;
31 }
32 
33 float HFPreRecHit::energy() const
34 {
35  float e = 0.f;
36  for (unsigned i=0; i<2; ++i)
37  if (hasInfo_[i])
38  e += hfQIE10Info_[i].energy();
39  return e;
40 }
41 
42 const HFQIE10Info* HFPreRecHit::getHFQIE10Info(const unsigned index) const
43 {
44  if (index < 2 && hasInfo_[index])
45  return &hfQIE10Info_[index];
46  else
47  return nullptr;
48 }
49 
50 std::pair<float,bool> HFPreRecHit::chargeAsymmetry(const float chargeThreshold) const
51 {
52  std::pair<float,bool> result(0.f, false);
53  if (hasInfo_[0] && hasInfo_[1])
54  {
55  const float q0 = hfQIE10Info_[0].charge();
56  const float q1 = hfQIE10Info_[1].charge();
57  const float qsum = q0 + q1;
58  if (qsum > 0.f && qsum >= chargeThreshold)
59  {
60  result.first = (q1 - q0)/qsum;
61  result.second = true;
62  }
63  }
64  return result;
65 }
66 
67 std::pair<float,bool> HFPreRecHit::energyAsymmetry(const float energyThreshold) const
68 {
69  std::pair<float,bool> result(0.f, false);
70  if (hasInfo_[0] && hasInfo_[1])
71  {
72  const float e0 = hfQIE10Info_[0].energy();
73  const float e1 = hfQIE10Info_[1].energy();
74  const float esum = e0 + e1;
75  if (esum > 0.f && esum >= energyThreshold)
76  {
77  result.first = (e1 - e0)/esum;
78  result.second = true;
79  }
80  }
81  return result;
82 }
float energy() const
Definition: HFPreRecHit.cc:33
const HFQIE10Info * getHFQIE10Info(unsigned index) const
Definition: HFPreRecHit.cc:42
HcalDetId id_
Definition: HFPreRecHit.h:57
U second(std::pair< T, U > const &p)
double f[11][100]
float energy() const
Definition: HFQIE10Info.h:35
Float e1
Definition: deltaR.h:20
double q1[4]
Definition: TauolaWrapper.h:87
std::pair< float, bool > energyAsymmetry(float energyThreshold) const
Definition: HFPreRecHit.cc:67
float charge() const
Definition: HFPreRecHit.cc:24
HFQIE10Info hfQIE10Info_[2]
Definition: HFPreRecHit.h:59
std::pair< float, bool > chargeAsymmetry(float chargeThreshold) const
Definition: HFPreRecHit.cc:50
bool hasInfo_[2]
Definition: HFPreRecHit.h:60
float charge() const
Definition: HFQIE10Info.h:34