25 int plane = strip.
plane();
27 LogTrace(
"PreShowerClusterAlgo") <<
"Preshower Seeded Algorithm - looking for clusters";
28 LogTrace(
"PreShowerClusterAlgo")<<
"Preshower is intersected at strip" << strip.
strip() <<
",at plane" << plane ;
32 std::vector< std::pair<DetId,float> >
dummy;
34 LogTrace(
"PreShowerClusterAlgo") <<
" Creating a null-cluster" ;
38 if ( strip ==
ESDetId(0) )
return nullcluster;
50 LogTrace(
"PreShowerClusterAlgo") <<
"Total number of strips in the central road:" <<
road_2d.size() ;
54 findRoad(strip_north,navigator,plane);
57 findRoad(strip_south,navigator,plane);
62 findRoad(strip_east,navigator,plane);
65 findRoad(strip_west,navigator,plane);
68 LogTrace(
"PreShowerClusterAlgo") <<
"Total number of strips in all three roads:" <<
road_2d.size() ;
73 RecHitsMap::iterator max_it;
75 std::vector<ESDetId>::iterator itID;
77 LogTrace(
"PreShowerClusterAlgo") <<
"ID ="<<*itID ;
79 RecHitsMap::iterator strip_it =
rechits_map->find(*itID);
82 LogTrace(
"PreShowerClusterAlgo") <<
" strip is " <<
ESDetId(strip_it->first) <<
"E ="<< strip_it->second.energy();
84 float E = strip_it->second.energy();
92 if ( !found )
return nullcluster;
96 recHits_pos.insert(std::make_pair(max_it->first, max_it->second));
97 used_s->insert(max_it->first);
98 LogTrace(
"PreShowerClusterAlgo") <<
"Central hottest strip" <<
ESDetId(max_it->first) <<
"is saved with energy E =" << E_max ;
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 ) {
111 LogTrace(
"PreShowerClusterAlgo") <<
"Adjacent east #" << nadjacents_east <<
":"<<
next ;
113 RecHitsMap::iterator strip_it =
rechits_map->find(next);
117 clusterRecHits.
push_back(strip_it->second);
119 if ( nadjacents_east==1 ) strip_1 =
next;
120 used_s->insert(strip_it->first);
121 LogTrace(
"PreShowerClusterAlgo") <<
"East adjacent strip #" << nadjacents_east <<
"is saved with energy E =" << strip_it->second.energy() ;
126 int nadjacents_west = 0;
127 while ( (next=navigator.
west()) !=
ESDetId(0) && next != startES && nadjacents_west < 2 ) {
129 LogTrace(
"PreShowerClusterAlgo") <<
"Adjacent west #" << nadjacents_west <<
":"<<
next ;
131 RecHitsMap::iterator strip_it =
rechits_map->find(next);
133 clusterRecHits.
push_back(strip_it->second);
134 if ( nadjacents_west==1 ) strip_2 =
next;
135 used_s->insert(strip_it->first);
136 LogTrace(
"PreShowerClusterAlgo") <<
"West adjacent strip #" << nadjacents_west <<
"is saved with energy E =" << strip_it->second.energy();
140 else if (plane == 2) {
143 int nadjacents_north = 0;
144 while ( (next=navigator.
north()) !=
ESDetId(0) && next != startES && nadjacents_north < 2 ) {
146 LogTrace(
"PreShowerClusterAlgo") <<
"Adjacent north #" << nadjacents_north <<
":"<<
next ;
148 RecHitsMap::iterator strip_it =
rechits_map->find(next);
150 clusterRecHits.
push_back(strip_it->second);
151 if ( nadjacents_north==1 ) strip_1 =
next;
152 used_s->insert(strip_it->first);
153 LogTrace(
"PreShowerClusterAlgo") <<
"North adjacent strip #" << nadjacents_north <<
"is saved with energy E =" << strip_it->second.energy() ;
158 int nadjacents_south = 0;
159 while ( (next=navigator.
south()) !=
ESDetId(0) && next != startES && nadjacents_south < 2 ) {
161 LogTrace(
"PreShowerClusterAlgo") <<
"Adjacent south #" << nadjacents_south <<
":"<<
next ;
163 RecHitsMap::iterator strip_it =
rechits_map->find(next);
165 clusterRecHits.
push_back(strip_it->second);
166 if ( nadjacents_south==1 ) strip_2 =
next;
167 used_s->insert(strip_it->first);
168 LogTrace(
"PreShowerClusterAlgo") <<
"South adjacent strip #" << nadjacents_south <<
"is saved with energy E =" << strip_it->second.energy() ;
173 LogTrace(
"PreShowerClusterAlgo") <<
" Wrong plane number" << plane <<
", null cluster will be returned! " << std::endl;
177 LogTrace(
"PreShowerClusterAlgo") <<
"Total size of clusterRecHits is" << clusterRecHits.
size();
178 LogTrace(
"PreShowerClusterAlgo") <<
"Two adjacent strips for position calculation are:" << strip_1 <<
"and" << strip_2;
182 RecHitsMap::iterator strip_it1, strip_it2;
185 recHits_pos.insert(std::make_pair(strip_it1->first, strip_it1->second));
189 recHits_pos.insert(std::make_pair(strip_it2->first, strip_it2->second));
192 RecHitsMap::iterator
cp;
193 double energy_pos = 0;
197 for (cp = recHits_pos.begin(); cp!=recHits_pos.end(); cp++ ) {
198 double E = cp->second.
energy();
200 auto thisCell = geometry_p->
getGeometry(cp->first);
202 x_pos += E * position.
x();
203 y_pos += E * position.
y();
204 z_pos += E * position.
z();
212 LogTrace(
"PreShowerClusterAlgo") <<
"ES Cluster position =" <<
"("<< x_pos <<
","<< y_pos <<
","<< z_pos <<
")";
218 std::vector<std::pair<DetId,float > > usedHits;
219 for (it=clusterRecHits.
begin(); it != clusterRecHits.
end(); it++) {
220 Eclust += it->energy();
221 usedHits.push_back(std::pair<DetId,float > (it->id(),1.));
228 LogTrace(
"PreShowerClusterAlgo") <<
" ES Cluster is created with:" ;
229 LogTrace(
"PreShowerClusterAlgo") <<
" energy =" << cluster.
energy();
230 LogTrace(
"PreShowerClusterAlgo") <<
" (eta,phi) =" <<
"("<<cluster.
eta()<<
","<<cluster.
phi()<<
")";
231 LogTrace(
"PreShowerClusterAlgo") <<
" nhits =" << cluster.
nhits();
233 LogTrace(
"PreShowerClusterAlgo") <<
" (x,y,z) =" <<
"(" << cluster.
x() <<
", "<< cluster.
y() <<
","<< cluster.
z()<<
")" ;
248 if (
used_s->find(candidate_it->first) !=
used_s->end())
249 LogTrace(
"PreShowerClusterAlgo") <<
" This strip is in use";
251 LogTrace(
"PreShowerClusterAlgo") <<
" No such a strip in rechits_map";
253 LogTrace(
"PreShowerClusterAlgo") <<
"Strip energy" << candidate_it->second.energy() <<
"is below threshold";
256 if ( (
used_s->find(candidate_it->first) !=
used_s->end()) ||
269 if ( strip ==
ESDetId(0) )
return;
275 LogTrace(
"PreShowerClusterAlgo") <<
"findRoad starts from strip" <<
strip;
280 LogTrace(
"PreShowerClusterAlgo") <<
" Go to the East ";
283 LogTrace(
"PreShowerClusterAlgo") <<
"East:" << n_east <<
"current strip is"<<
next;
291 LogTrace(
"PreShowerClusterAlgo") <<
"Go to the West" ;
295 LogTrace(
"PreShowerClusterAlgo") <<
"West: " << n_west <<
"current strip is" <<
next ;
301 LogTrace(
"PreShowerClusterAlgo") <<
"Total number of strips found in the road at 1-st plane is" << n_east+n_west ;
304 else if (plane == 2) {
307 LogTrace(
"PreShowerClusterAlgo") <<
"Go to the North";
310 LogTrace(
"PreShowerClusterAlgo") <<
"North:" << n_north <<
"current strip is" <<
next ;
318 LogTrace(
"PreShowerClusterAlgo") <<
"Go to the South";
323 LogTrace(
"PreShowerClusterAlgo") <<
"South:" << n_south <<
"current strip is" <<
next ;
330 LogTrace(
"PreShowerClusterAlgo") <<
"Total number of strips found in the road at 2-nd plane is" << n_south+n_north;
334 LogTrace(
"PreShowerClusterAlgo") <<
" Wrong plane number, null cluster will be returned!";
const math::XYZPoint & position() const
cluster centroid position
void findRoad(ESDetId strip, EcalPreshowerNavigator theESNav, int plane)
std::map< DetId, EcalRecHit > RecHitsMap
void push_back(T const &t)
reco::PreshowerCluster makeOneCluster(ESDetId strip, HitsID *used_strips, RecHitsMap *rechits_map, const CaloSubdetectorGeometry *&geometry_p, CaloSubdetectorTopology *&topology_p)
double z() const
z coordinate of cluster centroid
double eta() const
pseudorapidity of cluster centroid
void setHome(const T &startingPoint)
set the starting position
T west() const
move the navigator west
float energy() const
Energy. Note this is taken from the first SimTrack only.
bool goodStrip(RecHitsMap::iterator candidate_it)
double x() const
x coordinate of cluster centroid
double energy() const
cluster energy
T south() const
move the navigator south
int nhits() const
Number of RecHits the cluster.
std::vector< ESDetId > road_2d
std::vector< EcalRecHit >::iterator iterator
const_iterator end() const
T east() const
move the navigator east
void home() const
move the navigator back to the starting point
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.
static int position[264][3]
T north() const
move the navigator north
double y() const
y coordinate of cluster centroid
double preshClusterEnergyCut_
double phi() const
azimuthal angle of cluster centroid
double preshStripEnergyCut_
const_iterator begin() const