CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
CSCSegAlgoDF Class Reference

#include <CSCSegAlgoDF.h>

Inheritance diagram for CSCSegAlgoDF:
CSCSegmentAlgorithm

Public Types

typedef std::deque< bool > BoolContainer
 
typedef std::vector< const
CSCRecHit2D * > 
ChamberHitContainer
 
typedef std::vector< const
CSCRecHit2D * >
::const_iterator 
ChamberHitContainerCIt
 
typedef std::vector< int > LayerIndex
 Typedefs. More...
 

Public Member Functions

std::vector< CSCSegmentbuildSegments (const ChamberHitContainer &rechits)
 
 CSCSegAlgoDF (const edm::ParameterSet &ps)
 Constructor. More...
 
std::vector< CSCSegmentrun (const CSCChamber *aChamber, const ChamberHitContainer &rechits)
 
virtual ~CSCSegAlgoDF ()
 Destructor. More...
 
- Public Member Functions inherited from CSCSegmentAlgorithm
 CSCSegmentAlgorithm (const edm::ParameterSet &)
 Constructor. More...
 
virtual std::vector< CSCSegmentrun (const CSCChamber *chamber, const std::vector< const CSCRecHit2D * > &rechits)=0
 
virtual ~CSCSegmentAlgorithm ()
 Destructor. More...
 

Private Member Functions

bool addHit (const CSCRecHit2D *hit, int layer)
 
AlgebraicSymMatrix calculateError (void) const
 
void compareProtoSegment (const CSCRecHit2D *h, int layer)
 
CLHEP::HepMatrix derivativeMatrix (void) const
 
void flagHitsAsUsed (const ChamberHitContainer &rechitsInChamber)
 
void flipErrors (AlgebraicSymMatrix &) const
 
bool hasHitOnLayer (int layer) const
 
bool isHitNearSegment (const CSCRecHit2D *h) const
 
void orderSecondSeed (GlobalPoint gp1, const ChamberHitContainerCIt i1, const ChamberHitContainerCIt i2, const ChamberHitContainer &rechits, const LayerIndex &layerIndex)
 
void pruneFromResidual ()
 
void tryAddingHitsToSegment (const ChamberHitContainer &rechitsInChamber, const ChamberHitContainerCIt i1, const ChamberHitContainerCIt i2, const LayerIndex &layerIndex)
 Utility functions. More...
 
void updateParameters (void)
 
AlgebraicSymMatrix weightMatrix (void) const
 

Private Attributes

float chi2Max
 
ChamberHitContainer closeHits
 
bool debug
 
double dPhiFineMax
 
double dRPhiFineMax
 
float maxRatioResidual
 
int minHitsForPreClustering
 
int minHitsPerSegment
 
int minLayersApart
 
int muonsPerChamberMax
 
const std::string myName
 
int nHitsPerClusterIsShower
 
float nSigmaFromSegment
 
CSCSegAlgoPreClusteringpreCluster_
 
bool preClustering
 
double protoChi2
 
LocalVector protoDirection
 
LocalPoint protoIntercept
 
ChamberHitContainer protoSegment
 
float protoSlope_u
 
float protoSlope_v
 
bool Pruning
 
ChamberHitContainer secondSeedHits
 
CSCSegAlgoShoweringshowering_
 
float tanPhiMax
 
float tanThetaMax
 
bool testSeg
 
const CSCChambertheChamber
 
BoolContainer usedHits
 

Detailed Description

This is a modified version of the SK algorithm for building endcap muon track segments out of the rechit's in a CSCChamber.

A CSCSegment is a RecSegment4D, and is built from CSCRecHit2D objects, each of which is a RecHit2DLocalPos.

This builds segments by first creating proto-segments from at least 3 hits. We intend to try all possible pairs of hits to start segment building. 'All possible' means each hit lies on different layers in the chamber. Once a hit has been assigned to a segment, we don't consider it again, THAT IS, FOR THE FIRST PASS ONLY ! In fact, this is one of the possible flaw with the SK algorithms as it sometimes manages to build segments with the wrong starting points. In the DF algorithm, the endpoints are tested as the best starting points in a 2nd and 3rd loop.

Another difference with the from the SK algorithm is that rechits can be added to proto segments if they fall within n sigmas of the projected track within a given layer. Hence, a cylinder isn't used as in the SK algorimthm, which allows for pseudo 2D hits built from wire or strip only hits to be used in segment reconstruction.

Also, only a certain muonsPerChamberMax maximum number of segments can be produced in the chamber.

Alternative algorithms can be used for the segment building by writing classes like this, and then selecting which one is actually used via the CSCSegmentBuilder.

Author
Dominique Fortin - UCR

Definition at line 47 of file CSCSegAlgoDF.h.

Member Typedef Documentation

typedef std::deque<bool> CSCSegAlgoDF::BoolContainer

Definition at line 57 of file CSCSegAlgoDF.h.

typedef std::vector<const CSCRecHit2D*> CSCSegAlgoDF::ChamberHitContainer

Definition at line 55 of file CSCSegAlgoDF.h.

typedef std::vector<const CSCRecHit2D*>::const_iterator CSCSegAlgoDF::ChamberHitContainerCIt

Definition at line 56 of file CSCSegAlgoDF.h.

typedef std::vector<int> CSCSegAlgoDF::LayerIndex

Typedefs.

Definition at line 54 of file CSCSegAlgoDF.h.

Constructor & Destructor Documentation

CSCSegAlgoDF::CSCSegAlgoDF ( const edm::ParameterSet ps)
explicit

Constructor.

Definition at line 32 of file CSCSegAlgoDF.cc.

References chi2Max, debug, dPhiFineMax, dRPhiFineMax, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), maxRatioResidual, minHitsForPreClustering, minHitsPerSegment, minLayersApart, nHitsPerClusterIsShower, preCluster_, preClustering, Pruning, showering_, tanPhiMax, and tanThetaMax.

32  : CSCSegmentAlgorithm(ps), myName("CSCSegAlgoDF") {
33 
34  debug = ps.getUntrackedParameter<bool>("CSCSegmentDebug");
35  minLayersApart = ps.getParameter<int>("minLayersApart");
36  minHitsPerSegment = ps.getParameter<int>("minHitsPerSegment");
37  dRPhiFineMax = ps.getParameter<double>("dRPhiFineMax");
38  dPhiFineMax = ps.getParameter<double>("dPhiFineMax");
39  tanThetaMax = ps.getParameter<double>("tanThetaMax");
40  tanPhiMax = ps.getParameter<double>("tanPhiMax");
41  chi2Max = ps.getParameter<double>("chi2Max");
42  preClustering = ps.getUntrackedParameter<bool>("preClustering");
43  minHitsForPreClustering= ps.getParameter<int>("minHitsForPreClustering");
44  nHitsPerClusterIsShower= ps.getParameter<int>("nHitsPerClusterIsShower");
45  Pruning = ps.getUntrackedParameter<bool>("Pruning");
46  maxRatioResidual = ps.getParameter<double>("maxRatioResidualPrune");
47 
49  showering_ = new CSCSegAlgoShowering( ps );
50 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
CSCSegAlgoPreClustering * preCluster_
Definition: CSCSegAlgoDF.h:161
CSCSegmentAlgorithm(const edm::ParameterSet &)
Constructor.
CSCSegAlgoShowering * showering_
Definition: CSCSegAlgoDF.h:162
bool preClustering
Definition: CSCSegAlgoDF.h:145
const std::string myName
Definition: CSCSegAlgoDF.h:129
float maxRatioResidual
Definition: CSCSegAlgoDF.h:159
int minHitsForPreClustering
Definition: CSCSegAlgoDF.h:146
float tanThetaMax
Definition: CSCSegAlgoDF.h:157
double dPhiFineMax
Definition: CSCSegAlgoDF.h:155
double dRPhiFineMax
Definition: CSCSegAlgoDF.h:154
int minHitsPerSegment
Definition: CSCSegAlgoDF.h:152
int nHitsPerClusterIsShower
Definition: CSCSegAlgoDF.h:150
CSCSegAlgoDF::~CSCSegAlgoDF ( )
virtual

Destructor.

Definition at line 56 of file CSCSegAlgoDF.cc.

References preCluster_, and showering_.

56  {
57  delete preCluster_;
58  delete showering_;
59 }
CSCSegAlgoPreClustering * preCluster_
Definition: CSCSegAlgoDF.h:161
CSCSegAlgoShowering * showering_
Definition: CSCSegAlgoDF.h:162

Member Function Documentation

bool CSCSegAlgoDF::addHit ( const CSCRecHit2D hit,
int  layer 
)
private

Definition at line 373 of file CSCSegAlgoDF.cc.

References convertSQLiteXML::ok, and protoSegment.

Referenced by compareProtoSegment(), and tryAddingHitsToSegment().

373  {
374 
375  // Return true if hit was added successfully and then parameters are updated.
376  // Return false if there is already a hit on the same layer, or insert failed.
377 
378  bool ok = true;
379 
380  // Test that we are not trying to add the same hit again
381  for ( ChamberHitContainer::const_iterator it = protoSegment.begin(); it != protoSegment.end(); it++ )
382  if ( aHit == (*it) ) return false;
383 
384  protoSegment.push_back(aHit);
385 
386  return ok;
387 }
ChamberHitContainer protoSegment
Definition: CSCSegAlgoDF.h:135
std::vector< CSCSegment > CSCSegAlgoDF::buildSegments ( const ChamberHitContainer rechits)

Build track segments in this chamber (this is where the actual segment-building algorithm hides.)

Definition at line 106 of file CSCSegAlgoDF.cc.

References calculateError(), chi2Max, flagHitsAsUsed(), flipErrors(), i, cuy::ib, CSCChamber::layer(), CSCRecHit2D::localPosition(), minHitsPerSegment, minLayersApart, nHitsPerClusterIsShower, CSCSegment::nRecHits(), GeomDet::position(), preClustering, protoChi2, protoDirection, protoIntercept, protoSegment, protoSlope_u, protoSlope_v, pruneFromResidual(), Pruning, HI_PhotonSkim_cff::rechits, showering_, CSCSegAlgoShowering::showerSeg(), mathSSE::sqrt(), tanPhiMax, tanThetaMax, groupFilesInBlocks::temp, theChamber, GeomDet::toGlobal(), GeomDet::toLocal(), tryAddingHitsToSegment(), csvLumiCalc::unit, usedHits, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by run().

106  {
107 
108  ChamberHitContainer rechits = _rechits;
109  // Clear buffer for segment vector
110  std::vector<CSCSegment> segmentInChamber;
111  segmentInChamber.clear();
112 
113  unsigned nHitInChamber = rechits.size();
114  if ( nHitInChamber < 3 ) return segmentInChamber;
115 
116  LayerIndex layerIndex( nHitInChamber );
117 
118  unsigned nLayers = 0;
119  int old_layer = -1;
120  for ( unsigned int i = 0; i < nHitInChamber; i++ ) {
121  int this_layer = rechits[i]->cscDetId().layer();
122  layerIndex[i] = this_layer;
123  if ( this_layer != old_layer ) {
124  old_layer = this_layer;
125  nLayers++;
126  }
127  }
128 
129  if ( nLayers < 3 ) return segmentInChamber;
130 
131  double z1 = theChamber->layer(1)->position().z();
132  double z6 = theChamber->layer(6)->position().z();
133 
134  if ( z1 > 0. ) {
135  if ( z1 > z6 ) {
136  reverse( layerIndex.begin(), layerIndex.end() );
137  reverse( rechits.begin(), rechits.end() );
138  }
139  }
140  else if ( z1 < 0. ) {
141  if ( z1 < z6 ) {
142  reverse( layerIndex.begin(), layerIndex.end() );
143  reverse( rechits.begin(), rechits.end() );
144  }
145  }
146 
147  // Showering muon
148  if ( preClustering && int(nHitInChamber) > nHitsPerClusterIsShower && nLayers > 2 ) {
149  CSCSegment segShower = showering_->showerSeg(theChamber, rechits);
150 
151  // Make sure have at least 3 hits...
152  if ( segShower.nRecHits() < 3 ) return segmentInChamber;
153 
154  segmentInChamber.push_back(segShower);
155 
156  return segmentInChamber;
157  }
158 
159 
160  // Initialize flags that a given hit has been allocated to a segment
161  BoolContainer used_ini(rechits.size(), false);
162  usedHits = used_ini;
163 
164  ChamberHitContainerCIt ib = rechits.begin();
165  ChamberHitContainerCIt ie = rechits.end();
166 
167  // Now Loop over hits within the chamber to find 1st seed for segment building
168  for ( ChamberHitContainerCIt i1 = ib; i1 < ie; ++i1 ) {
169  if ( usedHits[i1-ib] ) continue;
170 
171  const CSCRecHit2D* h1 = *i1;
172  int layer1 = layerIndex[i1-ib];
173  const CSCLayer* l1 = theChamber->layer(layer1);
174  GlobalPoint gp1 = l1->toGlobal(h1->localPosition());
175  LocalPoint lp1 = theChamber->toLocal(gp1);
176 
177  // Loop over hits backward to find 2nd seed for segment building
178  for ( ChamberHitContainerCIt i2 = ie-1; i2 > ib; --i2 ) {
179 
180  if ( usedHits[i2-ib] ) continue; // Hit has been used already
181 
182  int layer2 = layerIndex[i2-ib];
183  if ( (layer2 - layer1) < minLayersApart ) continue;
184 
185  const CSCRecHit2D* h2 = *i2;
186  const CSCLayer* l2 = theChamber->layer(layer2);
187  GlobalPoint gp2 = l2->toGlobal(h2->localPosition());
188  LocalPoint lp2 = theChamber->toLocal(gp2);
189 
190  // Clear proto segment so it can be (re)-filled
191  protoSegment.clear();
192 
193  // localPosition is position of hit wrt layer (so local z = 0)
195 
196  // We want hit wrt chamber (and local z will be != 0)
197  float dz = gp2.z()-gp1.z();
198  protoSlope_u = (lp2.x() - lp1.x())/dz ;
199  protoSlope_v = (lp2.y() - lp1.y())/dz ;
200 
201  // Test if entrance angle is roughly pointing towards IP
202  if (fabs(protoSlope_v) > tanThetaMax) continue;
203  if (fabs(protoSlope_u) > tanPhiMax ) continue;
204 
205  protoSegment.push_back(h1);
206  protoSegment.push_back(h2);
207 
208  // Try adding hits to proto segment
209  tryAddingHitsToSegment(rechits, i1, i2, layerIndex);
210 
211  // Check no. of hits on segment to see if segment is large enough
212  bool segok = true;
213  unsigned iadd = 0;
214 
215  if (protoSegment.size() < minHitsPerSegment+iadd) segok = false;
216 
217  if ( Pruning && segok ) pruneFromResidual();
218 
219  // Check if segment satisfies chi2 requirement
220  if (protoChi2 > chi2Max) segok = false;
221 
222  if ( segok ) {
223 
224  // Fill segment properties
225 
226  // Local direction
227  double dz = 1./sqrt(1. + protoSlope_u*protoSlope_u + protoSlope_v*protoSlope_v);
228  double dx = dz * protoSlope_u;
229  double dy = dz * protoSlope_v;
230  LocalVector localDir(dx,dy,dz);
231 
232  // localDir may need sign flip to ensure it points outward from IP
233  double globalZpos = ( theChamber->toGlobal( protoIntercept ) ).z();
234  double globalZdir = ( theChamber->toGlobal( localDir ) ).z();
235  double directionSign = globalZpos * globalZdir;
236  protoDirection = (directionSign * localDir).unit();
237 
238  // Error matrix
239  AlgebraicSymMatrix protoErrors = calculateError();
240  // but reorder components to match what's required by TrackingRecHit interface
241  // i.e. slopes first, then positions
242  flipErrors( protoErrors );
243 
245 
246  segmentInChamber.push_back(temp);
247 
248  if (nHitInChamber-protoSegment.size() < 3) return segmentInChamber;
249  if (segmentInChamber.size() > 4) return segmentInChamber;
250 
251  // Flag used hits
252  flagHitsAsUsed(rechits);
253  }
254  }
255  }
256  return segmentInChamber;
257 }
void tryAddingHitsToSegment(const ChamberHitContainer &rechitsInChamber, const ChamberHitContainerCIt i1, const ChamberHitContainerCIt i2, const LayerIndex &layerIndex)
Utility functions.
void flipErrors(AlgebraicSymMatrix &) const
int i
Definition: DBlmapReader.cc:9
ChamberHitContainer protoSegment
Definition: CSCSegAlgoDF.h:135
std::vector< const CSCRecHit2D * > ChamberHitContainer
Definition: CSCSegAlgoDF.h:55
std::vector< const CSCRecHit2D * >::const_iterator ChamberHitContainerCIt
Definition: CSCSegAlgoDF.h:56
int ib
Definition: cuy.py:660
CSCSegment showerSeg(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:67
CSCSegAlgoShowering * showering_
Definition: CSCSegAlgoDF.h:162
float float float z
bool preClustering
Definition: CSCSegAlgoDF.h:145
std::deque< bool > BoolContainer
Definition: CSCSegAlgoDF.h:57
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:46
int nRecHits() const
Definition: CSCSegment.h:67
LocalPoint protoIntercept
Definition: CSCSegAlgoDF.h:139
string unit
Definition: csvLumiCalc.py:46
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:39
std::vector< int > LayerIndex
Typedefs.
Definition: CSCSegAlgoDF.h:54
float protoSlope_v
Definition: CSCSegAlgoDF.h:138
void flagHitsAsUsed(const ChamberHitContainer &rechitsInChamber)
float tanThetaMax
Definition: CSCSegAlgoDF.h:157
float protoSlope_u
Definition: CSCSegAlgoDF.h:137
void pruneFromResidual()
CLHEP::HepSymMatrix AlgebraicSymMatrix
double protoChi2
Definition: CSCSegAlgoDF.h:140
AlgebraicSymMatrix calculateError(void) const
const CSCChamber * theChamber
Definition: CSCSegAlgoDF.h:130
LocalVector protoDirection
Definition: CSCSegAlgoDF.h:141
LocalPoint localPosition() const
Definition: CSCRecHit2D.h:50
int minHitsPerSegment
Definition: CSCSegAlgoDF.h:152
int nHitsPerClusterIsShower
Definition: CSCSegAlgoDF.h:150
T x() const
Definition: PV3DBase.h:62
BoolContainer usedHits
Definition: CSCSegAlgoDF.h:131
AlgebraicSymMatrix CSCSegAlgoDF::calculateError ( void  ) const
private

Definition at line 633 of file CSCSegAlgoDF.cc.

References HLT_25ns14e33_v1_cff::A, derivativeMatrix(), query::result, weightMatrix(), and create_public_pileup_plots::weights.

Referenced by buildSegments().

633  {
634 
637 
638  // (AT W A)^-1
639  // from http://www.phys.ufl.edu/~avery/fitting.html, part I
640  int ierr;
641  AlgebraicSymMatrix result = weights.similarityT(A);
642  result.invert(ierr);
643 
644  // blithely assuming the inverting never fails...
645  return result;
646 }
AlgebraicSymMatrix weightMatrix(void) const
CLHEP::HepMatrix derivativeMatrix(void) const
CLHEP::HepMatrix AlgebraicMatrix
tuple result
Definition: query.py:137
CLHEP::HepSymMatrix AlgebraicSymMatrix
void CSCSegAlgoDF::compareProtoSegment ( const CSCRecHit2D h,
int  layer 
)
private

Definition at line 519 of file CSCSegAlgoDF.cc.

References addHit(), convertSQLiteXML::ok, protoChi2, protoDirection, protoIntercept, protoSegment, protoSlope_u, protoSlope_v, and updateParameters().

Referenced by tryAddingHitsToSegment().

519  {
520 
521  // Store old segment first
522  double old_protoChi2 = protoChi2;
523  LocalPoint old_protoIntercept = protoIntercept;
524  float old_protoSlope_u = protoSlope_u;
525  float old_protoSlope_v = protoSlope_v;
526  LocalVector old_protoDirection = protoDirection;
527  ChamberHitContainer old_protoSegment = protoSegment;
528 
529 
530  // Try adding the hit to existing segment, and remove old one existing in same layer
531  ChamberHitContainer::iterator it;
532  for ( it = protoSegment.begin(); it != protoSegment.end(); ) {
533  if ( (*it)->cscDetId().layer() == layer ) {
534  it = protoSegment.erase(it);
535  } else {
536  ++it;
537  }
538  }
539  bool ok = addHit(h, layer);
540 
541  if (ok) updateParameters();
542 
543  if ( (protoChi2 > old_protoChi2) || ( !ok ) ) {
544  protoChi2 = old_protoChi2;
545  protoIntercept = old_protoIntercept;
546  protoSlope_u = old_protoSlope_u;
547  protoSlope_v = old_protoSlope_v;
548  protoDirection = old_protoDirection;
549  protoSegment = old_protoSegment;
550  }
551 }
ChamberHitContainer protoSegment
Definition: CSCSegAlgoDF.h:135
std::vector< const CSCRecHit2D * > ChamberHitContainer
Definition: CSCSegAlgoDF.h:55
bool addHit(const CSCRecHit2D *hit, int layer)
void updateParameters(void)
LocalPoint protoIntercept
Definition: CSCSegAlgoDF.h:139
float protoSlope_v
Definition: CSCSegAlgoDF.h:138
float protoSlope_u
Definition: CSCSegAlgoDF.h:137
double protoChi2
Definition: CSCSegAlgoDF.h:140
LocalVector protoDirection
Definition: CSCSegAlgoDF.h:141
CLHEP::HepMatrix CSCSegAlgoDF::derivativeMatrix ( void  ) const
private

Definition at line 606 of file CSCSegAlgoDF.cc.

References CSCRecHit2D::cscDetId(), CSCChamber::layer(), CSCDetId::layer(), CSCRecHit2D::localPosition(), makeMuonMisalignmentScenario::matrix, protoSegment, theChamber, GeomDet::toGlobal(), GeomDet::toLocal(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by calculateError().

606  {
607 
608  ChamberHitContainer::const_iterator it;
609  int nhits = protoSegment.size();
610  CLHEP::HepMatrix matrix(2*nhits, 4);
611  int row = 0;
612 
613  for(it = protoSegment.begin(); it != protoSegment.end(); ++it) {
614 
615  const CSCRecHit2D& hit = (**it);
616  const CSCLayer* layer = theChamber->layer(hit.cscDetId().layer());
617  GlobalPoint gp = layer->toGlobal(hit.localPosition());
618  LocalPoint lp = theChamber->toLocal(gp);
619  float z = lp.z();
620  ++row;
621  matrix(row, 1) = 1.;
622  matrix(row, 3) = z;
623  ++row;
624  matrix(row, 2) = 1.;
625  matrix(row, 4) = z;
626  }
627  return matrix;
628 }
ChamberHitContainer protoSegment
Definition: CSCSegAlgoDF.h:135
CSCDetId cscDetId() const
Definition: CSCRecHit2D.h:52
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:67
int layer() const
Definition: CSCDetId.h:74
float float float z
T z() const
Definition: PV3DBase.h:64
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:39
const CSCChamber * theChamber
Definition: CSCSegAlgoDF.h:130
LocalPoint localPosition() const
Definition: CSCRecHit2D.h:50
void CSCSegAlgoDF::flagHitsAsUsed ( const ChamberHitContainer rechitsInChamber)
private

Flag hits on segment as used

Definition at line 559 of file CSCSegAlgoDF.cc.

References closeHits, cuy::ib, protoSegment, and usedHits.

Referenced by buildSegments().

559  {
560 
561  // Flag hits on segment as used
562  ChamberHitContainerCIt ib = rechitsInChamber.begin();
563  ChamberHitContainerCIt hi, iu;
564 
565  for ( hi = protoSegment.begin(); hi != protoSegment.end(); ++hi ) {
566  for ( iu = ib; iu != rechitsInChamber.end(); ++iu ) {
567  if (*hi == *iu) usedHits[iu-ib] = true;
568  }
569  }
570  // Don't reject hits marked as "nearby" for now.
571  // So this is bypassed at all times for now !!!
572  // Perhaps add back to speed up algorithm some more
573  if (closeHits.size() > 0) return;
574  for ( hi = closeHits.begin(); hi != closeHits.end(); ++hi ) {
575  for ( iu = ib; iu != rechitsInChamber.end(); ++iu ) {
576  if (*hi == *iu) usedHits[iu-ib] = true;
577  }
578  }
579 
580 }
ChamberHitContainer protoSegment
Definition: CSCSegAlgoDF.h:135
std::vector< const CSCRecHit2D * >::const_iterator ChamberHitContainerCIt
Definition: CSCSegAlgoDF.h:56
int ib
Definition: cuy.py:660
ChamberHitContainer closeHits
Definition: CSCSegAlgoDF.h:133
BoolContainer usedHits
Definition: CSCSegAlgoDF.h:131
void CSCSegAlgoDF::flipErrors ( AlgebraicSymMatrix a) const
private

Definition at line 648 of file CSCSegAlgoDF.cc.

References a.

Referenced by buildSegments().

648  {
649 
650  // The CSCSegment needs the error matrix re-arranged
651 
652  AlgebraicSymMatrix hold( a );
653 
654  // errors on slopes into upper left
655  a(1,1) = hold(3,3);
656  a(1,2) = hold(3,4);
657  a(2,1) = hold(4,3);
658  a(2,2) = hold(4,4);
659 
660  // errors on positions into lower right
661  a(3,3) = hold(1,1);
662  a(3,4) = hold(1,2);
663  a(4,3) = hold(2,1);
664  a(4,4) = hold(2,2);
665 
666  // off-diagonal elements remain unchanged
667 
668 }
double a
Definition: hdecay.h:121
CLHEP::HepSymMatrix AlgebraicSymMatrix
bool CSCSegAlgoDF::hasHitOnLayer ( int  layer) const
private

Definition at line 503 of file CSCSegAlgoDF.cc.

References protoSegment.

Referenced by tryAddingHitsToSegment().

503  {
504 
505  // Is there already a hit on this layer?
506  for ( ChamberHitContainerCIt it = protoSegment.begin(); it != protoSegment.end(); it++ )
507  if ( (*it)->cscDetId().layer() == layer ) return true;
508 
509  return false;
510 }
ChamberHitContainer protoSegment
Definition: CSCSegAlgoDF.h:135
std::vector< const CSCRecHit2D * >::const_iterator ChamberHitContainerCIt
Definition: CSCSegAlgoDF.h:56
bool CSCSegAlgoDF::isHitNearSegment ( const CSCRecHit2D h) const
private

Definition at line 336 of file CSCSegAlgoDF.cc.

References CSCRecHit2D::cscDetId(), SiPixelRawToDigiRegional_cfi::deltaPhi, dPhiFineMax, dRPhiFineMax, CSCChamber::layer(), CSCDetId::layer(), CSCRecHit2D::localPosition(), M_PI, PV3DBase< T, PVType, FrameType >::phi(), protoIntercept, protoSlope_u, protoSlope_v, dttmaxenums::R, mathSSE::sqrt(), theChamber, GeomDet::toGlobal(), GeomDet::toLocal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by tryAddingHitsToSegment().

336  {
337 
338  const CSCLayer* layer = theChamber->layer(hit->cscDetId().layer());
339 
340  // hit phi position in global coordinates
341  GlobalPoint Hgp = layer->toGlobal(hit->localPosition());
342  double Hphi = Hgp.phi();
343  if (Hphi < 0.) Hphi += 2.*M_PI;
344  LocalPoint Hlp = theChamber->toLocal(Hgp);
345  double z = Hlp.z();
346 
347  double LocalX = protoIntercept.x() + protoSlope_u * z;
348  double LocalY = protoIntercept.y() + protoSlope_v * z;
349  LocalPoint Slp(LocalX, LocalY, z);
350  GlobalPoint Sgp = theChamber->toGlobal(Slp);
351  double Sphi = Sgp.phi();
352  if (Sphi < 0.) Sphi += 2.*M_PI;
353  double R = sqrt(Sgp.x()*Sgp.x() + Sgp.y()*Sgp.y());
354 
355  double deltaPhi = Sphi - Hphi;
356  if (deltaPhi > 2.*M_PI) deltaPhi -= 2.*M_PI;
357  if (deltaPhi < -2.*M_PI) deltaPhi += 2.*M_PI;
358  if (deltaPhi < 0.) deltaPhi = -deltaPhi;
359 
360  double RdeltaPhi = R * deltaPhi;
361 
362  if (RdeltaPhi < dRPhiFineMax && deltaPhi < dPhiFineMax ) return true;
363 
364  return false;
365 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:67
float float float z
LocalPoint protoIntercept
Definition: CSCSegAlgoDF.h:139
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:39
#define M_PI
float protoSlope_v
Definition: CSCSegAlgoDF.h:138
double dPhiFineMax
Definition: CSCSegAlgoDF.h:155
float protoSlope_u
Definition: CSCSegAlgoDF.h:137
double dRPhiFineMax
Definition: CSCSegAlgoDF.h:154
const CSCChamber * theChamber
Definition: CSCSegAlgoDF.h:130
T x() const
Definition: PV3DBase.h:62
void CSCSegAlgoDF::orderSecondSeed ( GlobalPoint  gp1,
const ChamberHitContainerCIt  i1,
const ChamberHitContainerCIt  i2,
const ChamberHitContainer rechits,
const LayerIndex layerIndex 
)
private

Order the hits on the 2nd layer for seed building

Definition at line 744 of file CSCSegAlgoDF.cc.

References secondSeedHits.

748  {
749 
750  secondSeedHits.clear();
751 
752  //ChamberHitContainerCIt ib = rechits.begin();
753  ChamberHitContainerCIt ie = rechits.end();
754 
755  // int layer1 = layerIndex[i1-ib];
756  // int layer2 = layerIndex[i2-ib];
757 
758 
759  // Now fill vector of rechits closest to center of mass:
760  // secondSeedHitsIdx.clear() = 0;
761 
762  // Loop over all hits and find hit closest to 1st seed.
763  for ( ChamberHitContainerCIt i2 = ie-1; i2 > i1; --i2 ) {
764 
765 
766  }
767 
768 
769 }
std::vector< const CSCRecHit2D * >::const_iterator ChamberHitContainerCIt
Definition: CSCSegAlgoDF.h:56
ChamberHitContainer secondSeedHits
Definition: CSCSegAlgoDF.h:136
void CSCSegAlgoDF::pruneFromResidual ( )
private

Prune bad segment from the worse hit based on residuals

Definition at line 672 of file CSCSegAlgoDF.cc.

References CSCRecHit2D::cscDetId(), j, CSCChamber::layer(), CSCDetId::layer(), CSCRecHit2D::localPosition(), maxRatioResidual, protoIntercept, protoSegment, protoSlope_u, protoSlope_v, mathSSE::sqrt(), theChamber, GeomDet::toGlobal(), GeomDet::toLocal(), updateParameters(), findQualityFiles::v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by buildSegments().

672  {
673 
674  // Only prune if have at least 5 hits
675  if ( protoSegment.size() < 5 ) return ;
676 
677 
678  // Now Study residuals
679 
680  float maxResidual = 0.;
681  float sumResidual = 0.;
682  int nHits = 0;
683  int badIndex = -1;
684  int j = 0;
685 
686 
687  ChamberHitContainer::const_iterator ih;
688 
689  for ( ih = protoSegment.begin(); ih != protoSegment.end(); ++ih ) {
690  const CSCRecHit2D& hit = (**ih);
691  const CSCLayer* layer = theChamber->layer(hit.cscDetId().layer());
692  GlobalPoint gp = layer->toGlobal(hit.localPosition());
693  LocalPoint lp = theChamber->toLocal(gp);
694 
695  double u = lp.x();
696  double v = lp.y();
697  double z = lp.z();
698 
699  double du = protoIntercept.x() + protoSlope_u * z - u;
700  double dv = protoIntercept.y() + protoSlope_v * z - v;
701 
702  float residual = sqrt(du*du + dv*dv);
703 
704  sumResidual += residual;
705  nHits++;
706  if ( residual > maxResidual ) {
707  maxResidual = residual;
708  badIndex = j;
709  }
710  j++;
711  }
712 
713  float corrAvgResidual = (sumResidual - maxResidual)/(nHits -1);
714 
715  // Keep all hits
716  if ( maxResidual/corrAvgResidual < maxRatioResidual ) return;
717 
718 
719  // Drop worse hit and recompute segment properties + fill
720 
721  ChamberHitContainer newProtoSegment;
722 
723  j = 0;
724  for ( ih = protoSegment.begin(); ih != protoSegment.end(); ++ih ) {
725  if ( j != badIndex ) newProtoSegment.push_back(*ih);
726  j++;
727  }
728 
729  protoSegment.clear();
730 
731  for ( ih = newProtoSegment.begin(); ih != newProtoSegment.end(); ++ih ) {
732  protoSegment.push_back(*ih);
733  }
734 
735  // Update segment parameters
737 
738 }
ChamberHitContainer protoSegment
Definition: CSCSegAlgoDF.h:135
std::vector< const CSCRecHit2D * > ChamberHitContainer
Definition: CSCSegAlgoDF.h:55
CSCDetId cscDetId() const
Definition: CSCRecHit2D.h:52
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:67
int layer() const
Definition: CSCDetId.h:74
float float float z
void updateParameters(void)
LocalPoint protoIntercept
Definition: CSCSegAlgoDF.h:139
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
int j
Definition: DBlmapReader.cc:9
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:39
float maxRatioResidual
Definition: CSCSegAlgoDF.h:159
float protoSlope_v
Definition: CSCSegAlgoDF.h:138
float protoSlope_u
Definition: CSCSegAlgoDF.h:137
const CSCChamber * theChamber
Definition: CSCSegAlgoDF.h:130
LocalPoint localPosition() const
Definition: CSCRecHit2D.h:50
T x() const
Definition: PV3DBase.h:62
std::vector< CSCSegment > CSCSegAlgoDF::run ( const CSCChamber aChamber,
const ChamberHitContainer rechits 
)

Here we must implement the algorithm

Definition at line 65 of file CSCSegAlgoDF.cc.

References buildSegments(), CSCSegAlgoPreClustering::clusterHits(), minHitsForPreClustering, preCluster_, preClustering, and theChamber.

65  {
66 
67  // Store chamber info in temp memory
68  theChamber = aChamber;
69 
70  int nHits = rechits.size();
71 
72  // Segments prior to pruning
73  std::vector<CSCSegment> segments_temp;
74 
75  if ( preClustering && nHits > minHitsForPreClustering ) {
76  // This is where the segment origin is in the chamber on avg.
77  std::vector<CSCSegment> testSegments;
78  std::vector<ChamberHitContainer> clusteredHits = preCluster_->clusterHits(theChamber, rechits);
79  // loop over the found clusters:
80  for (std::vector<ChamberHitContainer>::iterator subrechits = clusteredHits.begin(); subrechits != clusteredHits.end(); ++subrechits ) {
81  // build the subset of segments:
82  std::vector<CSCSegment> segs = buildSegments( (*subrechits) );
83  // add the found subset of segments to the collection of all segments in this chamber:
84  segments_temp.insert( segments_temp.end(), segs.begin(), segs.end() );
85  }
86  } else {
87  std::vector<CSCSegment> segs = buildSegments( rechits );
88  // add the found subset of segments to the collection of all segments in this chamber:
89  segments_temp.insert( segments_temp.end(), segs.begin(), segs.end() );
90  }
91 
92  return segments_temp;
93 }
CSCSegAlgoPreClustering * preCluster_
Definition: CSCSegAlgoDF.h:161
bool preClustering
Definition: CSCSegAlgoDF.h:145
std::vector< CSCSegment > buildSegments(const ChamberHitContainer &rechits)
int minHitsForPreClustering
Definition: CSCSegAlgoDF.h:146
std::vector< std::vector< const CSCRecHit2D * > > clusterHits(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
clusterize
const CSCChamber * theChamber
Definition: CSCSegAlgoDF.h:130
void CSCSegAlgoDF::tryAddingHitsToSegment ( const ChamberHitContainer rechitsInChamber,
const ChamberHitContainerCIt  i1,
const ChamberHitContainerCIt  i2,
const LayerIndex layerIndex 
)
private

Utility functions.

Try adding non-used hits to segment
Skip the layers containing the segment endpoints on first 2 passes, but then
try hits on layer containing the segment starting points on 2nd and/or 3rd pass
if segment has >2 hits. Test each hit on the other layers to see if it is near
the segment using rechit error matrix.
If it is, see whether there is already a hit on the segment from the same layer

  • if so, and there are more than 2 hits on the segment, copy the segment,
    replace the old hit with the new hit. If the new segment chi2 is better
    then replace the original segment with the new one
  • if not, copy the segment, add the hit if it's within a certain range.

Definition at line 266 of file CSCSegAlgoDF.cc.

References addHit(), closeHits, compareProtoSegment(), h, hasHitOnLayer(), i, cuy::ib, isHitNearSegment(), protoSegment, updateParameters(), and usedHits.

Referenced by buildSegments().

269  {
270 
271 /* Iterate over the layers with hits in the chamber
272  * Skip the layers containing the segment endpoints on first pass, but then
273  * try hits on layer containing the segment starting points on 2nd pass
274  * if segment has >2 hits. Once a hit is added to a layer, don't replace it
275  * until 2nd iteration
276  */
277 
279  ChamberHitContainerCIt ie = rechits.end();
280  closeHits.clear();
281 
282  for ( ChamberHitContainerCIt i = ib; i != ie; ++i ) {
283 
284  if (i == i1 || i == i2 ) continue;
285  if ( usedHits[i-ib] ) continue; // Don't use hits already part of a segment.
286 
287  const CSCRecHit2D* h = *i;
288  int layer = layerIndex[i-ib];
289  int layer1 = layerIndex[i1-ib];
290  int layer2 = layerIndex[i2-ib];
291 
292  // Low multiplicity case
293  if (rechits.size() < 9) {
294  if ( isHitNearSegment( h ) ) {
295  if ( !hasHitOnLayer(layer) ) {
296  addHit(h, layer);
297  } else {
298  closeHits.push_back(h);
299  }
300  }
301 
302  // High multiplicity case
303  } else {
304  if ( isHitNearSegment( h ) ) {
305  if ( !hasHitOnLayer(layer) ) {
306  addHit(h, layer);
308  // Don't change the starting points at this stage !!!
309  } else {
310  closeHits.push_back(h);
311  if (layer != layer1 && layer != layer2 ) compareProtoSegment(h, layer);
312  }
313  }
314  }
315  }
316 
317  if ( int(protoSegment.size()) < 3) return;
318 
320 
321  // 2nd pass to remove biases
322  // This time, also consider changing the endpoints
323  for ( ChamberHitContainerCIt i = closeHits.begin() ; i != closeHits.end(); ++i ) {
324  const CSCRecHit2D* h = *i;
325  int layer = (*i)->cscDetId().layer();
326  compareProtoSegment(h, layer);
327  }
328 
329 }
int i
Definition: DBlmapReader.cc:9
ChamberHitContainer protoSegment
Definition: CSCSegAlgoDF.h:135
std::vector< const CSCRecHit2D * >::const_iterator ChamberHitContainerCIt
Definition: CSCSegAlgoDF.h:56
int ib
Definition: cuy.py:660
ChamberHitContainer closeHits
Definition: CSCSegAlgoDF.h:133
bool addHit(const CSCRecHit2D *hit, int layer)
bool isHitNearSegment(const CSCRecHit2D *h) const
void updateParameters(void)
void compareProtoSegment(const CSCRecHit2D *h, int layer)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
BoolContainer usedHits
Definition: CSCSegAlgoDF.h:131
bool hasHitOnLayer(int layer) const
void CSCSegAlgoDF::updateParameters ( void  )
private

Definition at line 395 of file CSCSegAlgoDF.cc.

References CSCRecHit2D::cscDetId(), CSCChamber::layer(), CSCDetId::layer(), CSCRecHit2D::localPosition(), CSCRecHit2D::localPositionError(), LogDebug, AlCaHLTBitMon_ParallelJobs::p, protoChi2, protoIntercept, protoSegment, protoSlope_u, protoSlope_v, theChamber, GeomDet::toGlobal(), GeomDet::toLocal(), findQualityFiles::v, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), LocalError::xy(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by compareProtoSegment(), pruneFromResidual(), and tryAddingHitsToSegment().

395  {
396 
397  // Compute slope from Least Square Fit
398  CLHEP::HepMatrix M(4,4,0);
399  CLHEP::HepVector B(4,0);
400 
401  ChamberHitContainer::const_iterator ih;
402 
403  for (ih = protoSegment.begin(); ih != protoSegment.end(); ++ih) {
404 
405  const CSCRecHit2D& hit = (**ih);
406  const CSCLayer* layer = theChamber->layer(hit.cscDetId().layer());
407  GlobalPoint gp = layer->toGlobal(hit.localPosition());
408  LocalPoint lp = theChamber->toLocal(gp);
409 
410  double u = lp.x();
411  double v = lp.y();
412  double z = lp.z();
413 
414  // ptc: Covariance matrix of local errors
415  CLHEP::HepMatrix IC(2,2);
416  IC(1,1) = hit.localPositionError().xx();
417  IC(1,2) = hit.localPositionError().xy();
418  IC(2,2) = hit.localPositionError().yy();
419  IC(2,1) = IC(1,2); // since Cov is symmetric
420 
421  // ptc: Invert covariance matrix (and trap if it fails!)
422  int ierr = 0;
423  IC.invert(ierr); // inverts in place
424  if (ierr != 0) {
425  LogDebug("CSC") << "CSCSegment::fitSlopes: failed to invert covariance matrix=\n" << IC << "\n";
426  }
427 
428  M(1,1) += IC(1,1);
429  M(1,2) += IC(1,2);
430  M(1,3) += IC(1,1) * z;
431  M(1,4) += IC(1,2) * z;
432  B(1) += u * IC(1,1) + v * IC(1,2);
433 
434  M(2,1) += IC(2,1);
435  M(2,2) += IC(2,2);
436  M(2,3) += IC(2,1) * z;
437  M(2,4) += IC(2,2) * z;
438  B(2) += u * IC(2,1) + v * IC(2,2);
439 
440  M(3,1) += IC(1,1) * z;
441  M(3,2) += IC(1,2) * z;
442  M(3,3) += IC(1,1) * z * z;
443  M(3,4) += IC(1,2) * z * z;
444  B(3) += ( u * IC(1,1) + v * IC(1,2) ) * z;
445 
446  M(4,1) += IC(2,1) * z;
447  M(4,2) += IC(2,2) * z;
448  M(4,3) += IC(2,1) * z * z;
449  M(4,4) += IC(2,2) * z * z;
450  B(4) += ( u * IC(2,1) + v * IC(2,2) ) * z;
451  }
452 
453  CLHEP::HepVector p = solve(M, B);
454 
455  // Update member variables
456  // Note that origin has local z = 0
457 
458  protoIntercept = LocalPoint(p(1), p(2), 0.);
459  protoSlope_u = p(3);
460  protoSlope_v = p(4);
461 
462 
463  // Determine Chi^2 for the proto wire segment
464 
465  double chsq = 0.;
466 
467  for (ih = protoSegment.begin(); ih != protoSegment.end(); ++ih) {
468 
469  const CSCRecHit2D& hit = (**ih);
470  const CSCLayer* layer = theChamber->layer(hit.cscDetId().layer());
471  GlobalPoint gp = layer->toGlobal(hit.localPosition());
472  LocalPoint lp = theChamber->toLocal(gp);
473 
474  double u = lp.x();
475  double v = lp.y();
476  double z = lp.z();
477 
478  double du = protoIntercept.x() + protoSlope_u * z - u;
479  double dv = protoIntercept.y() + protoSlope_v * z - v;
480 
481  CLHEP::HepMatrix IC(2,2);
482  IC(1,1) = hit.localPositionError().xx();
483  IC(1,2) = hit.localPositionError().xy();
484  IC(2,2) = hit.localPositionError().yy();
485  IC(2,1) = IC(1,2);
486 
487  // Invert covariance matrix
488  int ierr = 0;
489  IC.invert(ierr);
490  if (ierr != 0) {
491  LogDebug("CSC") << "CSCSegment::fillChiSquared: failed to invert covariance matrix=\n" << IC << "\n";
492  }
493  chsq += du*du*IC(1,1) + 2.*du*dv*IC(1,2) + dv*dv*IC(2,2);
494  }
495  protoChi2 = chsq;
496 }
#define LogDebug(id)
float xx() const
Definition: LocalError.h:24
ChamberHitContainer protoSegment
Definition: CSCSegAlgoDF.h:135
CSCDetId cscDetId() const
Definition: CSCRecHit2D.h:52
double_binary B
Definition: DDStreamer.cc:234
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:67
int layer() const
Definition: CSCDetId.h:74
float float float z
float xy() const
Definition: LocalError.h:25
LocalError localPositionError() const
Definition: CSCRecHit2D.h:51
float yy() const
Definition: LocalError.h:26
LocalPoint protoIntercept
Definition: CSCSegAlgoDF.h:139
T z() const
Definition: PV3DBase.h:64
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:39
float protoSlope_v
Definition: CSCSegAlgoDF.h:138
float protoSlope_u
Definition: CSCSegAlgoDF.h:137
double protoChi2
Definition: CSCSegAlgoDF.h:140
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
const CSCChamber * theChamber
Definition: CSCSegAlgoDF.h:130
LocalPoint localPosition() const
Definition: CSCRecHit2D.h:50
T x() const
Definition: PV3DBase.h:62
AlgebraicSymMatrix CSCSegAlgoDF::weightMatrix ( void  ) const
private

Definition at line 583 of file CSCSegAlgoDF.cc.

References CSCRecHit2D::localPositionError(), makeMuonMisalignmentScenario::matrix, protoSegment, LocalError::xx(), LocalError::xy(), and LocalError::yy().

Referenced by calculateError().

583  {
584 
585  std::vector<const CSCRecHit2D*>::const_iterator it;
586  int nhits = protoSegment.size();
587  AlgebraicSymMatrix matrix(2*nhits, 0);
588  int row = 0;
589 
590  for (it = protoSegment.begin(); it != protoSegment.end(); ++it) {
591 
592  const CSCRecHit2D& hit = (**it);
593  ++row;
594  matrix(row, row) = hit.localPositionError().xx();
595  matrix(row, row+1) = hit.localPositionError().xy();
596  ++row;
597  matrix(row, row-1) = hit.localPositionError().xy();
598  matrix(row, row) = hit.localPositionError().yy();
599  }
600  int ierr;
601  matrix.invert(ierr);
602  return matrix;
603 }
float xx() const
Definition: LocalError.h:24
ChamberHitContainer protoSegment
Definition: CSCSegAlgoDF.h:135
float xy() const
Definition: LocalError.h:25
LocalError localPositionError() const
Definition: CSCRecHit2D.h:51
float yy() const
Definition: LocalError.h:26
CLHEP::HepSymMatrix AlgebraicSymMatrix

Member Data Documentation

float CSCSegAlgoDF::chi2Max
private

Definition at line 158 of file CSCSegAlgoDF.h.

Referenced by buildSegments(), and CSCSegAlgoDF().

ChamberHitContainer CSCSegAlgoDF::closeHits
private

Definition at line 133 of file CSCSegAlgoDF.h.

Referenced by flagHitsAsUsed(), and tryAddingHitsToSegment().

bool CSCSegAlgoDF::debug
private

Definition at line 144 of file CSCSegAlgoDF.h.

Referenced by CSCSegAlgoDF().

double CSCSegAlgoDF::dPhiFineMax
private

Definition at line 155 of file CSCSegAlgoDF.h.

Referenced by CSCSegAlgoDF(), and isHitNearSegment().

double CSCSegAlgoDF::dRPhiFineMax
private

Definition at line 154 of file CSCSegAlgoDF.h.

Referenced by CSCSegAlgoDF(), and isHitNearSegment().

float CSCSegAlgoDF::maxRatioResidual
private

Definition at line 159 of file CSCSegAlgoDF.h.

Referenced by CSCSegAlgoDF(), and pruneFromResidual().

int CSCSegAlgoDF::minHitsForPreClustering
private

Definition at line 146 of file CSCSegAlgoDF.h.

Referenced by CSCSegAlgoDF(), and run().

int CSCSegAlgoDF::minHitsPerSegment
private

Definition at line 152 of file CSCSegAlgoDF.h.

Referenced by buildSegments(), and CSCSegAlgoDF().

int CSCSegAlgoDF::minLayersApart
private

Definition at line 149 of file CSCSegAlgoDF.h.

Referenced by buildSegments(), and CSCSegAlgoDF().

int CSCSegAlgoDF::muonsPerChamberMax
private

Definition at line 153 of file CSCSegAlgoDF.h.

const std::string CSCSegAlgoDF::myName
private

Definition at line 129 of file CSCSegAlgoDF.h.

int CSCSegAlgoDF::nHitsPerClusterIsShower
private

Definition at line 150 of file CSCSegAlgoDF.h.

Referenced by buildSegments(), and CSCSegAlgoDF().

float CSCSegAlgoDF::nSigmaFromSegment
private

Definition at line 151 of file CSCSegAlgoDF.h.

CSCSegAlgoPreClustering* CSCSegAlgoDF::preCluster_
private

Definition at line 161 of file CSCSegAlgoDF.h.

Referenced by CSCSegAlgoDF(), run(), and ~CSCSegAlgoDF().

bool CSCSegAlgoDF::preClustering
private

Definition at line 145 of file CSCSegAlgoDF.h.

Referenced by buildSegments(), CSCSegAlgoDF(), and run().

double CSCSegAlgoDF::protoChi2
private

Definition at line 140 of file CSCSegAlgoDF.h.

Referenced by buildSegments(), compareProtoSegment(), and updateParameters().

LocalVector CSCSegAlgoDF::protoDirection
private

Definition at line 141 of file CSCSegAlgoDF.h.

Referenced by buildSegments(), and compareProtoSegment().

LocalPoint CSCSegAlgoDF::protoIntercept
private
ChamberHitContainer CSCSegAlgoDF::protoSegment
private
float CSCSegAlgoDF::protoSlope_u
private
float CSCSegAlgoDF::protoSlope_v
private
bool CSCSegAlgoDF::Pruning
private

Definition at line 148 of file CSCSegAlgoDF.h.

Referenced by buildSegments(), and CSCSegAlgoDF().

ChamberHitContainer CSCSegAlgoDF::secondSeedHits
private

Definition at line 136 of file CSCSegAlgoDF.h.

Referenced by orderSecondSeed().

CSCSegAlgoShowering* CSCSegAlgoDF::showering_
private

Definition at line 162 of file CSCSegAlgoDF.h.

Referenced by buildSegments(), CSCSegAlgoDF(), and ~CSCSegAlgoDF().

float CSCSegAlgoDF::tanPhiMax
private

Definition at line 156 of file CSCSegAlgoDF.h.

Referenced by buildSegments(), and CSCSegAlgoDF().

float CSCSegAlgoDF::tanThetaMax
private

Definition at line 157 of file CSCSegAlgoDF.h.

Referenced by buildSegments(), and CSCSegAlgoDF().

bool CSCSegAlgoDF::testSeg
private

Definition at line 147 of file CSCSegAlgoDF.h.

const CSCChamber* CSCSegAlgoDF::theChamber
private
BoolContainer CSCSegAlgoDF::usedHits
private

Definition at line 131 of file CSCSegAlgoDF.h.

Referenced by buildSegments(), flagHitsAsUsed(), and tryAddingHitsToSegment().