CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HiBremRecoveryClusterAlgo Class Reference

#include <HiBremRecoveryClusterAlgo.h>

Public Types

enum  VerbosityLevel { pDEBUG = 0, pWARNING = 1, pINFO = 2, pERROR = 3 }
 

Public Member Functions

 HiBremRecoveryClusterAlgo (double eb_sc_road_etasize=0.06, double eb_sc_road_phisize=0.80, double ec_sc_road_etasize=0.14, double ec_sc_road_phisize=0.40, double theSeedTransverseEnergyThreshold=0.40, double theBarrelBremEnergyThreshold=2.3, double theEndcapBremEnergyThreshold=5.7, VerbosityLevel the_verbosity=pERROR)
 
reco::SuperClusterCollection makeSuperClusters (reco::CaloClusterPtrVector &clusters)
 
void setVerbosity (VerbosityLevel the_verbosity)
 

Private Member Functions

void makeIslandSuperClusters (reco::CaloClusterPtrVector &clusters_v, double etaRoad, double phiRoad)
 
bool match (reco::CaloClusterPtr seed_p, reco::CaloClusterPtr cluster_p, double etaRoad, double phiRoad)
 

Private Attributes

double BarrelBremEnergyThreshold
 
double eb_rdeta_
 
double eb_rdphi_
 
double ec_rdeta_
 
double ec_rdphi_
 
double EndcapBremEnergyThreshold
 
double seedTransverseEnergyThreshold
 
reco::SuperClusterCollection superclusters_v
 
VerbosityLevel verbosity
 

Detailed Description

Definition at line 21 of file HiBremRecoveryClusterAlgo.h.

Member Enumeration Documentation

◆ VerbosityLevel

Constructor & Destructor Documentation

◆ HiBremRecoveryClusterAlgo()

HiBremRecoveryClusterAlgo::HiBremRecoveryClusterAlgo ( double  eb_sc_road_etasize = 0.06,
double  eb_sc_road_phisize = 0.80,
double  ec_sc_road_etasize = 0.14,
double  ec_sc_road_phisize = 0.40,
double  theSeedTransverseEnergyThreshold = 0.40,
double  theBarrelBremEnergyThreshold = 2.3,
double  theEndcapBremEnergyThreshold = 5.7,
VerbosityLevel  the_verbosity = pERROR 
)
inline

Definition at line 25 of file HiBremRecoveryClusterAlgo.h.

References BarrelBremEnergyThreshold, eb_rdeta_, eb_rdphi_, ec_rdeta_, ec_rdphi_, EndcapBremEnergyThreshold, seedTransverseEnergyThreshold, and verbosity.

32  {
33  // e*_rdeta_ and e*_rdphi_ are half the total window
34  // because they correspond to one direction (positive or negative)
35  eb_rdeta_ = eb_sc_road_etasize / 2;
36  eb_rdphi_ = eb_sc_road_phisize / 2;
37  ec_rdeta_ = ec_sc_road_etasize / 2;
38  ec_rdphi_ = ec_sc_road_phisize / 2;
39 
40  seedTransverseEnergyThreshold = theSeedTransverseEnergyThreshold;
41  BarrelBremEnergyThreshold = theBarrelBremEnergyThreshold;
42  EndcapBremEnergyThreshold = theEndcapBremEnergyThreshold;
43  verbosity = the_verbosity;
44  }

Member Function Documentation

◆ makeIslandSuperClusters()

void HiBremRecoveryClusterAlgo::makeIslandSuperClusters ( reco::CaloClusterPtrVector clusters_v,
double  etaRoad,
double  phiRoad 
)
private

Definition at line 44 of file HiBremRecoveryClusterAlgo.cc.

References edm::PtrVector< T >::begin(), edm::PtrVectorBase::clear(), gather_cfg::cout, edm::PtrVector< T >::end(), spr::find(), match(), pINFO, edm::PtrVector< T >::push_back(), seedTransverseEnergyThreshold, funct::sin(), superclusters_v, and verbosity.

Referenced by makeSuperClusters().

46  {
47  // Vector of usedSeedEnergy, use the seed energy to check if this cluster is used.
48  std::vector<double> usedSeedEnergy;
49  usedSeedEnergy.clear();
50 
51  // Main brem recovery loop
52  for (reco::CaloCluster_iterator currentSeed = clusters_v.begin(); currentSeed != clusters_v.end(); ++currentSeed) {
53  if (verbosity <= pINFO) {
54  std::cout << "Current Cluster: " << (*currentSeed)->energy() << " "
55  << (std::find(usedSeedEnergy.begin(), usedSeedEnergy.end(), (*currentSeed)->energy()) !=
56  usedSeedEnergy.end())
57  << std::endl;
58  }
59 
60  // check this seed was not already used
61  if (std::find(usedSeedEnergy.begin(), usedSeedEnergy.end(), (*currentSeed)->energy()) != usedSeedEnergy.end())
62  continue;
63 
64  // Does our highest energy cluster have high enough energy? If not, continue instead of break to be robust
65  if ((*currentSeed)->energy() * sin((*currentSeed)->position().theta()) < seedTransverseEnergyThreshold)
66  continue;
67 
68  // if yes, make it a seed for a new SuperCluster, the position of the SC is calculated by energy weighted sum:
69  double energy_ = (*currentSeed)->energy();
70  math::XYZVector position_(
71  (*currentSeed)->position().X(), (*currentSeed)->position().Y(), (*currentSeed)->position().Z());
72  position_ *= energy_;
73  usedSeedEnergy.push_back((*currentSeed)->energy());
74 
75  // Printout if verbose
76  if (verbosity <= pINFO) {
77  std::cout << "*****************************" << std::endl;
78  std::cout << "******NEW SUPERCLUSTER*******" << std::endl;
79  std::cout << "Seed R = " << (*currentSeed)->position().Rho() << std::endl;
80  std::cout << "Seed Et = " << (*currentSeed)->energy() * sin((*currentSeed)->position().theta()) << std::endl;
81  }
82 
83  // and add the matching clusters:
84  reco::CaloClusterPtrVector constituentClusters;
85  constituentClusters.push_back(*currentSeed);
86  reco::CaloCluster_iterator currentCluster = currentSeed + 1;
87 
88  // loop over the clusters
89  while (currentCluster != clusters_v.end()) {
90  // Print out the basic clusters
91  if (verbosity <= pINFO) {
92  std::cout << "->Cluster: " << (*currentCluster)->energy() << " Used = "
93  << (std::find(usedSeedEnergy.begin(), usedSeedEnergy.end(), (*currentCluster)->energy()) !=
94  usedSeedEnergy.end())
95  << " Matched = " << match(*currentSeed, *currentCluster, etaRoad, phiRoad) << std::endl;
96  }
97 
98  // if it's in the search window, and unused
99  if (match(*currentSeed, *currentCluster, etaRoad, phiRoad) &&
100  (std::find(usedSeedEnergy.begin(), usedSeedEnergy.end(), (*currentCluster)->energy()) ==
101  usedSeedEnergy.end())) {
102  // Add basic cluster
103  constituentClusters.push_back(*currentCluster);
104  energy_ += (*currentCluster)->energy();
105  position_ += (*currentCluster)->energy() * math::XYZVector((*currentCluster)->position().X(),
106  (*currentCluster)->position().Y(),
107  (*currentCluster)->position().Z());
108  // Add the cluster to the used list
109  usedSeedEnergy.push_back((*currentCluster)->energy());
110 
111  if (verbosity <= pINFO) {
112  std::cout << "Cluster R = " << (*currentCluster)->position().Rho() << std::endl;
113  }
114  }
115  ++currentCluster;
116  }
117 
118  // Calculate the final position
119  position_ /= energy_;
120 
121  if (verbosity <= pINFO) {
122  std::cout << "Final SuperCluster R = " << position_.Rho() << std::endl;
123  }
124 
125  // Add the supercluster to the new collection
126  reco::SuperCluster newSuperCluster(
127  energy_, math::XYZPoint(position_.X(), position_.Y(), position_.Z()), (*currentSeed), constituentClusters);
128 
129  superclusters_v.push_back(newSuperCluster);
130 
131  if (verbosity <= pINFO) {
132  std::cout << "created a new supercluster of: " << std::endl;
133  std::cout << "Energy = " << newSuperCluster.energy() << std::endl;
134  std::cout << "Position in (R, phi, theta, eta) = (" << newSuperCluster.position().Rho() << ", "
135  << newSuperCluster.position().phi() << ", " << newSuperCluster.position().theta() << ", "
136  << newSuperCluster.position().eta() << ")" << std::endl;
137  }
138  }
139  clusters_v.clear();
140  usedSeedEnergy.clear();
141 }
bool match(reco::CaloClusterPtr seed_p, reco::CaloClusterPtr cluster_p, double etaRoad, double phiRoad)
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const_iterator end() const
Definition: PtrVector.h:146
reco::SuperClusterCollection superclusters_v
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

◆ makeSuperClusters()

reco::SuperClusterCollection HiBremRecoveryClusterAlgo::makeSuperClusters ( reco::CaloClusterPtrVector clusters)

Definition at line 5 of file HiBremRecoveryClusterAlgo.cc.

References BarrelBremEnergyThreshold, edm::PtrVector< T >::begin(), gather_cfg::cout, eb_rdeta_, eb_rdphi_, ec_rdeta_, ec_rdphi_, edm::PtrVector< T >::end(), EndcapBremEnergyThreshold, reco::CaloCluster::island, makeIslandSuperClusters(), pINFO, edm::PtrVector< T >::push_back(), superclusters_v, and verbosity.

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  reco::CaloClusterPtr cluster_p = *it;
18  if (cluster_p->algo() == reco::CaloCluster::island) {
19  if (verbosity <= pINFO) {
20  std::cout << "Basic Cluster: (eta,phi,energy) = " << cluster_p->position().eta() << " "
21  << cluster_p->position().phi() << " " << cluster_p->energy() << std::endl;
22  }
23 
24  // if the basic cluster pass the energy threshold -> fill it into the list
25  if (fabs(cluster_p->position().eta()) < etaBorder) {
26  if (cluster_p->energy() > BarrelBremEnergyThreshold)
27  islandClustersBarrel_v.push_back(cluster_p);
28  } else {
29  if (cluster_p->energy() > EndcapBremEnergyThreshold)
30  islandClustersEndCap_v.push_back(cluster_p);
31  }
32  }
33  }
34 
35  // make the superclusters from the Barrel clusters - Island
36  makeIslandSuperClusters(islandClustersBarrel_v, eb_rdeta_, eb_rdphi_);
37 
38  // make the superclusters from the EndCap clusters - Island
39  makeIslandSuperClusters(islandClustersEndCap_v, ec_rdeta_, ec_rdphi_);
40 
41  return superclusters_v;
42 }
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
reco::SuperClusterCollection superclusters_v
void makeIslandSuperClusters(reco::CaloClusterPtrVector &clusters_v, double etaRoad, double phiRoad)

◆ match()

bool HiBremRecoveryClusterAlgo::match ( reco::CaloClusterPtr  seed_p,
reco::CaloClusterPtr  cluster_p,
double  etaRoad,
double  phiRoad 
)
private

Definition at line 143 of file HiBremRecoveryClusterAlgo.cc.

References funct::cos(), gather_cfg::cout, HLT_2022v14_cff::dEta, photonValidator_cfi::dEtaMax, HLT_2022v14_cff::dPhi, HLT_2022v14_cff::dPhiMax, pINFO, and verbosity.

Referenced by makeIslandSuperClusters().

146  {
147  math::XYZPoint clusterPosition = cluster_p->position();
148  math::XYZPoint seedPosition = seed_p->position();
149 
150  double dPhi = acos(cos(seedPosition.phi() - clusterPosition.phi()));
151 
152  double dEta = fabs(seedPosition.eta() - clusterPosition.eta());
153  if (verbosity <= pINFO) {
154  std::cout << "seed phi: " << seedPosition.phi() << " cluster phi: " << clusterPosition.phi() << " dphi = " << dPhi
155  << " dphiMax = " << dPhiMax << std::endl;
156  std::cout << "seed eta: " << seedPosition.eta() << " cluster eta: " << clusterPosition.eta() << " deta = " << dEta
157  << " detaMax = " << dEtaMax << std::endl;
158  }
159  if (dEta > dEtaMax)
160  return false;
161  if (dPhi > dPhiMax)
162  return false;
163 
164  return true;
165 }
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12

◆ setVerbosity()

void HiBremRecoveryClusterAlgo::setVerbosity ( VerbosityLevel  the_verbosity)
inline

Definition at line 46 of file HiBremRecoveryClusterAlgo.h.

References verbosity.

46 { verbosity = the_verbosity; }

Member Data Documentation

◆ BarrelBremEnergyThreshold

double HiBremRecoveryClusterAlgo::BarrelBremEnergyThreshold
private

Definition at line 68 of file HiBremRecoveryClusterAlgo.h.

Referenced by HiBremRecoveryClusterAlgo(), and makeSuperClusters().

◆ eb_rdeta_

double HiBremRecoveryClusterAlgo::eb_rdeta_
private

Definition at line 60 of file HiBremRecoveryClusterAlgo.h.

Referenced by HiBremRecoveryClusterAlgo(), and makeSuperClusters().

◆ eb_rdphi_

double HiBremRecoveryClusterAlgo::eb_rdphi_
private

Definition at line 61 of file HiBremRecoveryClusterAlgo.h.

Referenced by HiBremRecoveryClusterAlgo(), and makeSuperClusters().

◆ ec_rdeta_

double HiBremRecoveryClusterAlgo::ec_rdeta_
private

Definition at line 62 of file HiBremRecoveryClusterAlgo.h.

Referenced by HiBremRecoveryClusterAlgo(), and makeSuperClusters().

◆ ec_rdphi_

double HiBremRecoveryClusterAlgo::ec_rdphi_
private

Definition at line 63 of file HiBremRecoveryClusterAlgo.h.

Referenced by HiBremRecoveryClusterAlgo(), and makeSuperClusters().

◆ EndcapBremEnergyThreshold

double HiBremRecoveryClusterAlgo::EndcapBremEnergyThreshold
private

Definition at line 69 of file HiBremRecoveryClusterAlgo.h.

Referenced by HiBremRecoveryClusterAlgo(), and makeSuperClusters().

◆ seedTransverseEnergyThreshold

double HiBremRecoveryClusterAlgo::seedTransverseEnergyThreshold
private

◆ superclusters_v

reco::SuperClusterCollection HiBremRecoveryClusterAlgo::superclusters_v
private

Definition at line 71 of file HiBremRecoveryClusterAlgo.h.

Referenced by makeIslandSuperClusters(), and makeSuperClusters().

◆ verbosity

VerbosityLevel HiBremRecoveryClusterAlgo::verbosity
private