CMS 3D CMS Logo

SimG4HcalHitCluster.cc
Go to the documentation of this file.
1 // File: SimG4HcalHitCluster.cc
3 // Description: Cluster class in SimG4HcalValidation
6 
7 #include "CLHEP/Vector/LorentzVector.h"
8 
9 SimG4HcalHitCluster::SimG4HcalHitCluster() : ec(0), etac(0), phic(0) {}
10 
12 
14  return (ec / cosh(etac) < cluster.e() / cosh(cluster.eta())) ? false : true;
15 }
16 
18  hitsc.push_back(hit);
19 
20  if (ec == 0. && etac == 0. && phic == 0.) {
21  ec = hit.e();
22  etac = hit.eta();
23  phic = hit.phi();
24  } else {
25  // cluster px,py,pz
26  double et = ec / my_cosh(etac);
27  double px = et * cos(phic);
28  double py = et * sin(phic);
29  double pz = et * my_sinh(etac);
30 
31  CLHEP::HepLorentzVector clusHLV(px, py, pz, ec);
32 
33  // hit px,py,pz
34  double eh = hit.e();
35  double etah = hit.eta();
36  double phih = hit.phi();
37  et = eh / my_cosh(etah);
38  px = et * cos(phih);
39  py = et * sin(phih);
40  pz = et * my_sinh(etah);
41 
42  CLHEP::HepLorentzVector hitHLV(px, py, pz, eh);
43 
44  // clus + hit
45  clusHLV += hitHLV;
46 
47  double theta = clusHLV.theta();
48  etac = -log(tan(theta / 2.));
49  phic = clusHLV.phi();
50  ec = clusHLV.t();
51  }
52 
53  return *this;
54 }
55 
57  double sum = 0.;
58  std::vector<CaloHit>::iterator itr;
59 
60  for (itr = hitsc.begin(); itr < hitsc.end(); itr++) {
61  if (itr->det() == 10 || itr->det() == 11 || itr->det() == 12) {
62  sum += itr->e();
63  }
64  }
65  return sum;
66 }
67 
68 std::ostream &operator<<(std::ostream &os, const SimG4HcalHitCluster &cluster) {
69  os << " SimG4HcalHitCluster:: E " << cluster.e() << " eta " << cluster.eta() << " phi " << cluster.phi();
70  return os;
71 }
double phi() const
Definition: CaloHit.h:23
std::vector< CaloHit > hitsc
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
double eta() const
Definition: CaloHit.h:22
SimG4HcalHitCluster & operator+=(const CaloHit &hit)
double my_sinh(float eta)
bool operator<(const SimG4HcalHitCluster &cluster) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double my_cosh(float eta)
double e() const
Definition: CaloHit.h:21
et
define resolution functions of each parameter
std::ostream & operator<<(std::ostream &os, const SimG4HcalHitCluster &cluster)