CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
TotemRPUVPatternFinder Class Reference

Class to recognize straight line tracks, based on optimized Hough trasform. More...

Inheritance diagram for TotemRPUVPatternFinder:
edm::stream::EDProducer<>

Classes

struct  RPSettings
 block of (exceptional) settings for 1 RP More...
 

Public Member Functions

void produce (edm::Event &e, const edm::EventSetup &c) override
 
 TotemRPUVPatternFinder (const edm::ParameterSet &conf)
 
 ~TotemRPUVPatternFinder () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 

Private Member Functions

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 More...
 

Private Attributes

edm::ESGetToken< CTPPSGeometry,
VeryForwardRealGeometryRecord
ctppsGeometryToken
 
edm::EDGetTokenT
< edm::DetSetVector
< TotemRPRecHit > > 
detSetVectorTotemRPRecHitToken
 
std::map< unsigned int,
RPSettings
exceptionalSettings
 exceptional settings: RP Id –> settings More...
 
edm::ESWatcher
< VeryForwardRealGeometryRecord
geometryWatcher
 
FastLineRecognitionlrcgn
 the line recognition algorithm More...
 
double max_a_toFit
 maximal angle (in any projection) to mark candidate as fittable - controls track parallelity More...
 
unsigned int maxHitsPerPlaneToSearch
 above this limit, planes are considered noisy More...
 
unsigned char minPlanesPerProjectionToFit
 minimal required number of active planes per projection to mark track candidate as fittable More...
 
unsigned char minPlanesPerProjectionToSearch
 minimal required number of active planes per projection to even start track recognition More...
 
edm::InputTag tagRecHit
 
double threshold
 minimal weight of (Hough) cluster to accept it as candidate More...
 
unsigned int verbosity
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Class to recognize straight line tracks, based on optimized Hough trasform.

The search is perfomed in global U,V coordinates (wrt. beam). In this way (some of) the alignment corrections can be taken into account.

Definition at line 37 of file TotemRPUVPatternFinder.cc.

Constructor & Destructor Documentation

TotemRPUVPatternFinder::TotemRPUVPatternFinder ( const edm::ParameterSet conf)

Definition at line 98 of file TotemRPUVPatternFinder.cc.

References detSetVectorTotemRPRecHitToken, exceptionalSettings, edm::ParameterSet::getParameter(), TotemRPUVPatternFinder::RPSettings::minPlanesPerProjectionToFit_U, and tagRecHit.

99  : tagRecHit(conf.getParameter<edm::InputTag>("tagRecHit")),
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")),
105  lrcgn(new FastLineRecognition(conf.getParameter<double>("clusterSize_a"),
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");
111 
112  RPSettings settings;
113  settings.minPlanesPerProjectionToFit_U = ps.getParameter<unsigned int>("minPlanesPerProjectionToFit_U");
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");
117 
118  exceptionalSettings[rpId] = settings;
119  }
120 
121  detSetVectorTotemRPRecHitToken = consumes<edm::DetSetVector<TotemRPRecHit>>(tagRecHit);
122 
123  produces<DetSetVector<TotemRPUVPattern>>();
124 }
T getUntrackedParameter(std::string const &, T const &) const
FastLineRecognition * lrcgn
the line recognition algorithm
std::map< unsigned int, RPSettings > exceptionalSettings
exceptional settings: RP Id –&gt; settings
double threshold
minimal weight of (Hough) cluster to accept it as candidate
edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > ctppsGeometryToken
unsigned char minPlanesPerProjectionToFit
minimal required number of active planes per projection to mark track candidate as fittable ...
edm::EDGetTokenT< edm::DetSetVector< TotemRPRecHit > > detSetVectorTotemRPRecHitToken
Class performing optimized hough transform to recognize lines.
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
unsigned char minPlanesPerProjectionToSearch
minimal required number of active planes per projection to even start track recognition ...
unsigned int maxHitsPerPlaneToSearch
above this limit, planes are considered noisy
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
double max_a_toFit
maximal angle (in any projection) to mark candidate as fittable - controls track parallelity ...
TotemRPUVPatternFinder::~TotemRPUVPatternFinder ( )
override

Definition at line 128 of file TotemRPUVPatternFinder.cc.

References lrcgn.

128 { delete lrcgn; }
FastLineRecognition * lrcgn
the line recognition algorithm

Member Function Documentation

void TotemRPUVPatternFinder::fillDescriptions ( edm::ConfigurationDescriptions descr)
static

Definition at line 285 of file TotemRPUVPatternFinder.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), edm::ParameterSetDescription::addVPSet(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, and edm::ParameterDescriptionNode::setComment().

285  {
287 
288  desc.add<edm::InputTag>("tagRecHit", edm::InputTag("totemRPRecHitProducer"))
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)
294  ->setComment(
295  "minimal number of reasonable (= not empty and not dirty) planes per projection and per RP, to start the "
296  "pattern search");
297  desc.add<double>("clusterSize_a", 0.02 /* rad */)
298  ->setComment("(full) cluster size (in rad) in slope-intercept space");
299  desc.add<double>("clusterSize_b", 0.3 /* mm */);
300 
301  desc.add<double>("threshold", 2.99)
302  ->setComment(
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");
307 
308  desc.add<unsigned int>("minPlanesPerProjectionToFit", 3)
309  ->setComment(
310  "minimal number of planes (in the recognised patterns) per projection and per RP, to tag the candidate as "
311  "fittable");
312 
313  desc.add<bool>("allowAmbiguousCombination", false)
314  ->setComment(
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");
317 
318  desc.add<double>("max_a_toFit", 10.0)
319  ->setComment(
320  "maximal angle (in any projection) to mark the candidate as fittable -> controls track parallelity with "
321  "beam\n"
322  "huge value -> no constraint");
323 
324  edm::ParameterSetDescription exceptions_validator;
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");
330 
331  std::vector<edm::ParameterSet> exceptions_default;
332  desc.addVPSet("exceptionalSettings", exceptions_validator, exceptions_default);
333 
334  descr.add("totemRPUVPatternFinder", desc);
335 }
void setComment(std::string const &value)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void TotemRPUVPatternFinder::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 164 of file TotemRPUVPatternFinder.cc.

References edm::ESWatcher< T >::check(), ctppsGeometryToken, data, detSetVectorTotemRPRecHitToken, exceptionalSettings, edm::DetSetVector< T >::find_or_insert(), relativeConstraints::geometry, geometryWatcher, edm::EventSetup::getData(), h, input, lrcgn, maxHitsPerPlaneToSearch, minPlanesPerProjectionToFit, minPlanesPerProjectionToSearch, AlCaHLTBitMon_ParallelJobs::p, TotemRPDetId::plane(), TotemRPUVPattern::projU, TotemRPUVPattern::projV, recognizeAndSelect(), FastLineRecognition::resetGeometry(), CTPPSDetId::rpId(), threshold, and verbosity.

164  {
165  if (verbosity > 5)
166  LogVerbatim("TotemRPUVPatternFinder")
167  << ">> TotemRPUVPatternFinder::produce " << event.id().run() << ":" << event.id().event();
168 
169  // geometry
170  const auto &geometry = es.getData(ctppsGeometryToken);
171  if (geometryWatcher.check(es))
173 
174  // get input
176  event.getByToken(detSetVectorTotemRPRecHitToken, input);
177 
178  // prepare output
179  DetSetVector<TotemRPUVPattern> patternsVector;
180 
181  // split input per RP and per U/V projection
182  struct RPData {
183  DetSetVector<TotemRPRecHit> hits_U, hits_V;
184  map<uint8_t, uint16_t> planeOccupancy_U, planeOccupancy_V;
185  };
186  map<unsigned int, RPData> rpData;
187 
188  for (auto &ids : *input) {
189  TotemRPDetId detId(ids.detId());
190  unsigned int plane = detId.plane();
191  bool uDir = detId.isStripsCoordinateUDirection();
192 
193  CTPPSDetId rpId = detId.rpId();
194 
195  RPData &data = rpData[rpId];
196 
197  for (auto &h : ids) {
198  if (uDir) {
199  auto &ods = data.hits_U.find_or_insert(ids.detId());
200  ods.push_back(h);
201  data.planeOccupancy_U[plane]++;
202  } else {
203  auto &ods = data.hits_V.find_or_insert(ids.detId());
204  ods.push_back(h);
205  data.planeOccupancy_V[plane]++;
206  }
207  }
208  }
209 
210  // track recognition pot by pot
211  for (auto const &it : rpData) {
212  CTPPSDetId rpId(it.first);
213  RPData const &data = it.second;
214 
215  // merge default and exceptional settings (if available)
216  unsigned int minPlanesPerProjectionToFit_U = minPlanesPerProjectionToFit;
217  unsigned int minPlanesPerProjectionToFit_V = minPlanesPerProjectionToFit;
218  double threshold_U = threshold;
219  double threshold_V = threshold;
220 
221  auto setIt = exceptionalSettings.find(rpId);
222  if (setIt != exceptionalSettings.end()) {
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;
227  }
228 
229  auto &uColl = data.planeOccupancy_U;
230  auto &vColl = data.planeOccupancy_V;
231 
232  if (verbosity > 5) {
233  LogVerbatim("TotemRPUVPatternFinder")
234  << "\tRP " << rpId << "\n\t\tall planes: u = " << uColl.size() << ", v = " << vColl.size();
235  }
236 
237  // count planes with clean data (no showers, noise, ...)
238  unsigned int uPlanes = 0, vPlanes = 0;
239  for (auto pit : uColl)
240  if (pit.second <= maxHitsPerPlaneToSearch)
241  uPlanes++;
242 
243  for (auto pit : vColl)
244  if (pit.second <= maxHitsPerPlaneToSearch)
245  vPlanes++;
246 
247  if (verbosity > 5)
248  LogVerbatim("TotemRPUVPatternFinder") << "\t\tplanes with clean data: u = " << uPlanes << ", v = " << vPlanes;
249 
250  // discard RPs with too few reasonable planes
252  continue;
253 
254  // prepare data containers
255  DetSet<TotemRPUVPattern> &patterns = patternsVector.find_or_insert(rpId);
256 
257  // "typical" z0 for the RP
258  double z0 = geometry.rp(rpId)->translation().z();
259 
260  // u then v recognition
261  recognizeAndSelect(TotemRPUVPattern::projU, z0, threshold_U, minPlanesPerProjectionToFit_U, data.hits_U, patterns);
262 
263  recognizeAndSelect(TotemRPUVPattern::projV, z0, threshold_V, minPlanesPerProjectionToFit_V, data.hits_V, patterns);
264 
265  if (verbosity > 5) {
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();
271 
272  LogVerbatim("TotemRPUVPatternFinder")
273  << "\t\t\tproj = " << ((p.projection() == TotemRPUVPattern::projU) ? "U" : "V") << ", a = " << p.a()
274  << ", b = " << p.b() << ", w = " << p.w() << ", fittable = " << p.fittable() << ", hits = " << n_hits;
275  }
276  }
277  }
278 
279  // save output
280  event.put(make_unique<DetSetVector<TotemRPUVPattern>>(patternsVector));
281 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
Log< level::Info, true > LogVerbatim
FastLineRecognition * lrcgn
the line recognition algorithm
uint32_t plane() const
Definition: TotemRPDetId.h:46
static std::string const input
Definition: EdmProvDump.cc:47
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:234
CTPPSDetId rpId() const
Definition: CTPPSDetId.h:78
std::map< unsigned int, RPSettings > exceptionalSettings
exceptional settings: RP Id –&gt; 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)
edm::EDGetTokenT< edm::DetSetVector< TotemRPRecHit > > detSetVectorTotemRPRecHitToken
edm::ESWatcher< VeryForwardRealGeometryRecord > geometryWatcher
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
unsigned char minPlanesPerProjectionToSearch
minimal required number of active planes per projection to even start track recognition ...
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
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.
Definition: Activities.doc:4
void TotemRPUVPatternFinder::recognizeAndSelect ( TotemRPUVPattern::ProjectionType  proj,
double  z0,
double  threshold,
unsigned int  planes_required,
const edm::DetSetVector< TotemRPRecHit > &  hits,
edm::DetSet< TotemRPUVPattern > &  patterns 
)
private

executes line recognition in a projection

Definition at line 132 of file TotemRPUVPatternFinder.cc.

References FastLineRecognition::getPatterns(), lrcgn, max_a_toFit, AlCaHLTBitMon_ParallelJobs::p, and edm::DetSet< T >::push_back().

Referenced by produce().

137  {
138  // run recognition
139  DetSet<TotemRPUVPattern> newPatterns;
140  lrcgn->getPatterns(hits, z0, threshold_loc, newPatterns);
141 
142  // set pattern properties and copy to the global pattern collection
143  for (auto &p : newPatterns) {
144  p.setProjection(proj);
145 
146  p.setFittable(true);
147 
148  set<unsigned int> planes;
149  for (const auto &ds : p.hits())
150  planes.insert(TotemRPDetId(ds.detId()).plane());
151 
152  if (planes.size() < planes_required)
153  p.setFittable(false);
154 
155  if (fabs(p.a()) > max_a_toFit)
156  p.setFittable(false);
157 
158  patterns.push_back(p);
159  }
160 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
void push_back(const T &t)
Definition: DetSet.h:66
FastLineRecognition * lrcgn
the line recognition algorithm
void getPatterns(const edm::DetSetVector< TotemRPRecHit > &input, double _z0, double threshold, edm::DetSet< TotemRPUVPattern > &patterns)
double max_a_toFit
maximal angle (in any projection) to mark candidate as fittable - controls track parallelity ...

Member Data Documentation

edm::ESGetToken<CTPPSGeometry, VeryForwardRealGeometryRecord> TotemRPUVPatternFinder::ctppsGeometryToken
private

Definition at line 50 of file TotemRPUVPatternFinder.cc.

Referenced by produce().

edm::EDGetTokenT<edm::DetSetVector<TotemRPRecHit> > TotemRPUVPatternFinder::detSetVectorTotemRPRecHitToken
private

Definition at line 48 of file TotemRPUVPatternFinder.cc.

Referenced by produce(), and TotemRPUVPatternFinder().

std::map<unsigned int, RPSettings> TotemRPUVPatternFinder::exceptionalSettings
private

exceptional settings: RP Id –> settings

Definition at line 80 of file TotemRPUVPatternFinder.cc.

Referenced by produce(), and TotemRPUVPatternFinder().

edm::ESWatcher<VeryForwardRealGeometryRecord> TotemRPUVPatternFinder::geometryWatcher
private

Definition at line 51 of file TotemRPUVPatternFinder.cc.

Referenced by produce().

FastLineRecognition* TotemRPUVPatternFinder::lrcgn
private

the line recognition algorithm

Definition at line 65 of file TotemRPUVPatternFinder.cc.

Referenced by produce(), recognizeAndSelect(), and ~TotemRPUVPatternFinder().

double TotemRPUVPatternFinder::max_a_toFit
private

maximal angle (in any projection) to mark candidate as fittable - controls track parallelity

Definition at line 71 of file TotemRPUVPatternFinder.cc.

Referenced by recognizeAndSelect().

unsigned int TotemRPUVPatternFinder::maxHitsPerPlaneToSearch
private

above this limit, planes are considered noisy

Definition at line 62 of file TotemRPUVPatternFinder.cc.

Referenced by produce().

unsigned char TotemRPUVPatternFinder::minPlanesPerProjectionToFit
private

minimal required number of active planes per projection to mark track candidate as fittable

Definition at line 59 of file TotemRPUVPatternFinder.cc.

Referenced by produce().

unsigned char TotemRPUVPatternFinder::minPlanesPerProjectionToSearch
private

minimal required number of active planes per projection to even start track recognition

Definition at line 56 of file TotemRPUVPatternFinder.cc.

Referenced by produce().

edm::InputTag TotemRPUVPatternFinder::tagRecHit
private

Definition at line 47 of file TotemRPUVPatternFinder.cc.

Referenced by TotemRPUVPatternFinder().

double TotemRPUVPatternFinder::threshold
private

minimal weight of (Hough) cluster to accept it as candidate

Definition at line 68 of file TotemRPUVPatternFinder.cc.

Referenced by utils.StatisticalTest::get_status(), and produce().

unsigned int TotemRPUVPatternFinder::verbosity
private

Definition at line 53 of file TotemRPUVPatternFinder.cc.

Referenced by produce().