CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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=0)
 
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

Definition at line 17 of file MeasurementByLayerGrouper.h.

Constructor & Destructor Documentation

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

Definition at line 24 of file MeasurementByLayerGrouper.h.

24 :theGeomSearch(search){};
const GeometricSearchTracker * theGeomSearch

Member Function Documentation

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

Definition at line 53 of file MeasurementByLayerGrouper.cc.

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

53  {
54  // if the DetLayer is set in the TM...
55  if (tm.layer()) return tm.layer();
56 
57  //if it corresponds to an invalid hit with no geomdet associated
58  //we can't retrieve the DetLayer
59  //because unfortunately the detlayer is not set in these cases
60  //returns 0 for the moment
61  //to be revisited
62 
63  if (tm.recHit()->det()==0){
64  LogDebug("MeasurementByLayerGrouper") <<"This hit has no geomdet associated skipping... ";
65  return 0;
66  }
67 
68  //now the cases in which the detid is set
69 
70  if (!theGeomSearch) {
71  throw cms::Exception("MeasurementByLayerGrouper") << "Impossible to retrieve the det layer because it's not set in the TM and the pointer to the GeometricSearchTracker is 0 ";
72  return 0;
73  }
74 
75  return theGeomSearch->detLayer(tm.recHit()->det()->geographicalId());
76 }
#define LogDebug(id)
const DetLayer * detLayer(const DetId &id) const
obsolete method. Use idToLayer() instead.
const GeometricSearchTracker * theGeomSearch
vector< pair< const DetLayer *, vector< TrajectoryMeasurement > > > MeasurementByLayerGrouper::operator() ( const std::vector< TM > &  vtm) const

Definition at line 12 of file MeasurementByLayerGrouper.cc.

References getDetLayer(), LogTrace, and query::result.

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

Member Data Documentation

const GeometricSearchTracker* MeasurementByLayerGrouper::theGeomSearch
private

Definition at line 18 of file MeasurementByLayerGrouper.h.