CMS 3D CMS Logo

TkPhase2OTMeasurementDet.cc
Go to the documentation of this file.
9 
11  Phase2OTMeasurementConditionSet & conditions ) :
12  MeasurementDet (gdet),
13  theDetConditions(&conditions)
14  {
15  if ( dynamic_cast<const PixelGeomDetUnit*>(gdet) == nullptr) {
16  throw MeasurementDetException( "TkPhase2OTMeasurementDet constructed with a GeomDet which is not a PixelGeomDetUnit");
17  }
18  }
19 
22  TempMeasurements & result) const {
23 
24 
25  if (!isActive(data)) {
26  result.add(theInactiveHit, 0.F);
27  return true;
28  }
29 
30  if (recHits(stateOnThisDet,est,data,result.hits,result.distances)) return true;
31 
32  // create a TrajectoryMeasurement with an invalid RecHit and zero estimate
33  bool inac = hasBadComponents(stateOnThisDet, data);
34  result.add(inac ? theInactiveHit : theMissingHit, 0.F);
35  return inac;
36 
37 }
38 
40  RecHitContainer & result, std::vector<float> & diffs) const {
41 
42  if unlikely( (!isActive(data)) || isEmpty(data.phase2OTData()) ) return false;
43 
44  auto oldSize = result.size();
45 
46 
47 
48  const detset & detSet = data.phase2OTData().detSet(index());
49  auto begin = &(data.phase2OTData().handle()->data().front());
50  auto reject = [&](auto ci)-> bool { return (!data.phase2OTClustersToSkip().empty()) && data.phase2OTClustersToSkip()[ci-begin];};
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 =
76  std::find_if(firstCluster, detSet.end(), [colMin](const Phase2TrackerCluster1D& hit) { return int(hit.column()) >= colMin; });
77  lastCluster =
78  std::find_if(firstCluster, detSet.end(), [colMax](const Phase2TrackerCluster1D& hit) { return int(hit.column()) > colMax; });
79  }
80 
81  while (firstCluster!=lastCluster) { // loop on each column
82  auto const col = firstCluster->column();
83  auto endCluster =
84  std::find_if(firstCluster, detSet.end(), [col](const Phase2TrackerCluster1D& hit) { return hit.column() != col; });
85  // find trajectory position in this column
86  auto rightCluster =
87  std::find_if(firstCluster, endCluster, [utraj](const Phase2TrackerCluster1D& hit) { return int(hit.firstStrip()) > utraj; });
88  // search for compatible clusters...
89  if ( rightCluster != firstCluster) {
90  // there are hits on the left of the utraj
91  auto leftCluster = rightCluster;
92  while ( --leftCluster >= firstCluster) {
93  if(reject(leftCluster)) continue;
94  Phase2TrackerCluster1DRef cluster = detSet.makeRefTo( data.phase2OTData().handle(), leftCluster);
95  auto hit = buildRecHit( cluster, stateOnThisDet.localParameters() );
96  auto diffEst = est.estimate( stateOnThisDet, *hit);
97  if ( !diffEst.first ) break; // exit loop on first incompatible hit
98  result.push_back(hit);
99  diffs.push_back(diffEst.second);
100  }
101  }
102  for ( ; rightCluster != endCluster; rightCluster++) {
103  if(reject(rightCluster)) continue;
104  Phase2TrackerCluster1DRef cluster = detSet.makeRefTo( data.phase2OTData().handle(), rightCluster);
105  auto hit = buildRecHit( cluster, stateOnThisDet.localParameters() );
106  auto diffEst = est.estimate( stateOnThisDet, *hit);
107  if ( !diffEst.first ) break; // exit loop on first incompatible hit
108  result.push_back(hit);
109  diffs.push_back(diffEst.second);
110  }
111  firstCluster = endCluster;
112  } // loop over columns
113  return result.size()>oldSize;
114 }
115 
116 
117 
118 
121  const LocalTrajectoryParameters & ltp) const
122 {
123 
124  const PixelGeomDetUnit& gdu( specificGeomDet() );
125  auto && params = cpe()->localParameters( *cluster, gdu );
126 
127  return std::make_shared<Phase2TrackerRecHit1D>( params.first, params.second, fastGeomDet(), cluster);
128 
129 }
130 
133 {
135  if (isEmpty(data.phase2OTData())) return result;
136  if (!isActive(data)) return result;
137  const Phase2TrackerCluster1D* begin=nullptr;
138  if (!data.phase2OTData().handle()->data().empty()) {
139  begin = &(data.phase2OTData().handle()->data().front());
140  }
141  const detset & detSet = data.phase2OTData().detSet(index());
142  result.reserve(detSet.size());
143  for ( const_iterator ci = detSet.begin(); ci != detSet.end(); ++ ci ) {
144 
145  if (ci < begin){
146  edm::LogError("IndexMisMatch")<<"TkPhase2OTMeasurementDet cannot create hit because of index mismatch.";
147  return result;
148  }
149  unsigned int index = ci-begin;
150  if (!data.phase2OTClustersToSkip().empty() && index>=data.phase2OTClustersToSkip().size()){
151  edm::LogError("IndexMisMatch")<<"TkPhase2OTMeasurementDet cannot create hit because of index mismatch. i.e "<<index<<" >= "<<data.phase2OTClustersToSkip().size();
152  return result;
153  }
154  if(data.phase2OTClustersToSkip().empty() or (not data.phase2OTClustersToSkip()[index]) ) {
155  Phase2TrackerCluster1DRef cluster = detSet.makeRefTo( data.phase2OTData().handle(), ci );
156  result.push_back( buildRecHit( cluster, ts.localParameters() ) );
157  }else{
158  LogDebug("TkPhase2OTMeasurementDet")<<"skipping this cluster from last iteration on "<<fastGeomDet().geographicalId().rawId()<<" key: "<<index;
159  }
160  }
161  return result;
162 }
163 
164 //FIXME:just temporary solution for phase2!
165 bool
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 }
#define LogDebug(id)
const std::vector< bool > & phase2OTClustersToSkip() const
bool valid() const
Definition: LocalError.h:21
bool isEmpty(const Phase2OTMeasurementDetSet &data) const
TkPhase2OTMeasurementDet(const GeomDet *gdet, Phase2OTMeasurementConditionSet &conditionSet)
const LocalTrajectoryParameters & localParameters() const
const Phase2OTMeasurementDetSet & phase2OTData() const
const Phase2DetSet & detSet(int i) const
unsigned int firstStrip() const
RecHitContainer recHits(const TrajectoryStateOnSurface &, const MeasurementTrackerEvent &dat) const override
const PixelGeomDetUnit & specificGeomDet() const
LocalError positionError() const
TrackingRecHit::ConstRecHitPointer theMissingHit
const GeomDet & fastGeomDet() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
#define unlikely(x)
int index() const
Sets the list of bad ROCs, identified by the positions of their centers in the local coordinate frame...
bool hasBadComponents(const TrajectoryStateOnSurface &tsos, const MeasurementTrackerEvent &dat) const override
virtual LocalValues localParameters(const T &, const GeomDetUnit &) const =0
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:18
const edm::Handle< edmNew::DetSetVector< Phase2TrackerCluster1D > > & handle() const
void add(ConstRecHitPointer const &h, float d)
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
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:79
const ClusterParameterEstimator< Phase2TrackerCluster1D > * cpe() const
const LocalTrajectoryError & localError() const
bool measurements(const TrajectoryStateOnSurface &stateOnThisDet, const MeasurementEstimator &est, const MeasurementTrackerEvent &dat, TempMeasurements &result) const override
std::shared_ptr< TrackingRecHit const > RecHitPointer
TrackingRecHit::ConstRecHitPointer theInactiveHit
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
bool isActive(const MeasurementTrackerEvent &data) const override
Is this module active in reconstruction? It must be both &#39;setActiveThisEvent&#39; and &#39;setActive&#39;...
TrackingRecHit::ConstRecHitContainer RecHitContainer
#define begin
Definition: vmac.h:30
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
iterator end()
Definition: DetSetNew.h:70
col
Definition: cuy.py:1008
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
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:95
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
size_type size() const
Definition: DetSetNew.h:87
detset::const_iterator const_iterator
TrackingRecHit::RecHitPointer buildRecHit(const Phase2TrackerCluster1DRef &cluster, const LocalTrajectoryParameters &ltp) const
iterator begin()
Definition: DetSetNew.h:67