CMS 3D CMS Logo

List of all members | Public Member Functions
CosmicMuonUtilities Class Reference

#include <CosmicMuonUtilities.h>

Public Member Functions

 CosmicMuonUtilities ()
 
bool isTraversing (const Trajectory &) const
 
std::string print (const ConstMuonRecHitContainer &) const
 
std::string print (const MuonRecHitContainer &) const
 
std::string print (const ConstRecHitContainer &) const
 
void reverseDirection (TrajectoryStateOnSurface &, const MagneticField *) const
 
TrajectoryStateOnSurface stepPropagate (const TrajectoryStateOnSurface &, const ConstRecHitPointer &, const Propagator &) const
 
virtual ~CosmicMuonUtilities ()
 

Detailed Description

Definition at line 30 of file CosmicMuonUtilities.h.

Constructor & Destructor Documentation

CosmicMuonUtilities::CosmicMuonUtilities ( )

Definition at line 22 of file CosmicMuonUtilities.cc.

22 {}
CosmicMuonUtilities::~CosmicMuonUtilities ( )
virtual

Definition at line 27 of file CosmicMuonUtilities.cc.

27 {}

Member Function Documentation

bool CosmicMuonUtilities::isTraversing ( const Trajectory t) const

Definition at line 100 of file CosmicMuonUtilities.cc.

References hfClusterShapes_cfi::hits, PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::perp(), Trajectory::recHits(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

100  {
102 
103  if (hits.empty())
104  return false;
105 
106  ConstRecHitContainer::const_iterator frontHit = hits.begin();
107  ConstRecHitContainer::const_iterator backHit = hits.end() - 1;
108 
109  // find first valid hit at both ends of the trajectory
110  while (!(*frontHit)->isValid() && frontHit != backHit) {
111  ++frontHit;
112  }
113  while (!(*backHit)->isValid() && backHit != frontHit) {
114  --backHit;
115  }
116 
117  if (frontHit == backHit)
118  return false;
119 
120  GlobalPoint frontPos = (*frontHit)->globalPosition();
121  GlobalPoint backPos = (*backHit)->globalPosition();
122 
123  // are there separate muon hits in 2 different hemispheres
124  GlobalVector deltaPos(frontPos - backPos);
125  if (deltaPos.mag() < 100.0)
126  return false;
127  if (fabs(deltaPos.z()) > 500.0)
128  return true;
129  if (deltaPos.perp() > 350.0)
130  return true;
131  GlobalPoint middle(
132  (frontPos.x() + backPos.x()) / 2, (frontPos.y() + backPos.y()) / 2, (frontPos.z() + backPos.z()) / 2);
133 
134  return ((middle.perp() < frontPos.perp()) && (middle.perp() < backPos.perp()));
135 }
T perp() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:60
ConstRecHitContainer recHits() const
Definition: Trajectory.h:186
T z() const
Definition: PV3DBase.h:61
std::vector< ConstRecHitPointer > ConstRecHitContainer
T x() const
Definition: PV3DBase.h:59
string CosmicMuonUtilities::print ( const ConstMuonRecHitContainer hits) const

Definition at line 40 of file CosmicMuonUtilities.cc.

References convertSQLitetoXML_cfg::output, and PV3DBase< T, PVType, FrameType >::perp().

40  {
41  stringstream output;
42 
43  for (ConstMuonRecHitContainer::const_iterator ir = hits.begin(); ir != hits.end(); ir++) {
44  if (!(*ir)->isValid()) {
45  output << "invalid RecHit" << endl;
46  continue;
47  }
48 
49  const GlobalPoint& pos = (*ir)->globalPosition();
50  output << "pos" << pos << "radius " << pos.perp() << " dim " << (*ir)->dimension() << " det "
51  << (*ir)->det()->geographicalId().det() << " sub det " << (*ir)->det()->subDetector() << endl;
52  }
53 
54  return output.str();
55 }
T perp() const
Definition: PV3DBase.h:69
string CosmicMuonUtilities::print ( const MuonRecHitContainer hits) const

Definition at line 60 of file CosmicMuonUtilities.cc.

References convertSQLitetoXML_cfg::output, and PV3DBase< T, PVType, FrameType >::perp().

60  {
61  stringstream output;
62 
63  for (MuonRecHitContainer::const_iterator ir = hits.begin(); ir != hits.end(); ir++) {
64  if (!(*ir)->isValid()) {
65  output << "invalid RecHit" << endl;
66  continue;
67  }
68 
69  const GlobalPoint& pos = (*ir)->globalPosition();
70  output << "pos" << pos << "radius " << pos.perp() << " dim " << (*ir)->dimension() << " det "
71  << (*ir)->det()->geographicalId().det() << " sub det " << (*ir)->det()->subDetector() << endl;
72  }
73 
74  return output.str();
75 }
T perp() const
Definition: PV3DBase.h:69
string CosmicMuonUtilities::print ( const ConstRecHitContainer hits) const

Definition at line 80 of file CosmicMuonUtilities.cc.

References convertSQLitetoXML_cfg::output, and PV3DBase< T, PVType, FrameType >::perp().

80  {
81  stringstream output;
82 
83  for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator ir = hits.begin(); ir != hits.end(); ir++) {
84  if (!(*ir)->isValid()) {
85  output << "invalid RecHit" << endl;
86  continue;
87  }
88 
89  const GlobalPoint& pos = (*ir)->globalPosition();
90  output << "pos" << pos << "radius " << pos.perp() << " dim " << (*ir)->dimension() << " det "
91  << (*ir)->det()->geographicalId().det() << " sub det " << (*ir)->det()->subDetector() << endl;
92  }
93 
94  return output.str();
95 }
T perp() const
Definition: PV3DBase.h:69
void CosmicMuonUtilities::reverseDirection ( TrajectoryStateOnSurface tsos,
const MagneticField mgfield 
) const
TrajectoryStateOnSurface CosmicMuonUtilities::stepPropagate ( const TrajectoryStateOnSurface tsos,
const ConstRecHitPointer hit,
const Propagator prop 
) const

Definition at line 140 of file CosmicMuonUtilities.cc.

References mps_fire::dest, TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), LogTrace, PV3DBase< T, PVType, FrameType >::mag(), metname, PlaneBuilder::plane(), Propagator::propagate(), makeMuonMisalignmentScenario::rot, command_line::start, customisers::steps, AlCaHLTBitMon_QueryRunRegistry::string, TrajectoryStateOnSurface::surface(), Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by CosmicMuonSmoother::fit(), and CosmicMuonSmoother::smooth().

142  {
143  const std::string metname = "Muon|RecoMuon|CosmicMuonUtilities";
144 
146  GlobalPoint dest = hit->globalPosition();
147  GlobalVector StepVector = dest - start;
148  GlobalVector UnitStepVector = StepVector.unit();
149  GlobalPoint GP = start;
150  TrajectoryStateOnSurface currTsos(tsos);
151  TrajectoryStateOnSurface predTsos;
152  float totalDis = StepVector.mag();
153  LogTrace(metname) << "stepPropagate: propagate from: " << start << " to " << dest;
154  LogTrace(metname) << "stepPropagate: their distance: " << totalDis;
155 
156  int steps = 3; // need to optimize
157 
158  float oneStep = totalDis / steps;
159  Basic3DVector<float> Basic3DV(StepVector.x(), StepVector.y(), StepVector.z());
160  for (int istep = 0; istep < steps - 1; istep++) {
161  GP += oneStep * UnitStepVector;
162  Surface::PositionType pos(GP.x(), GP.y(), GP.z());
163  LogTrace(metname) << "stepPropagate: a middle plane: " << pos << endl;
164  Surface::RotationType rot(Basic3DV, float(0));
165  PlaneBuilder::ReturnType SteppingPlane = PlaneBuilder().plane(pos, rot);
166  TrajectoryStateOnSurface predTsos = prop.propagate(currTsos, *SteppingPlane);
167  if (predTsos.isValid()) {
168  currTsos = predTsos;
169  LogTrace(metname) << "stepPropagate: middle state " << currTsos.globalPosition() << endl;
170  }
171  }
172 
173  predTsos = prop.propagate(currTsos, hit->det()->surface());
174 
175  return predTsos;
176 }
Definition: start.py:1
const std::string metname
ReturnType plane(const PositionType &pos, const RotationType &rot) const
Definition: PlaneBuilder.h:21
T y() const
Definition: PV3DBase.h:60
GlobalPoint globalPosition() const
T mag() const
Definition: PV3DBase.h:64
T z() const
Definition: PV3DBase.h:61
#define LogTrace(id)
Vector3DBase unit() const
Definition: Vector3DBase.h:54
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
T x() const
Definition: PV3DBase.h:59