CMS 3D CMS Logo

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

#include <Multi5x5BremRecoveryClusterAlgo.h>

Public Types

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

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, VerbosityLevel the_verbosity=pERROR)
 
void setVerbosity (VerbosityLevel the_verbosity)
 
 ~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
 
VerbosityLevel verbosity
 

Detailed Description

Definition at line 24 of file Multi5x5BremRecoveryClusterAlgo.h.

Member Enumeration Documentation

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,
VerbosityLevel  the_verbosity = pERROR 
)
inline

Definition at line 30 of file Multi5x5BremRecoveryClusterAlgo.h.

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

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

Member Function Documentation

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

Definition at line 41 of file Multi5x5BremRecoveryClusterAlgo.cc.

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

Referenced by makeSuperClusters().

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

Definition at line 4 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().

5 {
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 (reco::CaloCluster_iterator it = clustersCollection.begin(); it != clustersCollection.end(); it++)
16  {
17  reco::CaloClusterPtr cluster_p = *it;
18  if (cluster_p->algo() == reco::CaloCluster::multi5x5)
19  {
20  if (fabs(cluster_p->position().eta()) < etaBorder)
21  {
22  islandClustersBarrel_v.push_back(cluster_p);
23  }
24  else
25  {
26  islandClustersEndCap_v.push_back(cluster_p);
27  }
28  }
29  }
30 
31  // make the superclusters from the Barrel clusters - Island
32  makeIslandSuperClusters(islandClustersBarrel_v, eb_rdeta_, eb_rdphi_);
33  // make the superclusters from the EndCap clusters - Island
34  makeIslandSuperClusters(islandClustersEndCap_v, ec_rdeta_, ec_rdphi_);
35 
36  return superclusters_v;
37 }
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 138 of file Multi5x5BremRecoveryClusterAlgo.cc.

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

Referenced by makeIslandSuperClusters().

141 {
142  math::XYZPoint clusterPosition = cluster_p->position();
143  math::XYZPoint seedPosition = seed_p->position();
144 
145  double dPhi = acos(cos(seedPosition.phi() - clusterPosition.phi()));
146 
147  double dEta = fabs(seedPosition.eta() - clusterPosition.eta());
148 
149  if (dEta > dEtaMax) return false;
150  if (dPhi > dPhiMax) return false;
151 
152  return true;
153 }
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
void Multi5x5BremRecoveryClusterAlgo::setVerbosity ( VerbosityLevel  the_verbosity)
inline

Definition at line 60 of file Multi5x5BremRecoveryClusterAlgo.h.

References verbosity.

61  {
62  verbosity = the_verbosity;
63  }

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

Referenced by makeIslandSuperClusters(), and makeSuperClusters().

VerbosityLevel Multi5x5BremRecoveryClusterAlgo::verbosity
private