CMS 3D CMS Logo

TkStackMeasurementDet.cc
Go to the documentation of this file.
2 
4 
5 using namespace std;
6 
8  : MeasurementDet(gdet), thePixelCPE(cpe), theLowerDet(nullptr), theUpperDet(nullptr) {}
9 
10 void TkStackMeasurementDet::init(const MeasurementDet* lowerDet, const MeasurementDet* upperDet) {
11  theLowerDet = dynamic_cast<const TkPhase2OTMeasurementDet*>(lowerDet);
12  theUpperDet = dynamic_cast<const TkPhase2OTMeasurementDet*>(upperDet);
13 
14  if ((theLowerDet == nullptr) || (theUpperDet == nullptr)) {
16  "TkStackMeasurementDet ERROR: Trying to glue a det which is not a TkPhase2OTMeasurementDet");
17  }
18 }
19 
21  const MeasurementTrackerEvent& data) const {
23 
24  if (data.phase2OTVectorHits().empty())
25  return result;
26  LogTrace("MeasurementTracker") << " is not empty";
27  if (!isActive(data))
28  return result;
29  LogTrace("MeasurementTracker") << " and is active";
30 
31  //find clusters to skip
32  const detset& lowerDetSet = data.phase2OTData().detSet(lowerDet()->index());
33  const detset& upperDetSet = data.phase2OTData().detSet(upperDet()->index());
34  std::vector<bool> skipClustersUpper(data.phase2OTClustersToSkip().empty() ? 0 : upperDetSet.size(), false);
35  std::vector<bool> skipClustersLower(data.phase2OTClustersToSkip().empty() ? 0 : lowerDetSet.size(), false);
36 
37  const Phase2TrackerCluster1D* begin = nullptr;
38  if (!data.phase2OTData().handle()->data().empty()) {
39  begin = &(data.phase2OTData().handle()->data().front());
40  }
41  if (!data.phase2OTClustersToSkip().empty()) {
42  if (!lowerDetSet.empty()) {
43  for (const_iterator cil = lowerDetSet.begin(); cil != lowerDetSet.end(); ++cil) {
44  if (cil < begin) {
45  edm::LogError("IndexMisMatch") << "TkStackMeasurementDet cannot create hit because of index mismatch.";
46  return result;
47  }
48  unsigned int indexl = cil - begin;
49  if (data.phase2OTClustersToSkip()[indexl]) {
50  int iLocalL = std::distance(lowerDetSet.begin(), cil);
51  skipClustersLower[iLocalL] = true;
52  }
53  }
54  }
55  if (!upperDetSet.empty()) {
56  for (const_iterator ciu = upperDetSet.begin(); ciu != upperDetSet.end(); ++ciu) {
57  if (ciu < begin) {
58  edm::LogError("IndexMisMatch") << "TkStackMeasurementDet cannot create hit because of index mismatch.";
59  return result;
60  }
61  unsigned int indexu = ciu - begin;
62  if (data.phase2OTClustersToSkip()[indexu]) {
63  int iLocalU = std::distance(upperDetSet.begin(), ciu);
64  skipClustersUpper[iLocalU] = true;
65  }
66  }
67  }
68  }
69  DetId detIdStack = specificGeomDet().geographicalId();
70 
71  auto iterator = data.phase2OTVectorHits().find(detIdStack);
72  if (iterator == data.phase2OTVectorHits().end())
73  return result;
74  for (const auto& vecHit : data.phase2OTVectorHits()[detIdStack]) {
75  if (!data.phase2OTClustersToSkip().empty()) {
76  if (skipClustersLower[vecHit.lowerCluster().key() - lowerDetSet.offset()])
77  continue;
78  if (skipClustersUpper[vecHit.upperCluster().key() - upperDetSet.offset()])
79  continue;
80  }
81  result.push_back(std::make_shared<VectorHit>(vecHit));
82  }
83 
84  iterator = data.phase2OTVectorHitsRej().find(detIdStack);
85  if (iterator == data.phase2OTVectorHitsRej().end())
86  return result;
87  for (const auto& vecHit : data.phase2OTVectorHitsRej()[detIdStack]) {
88  if (!data.phase2OTClustersToSkip().empty()) {
89  if (skipClustersLower[vecHit.lowerCluster().key() - lowerDetSet.offset()])
90  continue;
91  if (skipClustersUpper[vecHit.upperCluster().key() - upperDetSet.offset()])
92  continue;
93  }
94  result.push_back(std::make_shared<VectorHit>(vecHit));
95  }
96 
97  return result;
98 }
99 
101  const MeasurementEstimator& est,
103  TempMeasurements& result) const {
104  LogDebug("MeasurementTracker") << "TkStackMeasurementDet::measurements";
105 
106  if (!isActive(data)) {
107  result.add(theInactiveHit, 0.F);
108  return true;
109  }
110 
111  LogTrace("MeasurementTracker") << " is active";
112 
113  auto oldSize = result.size();
114  MeasurementDet::RecHitContainer&& allHits = recHits(stateOnThisDet, data);
115 
116  for (auto&& hit : allHits) {
117  std::pair<bool, double> diffEst = est.estimate(stateOnThisDet, *hit);
118  if (diffEst.first) {
119  LogDebug("MeasurementTracker") << "New vh added with chi2: " << diffEst.second;
120  result.add(std::move(hit), diffEst.second);
121  }
122  }
123 
124  if (result.size() > oldSize)
125  return true;
126 
127  // create a TrajectoryMeasurement with an invalid RecHit and zero estimate
128  result.add(theMissingHit, 0.F);
129  LogDebug("MeasurementTracker") << "adding missing hit";
130  return false;
131 }
MeasurementEstimator
Definition: MeasurementEstimator.h:19
PixelClusterParameterEstimator
Definition: PixelClusterParameterEstimator.h:15
TkStackMeasurementDet::TkStackMeasurementDet
TkStackMeasurementDet(const StackGeomDet *gdet, const PixelClusterParameterEstimator *cpe)
Definition: TkStackMeasurementDet.cc:7
Phase2TrackerCluster1D
Definition: Phase2TrackerCluster1D.h:10
MeasurementDet::RecHitContainer
TrackingRecHit::ConstRecHitContainer RecHitContainer
Definition: MeasurementDet.h:19
TkStackMeasurementDet::lowerDet
const TkPhase2OTMeasurementDet * lowerDet() const
Definition: TkStackMeasurementDet.h:32
TkStackMeasurementDet::theLowerDet
const TkPhase2OTMeasurementDet * theLowerDet
Definition: TkStackMeasurementDet.h:50
MeasurementDetException.h
MeasurementDet
Definition: MeasurementDet.h:16
tracking::TempMeasurements
Definition: TempMeasurements.h:10
edmNew::DetSet::size
size_type size() const
Definition: DetSetNew.h:68
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
MeasurementEstimator::estimate
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
DetId
Definition: DetId.h:17
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
edmNew::DetSet::end
iterator end()
Definition: DetSetNew.h:56
MeasurementDetException
Common base class.
Definition: MeasurementDetException.h:12
TkStackMeasurementDet::const_iterator
detset::const_iterator const_iterator
Definition: TkStackMeasurementDet.h:25
TkStackMeasurementDet::upperDet
const TkPhase2OTMeasurementDet * upperDet() const
Definition: TkStackMeasurementDet.h:33
TkStackMeasurementDet::init
void init(const MeasurementDet *lowerDet, const MeasurementDet *upperDet)
Definition: TkStackMeasurementDet.cc:10
edmNew::DetSet
Definition: DetSetNew.h:22
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
TkStackMeasurementDet::measurements
bool measurements(const TrajectoryStateOnSurface &stateOnThisDet, const MeasurementEstimator &est, const MeasurementTrackerEvent &data, TempMeasurements &result) const override
Definition: TkStackMeasurementDet.cc:100
edmNew::DetSet::begin
iterator begin()
Definition: DetSetNew.h:54
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
TkStackMeasurementDet::specificGeomDet
const StackGeomDet & specificGeomDet() const
Definition: TkStackMeasurementDet.h:21
TkStackMeasurementDet::isActive
bool isActive(const MeasurementTrackerEvent &data) const override
return TRUE if both lower and upper components are active
Definition: TkStackMeasurementDet.h:36
edmNew::DetSet::offset
int offset() const
Definition: DetSetNew.h:62
StackGeomDet
Definition: StackGeomDet.h:7
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
TkStackMeasurementDet::recHits
RecHitContainer recHits(const TrajectoryStateOnSurface &, const MeasurementTrackerEvent &data) const override
Definition: TkStackMeasurementDet.cc:20
MeasurementDet::theInactiveHit
TrackingRecHit::ConstRecHitPointer theInactiveHit
Definition: MeasurementDet.h:95
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
mps_fire.result
result
Definition: mps_fire.py:311
TkStackMeasurementDet.h
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
TkStackMeasurementDet::theUpperDet
const TkPhase2OTMeasurementDet * theUpperDet
Definition: TkStackMeasurementDet.h:51
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
MeasurementDet::theMissingHit
TrackingRecHit::ConstRecHitPointer theMissingHit
Definition: MeasurementDet.h:94
edmNew::DetSet::empty
bool empty() const
Definition: DetSetNew.h:70
hit
Definition: SiStripHitEffFromCalibTree.cc:88
HLTSiStripMonitoring_cff.MeasurementTrackerEvent
MeasurementTrackerEvent
Definition: HLTSiStripMonitoring_cff.py:224