CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 27 of file CosmicMuonUtilities.h.

Constructor & Destructor Documentation

CosmicMuonUtilities::CosmicMuonUtilities ( )

Definition at line 22 of file CosmicMuonUtilities.cc.

22  {
23 }
CosmicMuonUtilities::~CosmicMuonUtilities ( )
virtual

Definition at line 29 of file CosmicMuonUtilities.cc.

29  {
30 }

Member Function Documentation

bool CosmicMuonUtilities::isTraversing ( const Trajectory t) const

Definition at line 131 of file CosmicMuonUtilities.cc.

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

131  {
132 
134 
135  if ( hits.empty() ) return false;
136 
137  ConstRecHitContainer::const_iterator frontHit = hits.begin();
138  ConstRecHitContainer::const_iterator backHit = hits.end() - 1;
139 
140  // find first valid hit at both ends of the trajectory
141  while ( !(*frontHit)->isValid() && frontHit != backHit) {++frontHit;}
142  while ( !(*backHit)->isValid() && backHit != frontHit) {--backHit;}
143 
144  if ( frontHit == backHit ) return false;
145 
146  GlobalPoint frontPos = (*frontHit)->globalPosition();
147  GlobalPoint backPos = (*backHit)->globalPosition();
148 
149  // are there separate muon hits in 2 different hemispheres
150  GlobalVector deltaPos(frontPos - backPos);
151  if ( deltaPos.mag() < 100.0 ) return false;
152  if ( fabs(deltaPos.z() ) > 500.0 ) return true;
153  if ( deltaPos.perp() > 350.0 ) return true;
154  GlobalPoint middle((frontPos.x()+backPos.x())/2,
155  (frontPos.y()+backPos.y())/2,
156  (frontPos.z()+backPos.z())/2);
157 
158  return ( (middle.perp() < frontPos.perp()) && (middle.perp() < backPos.perp()) );
159 
160 }
T perp() const
Definition: PV3DBase.h:72
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
std::vector< ConstRecHitPointer > ConstRecHitContainer
T x() const
Definition: PV3DBase.h:62
string CosmicMuonUtilities::print ( const ConstMuonRecHitContainer hits) const

Definition at line 50 of file CosmicMuonUtilities.cc.

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

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

Definition at line 77 of file CosmicMuonUtilities.cc.

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

77  {
78 
79  stringstream output;
80 
81  for (MuonRecHitContainer::const_iterator ir = hits.begin(); ir != hits.end(); ir++ ) {
82  if ( !(*ir)->isValid() ) {
83  output << "invalid RecHit"<<endl;
84  continue;
85  }
86 
87  const GlobalPoint& pos = (*ir)->globalPosition();
88  output
89  << "pos"<<pos
90  << "radius "<<pos.perp()
91  << " dim " << (*ir)->dimension()
92  << " det " << (*ir)->det()->geographicalId().det()
93  << " sub det " << (*ir)->det()->subDetector()<<endl;
94  }
95 
96  return output.str();
97 
98 }
T perp() const
Definition: PV3DBase.h:72
string CosmicMuonUtilities::print ( const ConstRecHitContainer hits) const

Definition at line 104 of file CosmicMuonUtilities.cc.

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

104  {
105 
106  stringstream output;
107 
108  for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator ir = hits.begin(); ir != hits.end(); ir++ ) {
109  if ( !(*ir)->isValid() ) {
110  output << "invalid RecHit"<<endl;
111  continue;
112  }
113 
114  const GlobalPoint& pos = (*ir)->globalPosition();
115  output
116  << "pos"<<pos
117  << "radius "<<pos.perp()
118  << " dim " << (*ir)->dimension()
119  << " det " << (*ir)->det()->geographicalId().det()
120  << " sub det " << (*ir)->det()->subDetector()<<endl;
121  }
122 
123  return output.str();
124 
125 }
T perp() const
Definition: PV3DBase.h:72
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 166 of file CosmicMuonUtilities.cc.

References alignCSCRings::dest, TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), LogTrace, PV3DBase< T, PVType, FrameType >::mag(), metname, PlaneBuilder::plane(), Propagator::propagate(), makeMuonMisalignmentScenario::rot, dqm_diff::start, relval_machine::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().

168  {
169 
170  const std::string metname = "Muon|RecoMuon|CosmicMuonUtilities";
171 
173  GlobalPoint dest = hit->globalPosition();
174  GlobalVector StepVector = dest - start;
175  GlobalVector UnitStepVector = StepVector.unit();
176  GlobalPoint GP =start;
177  TrajectoryStateOnSurface currTsos(tsos);
178  TrajectoryStateOnSurface predTsos;
179  float totalDis = StepVector.mag();
180  LogTrace(metname)<<"stepPropagate: propagate from: "<<start<<" to "<<dest;
181  LogTrace(metname)<<"stepPropagate: their distance: "<<totalDis;
182 
183  int steps = 3; // need to optimize
184 
185  float oneStep = totalDis/steps;
186  Basic3DVector<float> Basic3DV(StepVector.x(),StepVector.y(),StepVector.z());
187  for ( int istep = 0 ; istep < steps - 1 ; istep++) {
188  GP += oneStep*UnitStepVector;
189  Surface::PositionType pos(GP.x(),GP.y(),GP.z());
190  LogTrace(metname)<<"stepPropagate: a middle plane: "<<pos<<endl;
191  Surface::RotationType rot( Basic3DV , float(0));
192  PlaneBuilder::ReturnType SteppingPlane = PlaneBuilder().plane(pos,rot);
193  TrajectoryStateOnSurface predTsos = prop.propagate(currTsos, *SteppingPlane);
194  if (predTsos.isValid()) {
195  currTsos=predTsos;
196  LogTrace(metname)<<"stepPropagate: middle state "<< currTsos.globalPosition()<<endl;
197  }
198  }
199 
200  predTsos = prop.propagate(currTsos, hit->det()->surface());
201 
202  return predTsos;
203 
204 }
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
const std::string metname
ReturnType plane(const PositionType &pos, const RotationType &rot) const
Definition: PlaneBuilder.h:22
T y() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const
T mag() const
Definition: PV3DBase.h:67
T z() const
Definition: PV3DBase.h:64
#define LogTrace(id)
Vector3DBase unit() const
Definition: Vector3DBase.h:57
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:56
T x() const
Definition: PV3DBase.h:62