CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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)
 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, const edm::Event &iEvent)
 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)
 
std::vector< TrajectoryMeasurementGroupgroupedMeasurements (const DetLayer *layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, const edm::Event &iEvent)
 
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)
 returns TMeasurements in a DetLayer compatible with the TSOS. More...
 
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...
 
 MTDDetLayerMeasurements (edm::InputTag mtdlabel, edm::ConsumesCollector &iC)
 
MTDRecHitContainer recHits (const DetLayer *layer)
 returns the rechits which are on the layer More...
 
MTDRecHitContainer recHits (const DetLayer *layer, const edm::Event &iEvent)
 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.

The class to access recHits and TrajectoryMeasurements from DetLayer.

Author
B. Tannenwald Adapted from RecoMuon version.

Definition at line 30 of file MTDDetLayerMeasurements.h.

Member Typedef Documentation

◆ DetWithState

Definition at line 33 of file MTDDetLayerMeasurements.h.

◆ MeasurementContainer

Definition at line 32 of file MTDDetLayerMeasurements.h.

◆ MTDRecHitContainer

Definition at line 34 of file MTDDetLayerMeasurements.h.

Constructor & Destructor Documentation

◆ MTDDetLayerMeasurements()

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

Definition at line 22 of file MTDDetLayerMeasurements.cc.

23  : theMTDRecHits(), theMTDEventCacheID(0), theEvent(nullptr) {
24  mtdToken_ = iC.consumes<MTDTrackingRecHit>(mtdlabel);
25 }

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

◆ ~MTDDetLayerMeasurements()

MTDDetLayerMeasurements::~MTDDetLayerMeasurements ( )
virtual

Definition at line 27 of file MTDDetLayerMeasurements.cc.

27 {}

Member Function Documentation

◆ checkEvent()

void MTDDetLayerMeasurements::checkEvent ( ) const
private

check that the event is set, and throw otherwise

Definition at line 194 of file MTDDetLayerMeasurements.cc.

194  {
195  if (!theEvent)
196  throw cms::Exception("MTDDetLayerMeasurements") << "The event has not been set";
197 }

References Exception, and theEvent.

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

◆ checkMTDRecHits()

void MTDDetLayerMeasurements::checkMTDRecHits ( )
private

Definition at line 50 of file MTDDetLayerMeasurements.cc.

50  {
51  LogDebug("Track|RecoMTD|MTDDetLayerMeasurements") << "Checking MTD RecHits";
52  checkEvent();
53  auto cacheID = theEvent->cacheIdentifier();
54  if (cacheID == theMTDEventCacheID)
55  return;
56 
57  {
59  theMTDEventCacheID = cacheID;
60  }
61  if (!theMTDRecHits.isValid()) {
62  throw cms::Exception("MTDDetLayerMeasurements") << "Cannot get MTD RecHits";
63  LogDebug("Track|RecoMTD|MTDDetLayerMeasurements") << "Cannot get MTD RecHits";
64  }
65 }

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

Referenced by recHits().

◆ fastMeasurements() [1/2]

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 145 of file MTDDetLayerMeasurements.cc.

149  {
150  checkEvent();
151  return fastMeasurements(layer, theStateOnDet, startingState, prop, est, *theEvent);
152 }

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

◆ fastMeasurements() [2/2]

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 122 of file MTDDetLayerMeasurements.cc.

127  {
129  MTDRecHitContainer rhs = recHits(layer, iEvent);
130  for (const MTDRecHitContainer::value_type& irh : rhs) {
131  MeasurementEstimator::HitReturnType estimate = est.estimate(theStateOnDet, (*irh));
132  if (estimate.first) {
133  result.push_back(TrajectoryMeasurement(theStateOnDet, irh, estimate.second, layer));
134  }
135  }
136 
137  if (!result.empty()) {
138  sort(result.begin(), result.end(), TrajMeasLessEstim());
139  }
140 
141  return result;
142 }

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

Referenced by fastMeasurements().

◆ groupedMeasurements() [1/2]

std::vector< TrajectoryMeasurementGroup > MTDDetLayerMeasurements::groupedMeasurements ( const DetLayer layer,
const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est 
)

Definition at line 154 of file MTDDetLayerMeasurements.cc.

158  {
159  checkEvent();
160  return groupedMeasurements(layer, startingState, prop, est, *theEvent);
161 }

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

◆ groupedMeasurements() [2/2]

std::vector< TrajectoryMeasurementGroup > MTDDetLayerMeasurements::groupedMeasurements ( const DetLayer layer,
const TrajectoryStateOnSurface startingState,
const Propagator prop,
const MeasurementEstimator est,
const edm::Event iEvent 
)

Definition at line 163 of file MTDDetLayerMeasurements.cc.

168  {
169  std::vector<TrajectoryMeasurementGroup> result;
170  // if we want to use the concept of InvalidRecHits,
171  // we can reuse LayerMeasurements from TrackingTools/MeasurementDet
172  std::vector<DetGroup> groups(layer->groupedCompatibleDets(startingState, prop, est));
173 
174  for (const auto& grp : groups) {
175  std::vector<TrajectoryMeasurement> groupMeasurements;
176  for (const auto& detAndStateItr : grp) {
177  std::vector<TrajectoryMeasurement> detMeasurements =
178  measurements(layer, detAndStateItr.det(), detAndStateItr.trajectoryState(), est, iEvent);
179  groupMeasurements.insert(groupMeasurements.end(), detMeasurements.begin(), detMeasurements.end());
180  }
181 
182  if (!groupMeasurements.empty())
183  std::sort(groupMeasurements.begin(), groupMeasurements.end(), TrajMeasLessEstim());
184 
185  result.push_back(TrajectoryMeasurementGroup(groupMeasurements, grp));
186  }
187 
188  return result;
189 }

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

Referenced by groupedMeasurements().

◆ measurements() [1/3]

MeasurementContainer MTDDetLayerMeasurements::measurements ( const DetLayer layer,
const GeomDet det,
const TrajectoryStateOnSurface stateOnDet,
const MeasurementEstimator est,
const edm::Event iEvent 
)

Definition at line 97 of file MTDDetLayerMeasurements.cc.

101  {
103 
104  // Get the Segments which relies on the GeomDet given by compatibleDets
106 
107  // Create the Trajectory Measurement
108  for (auto rechit = mtdRecHits.begin(); rechit != mtdRecHits.end(); ++rechit) {
109  MeasurementEstimator::HitReturnType estimate = est.estimate(stateOnDet, **rechit);
110  LogDebug("RecoMTD") << "Dimension: " << (*rechit)->dimension() << " Chi2: " << estimate.second << std::endl;
111  if (estimate.first) {
112  result.push_back(TrajectoryMeasurement(stateOnDet, *rechit, estimate.second, layer));
113  }
114  }
115 
116  if (!result.empty())
117  sort(result.begin(), result.end(), TrajMeasLessEstim());
118 
119  return result;
120 }

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

Referenced by groupedMeasurements(), and measurements().

◆ measurements() [2/3]

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 68 of file MTDDetLayerMeasurements.cc.

71  {
72  checkEvent();
73  return measurements(layer, startingState, prop, est, *theEvent);
74 }

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

◆ measurements() [3/3]

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 76 of file MTDDetLayerMeasurements.cc.

80  {
82 
83  std::vector<DetWithState> dss = layer->compatibleDets(startingState, prop, est);
84  LogDebug("RecoMTD") << "compatibleDets: " << dss.size() << std::endl;
85 
86  for (const auto& dws : dss) {
87  MeasurementContainer detMeasurements = measurements(layer, dws.first, dws.second, est, iEvent);
88  result.insert(result.end(), detMeasurements.begin(), detMeasurements.end());
89  }
90 
91  if (!result.empty())
92  sort(result.begin(), result.end(), TrajMeasLessEstim());
93 
94  return result;
95 }

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

◆ recHits() [1/3]

MTDRecHitContainer MTDDetLayerMeasurements::recHits ( const DetLayer layer)

returns the rechits which are on the layer

Definition at line 211 of file MTDDetLayerMeasurements.cc.

211  {
212  checkEvent();
213  return recHits(layer, *theEvent);
214 }

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

◆ recHits() [2/3]

MTDRecHitContainer MTDDetLayerMeasurements::recHits ( const DetLayer layer,
const edm::Event iEvent 
)

returns the rechits which are on the layer

Definition at line 199 of file MTDDetLayerMeasurements.cc.

199  {
200  MTDRecHitContainer rhs;
201 
202  std::vector<const GeomDet*> gds = layer->basicComponents();
203 
204  for (const GeomDet* igd : gds) {
205  MTDRecHitContainer detHits = recHits(igd, iEvent);
206  rhs.insert(rhs.end(), detHits.begin(), detHits.end());
207  }
208  return rhs;
209 }

References GeometricSearchDet::basicComponents(), and iEvent.

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

◆ recHits() [3/3]

MTDRecHitContainer MTDDetLayerMeasurements::recHits ( const GeomDet geomDet,
const edm::Event iEvent 
)
private

obtain TrackingRecHits from a DetLayer

Definition at line 29 of file MTDDetLayerMeasurements.cc.

29  {
30  DetId geoId = geomDet->geographicalId();
31  theEvent = &iEvent;
33 
35 
36  // Create the ChamberId
37  DetId detId(geoId.rawId());
38  LogDebug("Track|RecoMTD|MTDDetLayerMeasurements") << "(MTD): " << static_cast<MTDDetId>(detId) << std::endl;
39 
40  // Get the MTD-Segment which relies on this chamber
41  //auto cmp = [](const unsigned one, const unsigned two) -> bool { return one < two; };
42  auto detset = (*theMTDRecHits)[detId];
43 
44  for (const auto& rechit : detset)
45  result.push_back(GenericTransientTrackingRecHit::build(geomDet, &rechit));
46 
47  return result;
48 }

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

◆ setEvent()

void MTDDetLayerMeasurements::setEvent ( const edm::Event event)

set event

Definition at line 192 of file MTDDetLayerMeasurements.cc.

192 { theEvent = &event; }

References edmPickEvents::event, and theEvent.

Member Data Documentation

◆ mtdToken_

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

Definition at line 102 of file MTDDetLayerMeasurements.h.

Referenced by checkMTDRecHits(), and MTDDetLayerMeasurements().

◆ theEvent

const edm::Event* MTDDetLayerMeasurements::theEvent
private

◆ theMTDEventCacheID

edm::Event::CacheIdentifier_t MTDDetLayerMeasurements::theMTDEventCacheID
private

Definition at line 110 of file MTDDetLayerMeasurements.h.

Referenced by checkMTDRecHits().

◆ theMTDRecHits

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

Definition at line 105 of file MTDDetLayerMeasurements.h.

Referenced by checkMTDRecHits().

GeomDet
Definition: GeomDet.h:27
TrajMeasLessEstim
Definition: TrajMeasLessEstim.h:10
GeometricSearchDet::compatibleDets
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
Definition: GeometricSearchDet.cc:35
MTDDetLayerMeasurements::groupedMeasurements
std::vector< TrajectoryMeasurementGroup > groupedMeasurements(const DetLayer *layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, const edm::Event &iEvent)
Definition: MTDDetLayerMeasurements.cc:163
MeasurementEstimator::HitReturnType
std::pair< bool, double > HitReturnType
Definition: MeasurementEstimator.h:34
MeasurementContainer
std::vector< TrajectoryMeasurement > MeasurementContainer
Definition: RPCRecHitFilter.h:55
MeasurementEstimator::estimate
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
DetId
Definition: DetId.h:17
GeometricSearchDet::groupedCompatibleDets
virtual std::vector< DetGroup > groupedCompatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
Definition: GeometricSearchDet.cc:42
MTDDetLayerMeasurements::recHits
MTDRecHitContainer recHits(const DetLayer *layer, const edm::Event &iEvent)
returns the rechits which are on the layer
Definition: MTDDetLayerMeasurements.cc:199
MTDDetLayerMeasurements::fastMeasurements
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
Definition: MTDDetLayerMeasurements.cc:122
edm::Event::cacheIdentifier
CacheIdentifier_t cacheIdentifier() const
Definition: Event.cc:36
MTDDetLayerMeasurements::checkEvent
void checkEvent() const
check that the event is set, and throw otherwise
Definition: MTDDetLayerMeasurements.cc:194
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
mtdRecHits_cfi.mtdRecHits
mtdRecHits
Definition: mtdRecHits_cfi.py:19
MTDDetLayerMeasurements::checkMTDRecHits
void checkMTDRecHits()
Definition: MTDDetLayerMeasurements.cc:50
MTDDetLayerMeasurements::mtdToken_
edm::EDGetTokenT< MTDTrackingRecHit > mtdToken_
Definition: MTDDetLayerMeasurements.h:102
MTDDetLayerMeasurements::measurements
MeasurementContainer measurements(const DetLayer *layer, const GeomDet *det, const TrajectoryStateOnSurface &stateOnDet, const MeasurementEstimator &est, const edm::Event &iEvent)
Definition: MTDDetLayerMeasurements.cc:97
edmPickEvents.event
event
Definition: edmPickEvents.py:273
MTDTrackingRecHit
A 2D TrackerRecHit with time and time error information.
Definition: MTDTrackingRecHit.h:10
iEvent
int iEvent
Definition: GenABIO.cc:224
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
TrajectoryMeasurementGroup
Definition: TrajectoryMeasurementGroup.h:17
Exception
Definition: hltDiff.cc:246
MTDDetLayerMeasurements::theMTDEventCacheID
edm::Event::CacheIdentifier_t theMTDEventCacheID
Definition: MTDDetLayerMeasurements.h:110
MTDRecHitContainer
std::vector< GenericTransientTrackingRecHit::RecHitPointer > MTDRecHitContainer
Definition: MTDDetLayerMeasurements.cc:19
mps_fire.result
result
Definition: mps_fire.py:311
MTDDetLayerMeasurements::theMTDRecHits
edm::Handle< edmNew::DetSetVector< MTDTrackingRecHit > > theMTDRecHits
Definition: MTDDetLayerMeasurements.h:105
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
GeometricSearchDet::basicComponents
virtual const std::vector< const GeomDet * > & basicComponents() const =0
GenericTransientTrackingRecHit::build
static RecHitPointer build(const GeomDet *geom, const TrackingRecHit *rh)
Definition: GenericTransientTrackingRecHit.h:35
TrajectoryMeasurement
Definition: TrajectoryMeasurement.h:25
MTDDetLayerMeasurements::theEvent
const edm::Event * theEvent
Definition: MTDDetLayerMeasurements.h:112