CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HGCalMulticluster_SA.cc
Go to the documentation of this file.
2 
3 #include <cmath>
4 
5 using namespace l1thgcfirmware;
6 
9  addConstituent(tc, true, fraction);
10 }
11 
12 void HGCalMulticluster::addConstituent(const HGCalCluster& tc, bool updateCentre, float fraction) {
13  // If no constituents, set seedMiptPt to cluster mipPt
14  if (constituents_.empty()) {
15  // seedMipPt_ = cMipPt;
16  if (!updateCentre) {
17  centre_x_ = tc.x();
18  centre_y_ = tc.y();
19  centre_z_ = tc.z();
20  }
21  }
22  // UpdateP4AndPosition
23  updateP4AndPosition(tc, updateCentre, fraction);
24 
25  constituents_.emplace_back(tc);
26 }
27 
28 void HGCalMulticluster::updateP4AndPosition(const HGCalCluster& tc, bool updateCentre, float fraction) {
29  // Get cluster mipPt
30  double cMipt = tc.mipPt() * fraction;
31  double cPt = tc.pt() * fraction;
32  if (updateCentre) {
33  float clusterCentre_x = centre_x_ * mipPt_ + tc.x() * cMipt;
34  float clusterCentre_y = centre_y_ * mipPt_ + tc.y() * cMipt;
35  float clusterCentre_z = centre_z_ * mipPt_ + tc.z() * cMipt; // Check this!
36 
37  if ((mipPt_ + cMipt) > 0) {
38  clusterCentre_x /= (mipPt_ + cMipt);
39  clusterCentre_y /= (mipPt_ + cMipt);
40  clusterCentre_z /= (mipPt_ + cMipt);
41  }
42  centre_x_ = clusterCentre_x;
43  centre_y_ = clusterCentre_y;
44  centre_z_ = clusterCentre_z;
45 
46  if (centre_z_ != 0) {
50  }
51  }
52 
53  mipPt_ += cMipt;
54  sumPt_ += cPt;
55 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void updateP4AndPosition(const l1thgcfirmware::HGCalCluster &tc, bool updateCentre=true, float fraction=1.)
void addConstituent(const l1thgcfirmware::HGCalCluster &tc, bool updateCentre=true, float fraction=1.)
std::vector< l1thgcfirmware::HGCalCluster > constituents_