CMS 3D CMS Logo

TkPhase2OTMeasurementDet.cc
Go to the documentation of this file.
9 
11  : MeasurementDet(gdet), theDetConditions(&conditions) {
12  if (dynamic_cast<const PixelGeomDetUnit*>(gdet) == nullptr) {
14  "TkPhase2OTMeasurementDet constructed with a GeomDet which is not a PixelGeomDetUnit");
15  }
16 }
17 
19  const MeasurementEstimator& est,
21  TempMeasurements& result) const {
22  if (!isActive(data)) {
23  result.add(theInactiveHit, 0.F);
24  return true;
25  }
26 
27  if (recHits(stateOnThisDet, est, data, result.hits, result.distances))
28  return true;
29 
30  // create a TrajectoryMeasurement with an invalid RecHit and zero estimate
31  bool inac = hasBadComponents(stateOnThisDet, data);
32  result.add(inac ? theInactiveHit : theMissingHit, 0.F);
33  return inac;
34 }
35 
37  const MeasurementEstimator& est,
40  std::vector<float>& diffs) const {
41  if
42  UNLIKELY((!isActive(data)) || isEmpty(data.phase2OTData())) return false;
43 
44  auto oldSize = result.size();
45 
46  const detset& detSet = data.phase2OTData().detSet(index());
47  auto begin = &(data.phase2OTData().handle()->data().front());
48  auto reject = [&](auto ci) -> bool {
49  return (!data.phase2OTClustersToSkip().empty()) && data.phase2OTClustersToSkip()[ci - begin];
50  };
51 
53  auto firstCluster = detSet.begin();
54  auto lastCluster = detSet.end();
55 
56  // do not use this as it does not account for APE...
57  // auto xyLimits = est.maximalLocalDisplacement(stateOnThisDet,fastGeomDet().specificSurface());
58  auto le = stateOnThisDet.localError().positionError();
59  LocalError lape = static_cast<TrackerGeomDet const&>(fastGeomDet()).localAlignmentError();
60  auto ye = le.yy();
61  if (lape.valid()) {
62  ye += lape.yy();
63  }
64  // 5 sigma to be on the safe side
65  ye = 5.f * std::sqrt(ye);
66  LocalVector maxD(0, ye, 0);
67  // pixel topology is rectangular: x and y are independent
68  auto ymin = specificGeomDet().specificTopology().measurementPosition(stateOnThisDet.localPosition() - maxD);
69  auto ymax = specificGeomDet().specificTopology().measurementPosition(stateOnThisDet.localPosition() + maxD);
70  int utraj = ymin.x();
71  // do not apply for iteration not cutting on propagation
72  if (est.maxSagitta() >= 0) {
73  int colMin = ymin.y();
74  int colMax = ymax.y();
75  firstCluster = std::find_if(firstCluster, detSet.end(), [colMin](const Phase2TrackerCluster1D& hit) {
76  return int(hit.column()) >= colMin;
77  });
78  lastCluster = std::find_if(
79  firstCluster, detSet.end(), [colMax](const Phase2TrackerCluster1D& hit) { return int(hit.column()) > colMax; });
80  }
81 
82  while (firstCluster != lastCluster) { // loop on each column
83  auto const col = firstCluster->column();
84  auto endCluster = std::find_if(
85  firstCluster, detSet.end(), [col](const Phase2TrackerCluster1D& hit) { return hit.column() != col; });
86  // find trajectory position in this column
87  auto rightCluster = std::find_if(
88  firstCluster, endCluster, [utraj](const Phase2TrackerCluster1D& hit) { return int(hit.firstStrip()) > utraj; });
89  // search for compatible clusters...
90  if (rightCluster != firstCluster) {
91  // there are hits on the left of the utraj
92  auto leftCluster = rightCluster;
93  while (--leftCluster >= firstCluster) {
94  if (reject(leftCluster))
95  continue;
96  Phase2TrackerCluster1DRef cluster = detSet.makeRefTo(data.phase2OTData().handle(), leftCluster);
97  auto hit = buildRecHit(cluster, stateOnThisDet.localParameters());
98  auto diffEst = est.estimate(stateOnThisDet, *hit);
99  if (!diffEst.first)
100  break; // exit loop on first incompatible hit
101  result.push_back(hit);
102  diffs.push_back(diffEst.second);
103  }
104  }
105  for (; rightCluster != endCluster; rightCluster++) {
106  if (reject(rightCluster))
107  continue;
108  Phase2TrackerCluster1DRef cluster = detSet.makeRefTo(data.phase2OTData().handle(), rightCluster);
109  auto hit = buildRecHit(cluster, stateOnThisDet.localParameters());
110  auto diffEst = est.estimate(stateOnThisDet, *hit);
111  if (!diffEst.first)
112  break; // exit loop on first incompatible hit
113  result.push_back(hit);
114  diffs.push_back(diffEst.second);
115  }
116  firstCluster = endCluster;
117  } // loop over columns
118  return result.size() > oldSize;
119 }
120 
122  const LocalTrajectoryParameters& ltp) const {
123  const PixelGeomDetUnit& gdu(specificGeomDet());
124  auto&& params = cpe()->localParameters(*cluster, gdu);
125 
126  return std::make_shared<Phase2TrackerRecHit1D>(params.first, params.second, fastGeomDet(), cluster);
127 }
128 
130  const MeasurementTrackerEvent& data) const {
132  if (isEmpty(data.phase2OTData()))
133  return result;
134  if (!isActive(data))
135  return result;
136  const Phase2TrackerCluster1D* begin = nullptr;
137  if (!data.phase2OTData().handle()->data().empty()) {
138  begin = &(data.phase2OTData().handle()->data().front());
139  }
140  const detset& detSet = data.phase2OTData().detSet(index());
141  result.reserve(detSet.size());
142  for (const_iterator ci = detSet.begin(); ci != detSet.end(); ++ci) {
143  if (ci < begin) {
144  edm::LogError("IndexMisMatch") << "TkPhase2OTMeasurementDet cannot create hit because of index mismatch.";
145  return result;
146  }
147  unsigned int index = ci - begin;
148  if (!data.phase2OTClustersToSkip().empty() && index >= data.phase2OTClustersToSkip().size()) {
149  edm::LogError("IndexMisMatch") << "TkPhase2OTMeasurementDet cannot create hit because of index mismatch. i.e "
150  << index << " >= " << data.phase2OTClustersToSkip().size();
151  return result;
152  }
153  if (data.phase2OTClustersToSkip().empty() or (not data.phase2OTClustersToSkip()[index])) {
154  Phase2TrackerCluster1DRef cluster = detSet.makeRefTo(data.phase2OTData().handle(), ci);
155  result.push_back(buildRecHit(cluster, ts.localParameters()));
156  } else {
157  LogDebug("TkPhase2OTMeasurementDet") << "skipping this cluster from last iteration on "
158  << fastGeomDet().geographicalId().rawId() << " key: " << index;
159  }
160  }
161  return result;
162 }
163 
164 //FIXME:just temporary solution for phase2!
166  const MeasurementTrackerEvent& data) const {
167  /*
168  if (badRocPositions_.empty()) return false;
169  LocalPoint lp = tsos.localPosition();
170  LocalError le = tsos.localError().positionError();
171  double dx = 3*std::sqrt(le.xx()) + theRocWidth, dy = 3*std::sqrt(le.yy()) + theRocHeight;
172  for (std::vector<LocalPoint>::const_iterator it = badRocPositions_.begin(), ed = badRocPositions_.end(); it != ed; ++it) {
173  if ( (std::abs(it->x() - lp.x()) < dx) &&
174  (std::abs(it->y() - lp.y()) < dy) ) return true;
175  }
176 */
177  return false;
178 }
Vector3DBase< float, LocalTag >
TrajMeasLessEstim.h
MeasurementEstimator
Definition: MeasurementEstimator.h:19
GeomDet
Definition: GeomDet.h:27
PixelTopology.h
Phase2TrackerCluster1D
Definition: Phase2TrackerCluster1D.h:10
MeasurementDet::RecHitContainer
TrackingRecHit::ConstRecHitContainer RecHitContainer
Definition: MeasurementDet.h:19
MeasurementEstimator::maxSagitta
float maxSagitta() const
Definition: MeasurementEstimator.h:70
LocalTrajectoryError::positionError
LocalError positionError() const
Definition: LocalTrajectoryError.h:81
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
TkPhase2OTMeasurementDet::const_iterator
detset::const_iterator const_iterator
Definition: TkPhase2OTMeasurementDet.h:21
cuy.col
col
Definition: cuy.py:1010
Phase2OTMeasurementConditionSet
Definition: TkMeasurementDetSet.h:405
MeasurementDetException.h
TrajectoryMeasurement.h
MeasurementDet
Definition: MeasurementDet.h:16
TrackingRecHit::RecHitPointer
std::shared_ptr< TrackingRecHit const > RecHitPointer
Definition: TrackingRecHit.h:24
tracking::TempMeasurements
Definition: TempMeasurements.h:10
edm::Ref
Definition: AssociativeIterator.h:58
TkPhase2OTMeasurementDet::specificGeomDet
const PixelGeomDetUnit & specificGeomDet() const
Definition: TkPhase2OTMeasurementDet.h:56
edmNew::DetSet::size
size_type size() const
Definition: DetSetNew.h:68
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
LocalTrajectoryParameters
Definition: LocalTrajectoryParameters.h:25
MeasurementEstimator::estimate
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
edmNew::DetSet::end
iterator end()
Definition: DetSetNew.h:56
MeasurementDetException
Common base class.
Definition: MeasurementDetException.h:12
TkPhase2OTMeasurementDet::index
int index() const
Sets the list of bad ROCs, identified by the positions of their centers in the local coordinate frame...
Definition: TkPhase2OTMeasurementDet.h:79
TkPhase2OTMeasurementDet::isActive
bool isActive(const MeasurementTrackerEvent &data) const override
Is this module active in reconstruction? It must be both 'setActiveThisEvent' and 'setActive'.
Definition: TkPhase2OTMeasurementDet.h:69
L1TOccupancyClient_cfi.ymax
ymax
Definition: L1TOccupancyClient_cfi.py:43
MeasurementEstimator.h
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
edmNew::DetSet
Definition: DetSetNew.h:22
TkPhase2OTMeasurementDet.h
TrajectoryStateOnSurface::localParameters
const LocalTrajectoryParameters & localParameters() const
Definition: TrajectoryStateOnSurface.h:73
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
Phase2TrackerRecHit1D.h
TrajectoryStateOnSurface::localPosition
LocalPoint localPosition() const
Definition: TrajectoryStateOnSurface.h:74
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
MeasurementTrackerEvent
Definition: MeasurementTrackerEvent.h:16
LocalError
Definition: LocalError.h:12
PixelGeomDetUnit::specificTopology
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Definition: PixelGeomDetUnit.cc:17
createfilelist.int
int
Definition: createfilelist.py:10
TkPhase2OTMeasurementDet::buildRecHit
TrackingRecHit::RecHitPointer buildRecHit(const Phase2TrackerCluster1DRef &cluster, const LocalTrajectoryParameters &ltp) const
Definition: TkPhase2OTMeasurementDet.cc:121
edmNew::DetSet::makeRefTo
edm::Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(HandleT const &handle, const_iterator ci) const
Definition: DetSetNew.h:73
TkPhase2OTMeasurementDet::TkPhase2OTMeasurementDet
TkPhase2OTMeasurementDet(const GeomDet *gdet, Phase2OTMeasurementConditionSet &conditionSet)
Definition: TkPhase2OTMeasurementDet.cc:10
ClusterParameterEstimator::localParameters
virtual LocalValues localParameters(const T &, const GeomDetUnit &) const =0
edmNew::DetSet::begin
iterator begin()
Definition: DetSetNew.h:54
LocalError::valid
bool valid() const
Definition: LocalError.h:20
TkPhase2OTMeasurementDet::cpe
const ClusterParameterEstimator< Phase2TrackerCluster1D > * cpe() const
Definition: TkPhase2OTMeasurementDet.h:91
Topology::measurementPosition
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
TkPhase2OTMeasurementDet::measurements
bool measurements(const TrajectoryStateOnSurface &stateOnThisDet, const MeasurementEstimator &est, const MeasurementTrackerEvent &dat, TempMeasurements &result) const override
Definition: TkPhase2OTMeasurementDet.cc:18
submitPVValidationJobs.conditions
list conditions
Definition: submitPVValidationJobs.py:674
TkPhase2OTMeasurementDet::recHits
RecHitContainer recHits(const TrajectoryStateOnSurface &, const MeasurementTrackerEvent &dat) const override
Definition: TkPhase2OTMeasurementDet.cc:129
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
L1TOccupancyClient_cfi.ymin
ymin
Definition: L1TOccupancyClient_cfi.py:43
TkPhase2OTMeasurementDet::isEmpty
bool isEmpty(const Phase2OTMeasurementDetSet &data) const
Definition: TkPhase2OTMeasurementDet.h:32
MeasurementDet::theInactiveHit
TrackingRecHit::ConstRecHitPointer theInactiveHit
Definition: MeasurementDet.h:95
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
mps_fire.result
result
Definition: mps_fire.py:311
MeasurementDet::fastGeomDet
const GeomDet & fastGeomDet() const
Definition: MeasurementDet.h:80
TkPhase2OTMeasurementDet::hasBadComponents
bool hasBadComponents(const TrajectoryStateOnSurface &tsos, const MeasurementTrackerEvent &dat) const override
Definition: TkPhase2OTMeasurementDet.cc:165
TrajectoryStateOnSurface::localError
const LocalTrajectoryError & localError() const
Definition: TrajectoryStateOnSurface.h:77
MeasurementDet::theMissingHit
TrackingRecHit::ConstRecHitPointer theMissingHit
Definition: MeasurementDet.h:94
LocalError::yy
float yy() const
Definition: LocalError.h:24
hit
Definition: SiStripHitEffFromCalibTree.cc:88
InvalidTransientRecHit.h