-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9083 from pietverwilligen/GEMCSCSegment_75X_PR_v3
Gemcsc segment 75X
- Loading branch information
Showing
26 changed files
with
4,169 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#ifndef GEMRecHit_GEMCSCSegment_h | ||
#define GEMRecHit_GEMCSCSegment_h | ||
|
||
/** \class GEMCSCSegment | ||
* | ||
* Based on CSCSegment class | ||
* Describes a reconstructed track segment in the GEM + CSC chambers. | ||
* This is 4-dimensional since it has an origin (x,y) and a direction (x,y) | ||
* in the local coordinate system of the (csc) chamber. | ||
* | ||
* \author R. Radogna | ||
*/ | ||
|
||
#include <DataFormats/TrackingRecHit/interface/RecSegment.h> | ||
|
||
#include <DataFormats/GEMRecHit/interface/GEMRecHitCollection.h> | ||
#include <DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h> | ||
#include <DataFormats/CSCRecHit/interface/CSCSegmentCollection.h> | ||
|
||
#include <FWCore/MessageLogger/interface/MessageLogger.h> | ||
|
||
#include <iosfwd> | ||
|
||
class CSCDetId; | ||
|
||
class GEMCSCSegment GCC11_FINAL : public RecSegment { | ||
|
||
public: | ||
|
||
/// Default constructor | ||
GEMCSCSegment() : theChi2(0.) {} | ||
|
||
/// Constructor | ||
GEMCSCSegment(const CSCSegment* csc_segment, const std::vector<const GEMRecHit*> gem_rhs, LocalPoint origin, LocalVector direction, AlgebraicSymMatrix errors, double chi2); | ||
|
||
/// Destructor | ||
virtual ~GEMCSCSegment(); | ||
|
||
//--- Base class interface | ||
GEMCSCSegment* clone() const { return new GEMCSCSegment(*this); } | ||
|
||
LocalPoint localPosition() const { return theOrigin; } | ||
LocalError localPositionError() const ; | ||
|
||
LocalVector localDirection() const { return theLocalDirection; } | ||
LocalError localDirectionError() const ; | ||
|
||
/// Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y ) | ||
AlgebraicVector parameters() const; | ||
|
||
/// Covariance matrix of parameters() | ||
AlgebraicSymMatrix parametersError() const { return theCovMatrix; } | ||
|
||
/// The projection matrix relates the trajectory state parameters to the segment parameters(). | ||
virtual AlgebraicMatrix projectionMatrix() const; | ||
|
||
double chi2() const { return theChi2; }; | ||
|
||
virtual int dimension() const { return 4; } | ||
|
||
virtual int degreesOfFreedom() const { return 2*nRecHits() - 4;} | ||
|
||
int nRecHits() const | ||
{ | ||
return (theGEMRecHits.size() + theCSCSegment.specificRecHits().size()); | ||
edm::LogVerbatim("GEMCSCSegment")<< "[GEMCSCSegment :: nRecHits] CSC RecHits: " <<theCSCSegment.specificRecHits().size() | ||
<< " + GEM RecHits: " << theGEMRecHits.size() << " = " <<(theGEMRecHits.size() + theCSCSegment.specificRecHits().size()); | ||
} | ||
|
||
|
||
//--- Return the constituents in different ways | ||
const CSCSegment cscSegment() const { return theCSCSegment; } | ||
const std::vector<GEMRecHit>& gemRecHits() const { return theGEMRecHits; } | ||
const std::vector<CSCRecHit2D>& cscRecHits() const { return theCSCSegment.specificRecHits(); } | ||
virtual std::vector<const TrackingRecHit*> recHits() const; | ||
virtual std::vector<TrackingRecHit*> recHits(); | ||
|
||
CSCDetId cscDetId() const { return geographicalId(); } | ||
|
||
void print() const; | ||
|
||
private: | ||
std::vector<GEMRecHit> theGEMRecHits; // store GEM Rechits | ||
CSCSegment theCSCSegment; // store CSC RecHits and store CSC Segment | ||
// eventually we have to disentangle if later on we decide | ||
// not to have a one-to-one relationship anymore | ||
// i.e. if we allow the GEMCSC segment to modify the | ||
// (selection of the rechits of the) CSC segment | ||
LocalPoint theOrigin; // in chamber frame - the GeomDet local coordinate system | ||
LocalVector theLocalDirection; // in chamber frame - the GeomDet local coordinate system | ||
AlgebraicSymMatrix theCovMatrix; // the covariance matrix | ||
double theChi2; | ||
|
||
}; | ||
|
||
std::ostream& operator<<(std::ostream& os, const GEMCSCSegment& seg); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef DataFormats_GEMCSCSegmentCollection_H | ||
#define DataFormats_GEMCSCSegmentCollection_H | ||
|
||
/** \class GEMCSCSegmentCollection | ||
* | ||
* The collection of GEMCSCSegment's. See \ref GEMCSCSegmentCollection.h for details. | ||
* | ||
* $Date: $ | ||
* \author Raffaella Radogna | ||
*/ | ||
|
||
#include <DataFormats/MuonDetId/interface/CSCDetId.h> | ||
#include <DataFormats/MuonDetId/interface/GEMDetId.h> | ||
#include <DataFormats/GEMRecHit/interface/GEMCSCSegment.h> | ||
|
||
#include <DataFormats/Common/interface/RangeMap.h> | ||
#include <DataFormats/Common/interface/ClonePolicy.h> | ||
#include <DataFormats/Common/interface/OwnVector.h> | ||
|
||
|
||
typedef edm::RangeMap <CSCDetId, edm::OwnVector<GEMCSCSegment> > GEMCSCSegmentCollection; | ||
|
||
#include <DataFormats/Common/interface/Ref.h> | ||
typedef edm::Ref<GEMCSCSegmentCollection> GEMCSCSegmentRef; | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
/** \file GEMCSCSegment.cc | ||
* | ||
* Based on CSCSegment class | ||
* \author Raffaella Radogna | ||
*/ | ||
|
||
#include <DataFormats/GEMRecHit/interface/GEMCSCSegment.h> | ||
#include <iostream> | ||
|
||
|
||
namespace { | ||
// Get CSCDetId from one of the rechits, but then remove the layer part so it's a _chamber_ id | ||
inline | ||
DetId buildDetId(CSCDetId id) { | ||
return CSCDetId (id.endcap(),id.station(),id.ring(),id.chamber(),0); | ||
} | ||
} | ||
|
||
|
||
class ProjectionMatrixDiag { | ||
// Aider class to make the return of the projection Matrix thread-safe | ||
protected: | ||
AlgebraicMatrix theProjectionMatrix; | ||
public: | ||
ProjectionMatrixDiag() : theProjectionMatrix(4,5,0) { | ||
theProjectionMatrix[0][1] = 1; | ||
theProjectionMatrix[1][2] = 1; | ||
theProjectionMatrix[2][3] = 1; | ||
theProjectionMatrix[3][4] = 1; | ||
} | ||
const AlgebraicMatrix &getMatrix() const { | ||
return (theProjectionMatrix); | ||
} | ||
}; | ||
|
||
|
||
|
||
|
||
GEMCSCSegment::GEMCSCSegment(const CSCSegment* csc_segment, const std::vector<const GEMRecHit*> gem_rhs, LocalPoint origin, LocalVector direction, AlgebraicSymMatrix errors, double chi2) : | ||
|
||
RecSegment(buildDetId(csc_segment->cscDetId())), | ||
theOrigin(origin), | ||
theLocalDirection(direction), theCovMatrix(errors), theChi2(chi2) { | ||
|
||
for(unsigned int i=0; i<gem_rhs.size(); ++i) { | ||
theGEMRecHits.push_back((*gem_rhs[i])); | ||
} | ||
theCSCSegment = *csc_segment; | ||
// LogDebug | ||
edm::LogVerbatim("GEMCSCSegment")<< "[GEMCSCSegment :: ctor] CSCDetId: " << csc_segment->cscDetId() << " CSC RecHits: " <<csc_segment->specificRecHits().size() | ||
<< " GEM RecHits: " << gem_rhs.size()<<"\n" // << " Fit chi2: "<<chi2<<" Position: "<<origin<<" Direction: "<<direction | ||
<< " CSC Segment Details: \n"<<*csc_segment<<"\n" | ||
<< " GEMCSC Segment Details: \n"<<*this<<"\n" | ||
<< "[GEMCSCSegment :: ctor] ------------------------------------------------------------"; | ||
} | ||
|
||
|
||
GEMCSCSegment::~GEMCSCSegment() {} | ||
|
||
|
||
std::vector<const TrackingRecHit*> GEMCSCSegment::recHits() const{ | ||
|
||
std::vector<const TrackingRecHit*> pointersOfRecHits; | ||
for (std::vector<GEMRecHit>::const_iterator irh = theGEMRecHits.begin(); irh!=theGEMRecHits.end(); ++irh) { | ||
pointersOfRecHits.push_back(&(*irh)); | ||
} | ||
for (std::vector<CSCRecHit2D>::const_iterator irh = theCSCSegment.specificRecHits().begin(); irh!=theCSCSegment.specificRecHits().end(); ++irh) { | ||
pointersOfRecHits.push_back(&(*irh)); | ||
} | ||
return pointersOfRecHits; | ||
} | ||
|
||
std::vector<TrackingRecHit*> GEMCSCSegment::recHits() { | ||
|
||
std::vector<TrackingRecHit*> pointersOfRecHits; | ||
for (std::vector<GEMRecHit>::iterator irh = theGEMRecHits.begin(); irh!=theGEMRecHits.end(); ++irh) { | ||
pointersOfRecHits.push_back(&(*irh)); | ||
} | ||
return pointersOfRecHits; | ||
} | ||
|
||
|
||
LocalError GEMCSCSegment::localPositionError() const { | ||
return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]); | ||
} | ||
|
||
|
||
LocalError GEMCSCSegment::localDirectionError() const { | ||
return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]); | ||
} | ||
|
||
|
||
AlgebraicVector GEMCSCSegment::parameters() const { | ||
// For consistency with DT, CSC and what we require for the TrackingRecHit interface, | ||
// the order of the parameters in the returned vector should be (dx/dz, dy/dz, x, z) | ||
|
||
AlgebraicVector result(4); | ||
if(theLocalDirection.z()!=0) { | ||
result[0] = theLocalDirection.x()/theLocalDirection.z(); | ||
result[1] = theLocalDirection.y()/theLocalDirection.z(); | ||
} | ||
result[2] = theOrigin.x(); | ||
result[3] = theOrigin.y(); | ||
return result; | ||
} | ||
|
||
AlgebraicMatrix GEMCSCSegment::projectionMatrix() const { | ||
static const ProjectionMatrixDiag theProjectionMatrix; | ||
return (theProjectionMatrix.getMatrix()); | ||
} | ||
|
||
|
||
|
||
|
||
std::ostream& operator<<(std::ostream& os, const GEMCSCSegment& seg) { | ||
os << "GEMCSCSegment: local pos = " << seg.localPosition() << | ||
" posErr = (" << sqrt(seg.localPositionError().xx())<<","<<sqrt(seg.localPositionError().yy())<< | ||
"0,)\n"<< | ||
" dir = " << seg.localDirection() << | ||
" dirErr = (" << sqrt(seg.localDirectionError().xx())<<","<<sqrt(seg.localDirectionError().yy())<< | ||
"0,)\n"<< | ||
" chi2/ndf = " << ((seg.degreesOfFreedom()!=0)?(seg.chi2()/double(seg.degreesOfFreedom())):0.0) << | ||
" #rechits = " << seg.nRecHits(); | ||
return os; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/MessageLogger"/> | ||
<use name="FWCore/ParameterSet"/> | ||
<use name="FWCore/PluginManager"/> | ||
<use name="FWCore/Utilities"/> | ||
|
||
<use name="CommonTools/Statistics"/> | ||
|
||
<use name="DataFormats/CSCRecHit"/> | ||
<use name="DataFormats/GEMRecHit"/> | ||
<use name="DataFormats/Common"/> | ||
<use name="DataFormats/GeometryVector"/> | ||
<use name="DataFormats/MuonDetId"/> | ||
|
||
<use name="Geometry/CSCGeometry"/> | ||
<use name="Geometry/GEMGeometry"/> | ||
<use name="Geometry/Records"/> | ||
|
||
<use name="rootcore"/> | ||
<use name="rootgraphics"/> | ||
<use name="Root"/> | ||
|
||
<flags EDM_PLUGIN="1"/> |
Oops, something went wrong.