CMS 3D CMS Logo

CosmicMuonUtilities.cc
Go to the documentation of this file.
1 
8 
13 
15 
16 using namespace edm;
17 using namespace std;
18 
19 //
20 // constructor
21 //
23 
24 //
25 // destructor
26 //
28 
30  GlobalTrajectoryParameters gtp(tsos.globalPosition(), -tsos.globalMomentum(), -tsos.charge(), mgfield);
31  TrajectoryStateOnSurface newTsos(gtp, tsos.cartesianError(), tsos.surface());
32  tsos = newTsos;
33 
34  return;
35 }
36 
37 //
38 //
39 //
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 }
56 
57 //
58 //
59 //
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 }
76 
77 //
78 //
79 //
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 }
96 
97 //
98 //
99 //
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 }
136 
137 //
138 //
139 //
141  const ConstRecHitPointer& hit,
142  const Propagator& prop) const {
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 }
Vector3DBase
Definition: Vector3DBase.h:8
Propagator.h
TkRotation< float >
start
Definition: start.py:1
MessageLogger.h
CosmicMuonUtilities::isTraversing
bool isTraversing(const Trajectory &) const
Definition: CosmicMuonUtilities.cc:100
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
deltaPhi.h
edm
HLT enums.
Definition: AlignableModifier.h:19
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
pos
Definition: PixelAliasList.h:18
CosmicMuonUtilities::~CosmicMuonUtilities
virtual ~CosmicMuonUtilities()
Definition: CosmicMuonUtilities.cc:27
TrajectoryStateOnSurface::charge
TrackCharge charge() const
Definition: TrajectoryStateOnSurface.h:68
MuonTransientTrackingRecHit::ConstMuonRecHitContainer
std::vector< ConstMuonRecHitPointer > ConstMuonRecHitContainer
Definition: MuonTransientTrackingRecHit.h:27
MuonTransientTrackingRecHit::MuonRecHitContainer
std::vector< MuonRecHitPointer > MuonRecHitContainer
Definition: MuonTransientTrackingRecHit.h:26
ReferenceCountingPointer< Plane >
CosmicMuonUtilities::reverseDirection
void reverseDirection(TrajectoryStateOnSurface &, const MagneticField *) const
Definition: CosmicMuonUtilities.cc:29
CosmicMuonUtilities::stepPropagate
TrajectoryStateOnSurface stepPropagate(const TrajectoryStateOnSurface &, const ConstRecHitPointer &, const Propagator &) const
Definition: CosmicMuonUtilities.cc:140
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
Propagator
Definition: Propagator.h:44
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
PlaneBuilder.h
CosmicMuonUtilities.h
Vector3DBase::unit
Vector3DBase unit() const
Definition: Vector3DBase.h:54
ConstRecHitPointer
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
Definition: MillePedeAlignmentAlgorithm.cc:75
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
CosmicMuonUtilities::CosmicMuonUtilities
CosmicMuonUtilities()
Definition: CosmicMuonUtilities.cc:22
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
Trajectory.h
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
std
Definition: JetResolutionObject.h:76
CosmicMuonUtilities::print
std::string print(const ConstMuonRecHitContainer &) const
Definition: CosmicMuonUtilities.cc:40
Trajectory
Definition: Trajectory.h:38
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:234
command_line.start
start
Definition: command_line.py:167
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
MagneticField
Definition: MagneticField.h:19
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