CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
MeasurementByLayerGrouper Class Reference

#include <MeasurementByLayerGrouper.h>

Public Member Functions

 MeasurementByLayerGrouper (const GeometricSearchTracker *search=nullptr)
 
std::vector< std::pair< const DetLayer *, std::vector< TM > > > operator() (const std::vector< TM > &) const
 

Private Types

typedef TrajectoryMeasurement TM
 

Private Member Functions

const DetLayergetDetLayer (const TM &tm) const
 

Private Attributes

const GeometricSearchTrackertheGeomSearch
 

Detailed Description

Definition at line 13 of file MeasurementByLayerGrouper.h.

Member Typedef Documentation

◆ TM

Definition at line 15 of file MeasurementByLayerGrouper.h.

Constructor & Destructor Documentation

◆ MeasurementByLayerGrouper()

MeasurementByLayerGrouper::MeasurementByLayerGrouper ( const GeometricSearchTracker search = nullptr)
inlineexplicit

Definition at line 21 of file MeasurementByLayerGrouper.h.

Member Function Documentation

◆ getDetLayer()

const DetLayer * MeasurementByLayerGrouper::getDetLayer ( const TM tm) const
private

Definition at line 49 of file MeasurementByLayerGrouper.cc.

49  {
50  // if the DetLayer is set in the TM...
51  if (tm.layer())
52  return tm.layer();
53 
54  //if it corresponds to an invalid hit with no geomdet associated
55  //we can't retrieve the DetLayer
56  //because unfortunately the detlayer is not set in these cases
57  //returns 0 for the moment
58  //to be revisited
59 
60  if (tm.recHit()->det() == nullptr) {
61  LogDebug("MeasurementByLayerGrouper") << "This hit has no geomdet associated skipping... ";
62  return nullptr;
63  }
64 
65  //now the cases in which the detid is set
66 
67  if (!theGeomSearch) {
68  throw cms::Exception("MeasurementByLayerGrouper") << "Impossible to retrieve the det layer because it's not set in "
69  "the TM and the pointer to the GeometricSearchTracker is 0 ";
70  return nullptr;
71  }
72 
73  return theGeomSearch->detLayer(tm.recHit()->det()->geographicalId());
74 }

References Exception, TrajectoryMeasurement::layer(), LogDebug, and TrajectoryMeasurement::recHit().

◆ operator()()

vector< pair< const DetLayer *, vector< TrajectoryMeasurement > > > MeasurementByLayerGrouper::operator() ( const std::vector< TM > &  vtm) const

Definition at line 10 of file MeasurementByLayerGrouper.cc.

11  {
12  if (vtm.empty())
13  return vector<pair<const DetLayer*, vector<TM> > >();
14 
15  vector<pair<const DetLayer*, vector<TM> > > result;
16  result.reserve(vtm.size());
17 
18  vector<TM>::const_iterator start = vtm.begin();
19  //here we assume that the TM on the same detLayer are consecutive (as it should)
20  while (start != vtm.end()) {
21  vector<TM>::const_iterator ipart = start;
22  do {
23  ipart++;
24  } while (ipart != vtm.end() && getDetLayer(*start) == getDetLayer(*ipart) &&
25  getDetLayer(*start) != nullptr //the returned pointer will be 0 in case
26  //the measurement contains an invalid hit with no associated detid.
27  //This kind of hits are at most one per layer.
28  //this last condition avoids that 2 consecutive measurements of this kind
29  //are grouped in the same layer.
30  //it would be useful if invalid hit out of the active area were
31  //given the detid reserved for the whole layer instead of 0
32  );
33 
34  vector<TM> group(start, ipart);
35  result.push_back(pair<const DetLayer*, vector<TM> >(getDetLayer(*start), group));
36  start = ipart;
37  }
38 #ifdef debug_MeasurementByLayerGrouper_
39  for (vector<pair<const DetLayer*, vector<TM> > >::const_iterator iter = result.begin(); iter != result.end();
40  iter++) {
41  LogTrace("MeasurementByLayerGrouper|SiTrackerMultiRecHitUpdator")
42  << "DetLayer " << iter->first << " has " << iter->second.size() << " measurements";
43  }
44 #endif
45 
46  return result;
47 }

References getDetLayer(), watchdog::group, LogTrace, mps_fire::result, command_line::start, and trackerHitRTTI::vector.

Member Data Documentation

◆ theGeomSearch

const GeometricSearchTracker* MeasurementByLayerGrouper::theGeomSearch
private

Definition at line 16 of file MeasurementByLayerGrouper.h.

start
Definition: start.py:1
MeasurementByLayerGrouper::theGeomSearch
const GeometricSearchTracker * theGeomSearch
Definition: MeasurementByLayerGrouper.h:16
DetLayer
Definition: DetLayer.h:21
GeometricSearchTracker::detLayer
const DetLayer * detLayer(const DetId &id) const
obsolete method. Use idToLayer() instead.
Definition: GeometricSearchTracker.h:60
cond::persistency::search
std::vector< T >::const_iterator search(const cond::Time_t &val, const std::vector< T > &container)
Definition: IOVProxy.cc:21
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
Exception
Definition: hltDiff.cc:245
MeasurementByLayerGrouper::getDetLayer
const DetLayer * getDetLayer(const TM &tm) const
Definition: MeasurementByLayerGrouper.cc:49
mps_fire.result
result
Definition: mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
command_line.start
start
Definition: command_line.py:167
watchdog.group
group
Definition: watchdog.py:82