34 bool add1 =
true, add2 =
true;
35 for (vector<const Point *>::const_iterator it =
contents.begin(); it !=
contents.end() && (add1 || add2); ++it)
37 if ((*it)->hit == p1->
hit)
40 if ((*it)->hit == p2->
hit)
76 map<unsigned int, GeomData>::iterator it =
geometryMap.find(
id);
81 CLHEP::Hep3Vector
d =
geometry->localToGlobalDirection(
id, CLHEP::Hep3Vector(0., 1., 0.));
85 gd.
s =
d.x()*c.x() +
d.y()*c.y();
99 for (
auto &ds : input)
101 unsigned int detId = ds.detId();
109 double z = gd.
z -
z0;
112 points.push_back(
Point(detId, hit, p, z, w));
117 printf(
">> FastLineRecognition::getPatterns(z0 = %E)\n", z0);
118 printf(
">>>>>>>>>>>>>>>>>>>\n");
134 printf(
"\tpoints of the selected cluster: %lu\n", c.
contents.size());
140 printf(
"\t\t%.1f\n", pit->z);
142 pattern.
addHit(pit->detId, *(pit->hit));
148 unsigned int u_points_b = 0;
149 for (vector<Point>::iterator dit = points.begin(); dit != points.end(); ++dit)
152 printf(
"\tusable points before: %u\n", u_points_b);
158 for (vector<Point>::iterator dit = points.begin(); dit != points.end(); ++dit)
161 if ((*hit)->hit == dit->hit)
171 unsigned int u_points_a = 0;
172 for (vector<Point>::iterator dit = points.begin(); dit != points.end(); ++dit)
175 printf(
"\tusable points after: %u\n", u_points_a);
180 printf(
"patterns at end: %lu\n", patterns.
size());
181 printf(
"<<<<<<<<<<<<<<<<<<<\n");
191 printf(
"\tFastLineRecognition::getOneLine\n");
194 if (points.size() < 2)
200 for (vector<Point>::const_iterator it1 = points.begin(); it1 != points.end(); ++it1)
205 for (vector<Point>::const_iterator it2 = it1; it2 != points.end(); ++it2)
210 const double &z1 = it1->z;
211 const double &z2 = it2->z;
216 const double &
p1 = it1->h;
217 const double &
p2 = it2->h;
219 const double &w1 = it1->w;
220 const double &
w2 = it2->w;
223 double a = (p2 -
p1) / (z2 - z1);
224 double b = p1 - z1 *
a;
228 printf(
"\t\t\tz: 1=%+5.1f, 2=%+5.1f | U/V: 1=%+6.3f, 2=%+6.3f | a=%+6.3f rad, b=%+6.3f mm, w=%.1f\n", z1, z2, p1, p2, a, b, w);
232 bool newCluster =
true;
233 for (
unsigned int k = 0;
k < clusters.size();
k++)
236 if (c.
S1 < 1. || c.
Sw <= 0.)
241 printf(
"\t\t\t\ttest cluster %u at a=%+6.3f, b=%+6.3f : %+6.3f, %+6.3f : %i, %i\n",
k, c.
Saw/c.
Sw, c.
Sbw/c.
Sw,
249 clusters[
k].add(& (*it1), & (*it2), a, b, w);
251 printf(
"\t\t\t\t--> cluster %u\n",
k);
261 printf(
"\t\t\t\t--> new cluster %lu\n", clusters.size());
264 clusters.back().add(& (*it1), & (*it2), a, b, w);
270 printf(
"\t\tclusters: %lu\n", clusters.size());
276 for (
unsigned int k = 0;
k < clusters.size();
k++)
279 for (vector<const Point *>::iterator it = clusters[
k].
contents.begin(); it != clusters[
k].contents.end(); ++it)
281 clusters[
k].weight = w;
291 printf(
"\t\tmw = %.1f, mk = %u\n", mw, mk);
297 result = clusters[mk];
Detector ID class for TOTEM Si strip detectors.
void addHit(edm::det_id_type detId, const TotemRPRecHit &hit)
double chw_a
cluster half widths in a and b
void push_back(const T &t)
common ppss p3p6s2 common epss epspn46 common const1 w2
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const TotemRPRecHit * hit
pointer to original reco hit
double s
sensor's centre projected to its read-out direction
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> Translation
cluster of intersection points
void getPatterns(const edm::DetSetVector< TotemRPRecHit > &input, double _z0, double threshold, edm::DetSet< TotemRPUVPattern > &patterns)
static std::string const input
bool getOneLine(const std::vector< Point > &points, double threshold, Cluster &result)
double threshold
weight threshold for accepting pattern candidates (clusters)
void add(const Point *p1, const Point *p2, double a, double b, double w)
std::map< unsigned int, GeomData > geometryMap
map: raw detector id –> GeomData
Reconstructed hit in TOTEM RP.
Abs< T >::type abs(const T &t)
std::vector< const Point * > contents
A linear pattern in U or V projection. The intercept b is taken at the middle of a RP: (geometry->Get...
static const double sigma0
the uncertainty of 1-hit cluster, in mm
GeomData getGeomData(unsigned int id)
expects raw detector id
FastLineRecognition(double cw_a=0., double cw_b=0.)
double z
z position of a sensor (wrt. IP)
double getPosition() const