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 
25 
26 class TkStripMeasurementDet GCC11_FINAL : public MeasurementDet {
27 public:
28 
31 
32  typedef SiStripRecHit2D::ClusterRef SiStripClusterRef;
33 
35 
38 
39  typedef std::vector<SiStripCluster>::const_iterator const_iterator;
40 
42 
43  TkStripMeasurementDet( const GeomDet* gdet, StMeasurementConditionSet & conditionSet );
44 
45  void setIndex(int i) { index_=i;}
46 
47  // void update( StMeasurementDetSet & theDets, const detset &detSet ) const {
48  // theDets.update(index(),detSet);
49  // }
50  void update( StMeasurementDetSet & theDets, std::vector<SiStripCluster>::const_iterator begin ,std::vector<SiStripCluster>::const_iterator end ) const {
51  theDets.update(index(), begin, end);
52  }
53 
54  bool isRegional() const { return conditionSet().isRegional();}
55 
56  void setEmpty(StMeasurementDetSet & theDets) const { theDets.setEmpty(index()); }
57 
58  bool isEmpty(const StMeasurementDetSet & theDets) const {return theDets.empty(index());}
59 
60  int index() const { return index_;}
61 
62  unsigned int rawId() const { return conditionSet().id(index()); }
63  unsigned char subId() const { return conditionSet().subId(index());}
64 
65 
66  const detset & theSet(const StMeasurementDetSet & theDets) const {return theDets.detSet(index());}
67  const detset & detSet(const StMeasurementDetSet & theDets) const {return theDets.detSet(index());}
68  // detset & detSet(StMeasurementDetSet & theDets) const { return theDets.detSet(index());}
69  unsigned int beginClusterI(const StMeasurementDetSet & theDets) const {return theDets.beginClusterI(index());}
70  unsigned int endClusterI(const StMeasurementDetSet & theDets) const {return theDets.endClusterI(index());}
71 
72  int size(const StMeasurementDetSet & theDets) const {return endClusterI(theDets) - beginClusterI(theDets) ; }
73 
74 
76  bool isActive(const MeasurementTrackerEvent & data) const { return data.stripData().isActive(index()); }
77 
78  //TO BE IMPLEMENTED
79  bool hasBadComponents( const TrajectoryStateOnSurface &tsos, const MeasurementTrackerEvent & data ) const {return false;}
80 
81 
82 
83  virtual RecHitContainer recHits( const TrajectoryStateOnSurface&, const MeasurementTrackerEvent & data) const;
84  void simpleRecHits( const TrajectoryStateOnSurface& ts, const MeasurementTrackerEvent & data, std::vector<SiStripRecHit2D> &result) const ;
85 
86  virtual bool recHits( const TrajectoryStateOnSurface& stateOnThisDet, const MeasurementEstimator& est, const MeasurementTrackerEvent & data,
87  RecHitContainer & result, std::vector<float> & diffs) const;
88 
89  virtual bool measurements( const TrajectoryStateOnSurface& stateOnThisDet,
91  TempMeasurements & result) const;
92 
93  const StripGeomDetUnit& specificGeomDet() const {return static_cast<StripGeomDetUnit const &>(fastGeomDet());}
94 
95 
96  template<class ClusterRefT>
98  buildRecHit( const ClusterRefT &cluster, const TrajectoryStateOnSurface& ltp) const {
99  const GeomDetUnit& gdu( specificGeomDet());
100  LocalValues lv = cpe()->localParameters( *cluster, gdu, ltp);
101  return TSiStripRecHit2DLocalPos::build( lv.first, lv.second, &fastGeomDet(), cluster, cpe());
102  }
103 
104 
105  template<class ClusterRefT>
106  void
107  buildRecHits( const ClusterRefT& cluster, const TrajectoryStateOnSurface& ltp, const RecHitContainer& _res) const {
108  RecHitContainer res = _res;
109  const GeomDetUnit& gdu( specificGeomDet());
110  VLocalValues vlv = cpe()->localParametersV( *cluster, gdu, ltp);
111  for(VLocalValues::const_iterator it=vlv.begin();it!=vlv.end();++it)
112  res.push_back(TSiStripRecHit2DLocalPos::build( it->first, it->second, &fastGeomDet(), cluster, cpe()));
113  }
114 
115 
116  template<class ClusterRefT>
117  bool filteredRecHits( const ClusterRefT& cluster, const TrajectoryStateOnSurface& ltp, const MeasurementEstimator& est, const std::vector<bool> & skipClusters,
118  RecHitContainer & result, std::vector<float> & diffs) const {
119  if (isMasked(*cluster)) return true;
120  const GeomDetUnit& gdu( specificGeomDet());
121  if (!accept(cluster, skipClusters)) return true;
122  VLocalValues const & vlv = cpe()->localParametersV( *cluster, gdu, ltp);
123  bool isCompatible(false);
124  for(auto vl : vlv) {
125  auto && recHit = TSiStripRecHit2DLocalPos::build( vl.first, vl.second, &fastGeomDet(), cluster, cpe());
126  std::pair<bool,double> diffEst = est.estimate(ltp, *recHit);
127  LogDebug("TkStripMeasurementDet")<<" chi2=" << diffEst.second;
128  if ( diffEst.first ) {
129  result.push_back(std::move(recHit));
130  diffs.push_back(diffEst.second);
131  isCompatible = true;
132  }
133  }
134  return isCompatible;
135  }
136 
137 
138 
140  void setActiveThisPeriod(StMeasurementDetSet & theDets, bool active) { conditionSet().setActive(index(),active);}
141 
144  void setActiveThisEvent(StMeasurementDetSet & theDets, bool active) const { theDets.setActiveThisEvent(index(),active); }
145 
147  bool hasAllGoodChannels() const { return (!hasAny128StripBad()) && badStripBlocks().empty(); }
148 
150  void set128StripStatus(bool good, int idx=-1) {
151  conditionSet().set128StripStatus(index(),good,idx);
152  }
153 
155 
157  bool testStrips(float utraj, float uerr) const;
158 
160 
161  std::vector<BadStripBlock> & getBadStripBlocks() { return conditionSet().getBadStripBlocks(index()); }
162  std::vector<BadStripBlock> const & badStripBlocks() const { return conditionSet().badStripBlocks(index()); }
163 
164  bool maskBad128StripBlocks() const { return conditionSet().maskBad128StripBlocks();}
165 
166 private:
167  int index_;
169  StMeasurementConditionSet & conditionSet() { return *theDetConditions; }
170  const StMeasurementConditionSet & conditionSet() const { return *theDetConditions; }
171 
172  const StripClusterParameterEstimator* cpe() const { return conditionSet().stripCPE(); }
173 
174  // --- regional unpacking
175  int totalStrips() const { return conditionSet().totalStrips(index()); }
176  BadStripCuts const & badStripCuts() const { return conditionSet().badStripCuts(index());}
177 
178  bool hasAny128StripBad() const { return conditionSet().hasAny128StripBad(index()); }
179 
180 
181  inline bool isMasked(const SiStripCluster &cluster) const {
182  return conditionSet().isMasked(index(), cluster);
183  }
184 
185 
186  template<class ClusterRefT>
187  void buildSimpleRecHit( const ClusterRefT& cluster,
188  const TrajectoryStateOnSurface& ltp,
189  std::vector<SiStripRecHit2D>& res) const {
190  const GeomDetUnit& gdu( specificGeomDet());
191  VLocalValues const & vlv = cpe()->localParametersV( *cluster, gdu, ltp);
192  for(VLocalValues::const_iterator it=vlv.begin();it!=vlv.end();++it){
193  res.push_back(SiStripRecHit2D( it->first, it->second, rawId(), cluster));
194  }
195  }
196 
197 
198 
199 
200 public:
201  inline bool accept(SiStripClusterRef const & r, const std::vector<bool> & skipClusters) const {
202  if(skipClusters.empty()) return true;
203  if (r.key()>=skipClusters.size()){
204  LogDebug("TkStripMeasurementDet")<<r.key()<<" is larger than: "<<skipClusters.size()
205  <<"\n This must be a new cluster, and therefore should not be skiped most likely.";
206  // edm::LogError("WrongStripMasking")<<r.key()<<" is larger than: "<<skipClusters.size()<<" no skipping done"; // protect for on demand???
207  return true;
208  }
209  return (not (skipClusters[r.key()]));
210  }
211  inline bool accept(SiStripRegionalClusterRef const &r, const std::vector<bool> & skipClusters) const{
212  if(skipClusters.empty()) return true;
213  if (r.key()>=skipClusters.size()){
214  LogDebug("TkStripMeasurementDet")<<r.key()<<" is larger than: "<<skipClusters.size()
215  <<"\n This must be a new cluster, and therefore should not be skiped most likely.";
216  return true;
217  }
218  return (not (skipClusters[r.key()]));
219  }
220 
221 };
222 
223 #endif
#define LogDebug(id)
const StMeasurementConditionSet & conditionSet() const
virtual ~TkStripMeasurementDet()
int i
Definition: DBlmapReader.cc:9
bool hasBadComponents(const TrajectoryStateOnSurface &tsos, const MeasurementTrackerEvent &data) const
bool accept(SiStripRegionalClusterRef const &r, const std::vector< bool > &skipClusters) const
const StripDetset & detSet(int i) const
int size(const StMeasurementDetSet &theDets) const
unsigned int endClusterI(const StMeasurementDetSet &theDets) const
StMeasurementConditionSet::BadStripBlock BadStripBlock
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TransientTrackingRecHit &hit) const =0
TransientTrackingRecHit::ConstRecHitContainer RecHitContainer
bool isRegional() const
bool hasAny128StripBad() const
void update(int i, const StripDetset &detSet)
data_type const * const_iterator
Definition: DetSetNew.h:30
void set128StripStatus(bool good, int idx=-1)
Sets the status of a block of 128 strips (or all blocks if idx=-1)
bool hasAllGoodChannels() const
does this module have at least one bad strip, APV or channel?
const StMeasurementDetSet & stripData() const
StMeasurementConditionSet & conditionSet()
int totalStrips() const
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:26
std::pair< LocalPoint, LocalError > LocalValues
const StripGeomDetUnit & specificGeomDet() const
const StripClusterParameterEstimator * cpe() const
bool isActive(const MeasurementTrackerEvent &data) const
Is this module active in reconstruction? It must be both &#39;setActiveThisEvent&#39; and &#39;setActive&#39;...
int index() const
const GeomDet & fastGeomDet() const
const detset & theSet(const StMeasurementDetSet &theDets) const
edmNew::DetSet< SiStripCluster > detset
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 ...
unsigned int endClusterI(int i) const
void setActiveThisPeriod(StMeasurementDetSet &theDets, bool active)
Turn on/off the module for reconstruction, for the full run or lumi (using info from DB...
void update(StMeasurementDetSet &theDets, std::vector< SiStripCluster >::const_iterator begin, std::vector< SiStripCluster >::const_iterator end) 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 ...
tuple result
Definition: query.py:137
unsigned int beginClusterI(int i) const
void buildSimpleRecHit(const ClusterRefT &cluster, const TrajectoryStateOnSurface &ltp, std::vector< SiStripRecHit2D > &res) const
SiStripRecHit2D::ClusterRef SiStripClusterRef
#define end
Definition: vmac.h:37
const detset & detSet(const StMeasurementDetSet &theDets) const
unsigned char subId() const
virtual RecHitContainer recHits(const TrajectoryStateOnSurface &, const MeasurementTrackerEvent &) const =0
std::vector< BadStripBlock > const & badStripBlocks() const
void setIndex(int i)
std::vector< BadStripBlock > & getBadStripBlocks()
void buildRecHits(const ClusterRefT &cluster, const TrajectoryStateOnSurface &ltp, const RecHitContainer &_res) const
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
unsigned int beginClusterI(const StMeasurementDetSet &theDets) const
key_type key() const
Accessor for product key.
Definition: Ref.h:266
StMeasurementConditionSet::BadStripCuts BadStripCuts
bool isActive(int i) const
bool maskBad128StripBlocks() const
void setEmpty(StMeasurementDetSet &theDets) const
bool empty(int i) const
unsigned int rawId() const
edm::LazyGetter< SiStripCluster >::value_ref SiStripRegionalClusterRef
#define begin
Definition: vmac.h:30
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
bool filteredRecHits(const ClusterRefT &cluster, const TrajectoryStateOnSurface &ltp, const MeasurementEstimator &est, const std::vector< bool > &skipClusters, RecHitContainer &result, std::vector< float > &diffs) const
StripClusterParameterEstimator::VLocalValues VLocalValues
bool isEmpty(const StMeasurementDetSet &theDets) const
bool accept(SiStripClusterRef const &r, const std::vector< bool > &skipClusters) const
BadStripCuts const & badStripCuts() const
std::vector< SiStripCluster >::const_iterator const_iterator
TransientTrackingRecHit::RecHitPointer buildRecHit(const ClusterRefT &cluster, const TrajectoryStateOnSurface &ltp) const
bool isMasked(const SiStripCluster &cluster) const
detset::const_iterator new_const_iterator
StripClusterParameterEstimator::LocalValues LocalValues
StMeasurementConditionSet * theDetConditions
virtual bool measurements(const TrajectoryStateOnSurface &stateOnThisDet, const MeasurementEstimator &est, const MeasurementTrackerEvent &data, TempMeasurements &result) const =0
Unlimited (trivial) bounds.