CMS 3D CMS Logo

Multi5x5ClusterAlgo.h
Go to the documentation of this file.
1 #ifndef RecoECAL_ECALClusters_Multi5x5ClusterAlgo_h
2 #define RecoECAL_ECALClusters_Multi5x5ClusterAlgo_h
3 
5 
12 
19 
20 // C/C++ headers
21 #include <string>
22 #include <vector>
23 #include <set>
24 
25 typedef std::map<DetId, EcalRecHit> RecHitsMap;
26 
28 public:
29  //the 5x5 clustering algo by default makes basic clusters which may not contain their seed crystal if they are close by to other clusters
30  //however we would like to post-fix the basic clusters to ensure they always contain their seed crystal
31  //so we define a proto basic cluster class which contains all the information which would be in a basic cluster
32  //which allows the addition of its seed and the removal of a seed of another cluster easily
34  float energy_;
36  std::vector<std::pair<DetId, float> > hits_;
38 
39  public:
41  ProtoBasicCluster(float iEnergy, const EcalRecHit &iSeed, std::vector<std::pair<DetId, float> > &iHits)
42  : energy_(iEnergy), seed_(iSeed) {
43  hits_.swap(iHits);
45  }
46 
47  float energy() const { return energy_; }
48  const EcalRecHit &seed() const { return seed_; }
49  const std::vector<std::pair<DetId, float> > &hits() const { return hits_; }
50  bool containsSeed() const { return containsSeed_; }
51 
52  bool removeHit(const EcalRecHit &hitToRM);
53  bool addSeed();
54 
55  private:
56  bool isSeedCrysInHits_() const;
57  };
58 
60 
61  Multi5x5ClusterAlgo(double ebst,
62  double ecst,
63  const std::vector<int> &v_chstatus,
64  const PositionCalc &posCalc,
68  v_chstatus_(v_chstatus),
70  posCalculator_ = posCalc;
71  std::sort(v_chstatus_.begin(), v_chstatus_.end());
72  }
73 
74  virtual ~Multi5x5ClusterAlgo() {}
75 
76  // this is the method that will start the clusterisation
77  std::vector<reco::BasicCluster> makeClusters(
80  const CaloSubdetectorTopology *topology_p,
81  const CaloSubdetectorGeometry *geometryES_p,
83  bool regional = false,
84  const std::vector<RectangularEtaPhiRegion> &regions = std::vector<RectangularEtaPhiRegion>());
85 
88 
89 private:
90  //algo to compute position of clusters
92 
95 
96  // Energy required for a seed:
99 
100  // collection of all rechits
102 
103  // The vector of seeds:
104  std::vector<EcalRecHit> seeds;
105 
106  std::vector<std::pair<DetId, int> > whichClusCrysBelongsTo_;
107 
108  // The set of used DetID's
109  std::set<DetId> used_s;
110  std::set<DetId> canSeed_s; // set of crystals not to be added but which can seed
111  // a new 3x3 (e.g. the outer crystals in a 5x5)
112 
113  // The vector of DetId's in the cluster currently reconstructed
114  std::vector<std::pair<DetId, float> > current_v;
115 
116  // The vector of clusters
117  std::vector<reco::BasicCluster> clusters_v;
118  std::vector<ProtoBasicCluster> protoClusters_;
119  // recHit flag to be excluded from seeding
120  std::vector<int> v_chstatus_;
121 
122  bool reassignSeedCrysToClusterItSeeds_; //the seed of the 5x5 crystal is sometimes in another basic cluster, however we may want to put it back into the cluster it seeds
123 
125  const CaloSubdetectorGeometry *geometry_p,
126  const CaloSubdetectorTopology *topology_p,
127  const CaloSubdetectorGeometry *geometryES_p);
128 
129  // Is the crystal at the navigator position a
130  // local maxiumum in energy?
132 
133  // prepare the 5x5 taking care over which crystals
134  // are allowed to seed new clusters and which are not
135  // after the preparation is complete
137  const EcalRecHitCollection *hits,
139 
140  // Add the crystal with DetId det to the current
141  // vector of crystals if it meets certain criteria
142  void addCrystal(const DetId &det);
143 
144  // take the crystals in the current_v and build
145  // them into a BasicCluster
147  const CaloSubdetectorGeometry *geometry_p,
148  const CaloSubdetectorGeometry *geometryES_p,
150  bool seedOutside);
151 };
152 
153 #endif
Multi5x5ClusterAlgo::ProtoBasicCluster::hits_
std::vector< std::pair< DetId, float > > hits_
Definition: Multi5x5ClusterAlgo.h:36
EcalRecHit
Definition: EcalRecHit.h:15
Multi5x5ClusterAlgo::protoClusters_
std::vector< ProtoBasicCluster > protoClusters_
Definition: Multi5x5ClusterAlgo.h:118
PositionCalc.h
edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
CaloNavigator.h
Multi5x5ClusterAlgo::ProtoBasicCluster::addSeed
bool addSeed()
Definition: Multi5x5ClusterAlgo.cc:403
Multi5x5ClusterAlgo::checkMaxima
bool checkMaxima(CaloNavigator< DetId > &navigator, const EcalRecHitCollection *hits)
Definition: Multi5x5ClusterAlgo.cc:283
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
reco::CaloID::Detectors
Detectors
Definition: CaloID.h:19
Multi5x5ClusterAlgo::ProtoBasicCluster::energy_
float energy_
Definition: Multi5x5ClusterAlgo.h:34
HLT_FULL_cff.navigator
navigator
Definition: HLT_FULL_cff.py:13126
BasicCluster.h
Multi5x5ClusterAlgo::clusters_v
std::vector< reco::BasicCluster > clusters_v
Definition: Multi5x5ClusterAlgo.h:117
RectangularEtaPhiRegion.h
Multi5x5ClusterAlgo::ProtoBasicCluster::seed_
EcalRecHit seed_
Definition: Multi5x5ClusterAlgo.h:35
Multi5x5ClusterAlgo::mainSearch
void mainSearch(const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry_p, const CaloSubdetectorTopology *topology_p, const CaloSubdetectorGeometry *geometryES_p)
Definition: Multi5x5ClusterAlgo.cc:133
Multi5x5ClusterAlgo::Point
math::XYZPoint Point
point in the space
Definition: Multi5x5ClusterAlgo.h:87
geometry
Definition: geometry.py:1
Multi5x5ClusterAlgo::~Multi5x5ClusterAlgo
virtual ~Multi5x5ClusterAlgo()
Definition: Multi5x5ClusterAlgo.h:74
EBDetId.h
Multi5x5ClusterAlgo::ProtoBasicCluster::containsSeed
bool containsSeed() const
Definition: Multi5x5ClusterAlgo.h:50
Multi5x5ClusterAlgo::ProtoBasicCluster::removeHit
bool removeHit(const EcalRecHit &hitToRM)
Definition: Multi5x5ClusterAlgo.cc:387
CaloID.h
edm::SortedCollection< EcalRecHit >
Multi5x5ClusterAlgo::v_chstatus_
std::vector< int > v_chstatus_
Definition: Multi5x5ClusterAlgo.h:120
Multi5x5ClusterAlgo::ProtoBasicCluster::ProtoBasicCluster
ProtoBasicCluster()
EcalRecHitCollections.h
DetId
Definition: DetId.h:17
Multi5x5ClusterAlgo::current_v
std::vector< std::pair< DetId, float > > current_v
Definition: Multi5x5ClusterAlgo.h:114
Multi5x5ClusterAlgo::addCrystal
void addCrystal(const DetId &det)
Definition: Multi5x5ClusterAlgo.cc:376
Multi5x5ClusterAlgo::reassignSeedCrysToClusterItSeeds_
bool reassignSeedCrysToClusterItSeeds_
Definition: Multi5x5ClusterAlgo.h:122
Multi5x5ClusterAlgo::makeClusters
std::vector< reco::BasicCluster > makeClusters(const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology_p, const CaloSubdetectorGeometry *geometryES_p, reco::CaloID::Detectors detector, bool regional=false, const std::vector< RectangularEtaPhiRegion > &regions=std::vector< RectangularEtaPhiRegion >())
Definition: Multi5x5ClusterAlgo.cc:54
Multi5x5ClusterAlgo
Definition: Multi5x5ClusterAlgo.h:27
Multi5x5ClusterAlgo::detector_
reco::CaloID::Detectors detector_
The ecal region used.
Definition: Multi5x5ClusterAlgo.h:94
multi5x5BasicClusters_cfi.reassignSeedCrysToClusterItSeeds
reassignSeedCrysToClusterItSeeds
Definition: multi5x5BasicClusters_cfi.py:25
RecHitsMap
std::map< DetId, EcalRecHit > RecHitsMap
Definition: Multi5x5ClusterAlgo.h:25
Multi5x5ClusterAlgo::posCalculator_
PositionCalc posCalculator_
Definition: Multi5x5ClusterAlgo.h:91
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
Multi5x5ClusterAlgo::recHits_
const EcalRecHitCollection * recHits_
Definition: Multi5x5ClusterAlgo.h:101
Multi5x5ClusterAlgo::seeds
std::vector< EcalRecHit > seeds
Definition: Multi5x5ClusterAlgo.h:104
PositionCalc
Definition: PositionCalc.h:29
Multi5x5ClusterAlgo::ProtoBasicCluster
Definition: Multi5x5ClusterAlgo.h:33
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
Multi5x5ClusterAlgo::canSeed_s
std::set< DetId > canSeed_s
Definition: Multi5x5ClusterAlgo.h:110
CaloSubdetectorTopology
Definition: CaloSubdetectorTopology.h:17
EcalBarrelHardcodedTopology.h
EcalRecHit.h
EcalEndcapNavigator.h
Multi5x5ClusterAlgo::ProtoBasicCluster::energy
float energy() const
Definition: Multi5x5ClusterAlgo.h:47
Multi5x5ClusterAlgo::Multi5x5ClusterAlgo
Multi5x5ClusterAlgo()
Definition: Multi5x5ClusterAlgo.h:59
CaloNavigator
Definition: CaloNavigator.h:7
Multi5x5ClusterAlgo::Multi5x5ClusterAlgo
Multi5x5ClusterAlgo(double ebst, double ecst, const std::vector< int > &v_chstatus, const PositionCalc &posCalc, bool reassignSeedCrysToClusterItSeeds=false)
Definition: Multi5x5ClusterAlgo.h:61
Multi5x5ClusterAlgo::ecalBarrelSeedThreshold
double ecalBarrelSeedThreshold
Definition: Multi5x5ClusterAlgo.h:97
Multi5x5ClusterAlgo::makeCluster
void makeCluster(const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry_p, const CaloSubdetectorGeometry *geometryES_p, const EcalRecHitCollection::const_iterator &seedIt, bool seedOutside)
Definition: Multi5x5ClusterAlgo.cc:229
Multi5x5ClusterAlgo::ProtoBasicCluster::ProtoBasicCluster
ProtoBasicCluster(float iEnergy, const EcalRecHit &iSeed, std::vector< std::pair< DetId, float > > &iHits)
Definition: Multi5x5ClusterAlgo.h:41
Multi5x5ClusterAlgo::used_s
std::set< DetId > used_s
Definition: Multi5x5ClusterAlgo.h:109
Multi5x5ClusterAlgo::prepareCluster
void prepareCluster(CaloNavigator< DetId > &navigator, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry)
Definition: Multi5x5ClusterAlgo.cc:327
CaloGeometry.h
Multi5x5ClusterAlgo::ecalEndcapSeedThreshold
double ecalEndcapSeedThreshold
Definition: Multi5x5ClusterAlgo.h:98
Point3D.h
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
hgcalTestNeighbor_cfi.detector
detector
Definition: hgcalTestNeighbor_cfi.py:6
Multi5x5ClusterAlgo::ProtoBasicCluster::hits
const std::vector< std::pair< DetId, float > > & hits() const
Definition: Multi5x5ClusterAlgo.h:49
AlignmentPI::regions
regions
Definition: AlignmentPayloadInspectorHelper.h:76
Multi5x5ClusterAlgo::ProtoBasicCluster::containsSeed_
bool containsSeed_
Definition: Multi5x5ClusterAlgo.h:37
EcalBarrelNavigator.h
Multi5x5ClusterAlgo::ProtoBasicCluster::isSeedCrysInHits_
bool isSeedCrysInHits_() const
Definition: Multi5x5ClusterAlgo.cc:423
Multi5x5ClusterAlgo::whichClusCrysBelongsTo_
std::vector< std::pair< DetId, int > > whichClusCrysBelongsTo_
Definition: Multi5x5ClusterAlgo.h:106
Multi5x5ClusterAlgo::ProtoBasicCluster::seed
const EcalRecHit & seed() const
Definition: Multi5x5ClusterAlgo.h:48