CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TkStripMeasurementDet.h
Go to the documentation of this file.
1 #ifndef TkStripMeasurementDet_H
2 #define TkStripMeasurementDet_H
3 
7 
21 
23 
24 #include<tuple>
25 
26 class TrackingRecHit;
27 
28 
30 
34 
35 
38  const TrajectoryStateOnSurface & itsos,
39  const MeasurementTrackerEvent & idata) : mdet(&imdet),tsos(&itsos),data(&idata){}
40 
42  const TkStripMeasurementDet & imdet,
43  const TrajectoryStateOnSurface & itsos,
44  const MeasurementTrackerEvent & idata)
45  : mdet(&imdet),tsos(&itsos),data(&idata), clusterI(ci), clusterE(ce) {}
46 
47 
51 
54 
55  inline SiStripRecHit2D buildHit() const;
56  inline void advance();
57 
58 public:
59 
60  bool empty() const { return clusterI==clusterE; }
61 
62  bool operator==(TkStripRecHitIter const & rh) {
63  return clusterI==rh.clusterI;
64  }
65  bool operator!=(TkStripRecHitIter const & rh) {
66  return clusterI!=rh.clusterI;
67  }
68  bool operator<(TkStripRecHitIter const & rh) {
69  return clusterI<rh.clusterI;
70  }
71 
73  advance();
74  return *this;
75  }
76 
78  return buildHit();
79  }
80 
81 };
82 
83 
85 public:
86 
89 
91 
94 
95  typedef std::vector<SiStripCluster>::const_iterator const_iterator;
96 
98 
100 
101  void setIndex(int i) { index_=i;}
102 
103  void setEmpty(StMeasurementDetSet & theDets) const { theDets.setEmpty(index()); }
104 
105  bool isEmpty(const StMeasurementDetSet & theDets) const {return theDets.empty(index());}
106 
107  int index() const { return index_;}
108 
109  unsigned int rawId() const { return conditionSet().id(index()); }
110  unsigned char subId() const { return conditionSet().subId(index());}
111 
112 
113  const detset & theSet(const StMeasurementDetSet & theDets) const {return theDets.detSet(index());}
114  const detset & detSet(const StMeasurementDetSet & theDets) const {return theDets.detSet(index());}
115 
116 
118  bool isActive(const MeasurementTrackerEvent & data) const { return data.stripData().isActive(index()); }
119 
120  //TO BE IMPLEMENTED
121  bool hasBadComponents( const TrajectoryStateOnSurface &tsos, const MeasurementTrackerEvent & data ) const {return false;}
122 
123 
124  std::tuple<TkStripRecHitIter,TkStripRecHitIter> hitRange(const TrajectoryStateOnSurface&, const MeasurementTrackerEvent & data) const;
125  void advance(TkStripRecHitIter & hi ) const;
126  SiStripRecHit2D hit(TkStripRecHitIter const & hi ) const;
127 
129 
130 
131  bool empty(const MeasurementTrackerEvent & data) const;
132 
133  void simpleRecHits( const TrajectoryStateOnSurface& ts, const MeasurementTrackerEvent & data, std::vector<SiStripRecHit2D> &result) const ;
134  bool simpleRecHits( const TrajectoryStateOnSurface& ts, const MeasurementEstimator& est, const MeasurementTrackerEvent & data, std::vector<SiStripRecHit2D> &result) const ;
135 
136  // simple hits
137  virtual bool recHits(SimpleHitContainer & result,
138  const TrajectoryStateOnSurface& stateOnThisDet, const MeasurementEstimator&, const MeasurementTrackerEvent & data) const;
139 
140  // TTRH
141  virtual bool recHits( const TrajectoryStateOnSurface& stateOnThisDet, const MeasurementEstimator& est, const MeasurementTrackerEvent & data,
142  RecHitContainer & result, std::vector<float> & diffs) const;
143 
144 
145  virtual bool measurements( const TrajectoryStateOnSurface& stateOnThisDet,
147  TempMeasurements & result) const;
148 
149  const StripGeomDetUnit& specificGeomDet() const {return static_cast<StripGeomDetUnit const &>(fastGeomDet());}
150 
151 
152  template<class ClusterRefT>
154  buildRecHit( const ClusterRefT &cluster, const TrajectoryStateOnSurface& ltp) const {
155  const GeomDetUnit& gdu( specificGeomDet());
156  LocalValues lv = cpe()->localParameters( *cluster, gdu, ltp);
157  return std::make_shared<SiStripRecHit2D>( lv.first, lv.second, fastGeomDet(), cluster);
158  }
159 
160 
161  template<class ClusterRefT>
162  void
163  buildRecHits( const ClusterRefT& cluster, const TrajectoryStateOnSurface& ltp, const RecHitContainer& _res) const {
164  RecHitContainer res = _res;
165  const GeomDetUnit& gdu( specificGeomDet());
166  VLocalValues vlv = cpe()->localParametersV( *cluster, gdu, ltp);
167  for(VLocalValues::const_iterator it=vlv.begin();it!=vlv.end();++it)
168  res.push_back(std::make_shared<SiStripRecHit2D>( it->first, it->second, fastGeomDet(), cluster));
169  }
170 
171 
172  template<class ClusterRefT>
173  bool filteredRecHits( const ClusterRefT& cluster, const TrajectoryStateOnSurface& ltp, const MeasurementEstimator& est, const std::vector<bool> & skipClusters,
174  RecHitContainer & result, std::vector<float> & diffs) const {
175  if (isMasked(*cluster)) return true;
176  const GeomDetUnit& gdu( specificGeomDet());
177  if (!accept(cluster, skipClusters)) return true;
178  VLocalValues const & vlv = cpe()->localParametersV( *cluster, gdu, ltp);
179  bool isCompatible(false);
180  for(auto vl : vlv) {
181  SiStripRecHit2D recHit(vl.first, vl.second, fastGeomDet(), cluster);
182  std::pair<bool,double> diffEst = est.estimate(ltp, recHit);
183  LogDebug("TkStripMeasurementDet")<<" chi2=" << diffEst.second;
184  if ( diffEst.first ) {
185  result.push_back(std::move(std::make_shared<SiStripRecHit2D>(recHit)));
186  diffs.push_back(diffEst.second);
187  isCompatible = true;
188  }
189  }
190  return isCompatible;
191  }
192 
193 
194  template<class ClusterRefT>
195  bool filteredRecHits( const ClusterRefT& cluster, const TrajectoryStateOnSurface& ltp, const MeasurementEstimator& est, const std::vector<bool> & skipClusters,
196  std::vector<SiStripRecHit2D> & result) const {
197  if (isMasked(*cluster)) return true;
198  const GeomDetUnit& gdu( specificGeomDet());
199  if (!accept(cluster, skipClusters)) return true;
200  VLocalValues const & vlv = cpe()->localParametersV( *cluster, gdu, ltp);
201  bool isCompatible(false);
202  for(auto vl : vlv) {
203  auto && recHit = SiStripRecHit2D( vl.first, vl.second, gdu, cluster);
204  std::pair<bool,double> diffEst = est.estimate(ltp, recHit);
205  LogDebug("TkStripMeasurementDet")<<" chi2=" << diffEst.second;
206  if ( diffEst.first ) {
207  result.push_back(std::move(recHit));
208  isCompatible = true;
209  }
210  }
211  return isCompatible;
212  }
213 
214 
215 
216 
218  void setActiveThisPeriod(StMeasurementDetSet & theDets, bool active) { conditionSet().setActive(index(),active);}
219 
222  void setActiveThisEvent(StMeasurementDetSet & theDets, bool active) const { theDets.setActiveThisEvent(index(),active); }
223 
225  bool hasAllGoodChannels() const { return (!hasAny128StripBad()) && badStripBlocks().empty(); }
226 
228  void set128StripStatus(bool good, int idx=-1) {
230  }
231 
233 
235  bool testStrips(float utraj, float uerr) const;
236 
238 
239  std::vector<BadStripBlock> & getBadStripBlocks() { return conditionSet().getBadStripBlocks(index()); }
240  std::vector<BadStripBlock> const & badStripBlocks() const { return conditionSet().badStripBlocks(index()); }
241 
243 
244 private:
245  int index_;
249 
251 
252  // --- regional unpacking
253  int totalStrips() const { return conditionSet().totalStrips(index()); }
254  BadStripCuts const & badStripCuts() const { return conditionSet().badStripCuts(index());}
255 
256  bool hasAny128StripBad() const { return conditionSet().hasAny128StripBad(index()); }
257 
258 
259  inline bool isMasked(const SiStripCluster &cluster) const {
260  return conditionSet().isMasked(index(), cluster);
261  }
262 
263 
264  template<class ClusterRefT>
265  void buildSimpleRecHit( const ClusterRefT& cluster,
266  const TrajectoryStateOnSurface& ltp,
267  std::vector<SiStripRecHit2D>& res) const {
268  const GeomDetUnit& gdu( specificGeomDet());
269  VLocalValues const & vlv = cpe()->localParametersV( *cluster, gdu, ltp);
270  for(VLocalValues::const_iterator it=vlv.begin();it!=vlv.end();++it){
271  res.push_back(SiStripRecHit2D( it->first, it->second, gdu, cluster));
272  }
273  }
274 
275 
276 
277 
278 
279 
280 
281 public:
282  inline bool accept(SiStripClusterRef const & r, const std::vector<bool> & skipClusters) const {
283  if(skipClusters.empty()) return true;
284  if (r.key()>=skipClusters.size()){
285  LogDebug("TkStripMeasurementDet")<<r.key()<<" is larger than: "<<skipClusters.size()
286  <<"\n This must be a new cluster, and therefore should not be skiped most likely.";
287  // edm::LogError("WrongStripMasking")<<r.key()<<" is larger than: "<<skipClusters.size()<<" no skipping done"; // protect for on demand???
288  return true;
289  }
290  return (not (skipClusters[r.key()]));
291  }
292 
293 };
294 
295 
296 inline
298  return mdet->hit(*this);
299 }
300 inline
302  mdet->advance(*this);
303 }
304 
305 
306 
307 #endif
#define LogDebug(id)
bool isMasked(int i, const SiStripCluster &cluster) const
virtual LocalValues localParameters(const SiStripCluster &, const GeomDetUnit &) const
int i
Definition: DBlmapReader.cc:9
StMeasurementConditionSet::BadStripCuts BadStripCuts
new_const_iterator clusterE
#define GCC11_FINAL
virtual VLocalValues localParametersV(const SiStripCluster &cluster, const GeomDetUnit &gd) const
tracking::TempMeasurements TempMeasurements
void buildSimpleRecHit(const ClusterRefT &cluster, const TrajectoryStateOnSurface &ltp, std::vector< SiStripRecHit2D > &res) const
const StripDetset & detSet(int i) const
const TrajectoryStateOnSurface * tsos
const detset & theSet(const StMeasurementDetSet &theDets) const
edmNew::DetSet< SiStripCluster > detset
std::tuple< TkStripRecHitIter, TkStripRecHitIter > hitRange(const TrajectoryStateOnSurface &, const MeasurementTrackerEvent &data) const
SiStripRecHit2D operator*() const
StripClusterParameterEstimator::VLocalValues VLocalValues
unsigned char subId() const
bool operator==(TkStripRecHitIter const &rh)
bool empty(const MeasurementTrackerEvent &data) const
StripClusterParameterEstimator::LocalValues LocalValues
bool filteredRecHits(const ClusterRefT &cluster, const TrajectoryStateOnSurface &ltp, const MeasurementEstimator &est, const std::vector< bool > &skipClusters, std::vector< SiStripRecHit2D > &result) const
TkStripMeasurementDet(const GeomDet *gdet, StMeasurementConditionSet &conditionSet)
BadStripCuts const & badStripCuts() const
void simpleRecHits(const TrajectoryStateOnSurface &ts, const MeasurementTrackerEvent &data, std::vector< SiStripRecHit2D > &result) const
TkStripRecHitIter(const TkStripMeasurementDet &imdet, const TrajectoryStateOnSurface &itsos, const MeasurementTrackerEvent &idata)
data_type const * const_iterator
Definition: DetSetNew.h:30
bool accept(SiStripClusterRef const &r, const std::vector< bool > &skipClusters) const
const StMeasurementDetSet & stripData() const
bool isMasked(const SiStripCluster &cluster) const
SiStripRecHit2D hit(TkStripRecHitIter const &hi) const
const MeasurementTrackerEvent * data
const GeomDet & fastGeomDet() const
virtual RecHitContainer recHits(const TrajectoryStateOnSurface &, const MeasurementTrackerEvent &data) const
const BadStripCuts & badStripCuts(int i) const
unsigned int id(int i) const
StMeasurementConditionSet & conditionSet()
virtual bool measurements(const TrajectoryStateOnSurface &stateOnThisDet, const MeasurementEstimator &est, const MeasurementTrackerEvent &data, TempMeasurements &result) const
void setActiveThisEvent(int i, bool active)
Turn on/off the module for reconstruction for one events. This per-event flag is cleared by any call ...
bool filteredRecHits(const ClusterRefT &cluster, const TrajectoryStateOnSurface &ltp, const MeasurementEstimator &est, const std::vector< bool > &skipClusters, RecHitContainer &result, std::vector< float > &diffs) const
void setActive(int i, bool active)
Turn on/off the module for reconstruction, for the full run or lumi (using info from DB...
std::vector< BadStripBlock > & getBadStripBlocks(int i)
std::vector< BadStripBlock > const & badStripBlocks() const
bool hasBadComponents(const TrajectoryStateOnSurface &tsos, const MeasurementTrackerEvent &data) const
tuple result
Definition: query.py:137
bool hasAny128StripBad(int i) const
const StripClusterParameterEstimator * stripCPE() const
void buildRecHits(const ClusterRefT &cluster, const TrajectoryStateOnSurface &ltp, const RecHitContainer &_res) const
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
bool hasAllGoodChannels() const
does this module have at least one bad strip, APV or channel?
void advance(TkStripRecHitIter &hi) const
void setActiveThisEvent(StMeasurementDetSet &theDets, bool active) const
Turn on/off the module for reconstruction for one events. This per-event flag is cleared by any call ...
TkStripRecHitIter(new_const_iterator ci, new_const_iterator ce, const TkStripMeasurementDet &imdet, const TrajectoryStateOnSurface &itsos, const MeasurementTrackerEvent &idata)
StMeasurementConditionSet::BadStripBlock BadStripBlock
std::vector< SiStripCluster >::const_iterator const_iterator
std::shared_ptr< TrackingRecHit const > RecHitPointer
const TkStripMeasurementDet * mdet
std::vector< BadStripBlock > & getBadStripBlocks()
bool operator<(TkStripRecHitIter const &rh)
TrackingRecHit::RecHitPointer buildRecHit(const ClusterRefT &cluster, const TrajectoryStateOnSurface &ltp) const
void set128StripStatus(bool good, int idx=-1)
Sets the status of a block of 128 strips (or all blocks if idx=-1)
TkStripRecHitIter & operator++()
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
key_type key() const
Accessor for product key.
Definition: Ref.h:266
bool isActive(const MeasurementTrackerEvent &data) const
Is this module active in reconstruction? It must be both &#39;setActiveThisEvent&#39; and &#39;setActive&#39;...
const StripGeomDetUnit & specificGeomDet() const
void setActiveThisPeriod(StMeasurementDetSet &theDets, bool active)
Turn on/off the module for reconstruction, for the full run or lumi (using info from DB...
bool isActive(int i) const
bool isEmpty(const StMeasurementDetSet &theDets) const
std::pair< LocalPoint, LocalError > LocalValues
new_const_iterator clusterI
const StripClusterParameterEstimator * cpe() const
bool empty(int i) const
TrackingRecHit::ConstRecHitContainer RecHitContainer
std::vector< BaseTrackerRecHit * > SimpleHitContainer
SiStripRecHit2D::ClusterRef SiStripClusterRef
const detset & detSet(const StMeasurementDetSet &theDets) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
detset::const_iterator new_const_iterator
bool testStrips(float utraj, float uerr) const
return true if there are &#39;enough&#39; good strips in the utraj +/- 3 uerr range.
std::vector< BadStripBlock > const & badStripBlocks(int i) const
unsigned int rawId() const
void set128StripStatus(int i, bool good, int idx=-1)
detset::const_iterator new_const_iterator
StMeasurementConditionSet * theDetConditions
unsigned char subId(int i) const
void setEmpty(StMeasurementDetSet &theDets) const
bool operator!=(TkStripRecHitIter const &rh)
SiStripRecHit2D buildHit() const
const StMeasurementConditionSet & conditionSet() const