CMS 3D CMS Logo

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