CMS 3D CMS Logo

List of all members | Static Public Member Functions
EcalClusterSeverityLevelAlgo Class Reference

#include <EcalClusterSeverityLevelAlgo.h>

Static Public Member Functions

static DetId closestProblematic (const reco::CaloCluster &, const EcalRecHitCollection &, const CaloTopology *topology, const EcalSeverityLevelAlgo &)
 
static std::pair< int, int > etaphiDistanceClosestProblematic (const reco::CaloCluster &, const EcalRecHitCollection &, const CaloTopology *topology, const EcalSeverityLevelAlgo &)
 
static float fractionAroundClosestProblematic (const reco::CaloCluster &, const EcalRecHitCollection &, const CaloTopology *topology, const EcalSeverityLevelAlgo &)
 
static float goodFraction (const reco::CaloCluster &, const EcalRecHitCollection &, const EcalSeverityLevelAlgo &)
 

Detailed Description

Definition at line 14 of file EcalClusterSeverityLevelAlgo.h.

Member Function Documentation

DetId EcalClusterSeverityLevelAlgo::closestProblematic ( const reco::CaloCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
const EcalSeverityLevelAlgo sevlv 
)
static

Definition at line 75 of file EcalClusterSeverityLevelAlgo.cc.

References DetId::det(), EBDetId::distanceEta(), EBDetId::distancePhi(), DetId::Ecal, EcalBarrel, edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), CaloTopology::getWindow(), EcalSeverityLevel::kGood, alignCSCRings::r, SurveyInfoScenario_cff::seed, EcalSeverityLevelAlgo::severityLevel(), mathSSE::sqrt(), and DetId::subdetId().

Referenced by etaphiDistanceClosestProblematic(), and fractionAroundClosestProblematic().

78 {
79  DetId seed=EcalClusterTools::getMaximum(cluster,&recHits).first;
80  if ( (seed.det() != DetId::Ecal) ||
81  (EcalSubdetector(seed.subdetId()) != EcalBarrel) )
82  {
83  //method not supported if not in Barrel
84  edm::LogError("EcalClusterSeverityLevelAlgo") << "The cluster seed is not in the BARREL";
85  return DetId(0);
86  }
87 
88  int minDist=9999; DetId closestProb(0);
89  //Get a window of DetId around the seed crystal
90  std::vector<DetId> neighbours = topology->getWindow(seed,51,11);
91 
92  for ( std::vector<DetId>::const_iterator it = neighbours.begin(); it != neighbours.end(); ++it )
93  {
94  EcalRecHitCollection::const_iterator jrh = recHits.find(*it);
95  if ( jrh == recHits.end() )
96  continue;
97  //Now checking rh flag
98  uint32_t sev = sevlv.severityLevel( *it, recHits);
99  if (sev == EcalSeverityLevel::kGood)
100  continue;
101  // std::cout << "[closestProblematic] Found a problematic channel " << EBDetId(*it) << " " << flag << std::endl;
102  //Find the closest DetId in eta,phi space (distance defined by deta^2 + dphi^2)
103  int deta=EBDetId::distanceEta(EBDetId(seed),EBDetId(*it));
104  int dphi=EBDetId::distancePhi(EBDetId(seed),EBDetId(*it));
105  double r = sqrt(deta*deta + dphi*dphi);
106  if (r < minDist){
107  closestProb = *it;
108  minDist = r;
109  }
110  }
111 
112  return closestProb;
113 }
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
std::vector< EcalRecHit >::const_iterator const_iterator
static int distanceEta(const EBDetId &a, const EBDetId &b)
Definition: EBDetId.cc:118
std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Get the neighbors of the given cell in a window of given size.
Definition: CaloTopology.cc:67
T sqrt(T t)
Definition: SSEVec.h:18
static int distancePhi(const EBDetId &a, const EBDetId &b)
Definition: EBDetId.cc:125
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
const_iterator end() const
Definition: DetId.h:18
iterator find(key_type k)
EcalSubdetector
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
std::pair< int, int > EcalClusterSeverityLevelAlgo::etaphiDistanceClosestProblematic ( const reco::CaloCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
const EcalSeverityLevelAlgo sevlv 
)
static

Definition at line 115 of file EcalClusterSeverityLevelAlgo.cc.

References closestProblematic(), DetId::det(), EBDetId::distanceEta(), EBDetId::distancePhi(), DetId::Ecal, EcalBarrel, SurveyInfoScenario_cff::seed, and DetId::subdetId().

118 {
119  DetId seed=EcalClusterTools::getMaximum(cluster,&recHits).first;
120  if ( (seed.det() != DetId::Ecal) ||
121  (EcalSubdetector(seed.subdetId()) != EcalBarrel) )
122  {
123  edm::LogError("EcalClusterSeverityLevelAlgo") << "The cluster seed is not in the BARREL";
124  //method not supported if not in Barrel
125  return std::pair<int,int>(-1,-1);
126  }
127 
128  DetId closestProb = closestProblematic(cluster , recHits, topology, sevlv);
129 
130  if (! closestProb.null())
131  return std::pair<int,int>(EBDetId::distanceEta(EBDetId(seed),EBDetId(closestProb)),EBDetId::distancePhi(EBDetId(seed),EBDetId(closestProb)));
132  else
133  return std::pair<int,int>(-1,-1);
134 }
static int distanceEta(const EBDetId &a, const EBDetId &b)
Definition: EBDetId.cc:118
static int distancePhi(const EBDetId &a, const EBDetId &b)
Definition: EBDetId.cc:125
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
Definition: DetId.h:18
static DetId closestProblematic(const reco::CaloCluster &, const EcalRecHitCollection &, const CaloTopology *topology, const EcalSeverityLevelAlgo &)
EcalSubdetector
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
float EcalClusterSeverityLevelAlgo::fractionAroundClosestProblematic ( const reco::CaloCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
const EcalSeverityLevelAlgo sevlv 
)
static

Definition at line 36 of file EcalClusterSeverityLevelAlgo.cc.

References closestProblematic(), edm::SortedCollection< T, SORT >::end(), reco::CaloCluster::energy(), edm::SortedCollection< T, SORT >::find(), dedxEstimators_cff::fraction, CaloTopology::getWindow(), reco::CaloCluster::hitsAndFractions(), and DetId::null().

38 {
39  DetId closestProb = closestProblematic(cluster , recHits, topology, sevlv);
40  // std::cout << "%%%%%%%%%%% Closest prob is " << EBDetId(closestProb) << std::endl;
41  if (closestProb.null())
42  return 0.;
43 
44  std::vector<DetId> neighbours = topology->getWindow(closestProb,3,3);
45  std::vector<DetId>::const_iterator itn;
46 
47  std::vector< std::pair<DetId, float> > hitsAndFracs = cluster.hitsAndFractions();
48  std::vector< std::pair<DetId, float> >::const_iterator it;
49 
50  float fraction = 0.;
51 
52  for ( itn = neighbours.begin(); itn != neighbours.end(); ++itn )
53  {
54  // std::cout << "Checking detId " << EBDetId((*itn)) << std::endl;
55  for ( it = hitsAndFracs.begin(); it != hitsAndFracs.end(); ++it )
56  {
57  DetId id = (*it).first;
58  if ( id != (*itn) )
59  continue;
60  // std::cout << "Is in cluster detId " << EBDetId(id) << std::endl;
61  EcalRecHitCollection::const_iterator jrh = recHits.find( id );
62  if ( jrh == recHits.end() )
63  {
64  edm::LogError("EcalClusterSeverityLevelAlgo") << "The cluster DetId " << id.rawId() << " is not in the recHit collection!!";
65  return -1;
66  }
67 
68  fraction += (*jrh).energy() * (*it).second / cluster.energy();
69  }
70  }
71  // std::cout << "%%%%%%%%%%% Fraction is " << fraction << std::endl;
72  return fraction;
73 }
constexpr bool null() const
is this a null id ?
Definition: DetId.h:52
std::vector< EcalRecHit >::const_iterator const_iterator
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:197
std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Get the neighbors of the given cell in a window of given size.
Definition: CaloTopology.cc:67
double energy() const
cluster energy
Definition: CaloCluster.h:126
const_iterator end() const
Definition: DetId.h:18
static DetId closestProblematic(const reco::CaloCluster &, const EcalRecHitCollection &, const CaloTopology *topology, const EcalSeverityLevelAlgo &)
iterator find(key_type k)
float EcalClusterSeverityLevelAlgo::goodFraction ( const reco::CaloCluster cluster,
const EcalRecHitCollection recHits,
const EcalSeverityLevelAlgo sevlv 
)
static

Definition at line 10 of file EcalClusterSeverityLevelAlgo.cc.

References edm::SortedCollection< T, SORT >::end(), reco::CaloCluster::energy(), edm::SortedCollection< T, SORT >::find(), dedxEstimators_cff::fraction, reco::CaloCluster::hitsAndFractions(), EcalSeverityLevel::kBad, EcalSeverityLevel::kProblematic, EcalSeverityLevel::kRecovered, and EcalSeverityLevelAlgo::severityLevel().

12 {
13  float fraction = 0.;
14  std::vector< std::pair<DetId, float> > hitsAndFracs = cluster.hitsAndFractions();
15  std::vector< std::pair<DetId, float> >::const_iterator it;
16  for ( it = hitsAndFracs.begin(); it != hitsAndFracs.end(); ++it ) {
17  DetId id = (*it).first;
18  EcalRecHitCollection::const_iterator jrh = recHits.find( id );
19  if ( jrh == recHits.end() ) {
20  edm::LogError("EcalClusterSeverityLevelAlgo") << "The cluster DetId " << id.rawId() << " is not in the recHit collection!!";
21  return -1;
22  }
23 
24  uint32_t sev = sevlv.severityLevel( id, recHits);
25  // if ( sev == EcalSeverityLevelAlgo::kBad ) ++recoveryFailed;
28  {
29 // std::cout << "[goodFraction] Found a problematic channel " << EBDetId(id) << " " << flag << " energy: " << (*jrh).energy() << std::endl;
30  fraction += (*jrh).energy() * (*it).second / cluster.energy();
31  }
32  }
33  return 1. - fraction;
34 }
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
std::vector< EcalRecHit >::const_iterator const_iterator
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:197
double energy() const
cluster energy
Definition: CaloCluster.h:126
const_iterator end() const
Definition: DetId.h:18
iterator find(key_type k)