test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrajectoryFactoryBase.cc
Go to the documentation of this file.
4 
6 
8 
9 
11  TrajectoryFactoryBase(config, 1)
12 {
13 }
14 
16  unsigned int tracksPerTrajectory) :
17  cfg_(config),
18  tracksPerTrajectory_(tracksPerTrajectory),
19  materialEffects_(materialEffects(config.getParameter<std::string>("MaterialEffects"))),
20  propDir_(propagationDirection(config.getParameter<std::string>("PropagationDirection"))),
21  useWithoutDet_(config.getParameter<bool>("UseHitWithoutDet")),
22  useInvalidHits_(config.getParameter<bool>("UseInvalidHits")),
23  useProjectedHits_(config.getParameter<bool>("UseProjectedHits")),
24  useBeamSpot_(config.getParameter<bool>("UseBeamSpot")),
25  includeAPEs_(config.getParameter<bool>("IncludeAPEs"))
26 {
27  edm::LogInfo("Alignment")
28  << "@SUB=TrajectoryFactoryBase"
29  << "TrajectoryFactory '" << cfg_.getParameter<std::string>("TrajectoryFactoryName")
30  << "' with following settings:"
31  << "\nmaterial effects: " << cfg_.getParameter<std::string>("MaterialEffects")
32  << "\npropagation: " << cfg_.getParameter<std::string>("PropagationDirection")
33  << "\nuse hits without det: " << (useWithoutDet_ ? "yes" : "no")
34  << "\nuse invalid hits: " << (useInvalidHits_ ? "yes" : "no")
35  << "\nuse projected hits: " << (useProjectedHits_ ? "yes" : "no")
36  << "\nuse beamspot: " << (useBeamSpot_ ? "yes" : "no")
37  << "\ninclude APEs: " << (includeAPEs_ ? "yes" : "no");
38 }
39 
40 
42 
43 
46 {
48 
49  // get the trajectory measurements in the correct order, i.e. reverse if needed
50  Trajectory::DataContainer trajectoryMeasurements
51  = this->orderedTrajectoryMeasurements( *track.first );
52  Trajectory::DataContainer::iterator itM = trajectoryMeasurements.begin();
53 
54  // get the innermost valid trajectory state - the corresponding hit must be o.k. as well
55  while ( itM != trajectoryMeasurements.end() )
56  {
57  if ( ( *itM ).updatedState().isValid() && useRecHit( ( *itM ).recHit() ) ) break;
58  ++itM;
59  }
60  if ( itM != trajectoryMeasurements.end() ) result.first = ( *itM ).updatedState();
61 
62  // get the valid RecHits
63  while ( itM != trajectoryMeasurements.end() )
64  {
65  TransientTrackingRecHit::ConstRecHitPointer aRecHit = ( *itM ).recHit();
66  if ( useRecHit( aRecHit ) ) result.second.push_back( aRecHit );
67  ++itM;
68  }
69 
70  return result;
71 }
72 
73 
76 {
77  const PropagationDirection dir = trajectory.direction();
78  const bool hitsAreReverse = ( ( dir == propDir_ || propDir_ == anyDirection ) ? false : true );
79 
80  const Trajectory::DataContainer & original = trajectory.measurements();
81 
82  if ( hitsAreReverse )
83  {
84  // Simply use this line instead of the copying by hand?
85  // const Trajectory::DataContainer reordered(original.rbegin(), original.rend());
86  Trajectory::DataContainer reordered;
87  reordered.reserve( original.size() );
88 
89  Trajectory::DataContainer::const_reverse_iterator itM;
90  for ( itM = original.rbegin(); itM != original.rend(); ++itM )
91  {
92  reordered.push_back( *itM );
93  }
94  return reordered;
95  }
96 
97  return original;
98 }
99 
100 
101 bool TrajectoryFactoryBase::sameSurface( const Surface& s1, const Surface& s2 ) const
102 {
103  // - Should use perp2() instead of perp()
104  // - Should not rely on floating point equality, but make a minimal range, e.g. 1.e-6 ?
105  return ( s1.eta() == s2.eta() ) && ( s1.phi() == s2.phi() ) && ( s1.position().perp() == s2.position().perp() );
106 }
107 
108 
109 bool
111 {
112  const GeomDet* det = hitPtr->det();
113  if ( !det && !useWithoutDet_ ) return false;
114 
115  if ( !( useInvalidHits_ || hitPtr->isValid() ) ) return false;
116 
117  if ( !useProjectedHits_ )
118  {
119  if(trackerHitRTTI::isProjected(*hitPtr)) return false;
120  }
121 
122  return true;
123 }
124 
125 
128 {
129  if ( strME == "MultipleScattering" ) return ReferenceTrajectoryBase::multipleScattering;
130  if ( strME == "EnergyLoss" ) return ReferenceTrajectoryBase::energyLoss;
131  if ( strME == "Combined" ) return ReferenceTrajectoryBase::combined;
132  if ( strME == "None" ) return ReferenceTrajectoryBase::none;
133  if ( strME == "BreakPoints" ) return ReferenceTrajectoryBase::breakPoints;
134  if ( strME == "BrokenLines" ) return ReferenceTrajectoryBase::brokenLinesCoarse;
135  if ( strME == "BrokenLinesCoarse" ) return ReferenceTrajectoryBase::brokenLinesCoarse;
136  if ( strME == "BrokenLinesFine" ) return ReferenceTrajectoryBase::brokenLinesFine;
137  if ( strME == "LocalGBL" ) return ReferenceTrajectoryBase::localGBL;
138  if ( strME == "CurvlinGBL" ) return ReferenceTrajectoryBase::curvlinGBL;
139 
140  throw cms::Exception("BadConfig")
141  << "[TrajectoryFactoryBase::materialEffects] Unknown parameter: " << strME;
142 }
143 
144 
147 {
148  if ( strPD == "oppositeToMomentum" ) return oppositeToMomentum;
149  if ( strPD == "alongMomentum" ) return alongMomentum;
150  if ( strPD == "anyDirection" ) return anyDirection;
151 
152  throw cms::Exception("BadConfig")
153  << "[TrajectoryFactoryBase::propagationDirection] Unknown parameter: " << strPD;
154 }
T getParameter(std::string const &) const
T perp() const
Definition: PV3DBase.h:72
MaterialEffects materialEffects(void) const
list original
Definition: definitions.py:57
virtual const Trajectory::DataContainer orderedTrajectoryMeasurements(const Trajectory &trajectory) const
AlignmentAlgorithmBase::ConstTrajTrackPair ConstTrajTrackPair
PropagationDirection
bool useRecHit(const TransientTrackingRecHit::ConstRecHitPointer &hitPtr) const
tuple s2
Definition: indexGen.py:106
tuple result
Definition: mps_fire.py:84
PropagationDirection const & direction() const
Definition: Trajectory.cc:125
DataContainer const & measurements() const
Definition: Trajectory.h:250
TrajectoryFactoryBase(const edm::ParameterSet &config)
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:44
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
bool sameSurface(const Surface &s1, const Surface &s2) const
virtual const TrajectoryInput innermostStateAndRecHits(const ConstTrajTrackPair &track) const
const PropagationDirection propDir_
const edm::ParameterSet cfg_
PropagationDirection propagationDirection(void) const
std::pair< TrajectoryStateOnSurface, TransientTrackingRecHit::ConstRecHitContainer > TrajectoryInput
dbl *** dir
Definition: mlp_gen.cc:35
virtual ~TrajectoryFactoryBase(void)
const PositionType & position() const
bool isProjected(TrackingRecHit const &hit)