24 int plane = strip.
plane();
26 LogTrace(
"PreShowerClusterAlgo") <<
"Preshower Seeded Algorithm - looking for clusters";
27 LogTrace(
"PreShowerClusterAlgo") <<
"Preshower is intersected at strip" << strip.
strip() <<
",at plane" << plane;
30 std::vector<std::pair<DetId, float> >
dummy;
32 LogTrace(
"PreShowerClusterAlgo") <<
" Creating a null-cluster";
49 LogTrace(
"PreShowerClusterAlgo") <<
"Total number of strips in the central road:" <<
road_2d.size();
53 findRoad(strip_north, navigator, plane);
56 findRoad(strip_south, navigator, plane);
61 findRoad(strip_east, navigator, plane);
64 findRoad(strip_west, navigator, plane);
67 LogTrace(
"PreShowerClusterAlgo") <<
"Total number of strips in all three roads:" <<
road_2d.size();
72 RecHitsMap::iterator max_it;
74 std::vector<ESDetId>::iterator itID;
76 LogTrace(
"PreShowerClusterAlgo") <<
"ID =" << *itID;
78 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();
97 recHits_pos.insert(std::make_pair(max_it->first, max_it->second));
98 used_s->insert(max_it->first);
99 LogTrace(
"PreShowerClusterAlgo") <<
"Central hottest strip" <<
ESDetId(max_it->first)
100 <<
"is saved with energy E =" << E_max;
104 navigator.
setHome(max_it->first);
105 ESDetId startES = max_it->first;
109 int nadjacents_east = 0;
110 while ((next = navigator.
east()) !=
ESDetId(0) && next != startES && nadjacents_east < 2) {
112 LogTrace(
"PreShowerClusterAlgo") <<
"Adjacent east #" << nadjacents_east <<
":" <<
next;
114 RecHitsMap::iterator strip_it =
rechits_map->find(next);
119 clusterRecHits.
push_back(strip_it->second);
121 if (nadjacents_east == 1)
123 used_s->insert(strip_it->first);
124 LogTrace(
"PreShowerClusterAlgo") <<
"East adjacent strip #" << nadjacents_east
125 <<
"is saved with energy E =" << strip_it->second.energy();
129 int nadjacents_west = 0;
130 while ((next = navigator.
west()) !=
ESDetId(0) && next != startES && nadjacents_west < 2) {
132 LogTrace(
"PreShowerClusterAlgo") <<
"Adjacent west #" << nadjacents_west <<
":" <<
next;
134 RecHitsMap::iterator strip_it =
rechits_map->find(next);
137 clusterRecHits.
push_back(strip_it->second);
138 if (nadjacents_west == 1)
140 used_s->insert(strip_it->first);
141 LogTrace(
"PreShowerClusterAlgo") <<
"West adjacent strip #" << nadjacents_west
142 <<
"is saved with energy E =" << strip_it->second.energy();
144 }
else if (plane == 2) {
146 int nadjacents_north = 0;
147 while ((next = navigator.
north()) !=
ESDetId(0) && next != startES && nadjacents_north < 2) {
149 LogTrace(
"PreShowerClusterAlgo") <<
"Adjacent north #" << nadjacents_north <<
":" <<
next;
151 RecHitsMap::iterator strip_it =
rechits_map->find(next);
154 clusterRecHits.
push_back(strip_it->second);
155 if (nadjacents_north == 1)
157 used_s->insert(strip_it->first);
158 LogTrace(
"PreShowerClusterAlgo") <<
"North adjacent strip #" << nadjacents_north
159 <<
"is saved with energy E =" << strip_it->second.energy();
163 int nadjacents_south = 0;
164 while ((next = navigator.
south()) !=
ESDetId(0) && next != startES && nadjacents_south < 2) {
166 LogTrace(
"PreShowerClusterAlgo") <<
"Adjacent south #" << nadjacents_south <<
":" <<
next;
168 RecHitsMap::iterator strip_it =
rechits_map->find(next);
171 clusterRecHits.
push_back(strip_it->second);
172 if (nadjacents_south == 1)
174 used_s->insert(strip_it->first);
175 LogTrace(
"PreShowerClusterAlgo") <<
"South adjacent strip #" << nadjacents_south
176 <<
"is saved with energy E =" << strip_it->second.energy();
179 LogTrace(
"PreShowerClusterAlgo") <<
" Wrong plane number" << plane <<
", null cluster will be returned! " 184 LogTrace(
"PreShowerClusterAlgo") <<
"Total size of clusterRecHits is" << clusterRecHits.
size();
185 LogTrace(
"PreShowerClusterAlgo") <<
"Two adjacent strips for position calculation are:" << strip_1 <<
"and" 189 RecHitsMap::iterator strip_it1, strip_it2;
192 recHits_pos.insert(std::make_pair(strip_it1->first, strip_it1->second));
196 recHits_pos.insert(std::make_pair(strip_it2->first, strip_it2->second));
199 RecHitsMap::iterator
cp;
200 double energy_pos = 0;
204 for (cp = recHits_pos.begin(); cp != recHits_pos.end(); cp++) {
205 double E = cp->second.
energy();
207 auto thisCell = geometry_p->
getGeometry(cp->first);
209 x_pos += E * position.
x();
210 y_pos += E * position.
y();
211 z_pos += E * position.
z();
213 if (energy_pos > 0.) {
219 LogTrace(
"PreShowerClusterAlgo") <<
"ES Cluster position =" 220 <<
"(" << x_pos <<
"," << y_pos <<
"," << z_pos <<
")";
225 std::vector<std::pair<DetId, float> > usedHits;
226 for (it = clusterRecHits.
begin(); it != clusterRecHits.
end(); it++) {
227 Eclust += it->energy();
228 usedHits.push_back(std::pair<DetId, float>(it->id(), 1.));
233 LogTrace(
"PreShowerClusterAlgo") <<
" ES Cluster is created with:";
234 LogTrace(
"PreShowerClusterAlgo") <<
" energy =" << cluster.
energy();
235 LogTrace(
"PreShowerClusterAlgo") <<
" (eta,phi) =" 236 <<
"(" << cluster.
eta() <<
"," << cluster.
phi() <<
")";
237 LogTrace(
"PreShowerClusterAlgo") <<
" nhits =" << cluster.
nhits();
239 LogTrace(
"PreShowerClusterAlgo") <<
" (x,y,z) =" 240 <<
"(" << cluster.
x() <<
", " << cluster.
y() <<
"," << cluster.
z() <<
")";
252 LogTrace(
"PreShowerClusterAlgo") <<
" This strip is in use";
254 LogTrace(
"PreShowerClusterAlgo") <<
" No such a strip in rechits_map";
256 LogTrace(
"PreShowerClusterAlgo") <<
"Strip energy" << candidate_it->second.energy() <<
"is below threshold";
259 if ((
used_s->find(candidate_it->first) !=
used_s->end()) ||
277 LogTrace(
"PreShowerClusterAlgo") <<
"findRoad starts from strip" <<
strip;
282 LogTrace(
"PreShowerClusterAlgo") <<
" Go to the East ";
285 LogTrace(
"PreShowerClusterAlgo") <<
"East:" << n_east <<
"current strip is" <<
next;
294 LogTrace(
"PreShowerClusterAlgo") <<
"Go to the West";
298 LogTrace(
"PreShowerClusterAlgo") <<
"West: " << n_west <<
"current strip is" <<
next;
305 LogTrace(
"PreShowerClusterAlgo") <<
"Total number of strips found in the road at 1-st plane is" << n_east + n_west;
307 }
else if (plane == 2) {
310 LogTrace(
"PreShowerClusterAlgo") <<
"Go to the North";
313 LogTrace(
"PreShowerClusterAlgo") <<
"North:" << n_north <<
"current strip is" <<
next;
322 LogTrace(
"PreShowerClusterAlgo") <<
"Go to the South";
326 LogTrace(
"PreShowerClusterAlgo") <<
"South:" << n_south <<
"current strip is" <<
next;
334 LogTrace(
"PreShowerClusterAlgo") <<
"Total number of strips found in the road at 2-nd plane is" 335 << n_south + n_north;
338 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)
double z() const
z coordinate of cluster centroid
double eta() const
pseudorapidity of cluster centroid
reco::PreshowerCluster makeOneCluster(ESDetId strip, HitsID *used_strips, RecHitsMap *rechits_map, const CaloSubdetectorGeometry *geometry_p, const CaloSubdetectorTopology *topology_p)
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.
Structure Point Contains parameters of Gaussian fits to DMRs.
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