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 29 of file CosmicMuonUtilities.h.

Constructor & Destructor Documentation

CosmicMuonUtilities::CosmicMuonUtilities ( )

Definition at line 24 of file CosmicMuonUtilities.cc.

24  {
25 }
CosmicMuonUtilities::~CosmicMuonUtilities ( )
virtual

Definition at line 31 of file CosmicMuonUtilities.cc.

31  {
32 }

Member Function Documentation

bool CosmicMuonUtilities::isTraversing ( const Trajectory t) const

Definition at line 133 of file CosmicMuonUtilities.cc.

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

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

Definition at line 52 of file CosmicMuonUtilities.cc.

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

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

Definition at line 79 of file CosmicMuonUtilities.cc.

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

79  {
80 
81  stringstream output;
82 
83  for (MuonRecHitContainer::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
91  << "pos"<<pos
92  << "radius "<<pos.perp()
93  << " dim " << (*ir)->dimension()
94  << " det " << (*ir)->det()->geographicalId().det()
95  << " sub det " << (*ir)->det()->subDetector()<<endl;
96  }
97 
98  return output.str();
99 
100 }
T perp() const
Definition: PV3DBase.h:66
string CosmicMuonUtilities::print ( const ConstRecHitContainer hits) const

Definition at line 106 of file CosmicMuonUtilities.cc.

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

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

References alignmentValidation::dest, TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), LogTrace, PV3DBase< T, PVType, FrameType >::mag(), metname, PlaneBuilder::plane(), pos, Propagator::propagate(), cmsPerfSuiteHarvest::steps, 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().

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