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 Attributes
PreshowerPhiClusterAlgo Class Reference

#include <PreshowerPhiClusterAlgo.h>

Public Types

typedef std::set< DetIdHitsID
 
typedef math::XYZPoint Point
 
typedef std::map< DetId,
EcalRecHit
RecHitsMap
 

Public Member Functions

bool goodStrip (RecHitsMap::iterator candidate_it)
 
reco::PreshowerCluster makeOneCluster (ESDetId strip, HitsID *used_strips, RecHitsMap *rechits_map, const CaloSubdetectorGeometry *&geometry_p, CaloSubdetectorTopology *&topology_p, double deltaEta, double minDeltaPhi, double maxDeltaPhi)
 
 PreshowerPhiClusterAlgo ()
 
 PreshowerPhiClusterAlgo (float stripEnergyCut)
 
 ~PreshowerPhiClusterAlgo ()
 

Private Attributes

float esStripEnergyCut_
 
RecHitsMaprechits_map
 
std::vector< ESDetIdroad_2d
 
HitsIDused_s
 

Detailed Description

Definition at line 17 of file PreshowerPhiClusterAlgo.h.

Member Typedef Documentation

Definition at line 24 of file PreshowerPhiClusterAlgo.h.

Definition at line 21 of file PreshowerPhiClusterAlgo.h.

Definition at line 23 of file PreshowerPhiClusterAlgo.h.

Constructor & Destructor Documentation

PreshowerPhiClusterAlgo::PreshowerPhiClusterAlgo ( )
inline

Definition at line 26 of file PreshowerPhiClusterAlgo.h.

26  :
28  {}
PreshowerPhiClusterAlgo::PreshowerPhiClusterAlgo ( float  stripEnergyCut)
inline

Definition at line 30 of file PreshowerPhiClusterAlgo.h.

30  :
31  esStripEnergyCut_(stripEnergyCut)
32  {}
PreshowerPhiClusterAlgo::~PreshowerPhiClusterAlgo ( )
inline

Definition at line 34 of file PreshowerPhiClusterAlgo.h.

34 {};

Member Function Documentation

bool PreshowerPhiClusterAlgo::goodStrip ( RecHitsMap::iterator  candidate_it)

Definition at line 99 of file PreshowerPhiClusterAlgo.cc.

References esStripEnergyCut_, LogTrace, rechits_map, and used_s.

Referenced by makeOneCluster().

99  {
100 
101  if ( used_s->find(candidate_it->first) != used_s->end())
102  LogTrace("PreShowerPhiClusterAlgo") << " This strip is in use";
103  if (candidate_it == rechits_map->end() )
104  LogTrace("PreShowerPhiClusterAlgo") << " No such a strip in rechits_map";
105  if (candidate_it->second.energy() <= esStripEnergyCut_)
106  LogTrace("PreShowerPhiClusterAlgo") << "Strip energy" << candidate_it->second.energy() <<"is below threshold";
107 
108  // crystal should not be included...
109  if ( (used_s->find(candidate_it->first) != used_s->end()) || // ...if it already belongs to a cluster
110  (candidate_it == rechits_map->end() ) || // ...if it corresponds to a hit
111  (candidate_it->second.energy() <= esStripEnergyCut_ ) ) // ...if it has a negative or zero energy
112  {
113  return false;
114  }
115  return true;
116 }
#define LogTrace(id)
reco::PreshowerCluster PreshowerPhiClusterAlgo::makeOneCluster ( ESDetId  strip,
HitsID used_strips,
RecHitsMap rechits_map,
const CaloSubdetectorGeometry *&  geometry_p,
CaloSubdetectorTopology *&  topology_p,
double  deltaEta,
double  minDeltaPhi,
double  maxDeltaPhi 
)

Definition at line 15 of file PreshowerPhiClusterAlgo.cc.

References edm::SortedCollection< T, SORT >::begin(), reco::deltaPhi(), edm::SortedCollection< T, SORT >::end(), PV3DBase< T, PVType, FrameType >::eta(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), goodStrip(), PV3DBase< T, PVType, FrameType >::phi(), ESDetId::plane(), position, edm::SortedCollection< T, SORT >::push_back(), rechits_map, used_s, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

21 {
22 
23  rechits_map = the_rechitsMap_p;
24  used_s = used_strips;
25 
26  int plane = strip.plane();
27 
28  // create null-cluster
29  std::vector< std::pair<DetId,float> > dummy;
30  Point posi(0,0,0);
31  reco::PreshowerCluster nullcluster = reco::PreshowerCluster(0., posi, dummy, plane);
32  if (strip == ESDetId(0)) return nullcluster; // works in case of no intersected strip found (e.g. in the Barrel)
33 
34  const CaloCellGeometry *refCell = geometry_p->getGeometry(strip);
35  GlobalPoint refpos = refCell->getPosition();
36  double refEta = refpos.eta();
37  double refPhi = refpos.phi();
38 
39  // Collection of cluster strips
40  EcalRecHitCollection clusterRecHits;
41 
42  double x_pos = 0;
43  double y_pos = 0;
44  double z_pos = 0;
45 
46  RecHitsMap::iterator strip_it;
47  for (strip_it = rechits_map->begin(); strip_it != rechits_map->end(); ++strip_it) {
48 
49  if (!goodStrip(strip_it)) continue;
50 
51  ESDetId mystrip = (strip_it->first == DetId(0)) ? ESDetId(0) : ESDetId(strip_it->first);
52  if (mystrip.plane() != plane) continue;
53 
54  const CaloCellGeometry *thisCell = geometry_p->getGeometry(strip_it->first);
55  GlobalPoint position = thisCell->getPosition();
56 
57  if (fabs(position.eta() - refEta) < deltaEta) {
58 
59  //std::cout<<"all strips : "<<mystrip.plane()<<" "<<position.phi()<<" "<<reco::deltaPhi(position.phi(), refPhi)<<std::endl;
60 
61  if (reco::deltaPhi(position.phi(), refPhi) > 0 && reco::deltaPhi(position.phi(), refPhi) > maxDeltaPhi) continue;
62  if (reco::deltaPhi(position.phi(), refPhi) < 0 && reco::deltaPhi(position.phi(), refPhi) < minDeltaPhi) continue;
63 
64  //std::cout<<mystrip.zside()<<" "<<mystrip.plane()<<" "<<mystrip.six()<<" "<<mystrip.siy()<<" "<<mystrip.strip()<<" "<<position.eta()<<" "<<position.phi()<<" "<<strip_it->second.energy()<<" "<<strip_it->second.recoFlag()<<" "<<refEta<<" "<<refPhi<<" "<<reco::deltaPhi(position.phi(), refPhi)<<std::endl;
65 
66  clusterRecHits.push_back(strip_it->second);
67  used_s->insert(strip_it->first);
68 
69  x_pos += strip_it->second.energy() * position.x();
70  y_pos += strip_it->second.energy() * position.y();
71  z_pos += strip_it->second.energy() * position.z();
72  }
73 
74  }
75 
77  double Eclust = 0;
78 
79  std::vector<std::pair<DetId,float > > usedHits;
80  for (it=clusterRecHits.begin(); it != clusterRecHits.end(); it++) {
81  Eclust += it->energy();
82  usedHits.push_back(std::pair<DetId,float > (it->id(), 1.));
83  }
84 
85  if (Eclust > 0.) {
86  x_pos /= Eclust;
87  y_pos /= Eclust;
88  z_pos /= Eclust;
89  }
90  Point pos(x_pos,y_pos,z_pos);
91 
92  reco::PreshowerCluster cluster = reco::PreshowerCluster(Eclust, pos, usedHits, plane);
93  used_strips = used_s;
94 
95  return cluster;
96 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
void push_back(T const &t)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
bool goodStrip(RecHitsMap::iterator candidate_it)
T z() const
Definition: PV3DBase.h:64
math::XYZPoint Point
std::vector< EcalRecHit >::iterator iterator
const_iterator end() const
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:12
Definition: DetId.h:18
T eta() const
Definition: PV3DBase.h:76
static int position[264][3]
Definition: ReadPGInfo.cc:509
int plane() const
Definition: ESDetId.h:46
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
T x() const
Definition: PV3DBase.h:62
const_iterator begin() const

Member Data Documentation

float PreshowerPhiClusterAlgo::esStripEnergyCut_
private

Definition at line 47 of file PreshowerPhiClusterAlgo.h.

Referenced by goodStrip().

RecHitsMap* PreshowerPhiClusterAlgo::rechits_map
private

Definition at line 52 of file PreshowerPhiClusterAlgo.h.

Referenced by goodStrip(), and makeOneCluster().

std::vector<ESDetId> PreshowerPhiClusterAlgo::road_2d
private

Definition at line 49 of file PreshowerPhiClusterAlgo.h.

HitsID* PreshowerPhiClusterAlgo::used_s
private

Definition at line 55 of file PreshowerPhiClusterAlgo.h.

Referenced by goodStrip(), and makeOneCluster().