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 Attributes
LayerMeasurements Class Reference

#include <LayerMeasurements.h>

Public Member Functions

void addInvalidMeas (std::vector< TrajectoryMeasurement > &measVec, const DetGroup &group, const DetLayer &layer) const
 
std::vector
< TrajectoryMeasurementGroup
groupedMeasurements (const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
 
 LayerMeasurements (const MeasurementDetSystem *detSysytem)
 
std::vector
< TrajectoryMeasurement
measurements (const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
 

Private Attributes

const MeasurementDetSystemtheDetSystem
 

Detailed Description

Definition at line 16 of file LayerMeasurements.h.

Constructor & Destructor Documentation

LayerMeasurements::LayerMeasurements ( const MeasurementDetSystem detSysytem)
inline

Definition at line 19 of file LayerMeasurements.h.

19  :
20  theDetSystem (detSysytem) {}
const MeasurementDetSystem * theDetSystem

Member Function Documentation

void LayerMeasurements::addInvalidMeas ( std::vector< TrajectoryMeasurement > &  measVec,
const DetGroup group,
const DetLayer layer 
) const

Definition at line 112 of file LayerMeasurements.cc.

References InvalidTransientRecHit::build(), and TrackingRecHit::missing.

115 {
116  if (!measVec.empty()) {
117  // invalidMeas on Det of most compatible hit
118  measVec.push_back( TrajectoryMeasurement( measVec.front().predictedState(),
119  InvalidTransientRecHit::build(measVec.front().recHit()->det(), TrackingRecHit::missing),
120  0.,&layer));
121  }
122  else if (!group.empty()) {
123  // invalid state on first compatible Det
124  measVec.push_back( TrajectoryMeasurement( group.front().trajectoryState(),
125  InvalidTransientRecHit::build(group.front().det(), TrackingRecHit::missing), 0.,&layer));
126  }
127 }
static RecHitPointer build(const GeomDet *geom, Type type=TrackingRecHit::missing, const DetLayer *layer=0)
vector< TrajectoryMeasurementGroup > LayerMeasurements::groupedMeasurements ( const DetLayer layer,
const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est 
) const

Definition at line 50 of file LayerMeasurements.cc.

References InvalidTransientRecHit::build(), GeometricSearchDet::compatible(), MeasurementDet::fastMeasurements(), GeometricSearchDet::groupedCompatibleDets(), TrackingRecHit::inactive, LogDebug, TrackingRecHit::missing, query::result, python.multivaluedict::sort(), and tmp.

54 {
55  vector<TrajectoryMeasurementGroup> result;
56 
57  {
58  vector<DetGroup> groups( layer.groupedCompatibleDets( startingState, prop, est));
59  result.reserve(groups.size());
60  for (vector<DetGroup>::const_iterator grp=groups.begin(); grp!=groups.end(); grp++) {
61  if ( grp->empty() ) continue;
62 
63  vector<TrajectoryMeasurement> tmpVec;
64  for (DetGroup::const_iterator idet=grp->begin(); idet!=grp->end(); idet++) {
65  const MeasurementDet* mdet = theDetSystem->idToDet(idet->det()->geographicalId());
66  if (mdet == 0) {
67  throw MeasurementDetException( "MeasurementDet not found");
68  }
69  vector<TrajectoryMeasurement> tmp =
70  mdet->fastMeasurements( idet->trajectoryState(), startingState, prop, est);
71  if (!tmp.empty()) {
72  // only collect valid RecHits
73 
74  if(tmp.back().recHit()->getType() == TrackingRecHit::missing) tmp.pop_back();
75 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
76  tmpVec.insert( tmpVec.end(), std::make_move_iterator(tmp.begin()), std::make_move_iterator(tmp.end()));
77 #else
78  tmpVec.insert( tmpVec.end(), tmp.begin(), tmp.end());
79 #endif
80  }
81  }
82 
83  for(vector<TrajectoryMeasurement>::iterator tmpIt=tmpVec.begin();tmpIt!=tmpVec.end();tmpIt++){
84  LogDebug("LayerMeasurements")<<"[grouped] temporaryly adding a measurement which rechit is: "<<(tmpIt->recHit()->isValid()?"valid":"invalid");
85  tmpIt->setLayer(&layer);
86  }
87 
88 
89  // sort the final result
90  sort( tmpVec.begin(), tmpVec.end(), TrajMeasLessEstim());
91  addInvalidMeas( tmpVec, *grp,layer);
92 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
93  result.push_back( TrajectoryMeasurementGroup( std::move(tmpVec), std::move(*grp)));
94 #else
95  result.push_back( TrajectoryMeasurementGroup( tmpVec, *grp));
96 #endif
97  }
98  }
99 
100  // if the result is empty check if the layer is compatible (for invalid measurement)
101  if (result.empty()) {
102  pair<bool, TrajectoryStateOnSurface> compat = layer.compatible( startingState, prop, est);
103  if ( compat.first) {
104  TrajectoryMeasurement inval( compat.second, InvalidTransientRecHit::build(0, TrackingRecHit::inactive,&layer), 0.F,&layer);
105  vector<TrajectoryMeasurement> tmVec(1,inval);
106  result.push_back( TrajectoryMeasurementGroup( tmVec, DetGroup()));
107  }
108  }
109  return result;
110 }
#define LogDebug(id)
virtual std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const =0
static RecHitPointer build(const GeomDet *geom, Type type=TrackingRecHit::missing, const DetLayer *layer=0)
virtual std::vector< DetGroup > groupedCompatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
tuple result
Definition: query.py:137
virtual std::vector< TrajectoryMeasurement > fastMeasurements(const TrajectoryStateOnSurface &stateOnThisDet, const TrajectoryStateOnSurface &startingState, const Propagator &, const MeasurementEstimator &) const =0
void addInvalidMeas(std::vector< TrajectoryMeasurement > &measVec, const DetGroup &group, const DetLayer &layer) const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
const MeasurementDetSystem * theDetSystem
virtual const MeasurementDet * idToDet(const DetId &id) const =0
Return the pointer to the MeasurementDet corresponding to a given DetId.
vector< TrajectoryMeasurement > LayerMeasurements::measurements ( const DetLayer layer,
const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est 
) const

Definition at line 14 of file LayerMeasurements.cc.

References InvalidTransientRecHit::build(), GeometricSearchDet::compatible(), GeometricSearchDet::compatibleDets(), GeometricSearchDetMeasurements::get(), TrackingRecHit::inactive, LogDebug, and query::result.

Referenced by HitEff::analyze(), MuonCkfTrajectoryBuilder::collectMeasurement(), OutInConversionSeedFinder::completeSeed(), InOutConversionSeedFinder::completeSeed(), CkfTrajectoryBuilder::findCompatibleMeasurements(), HICTrajectoryBuilder::findCompatibleMeasurements(), TSGFromPropagation::findMeasurements(), FastTSGFromPropagation::findMeasurements(), NuclearInteractionFinder::findMeasurementsFromTSOS(), SiStripElectronSeedGenerator::findSeedsFromCluster(), CosmicTrackingRegion::hits(), RectangularEtaPhiTrackingRegion::hits(), PixelMatchNextLayers::PixelMatchNextLayers(), and OutInConversionSeedFinder::startSeed().

18 {
20  vector<DetWithState> compatDets = layer.compatibleDets( startingState, prop, est);
21 
22  vector<TrajectoryMeasurement> result;
23  if (compatDets.empty()) {
24  pair<bool, TrajectoryStateOnSurface> compat =
25  layer.compatible( startingState, prop, est);
26 
27 
28  if ( compat.first) {
29  result.push_back( TrajectoryMeasurement( compat.second,
31  &layer));
32  LogDebug("LayerMeasurements")<<"adding a missing hit.";
33  }else LogDebug("LayerMeasurements")<<"adding not measurement.";
34  return result;
35  }
36 
38  vector<TrajectoryMeasurement> tmpResult = gsdm.get( layer, compatDets, startingState, prop, est);
39 
40  for(vector<TrajectoryMeasurement>::const_iterator tmpIt=tmpResult.begin();tmpIt!=tmpResult.end();tmpIt++){
41  LogDebug("LayerMeasurements")<<"adding a measurement which rechit is: "<<(tmpIt->recHit()->isValid()?"valid":"invalid");
42  result.push_back( TrajectoryMeasurement(tmpIt->predictedState(),tmpIt->recHit(),tmpIt->estimate(),&layer) );
43  }
44 
45  return result;
46 }
#define LogDebug(id)
virtual std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const =0
static RecHitPointer build(const GeomDet *geom, Type type=TrackingRecHit::missing, const DetLayer *layer=0)
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
tuple result
Definition: query.py:137
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
const MeasurementDetSystem * theDetSystem
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState

Member Data Documentation

const MeasurementDetSystem* LayerMeasurements::theDetSystem
private

Definition at line 41 of file LayerMeasurements.h.