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 22 of file HiBremRecoveryClusterAlgo.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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 28 of file HiBremRecoveryClusterAlgo.h.

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

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  BarrelBremEnergyThreshold = theBarrelBremEnergyThreshold;
47  EndcapBremEnergyThreshold = theEndcapBremEnergyThreshold;
48  verbosity = the_verbosity;
49  }

Member Function Documentation

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

Definition at line 47 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(), and setVerbosity().

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

Referenced by HiSuperClusterProducer::produceSuperclustersForECALPart(), and setVerbosity().

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

Definition at line 155 of file HiBremRecoveryClusterAlgo.cc.

References funct::cos(), gather_cfg::cout, dPhi(), pINFO, and verbosity.

Referenced by makeIslandSuperClusters(), and setVerbosity().

158 {
159  math::XYZPoint clusterPosition = cluster_p->position();
160  math::XYZPoint seedPosition = seed_p->position();
161 
162  double dPhi = acos(cos(seedPosition.phi() - clusterPosition.phi()));
163 
164  double dEta = fabs(seedPosition.eta() - clusterPosition.eta());
165  if (verbosity <= pINFO) {
166  std::cout <<"seed phi: "<<seedPosition.phi()<<" cluster phi: "<<clusterPosition.phi()<<" dphi = "<<dPhi<<" dphiMax = "<<dPhiMax<<std::endl;
167  std::cout <<"seed eta: "<<seedPosition.eta()<<" cluster eta: "<<clusterPosition.eta()<<" deta = "<<dEta<<" detaMax = "<<dEtaMax<<std::endl;
168  }
169  if (dEta > dEtaMax) return false;
170  if (dPhi > dPhiMax) return false;
171 
172  return true;
173 }
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:12
void HiBremRecoveryClusterAlgo::setVerbosity ( VerbosityLevel  the_verbosity)
inline

Member Data Documentation

double HiBremRecoveryClusterAlgo::BarrelBremEnergyThreshold
private

Definition at line 80 of file HiBremRecoveryClusterAlgo.h.

Referenced by HiBremRecoveryClusterAlgo(), and makeSuperClusters().

double HiBremRecoveryClusterAlgo::eb_rdeta_
private

Definition at line 72 of file HiBremRecoveryClusterAlgo.h.

Referenced by HiBremRecoveryClusterAlgo(), and makeSuperClusters().

double HiBremRecoveryClusterAlgo::eb_rdphi_
private

Definition at line 73 of file HiBremRecoveryClusterAlgo.h.

Referenced by HiBremRecoveryClusterAlgo(), and makeSuperClusters().

double HiBremRecoveryClusterAlgo::ec_rdeta_
private

Definition at line 74 of file HiBremRecoveryClusterAlgo.h.

Referenced by HiBremRecoveryClusterAlgo(), and makeSuperClusters().

double HiBremRecoveryClusterAlgo::ec_rdphi_
private

Definition at line 75 of file HiBremRecoveryClusterAlgo.h.

Referenced by HiBremRecoveryClusterAlgo(), and makeSuperClusters().

double HiBremRecoveryClusterAlgo::EndcapBremEnergyThreshold
private

Definition at line 81 of file HiBremRecoveryClusterAlgo.h.

Referenced by HiBremRecoveryClusterAlgo(), and makeSuperClusters().

double HiBremRecoveryClusterAlgo::seedTransverseEnergyThreshold
private
reco::SuperClusterCollection HiBremRecoveryClusterAlgo::superclusters_v
private

Definition at line 83 of file HiBremRecoveryClusterAlgo.h.

Referenced by makeIslandSuperClusters(), and makeSuperClusters().

VerbosityLevel HiBremRecoveryClusterAlgo::verbosity
private