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 (std::vector< const CSCRecHit2D * > proto_segment, LocalPoint origin, LocalVector direction, 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
DetId geographicalId () const
 
virtual void getKfComponents (KfComponentsHolder &holder) const
 
unsigned int getRTTI () const
 
Type getType () const
 
virtual bool hasPositionAndError () const
 to be redefined by daughter class More...
 
bool isValid () const
 
id_type rawId () const
 
virtual void recHitsV (std::vector< const TrackingRecHit * > &) const
 
virtual void recHitsV (std::vector< TrackingRecHit * > &)
 
virtual bool sharesInput (const TrackingRecHit *other, SharedInputType what) const
 
 TrackingRecHit (DetId id, Type type=valid)
 
 TrackingRecHit (id_type id=0, Type type=valid)
 
 TrackingRecHit (DetId id, unsigned int rt, Type type=valid)
 
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 unsigned int id_type
 
enum  SharedInputType { all, some }
 definition of equality via shared input More...
 
enum  Type { valid = 0, missing = 1, inactive = 2, bad = 3 }
 
- 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.

Date:
2011/03/30 16:02:52
Author
Matteo Sani
Rick Wilkinson
Tim Cox

Definition at line 22 of file CSCSegment.h.

Constructor & Destructor Documentation

CSCSegment::CSCSegment ( )
inline

Default constructor.

Definition at line 27 of file CSCSegment.h.

Referenced by clone().

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

Constructor.

Definition at line 19 of file CSCSegment.cc.

References i, and theCSCRecHits.

20  :
21  RecSegment(buildDetId(proto_segment.front()->cscDetId())),
22  theOrigin(origin),
24 
25  for(unsigned int i=0; i<proto_segment.size(); ++i)
26  theCSCRecHits.push_back(*proto_segment[i]);
27 }
int i
Definition: DBlmapReader.cc:9
bool aME11a_duplicate
Definition: CSCSegment.h:99
double theChi2
Definition: CSCSegment.h:98
AlgebraicSymMatrix theCovMatrix
Definition: CSCSegment.h:97
LocalPoint theOrigin
Definition: CSCSegment.h:95
std::vector< CSCRecHit2D > theCSCRecHits
Definition: CSCSegment.h:94
double chi2() const
Chi2 of the segment fit.
Definition: CSCSegment.h:58
LocalVector theLocalDirection
Definition: CSCSegment.h:96
RecSegment(DetId id)
Definition: RecSegment.h:32
CSCSegment::~CSCSegment ( )
virtual

Destructor.

Definition at line 29 of file CSCSegment.cc.

29 {}

Member Function Documentation

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

Implements TrackingRecHit.

Definition at line 37 of file CSCSegment.h.

References CSCSegment().

37 { return new CSCSegment(*this); }
CSCSegment()
Default constructor.
Definition: CSCSegment.h:27
CSCDetId CSCSegment::cscDetId ( ) const
inline

Definition at line 70 of file CSCSegment.h.

References TrackingRecHit::geographicalId().

Referenced by FWCSCSegmentProxyBuilder::build().

70 { return geographicalId(); }
DetId geographicalId() const
virtual int CSCSegment::degreesOfFreedom ( ) const
inlinevirtual

Degrees of freedom of the segment fit.

Implements RecSegment.

Definition at line 62 of file CSCSegment.h.

References nRecHits().

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

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

Dimension (in parameter space)

Implements RecSegment.

Definition at line 60 of file CSCSegment.h.

60 { return 4; }
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:100
bool CSCSegment::isME11a_duplicate ( ) const
inline

Definition at line 74 of file CSCSegment.h.

References theDuplicateSegments.

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

Error on the local direction.

Implements RecSegment.

Definition at line 52 of file CSCSegment.cc.

References theCovMatrix.

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

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

Implements TrackingRecHit.

Definition at line 48 of file CSCSegment.cc.

References theCovMatrix.

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

48  {
49  return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]);
50 }
AlgebraicSymMatrix theCovMatrix
Definition: CSCSegment.h:97
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 57 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 ChamberSegmentUtility::getCSCRHmap(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::inputTags(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::properties(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::recursePSetProperties(), and StateSegmentMatcher::StateSegmentMatcher().

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

Covariance matrix of parameters()

Implements TrackingRecHit.

Definition at line 49 of file CSCSegment.h.

References theCovMatrix.

Referenced by StateSegmentMatcher::StateSegmentMatcher().

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

Definition at line 185 of file CSCSegment.cc.

References gather_cfg::cout.

185  {
186  std::cout << *this << std::endl;
187 }
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 72 of file CSCSegment.cc.

72  {
73  static AlgebraicMatrix theProjectionMatrix( 4, 5, 0);
74  static bool isInitialized = false;
75  if (!isInitialized) {
76  theProjectionMatrix[0][1] = 1;
77  theProjectionMatrix[1][2] = 1;
78  theProjectionMatrix[2][3] = 1;
79  theProjectionMatrix[3][4] = 1;
80  isInitialized=true;
81  }
82  return theProjectionMatrix;
83 }
CLHEP::HepMatrix AlgebraicMatrix
std::vector< const TrackingRecHit * > CSCSegment::recHits ( ) const
virtual

Access to component RecHits (if any)

Implements TrackingRecHit.

Definition at line 31 of file CSCSegment.cc.

References theCSCRecHits.

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

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

Non-const access to component RecHits (if any)

Implements TrackingRecHit.

Definition at line 39 of file CSCSegment.cc.

References theCSCRecHits.

39  {
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:94
void CSCSegment::setDuplicateSegments ( std::vector< CSCSegment * > &  duplicates)

Definition at line 85 of file CSCSegment.cc.

References i, and theDuplicateSegments.

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

Definition at line 132 of file CSCSegment.cc.

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

132  {
134 }
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:94
const std::vector< CSCRecHit2D > & specificRecHits() const
Definition: CSCSegment.h:66
std::vector< CSCRecHit2D > theCSCRecHits
Definition: CSCSegment.h:94
bool CSCSegment::sharesRecHits ( const CSCSegment anotherSegment) const

Definition at line 137 of file CSCSegment.cc.

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

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

Definition at line 66 of file CSCSegment.h.

References theCSCRecHits.

Referenced by operator<<(), and sharesRecHits().

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

Definition at line 94 of file CSCSegment.cc.

Referenced by sharesRecHits().

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

Definition at line 148 of file CSCSegment.cc.

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

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

double CSCSegment::theChi2
private

Definition at line 98 of file CSCSegment.h.

Referenced by chi2().

AlgebraicSymMatrix CSCSegment::theCovMatrix
private

Definition at line 97 of file CSCSegment.h.

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

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

Definition at line 94 of file CSCSegment.h.

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

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

Definition at line 100 of file CSCSegment.h.

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

LocalVector CSCSegment::theLocalDirection
private

Definition at line 96 of file CSCSegment.h.

Referenced by localDirection(), and parameters().

LocalPoint CSCSegment::theOrigin
private

Definition at line 95 of file CSCSegment.h.

Referenced by localPosition(), and parameters().