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  return (ec / cosh(etac) < cluster.e() / cosh(cluster.eta())) ? false : true;
13 }
14 
16  hitsc.push_back(hit);
17 
18  if (ec == 0. && etac == 0. && phic == 0.) {
19  ec = hit.e();
20  etac = hit.eta();
21  phic = hit.phi();
22  } else {
23  // cluster px,py,pz
24  double et = ec / my_cosh(etac);
25  double px = et * cos(phic);
26  double py = et * sin(phic);
27  double pz = et * my_sinh(etac);
28 
29  CLHEP::HepLorentzVector clusHLV(px, py, pz, ec);
30 
31  // hit px,py,pz
32  double eh = hit.e();
33  double etah = hit.eta();
34  double phih = hit.phi();
35  et = eh / my_cosh(etah);
36  px = et * cos(phih);
37  py = et * sin(phih);
38  pz = et * my_sinh(etah);
39 
40  CLHEP::HepLorentzVector hitHLV(px, py, pz, eh);
41 
42  // clus + hit
43  clusHLV += hitHLV;
44 
45  double theta = clusHLV.theta();
46  etac = -log(tan(theta / 2.));
47  phic = clusHLV.phi();
48  ec = clusHLV.t();
49  }
50 
51  return *this;
52 }
53 
55  double sum = 0.;
56  std::vector<CaloHit>::iterator itr;
57 
58  for (itr = hitsc.begin(); itr < hitsc.end(); itr++) {
59  if (itr->det() == 10 || itr->det() == 11 || itr->det() == 12) {
60  sum += itr->e();
61  }
62  }
63  return sum;
64 }
65 
66 std::ostream &operator<<(std::ostream &os, const SimG4HcalHitCluster &cluster) {
67  os << " SimG4HcalHitCluster:: E " << cluster.e() << " eta " << cluster.eta() << " phi " << cluster.phi();
68  return os;
69 }
std::vector< CaloHit > hitsc
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
bool operator<(const SimG4HcalHitCluster &cluster) const
SimG4HcalHitCluster & operator+=(const CaloHit &hit)
double my_sinh(float eta)
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)
Geom::Theta< T > theta() const
std::ostream & operator<<(std::ostream &os, const SimG4HcalHitCluster &cluster)