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 Member Functions | Private Attributes
SimpleDAFHitCollector Class Reference

#include <SimpleDAFHitCollector.h>

Inheritance diagram for SimpleDAFHitCollector:
MultiRecHitCollector

Public Member Functions

const MeasurementEstimatorgetEstimator () const
 
const PropagatorgetPropagator () const
 
const SiTrackerMultiRecHitUpdatorgetUpdator () const
 
virtual std::vector
< TrajectoryMeasurement
recHits (const Trajectory &, const MeasurementTrackerEvent *theMTE) const
 
 SimpleDAFHitCollector (const MeasurementTracker *measurementTracker, const SiTrackerMultiRecHitUpdator *updator, const MeasurementEstimator *est, const Propagator *propagator, bool debug)
 
virtual ~SimpleDAFHitCollector ()
 
- Public Member Functions inherited from MultiRecHitCollector
const MeasurementTrackergetMeasurementTracker () const
 
 MultiRecHitCollector (const MeasurementTracker *meas)
 

Private Member Functions

void buildMultiRecHits (const std::vector< TrajectoryMeasurement > &measgroup, std::vector< TrajectoryMeasurement > &result) const
 

Private Attributes

const bool debug_
 
const MeasurementEstimatortheEstimator
 
const PropagatorthePropagator
 
const SiTrackerMultiRecHitUpdatortheUpdator
 

Detailed Description

Definition at line 10 of file SimpleDAFHitCollector.h.

Constructor & Destructor Documentation

SimpleDAFHitCollector::SimpleDAFHitCollector ( const MeasurementTracker measurementTracker,
const SiTrackerMultiRecHitUpdator updator,
const MeasurementEstimator est,
const Propagator propagator,
bool  debug 
)
inlineexplicit

Definition at line 12 of file SimpleDAFHitCollector.h.

16  :MultiRecHitCollector(measurementTracker), theUpdator(updator), theEstimator(est), thePropagator(propagator), debug_(debug){}
const MeasurementEstimator * theEstimator
MultiRecHitCollector(const MeasurementTracker *meas)
const Propagator * thePropagator
#define debug
Definition: HDRShower.cc:19
const SiTrackerMultiRecHitUpdator * theUpdator
virtual SimpleDAFHitCollector::~SimpleDAFHitCollector ( )
inlinevirtual

Definition at line 19 of file SimpleDAFHitCollector.h.

19 {}

Member Function Documentation

void SimpleDAFHitCollector::buildMultiRecHits ( const std::vector< TrajectoryMeasurement > &  measgroup,
std::vector< TrajectoryMeasurement > &  result 
) const
private
const MeasurementEstimator* SimpleDAFHitCollector::getEstimator ( ) const
inline

Definition at line 31 of file SimpleDAFHitCollector.h.

References theEstimator.

31 {return theEstimator;}
const MeasurementEstimator * theEstimator
const Propagator* SimpleDAFHitCollector::getPropagator ( ) const
inline

Definition at line 32 of file SimpleDAFHitCollector.h.

References thePropagator.

32 {return thePropagator;}
const Propagator * thePropagator
const SiTrackerMultiRecHitUpdator* SimpleDAFHitCollector::getUpdator ( ) const
inline

Definition at line 30 of file SimpleDAFHitCollector.h.

References theUpdator.

30 {return theUpdator;}
const SiTrackerMultiRecHitUpdator * theUpdator
vector< TrajectoryMeasurement > SimpleDAFHitCollector::recHits ( const Trajectory traj,
const MeasurementTrackerEvent theMTE 
) const
virtual

Implements MultiRecHitCollector.

Definition at line 16 of file SimpleDAFHitCollector.cc.

References cond::rpcobimon::current, MeasurementDet::geomDet(), tracking::TempMeasurements::hits, i, MeasurementTrackerEvent::idToDet(), TrajectoryStateOnSurface::isValid(), LogTrace, MeasurementDetWithData::mdet(), MeasurementDetWithData::measurements(), Trajectory::measurements(), TrackingRecHit::missing, TrajectoryStateOnSurface::rescaleError(), query::result, and tracking::TempMeasurements::size().

16  {
17 
18  LogTrace("MultiRecHitCollector") << " Calling SimpleDAFHitCollector::recHits" << std::endl;
19 
20  //WARNING: At the moment the trajectories has the measurements
21  //with reversed sorting after the track smoothing
22  const vector<TrajectoryMeasurement>& meas = traj.measurements();
23 
24  if (meas.empty()) return vector<TrajectoryMeasurement>();
25 
26  //debug
27  LogTrace("MultiRecHitCollector") << "Original measurements are:";
28  for(vector<TrajectoryMeasurement>::const_iterator itrajmeas = meas.begin(); itrajmeas < meas.end();
29  itrajmeas++) {
30  if (itrajmeas->recHit()->isValid()){
31  LogTrace("MultiRecHitCollector") << " Valid Hit with DetId " << itrajmeas->recHit()->geographicalId().rawId()
32  << " local position " << itrajmeas->recHit()->hit()->localPosition()
33  << " global position " << itrajmeas->recHit()->hit()->globalPosition() ;
34  } else {
35  LogTrace("MultiRecHitCollector") << " Invalid Hit with DetId " << itrajmeas->recHit()->geographicalId().rawId();
36  }
37  }
38 
39  //groups the TrajectoryMeasurements on a sensor by sensor
40  //we have to sort the TrajectoryMeasurements in the opposite way in the fitting direction
41  vector<TrajectoryMeasurement> result;
42  for(vector<TrajectoryMeasurement>::const_reverse_iterator itrajmeas = meas.rbegin(); itrajmeas < meas.rend();
43  itrajmeas++) {
44 
45  DetId id = itrajmeas->recHit()->geographicalId();
46  MeasurementDetWithData measDet = theMTE->idToDet(id);
48  std::vector<const TrackingRecHit*> hits;
49 
50  TrajectoryStateOnSurface current = itrajmeas->updatedState();
51  //the error is scaled in order to take more "compatible" hits
52  if (current.isValid()) current.rescaleError(10);
53 
54  TrajectoryStateOnSurface state = itrajmeas->predictedState();
55  if (!state.isValid()){
56  LogTrace("MultiRecHitCollector") << "Something wrong! no valid TSOS found in current group ";
57  continue;
58  }
59  //collected hits compatible with the itrajmeas
60  if( measDet.measurements(current, *(getEstimator()), tmps)){
61  LogTrace("MultiRecHitCollector") << " Found " << tmps.size() << " compatible measurements";
62  for (std::size_t i=0; i!=tmps.size(); ++i){
63  DetId idtemps = tmps.hits[i]->geographicalId();
64 
65  if( idtemps == id && tmps.hits[i]->hit()->isValid() ) {
66  hits.push_back(tmps.hits[i]->hit());
67  }
68  }
69 
70  //I will keep the Invalid hit, IF this is not the first one
71  if (hits.empty()){
72  LogTrace("MultiRecHitCollector") << " -> but no valid hits found in current group.";
73 
74  if( result.empty() ) continue;
75 
76  result.push_back(TrajectoryMeasurement(state,
77  std::make_shared<InvalidTrackingRecHit>(measDet.mdet().geomDet(), TrackingRecHit::missing)));
78  } else {
79  //measurements in groups are sorted with increating chi2
80  //sort( *hits.begin(), *hits.end(), TrajMeasLessEstim());
81 
82  LogTrace("MultiRecHitCollector") << " -> " << hits.size() << " valid hits for this sensor.";
83 
84  //building a MultiRecHit out of each sensor group
85  result.push_back(TrajectoryMeasurement(state,theUpdator->buildMultiRecHit(hits, state)));
86  }
87  } else {
88  LogTrace("MultiRecHitCollector") << " No measurements found in current group.";
89 
90  if( result.empty() ) continue;
91 
92  result.push_back(TrajectoryMeasurement(state,
93  std::make_shared<InvalidTrackingRecHit>(measDet.mdet().geomDet(), TrackingRecHit::missing)));
94 
95  }
96 
97  }
98  LogTrace("MultiRecHitCollector") << " Ending SimpleDAFHitCollector::recHits >> " << result.size();
99 
100  //adding a protection against too few hits and invalid hits
101  //(due to failed propagation on the same surface of the original hits)
102  if (result.size()>2)
103  {
104  int hitcounter=0;
105  //check if the vector result has more than 3 valid hits
106  for (vector<TrajectoryMeasurement>::const_iterator iimeas = result.begin(); iimeas != result.end(); ++iimeas) {
107  if(iimeas->recHit()->isValid()) hitcounter++;
108  }
109 
110  if(hitcounter>2)
111  return result;
112  else return vector<TrajectoryMeasurement>();
113  }
114 
115  else{return vector<TrajectoryMeasurement>();}
116 
117 }
MeasurementDetWithData idToDet(const DetId &id) const
Previous MeasurementDetSystem interface.
int i
Definition: DBlmapReader.cc:9
const MeasurementEstimator * getEstimator() const
std::size_t size() const
virtual const GeomDet & geomDet() const
DataContainer const & measurements() const
Definition: Trajectory.h:203
virtual TransientTrackingRecHit::RecHitPointer buildMultiRecHit(const std::vector< const TrackingRecHit * > &rhv, const TrajectoryStateOnSurface &tsos, float annealing=1.) const
tuple result
Definition: query.py:137
const MeasurementDet & mdet() const
#define LogTrace(id)
Definition: DetId.h:18
bool measurements(const TrajectoryStateOnSurface &stateOnThisDet, const MeasurementEstimator &est, TempMeasurements &result) const
const SiTrackerMultiRecHitUpdator * theUpdator

Member Data Documentation

const bool SimpleDAFHitCollector::debug_
private

Definition at line 43 of file SimpleDAFHitCollector.h.

const MeasurementEstimator* SimpleDAFHitCollector::theEstimator
private

Definition at line 40 of file SimpleDAFHitCollector.h.

Referenced by getEstimator().

const Propagator* SimpleDAFHitCollector::thePropagator
private

Definition at line 42 of file SimpleDAFHitCollector.h.

Referenced by getPropagator().

const SiTrackerMultiRecHitUpdator* SimpleDAFHitCollector::theUpdator
private

Definition at line 39 of file SimpleDAFHitCollector.h.

Referenced by getUpdator().