CMS 3D CMS Logo

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

#include <Multi5x5BremRecoveryClusterAlgo.h>

Public Member Functions

reco::SuperClusterCollection makeSuperClusters (const reco::CaloClusterPtrVector &clusters)
 
 Multi5x5BremRecoveryClusterAlgo (const edm::ParameterSet &bremRecoveryPset, 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, bool dynamicPhiRoad=true, double theSeedTransverseEnergyThreshold=0.40)
 
 ~Multi5x5BremRecoveryClusterAlgo ()
 

Private Member Functions

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

Private Attributes

bool dynamicPhiRoad_
 
double eb_rdeta_
 
double eb_rdphi_
 
double ec_rdeta_
 
double ec_rdphi_
 
BremRecoveryPhiRoadAlgophiRoadAlgo_
 
double seedTransverseEnergyThreshold
 
reco::SuperClusterCollection superclusters_v
 

Detailed Description

Definition at line 23 of file Multi5x5BremRecoveryClusterAlgo.h.

Constructor & Destructor Documentation

◆ Multi5x5BremRecoveryClusterAlgo()

Multi5x5BremRecoveryClusterAlgo::Multi5x5BremRecoveryClusterAlgo ( const edm::ParameterSet bremRecoveryPset,
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,
bool  dynamicPhiRoad = true,
double  theSeedTransverseEnergyThreshold = 0.40 
)
inline

Definition at line 25 of file Multi5x5BremRecoveryClusterAlgo.h.

References cosmicSuperClusters_cfi::bremRecoveryPset, cosmicSuperClusters_cfi::dynamicPhiRoad, dynamicPhiRoad_, eb_rdeta_, eb_rdphi_, ec_rdeta_, ec_rdphi_, phiRoadAlgo_, and seedTransverseEnergyThreshold.

31  {
32  // e*_rdeta_ and e*_rdphi_ are half the total window
33  // because they correspond to one direction (positive or negative)
34  eb_rdeta_ = eb_sc_road_etasize / 2;
35  eb_rdphi_ = eb_sc_road_phisize / 2;
36  ec_rdeta_ = ec_sc_road_etasize / 2;
37  ec_rdphi_ = ec_sc_road_phisize / 2;
38 
39  seedTransverseEnergyThreshold = theSeedTransverseEnergyThreshold;
41  if (dynamicPhiRoad_)
43  }

◆ ~Multi5x5BremRecoveryClusterAlgo()

Multi5x5BremRecoveryClusterAlgo::~Multi5x5BremRecoveryClusterAlgo ( )
inline

Definition at line 46 of file Multi5x5BremRecoveryClusterAlgo.h.

References dynamicPhiRoad_, and phiRoadAlgo_.

Member Function Documentation

◆ makeIslandSuperClusters()

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

Definition at line 35 of file Multi5x5BremRecoveryClusterAlgo.cc.

References funct::abs(), cms::cuda::assert(), edm::PtrVectorBase::clear(), Calorimetry_cff::dp, dynamicPhiRoad_, edm::PtrVectorBase::empty(), BremRecoveryPhiRoadAlgo::endcapPhiRoad(), HCALHighEnergyHPDFilter_cfi::energy, reco::CaloCluster::energy(), EgHLTOffHistBins_cfi::et, PVValHelper::eta, dqmMemoryStats::float, mps_fire::i, dqmiolumiharvest::j, LogTrace, M_PI, match(), LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, phi, phiRoadAlgo_, reco::CaloCluster::position(), position, edm::PtrVector< T >::push_back(), seedTransverseEnergyThreshold, funct::sin(), edm::PtrVectorBase::size(), superclusters_v, theta(), mitigatedMETSequence_cff::U, X, BeamSpotPI::Y, and BeamSpotPI::Z.

Referenced by makeSuperClusters().

37  {
38  if (clusters_v.empty())
39  return;
40 
41  const auto clustersSize = clusters_v.size();
42  assert(clustersSize > 0);
43 
44  bool usedSeed[clustersSize];
45  for (auto ic = 0U; ic < clustersSize; ++ic)
46  usedSeed[ic] = false;
47 
48  float eta[clustersSize], phi[clustersSize], et[clustersSize];
49  for (auto ic = 0U; ic < clustersSize; ++ic) {
50  eta[ic] = clusters_v[ic]->eta();
51  phi[ic] = clusters_v[ic]->phi();
52  et[ic] = clusters_v[ic]->energy() * sin(clusters_v[ic]->position().theta());
53  }
54 
55  for (auto is = 0U; is < clustersSize; ++is) {
56  // check this seed was not already used
57  if (usedSeed[is])
58  continue;
59  auto const& currentSeed = clusters_v[is];
60 
61  // Does our highest energy cluster have high enough energy?
62  // changed this to continue from break (to be robust against the order of sorting of the seed clusters)
64  continue;
65 
66  // if yes, make it a seed for a new SuperCluster:
67  double energy = (currentSeed)->energy();
68  math::XYZVector position_(
69  (currentSeed)->position().X(), (currentSeed)->position().Y(), (currentSeed)->position().Z());
70  position_ *= energy;
71  usedSeed[is] = true;
72 
73  LogTrace("EcalClusters") << "*****************************";
74  LogTrace("EcalClusters") << "******NEW SUPERCLUSTER*******";
75  LogTrace("EcalClusters") << "Seed R = " << (currentSeed)->position().Rho();
76 
77  reco::CaloClusterPtrVector constituentClusters;
78  constituentClusters.push_back(currentSeed);
79  auto ic = is + 1;
80 
81  while (ic < clustersSize) {
82  auto const& currentCluster = clusters_v[ic];
83 
84  // if dynamic phi road is enabled then compute the phi road for a cluster
85  // of energy of existing clusters + the candidate cluster.
86  if (dynamicPhiRoad_)
87  phiRoad = phiRoadAlgo_->endcapPhiRoad(energy + (currentCluster)->energy());
88 
89  auto dphi = [](float p1, float p2) {
90  auto dp = std::abs(p1 - p2);
91  if (dp > float(M_PI))
92  dp -= float(2 * M_PI);
93  return std::abs(dp);
94  };
95 
96  auto match = [&](int i, int j) {
97  return (dphi(phi[i], phi[j]) < phiRoad) && (std::abs(eta[i] - eta[j]) < etaRoad);
98  };
99 
100  // does the cluster match the phi road for this candidate supercluster
101  if (!usedSeed[ic] && match(is, ic)) {
102  // add basic cluster to supercluster constituents
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  // remove cluster from vector of available clusters
109  usedSeed[ic] = true;
110  LogTrace("EcalClusters") << "Cluster R = " << (currentCluster)->position().Rho();
111  }
112  ++ic;
113  }
114 
115  position_ /= energy;
116 
117  LogTrace("EcalClusters") << "Final SuperCluster R = " << position_.Rho();
118 
119  reco::SuperCluster newSuperCluster(
120  energy, math::XYZPoint(position_.X(), position_.Y(), position_.Z()), currentSeed, constituentClusters);
121 
122  superclusters_v.push_back(newSuperCluster);
123  LogTrace("EcalClusters") << "created a new supercluster of: ";
124  LogTrace("EcalClusters") << "Energy = " << newSuperCluster.energy();
125  LogTrace("EcalClusters") << "Position in (R, phi, theta) = (" << newSuperCluster.position().Rho() << ", "
126  << newSuperCluster.position().phi() << ", " << newSuperCluster.position().theta() << ")";
127  }
128 
129  clusters_v.clear();
130 }
size_type size() const
Size of the RefVector.
Definition: PtrVectorBase.h:75
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
#define X(str)
Definition: MuonsGrabber.cc:38
assert(be >=bs)
#define LogTrace(id)
bool empty() const
Is the RefVector empty.
Definition: PtrVectorBase.h:72
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI
reco::SuperClusterCollection superclusters_v
double endcapPhiRoad(double energy)
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
static int position[264][3]
Definition: ReadPGInfo.cc:289
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
Geom::Theta< T > theta() const

◆ makeSuperClusters()

reco::SuperClusterCollection Multi5x5BremRecoveryClusterAlgo::makeSuperClusters ( const reco::CaloClusterPtrVector clusters)

Definition at line 5 of file Multi5x5BremRecoveryClusterAlgo.cc.

References eb_rdeta_, eb_rdphi_, ec_rdeta_, ec_rdphi_, makeIslandSuperClusters(), reco::CaloCluster::multi5x5, edm::PtrVector< T >::push_back(), and superclusters_v.

6  {
7  const float etaBorder = 1.479;
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 (auto const& cluster_p : clustersCollection) {
16  if (cluster_p->algo() == reco::CaloCluster::multi5x5) {
17  if (fabs(cluster_p->position().eta()) < etaBorder) {
18  islandClustersBarrel_v.push_back(cluster_p);
19  } else {
20  islandClustersEndCap_v.push_back(cluster_p);
21  }
22  }
23  }
24 
25  // make the superclusters from the Barrel clusters - Island
26  makeIslandSuperClusters(islandClustersBarrel_v, eb_rdeta_, eb_rdphi_);
27  // make the superclusters from the EndCap clusters - Island
28  makeIslandSuperClusters(islandClustersEndCap_v, ec_rdeta_, ec_rdphi_);
29 
30  return superclusters_v;
31 }
void makeIslandSuperClusters(reco::CaloClusterPtrVector &clusters_v, double etaRoad, double phiRoad)
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
reco::SuperClusterCollection superclusters_v

Member Data Documentation

◆ dynamicPhiRoad_

bool Multi5x5BremRecoveryClusterAlgo::dynamicPhiRoad_
private

◆ eb_rdeta_

double Multi5x5BremRecoveryClusterAlgo::eb_rdeta_
private

◆ eb_rdphi_

double Multi5x5BremRecoveryClusterAlgo::eb_rdphi_
private

◆ ec_rdeta_

double Multi5x5BremRecoveryClusterAlgo::ec_rdeta_
private

◆ ec_rdphi_

double Multi5x5BremRecoveryClusterAlgo::ec_rdphi_
private

◆ phiRoadAlgo_

BremRecoveryPhiRoadAlgo* Multi5x5BremRecoveryClusterAlgo::phiRoadAlgo_
private

◆ seedTransverseEnergyThreshold

double Multi5x5BremRecoveryClusterAlgo::seedTransverseEnergyThreshold
private

◆ superclusters_v

reco::SuperClusterCollection Multi5x5BremRecoveryClusterAlgo::superclusters_v
private

Definition at line 67 of file Multi5x5BremRecoveryClusterAlgo.h.

Referenced by makeIslandSuperClusters(), and makeSuperClusters().