CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
Multi5x5BremRecoveryClusterAlgo Class Reference

#include <Multi5x5BremRecoveryClusterAlgo.h>

Public Member Functions

reco::SuperClusterCollection makeSuperClusters (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)
 
bool match (reco::CaloClusterPtr seed_p, reco::CaloClusterPtr cluster_p, 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 24 of file Multi5x5BremRecoveryClusterAlgo.h.

Constructor & Destructor Documentation

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 29 of file Multi5x5BremRecoveryClusterAlgo.h.

References dynamicPhiRoad_, eb_rdeta_, eb_rdphi_, ec_rdeta_, ec_rdphi_, phiRoadAlgo_, and seedTransverseEnergyThreshold.

37  {
38  // e*_rdeta_ and e*_rdphi_ are half the total window
39  // because they correspond to one direction (positive or negative)
40  eb_rdeta_ = eb_sc_road_etasize / 2;
41  eb_rdphi_ = eb_sc_road_phisize / 2;
42  ec_rdeta_ = ec_sc_road_etasize / 2;
43  ec_rdphi_ = ec_sc_road_phisize / 2;
44 
45  seedTransverseEnergyThreshold = theSeedTransverseEnergyThreshold;
46  dynamicPhiRoad_ = dynamicPhiRoad;
47  if (dynamicPhiRoad_) phiRoadAlgo_ = new BremRecoveryPhiRoadAlgo(bremRecoveryPset);
48 
49  }
Multi5x5BremRecoveryClusterAlgo::~Multi5x5BremRecoveryClusterAlgo ( )
inline

Member Function Documentation

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

Definition at line 42 of file Multi5x5BremRecoveryClusterAlgo.cc.

References edm::PtrVector< T >::begin(), edm::PtrVectorBase::clear(), dynamicPhiRoad_, edm::PtrVector< T >::end(), BremRecoveryPhiRoadAlgo::endcapPhiRoad(), relval_parameters_module::energy, spr::find(), LogTrace, match(), phiRoadAlgo_, edm::PtrVector< T >::push_back(), seedTransverseEnergyThreshold, funct::sin(), and superclusters_v.

Referenced by makeSuperClusters().

44 {
45 
46  std::vector<DetId> usedSeedDetIds;
47  usedSeedDetIds.clear();
48 
49  for (reco::CaloCluster_iterator currentSeed = clusters_v.begin(); currentSeed != clusters_v.end(); ++currentSeed)
50  {
51 
52  // check this seed was not already used
53  if (std::find(usedSeedDetIds.begin(), usedSeedDetIds.end(), (*currentSeed)->seed())
54  != usedSeedDetIds.end()) continue;
55 
56  // Does our highest energy cluster have high enough energy?
57  // changed this to continue from break (to be robust against the order of sorting of the seed clusters)
58  if ((*currentSeed)->energy() * sin((*currentSeed)->position().theta()) < seedTransverseEnergyThreshold) continue;
59 
60  // if yes, make it a seed for a new SuperCluster:
61  double energy = (*currentSeed)->energy();
62  math::XYZVector position_((*currentSeed)->position().X(),
63  (*currentSeed)->position().Y(),
64  (*currentSeed)->position().Z());
65  position_ *= energy;
66  usedSeedDetIds.push_back((*currentSeed)->seed());
67 
68 LogTrace("EcalClusters") << "*****************************";
69 LogTrace("EcalClusters") << "******NEW SUPERCLUSTER*******";
70 LogTrace("EcalClusters") << "Seed R = " << (*currentSeed)->position().Rho();
71 
72  reco::CaloClusterPtrVector constituentClusters;
73  constituentClusters.push_back(*currentSeed);
74  reco::CaloCluster_iterator currentCluster = currentSeed + 1;
75 
76  while (currentCluster != clusters_v.end())
77  {
78 
79  // if dynamic phi road is enabled then compute the phi road for a cluster
80  // of energy of existing clusters + the candidate cluster.
81  if (dynamicPhiRoad_)
82  phiRoad = phiRoadAlgo_->endcapPhiRoad(energy + (*currentCluster)->energy());
83 
84  // does the cluster match the phi road for this candidate supercluster
85  if (match(*currentSeed, *currentCluster, etaRoad, phiRoad) &&
86  std::find(usedSeedDetIds.begin(), usedSeedDetIds.end(), (*currentCluster)->seed()) == usedSeedDetIds.end())
87  {
88 
89  // add basic cluster to supercluster constituents
90  constituentClusters.push_back(*currentCluster);
91  energy += (*currentCluster)->energy();
92  position_ += (*currentCluster)->energy() * math::XYZVector((*currentCluster)->position().X(),
93  (*currentCluster)->position().Y(),
94  (*currentCluster)->position().Z());
95 
96  // remove cluster from vector of available clusters
97  usedSeedDetIds.push_back((*currentCluster)->seed());
98 LogTrace("EcalClusters") << "Cluster R = " << (*currentCluster)->position().Rho();
99  }
100  ++currentCluster;
101 
102  }
103 
104  position_ /= energy;
105 
106 LogTrace("EcalClusters") <<"Final SuperCluster R = " << position_.Rho();
107 
108  reco::SuperCluster newSuperCluster(energy,
109  math::XYZPoint(position_.X(), position_.Y(), position_.Z()),
110  (*currentSeed),
111  constituentClusters);
112 
113  superclusters_v.push_back(newSuperCluster);
114 LogTrace("EcalClusters") << "created a new supercluster of: ";
115 LogTrace("EcalClusters") << "Energy = " << newSuperCluster.energy();
116 LogTrace("EcalClusters") << "Position in (R, phi, theta) = ("
117  << newSuperCluster.position().Rho() << ", "
118  << newSuperCluster.position().phi() << ", "
119  << newSuperCluster.position().theta() << ")" ;
120 
121 
122  }
123 
124  clusters_v.clear();
125 
126 }
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:137
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:7
const_iterator begin() const
Definition: PtrVector.h:126
const_iterator end() const
Definition: PtrVector.h:131
#define LogTrace(id)
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:13
void clear()
Clear the PtrVector.
Definition: PtrVectorBase.h:79
bool match(reco::CaloClusterPtr seed_p, reco::CaloClusterPtr cluster_p, double etaRoad, double phiRoad)
reco::SuperClusterCollection Multi5x5BremRecoveryClusterAlgo::makeSuperClusters ( reco::CaloClusterPtrVector clusters)

Definition at line 5 of file Multi5x5BremRecoveryClusterAlgo.cc.

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

Referenced by Multi5x5SuperClusterProducer::produceSuperclustersForECALPart().

6 {
7 
8  const float etaBorder = 1.479;
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::multi5x5)
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 }
void makeIslandSuperClusters(reco::CaloClusterPtrVector &clusters_v, double etaRoad, double phiRoad)
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:137
reco::SuperClusterCollection superclusters_v
bool Multi5x5BremRecoveryClusterAlgo::match ( reco::CaloClusterPtr  seed_p,
reco::CaloClusterPtr  cluster_p,
double  etaRoad,
double  phiRoad 
)
private

Definition at line 129 of file Multi5x5BremRecoveryClusterAlgo.cc.

References funct::cos(), and dPhi().

Referenced by makeIslandSuperClusters().

132 {
133  math::XYZPoint clusterPosition = cluster_p->position();
134  math::XYZPoint seedPosition = seed_p->position();
135 
136  double dPhi = acos(cos(seedPosition.phi() - clusterPosition.phi()));
137 
138  double dEta = fabs(seedPosition.eta() - clusterPosition.eta());
139 
140  if (dEta > dEtaMax) return false;
141  if (dPhi > dPhiMax) return false;
142 
143  return true;
144 }
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13

Member Data Documentation

bool Multi5x5BremRecoveryClusterAlgo::dynamicPhiRoad_
private
double Multi5x5BremRecoveryClusterAlgo::eb_rdeta_
private
double Multi5x5BremRecoveryClusterAlgo::eb_rdphi_
private
double Multi5x5BremRecoveryClusterAlgo::ec_rdeta_
private
double Multi5x5BremRecoveryClusterAlgo::ec_rdphi_
private
BremRecoveryPhiRoadAlgo* Multi5x5BremRecoveryClusterAlgo::phiRoadAlgo_
private
double Multi5x5BremRecoveryClusterAlgo::seedTransverseEnergyThreshold
private
reco::SuperClusterCollection Multi5x5BremRecoveryClusterAlgo::superclusters_v
private

Definition at line 83 of file Multi5x5BremRecoveryClusterAlgo.h.

Referenced by makeIslandSuperClusters(), and makeSuperClusters().