CMS 3D CMS Logo

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