CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
BremRecoveryClusterAlgo.cc
Go to the documentation of this file.
2 
4 
6  const float etaBorder = 1.479;
7 
8  superclusters_v.clear();
9 
10  // create vectors of references to clusters of a specific origin...
11  reco::CaloClusterPtrVector islandClustersBarrel_v;
12  reco::CaloClusterPtrVector islandClustersEndCap_v;
13 
14  // ...and populate them:
15  for (reco::CaloCluster_iterator it = clustersCollection.begin(); it != clustersCollection.end(); it++) {
16  reco::CaloClusterPtr cluster_p = *it;
17  if (cluster_p->algo() == reco::CaloCluster::island) {
18  if (fabs(cluster_p->position().eta()) < etaBorder) {
19  islandClustersBarrel_v.push_back(cluster_p);
20  } else {
21  islandClustersEndCap_v.push_back(cluster_p);
22  }
23  }
24  }
25 
26  // make the superclusters from the Barrel clusters - Island
27  makeIslandSuperClusters(islandClustersBarrel_v, eb_rdeta_, eb_rdphi_);
28  // make the superclusters from the EndCap clusters - Island
29  makeIslandSuperClusters(islandClustersEndCap_v, ec_rdeta_, ec_rdphi_);
30 
31  return superclusters_v;
32 }
33 
35 
37  double etaRoad,
38  double phiRoad) {
39  for (reco::CaloCluster_iterator currentSeed = clusters_v.begin(); currentSeed != clusters_v.end(); ++currentSeed) {
40  // Does our highest energy cluster have high enough energy?
41  if ((*currentSeed)->energy() * sin((*currentSeed)->position().theta()) < seedTransverseEnergyThreshold)
42  break;
43 
44  // if yes, make it a seed for a new SuperCluster:
45  double energy_ = (*currentSeed)->energy();
46  math::XYZVector position_(
47  (*currentSeed)->position().X(), (*currentSeed)->position().Y(), (*currentSeed)->position().Z());
48  position_ *= energy_;
49 
50  if (verbosity <= pINFO) {
51  std::cout << "*****************************" << std::endl;
52  std::cout << "******NEW SUPERCLUSTER*******" << std::endl;
53  std::cout << "Seed R = " << (*currentSeed)->position().Rho() << std::endl;
54  }
55 
56  // and add the matching clusters:
57  reco::CaloClusterPtrVector constituentClusters;
58  constituentClusters.push_back(*currentSeed);
59  reco::CaloCluster_iterator currentCluster = currentSeed + 1;
60  while (currentCluster != clusters_v.end()) {
61  if (match(*currentSeed, *currentCluster, etaRoad, phiRoad)) {
62  constituentClusters.push_back(*currentCluster);
63  energy_ += (*currentCluster)->energy();
64  position_ += (*currentCluster)->energy() * math::XYZVector((*currentCluster)->position().X(),
65  (*currentCluster)->position().Y(),
66  (*currentCluster)->position().Z());
67  if (verbosity <= pINFO) {
68  std::cout << "Cluster R = " << (*currentCluster)->position().Rho() << std::endl;
69  }
70  }
71  ++currentCluster;
72  }
73 
74  position_ /= energy_;
75 
76  if (verbosity <= pINFO) {
77  std::cout << "Final SuperCluster R = " << position_.Rho() << std::endl;
78  }
79 
80  reco::SuperCluster newSuperCluster(
81  energy_, math::XYZPoint(position_.X(), position_.Y(), position_.Z()), (*currentSeed), constituentClusters);
82 
83  superclusters_v.push_back(newSuperCluster);
84 
85  if (verbosity <= pINFO) {
86  std::cout << "created a new supercluster of: " << std::endl;
87  std::cout << "Energy = " << newSuperCluster.energy() << std::endl;
88  std::cout << "Position in (R, phi, theta) = (" << newSuperCluster.position().Rho() << ", "
89  << newSuperCluster.position().phi() << ", " << newSuperCluster.position().theta() << ")" << std::endl;
90  }
91  }
92  clusters_v.clear();
93 }
94 
96  reco::CaloClusterPtr cluster_p,
97  double dEtaMax,
98  double dPhiMax) {
99  math::XYZPoint clusterPosition = cluster_p->position();
100  math::XYZPoint seedPosition = seed_p->position();
101 
102  double dPhi = acos(cos(seedPosition.phi() - clusterPosition.phi()));
103 
104  double dEta = fabs(seedPosition.eta() - clusterPosition.eta());
105 
106  if (dEta > dEtaMax)
107  return false;
108  if (dPhi > dPhiMax)
109  return false;
110 
111  return true;
112 }
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
reco::SuperClusterCollection makeSuperClusters(reco::CaloClusterPtrVector &clusters)
const_iterator end() const
Definition: PtrVector.h:146
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
const_iterator begin() const
Definition: PtrVector.h:144
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
void clear()
Clear the PtrVector.
Definition: PtrVectorBase.h:81
void makeIslandSuperClusters(reco::CaloClusterPtrVector &clusters_v, double etaRoad, double phiRoad)
bool match(reco::CaloClusterPtr seed_p, reco::CaloClusterPtr cluster_p, double etaRoad, double phiRoad)
reco::SuperClusterCollection superclusters_v