86 unsigned int planes_required,
101 verbosity(conf.getUntrackedParameter<unsigned
int>(
"verbosity", 0)),
102 minPlanesPerProjectionToSearch(conf.getParameter<unsigned
int>(
"minPlanesPerProjectionToSearch")),
103 minPlanesPerProjectionToFit(conf.getParameter<unsigned
int>(
"minPlanesPerProjectionToFit")),
104 maxHitsPerPlaneToSearch(conf.getParameter<unsigned
int>(
"maxHitsPerPlaneToSearch")),
106 conf.getParameter<double>(
"clusterSize_b"))),
107 threshold(conf.getParameter<double>(
"threshold")),
108 max_a_toFit(conf.getParameter<double>(
"max_a_toFit")) {
109 for (
const auto &ps : conf.
getParameter<vector<ParameterSet>>(
"exceptionalSettings")) {
110 unsigned int rpId = ps.getParameter<
unsigned int>(
"rpId");
114 settings.minPlanesPerProjectionToFit_V = ps.getParameter<
unsigned int>(
"minPlanesPerProjectionToFit_V");
115 settings.threshold_U = ps.getParameter<
double>(
"threshold_U");
116 settings.threshold_V = ps.getParameter<
double>(
"threshold_V");
123 produces<DetSetVector<TotemRPUVPattern>>();
134 double threshold_loc,
135 unsigned int planes_required,
143 for (
auto &
p : newPatterns) {
144 p.setProjection(
proj);
148 set<unsigned int> planes;
149 for (
const auto &ds :
p.hits())
152 if (planes.size() < planes_required)
153 p.setFittable(
false);
156 p.setFittable(
false);
167 <<
">> TotemRPUVPatternFinder::produce " <<
event.id().run() <<
":" <<
event.id().event();
184 map<uint8_t, uint16_t> planeOccupancy_U, planeOccupancy_V;
186 map<unsigned int, RPData> rpData;
188 for (
auto &ids : *
input) {
190 unsigned int plane = detId.
plane();
191 bool uDir = detId.isStripsCoordinateUDirection();
195 RPData &
data = rpData[rpId];
197 for (
auto &
h : ids) {
199 auto &ods =
data.hits_U.find_or_insert(ids.detId());
201 data.planeOccupancy_U[plane]++;
203 auto &ods =
data.hits_V.find_or_insert(ids.detId());
205 data.planeOccupancy_V[plane]++;
211 for (
auto const &it : rpData) {
213 RPData
const &
data = it.second;
223 minPlanesPerProjectionToFit_U = setIt->second.minPlanesPerProjectionToFit_U;
224 minPlanesPerProjectionToFit_V = setIt->second.minPlanesPerProjectionToFit_V;
225 threshold_U = setIt->second.threshold_U;
226 threshold_V = setIt->second.threshold_V;
229 auto &uColl =
data.planeOccupancy_U;
230 auto &vColl =
data.planeOccupancy_V;
234 <<
"\tRP " << rpId <<
"\n\t\tall planes: u = " << uColl.size() <<
", v = " << vColl.size();
238 unsigned int uPlanes = 0, vPlanes = 0;
239 for (
auto pit : uColl)
243 for (
auto pit : vColl)
248 LogVerbatim(
"TotemRPUVPatternFinder") <<
"\t\tplanes with clean data: u = " << uPlanes <<
", v = " << vPlanes;
258 double z0 =
geometry.rp(rpId)->translation().z();
266 LogVerbatim(
"TotemRPUVPatternFinder") <<
"\t\tpatterns:";
267 for (
const auto &
p : patterns) {
268 unsigned int n_hits = 0;
269 for (
auto &hds :
p.hits())
270 n_hits += hds.size();
274 <<
", b = " <<
p.b() <<
", w = " <<
p.w() <<
", fittable = " <<
p.fittable() <<
", hits = " << n_hits;
289 ->setComment(
"input rechits collection to retrieve");
290 desc.addUntracked<
unsigned int>(
"verbosity", 0);
291 desc.add<
unsigned int>(
"maxHitsPerPlaneToSearch", 5)
292 ->setComment(
"minimum threshold of hits multiplicity to flag the pattern as dirty");
293 desc.add<
unsigned int>(
"minPlanesPerProjectionToSearch", 3)
295 "minimal number of reasonable (= not empty and not dirty) planes per projection and per RP, to start the " 297 desc.add<
double>(
"clusterSize_a", 0.02 )
298 ->setComment(
"(full) cluster size (in rad) in slope-intercept space");
299 desc.add<
double>(
"clusterSize_b", 0.3 );
301 desc.add<
double>(
"threshold", 2.99)
303 "minimal weight of (Hough) cluster to accept it as candidate\n" 304 " weight of cluster = sum of weights of contributing points\n" 305 " weight of point = sigma0 / sigma_of_point\n" 306 "most often: weight of point ~ 1, thus cluster weight is roughly number of contributing points");
308 desc.add<
unsigned int>(
"minPlanesPerProjectionToFit", 3)
310 "minimal number of planes (in the recognised patterns) per projection and per RP, to tag the candidate as " 313 desc.add<
bool>(
"allowAmbiguousCombination",
false)
315 "whether to allow combination of most significant U and V pattern, in case there several of them.\n" 316 "don't set it to True, unless you have reason");
318 desc.add<
double>(
"max_a_toFit", 10.0)
320 "maximal angle (in any projection) to mark the candidate as fittable -> controls track parallelity with " 322 "huge value -> no constraint");
325 exceptions_validator.
add<
unsigned int>(
"rpId")->setComment(
"RP id according to CTPPSDetId");
326 exceptions_validator.
add<
unsigned int>(
"minPlanesPerProjectionToFit_U");
327 exceptions_validator.
add<
unsigned int>(
"minPlanesPerProjectionToFit_V");
328 exceptions_validator.
add<
double>(
"threshold_U");
329 exceptions_validator.
add<
double>(
"threshold_V");
331 std::vector<edm::ParameterSet> exceptions_default;
332 desc.addVPSet(
"exceptionalSettings", exceptions_validator, exceptions_default);
334 descr.
add(
"totemRPUVPatternFinder",
desc);
Detector ID class for TOTEM Si strip detectors.
Log< level::Info, true > LogVerbatim
TotemRPUVPatternFinder(const edm::ParameterSet &conf)
~TotemRPUVPatternFinder() override
T getParameter(std::string const &) const
void push_back(const T &t)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
FastLineRecognition * lrcgn
the line recognition algorithm
void getPatterns(const edm::DetSetVector< TotemRPRecHit > &input, double _z0, double threshold, edm::DetSet< TotemRPUVPattern > &patterns)
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
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > ctppsGeometryToken
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)
unsigned char minPlanesPerProjectionToFit_V
#define DEFINE_FWK_MODULE(type)
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.
char data[epos_bytes_allocation]
static void fillDescriptions(edm::ConfigurationDescriptions &)
unsigned int maxHitsPerPlaneToSearch
above this limit, planes are considered noisy
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
unsigned char minPlanesPerProjectionToFit_U
double max_a_toFit
maximal angle (in any projection) to mark candidate as fittable - controls track parallelity ...