CMS 3D CMS Logo

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 }
BremRecoveryClusterAlgo::pINFO
Definition: BremRecoveryClusterAlgo.h:23
BremRecoveryClusterAlgo::superclusters_v
reco::SuperClusterCollection superclusters_v
Definition: BremRecoveryClusterAlgo.h:65
photonValidator_cfi.dEtaMax
dEtaMax
Definition: photonValidator_cfi.py:76
reco::SuperCluster
Definition: SuperCluster.h:18
BremRecoveryClusterAlgo::ec_rdphi_
double ec_rdphi_
Definition: BremRecoveryClusterAlgo.h:61
BremRecoveryClusterAlgo::verbosity
VerbosityLevel verbosity
Definition: BremRecoveryClusterAlgo.h:56
gather_cfg.cout
cout
Definition: gather_cfg.py:144
BremRecoveryClusterAlgo::makeSuperClusters
reco::SuperClusterCollection makeSuperClusters(reco::CaloClusterPtrVector &clusters)
Definition: BremRecoveryClusterAlgo.cc:5
BremRecoveryClusterAlgo.h
edm::PtrVector::begin
const_iterator begin() const
Definition: PtrVector.h:144
edm::PtrVectorItr
Definition: PtrVector.h:51
HLT_2018_cff.dEta
dEta
Definition: HLT_2018_cff.py:12289
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
reco::SuperClusterCollection
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Definition: SuperClusterFwd.h:9
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
edm::PtrVector< CaloCluster >
HLT_2018_cff.dPhi
dPhi
Definition: HLT_2018_cff.py:12290
edm::PtrVector::push_back
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
BremRecoveryClusterAlgo::eb_rdphi_
double eb_rdphi_
Definition: BremRecoveryClusterAlgo.h:59
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
BremRecoveryClusterAlgo::ec_rdeta_
double ec_rdeta_
Definition: BremRecoveryClusterAlgo.h:60
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
edm::PtrVector::end
const_iterator end() const
Definition: PtrVector.h:146
edm::PtrVectorBase::clear
void clear()
Clear the PtrVector.
Definition: PtrVectorBase.h:79
BremRecoveryClusterAlgo::eb_rdeta_
double eb_rdeta_
Definition: BremRecoveryClusterAlgo.h:58
reco::CaloCluster::island
Definition: CaloCluster.h:34
edm::Ptr< CaloCluster >
BremRecoveryClusterAlgo::seedTransverseEnergyThreshold
double seedTransverseEnergyThreshold
Definition: BremRecoveryClusterAlgo.h:63
BremRecoveryClusterAlgo::match
bool match(reco::CaloClusterPtr seed_p, reco::CaloClusterPtr cluster_p, double etaRoad, double phiRoad)
Definition: BremRecoveryClusterAlgo.cc:95
BremRecoveryClusterAlgo::makeIslandSuperClusters
void makeIslandSuperClusters(reco::CaloClusterPtrVector &clusters_v, double etaRoad, double phiRoad)
Definition: BremRecoveryClusterAlgo.cc:36
Vector3D.h
CSCSegmentAlgorithmRU_cfi.dPhiMax
dPhiMax
Definition: CSCSegmentAlgorithmRU_cfi.py:10
CaloCluster.h