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)
56 min_a =
min(a, min_a);
57 min_b =
min(b, min_b);
58 max_a =
max(a, max_a);
59 max_b =
max(b, max_b);
81 map<unsigned int, GeomData>::iterator it =
geometryMap.find(
id);
86 CLHEP::Hep3Vector
d =
geometry->LocalToGlobalDirection(
id, CLHEP::Hep3Vector(0., 1., 0.));
90 gd.
s =
d.x()*c.x() +
d.y()*c.y();
103 std::vector<Point> points;
104 for (
auto &ds : input)
106 unsigned int detId = ds.detId();
114 double z = gd.
z -
z0;
117 points.push_back(
Point(detId, hit, p, z, w));
122 printf(
">> FastLineRecognition::getPatterns(z0 = %E)\n", z0);
123 printf(
">>>>>>>>>>>>>>>>>>>\n");
139 printf(
"\tpoints of the selected cluster: %lu\n", c.
contents.size());
145 printf(
"\t\t%.1f\n", pit->z);
147 pattern.
addHit(pit->detId, *(pit->hit));
153 unsigned int u_points_b = 0;
154 for (vector<Point>::iterator dit = points.begin(); dit != points.end(); ++dit)
157 printf(
"\tusable points before: %u\n", u_points_b);
163 for (vector<Point>::iterator dit = points.begin(); dit != points.end(); ++dit)
166 if ((*hit)->hit == dit->hit)
176 unsigned int u_points_a = 0;
177 for (vector<Point>::iterator dit = points.begin(); dit != points.end(); ++dit)
180 printf(
"\tusable points after: %u\n", u_points_a);
185 printf(
"patterns at end: %lu\n", patterns.
size());
186 printf(
"<<<<<<<<<<<<<<<<<<<\n");
196 printf(
"\tFastLineRecognition::getOneLine\n");
199 if (points.size() < 2)
205 for (vector<Point>::const_iterator it1 = points.begin(); it1 != points.end(); ++it1)
210 for (vector<Point>::const_iterator it2 = it1; it2 != points.end(); ++it2)
215 const double &z1 = it1->z;
216 const double &z2 = it2->z;
221 const double &
p1 = it1->h;
222 const double &
p2 = it2->h;
224 const double &w1 = it1->w;
225 const double &
w2 = it2->w;
228 double a = (p2 -
p1) / (z2 - z1);
229 double b = p1 - z1 *
a;
233 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);
237 bool newCluster =
true;
238 for (
unsigned int k = 0;
k < clusters.size();
k++)
241 if (c.
S1 < 1. || c.
Sw <= 0.)
246 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,
254 clusters[
k].add(& (*it1), & (*it2), a, b, w);
256 printf(
"\t\t\t\t--> cluster %u\n",
k);
266 printf(
"\t\t\t\t--> new cluster %lu\n", clusters.size());
269 clusters.back().add(& (*it1), & (*it2), a, b, w);
275 printf(
"\t\tclusters: %lu\n", clusters.size());
281 for (
unsigned int k = 0;
k < clusters.size();
k++)
284 for (vector<const Point *>::iterator it = clusters[
k].
contents.begin(); it != clusters[
k].contents.end(); ++it)
286 clusters[
k].weight = w;
296 printf(
"\t\tmw = %.1f, mk = %u\n", mw, mk);
302 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
cluster of intersection points
void getPatterns(const edm::DetSetVector< TotemRPRecHit > &input, double _z0, double threshold, edm::DetSet< TotemRPUVPattern > &patterns)
static std::string const input
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
const PhiMemoryImage patterns[9]
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