CMS 3D CMS Logo

GEMCSCSegment.cc
Go to the documentation of this file.
1 
9 #include <iostream>
10 
11 namespace {
12  // Get CSCDetId from one of the rechits, but then remove the layer part so it's a _chamber_ id
13  inline DetId buildDetId(CSCDetId id) { return CSCDetId(id.endcap(), id.station(), id.ring(), id.chamber(), 0); }
14 } // namespace
15 
17  // Aider class to make the return of the projection Matrix thread-safe
18 protected:
20 
21 public:
23  theProjectionMatrix[0][1] = 1;
24  theProjectionMatrix[1][2] = 1;
25  theProjectionMatrix[2][3] = 1;
26  theProjectionMatrix[3][4] = 1;
27  }
28  const AlgebraicMatrix& getMatrix() const { return (theProjectionMatrix); }
29 };
30 
32  const std::vector<const GEMRecHit*> gem_rhs,
33  LocalPoint origin,
34  LocalVector direction,
36  double chi2)
37  :
38 
39  RecSegment(buildDetId(csc_segment->cscDetId())),
40  theOrigin(origin),
41  theLocalDirection(direction),
42  theCovMatrix(errors),
43  theChi2(chi2) {
44  for (unsigned int i = 0; i < gem_rhs.size(); ++i) {
45  theGEMRecHits.push_back((*gem_rhs[i]));
46  }
47  theCSCSegment = *csc_segment;
48  // LogDebug
49  edm::LogVerbatim("GEMCSCSegment")
50  << "[GEMCSCSegment :: ctor] CSCDetId: " << csc_segment->cscDetId()
51  << " CSC RecHits: " << csc_segment->specificRecHits().size() << " GEM RecHits: " << gem_rhs.size()
52  << "\n" // << " Fit chi2: "<<chi2<<" Position: "<<origin<<" Direction: "<<direction
53  << " CSC Segment Details: \n"
54  << *csc_segment << "\n"
55  << " GEMCSC Segment Details: \n"
56  << *this << "\n"
57  << "[GEMCSCSegment :: ctor] ------------------------------------------------------------";
58 }
59 
61 
62 std::vector<const TrackingRecHit*> GEMCSCSegment::recHits() const {
63  std::vector<const TrackingRecHit*> pointersOfRecHits;
64  for (std::vector<GEMRecHit>::const_iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) {
65  pointersOfRecHits.push_back(&(*irh));
66  }
67  for (std::vector<CSCRecHit2D>::const_iterator irh = theCSCSegment.specificRecHits().begin();
68  irh != theCSCSegment.specificRecHits().end();
69  ++irh) {
70  pointersOfRecHits.push_back(&(*irh));
71  }
72  return pointersOfRecHits;
73 }
74 
75 std::vector<TrackingRecHit*> GEMCSCSegment::recHits() {
76  std::vector<TrackingRecHit*> pointersOfRecHits;
77  for (std::vector<GEMRecHit>::iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) {
78  pointersOfRecHits.push_back(&(*irh));
79  }
80  return pointersOfRecHits;
81 }
82 
84  return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]);
85 }
86 
88  return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]);
89 }
90 
92  // For consistency with DT, CSC and what we require for the TrackingRecHit interface,
93  // the order of the parameters in the returned vector should be (dx/dz, dy/dz, x, z)
94 
96  if (theLocalDirection.z() != 0) {
99  }
100  result[2] = theOrigin.x();
101  result[3] = theOrigin.y();
102  return result;
103 }
104 
107  return (theProjectionMatrix.getMatrix());
108 }
109 
110 std::ostream& operator<<(std::ostream& os, const GEMCSCSegment& seg) {
111  os << "GEMCSCSegment: local pos = " << seg.localPosition() << " posErr = (" << sqrt(seg.localPositionError().xx())
112  << "," << sqrt(seg.localPositionError().yy()) << "0,)\n"
113  << " dir = " << seg.localDirection() << " dirErr = (" << sqrt(seg.localDirectionError().xx()) << ","
114  << sqrt(seg.localDirectionError().yy()) << "0,)\n"
115  << " chi2/ndf = "
116  << ((seg.degreesOfFreedom() != 0) ? (seg.chi2() / double(seg.degreesOfFreedom())) : 0.0)
117  << " #rechits = " << seg.nRecHits();
118  return os;
119 }
CSCSegment::specificRecHits
const std::vector< CSCRecHit2D > & specificRecHits() const
Definition: CSCSegment.h:66
Vector3DBase< float, LocalTag >
mps_fire.i
i
Definition: mps_fire.py:428
GEMCSCSegment::projectionMatrix
AlgebraicMatrix projectionMatrix() const override
The projection matrix relates the trajectory state parameters to the segment parameters().
Definition: GEMCSCSegment.cc:105
MessageLogger.h
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
relativeConstraints.station
station
Definition: relativeConstraints.py:67
RecSegment
Definition: RecSegment.h:27
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
GEMCSCSegment::chi2
double chi2() const override
Chi2 of the segment fit.
Definition: GEMCSCSegment.h:58
ProjectionMatrixDiag
Definition: GEMCSCSegment.cc:16
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DetId
Definition: DetId.h:17
GEMCSCSegment::recHits
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
Definition: GEMCSCSegment.cc:62
errors
Definition: errors.py:1
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
LocalError::xx
float xx() const
Definition: LocalError.h:22
GEMCSCSegment::nRecHits
int nRecHits() const
Definition: GEMCSCSegment.h:64
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
GEMCSCSegment::theLocalDirection
LocalVector theLocalDirection
Definition: GEMCSCSegment.h:85
GEMCSCSegment::parameters
AlgebraicVector parameters() const override
Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y )
Definition: GEMCSCSegment.cc:91
Point3DBase< float, LocalTag >
CSCSegment
Definition: CSCSegment.h:21
GEMCSCSegment
Definition: GEMCSCSegment.h:24
ProjectionMatrixDiag::getMatrix
const AlgebraicMatrix & getMatrix() const
Definition: GEMCSCSegment.cc:28
LocalError
Definition: LocalError.h:12
GEMCSCSegment::theGEMRecHits
std::vector< GEMRecHit > theGEMRecHits
Definition: GEMCSCSegment.h:78
CSCDetId
Definition: CSCDetId.h:26
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
GEMCSCSegment::localDirectionError
LocalError localDirectionError() const override
Error on the local direction.
Definition: GEMCSCSegment.cc:87
GEMCSCSegment::localPositionError
LocalError localPositionError() const override
Definition: GEMCSCSegment.cc:83
ProjectionMatrixDiag::theProjectionMatrix
AlgebraicMatrix theProjectionMatrix
Definition: GEMCSCSegment.cc:19
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
GEMCSCSegment::~GEMCSCSegment
~GEMCSCSegment() override
Destructor.
Definition: GEMCSCSegment.cc:60
GEMCSCSegment::theOrigin
LocalPoint theOrigin
Definition: GEMCSCSegment.h:84
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
GEMCSCSegment::theCSCSegment
CSCSegment theCSCSegment
Definition: GEMCSCSegment.h:79
GEMCSCSegment::localPosition
LocalPoint localPosition() const override
Definition: GEMCSCSegment.h:43
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
operator<<
std::ostream & operator<<(std::ostream &os, const GEMCSCSegment &seg)
Definition: GEMCSCSegment.cc:110
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
theProjectionMatrix
static const AlgebraicMatrix theProjectionMatrix
Definition: CSCSegment.cc:79
CSCSegment::cscDetId
CSCDetId cscDetId() const
Definition: CSCSegment.h:70
GEMCSCSegment.h
mps_fire.result
result
Definition: mps_fire.py:311
GEMCSCSegment::localDirection
LocalVector localDirection() const override
Local direction.
Definition: GEMCSCSegment.h:46
GEMCSCSegment::GEMCSCSegment
GEMCSCSegment()
Default constructor.
Definition: GEMCSCSegment.h:27
ProjectionMatrixDiag::ProjectionMatrixDiag
ProjectionMatrixDiag()
Definition: GEMCSCSegment.cc:22
LocalError::yy
float yy() const
Definition: LocalError.h:24
GEMCSCSegment::degreesOfFreedom
int degreesOfFreedom() const override
Degrees of freedom of the segment fit.
Definition: GEMCSCSegment.h:62
GEMCSCSegment::theCovMatrix
AlgebraicSymMatrix theCovMatrix
Definition: GEMCSCSegment.h:86