CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
19  hitsc.push_back(hit);
20 
21  if (ec == 0. && etac == 0. && phic == 0.) {
22  ec = hit.e();
23  etac = hit.eta();
24  phic = hit.phi();
25  } else {
26  // cluster px,py,pz
27  double et = ec / my_cosh(etac);
28  double px = et * cos(phic);
29  double py = et * sin(phic);
30  double pz = et * my_sinh(etac);
31 
32  CLHEP::HepLorentzVector clusHLV(px,py,pz,ec);
33 
34  // hit px,py,pz
35  double eh = hit.e();
36  double etah = hit.eta();
37  double phih = hit.phi();
38  et = eh / my_cosh(etah);
39  px = et * cos(phih);
40  py = et * sin(phih);
41  pz = et * my_sinh(etah);
42 
43  CLHEP::HepLorentzVector hitHLV(px,py,pz,eh);
44 
45  // clus + hit
46  clusHLV += hitHLV;
47 
48  double theta = clusHLV.theta();
49  etac = -log(tan(theta/2.));
50  phic = clusHLV.phi();
51  ec = clusHLV.t();
52  }
53 
54  return *this;
55 }
56 
58 
59  double sum = 0.;
60  std::vector<CaloHit>::iterator itr;
61 
62  for (itr = hitsc.begin(); itr < hitsc.end(); itr++) {
63  if (itr->det() == 10 || itr->det() == 11 || itr->det() == 12) {
64  sum += itr->e();
65  }
66  }
67  return sum;
68 }
69 
70 std::ostream& operator<<(std::ostream& os, const SimG4HcalHitCluster& cluster){
71  os << " SimG4HcalHitCluster:: E " << cluster.e() << " eta " << cluster.eta()
72  << " phi " << cluster.phi();
73  return os;
74 }
double phi() const
Definition: CaloHit.h:26
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:25
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
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:24