CMS 3D CMS Logo

TkDoubleSensMeasurementDet.cc
Go to the documentation of this file.
2 
4 
5 using namespace std;
6 
9  : MeasurementDet(gdet), thePixelCPE(cpe), theFirstDet(nullptr), theSecondDet(nullptr) {}
10 
11 void TkDoubleSensMeasurementDet::init(const MeasurementDet* firstDet, const MeasurementDet* secondDet) {
12  theFirstDet = dynamic_cast<const TkPixelMeasurementDet*>(firstDet);
13  theSecondDet = dynamic_cast<const TkPixelMeasurementDet*>(secondDet);
14 
15  if ((theFirstDet == nullptr) || (theSecondDet == nullptr)) {
17  "TkDoubleSensMeasurementDet ERROR: Trying to glue a det which is not a TkPixelMeasurementDet");
18  }
19 }
20 
22  const TrajectoryStateOnSurface& ts, const MeasurementTrackerEvent& data) const {
24 
25  if (data.pixelData().handle()->data().empty())
26  return result;
27  LogTrace("MeasurementTracker") << " is not empty";
28  if (!isActive(data))
29  return result;
30  LogTrace("MeasurementTracker") << " and is active";
31 
32  //find clusters to skip
33  const detset& firstDetSet = data.pixelData().detSet(firstDet()->index());
34  const detset& secondDetSet = data.pixelData().detSet(secondDet()->index());
35  std::vector<bool> skipClustersUpper(data.pixelClustersToSkip().empty() ? 0 : secondDetSet.size(), false);
36  std::vector<bool> skipClustersLower(data.pixelClustersToSkip().empty() ? 0 : firstDetSet.size(), false);
37 
38  const SiPixelCluster* begin = nullptr;
39  if (!data.pixelData().handle()->data().empty()) {
40  begin = &(data.pixelData().handle()->data().front());
41  }
42  if (!data.pixelClustersToSkip().empty()) {
43  if (!firstDetSet.empty()) {
44  for (const_iterator cil = firstDetSet.begin(); cil != firstDetSet.end(); ++cil) {
45  if (cil < begin) {
46  edm::LogError("IndexMisMatch") << "TkDoubleSensMeasurementDet cannot create hit because of index mismatch.";
47  return result;
48  }
49  unsigned int indexl = cil - begin;
50  if (data.pixelClustersToSkip()[indexl]) {
51  int iLocalL = std::distance(firstDetSet.begin(), cil);
52  skipClustersLower[iLocalL] = true;
53  }
54  }
55  }
56  if (!secondDetSet.empty()) {
57  for (const_iterator ciu = secondDetSet.begin(); ciu != secondDetSet.end(); ++ciu) {
58  if (ciu < begin) {
59  edm::LogError("IndexMisMatch") << "TkDoubleSensMeasurementDet cannot create hit because of index mismatch.";
60  return result;
61  }
62  unsigned int indexu = ciu - begin;
63  if (data.pixelClustersToSkip()[indexu]) {
64  int iLocalU = std::distance(secondDetSet.begin(), ciu);
65  skipClustersUpper[iLocalU] = true;
66  }
67  }
68  }
69  }
70 
71  return result;
72 }
73 
75  const MeasurementEstimator& est,
77  TempMeasurements& result) const {
78  LogDebug("MeasurementTracker") << "TkDoubleSensMeasurementDet::measurements";
79 
80  if (!isActive(data)) {
81  result.add(theInactiveHit, 0.F);
82  return true;
83  }
84 
85  LogTrace("MeasurementTracker") << " is active";
86 
87  auto oldSize = result.size();
88  MeasurementDet::RecHitContainer&& allHits = recHits(stateOnThisDet, data);
89 
90  for (auto&& hit : allHits) {
91  std::pair<bool, double> diffEst = est.estimate(stateOnThisDet, *hit);
92  if (diffEst.first) {
93  LogDebug("MeasurementTracker") << "New vh added with chi2: " << diffEst.second;
94  result.add(std::move(hit), diffEst.second);
95  }
96  }
97 
98  if (result.size() > oldSize)
99  return true;
100 
101  // create a TrajectoryMeasurement with an invalid RecHit and zero estimate
102  result.add(theMissingHit, 0.F);
103  LogDebug("MeasurementTracker") << "adding missing hit";
104  return false;
105 }
void init(const MeasurementDet *firstDet, const MeasurementDet *secondDet)
const TkPixelMeasurementDet * secondDet() const
Log< level::Error, false > LogError
bool empty() const
Definition: DetSetNew.h:67
#define LogTrace(id)
TrackingRecHit::ConstRecHitPointer theMissingHit
bool isActive(const MeasurementTrackerEvent &data) const override
return TRUE if both first and second components are active
const TkPixelMeasurementDet * theFirstDet
const TkPixelMeasurementDet * firstDet() const
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
bool measurements(const TrajectoryStateOnSurface &stateOnThisDet, const MeasurementEstimator &est, const MeasurementTrackerEvent &data, TempMeasurements &result) const override
RecHitContainer recHits(const TrajectoryStateOnSurface &, const MeasurementTrackerEvent &data) const override
detset::const_iterator const_iterator
TrackingRecHit::ConstRecHitPointer theInactiveHit
const TkPixelMeasurementDet * theSecondDet
size_type size() const
Definition: DetSetNew.h:65
TrackingRecHit::ConstRecHitContainer RecHitContainer
Pixel cluster – collection of neighboring pixels above threshold.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
iterator end()
Definition: DetSetNew.h:53
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
def move(src, dest)
Definition: eostools.py:511
TkDoubleSensMeasurementDet(const DoubleSensGeomDet *gdet, const PixelClusterParameterEstimator *cpe)
#define LogDebug(id)
iterator begin()
Definition: DetSetNew.h:51