CMS 3D CMS Logo

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