CMS 3D CMS Logo

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