18 CSCSegment::CSCSegment(
const std::vector<const CSCRecHit2D*>& proto_segment,
LocalPoint origin,
22 theLocalDirection(direction), theCovMatrix(errors), theChi2(chi2), aME11a_duplicate(
false) {
24 for(
unsigned int i=0;
i<proto_segment.size(); ++
i)
25 theCSCRecHits.push_back(*proto_segment[
i]);
28 CSCSegment::~CSCSegment() {}
30 std::vector<const TrackingRecHit*> CSCSegment::recHits()
const{
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));
35 return pointersOfRecHits;
38 std::vector<TrackingRecHit*> CSCSegment::recHits() {
40 std::vector<TrackingRecHit*> pointersOfRecHits;
41 for (std::vector<CSCRecHit2D>::iterator irh = theCSCRecHits.begin(); irh!=theCSCRecHits.end(); ++irh) {
42 pointersOfRecHits.push_back(&(*irh));
44 return pointersOfRecHits;
47 LocalError CSCSegment::localPositionError()
const {
48 return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]);
51 LocalError CSCSegment::localDirectionError()
const {
52 return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]);
62 result[0] = theLocalDirection.x()/theLocalDirection.z();
63 result[1] = theLocalDirection.y()/theLocalDirection.z();
86 void CSCSegment::setDuplicateSegments(std::vector<CSCSegment*> & duplicates){
87 theDuplicateSegments.clear();
88 for(
unsigned int i=0;
i<duplicates.size(); ++
i){
89 theDuplicateSegments.push_back(*duplicates[
i]);
91 theDuplicateSegments.back().theDuplicateSegments.resize(0);
95 bool CSCSegment::testSharesAllInSpecificRecHits(
const std::vector<CSCRecHit2D>& specificRecHits_1,
96 const std::vector<CSCRecHit2D>& specificRecHits_2,
97 CSCRecHit2D::SharedInputType sharesInput)
const{
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;
105 bool shareConditionPassed =
true;
106 for ( std::vector<CSCRecHit2D>::const_iterator itRH = rhContainer_1->begin();
107 itRH != rhContainer_1->end(); ++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)){
118 shareConditionPassed =
false;
122 return shareConditionPassed;
133 bool CSCSegment::sharesRecHits(
const CSCSegment & anotherSegment, CSCRecHit2D::SharedInputType sharesInput)
const {
134 return testSharesAllInSpecificRecHits( theCSCRecHits , anotherSegment.specificRecHits(), sharesInput);
138 bool CSCSegment::sharesRecHits(
const CSCSegment & anotherSegment)
const {
139 if(testSharesAllInSpecificRecHits( theCSCRecHits , anotherSegment.specificRecHits(), CSCRecHit2D::someWires) &&
140 testSharesAllInSpecificRecHits( theCSCRecHits , anotherSegment.specificRecHits(), CSCRecHit2D::someStrips)){
151 std::vector<float> wireTimes;
152 for (std::vector<CSCRecHit2D>::const_iterator itRH = theCSCRecHits.begin();
153 itRH != theCSCRecHits.end(); ++itRH) {
155 averageTime+=recHit->tpeak();
156 averageTime+=recHit->wireTime();
157 wireTimes.push_back(recHit->wireTime());
159 averageTime=averageTime/(2*theCSCRecHits.size());
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);
176 int N=theCSCRecHits.size()+wireTimes.size();
177 averageTime=(averageTime*N-(*maxHit))/(N-1);
178 wireTimes.erase(maxHit);
191 os <<
"CSCSegment: local pos = " << seg.localPosition() <<
192 " posErr = (" <<
sqrt(seg.localPositionError().xx())<<
","<<
sqrt(seg.localPositionError().yy())<<
194 " dir = " << seg.localDirection() <<
195 " dirErr = (" <<
sqrt(seg.localDirectionError().xx())<<
","<<
sqrt(seg.localDirectionError().yy())<<
197 " chi2/ndf = " << seg.chi2()/double(seg.degreesOfFreedom()) <<
198 " #rechits = " << seg.specificRecHits().size()<<
199 " ME1/1a duplicates : "<<seg.duplicateSegments().size();
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
std::ostream & operator<<(std::ostream &out, const ALILine &li)
static const AlgebraicMatrix theProjectionMatrix
CLHEP::HepMatrix AlgebraicMatrix
CLHEP::HepVector AlgebraicVector
float maxDiff(float one, float two, float three, float four)
AlgebraicMatrix createStaticMatrix()
CLHEP::HepSymMatrix AlgebraicSymMatrix
volatile std::atomic< bool > shutdown_flag false