File indexing completed on 2024-04-06 12:27:39
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef RecoPPS_Local_FastLineRecognition
0010 #define RecoPPS_Local_FastLineRecognition
0011
0012 #include "DataFormats/Common/interface/DetSet.h"
0013 #include "DataFormats/Common/interface/DetSetVector.h"
0014
0015 #include "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h"
0016 #include "DataFormats/CTPPSDetId/interface/TotemRPDetId.h"
0017 #include "DataFormats/CTPPSReco/interface/TotemRPRecHit.h"
0018 #include "DataFormats/CTPPSReco/interface/TotemRPUVPattern.h"
0019
0020
0021
0022
0023
0024 class FastLineRecognition {
0025 public:
0026 FastLineRecognition(double cw_a = 0., double cw_b = 0.);
0027
0028 ~FastLineRecognition();
0029
0030 void resetGeometry(const CTPPSGeometry *_g) {
0031 geometry = _g;
0032 geometryMap.clear();
0033 }
0034
0035 void getPatterns(const edm::DetSetVector<TotemRPRecHit> &input,
0036 double _z0,
0037 double threshold,
0038 edm::DetSet<TotemRPUVPattern> &patterns);
0039
0040 private:
0041
0042 static const double sigma0;
0043
0044
0045 double z0;
0046
0047
0048 double chw_a, chw_b;
0049
0050
0051 double threshold;
0052
0053
0054 const CTPPSGeometry *geometry;
0055
0056 struct GeomData {
0057 double z;
0058 double s;
0059 };
0060
0061
0062 std::map<unsigned int, GeomData> geometryMap;
0063
0064
0065 GeomData getGeomData(unsigned int id);
0066
0067 struct Point {
0068 unsigned int detId;
0069 const TotemRPRecHit *hit;
0070 double h;
0071 double z;
0072 double w;
0073 bool usable;
0074 Point(unsigned int _d = 0, const TotemRPRecHit *_hit = nullptr, double _h = 0., double _z = 0., double _w = 0.)
0075 : detId(_d), hit(_hit), h(_h), z(_z), w(_w), usable(true) {}
0076 };
0077
0078
0079 struct Cluster {
0080 double Saw, Sbw, Sw, S1;
0081 double weight;
0082
0083 std::vector<const Point *> contents;
0084
0085 Cluster() : Saw(0.), Sbw(0.), Sw(0.), S1(0.), weight(0.) {}
0086
0087 void add(const Point *p1, const Point *p2, double a, double b, double w);
0088
0089 bool operator<(const Cluster &c) const { return (this->Sw > c.Sw) ? true : false; }
0090 };
0091
0092
0093
0094 bool getOneLine(const std::vector<Point> &points, double threshold, Cluster &result);
0095 };
0096
0097 #endif