24 int plane = strip.
plane();
27 std::cout <<
"Preshower Seeded Algorithm - looking for clusters" << std::endl;
28 std::cout <<
"Preshower is intersected at strip " << strip.
strip() <<
", at plane " << plane << std::endl;
32 std::vector< std::pair<DetId,float> > dummy;
37 if ( strip ==
ESDetId(0) )
return nullcluster;
53 findRoad(strip_north,navigator,plane);
56 findRoad(strip_south,navigator,plane);
61 findRoad(strip_east,navigator,plane);
64 findRoad(strip_west,navigator,plane);
73 RecHitsMap::iterator max_it;
75 std::vector<ESDetId>::iterator itID;
78 RecHitsMap::iterator strip_it =
rechits_map->find(*itID);
82 float E = strip_it->second.energy();
90 if ( !found )
return nullcluster;
94 recHits_pos.insert(std::make_pair(max_it->first, max_it->second));
95 used_s->insert(max_it->first);
97 std::cout <<
" Central hottest strip " <<
ESDetId(max_it->first) <<
" is saved " << std::endl;
98 std::cout <<
" with energy E = " << E_max << std::endl;
102 ESDetId next, strip_1, strip_2;
103 navigator.
setHome(max_it->first);
104 ESDetId startES = max_it->first;
108 int nadjacents_east = 0;
109 while ( (next=navigator.
east()) !=
ESDetId(0) && next != startES && nadjacents_east < 2 ) {
112 RecHitsMap::iterator strip_it =
rechits_map->find(next);
116 clusterRecHits.
push_back(strip_it->second);
118 if ( nadjacents_east==1 ) strip_1 = next;
119 used_s->insert(strip_it->first);
121 << strip_it->second.energy() << std::endl;
125 int nadjacents_west = 0;
126 while ( (next=navigator.
west()) !=
ESDetId(0) && next != startES && nadjacents_west < 2 ) {
129 RecHitsMap::iterator strip_it =
rechits_map->find(next);
131 clusterRecHits.
push_back(strip_it->second);
132 if ( nadjacents_west==1 ) strip_2 = next;
133 used_s->insert(strip_it->first);
135 << strip_it->second.energy() << std::endl;
138 else if (plane == 2) {
141 int nadjacents_north = 0;
142 while ( (next=navigator.
north()) !=
ESDetId(0) && next != startES && nadjacents_north < 2 ) {
145 RecHitsMap::iterator strip_it =
rechits_map->find(next);
147 clusterRecHits.
push_back(strip_it->second);
148 if ( nadjacents_north==1 ) strip_1 = next;
149 used_s->insert(strip_it->first);
151 << strip_it->second.energy() << std::endl;
155 int nadjacents_south = 0;
156 while ( (next=navigator.
south()) !=
ESDetId(0) && next != startES && nadjacents_south < 2 ) {
159 RecHitsMap::iterator strip_it =
rechits_map->find(next);
161 clusterRecHits.
push_back(strip_it->second);
162 if ( nadjacents_south==1 ) strip_2 = next;
163 used_s->insert(strip_it->first);
165 << strip_it->second.energy() << std::endl;
169 std::cout <<
" Wrong plane number" << plane <<
", null cluster will be returned! " << std::endl;
174 << strip_1 <<
" and " << strip_2 << std::endl;
177 RecHitsMap::iterator strip_it1, strip_it2;
180 recHits_pos.insert(std::make_pair(strip_it1->first, strip_it1->second));
184 recHits_pos.insert(std::make_pair(strip_it2->first, strip_it2->second));
187 RecHitsMap::iterator
cp;
188 double energy_pos = 0;
192 for (cp = recHits_pos.begin(); cp!=recHits_pos.end(); cp++ ) {
193 double E = cp->second.energy();
197 x_pos += E * position.
x();
198 y_pos += E * position.
y();
199 z_pos += E * position.
z();
207 if (
debugLevel_ ==
pDEBUG )
std::cout <<
" ES Cluster position = " <<
"(" << x_pos <<
","<< y_pos <<
","<< z_pos <<
")"<< std::endl;
213 std::vector<std::pair<DetId,float > > usedHits;
214 for (it=clusterRecHits.
begin(); it != clusterRecHits.
end(); it++) {
215 Eclust += it->energy();
216 usedHits.push_back(std::pair<DetId,float > (it->id(),1.));
226 std::cout <<
" ES Cluster is created with " << std::endl;
228 std::cout <<
" (eta,phi) = " <<
"("<<cluster.
eta()<<
", "<<cluster.
phi()<<
")"<< std::endl;
231 std::cout <<
" (x,y,z) = " <<
"(" << cluster.
x() <<
", "<< cluster.
y() <<
", "<< cluster.
z()<<
")"<< std::endl;
248 if (
used_s->find(candidate_it->first) !=
used_s->end())
249 std::cout <<
" This strip is in use " << std::endl;
251 std::cout <<
" No such a strip in rechits_map " << std::endl;
253 std::cout <<
" Strip energy " << candidate_it->second.energy() <<
" is below threshold " << std::endl;
256 if ( (
used_s->find(candidate_it->first) !=
used_s->end()) ||
270 if ( strip ==
ESDetId(0) )
return;
298 if (
debugLevel_ ==
pDEBUG )
std::cout <<
"Total number of strips found in the road at 1-st plane is " << n_east+n_west << std::endl;
300 else if (plane == 2) {
320 if (
debugLevel_ ==
pDEBUG )
std::cout <<
"Total number of strips found in the road at 2-nd plane is " << n_south+n_north << std::endl;
const math::XYZPoint & position() const
cluster centroid position
void setHome(const T &startingPoint)
set the starting position
void findRoad(ESDetId strip, EcalPreshowerNavigator theESNav, int plane)
void home() const
move the navigator back to the starting point
std::map< DetId, EcalRecHit > RecHitsMap
virtual T west() const
move the navigator west
void push_back(T const &t)
reco::PreshowerCluster makeOneCluster(ESDetId strip, HitsID *used_strips, RecHitsMap *rechits_map, const CaloSubdetectorGeometry *&geometry_p, CaloSubdetectorTopology *&topology_p)
virtual T north() const
move the navigator north
double z() const
z coordinate of cluster centroid
static int position[TOTALCHAMBERS][3]
double eta() const
pseudorapidity of cluster centroid
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
virtual T east() const
move the navigator east
bool goodStrip(RecHitsMap::iterator candidate_it)
double x() const
x coordinate of cluster centroid
double energy() const
cluster energy
int nhits() const
Number of RecHits the cluster.
std::vector< ESDetId > road_2d
std::vector< T >::iterator iterator
const_iterator end() const
double y() const
y coordinate of cluster centroid
double preshClusterEnergyCut_
double phi() const
azimuthal angle of cluster centroid
virtual T south() const
move the navigator south
const GlobalPoint & getPosition() const
double preshStripEnergyCut_
const_iterator begin() const