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 
24 
25 #include<tuple>
26 
27 class TrackingRecHit;
28 
29 
31 
35 
36 
39  const TrajectoryStateOnSurface & itsos,
40  const MeasurementTrackerEvent & idata) : mdet(&imdet),tsos(&itsos),data(&idata){}
41 
43  const TkStripMeasurementDet & imdet,
44  const TrajectoryStateOnSurface & itsos,
45  const MeasurementTrackerEvent & idata)
46  : mdet(&imdet),tsos(&itsos),data(&idata), clusterI(ci), clusterE(ce) {}
47 
48 
49  const TkStripMeasurementDet * mdet = 0;
50  const TrajectoryStateOnSurface * tsos=0;
52 
55 
56  inline SiStripRecHit2D buildHit() const;
57  inline void advance();
58 
59 public:
60 
61  bool empty() const { return clusterI==clusterE; }
62 
63  bool operator==(TkStripRecHitIter const & rh) {
64  return clusterI==rh.clusterI;
65  }
66  bool operator!=(TkStripRecHitIter const & rh) {
67  return clusterI!=rh.clusterI;
68  }
69  bool operator<(TkStripRecHitIter const & rh) {
70  return clusterI<rh.clusterI;
71  }
72 
74  advance();
75  return *this;
76  }
77 
79  return buildHit();
80  }
81 
82 };
83 
84 
86 public:
87 
90 
92 
95 
96  typedef std::vector<SiStripCluster>::const_iterator const_iterator;
97 
99 
100  TkStripMeasurementDet( const GeomDet* gdet, StMeasurementConditionSet & conditionSet );
101 
102  void setIndex(int i) { index_=i;}
103 
104  void setEmpty(StMeasurementDetSet & theDets) const { theDets.setEmpty(index()); }
105 
106  bool isEmpty(const StMeasurementDetSet & theDets) const {return theDets.empty(index());}
107 
108  int index() const { return index_;}
109 
110  unsigned int rawId() const { return conditionSet().id(index()); }
111  unsigned char subId() const { return conditionSet().subId(index());}
112 
113 
114  const detset & theSet(const StMeasurementDetSet & theDets) const {return theDets.detSet(index());}
115  const detset & detSet(const StMeasurementDetSet & theDets) const {return theDets.detSet(index());}
116 
117 
119  bool isActive(const MeasurementTrackerEvent & data) const { return data.stripData().isActive(index()); }
120 
121  //TO BE IMPLEMENTED
122  bool hasBadComponents( const TrajectoryStateOnSurface &tsos, const MeasurementTrackerEvent & data ) const {return false;}
123 
124 
125  std::tuple<TkStripRecHitIter,TkStripRecHitIter> hitRange(const TrajectoryStateOnSurface&, const MeasurementTrackerEvent & data) const;
126  void advance(TkStripRecHitIter & hi ) const;
127  SiStripRecHit2D hit(TkStripRecHitIter const & hi ) const;
128 
129  virtual RecHitContainer recHits( const TrajectoryStateOnSurface&, const MeasurementTrackerEvent & data) const;
130 
131 
132  bool empty(const MeasurementTrackerEvent & data) const;
133 
134  void simpleRecHits( const TrajectoryStateOnSurface& ts, const MeasurementTrackerEvent & data, std::vector<SiStripRecHit2D> &result) const ;
135  bool simpleRecHits( const TrajectoryStateOnSurface& ts, const MeasurementEstimator& est, const MeasurementTrackerEvent & data, std::vector<SiStripRecHit2D> &result) const ;
136 
137  // simple hits
138  virtual bool recHits(SimpleHitContainer & result,
139  const TrajectoryStateOnSurface& stateOnThisDet, const MeasurementEstimator&, const MeasurementTrackerEvent & data) const;
140 
141  // TTRH
142  virtual bool recHits( const TrajectoryStateOnSurface& stateOnThisDet, const MeasurementEstimator& est, const MeasurementTrackerEvent & data,
143  RecHitContainer & result, std::vector<float> & diffs) const;
144 
145 
146  virtual bool measurements( const TrajectoryStateOnSurface& stateOnThisDet,
148  TempMeasurements & result) const;
149 
150  const StripGeomDetUnit& specificGeomDet() const {return static_cast<StripGeomDetUnit const &>(fastGeomDet());}
151 
152 
153  template<class ClusterRefT>
155  buildRecHit( const ClusterRefT &cluster, const TrajectoryStateOnSurface& ltp) const {
156  const GeomDetUnit& gdu( specificGeomDet());
157  LocalValues lv = cpe()->localParameters( *cluster, gdu, ltp);
158  return std::make_shared<SiStripRecHit2D>( lv.first, lv.second, fastGeomDet(), cluster);
159  }
160 
161 
162  template<class ClusterRefT>
163  void
164  buildRecHits( const ClusterRefT& cluster, const TrajectoryStateOnSurface& ltp, const RecHitContainer& _res) const {
165  RecHitContainer res = _res;
166  const GeomDetUnit& gdu( specificGeomDet());
167  VLocalValues vlv = cpe()->localParametersV( *cluster, gdu, ltp);
168  for(VLocalValues::const_iterator it=vlv.begin();it!=vlv.end();++it)
169  res.push_back(std::make_shared<SiStripRecHit2D>( it->first, it->second, fastGeomDet(), cluster));
170  }
171 
172 
173  template<class ClusterRefT>
174  bool filteredRecHits( const ClusterRefT& cluster, const TrajectoryStateOnSurface& ltp, const MeasurementEstimator& est, const std::vector<bool> & skipClusters,
175  RecHitContainer & result, std::vector<float> & diffs) const {
176  if (isMasked(*cluster)) return true;
177  const GeomDetUnit& gdu( specificGeomDet());
178  if (!accept(cluster, skipClusters)) return true;
179  if (!est.preFilter(ltp, ClusterFilterPayload(rawId(),&*cluster) )) return true; // avoids shadow; consistent with previous statement...
180  VLocalValues const & vlv = cpe()->localParametersV( *cluster, gdu, ltp);
181  bool isCompatible(false);
182  for(auto vl : vlv) {
183  SiStripRecHit2D recHit(vl.first, vl.second, fastGeomDet(), cluster); // FIXME add cluster count in OmniRef
184  std::pair<bool,double> diffEst = est.estimate(ltp, recHit);
185  LogDebug("TkStripMeasurementDet")<<" chi2=" << diffEst.second;
186  if ( diffEst.first ) {
187  result.push_back(std::move(std::make_shared<SiStripRecHit2D>(recHit)));
188  diffs.push_back(diffEst.second);
189  isCompatible = true;
190  }
191  }
192  return isCompatible;
193  }
194 
195 
196  template<class ClusterRefT>
197  bool filteredRecHits( const ClusterRefT& cluster, const TrajectoryStateOnSurface& ltp, const MeasurementEstimator& est, const std::vector<bool> & skipClusters,
198  std::vector<SiStripRecHit2D> & result) const {
199  if (isMasked(*cluster)) return true;
200  const GeomDetUnit& gdu( specificGeomDet());
201  if (!accept(cluster, skipClusters)) return true;
202  if (!est.preFilter(ltp, ClusterFilterPayload(rawId(),&*cluster) )) return true; // avoids shadow; consistent with previous statement...
203  VLocalValues const & vlv = cpe()->localParametersV( *cluster, gdu, ltp);
204  bool isCompatible(false);
205  for(auto vl : vlv) {
206  auto && recHit = SiStripRecHit2D( vl.first, vl.second, gdu, cluster); // FIXME add cluster count in OmniRef
207  std::pair<bool,double> diffEst = est.estimate(ltp, recHit);
208  LogDebug("TkStripMeasurementDet")<<" chi2=" << diffEst.second;
209  if ( diffEst.first ) {
210  result.push_back(std::move(recHit));
211  isCompatible = true;
212  }
213  }
214  return isCompatible;
215  }
216 
217 
218 
219 
221  void setActiveThisPeriod(StMeasurementDetSet & theDets, bool active) { conditionSet().setActive(index(),active);}
222 
225  void setActiveThisEvent(StMeasurementDetSet & theDets, bool active) const { theDets.setActiveThisEvent(index(),active); }
226 
228  bool hasAllGoodChannels() const { return (!hasAny128StripBad()) && badStripBlocks().empty(); }
229 
231  void set128StripStatus(bool good, int idx=-1) {
232  conditionSet().set128StripStatus(index(),good,idx);
233  }
234 
236 
238  bool testStrips(float utraj, float uerr) const;
239 
241 
242  std::vector<BadStripBlock> & getBadStripBlocks() { return conditionSet().getBadStripBlocks(index()); }
243  std::vector<BadStripBlock> const & badStripBlocks() const { return conditionSet().badStripBlocks(index()); }
244 
245  bool maskBad128StripBlocks() const { return conditionSet().maskBad128StripBlocks();}
246 
247 private:
248  int index_;
250  StMeasurementConditionSet & conditionSet() { return *theDetConditions; }
251  const StMeasurementConditionSet & conditionSet() const { return *theDetConditions; }
252 
253  const StripClusterParameterEstimator* cpe() const { return conditionSet().stripCPE(); }
254 
255  // --- regional unpacking
256  int totalStrips() const { return conditionSet().totalStrips(index()); }
257  BadStripCuts const & badStripCuts() const { return conditionSet().badStripCuts(index());}
258 
259  bool hasAny128StripBad() const { return conditionSet().hasAny128StripBad(index()); }
260 
261 
262  inline bool isMasked(const SiStripCluster &cluster) const {
263  return conditionSet().isMasked(index(), cluster);
264  }
265 
266 
267  template<class ClusterRefT>
268  void buildSimpleRecHit( const ClusterRefT& cluster,
269  const TrajectoryStateOnSurface& ltp,
270  std::vector<SiStripRecHit2D>& res) const {
271  const GeomDetUnit& gdu( specificGeomDet());
272  VLocalValues const & vlv = cpe()->localParametersV( *cluster, gdu, ltp);
273  for(VLocalValues::const_iterator it=vlv.begin();it!=vlv.end();++it){
274  res.push_back(SiStripRecHit2D( it->first, it->second, gdu, cluster));
275  }
276  }
277 
278 
279 
280 
281 
282 
283 
284 public:
285  inline bool accept(SiStripClusterRef const & r, const std::vector<bool> & skipClusters) const {
286  if(skipClusters.empty()) return true;
287  if (r.key()>=skipClusters.size()){
288  LogDebug("TkStripMeasurementDet")<<r.key()<<" is larger than: "<<skipClusters.size()
289  <<"\n This must be a new cluster, and therefore should not be skiped most likely.";
290  // edm::LogError("WrongStripMasking")<<r.key()<<" is larger than: "<<skipClusters.size()<<" no skipping done"; // protect for on demand???
291  return true;
292  }
293  return (not (skipClusters[r.key()]));
294  }
295 
296 };
297 
298 
299 inline
301  return mdet->hit(*this);
302 }
303 inline
305  mdet->advance(*this);
306 }
307 
308 
309 
310 #endif
#define LogDebug(id)
#define dso_hidden
int i
Definition: DBlmapReader.cc:9
StMeasurementConditionSet::BadStripCuts BadStripCuts
new_const_iterator clusterE
#define GCC11_FINAL
void buildSimpleRecHit(const ClusterRefT &cluster, const TrajectoryStateOnSurface &ltp, std::vector< SiStripRecHit2D > &res) const
const StripDetset & detSet(int i) const
virtual bool preFilter(const TrajectoryStateOnSurface &, OpaquePayload const &) const
const detset & theSet(const StMeasurementDetSet &theDets) const
edmNew::DetSet< SiStripCluster > detset
SiStripRecHit2D operator*() const
StripClusterParameterEstimator::VLocalValues VLocalValues
unsigned char subId() const
bool operator==(TkStripRecHitIter const &rh)
StripClusterParameterEstimator::LocalValues LocalValues
bool filteredRecHits(const ClusterRefT &cluster, const TrajectoryStateOnSurface &ltp, const MeasurementEstimator &est, const std::vector< bool > &skipClusters, std::vector< SiStripRecHit2D > &result) const
BadStripCuts const & badStripCuts() const
TkStripRecHitIter(const TkStripMeasurementDet &imdet, const TrajectoryStateOnSurface &itsos, const MeasurementTrackerEvent &idata)
data_type const * const_iterator
Definition: DetSetNew.h:30
key_type key() const
Accessor for product key.
Definition: Ref.h:266
bool accept(SiStripClusterRef const &r, const std::vector< bool > &skipClusters) const
const StMeasurementDetSet & stripData() const
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:25
bool isMasked(const SiStripCluster &cluster) const
SiStripRecHit2D hit(TkStripRecHitIter const &hi) const
const GeomDet & fastGeomDet() const
StMeasurementConditionSet & conditionSet()
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
std::vector< BadStripBlock > const & badStripBlocks() const
bool hasBadComponents(const TrajectoryStateOnSurface &tsos, const MeasurementTrackerEvent &data) const
tuple result
Definition: query.py:137
def move
Definition: eostools.py:508
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
virtual RecHitContainer recHits(const TrajectoryStateOnSurface &, const MeasurementTrackerEvent &) const =0
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...
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
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
unsigned int rawId() const
detset::const_iterator new_const_iterator
StMeasurementConditionSet * theDetConditions
void setEmpty(StMeasurementDetSet &theDets) const
bool operator!=(TkStripRecHitIter const &rh)
SiStripRecHit2D buildHit() const
const StMeasurementConditionSet & conditionSet() const
virtual bool measurements(const TrajectoryStateOnSurface &stateOnThisDet, const MeasurementEstimator &est, const MeasurementTrackerEvent &data, TempMeasurements &result) const =0