CMS 3D CMS Logo

SuperClusterShapeAlgo.cc
Go to the documentation of this file.
1 #include <iostream>
2 
9 
13 
15  : recHits_(hits), geometry_(geo) {}
16 
18  double numeratorEtaWidth = 0;
19  double numeratorPhiWidth = 0;
20 
21  double scEnergy = passedCluster.energy();
22  double denominator = scEnergy;
23 
24  double scEta = passedCluster.position().eta();
25  double scPhi = passedCluster.position().phi();
26 
27  const std::vector<std::pair<DetId, float> >& detId = passedCluster.hitsAndFractions();
28  // Loop over recHits associated with the given SuperCluster
29  for (std::vector<std::pair<DetId, float> >::const_iterator hit = detId.begin(); hit != detId.end(); ++hit) {
31  //FIXME: THIS IS JUST A WORKAROUND A FIX SHOULD BE APPLIED
32  if (rHit == recHits_->end()) {
33  continue;
34  }
35  auto this_cell = geometry_->getGeometry(rHit->id());
36  if (this_cell == nullptr) {
37  //edm::LogInfo("SuperClusterShapeAlgo") << "pointer to the cell in Calculate_Covariances is NULL!";
38  continue;
39  }
40  GlobalPoint position = this_cell->getPosition();
41  //take into account energy fractions
42  double energyHit = rHit->energy() * hit->second;
43 
44  //form differences
45  double dPhi = position.phi() - scPhi;
46  if (dPhi > +Geom::pi()) {
47  dPhi = Geom::twoPi() - dPhi;
48  }
49  if (dPhi < -Geom::pi()) {
50  dPhi = Geom::twoPi() + dPhi;
51  }
52 
53  double dEta = position.eta() - scEta;
54 
55  if (energyHit > 0) {
56  numeratorEtaWidth += energyHit * dEta * dEta;
57  numeratorPhiWidth += energyHit * dPhi * dPhi;
58  }
59 
60  etaWidth_ = sqrt(numeratorEtaWidth / denominator);
61  phiWidth_ = sqrt(numeratorPhiWidth / denominator);
62  }
63 }
EcalPreshowerTopology.h
EcalBarrelGeometry.h
edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
reco::SuperCluster
Definition: SuperCluster.h:18
SuperClusterShapeAlgo::phiWidth_
double phiWidth_
Definition: SuperClusterShapeAlgo.h:40
EcalBarrelTopology.h
edm::SortedCollection< EcalRecHit >
HLT_FULL_cff.dPhi
dPhi
Definition: HLT_FULL_cff.py:13695
SuperClusterShapeAlgo::recHits_
const EcalRecHitCollection * recHits_
Definition: SuperClusterShapeAlgo.h:37
SuperClusterShapeAlgo.h
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
SuperClusterShapeAlgo::SuperClusterShapeAlgo
SuperClusterShapeAlgo(const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry)
Definition: SuperClusterShapeAlgo.cc:14
Geom::pi
constexpr double pi()
Definition: Pi.h:31
Geom::twoPi
constexpr double twoPi()
Definition: Pi.h:32
Point3DBase< float, GlobalTag >
EcalSubdetector.h
reco::CaloCluster::hitsAndFractions
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
EcalEndcapTopology.h
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
SuperClusterShapeAlgo::etaWidth_
double etaWidth_
Definition: SuperClusterShapeAlgo.h:40
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
CaloSubdetectorGeometry::getGeometry
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
Definition: CaloSubdetectorGeometry.cc:36
reco::CaloCluster::position
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
edm::SortedCollection::find
iterator find(key_type k)
Definition: SortedCollection.h:240
HLTTauDQMOffline_cfi.denominator
denominator
Definition: HLTTauDQMOffline_cfi.py:180
CaloCellGeometry.h
HLT_FULL_cff.dEta
dEta
Definition: HLT_FULL_cff.py:13694
SuperClusterShapeAlgo::geometry_
const CaloSubdetectorGeometry * geometry_
Definition: SuperClusterShapeAlgo.h:38
Point3D.h
SuperClusterShapeAlgo::Calculate_Covariances
void Calculate_Covariances(const reco::SuperCluster &passedCluster)
Definition: SuperClusterShapeAlgo.cc:17
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
Vector3D.h
reco::CaloCluster::energy
double energy() const
cluster energy
Definition: CaloCluster.h:149
hit
Definition: SiStripHitEffFromCalibTree.cc:88