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 ConstRecHitContainer &) const
 
std::string print (const MuonRecHitContainer &) 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::CosmicMuonUtilities ( )

Definition at line 22 of file CosmicMuonUtilities.cc.

22 {}

◆ ~CosmicMuonUtilities()

CosmicMuonUtilities::~CosmicMuonUtilities ( )
virtual

Definition at line 27 of file CosmicMuonUtilities.cc.

27 {}

Member Function Documentation

◆ isTraversing()

bool CosmicMuonUtilities::isTraversing ( const Trajectory t) const

Definition at line 100 of file CosmicMuonUtilities.cc.

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 }

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

◆ print() [1/3]

string CosmicMuonUtilities::print ( const ConstMuonRecHitContainer hits) const

Definition at line 40 of file CosmicMuonUtilities.cc.

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 }

References hfClusterShapes_cfi::hits, and convertSQLitetoXML_cfg::output.

◆ print() [2/3]

string CosmicMuonUtilities::print ( const ConstRecHitContainer hits) const

Definition at line 80 of file CosmicMuonUtilities.cc.

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 }

References hfClusterShapes_cfi::hits, and convertSQLitetoXML_cfg::output.

◆ print() [3/3]

string CosmicMuonUtilities::print ( const MuonRecHitContainer hits) const

Definition at line 60 of file CosmicMuonUtilities.cc.

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 }

References hfClusterShapes_cfi::hits, and convertSQLitetoXML_cfg::output.

◆ reverseDirection()

void CosmicMuonUtilities::reverseDirection ( TrajectoryStateOnSurface tsos,
const MagneticField mgfield 
) const

◆ stepPropagate()

TrajectoryStateOnSurface CosmicMuonUtilities::stepPropagate ( const TrajectoryStateOnSurface tsos,
const ConstRecHitPointer hit,
const Propagator prop 
) const

Definition at line 140 of file CosmicMuonUtilities.cc.

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 }

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, 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().

Vector3DBase
Definition: Vector3DBase.h:8
TkRotation< float >
start
Definition: start.py:1
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
TrajectoryStateOnSurface::cartesianError
const CartesianTrajectoryError cartesianError() const
Definition: TrajectoryStateOnSurface.h:71
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
pos
Definition: PixelAliasList.h:18
TrajectoryStateOnSurface::charge
TrackCharge charge() const
Definition: TrajectoryStateOnSurface.h:68
ReferenceCountingPointer< Plane >
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
Vector3DBase::unit
Vector3DBase unit() const
Definition: Vector3DBase.h:54
GlobalTrajectoryParameters
Definition: GlobalTrajectoryParameters.h:15
Point3DBase< float, GlobalTag >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackingRecHit::ConstRecHitContainer
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: TrackingRecHit.h:32
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
Propagator::propagate
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
PlaneBuilder::plane
ReturnType plane(const PositionType &pos, const RotationType &rot) const
Definition: PlaneBuilder.h:21
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
TrajectoryStateOnSurface::surface
const SurfaceType & surface() const
Definition: TrajectoryStateOnSurface.h:78
PlaneBuilder
Definition: PlaneBuilder.h:13
customisers.steps
steps
Definition: customisers.py:40
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
command_line.start
start
Definition: command_line.py:167
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
Basic3DVector< float >
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
hit
Definition: SiStripHitEffFromCalibTree.cc:88
mps_fire.dest
dest
Definition: mps_fire.py:179
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:40