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 Attributes
CSCSegment Class Reference

#include <CSCSegment.h>

Inheritance diagram for CSCSegment:
RecSegment TrackingRecHit

Public Member Functions

double chi2 () const
 Chi2 of the segment fit. More...
 
CSCSegmentclone () const
 
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...
 
virtual int degreesOfFreedom () const
 Degrees of freedom of the segment fit. More...
 
virtual int dimension () const
 Dimension (in parameter space) More...
 
const std::vector< CSCSegment > & duplicateSegments () const
 
bool isME11a_duplicate () const
 
LocalVector localDirection () const
 Local direction. More...
 
LocalError localDirectionError () const
 Error on the local direction. More...
 
LocalPoint localPosition () const
 
LocalError localPositionError () const
 
int nRecHits () const
 
AlgebraicVector parameters () const
 Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y ) More...
 
AlgebraicSymMatrix parametersError () const
 Covariance matrix of parameters() More...
 
void print () const
 
virtual AlgebraicMatrix projectionMatrix () const
 The projection matrix relates the trajectory state parameters to the segment parameters(). More...
 
virtual std::vector< const
TrackingRecHit * > 
recHits () const
 Access to component RecHits (if any) More...
 
virtual std::vector
< TrackingRecHit * > 
recHits ()
 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
 
virtual ~CSCSegment ()
 Destructor. More...
 
- Public Member Functions inherited from RecSegment
 RecSegment (DetId id)
 
 RecSegment (TrackingRecHit::id_type id=0)
 
virtual ~RecSegment ()
 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
< ConstRecHitPointer
ConstRecHitContainer
 
using ConstRecHitPointer = std::shared_ptr< TrackingRecHit const >
 
typedef unsigned int id_type
 
typedef std::vector
< ConstRecHitPointer
RecHitContainer
 
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
}
 
- 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::CSCSegment ( )
inline

Default constructor.

Definition at line 26 of file CSCSegment.h.

Referenced by clone().

26 : theChi2(0.), aME11a_duplicate(false) {}
bool aME11a_duplicate
Definition: CSCSegment.h:98
double theChi2
Definition: CSCSegment.h:97
CSCSegment::CSCSegment ( const std::vector< const CSCRecHit2D * > &  proto_segment,
LocalPoint  origin,
LocalVector  direction,
const AlgebraicSymMatrix errors,
double  chi2 
)

Constructor.

Definition at line 18 of file CSCSegment.cc.

References i, and theCSCRecHits.

19  :
20  RecSegment(buildDetId(proto_segment.front()->cscDetId())),
21  theOrigin(origin),
23 
24  for(unsigned int i=0; i<proto_segment.size(); ++i)
25  theCSCRecHits.push_back(*proto_segment[i]);
26 }
int i
Definition: DBlmapReader.cc:9
bool aME11a_duplicate
Definition: CSCSegment.h:98
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
double chi2() const
Chi2 of the segment fit.
Definition: CSCSegment.h:57
LocalVector theLocalDirection
Definition: CSCSegment.h:95
RecSegment(DetId id)
Definition: RecSegment.h:30
CSCSegment::~CSCSegment ( )
virtual

Destructor.

Definition at line 28 of file CSCSegment.cc.

28 {}

Member Function Documentation

double CSCSegment::chi2 ( ) const
inlinevirtual
CSCSegment* CSCSegment::clone ( void  ) const
inlinevirtual

Implements TrackingRecHit.

Definition at line 36 of file CSCSegment.h.

References CSCSegment().

36 { return new CSCSegment(*this); }
CSCSegment()
Default constructor.
Definition: CSCSegment.h:26
CSCDetId CSCSegment::cscDetId ( ) const
inline
virtual int CSCSegment::degreesOfFreedom ( ) const
inlinevirtual

Degrees of freedom of the segment fit.

Implements RecSegment.

Definition at line 61 of file CSCSegment.h.

References nRecHits().

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

61 { return 2*nRecHits() - 4;}
int nRecHits() const
Definition: CSCSegment.h:67
virtual int CSCSegment::dimension ( ) const
inlinevirtual

Dimension (in parameter space)

Implements RecSegment.

Definition at line 59 of file CSCSegment.h.

59 { return 4; }
const std::vector< CSCSegment>& CSCSegment::duplicateSegments ( ) const
inline

Definition at line 75 of file CSCSegment.h.

References theDuplicateSegments.

Referenced by operator<<().

75 { return theDuplicateSegments; }
std::vector< CSCSegment > theDuplicateSegments
Definition: CSCSegment.h:99
bool CSCSegment::isME11a_duplicate ( ) const
inline

Definition at line 73 of file CSCSegment.h.

References theDuplicateSegments.

73 { return (theDuplicateSegments.size() > 0 ? true : false); }
std::vector< CSCSegment > theDuplicateSegments
Definition: CSCSegment.h:99
LocalVector CSCSegment::localDirection ( ) const
inlinevirtual
LocalError CSCSegment::localDirectionError ( ) const
virtual

Error on the local direction.

Implements RecSegment.

Definition at line 51 of file CSCSegment.cc.

References theCovMatrix.

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

51  {
52  return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]);
53 }
AlgebraicSymMatrix theCovMatrix
Definition: CSCSegment.h:96
LocalPoint CSCSegment::localPosition ( ) const
inlinevirtual
LocalError CSCSegment::localPositionError ( ) const
virtual

Implements TrackingRecHit.

Definition at line 47 of file CSCSegment.cc.

References theCovMatrix.

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

47  {
48  return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]);
49 }
AlgebraicSymMatrix theCovMatrix
Definition: CSCSegment.h:96
int CSCSegment::nRecHits ( ) const
inline
AlgebraicVector CSCSegment::parameters ( void  ) const
virtual

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 query::result, theLocalDirection, theOrigin, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::inputTags(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::properties(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::recursePSetProperties(), and 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 y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
tuple result
Definition: query.py:137
LocalPoint theOrigin
Definition: CSCSegment.h:94
CLHEP::HepVector AlgebraicVector
LocalVector theLocalDirection
Definition: CSCSegment.h:95
T x() const
Definition: PV3DBase.h:62
AlgebraicSymMatrix CSCSegment::parametersError ( ) const
inlinevirtual

Covariance matrix of parameters()

Implements TrackingRecHit.

Definition at line 48 of file CSCSegment.h.

References theCovMatrix.

Referenced by CSCSegAlgoST::dumpSegment(), and StateSegmentMatcher::StateSegmentMatcher().

48 { return theCovMatrix; }
AlgebraicSymMatrix theCovMatrix
Definition: CSCSegment.h:96
void CSCSegment::print ( void  ) const

Definition at line 186 of file CSCSegment.cc.

References gather_cfg::cout.

186  {
187  std::cout << *this << std::endl;
188 }
tuple cout
Definition: gather_cfg.py:121
AlgebraicMatrix CSCSegment::projectionMatrix ( ) const
virtual

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

Implements TrackingRecHit.

Definition at line 82 of file CSCSegment.cc.

References theProjectionMatrix.

82  {
83  return theProjectionMatrix;
84 }
static const AlgebraicMatrix theProjectionMatrix
Definition: CSCSegment.cc:80
std::vector< const TrackingRecHit * > CSCSegment::recHits ( ) const
virtual

Access to component RecHits (if any)

Implements TrackingRecHit.

Definition at line 30 of file CSCSegment.cc.

References theCSCRecHits.

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

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

Non-const access to component RecHits (if any)

Implements TrackingRecHit.

Definition at line 38 of file CSCSegment.cc.

References theCSCRecHits.

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

Definition at line 86 of file CSCSegment.cc.

References i, and theDuplicateSegments.

86  {
87  theDuplicateSegments.clear();
88  for(unsigned int i=0; i<duplicates.size(); ++i){
89  theDuplicateSegments.push_back(*duplicates[i]);
90  //avoid copying duplicates of duplicates of duplicates...
91  theDuplicateSegments.back().theDuplicateSegments.resize(0);
92  }
93 }
int i
Definition: DBlmapReader.cc:9
std::vector< CSCSegment > theDuplicateSegments
Definition: CSCSegment.h:99
bool CSCSegment::sharesRecHits ( const CSCSegment anotherSegment,
CSCRecHit2D::SharedInputType  sharesInput 
) const

Definition at line 133 of file CSCSegment.cc.

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

133  {
135 }
virtual bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
bool testSharesAllInSpecificRecHits(const std::vector< CSCRecHit2D > &specificRecHits_1, const std::vector< CSCRecHit2D > &specificRecHits_2, CSCRecHit2D::SharedInputType) const
Definition: CSCSegment.cc:95
const std::vector< CSCRecHit2D > & specificRecHits() const
Definition: CSCSegment.h:65
std::vector< CSCRecHit2D > theCSCRecHits
Definition: CSCSegment.h:93
bool CSCSegment::sharesRecHits ( const CSCSegment anotherSegment) const

Definition at line 138 of file CSCSegment.cc.

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

138  {
141  return true;
142  }
143  else{
144  return false;
145  }
146 }
bool testSharesAllInSpecificRecHits(const std::vector< CSCRecHit2D > &specificRecHits_1, const std::vector< CSCRecHit2D > &specificRecHits_2, CSCRecHit2D::SharedInputType) const
Definition: CSCSegment.cc:95
const std::vector< CSCRecHit2D > & specificRecHits() const
Definition: CSCSegment.h:65
std::vector< CSCRecHit2D > theCSCRecHits
Definition: CSCSegment.h:93
const std::vector<CSCRecHit2D>& CSCSegment::specificRecHits ( ) const
inline

Definition at line 65 of file CSCSegment.h.

References theCSCRecHits.

Referenced by CSCSegAlgoST::dumpSegment(), operator<<(), sharesRecHits(), and DynamicTruncation::updateWithCSChits().

65 { return theCSCRecHits; }
std::vector< CSCRecHit2D > theCSCRecHits
Definition: CSCSegment.h:93
bool CSCSegment::testSharesAllInSpecificRecHits ( const std::vector< CSCRecHit2D > &  specificRecHits_1,
const std::vector< CSCRecHit2D > &  specificRecHits_2,
CSCRecHit2D::SharedInputType  sharesInput 
) const

Definition at line 95 of file CSCSegment.cc.

Referenced by sharesRecHits().

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

Definition at line 149 of file CSCSegment.cc.

References diffTreeTool::diff, reco::castor::maxDiff(), N, theCSCRecHits, CSCRecHit2D::tpeak(), and CSCRecHit2D::wireTime().

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

Member Data Documentation

bool CSCSegment::aME11a_duplicate
private

Definition at line 98 of file CSCSegment.h.

double CSCSegment::theChi2
private

Definition at line 97 of file CSCSegment.h.

Referenced by chi2().

AlgebraicSymMatrix CSCSegment::theCovMatrix
private

Definition at line 96 of file CSCSegment.h.

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

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

Definition at line 93 of file CSCSegment.h.

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

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

Definition at line 99 of file CSCSegment.h.

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

LocalVector CSCSegment::theLocalDirection
private

Definition at line 95 of file CSCSegment.h.

Referenced by localDirection(), and parameters().

LocalPoint CSCSegment::theOrigin
private

Definition at line 94 of file CSCSegment.h.

Referenced by localPosition(), and parameters().