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
MuonResidualsFromTrack Class Reference

#include <MuonResidualsFromTrack.h>

Public Member Functions

const std::vector< DetIdchamberIds () const
 
MuonChamberResidualchamberResidual (DetId chamberId, int type)
 
bool contains_TIDTEC () const
 
 MuonResidualsFromTrack (edm::ESHandle< GlobalTrackingGeometry > globalGeometry, const Trajectory *traj, AlignableNavigator *navigator, double maxResidual)
 
double trackerChi2 () const
 
int trackerNumHits () const
 
double trackerRedChi2 () const
 
 ~MuonResidualsFromTrack ()
 

Private Attributes

std::vector< DetIdm_chamberIds
 
bool m_contains_TIDTEC
 
std::map< DetId,
MuonChamberResidual * > 
m_csc
 
std::map< DetId,
MuonChamberResidual * > 
m_dt13
 
std::map< DetId,
MuonChamberResidual * > 
m_dt2
 
double m_tracker_chi2
 
int m_tracker_numHits
 
TrajectoryStateCombiner m_tsoscomb
 

Detailed Description

Date:
2009/02/27 18:58:29
Revision:
1.2
Author
J. Pivarski - Texas A&M University pivar.nosp@m.ski@.nosp@m.physi.nosp@m.cs.t.nosp@m.amu.e.nosp@m.du

Definition at line 29 of file MuonResidualsFromTrack.h.

Constructor & Destructor Documentation

MuonResidualsFromTrack::MuonResidualsFromTrack ( edm::ESHandle< GlobalTrackingGeometry globalGeometry,
const Trajectory traj,
AlignableNavigator navigator,
double  maxResidual 
)

Definition at line 3 of file MuonResidualsFromTrack.cc.

References AlignableNavigator::alignableFromDetId(), TrajectoryMeasurement::backwardPredictedState(), CSCDetId::chamber(), MuonSubdetId::CSC, MuonSubdetId::DT, CSCDetId::endcap(), TrajectoryMeasurement::forwardPredictedState(), TrackingRecHit::geographicalId(), TrackingRecHit::isValid(), TrajectoryStateOnSurface::isValid(), CSCDetId::layer(), TrajectoryStateOnSurface::localError(), TrackingRecHit::localPosition(), TrajectoryStateOnSurface::localPosition(), TrackingRecHit::localPositionError(), m_chamberIds, m_contains_TIDTEC, m_csc, m_dt13, m_dt2, m_tracker_chi2, m_tracker_numHits, m_tsoscomb, Trajectory::measurements(), DetId::Muon, LocalTrajectoryError::positionError(), TrajectoryMeasurement::recHit(), CSCDetId::ring(), CSCDetId::station(), DTSuperLayerId::superlayer(), StripSubdetector::TEC, StripSubdetector::TID, DetId::Tracker, PV3DBase< T, PVType, FrameType >::x(), and LocalError::xx().

3  {
5  m_tracker_chi2 = 0.;
6  m_contains_TIDTEC = false;
7  m_chamberIds.clear();
8  m_dt13.clear();
9  m_dt2.clear();
10  m_csc.clear();
11 
12  std::vector<TrajectoryMeasurement> measurements = traj->measurements();
13  for (std::vector<TrajectoryMeasurement>::const_iterator im = measurements.begin(); im != measurements.end(); ++im) {
14  TrajectoryMeasurement meas = *im;
15  const TransientTrackingRecHit *hit = &(*meas.recHit());
16  DetId id = hit->geographicalId();
17 
18  if (hit->isValid()) {
20  if (tsos.isValid() && fabs(tsos.localPosition().x() - hit->localPosition().x()) < maxResidual) {
21 
22  if (id.det() == DetId::Tracker) {
23  double xresid = tsos.localPosition().x() - hit->localPosition().x();
24  double xresiderr2 = tsos.localError().positionError().xx() + hit->localPositionError().xx();
25 
27  m_tracker_chi2 += xresid * xresid / xresiderr2;
28 
29  if (id.subdetId() == StripSubdetector::TID || id.subdetId() == StripSubdetector::TEC) m_contains_TIDTEC = true;
30  }
31 
32  else if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::DT) {
33  const DTChamberId chamberId(id.rawId());
34  const DTSuperLayerId superLayerId(id.rawId());
35 
36  // have we seen this chamber before?
37  if (m_dt13.find(chamberId) == m_dt13.end() && m_dt2.find(chamberId) == m_dt2.end()) {
38  m_chamberIds.push_back(chamberId);
39  }
40 
41  if (superLayerId.superlayer() == 2) {
42  if (m_dt2.find(chamberId) == m_dt2.end()) {
43  AlignableDetOrUnitPtr chamberAlignable = navigator->alignableFromDetId(chamberId);
44  m_dt2[chamberId] = new MuonDT2ChamberResidual(globalGeometry, navigator, chamberId, chamberAlignable);
45  }
46 
47  m_dt2[chamberId]->addResidual(&tsos, hit);
48  }
49 
50  else {
51  if (m_dt13.find(chamberId) == m_dt13.end()) {
52  AlignableDetOrUnitPtr chamberAlignable = navigator->alignableFromDetId(chamberId);
53  m_dt13[chamberId] = new MuonDT13ChamberResidual(globalGeometry, navigator, chamberId, chamberAlignable);
54  }
55 
56  m_dt13[chamberId]->addResidual(&tsos, hit);
57  }
58  }
59 
60  else if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC) {
61  const CSCDetId cscDetId(id.rawId());
62  const CSCDetId chamberId(cscDetId.endcap(), cscDetId.station(), cscDetId.ring(), cscDetId.chamber());
63 
64  // not sure why we sometimes get layer == 0
65  if (cscDetId.layer() != 0) {
66 
67  // have we seen this chamber before?
68  if (m_csc.find(chamberId) == m_csc.end()) {
69  m_chamberIds.push_back(chamberId);
70 
71  AlignableDetOrUnitPtr chamberAlignable = navigator->alignableFromDetId(chamberId);
72  m_csc[chamberId] = new MuonCSCChamberResidual(globalGeometry, navigator, chamberId, chamberAlignable);
73  }
74 
75  m_csc[chamberId]->addResidual(&tsos, hit);
76 
77  } // end if cscDetId.layer() != 0
78  }
79 
80  } // end if track propagation is valid
81  } // end if hit is valid
82  } // end loop over measurments
83 }
float xx() const
Definition: LocalError.h:19
std::vector< DetId > m_chamberIds
TrajectoryStateOnSurface forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
std::map< DetId, MuonChamberResidual * > m_dt2
std::map< DetId, MuonChamberResidual * > m_csc
ConstRecHitPointer recHit() const
LocalError positionError() const
DataContainer const & measurements() const
Definition: Trajectory.h:169
static const int CSC
Definition: MuonSubdetId.h:15
const LocalTrajectoryError & localError() const
Definition: DetId.h:20
virtual LocalError localPositionError() const =0
bool isValid() const
static const int DT
Definition: MuonSubdetId.h:14
DetId geographicalId() const
T x() const
Definition: PV3DBase.h:56
virtual LocalPoint localPosition() const =0
std::map< DetId, MuonChamberResidual * > m_dt13
AlignableDetOrUnitPtr alignableFromDetId(const DetId &detid)
Returns AlignableDetOrUnitPtr corresponding to given DetId.
TrajectoryStateOnSurface backwardPredictedState() const
Access to backward predicted state (from smoother)
TrajectoryStateCombiner m_tsoscomb
MuonResidualsFromTrack::~MuonResidualsFromTrack ( )

Definition at line 85 of file MuonResidualsFromTrack.cc.

References m_csc, m_dt13, and m_dt2.

85  {
86  for (std::map<DetId,MuonChamberResidual*>::const_iterator residual = m_dt13.begin(); residual != m_dt13.end(); ++residual) {
87  delete residual->second;
88  }
89  for (std::map<DetId,MuonChamberResidual*>::const_iterator residual = m_dt2.begin(); residual != m_dt2.end(); ++residual) {
90  delete residual->second;
91  }
92  for (std::map<DetId,MuonChamberResidual*>::const_iterator residual = m_csc.begin(); residual != m_csc.end(); ++residual) {
93  delete residual->second;
94  }
95 }
std::map< DetId, MuonChamberResidual * > m_dt2
std::map< DetId, MuonChamberResidual * > m_csc
std::map< DetId, MuonChamberResidual * > m_dt13

Member Function Documentation

const std::vector<DetId> MuonResidualsFromTrack::chamberIds ( ) const
inline
MuonChamberResidual* MuonResidualsFromTrack::chamberResidual ( DetId  chamberId,
int  type 
)
inline

Definition at line 45 of file MuonResidualsFromTrack.h.

References MuonChamberResidual::kCSC, MuonChamberResidual::kDT13, MuonChamberResidual::kDT2, m_csc, m_dt13, m_dt2, and NULL.

Referenced by AlignmentMonitorMuonSystemMap1D::event(), AlignmentMonitorSegmentDifferences::event(), AlignmentMonitorMuonVsCurvature::event(), and MuonAlignmentFromReference::run().

45  {
47  if (m_dt13.find(chamberId) == m_dt13.end()) return NULL;
48  return m_dt13[chamberId];
49  }
50  else if (type == MuonChamberResidual::kDT2) {
51  if (m_dt2.find(chamberId) == m_dt2.end()) return NULL;
52  return m_dt2[chamberId];
53  }
54  else if (type == MuonChamberResidual::kCSC) {
55  if (m_csc.find(chamberId) == m_csc.end()) return NULL;
56  return m_csc[chamberId];
57  }
58  else return NULL;
59  };
type
Definition: HCALResponse.h:22
std::map< DetId, MuonChamberResidual * > m_dt2
#define NULL
Definition: scimark2.h:8
std::map< DetId, MuonChamberResidual * > m_csc
std::map< DetId, MuonChamberResidual * > m_dt13
bool MuonResidualsFromTrack::contains_TIDTEC ( ) const
inline
double MuonResidualsFromTrack::trackerChi2 ( ) const
inline

Definition at line 35 of file MuonResidualsFromTrack.h.

References m_tracker_chi2.

35 { return m_tracker_chi2; };
int MuonResidualsFromTrack::trackerNumHits ( ) const
inline
double MuonResidualsFromTrack::trackerRedChi2 ( ) const
inline

Member Data Documentation

std::vector<DetId> MuonResidualsFromTrack::m_chamberIds
private

Definition at line 68 of file MuonResidualsFromTrack.h.

Referenced by chamberIds(), and MuonResidualsFromTrack().

bool MuonResidualsFromTrack::m_contains_TIDTEC
private

Definition at line 66 of file MuonResidualsFromTrack.h.

Referenced by contains_TIDTEC(), and MuonResidualsFromTrack().

std::map<DetId,MuonChamberResidual*> MuonResidualsFromTrack::m_csc
private
std::map<DetId,MuonChamberResidual*> MuonResidualsFromTrack::m_dt13
private
std::map<DetId,MuonChamberResidual*> MuonResidualsFromTrack::m_dt2
private
double MuonResidualsFromTrack::m_tracker_chi2
private

Definition at line 65 of file MuonResidualsFromTrack.h.

Referenced by MuonResidualsFromTrack(), trackerChi2(), and trackerRedChi2().

int MuonResidualsFromTrack::m_tracker_numHits
private

Definition at line 64 of file MuonResidualsFromTrack.h.

Referenced by MuonResidualsFromTrack(), trackerNumHits(), and trackerRedChi2().

TrajectoryStateCombiner MuonResidualsFromTrack::m_tsoscomb
private

Definition at line 59 of file MuonResidualsFromTrack.h.

Referenced by MuonResidualsFromTrack().