CMS 3D CMS Logo

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

#include <MTDDetLayerMeasurements.h>

Public Types

typedef std::pair< const GeomDet *, TrajectoryStateOnSurfaceDetWithState
 
typedef std::vector< TrajectoryMeasurementMeasurementContainer
 
typedef std::vector< GenericTransientTrackingRecHit::RecHitPointerMTDRecHitContainer
 

Public Member Functions

MeasurementContainer fastMeasurements (const DetLayer *layer, const TrajectoryStateOnSurface &theStateOnDet, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, const edm::Event &iEvent)
 faster version in case the TrajectoryState on the surface of the GeomDet is already available More...
 
MeasurementContainer fastMeasurements (const DetLayer *layer, const TrajectoryStateOnSurface &theStateOnDet, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est)
 faster version in case the TrajectoryState on the surface of the GeomDet is already available More...
 
std::vector< TrajectoryMeasurementGroupgroupedMeasurements (const DetLayer *layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, const edm::Event &iEvent)
 
std::vector< TrajectoryMeasurementGroupgroupedMeasurements (const DetLayer *layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est)
 
MeasurementContainer measurements (const DetLayer *layer, const GeomDet *det, const TrajectoryStateOnSurface &stateOnDet, const MeasurementEstimator &est, const edm::Event &iEvent)
 
MeasurementContainer measurements (const DetLayer *layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, const edm::Event &iEvent)
 returns TMeasurements in a DetLayer compatible with the TSOS. More...
 
MeasurementContainer measurements (const DetLayer *layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est)
 returns TMeasurements in a DetLayer compatible with the TSOS. More...
 
 MTDDetLayerMeasurements (edm::InputTag mtdlabel, edm::ConsumesCollector &iC)
 
MTDRecHitContainer recHits (const DetLayer *layer, const edm::Event &iEvent)
 returns the rechits which are on the layer More...
 
MTDRecHitContainer recHits (const DetLayer *layer)
 returns the rechits which are on the layer More...
 
void setEvent (const edm::Event &)
 set event More...
 
virtual ~MTDDetLayerMeasurements ()
 

Private Member Functions

void checkEvent () const
 check that the event is set, and throw otherwise More...
 
void checkMTDRecHits ()
 
MTDRecHitContainer recHits (const GeomDet *, const edm::Event &iEvent)
 obtain TrackingRecHits from a DetLayer More...
 

Private Attributes

edm::EDGetTokenT< MTDTrackingRecHitmtdToken_
 
const edm::EventtheEvent
 
edm::Event::CacheIdentifier_t theMTDEventCacheID
 
edm::Handle< edmNew::DetSetVector< MTDTrackingRecHit > > theMTDRecHits
 

Detailed Description

The class to access recHits and TrajectoryMeasurements from DetLayer.

Author
B. Tannenwald Adapted from RecoMuon version.

Definition at line 32 of file MTDDetLayerMeasurements.h.

Member Typedef Documentation

Definition at line 35 of file MTDDetLayerMeasurements.h.

Definition at line 34 of file MTDDetLayerMeasurements.h.

Definition at line 36 of file MTDDetLayerMeasurements.h.

Constructor & Destructor Documentation

MTDDetLayerMeasurements::MTDDetLayerMeasurements ( edm::InputTag  mtdlabel,
edm::ConsumesCollector iC 
)

Definition at line 23 of file MTDDetLayerMeasurements.cc.

References edm::ConsumesCollector::consumes(), and mtdToken_.

24  :
25  theMTDRecHits(),
27  theEvent(nullptr)
28 {
29  mtdToken_ = iC.consumes<MTDTrackingRecHit>(mtdlabel);
30 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::Event::CacheIdentifier_t theMTDEventCacheID
edm::Handle< edmNew::DetSetVector< MTDTrackingRecHit > > theMTDRecHits
edm::EDGetTokenT< MTDTrackingRecHit > mtdToken_
A 2D TrackerRecHit with time and time error information.
MTDDetLayerMeasurements::~MTDDetLayerMeasurements ( )
virtual

Definition at line 32 of file MTDDetLayerMeasurements.cc.

32 {}

Member Function Documentation

void MTDDetLayerMeasurements::checkEvent ( ) const
private

check that the event is set, and throw otherwise

Definition at line 226 of file MTDDetLayerMeasurements.cc.

References Exception, and theEvent.

Referenced by checkMTDRecHits(), fastMeasurements(), groupedMeasurements(), measurements(), and recHits().

226  {
227  if(!theEvent)
228  throw cms::Exception("MTDDetLayerMeasurements") << "The event has not been set";
229 }
void MTDDetLayerMeasurements::checkMTDRecHits ( )
private

Definition at line 57 of file MTDDetLayerMeasurements.cc.

References edm::Event::cacheIdentifier(), checkEvent(), Exception, edm::Event::getByToken(), edm::HandleBase::isValid(), LogDebug, mtdToken_, theEvent, theMTDEventCacheID, and theMTDRecHits.

Referenced by recHits().

58 {
59  LogDebug("Track|RecoMTD|MTDDetLayerMeasurements") << "Checking MTD RecHits";
60  checkEvent();
61  auto cacheID = theEvent->cacheIdentifier();
62  if (cacheID == theMTDEventCacheID) return;
63 
64  {
66  theMTDEventCacheID = cacheID;
67  }
68  if(!theMTDRecHits.isValid())
69  {
70  throw cms::Exception("MTDDetLayerMeasurements") << "Cannot get MTD RecHits";
71  LogDebug("Track|RecoMTD|MTDDetLayerMeasurements") << "Cannot get MTD RecHits";
72  }
73 }
#define LogDebug(id)
void checkEvent() const
check that the event is set, and throw otherwise
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::Event::CacheIdentifier_t theMTDEventCacheID
CacheIdentifier_t cacheIdentifier() const
Definition: Event.cc:35
edm::Handle< edmNew::DetSetVector< MTDTrackingRecHit > > theMTDRecHits
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< MTDTrackingRecHit > mtdToken_
MeasurementContainer MTDDetLayerMeasurements::fastMeasurements ( const DetLayer layer,
const TrajectoryStateOnSurface theStateOnDet,
const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est,
const edm::Event iEvent 
)

faster version in case the TrajectoryState on the surface of the GeomDet is already available

Definition at line 143 of file MTDDetLayerMeasurements.cc.

References MeasurementEstimator::estimate(), recHits(), mps_fire::result, and jetUpdater_cfi::sort.

Referenced by fastMeasurements().

148  {
150  MTDRecHitContainer rhs = recHits(layer, iEvent);
151  for (MTDRecHitContainer::value_type irh: rhs) {
152  MeasurementEstimator::HitReturnType estimate = est.estimate(theStateOnDet, (*irh));
153  if (estimate.first)
154  {
155  result.push_back(TrajectoryMeasurement(theStateOnDet,irh,
156  estimate.second,layer));
157  }
158  }
159 
160  if (!result.empty()) {
161  sort( result.begin(), result.end(), TrajMeasLessEstim());
162  }
163 
164  return result;
165 }
MTDRecHitContainer recHits(const DetLayer *layer, const edm::Event &iEvent)
returns the rechits which are on the layer
std::vector< GenericTransientTrackingRecHit::RecHitPointer > MTDRecHitContainer
std::pair< bool, double > HitReturnType
std::vector< TrajectoryMeasurement > MeasurementContainer
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
MeasurementContainer MTDDetLayerMeasurements::fastMeasurements ( const DetLayer layer,
const TrajectoryStateOnSurface theStateOnDet,
const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est 
)

faster version in case the TrajectoryState on the surface of the GeomDet is already available

fastMeasurements method if already got the Event

Definition at line 169 of file MTDDetLayerMeasurements.cc.

References checkEvent(), fastMeasurements(), and theEvent.

173  {
174  checkEvent();
175  return fastMeasurements(layer, theStateOnDet, startingState, prop, est, *theEvent);
176 }
void checkEvent() const
check that the event is set, and throw otherwise
MeasurementContainer fastMeasurements(const DetLayer *layer, const TrajectoryStateOnSurface &theStateOnDet, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, const edm::Event &iEvent)
faster version in case the TrajectoryState on the surface of the GeomDet is already available ...
std::vector< TrajectoryMeasurementGroup > MTDDetLayerMeasurements::groupedMeasurements ( const DetLayer layer,
const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est,
const edm::Event iEvent 
)

Definition at line 190 of file MTDDetLayerMeasurements.cc.

References GeometricSearchDet::groupedCompatibleDets(), iEvent, measurements(), mps_fire::result, and jetUpdater_cfi::sort.

Referenced by groupedMeasurements().

194  {
195 
196  std::vector<TrajectoryMeasurementGroup> result;
197  // if we want to use the concept of InvalidRecHits,
198  // we can reuse LayerMeasurements from TrackingTools/MeasurementDet
199  std::vector<DetGroup> groups(layer->groupedCompatibleDets(startingState, prop, est));
200 
201  for (const auto& grp : groups) {
202 
203  std::vector<TrajectoryMeasurement> groupMeasurements;
204  for (const auto& detAndStateItr : grp) {
205 
206  std::vector<TrajectoryMeasurement> detMeasurements
207  = measurements(layer, detAndStateItr.det(), detAndStateItr.trajectoryState(), est, iEvent);
208  groupMeasurements.insert(groupMeasurements.end(), detMeasurements.begin(), detMeasurements.end());
209  }
210 
211  if (!groupMeasurements.empty())
212  std::sort( groupMeasurements.begin(), groupMeasurements.end(), TrajMeasLessEstim());
213 
214  result.push_back(TrajectoryMeasurementGroup(groupMeasurements, grp));
215  }
216 
217  return result;
218 }
virtual std::vector< DetGroup > groupedCompatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
int iEvent
Definition: GenABIO.cc:224
MeasurementContainer measurements(const DetLayer *layer, const GeomDet *det, const TrajectoryStateOnSurface &stateOnDet, const MeasurementEstimator &est, const edm::Event &iEvent)
std::vector< TrajectoryMeasurementGroup > MTDDetLayerMeasurements::groupedMeasurements ( const DetLayer layer,
const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est 
)

Definition at line 180 of file MTDDetLayerMeasurements.cc.

References checkEvent(), groupedMeasurements(), and theEvent.

183  {
184  checkEvent();
185  return groupedMeasurements(layer, startingState, prop, est, *theEvent);
186 }
void checkEvent() const
check that the event is set, and throw otherwise
std::vector< TrajectoryMeasurementGroup > groupedMeasurements(const DetLayer *layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, const edm::Event &iEvent)
MeasurementContainer MTDDetLayerMeasurements::measurements ( const DetLayer layer,
const GeomDet det,
const TrajectoryStateOnSurface stateOnDet,
const MeasurementEstimator est,
const edm::Event iEvent 
)

Definition at line 112 of file MTDDetLayerMeasurements.cc.

References MeasurementEstimator::estimate(), LogDebug, mtdRecHits_cfi::mtdRecHits, recHits(), mps_fire::result, and jetUpdater_cfi::sort.

Referenced by groupedMeasurements(), and measurements().

116  {
118 
119  // Get the Segments which relies on the GeomDet given by compatibleDets
120  MTDRecHitContainer mtdRecHits = recHits(det, iEvent);
121 
122  // Create the Trajectory Measurement
123  for(auto rechit = mtdRecHits.begin();
124  rechit != mtdRecHits.end(); ++rechit) {
125 
126  MeasurementEstimator::HitReturnType estimate = est.estimate(stateOnDet,**rechit);
127  LogDebug("RecoMTD")<<"Dimension: "<<(*rechit)->dimension()
128  <<" Chi2: "<<estimate.second<<std::endl;
129  if (estimate.first) {
130  result.push_back(TrajectoryMeasurement(stateOnDet, *rechit,
131  estimate.second,layer));
132  }
133  }
134 
135  if (!result.empty()) sort( result.begin(), result.end(), TrajMeasLessEstim());
136 
137  return result;
138 }
#define LogDebug(id)
MTDRecHitContainer recHits(const DetLayer *layer, const edm::Event &iEvent)
returns the rechits which are on the layer
std::vector< GenericTransientTrackingRecHit::RecHitPointer > MTDRecHitContainer
std::pair< bool, double > HitReturnType
std::vector< TrajectoryMeasurement > MeasurementContainer
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
MeasurementContainer MTDDetLayerMeasurements::measurements ( const DetLayer layer,
const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est,
const edm::Event iEvent 
)

returns TMeasurements in a DetLayer compatible with the TSOS.

Definition at line 87 of file MTDDetLayerMeasurements.cc.

References GeometricSearchDet::compatibleDets(), LogDebug, measurements(), mps_fire::result, and jetUpdater_cfi::sort.

91  {
92 
94 
95  std::vector<DetWithState> dss = layer->compatibleDets(startingState, prop, est);
96  LogDebug("RecoMTD")<<"compatibleDets: "<<dss.size()<<std::endl;
97 
98  for(const auto& dws: dss) {
99 
100  MeasurementContainer detMeasurements
101  = measurements(layer, dws.first, dws.second, est, iEvent);
102  result.insert(result.end(), detMeasurements.begin(), detMeasurements.end());
103  }
104 
105  if (!result.empty()) sort( result.begin(), result.end(), TrajMeasLessEstim());
106 
107  return result;
108 }
#define LogDebug(id)
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
MeasurementContainer measurements(const DetLayer *layer, const GeomDet *det, const TrajectoryStateOnSurface &stateOnDet, const MeasurementEstimator &est, const edm::Event &iEvent)
std::vector< TrajectoryMeasurement > MeasurementContainer
MeasurementContainer MTDDetLayerMeasurements::measurements ( const DetLayer layer,
const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est 
)

returns TMeasurements in a DetLayer compatible with the TSOS.

measurements method if already got the Event

Definition at line 77 of file MTDDetLayerMeasurements.cc.

References checkEvent(), measurements(), and theEvent.

80  {
81  checkEvent();
82  return measurements(layer, startingState, prop, est, *theEvent);
83 }
void checkEvent() const
check that the event is set, and throw otherwise
MeasurementContainer measurements(const DetLayer *layer, const GeomDet *det, const TrajectoryStateOnSurface &stateOnDet, const MeasurementEstimator &est, const edm::Event &iEvent)
MTDRecHitContainer MTDDetLayerMeasurements::recHits ( const DetLayer layer,
const edm::Event iEvent 
)

returns the rechits which are on the layer

Definition at line 231 of file MTDDetLayerMeasurements.cc.

References GeometricSearchDet::basicComponents().

Referenced by fastMeasurements(), measurements(), and recHits().

232  {
233  MTDRecHitContainer rhs;
234 
235  std::vector <const GeomDet*> gds = layer->basicComponents();
236 
237  for (const GeomDet* igd : gds) {
238  MTDRecHitContainer detHits = recHits(igd, iEvent);
239  rhs.insert(rhs.end(), detHits.begin(), detHits.end());
240  }
241  return rhs;
242 }
MTDRecHitContainer recHits(const DetLayer *layer, const edm::Event &iEvent)
returns the rechits which are on the layer
virtual const std::vector< const GeomDet * > & basicComponents() const =0
std::vector< GenericTransientTrackingRecHit::RecHitPointer > MTDRecHitContainer
MTDRecHitContainer MTDDetLayerMeasurements::recHits ( const DetLayer layer)

returns the rechits which are on the layer

Definition at line 244 of file MTDDetLayerMeasurements.cc.

References checkEvent(), recHits(), and theEvent.

245 {
246  checkEvent();
247  return recHits(layer, *theEvent);
248 }
MTDRecHitContainer recHits(const DetLayer *layer, const edm::Event &iEvent)
returns the rechits which are on the layer
void checkEvent() const
check that the event is set, and throw otherwise
MTDRecHitContainer MTDDetLayerMeasurements::recHits ( const GeomDet geomDet,
const edm::Event iEvent 
)
private

obtain TrackingRecHits from a DetLayer

Definition at line 34 of file MTDDetLayerMeasurements.cc.

References GenericTransientTrackingRecHit::build(), checkMTDRecHits(), GeomDet::geographicalId(), iEvent, LogDebug, DetId::rawId(), mps_fire::result, and theEvent.

36 {
37  DetId geoId = geomDet->geographicalId();
38  theEvent = &iEvent;
40 
42 
43  // Create the ChamberId
44  DetId detId(geoId.rawId());
45  LogDebug("Track|RecoMTD|MTDDetLayerMeasurements") << "(MTD): "<<detId<<std::endl;
46 
47  // Get the MTD-Segment which relies on this chamber
48  //auto cmp = [](const unsigned one, const unsigned two) -> bool { return one < two; };
49  auto detset = (*theMTDRecHits)[detId];
50 
51  for (const auto & rechit : detset)
52  result.push_back(GenericTransientTrackingRecHit::build(geomDet, &rechit));
53 
54  return result;
55 }
#define LogDebug(id)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
std::vector< GenericTransientTrackingRecHit::RecHitPointer > MTDRecHitContainer
int iEvent
Definition: GenABIO.cc:224
static RecHitPointer build(const GeomDet *geom, const TrackingRecHit *rh)
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:79
Definition: DetId.h:18
void MTDDetLayerMeasurements::setEvent ( const edm::Event event)

set event

Definition at line 221 of file MTDDetLayerMeasurements.cc.

References event(), and theEvent.

221  {
222  theEvent = &event;
223 }
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past

Member Data Documentation

edm::EDGetTokenT<MTDTrackingRecHit> MTDDetLayerMeasurements::mtdToken_
private

Definition at line 115 of file MTDDetLayerMeasurements.h.

Referenced by checkMTDRecHits(), and MTDDetLayerMeasurements().

const edm::Event* MTDDetLayerMeasurements::theEvent
private
edm::Event::CacheIdentifier_t MTDDetLayerMeasurements::theMTDEventCacheID
private

Definition at line 123 of file MTDDetLayerMeasurements.h.

Referenced by checkMTDRecHits().

edm::Handle<edmNew::DetSetVector<MTDTrackingRecHit> > MTDDetLayerMeasurements::theMTDRecHits
private

Definition at line 118 of file MTDDetLayerMeasurements.h.

Referenced by checkMTDRecHits().