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 (const 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...
 
template<class T >
T sortResult (T &)
 

Private Attributes

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

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 ( const edm::InputTag mtdlabel,
edm::ConsumesCollector iC 
)

Definition at line 22 of file MTDDetLayerMeasurements.cc.

23  : theMTDToken(iC.consumes<MTDTrackingRecHit>(mtdlabel)),
24  theMTDRecHits(),
26  theEvent(nullptr) {}
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::Event::CacheIdentifier_t theMTDEventCacheID
edm::Handle< edmNew::DetSetVector< MTDTrackingRecHit > > theMTDRecHits
edm::EDGetTokenT< MTDTrackingRecHit > theMTDToken
A 2D TrackerRecHit with time and time error information.

◆ ~MTDDetLayerMeasurements()

MTDDetLayerMeasurements::~MTDDetLayerMeasurements ( )
virtual

Definition at line 28 of file MTDDetLayerMeasurements.cc.

28 {}

Member Function Documentation

◆ checkEvent()

void MTDDetLayerMeasurements::checkEvent ( ) const
private

check that the event is set, and throw otherwise

Definition at line 189 of file MTDDetLayerMeasurements.cc.

References Exception, and theEvent.

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

189  {
190  if (!theEvent)
191  throw cms::Exception("MTDDetLayerMeasurements") << "The event has not been set";
192 }

◆ checkMTDRecHits()

void MTDDetLayerMeasurements::checkMTDRecHits ( )
private

Definition at line 50 of file MTDDetLayerMeasurements.cc.

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

Referenced by recHits().

50  {
51  LogDebug("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  }
64 }
edm::Event::CacheIdentifier_t theMTDEventCacheID
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
void checkEvent() const
check that the event is set, and throw otherwise
edm::Handle< edmNew::DetSetVector< MTDTrackingRecHit > > theMTDRecHits
edm::EDGetTokenT< MTDTrackingRecHit > theMTDToken
CacheIdentifier_t cacheIdentifier() const
Definition: Event.cc:37
bool isValid() const
Definition: HandleBase.h:70
#define LogDebug(id)

◆ fastMeasurements() [1/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 124 of file MTDDetLayerMeasurements.cc.

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

Referenced by fastMeasurements().

129  {
132  for (const auto& irh : rhs) {
133  MeasurementEstimator::HitReturnType estimate = est.estimate(theStateOnDet, (*irh));
134  if (estimate.first) {
135  result.push_back(TrajectoryMeasurement(theStateOnDet, irh, estimate.second, layer));
136  }
137  }
138 
139  return sortResult(result);
140 }
MTDRecHitContainer recHits(const DetLayer *layer, const edm::Event &iEvent)
returns the rechits which are on the layer
std::vector< GenericTransientTrackingRecHit::RecHitPointer > MTDRecHitContainer
constexpr std::array< uint8_t, layerIndexSize > layer
int iEvent
Definition: GenABIO.cc:224
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
std::vector< TrajectoryMeasurement > MeasurementContainer
std::pair< bool, double > HitReturnType

◆ fastMeasurements() [2/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 143 of file MTDDetLayerMeasurements.cc.

References checkEvent(), fastMeasurements(), phase1PixelTopology::layer, and theEvent.

147  {
148  checkEvent();
149  return fastMeasurements(layer, theStateOnDet, startingState, prop, est, *theEvent);
150 }
constexpr std::array< uint8_t, layerIndexSize > layer
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 ...
void checkEvent() const
check that the event is set, and throw otherwise

◆ groupedMeasurements() [1/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 161 of file MTDDetLayerMeasurements.cc.

References iEvent, phase1PixelTopology::layer, measurements(), mps_fire::result, and sortResult().

Referenced by groupedMeasurements().

166  {
167  std::vector<TrajectoryMeasurementGroup> result;
168  // if we want to use the concept of InvalidRecHits,
169  // we can reuse LayerMeasurements from TrackingTools/MeasurementDet
170  std::vector<DetGroup> groups(layer->groupedCompatibleDets(startingState, prop, est));
171 
172  for (const auto& grp : groups) {
173  std::vector<TrajectoryMeasurement> groupMeasurements;
174  for (const auto& detAndStateItr : grp) {
175  std::vector<TrajectoryMeasurement> detMeasurements =
176  measurements(layer, detAndStateItr.det(), detAndStateItr.trajectoryState(), est, iEvent);
177  groupMeasurements.insert(groupMeasurements.end(), detMeasurements.begin(), detMeasurements.end());
178  }
179 
180  result.push_back(TrajectoryMeasurementGroup(sortResult(groupMeasurements), grp));
181  }
182 
183  return result;
184 }
constexpr std::array< uint8_t, layerIndexSize > layer
int iEvent
Definition: GenABIO.cc:224
MeasurementContainer measurements(const DetLayer *layer, const GeomDet *det, const TrajectoryStateOnSurface &stateOnDet, const MeasurementEstimator &est, const edm::Event &iEvent)

◆ groupedMeasurements() [2/2]

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

Definition at line 152 of file MTDDetLayerMeasurements.cc.

References checkEvent(), groupedMeasurements(), phase1PixelTopology::layer, and theEvent.

156  {
157  checkEvent();
158  return groupedMeasurements(layer, startingState, prop, est, *theEvent);
159 }
std::vector< TrajectoryMeasurementGroup > groupedMeasurements(const DetLayer *layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, const edm::Event &iEvent)
constexpr std::array< uint8_t, layerIndexSize > layer
void checkEvent() const
check that the event is set, and throw otherwise

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

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

Referenced by groupedMeasurements(), and measurements().

106  {
108 
109  // Get the Segments which relies on the GeomDet given by compatibleDets
111 
112  // Create the Trajectory Measurement
113  for (const auto& rechit : mtdRecHits) {
114  MeasurementEstimator::HitReturnType estimate = est.estimate(stateOnDet, *rechit);
115  LogDebug("RecoMTD") << "Dimension: " << rechit->dimension() << " Chi2: " << estimate.second << std::endl;
116  if (estimate.first) {
117  result.push_back(TrajectoryMeasurement(stateOnDet, rechit, estimate.second, layer));
118  }
119  }
120 
121  return sortResult(result);
122 }
MTDRecHitContainer recHits(const DetLayer *layer, const edm::Event &iEvent)
returns the rechits which are on the layer
std::vector< GenericTransientTrackingRecHit::RecHitPointer > MTDRecHitContainer
constexpr std::array< uint8_t, layerIndexSize > layer
int iEvent
Definition: GenABIO.cc:224
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
std::vector< TrajectoryMeasurement > MeasurementContainer
std::pair< bool, double > HitReturnType
#define LogDebug(id)

◆ measurements() [2/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 84 of file MTDDetLayerMeasurements.cc.

References iEvent, phase1PixelTopology::layer, LogDebug, measurements(), mps_fire::result, and sortResult().

88  {
90 
91  const auto& dss = layer->compatibleDets(startingState, prop, est);
92  LogDebug("MTDDetLayerMeasurements") << "compatibleDets: " << dss.size() << std::endl;
93 
94  for (const auto& dws : dss) {
95  MeasurementContainer detMeasurements = measurements(layer, dws.first, dws.second, est, iEvent);
96  result.insert(result.end(), detMeasurements.begin(), detMeasurements.end());
97  }
98 
99  return sortResult(result);
100 }
constexpr std::array< uint8_t, layerIndexSize > layer
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< TrajectoryMeasurement > MeasurementContainer
#define LogDebug(id)

◆ measurements() [3/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 76 of file MTDDetLayerMeasurements.cc.

References checkEvent(), phase1PixelTopology::layer, measurements(), and theEvent.

79  {
80  checkEvent();
81  return measurements(layer, startingState, prop, est, *theEvent);
82 }
constexpr std::array< uint8_t, layerIndexSize > layer
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)

◆ recHits() [1/3]

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

returns the rechits which are on the layer

Definition at line 194 of file MTDDetLayerMeasurements.cc.

References iEvent, and phase1PixelTopology::layer.

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

194  {
195  MTDRecHitContainer rhs;
196 
197  std::vector<const GeomDet*> gds = layer->basicComponents();
198 
199  for (const GeomDet* igd : gds) {
200  MTDRecHitContainer detHits = recHits(igd, iEvent);
201  rhs.insert(rhs.end(), detHits.begin(), detHits.end());
202  }
203  return rhs;
204 }
MTDRecHitContainer recHits(const DetLayer *layer, const edm::Event &iEvent)
returns the rechits which are on the layer
std::vector< GenericTransientTrackingRecHit::RecHitPointer > MTDRecHitContainer
constexpr std::array< uint8_t, layerIndexSize > layer
int iEvent
Definition: GenABIO.cc:224

◆ recHits() [2/3]

MTDRecHitContainer MTDDetLayerMeasurements::recHits ( const DetLayer layer)

returns the rechits which are on the layer

Definition at line 206 of file MTDDetLayerMeasurements.cc.

References checkEvent(), phase1PixelTopology::layer, recHits(), and theEvent.

206  {
207  checkEvent();
208  return recHits(layer, *theEvent);
209 }
MTDRecHitContainer recHits(const DetLayer *layer, const edm::Event &iEvent)
returns the rechits which are on the layer
constexpr std::array< uint8_t, layerIndexSize > layer
void checkEvent() const
check that the event is set, and throw otherwise

◆ recHits() [3/3]

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

obtain TrackingRecHits from a DetLayer

Definition at line 30 of file MTDDetLayerMeasurements.cc.

References GenericTransientTrackingRecHit::build(), checkMTDRecHits(), GeomDet::geographicalId(), totem::nt2::vfat::geoId(), iEvent, LogDebug, mps_fire::result, and theEvent.

30  {
31  DetId geoId = geomDet->geographicalId();
32  theEvent = &iEvent;
34 
36 
37  // Create the ChamberId
38  DetId detId(geoId.rawId());
39  LogDebug("MTDDetLayerMeasurements") << "(MTD): " << static_cast<MTDDetId>(detId) << std::endl;
40 
41  // Get the MTD-Segment which relies on this chamber
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 }
uint8_t geoId(const VFATFrame &frame)
retrieve the GEO information for this channel
std::vector< GenericTransientTrackingRecHit::RecHitPointer > MTDRecHitContainer
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
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:64
Definition: DetId.h:17
#define LogDebug(id)

◆ setEvent()

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

set event

Definition at line 187 of file MTDDetLayerMeasurements.cc.

References edmPickEvents::event, and theEvent.

◆ sortResult()

template<class T >
T MTDDetLayerMeasurements::sortResult ( T result)
private

Definition at line 67 of file MTDDetLayerMeasurements.cc.

References mps_fire::result, and jetUpdater_cfi::sort.

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

67  {
68  if (!result.empty()) {
69  sort(result.begin(), result.end(), TrajMeasLessEstim());
70  }
71 
72  return result;
73 }

Member Data Documentation

◆ theEvent

const edm::Event* MTDDetLayerMeasurements::theEvent
private

◆ theMTDEventCacheID

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

Definition at line 114 of file MTDDetLayerMeasurements.h.

Referenced by checkMTDRecHits().

◆ theMTDRecHits

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

Definition at line 109 of file MTDDetLayerMeasurements.h.

Referenced by checkMTDRecHits().

◆ theMTDToken

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

Definition at line 106 of file MTDDetLayerMeasurements.h.

Referenced by checkMTDRecHits().