CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CSCSegment Class Referencefinal

#include <CSCSegment.h>

Inheritance diagram for CSCSegment:
RecSegment TrackingRecHit

Public Member Functions

double chi2 () const override
 Chi2 of the segment fit. More...
 
CSCSegmentclone () const override
 
CSCDetId cscDetId () const
 
 CSCSegment ()
 Default constructor. More...
 
 CSCSegment (const std::vector< const CSCRecHit2D *> &proto_segment, LocalPoint origin, LocalVector direction, const AlgebraicSymMatrix &errors, double chi2)
 Constructor. More...
 
int degreesOfFreedom () const override
 Degrees of freedom of the segment fit. More...
 
int dimension () const override
 Dimension (in parameter space) More...
 
const std::vector< CSCSegment > & duplicateSegments () const
 
bool isME11a_duplicate () const
 
LocalVector localDirection () const override
 Local direction. More...
 
LocalError localDirectionError () const override
 Error on the local direction. More...
 
LocalPoint localPosition () const override
 
LocalError localPositionError () const override
 
int nRecHits () const
 
AlgebraicVector parameters () const override
 Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y ) More...
 
AlgebraicSymMatrix parametersError () const override
 Covariance matrix of parameters() More...
 
void print () const
 
AlgebraicMatrix projectionMatrix () const override
 The projection matrix relates the trajectory state parameters to the segment parameters(). More...
 
std::vector< const TrackingRecHit * > recHits () const override
 Access to component RecHits (if any) More...
 
std::vector< TrackingRecHit * > recHits () override
 Non-const access to component RecHits (if any) More...
 
void setDuplicateSegments (std::vector< CSCSegment *> &duplicates)
 
bool sharesRecHits (const CSCSegment &anotherSegment, CSCRecHit2D::SharedInputType sharesInput) const
 
bool sharesRecHits (const CSCSegment &anotherSegment) const
 
const std::vector< CSCRecHit2D > & specificRecHits () const
 
bool testSharesAllInSpecificRecHits (const std::vector< CSCRecHit2D > &specificRecHits_1, const std::vector< CSCRecHit2D > &specificRecHits_2, CSCRecHit2D::SharedInputType) const
 
float time () const
 
 ~CSCSegment () override
 Destructor. More...
 
- Public Member Functions inherited from RecSegment
 RecSegment (DetId id)
 
 RecSegment (TrackingRecHit::id_type id=0)
 
 ~RecSegment () override
 Destructor. More...
 
- Public Member Functions inherited from TrackingRecHit
virtual bool canImproveWithTrack () const
 
RecHitPointer cloneForFit (const GeomDet &idet) const
 
virtual TrackingRecHitcloneHit () const
 
virtual RecHitPointer cloneSH () const
 
const GeomDetdet () const
 
virtual const GeomDetUnitdetUnit () const
 
virtual float errorGlobalR () const
 
virtual float errorGlobalRPhi () const
 
virtual float errorGlobalZ () const
 
DetId geographicalId () const
 
virtual void getKfComponents (KfComponentsHolder &holder) const
 
unsigned int getRTTI () const
 
Type getType () const
 
virtual GlobalPoint globalPosition () const
 
virtual GlobalError globalPositionError () const
 
virtual bool hasPositionAndError () const
 to be redefined by daughter class More...
 
virtual TrackingRecHit const * hit () const
 
bool isValid () const
 
id_type rawId () const
 
virtual void recHitsV (std::vector< const TrackingRecHit *> &) const
 
virtual void recHitsV (std::vector< TrackingRecHit *> &)
 
virtual void setDet (const GeomDet &idet)
 
virtual bool sharesInput (const TrackingRecHit *other, SharedInputType what) const
 
virtual const Surfacesurface () const
 
 TrackingRecHit (DetId id, Type type=valid)
 
 TrackingRecHit (id_type id=0, Type type=valid)
 
 TrackingRecHit (DetId id, unsigned int rt, Type type=valid)
 
 TrackingRecHit (const GeomDet &idet, Type type=valid)
 
 TrackingRecHit (const GeomDet &idet, unsigned int rt, Type type=valid)
 
 TrackingRecHit (const GeomDet &idet, TrackingRecHit const &rh)
 
virtual ConstRecHitContainer transientHits () const
 
Type type () const
 
virtual float weight () const
 
virtual ~TrackingRecHit ()
 

Private Attributes

bool aME11a_duplicate
 
double theChi2
 
AlgebraicSymMatrix theCovMatrix
 
std::vector< CSCRecHit2DtheCSCRecHits
 
std::vector< CSCSegmenttheDuplicateSegments
 
LocalVector theLocalDirection
 
LocalPoint theOrigin
 

Additional Inherited Members

- Public Types inherited from TrackingRecHit
typedef std::vector< ConstRecHitPointerConstRecHitContainer
 
using ConstRecHitPointer = std::shared_ptr< TrackingRecHit const >
 
typedef unsigned int id_type
 
typedef std::vector< ConstRecHitPointerRecHitContainer
 
using RecHitPointer = std::shared_ptr< TrackingRecHit const >
 
enum  SharedInputType { all, some }
 definition of equality via shared input More...
 
enum  Type {
  valid = 0, missing = 1, inactive = 2, bad = 3,
  missing_inner = 4, missing_outer = 5, inactive_inner = 6, inactive_outer = 7
}
 
- Static Public Attributes inherited from TrackingRecHit
static const int rttiShift = 24
 
static const int typeMask = 0xf
 
- Protected Member Functions inherited from TrackingRecHit
void setId (id_type iid)
 
void setRTTI (unsigned int rt)
 
void setType (Type ttype)
 

Detailed Description

Describes a reconstructed track segment in the 6 layers of a CSC chamber. This is 4-dimensional since it has an origin (x,y) and a direction (x,y) in the local coordinate system of the chamber.

Author
Matteo Sani
Rick Wilkinson
Tim Cox

Definition at line 21 of file CSCSegment.h.

Constructor & Destructor Documentation

◆ CSCSegment() [1/2]

CSCSegment::CSCSegment ( )
inline

Default constructor.

Definition at line 24 of file CSCSegment.h.

Referenced by clone().

24 : theChi2(0.), aME11a_duplicate(false) {}
bool aME11a_duplicate
Definition: CSCSegment.h:98
double theChi2
Definition: CSCSegment.h:97

◆ CSCSegment() [2/2]

CSCSegment::CSCSegment ( const std::vector< const CSCRecHit2D *> &  proto_segment,
LocalPoint  origin,
LocalVector  direction,
const AlgebraicSymMatrix errors,
double  chi2 
)

Constructor.

Definition at line 15 of file CSCSegment.cc.

References mps_fire::i, and theCSCRecHits.

20  : RecSegment(buildDetId(proto_segment.front()->cscDetId())),
21  theOrigin(origin),
22  theLocalDirection(direction),
24  theChi2(chi2),
25  aME11a_duplicate(false) {
26  for (unsigned int i = 0; i < proto_segment.size(); ++i)
27  theCSCRecHits.push_back(*proto_segment[i]);
28 }
bool aME11a_duplicate
Definition: CSCSegment.h:98
double chi2() const override
Chi2 of the segment fit.
Definition: CSCSegment.h:58
double theChi2
Definition: CSCSegment.h:97
AlgebraicSymMatrix theCovMatrix
Definition: CSCSegment.h:96
LocalPoint theOrigin
Definition: CSCSegment.h:94
std::vector< CSCRecHit2D > theCSCRecHits
Definition: CSCSegment.h:93
LocalVector theLocalDirection
Definition: CSCSegment.h:95
Definition: errors.py:1
RecSegment(DetId id)
Definition: RecSegment.h:29

◆ ~CSCSegment()

CSCSegment::~CSCSegment ( )
override

Destructor.

Definition at line 30 of file CSCSegment.cc.

30 {}

Member Function Documentation

◆ chi2()

double CSCSegment::chi2 ( ) const
inlineoverridevirtual

◆ clone()

CSCSegment* CSCSegment::clone ( void  ) const
inlineoverridevirtual

Implements TrackingRecHit.

Definition at line 37 of file CSCSegment.h.

References CSCSegment().

37 { return new CSCSegment(*this); }
CSCSegment()
Default constructor.
Definition: CSCSegment.h:24

◆ cscDetId()

CSCDetId CSCSegment::cscDetId ( ) const
inline

◆ degreesOfFreedom()

int CSCSegment::degreesOfFreedom ( ) const
inlineoverridevirtual

Degrees of freedom of the segment fit.

Implements RecSegment.

Definition at line 62 of file CSCSegment.h.

References nRecHits().

Referenced by CSCSegAlgoST::dumpSegment(), CSCSegAlgoDF::dumpSegment(), CSCSegAlgoSK::dumpSegment(), CSCSegAlgoTC::dumpSegment(), operator<<(), and MuonTrackCSCChamberResidual::setSegmentResidual().

62 { return 2 * nRecHits() - 4; }
int nRecHits() const
Definition: CSCSegment.h:68

◆ dimension()

int CSCSegment::dimension ( ) const
inlineoverridevirtual

Dimension (in parameter space)

Implements RecSegment.

Definition at line 60 of file CSCSegment.h.

60 { return 4; }

◆ duplicateSegments()

const std::vector<CSCSegment>& CSCSegment::duplicateSegments ( ) const
inline

Definition at line 76 of file CSCSegment.h.

References theDuplicateSegments.

Referenced by operator<<().

76 { return theDuplicateSegments; }
std::vector< CSCSegment > theDuplicateSegments
Definition: CSCSegment.h:99

◆ isME11a_duplicate()

bool CSCSegment::isME11a_duplicate ( ) const
inline

Definition at line 74 of file CSCSegment.h.

References theDuplicateSegments, and funct::true.

74 { return (!theDuplicateSegments.empty() ? true : false); }
std::vector< CSCSegment > theDuplicateSegments
Definition: CSCSegment.h:99

◆ localDirection()

LocalVector CSCSegment::localDirection ( ) const
inlineoverridevirtual

◆ localDirectionError()

LocalError CSCSegment::localDirectionError ( ) const
overridevirtual

Error on the local direction.

Implements RecSegment.

Definition at line 52 of file CSCSegment.cc.

References theCovMatrix.

Referenced by CSCSegAlgoST::dumpSegment(), CSCSegAlgoDF::dumpSegment(), CSCSegAlgoSK::dumpSegment(), CSCSegAlgoTC::dumpSegment(), operator<<(), and CSCSegmentValidation::plotResolution().

52  {
53  return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]);
54 }
AlgebraicSymMatrix theCovMatrix
Definition: CSCSegment.h:96

◆ localPosition()

LocalPoint CSCSegment::localPosition ( ) const
inlineoverridevirtual

◆ localPositionError()

LocalError CSCSegment::localPositionError ( ) const
overridevirtual

◆ nRecHits()

int CSCSegment::nRecHits ( ) const
inline

Definition at line 68 of file CSCSegment.h.

References theCSCRecHits.

Referenced by CSCSegAlgoST::buildSegments(), CSCSegAlgoDF::buildSegments(), degreesOfFreedom(), and MuonTrackCSCChamberResidual::setSegmentResidual().

68 { return theCSCRecHits.size(); }
std::vector< CSCRecHit2D > theCSCRecHits
Definition: CSCSegment.h:93

◆ parameters()

AlgebraicVector CSCSegment::parameters ( void  ) const
overridevirtual

Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y )

Implements TrackingRecHit.

Definition at line 56 of file CSCSegment.cc.

References mps_fire::result, theLocalDirection, theOrigin, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by StateSegmentMatcher::StateSegmentMatcher().

56  {
57  // For consistency with DT and what we require for the TrackingRecHit interface,
58  // the order of the parameters in the returned vector should be (dx/dz, dy/dz, x, z)
59 
61 
64  result[2] = theOrigin.x();
65  result[3] = theOrigin.y();
66 
67  return result;
68 }
T z() const
Definition: PV3DBase.h:61
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
LocalPoint theOrigin
Definition: CSCSegment.h:94
CLHEP::HepVector AlgebraicVector
LocalVector theLocalDirection
Definition: CSCSegment.h:95

◆ parametersError()

AlgebraicSymMatrix CSCSegment::parametersError ( ) const
inlineoverridevirtual

◆ print()

void CSCSegment::print ( void  ) const

Definition at line 179 of file CSCSegment.cc.

References gather_cfg::cout.

179 { std::cout << *this << std::endl; }

◆ projectionMatrix()

AlgebraicMatrix CSCSegment::projectionMatrix ( ) const
overridevirtual

The projection matrix relates the trajectory state parameters to the segment parameters().

Implements TrackingRecHit.

Definition at line 81 of file CSCSegment.cc.

References theProjectionMatrix.

81 { return theProjectionMatrix; }
static const AlgebraicMatrix theProjectionMatrix
Definition: CSCSegment.cc:79

◆ recHits() [1/2]

std::vector< const TrackingRecHit * > CSCSegment::recHits ( ) const
overridevirtual

Access to component RecHits (if any)

Implements TrackingRecHit.

Definition at line 32 of file CSCSegment.cc.

References theCSCRecHits.

Referenced by MuonAssociatorByHitsHelper::getMatchedIds(), TrackerMuonHitExtractor::getMuonHits(), and MuonTrackProducer::produce().

32  {
33  std::vector<const TrackingRecHit*> pointersOfRecHits;
34  for (std::vector<CSCRecHit2D>::const_iterator irh = theCSCRecHits.begin(); irh != theCSCRecHits.end(); ++irh) {
35  pointersOfRecHits.push_back(&(*irh));
36  }
37  return pointersOfRecHits;
38 }
std::vector< CSCRecHit2D > theCSCRecHits
Definition: CSCSegment.h:93

◆ recHits() [2/2]

std::vector< TrackingRecHit * > CSCSegment::recHits ( )
overridevirtual

Non-const access to component RecHits (if any)

Implements TrackingRecHit.

Definition at line 40 of file CSCSegment.cc.

References theCSCRecHits.

40  {
41  std::vector<TrackingRecHit*> pointersOfRecHits;
42  for (std::vector<CSCRecHit2D>::iterator irh = theCSCRecHits.begin(); irh != theCSCRecHits.end(); ++irh) {
43  pointersOfRecHits.push_back(&(*irh));
44  }
45  return pointersOfRecHits;
46 }
std::vector< CSCRecHit2D > theCSCRecHits
Definition: CSCSegment.h:93

◆ setDuplicateSegments()

void CSCSegment::setDuplicateSegments ( std::vector< CSCSegment *> &  duplicates)

Definition at line 83 of file CSCSegment.cc.

References mps_fire::i, and theDuplicateSegments.

83  {
84  theDuplicateSegments.clear();
85  for (unsigned int i = 0; i < duplicates.size(); ++i) {
86  theDuplicateSegments.push_back(*duplicates[i]);
87  //avoid copying duplicates of duplicates of duplicates...
88  theDuplicateSegments.back().theDuplicateSegments.resize(0);
89  }
90 }
std::vector< CSCSegment > theDuplicateSegments
Definition: CSCSegment.h:99

◆ sharesRecHits() [1/2]

bool CSCSegment::sharesRecHits ( const CSCSegment anotherSegment,
CSCRecHit2D::SharedInputType  sharesInput 
) const

Definition at line 129 of file CSCSegment.cc.

References TrackingRecHit::sharesInput(), specificRecHits(), testSharesAllInSpecificRecHits(), and theCSCRecHits.

129  {
131 }
virtual bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
std::vector< CSCRecHit2D > theCSCRecHits
Definition: CSCSegment.h:93
bool testSharesAllInSpecificRecHits(const std::vector< CSCRecHit2D > &specificRecHits_1, const std::vector< CSCRecHit2D > &specificRecHits_2, CSCRecHit2D::SharedInputType) const
Definition: CSCSegment.cc:92
const std::vector< CSCRecHit2D > & specificRecHits() const
Definition: CSCSegment.h:66

◆ sharesRecHits() [2/2]

bool CSCSegment::sharesRecHits ( const CSCSegment anotherSegment) const

Definition at line 134 of file CSCSegment.cc.

References CSCRecHit2D::someStrips, CSCRecHit2D::someWires, specificRecHits(), testSharesAllInSpecificRecHits(), and theCSCRecHits.

134  {
137  return true;
138  } else {
139  return false;
140  }
141 }
std::vector< CSCRecHit2D > theCSCRecHits
Definition: CSCSegment.h:93
bool testSharesAllInSpecificRecHits(const std::vector< CSCRecHit2D > &specificRecHits_1, const std::vector< CSCRecHit2D > &specificRecHits_2, CSCRecHit2D::SharedInputType) const
Definition: CSCSegment.cc:92
const std::vector< CSCRecHit2D > & specificRecHits() const
Definition: CSCSegment.h:66

◆ specificRecHits()

const std::vector<CSCRecHit2D>& CSCSegment::specificRecHits ( ) const
inline

◆ testSharesAllInSpecificRecHits()

bool CSCSegment::testSharesAllInSpecificRecHits ( const std::vector< CSCRecHit2D > &  specificRecHits_1,
const std::vector< CSCRecHit2D > &  specificRecHits_2,
CSCRecHit2D::SharedInputType  sharesInput 
) const

Definition at line 92 of file CSCSegment.cc.

References TrackingRecHit::sharesInput().

Referenced by sharesRecHits().

94  {
95  const std::vector<CSCRecHit2D>* rhContainer_1 = &specificRecHits_1;
96  const std::vector<CSCRecHit2D>* rhContainer_2 = &specificRecHits_2;
97  if (specificRecHits_1.size() > specificRecHits_2.size()) {
98  rhContainer_2 = &specificRecHits_1;
99  rhContainer_1 = &specificRecHits_2;
100  }
101  //
102  bool shareConditionPassed = true;
103  for (std::vector<CSCRecHit2D>::const_iterator itRH = rhContainer_1->begin(); itRH != rhContainer_1->end(); ++itRH) {
104  const CSCRecHit2D* firstRecHit = &(*itRH);
105  bool sharedHit = false;
106  for (std::vector<CSCRecHit2D>::const_iterator itRH2 = rhContainer_2->begin(); itRH2 != rhContainer_2->end();
107  ++itRH2) {
108  if (itRH2->sharesInput(firstRecHit, sharesInput)) {
109  sharedHit = true;
110  break;
111  }
112  }
113  if (!sharedHit) {
114  shareConditionPassed = false;
115  break;
116  }
117  }
118  return shareConditionPassed;
119 }
virtual bool sharesInput(const TrackingRecHit *other, SharedInputType what) const

◆ time()

float CSCSegment::time ( ) const

Definition at line 144 of file CSCSegment.cc.

References change_name::diff, reco::castor::maxDiff(), MTVHistoProducerAlgoForTrackerBlock_cfi::maxHit, N, rpcPointValidation_cfi::recHit, and theCSCRecHits.

Referenced by CSCSegAlgoST::dumpSegment(), CSCSegAlgoDF::dumpSegment(), CSCSegAlgoSK::dumpSegment(), CSCSegAlgoTC::dumpSegment(), and GEMEffByGEMCSCSegmentSource::isME11SegmentMatched().

144  {
145  float averageTime = 0;
146  std::vector<float> wireTimes;
147  for (std::vector<CSCRecHit2D>::const_iterator itRH = theCSCRecHits.begin(); itRH != theCSCRecHits.end(); ++itRH) {
148  const CSCRecHit2D* recHit = &(*itRH);
149  averageTime += recHit->tpeak();
150  averageTime += recHit->wireTime();
151  wireTimes.push_back(recHit->wireTime());
152  }
153  averageTime = averageTime / (2 * theCSCRecHits.size());
154 
155  //The wire times have a long tail that has to be pruned. The strip times (tpeak) are fine
156  bool modified = true;
157  while (modified) {
158  modified = false;
159  double maxDiff = -1;
160  std::vector<float>::iterator maxHit;
161  for (std::vector<float>::iterator itWT = wireTimes.begin(); itWT != wireTimes.end(); ++itWT) {
162  float diff = fabs(*itWT - averageTime);
163  if (diff > maxDiff) {
164  maxDiff = diff;
165  maxHit = itWT;
166  }
167  }
168  if (maxDiff > 26) {
169  int N = theCSCRecHits.size() + wireTimes.size();
170  averageTime = (averageTime * N - (*maxHit)) / (N - 1);
171  wireTimes.erase(maxHit);
172  modified = true;
173  }
174  }
175  return averageTime;
176 }
std::vector< CSCRecHit2D > theCSCRecHits
Definition: CSCSegment.h:93
#define N
Definition: blowfish.cc:9
float maxDiff(float one, float two, float three, float four)

Member Data Documentation

◆ aME11a_duplicate

bool CSCSegment::aME11a_duplicate
private

Definition at line 98 of file CSCSegment.h.

◆ theChi2

double CSCSegment::theChi2
private

Definition at line 97 of file CSCSegment.h.

Referenced by chi2().

◆ theCovMatrix

AlgebraicSymMatrix CSCSegment::theCovMatrix
private

Definition at line 96 of file CSCSegment.h.

Referenced by localDirectionError(), localPositionError(), and parametersError().

◆ theCSCRecHits

std::vector<CSCRecHit2D> CSCSegment::theCSCRecHits
private

Definition at line 93 of file CSCSegment.h.

Referenced by CSCSegment(), nRecHits(), recHits(), sharesRecHits(), specificRecHits(), and time().

◆ theDuplicateSegments

std::vector<CSCSegment> CSCSegment::theDuplicateSegments
private

Definition at line 99 of file CSCSegment.h.

Referenced by duplicateSegments(), isME11a_duplicate(), and setDuplicateSegments().

◆ theLocalDirection

LocalVector CSCSegment::theLocalDirection
private

Definition at line 95 of file CSCSegment.h.

Referenced by localDirection(), and parameters().

◆ theOrigin

LocalPoint CSCSegment::theOrigin
private

Definition at line 94 of file CSCSegment.h.

Referenced by localPosition(), and parameters().