CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TkPixelMeasurementDet.cc
Go to the documentation of this file.
10 
11 namespace {
12  // in cms units are in cm
13  constexpr float theRocWidth = 0.81 / 2;
14  constexpr float theRocHeight = 0.81 / 2;
15 } // namespace
16 
18  : MeasurementDet(gdet), theDetConditions(&conditions) {
19  if (dynamic_cast<const PixelGeomDetUnit*>(gdet) == nullptr) {
20  throw MeasurementDetException("TkPixelMeasurementDet constructed with a GeomDet which is not a PixelGeomDetUnit");
21  }
22 }
23 
25  const MeasurementEstimator& est,
27  TempMeasurements& result) const {
28  if (!isActive(data)) {
29  result.add(theInactiveHit, 0.F);
30  return true;
31  }
32 
33  auto xl = 100.f;
34  auto yl = 100.f;
35  // do not apply for iteration not cutting on propagation
36  if (est.maxSagitta() >= 0) {
37  // do not use this as it does not account for APE...
38  // auto xyLimits = est.maximalLocalDisplacement(stateOnThisDet,fastGeomDet().specificSurface());
39  auto le = stateOnThisDet.localError().positionError();
40  LocalError lape = static_cast<TrackerGeomDet const&>(fastGeomDet()).localAlignmentError();
41  xl = le.xx();
42  yl = le.yy();
43  if (lape.valid()) {
44  xl += lape.xx();
45  yl += lape.yy();
46  }
47  // 5 sigma to be on the safe side
48  xl = 5.f * std::sqrt(xl);
49  yl = 5.f * std::sqrt(yl);
50  }
51 
52  auto oldSize = result.size();
53  MeasurementDet::RecHitContainer&& allHits = compHits(stateOnThisDet, data, xl, yl);
54  for (auto&& hit : allHits) {
55  std::pair<bool, double> diffEst = est.estimate(stateOnThisDet, *hit);
56  if (diffEst.first)
57  result.add(std::move(hit), diffEst.second);
58  }
59 
60  if (result.size() > oldSize)
61  return true;
62 
63  // create a TrajectoryMeasurement with an invalid RecHit and zero estimate
64  bool inac = hasBadComponents(stateOnThisDet, data);
65  result.add(inac ? theInactiveHit : theMissingHit, 0.F);
66  return inac;
67 }
68 
70  const LocalTrajectoryParameters& ltp) const {
71  const GeomDetUnit& gdu(specificGeomDet());
72 
73  auto&& params = cpe()->getParameters(*cluster, gdu, ltp);
74  return std::make_shared<SiPixelRecHit>(
75  std::get<0>(params), std::get<1>(params), std::get<2>(params), fastGeomDet(), cluster);
76 }
77 
79  const MeasurementTrackerEvent& data) const {
80  float xl = 100.f; // larger than any detector
81  float yl = 100.f;
82  return compHits(ts, data, xl, yl);
83 }
84 
87  float xl,
88  float yl) const {
90  if (isEmpty(data.pixelData()) == true)
91  return result;
92  if (isActive(data) == false)
93  return result;
94  const SiPixelCluster* begin = nullptr;
95  if (!data.pixelData().handle()->data().empty()) {
96  begin = &(data.pixelData().handle()->data().front());
97  }
98  const detset& detSet = data.pixelData().detSet(index());
99  result.reserve(detSet.size());
100 
101  // pixel topology is rectangular, all positions are independent
102  LocalVector maxD(xl, yl, 0);
103  auto PMinus = specificGeomDet().specificTopology().measurementPosition(ts.localPosition() - maxD);
105 
106  int xminus = PMinus.x();
107  int yminus = PMinus.y();
108  int xplus = PPlus.x() + 0.5f;
109  int yplus = PPlus.y() + 0.5f;
110 
111  // rechits are sorted in x...
112  auto rightCluster = std::find_if(
113  detSet.begin(), detSet.end(), [xplus](const SiPixelCluster& cl) { return cl.minPixelRow() > xplus; });
114 
115  // std::cout << "px xlim " << xl << ' ' << xminus << '/' << xplus << ' ' << rightCluster-detSet.begin() << ',' << detSet.end()-rightCluster << std::endl;
116 
117  // consider only compatible clusters
118  for (auto ci = detSet.begin(); ci != rightCluster; ++ci) {
119  if (ci < begin) {
120  edm::LogError("IndexMisMatch") << "TkPixelMeasurementDet cannot create hit because of index mismatch.";
121  return result;
122  }
123  unsigned int index = ci - begin;
124  if (!data.pixelClustersToSkip().empty() && index >= data.pixelClustersToSkip().size()) {
125  edm::LogError("IndexMisMatch") << "TkPixelMeasurementDet cannot create hit because of index mismatch. i.e "
126  << index << " >= " << data.pixelClustersToSkip().size();
127  return result;
128  }
129 
130  if (ci->maxPixelRow() < xminus)
131  continue;
132  // also check compatibility in y... (does not add much)
133  if (ci->minPixelCol() > yplus)
134  continue;
135  if (ci->maxPixelCol() < yminus)
136  continue;
137 
138  if (data.pixelClustersToSkip().empty() or (not data.pixelClustersToSkip()[index])) {
139  SiPixelClusterRef cluster = detSet.makeRefTo(data.pixelData().handle(), ci);
140  result.push_back(buildRecHit(cluster, ts.localParameters()));
141  } else {
142  LogDebug("TkPixelMeasurementDet") << "skipping this cluster from last iteration on "
143  << fastGeomDet().geographicalId().rawId() << " key: " << index;
144  }
145  }
146  return result;
147 }
148 
150  const MeasurementTrackerEvent& data) const {
151  auto badFEDChannelPositions = getBadFEDChannelPositions(data);
152  if (badRocPositions_.empty() && badFEDChannelPositions == nullptr)
153  return false;
154 
155  auto lp = tsos.localPosition();
156  auto le = tsos.localError().positionError();
157  for (auto const& broc : badRocPositions_) {
158  auto dx = std::abs(broc.x() - lp.x()) - theRocWidth;
159  auto dy = std::abs(broc.y() - lp.y()) - theRocHeight;
160  if ((dx <= 0.f) & (dy <= 0.f))
161  return true;
162  if ((dx * dx < 9.f * le.xx()) && (dy * dy < 9.f * le.yy()))
163  return true;
164  }
165 
166  if (badFEDChannelPositions == nullptr)
167  return false;
168  float dx = 3.f * std::sqrt(le.xx()) + theRocWidth, dy = 3.f * std::sqrt(le.yy()) + theRocHeight;
169  for (auto const& p : *badFEDChannelPositions) {
170  if (lp.x() > (p.first.x() - dx) && lp.x() < (p.second.x() + dx) && lp.y() > (p.first.y() - dy) &&
171  lp.y() < (p.second.y() + dy)) {
172  return true;
173  }
174  }
175 
176  return false;
177 }
bool valid() const
Definition: LocalError.h:20
float xx() const
Definition: LocalError.h:22
std::size_t size() const
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
const LocalTrajectoryParameters & localParameters() const
const PixelClusterParameterEstimator * cpe() const
bool isActive(const MeasurementTrackerEvent &data) const override
Is this module active in reconstruction? It must be both &#39;setActiveThisEvent&#39; and &#39;setActive&#39;...
std::vector< LocalPoint > badRocPositions_
const PxMeasurementDetSet::BadFEDChannelPositions * getBadFEDChannelPositions(const MeasurementTrackerEvent &data) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
RecHitContainer compHits(const TrajectoryStateOnSurface &, const MeasurementTrackerEvent &dat, float xl, float yl) const
const edm::Handle< edmNew::DetSetVector< SiPixelCluster > > & handle() const
TrackingRecHit::RecHitPointer buildRecHit(const SiPixelClusterRef &cluster, const LocalTrajectoryParameters &ltp) const
Log< level::Error, false > LogError
const std::vector< bool > & pixelClustersToSkip() const
LocalError positionError() const
tuple cl
Definition: haddnano.py:49
tuple result
Definition: mps_fire.py:311
TrackingRecHit::ConstRecHitPointer theMissingHit
virtual ReturnType getParameters(const SiPixelCluster &cl, const GeomDetUnit &det) const =0
const GeomDet & fastGeomDet() const
bool measurements(const TrajectoryStateOnSurface &stateOnThisDet, const MeasurementEstimator &est, const MeasurementTrackerEvent &dat, TempMeasurements &result) const override
float yy() const
Definition: LocalError.h:24
const PxMeasurementDetSet & pixelData() const
T sqrt(T t)
Definition: SSEVec.h:19
void add(ConstRecHitPointer const &h, float d)
def move
Definition: eostools.py:511
TkPixelMeasurementDet(const GeomDet *gdet, PxMeasurementConditionSet &conditionSet)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
const LocalTrajectoryError & localError() const
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
std::shared_ptr< TrackingRecHit const > RecHitPointer
TrackingRecHit::ConstRecHitPointer theInactiveHit
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
bool hasBadComponents(const TrajectoryStateOnSurface &tsos, const MeasurementTrackerEvent &dat) const override
TrackingRecHit::ConstRecHitContainer RecHitContainer
Pixel cluster – collection of neighboring pixels above threshold.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const PixelGeomDetUnit & specificGeomDet() const
iterator end()
Definition: DetSetNew.h:56
RecHitContainer recHits(const TrajectoryStateOnSurface &, const MeasurementTrackerEvent &dat) const override
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
const PixelDetSet & detSet(int i) const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
size_type size() const
Definition: DetSetNew.h:68
T x() const
Definition: PV2DBase.h:43
bool isEmpty(const PxMeasurementDetSet &data) const
#define LogDebug(id)
iterator begin()
Definition: DetSetNew.h:54