CMS 3D CMS Logo

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