84 unsigned int planes_required,
97 verbosity(conf.getUntrackedParameter<unsigned
int>(
"verbosity", 0)),
101 lrcgn(new
FastLineRecognition(conf.getParameter<double>(
"clusterSize_a"), conf.getParameter<double>(
"clusterSize_b"))),
102 threshold(conf.getParameter<double>(
"threshold")),
103 max_a_toFit(conf.getParameter<double>(
"max_a_toFit"))
105 for (
const auto &ps : conf.
getParameter< vector<ParameterSet> >(
"exceptionalSettings"))
107 unsigned int rpId = ps.getParameter<
unsigned int>(
"rpId");
111 settings.minPlanesPerProjectionToFit_V = ps.getParameter<
unsigned int>(
"minPlanesPerProjectionToFit_V");
112 settings.threshold_U = ps.getParameter<
double>(
"threshold_U");
113 settings.threshold_V = ps.getParameter<
double>(
"threshold_V");
120 produces<DetSetVector<TotemRPUVPattern>>();
133 double z0,
double threshold_loc,
unsigned int planes_required,
141 for (
auto &
p : newPatterns)
143 p.setProjection(proj);
147 set<unsigned int> planes;
148 for (
const auto &ds :
p.getHits())
151 if (planes.size() < planes_required)
152 p.setFittable(
false);
155 p.setFittable(
false);
167 <<
">> TotemRPUVPatternFinder::produce " <<
event.id().run() <<
":" <<
event.id().event();
186 map<uint8_t, uint16_t> planeOccupancy_U, planeOccupancy_V;
188 map<unsigned int, RPData> rpData;
190 for (
auto &
ids : *input)
193 unsigned int plane = detId.
plane();
194 bool uDir = detId.isStripsCoordinateUDirection();
198 RPData &
data = rpData[rpId];
204 auto &ods = data.hits_U.find_or_insert(ids.detId());
206 data.planeOccupancy_U[plane]++;
208 auto &ods = data.hits_V.find_or_insert(ids.detId());
210 data.planeOccupancy_V[plane]++;
216 for (
auto it : rpData)
219 RPData &
data = it.second;
230 minPlanesPerProjectionToFit_U = setIt->second.minPlanesPerProjectionToFit_U;
231 minPlanesPerProjectionToFit_V = setIt->second.minPlanesPerProjectionToFit_V;
232 threshold_U = setIt->second.threshold_U;
233 threshold_V = setIt->second.threshold_V;
236 auto &uColl = data.planeOccupancy_U;
237 auto &vColl = data.planeOccupancy_V;
243 <<
"\n\t\tall planes: u = " << uColl.size() <<
", v = " << vColl.size();
247 unsigned int uPlanes = 0, vPlanes = 0;
248 for (
auto pit : uColl)
252 for (
auto pit : vColl)
257 LogVerbatim(
"TotemRPUVPatternFinder") <<
"\t\tplanes with clean data: u = " << uPlanes <<
", v = " << vPlanes;
276 LogVerbatim(
"TotemRPUVPatternFinder") <<
"\t\tpatterns:";
277 for (
const auto &
p : patterns)
279 unsigned int n_hits = 0;
280 for (
auto &hds :
p.getHits())
281 n_hits += hds.size();
285 <<
", a = " <<
p.getA()
286 <<
", b = " <<
p.getB()
287 <<
", w = " <<
p.getW()
288 <<
", fittable = " <<
p.getFittable()
289 <<
", hits = " << n_hits;
306 ->setComment(
"input rechits collection to retrieve" );
308 desc.
add<
unsigned int>(
"maxHitsPerPlaneToSearch", 5 )
309 ->setComment(
"minimum threshold of hits multiplicity to flag the pattern as dirty" );
310 desc.
add<
unsigned int>(
"minPlanesPerProjectionToSearch", 3 )
311 ->setComment(
"minimal number of reasonable (= not empty and not dirty) planes per projection and per RP, to start the pattern search" );
312 desc.
add<
double>(
"clusterSize_a", 0.02 )
313 ->setComment(
"(full) cluster size (in rad) in slope-intercept space" );
314 desc.
add<
double>(
"clusterSize_b", 0.3 );
316 desc.
add<
double>(
"threshold", 2.99 )
317 ->setComment(
"minimal weight of (Hough) cluster to accept it as candidate\n" 318 " weight of cluster = sum of weights of contributing points\n" 319 " weight of point = sigma0 / sigma_of_point\n" 320 "most often: weight of point ~ 1, thus cluster weight is roughly number of contributing points" );
322 desc.
add<
unsigned int>(
"minPlanesPerProjectionToFit", 3 )
323 ->setComment(
"minimal number of planes (in the recognised patterns) per projection and per RP, to tag the candidate as fittable" );
325 desc.
add<
bool>(
"allowAmbiguousCombination",
false )
326 ->setComment(
"whether to allow combination of most significant U and V pattern, in case there several of them.\n" 327 "don't set it to True, unless you have reason" );
329 desc.
add<
double>(
"max_a_toFit", 10.0 )
330 ->setComment(
"maximal angle (in any projection) to mark the candidate as fittable -> controls track parallelity with beam\n" 331 "huge value -> no constraint" );
334 exceptions_validator.
add<
unsigned int>(
"rpId" )
335 ->setComment(
"RP id according to CTPPSDetId" );
336 exceptions_validator.
add<
unsigned int>(
"minPlanesPerProjectionToFit_U" );
337 exceptions_validator.
add<
unsigned int>(
"minPlanesPerProjectionToFit_V" );
338 exceptions_validator.
add<
double>(
"threshold_U" );
339 exceptions_validator.
add<
double>(
"threshold_V" );
341 std::vector<edm::ParameterSet> exceptions_default;
342 desc.
addVPSet(
"exceptionalSettings", exceptions_validator, exceptions_default );
344 descr.
add(
"totemRPUVPatternFinder", desc );
Detector ID class for TOTEM Si strip detectors.
T getParameter(std::string const &) const
TotemRPUVPatternFinder(const edm::ParameterSet &conf)
~TotemRPUVPatternFinder() override
void push_back(const T &t)
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
FastLineRecognition * lrcgn
the line recognition algorithm
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
#define DEFINE_FWK_MODULE(type)
void getPatterns(const edm::DetSetVector< TotemRPRecHit > &input, double _z0, double threshold, edm::DetSet< TotemRPUVPattern > &patterns)
Event setup record containing the real (actual) geometry information.
static std::string const input
reference find_or_insert(det_id_type id)
block of (exceptional) settings for 1 RP
std::map< unsigned int, RPSettings > exceptionalSettings
exceptional settings: RP Id –> settings
double threshold
minimal weight of (Hough) cluster to accept it as candidate
void recognizeAndSelect(TotemRPUVPattern::ProjectionType proj, double z0, double threshold, unsigned int planes_required, const edm::DetSetVector< TotemRPRecHit > &hits, edm::DetSet< TotemRPUVPattern > &patterns)
executes line recognition in a projection
unsigned char minPlanesPerProjectionToFit
minimal required number of active planes per projection to mark track candidate as fittable ...
void resetGeometry(const CTPPSGeometry *_g)
DDTranslation translation() const
unsigned char minPlanesPerProjectionToFit_V
CTPPSDetId getRPId() const
edm::EDGetTokenT< edm::DetSetVector< TotemRPRecHit > > detSetVectorTotemRPRecHitToken
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Class performing optimized hough transform to recognize lines.
edm::ESWatcher< VeryForwardRealGeometryRecord > geometryWatcher
void produce(edm::Event &e, const edm::EventSetup &c) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool check(const edm::EventSetup &iSetup)
Base class for CTPPS detector IDs.
unsigned char minPlanesPerProjectionToSearch
minimal required number of active planes per projection to even start track recognition ...
Class to recognize straight line tracks, based on optimized Hough trasform.
ESHandle< TrackerGeometry > geometry
char data[epos_bytes_allocation]
static void fillDescriptions(edm::ConfigurationDescriptions &)
unsigned int maxHitsPerPlaneToSearch
above this limit, planes are considered noisy
T const * product() const
unsigned char minPlanesPerProjectionToFit_U
const DetGeomDesc * getRP(unsigned int id) const
returns geometry of a RP box
double max_a_toFit
maximal angle (in any projection) to mark candidate as fittable - controls track parallelity ...