CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
StMeasurementDetSet Class Reference

#include <TkMeasurementDetSet.h>

Classes

struct  DetSetHelper
 

Public Types

typedef StripDetset::const_iterator new_const_iterator
 
typedef edmNew::DetSet< SiStripClusterStripDetset
 

Public Member Functions

const StMeasurementConditionSetconditions () const
 
void defineStrip (int i, std::pair< unsigned int, unsigned int > range)
 
const StripDetsetdetSet (int i) const
 
bool empty (int i) const
 
int find (unsigned int jd, int i=0) const
 
edm::Handle< edmNew::DetSetVector< SiStripCluster > > & handle ()
 
const edm::Handle< edmNew::DetSetVector< SiStripCluster > > & handle () const
 
unsigned int id (int i) const
 
bool isActive (int i) const
 
int nDet () const
 
std::vector< uint32_t > & rawInactiveStripDetIds ()
 
const std::vector< uint32_t > & rawInactiveStripDetIds () const
 
void resetOnDemandStrips ()
 
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 to 'update' or 'setEmpty'. More...
 
void setEmpty (int i)
 
void setEmpty ()
 
void setUpdated (int i)
 
int size () const
 
 StMeasurementDetSet (const StMeasurementConditionSet &cond)
 
const bool stripDefined (int i) const
 
const bool stripUpdated (int i) const
 
void update (int i, const StripDetset &detSet)
 
void update (int i, int j)
 
 ~StMeasurementDetSet ()
 

Private Types

enum  ReadyState : char { ReadyState::kUnset, ReadyState::kSetting, ReadyState::kSet }
 

Private Member Functions

void getDetSet (int i) const
 

Static Private Member Functions

static void incAct ()
 
static void incReady ()
 
static void incSet ()
 
static void incTot (int)
 
static void printStat ()
 
static void zeroStat ()
 

Private Attributes

std::vector< bool > activeThisEvent_
 
const StMeasurementConditionSetconditionSet_
 
std::vector< int > detIndex_
 
std::vector< DetSetHelperdetSet_
 
edm::Handle< edmNew::DetSetVector< SiStripCluster > > handle_
 
std::vector< bool > stripDefined_
 
std::vector< std::pair< unsigned int, unsigned int > > stripRegions_
 
std::vector< bool > stripUpdated_
 
std::vector< uint32_t > theRawInactiveStripDetIds_
 

Friends

class MeasurementTrackerImpl
 

Detailed Description

Definition at line 141 of file TkMeasurementDetSet.h.

Member Typedef Documentation

◆ new_const_iterator

Definition at line 144 of file TkMeasurementDetSet.h.

◆ StripDetset

Definition at line 143 of file TkMeasurementDetSet.h.

Member Enumeration Documentation

◆ ReadyState

enum StMeasurementDetSet::ReadyState : char
strongprivate
Enumerator
kUnset 
kSetting 
kSet 

Definition at line 262 of file TkMeasurementDetSet.h.

262 : char { kUnset, kSetting, kSet };
const char * kSet

Constructor & Destructor Documentation

◆ StMeasurementDetSet()

StMeasurementDetSet::StMeasurementDetSet ( const StMeasurementConditionSet cond)
inline

Definition at line 146 of file TkMeasurementDetSet.h.

147  : conditionSet_(&cond),
148  activeThisEvent_(cond.nDet(), true),
149  detSet_(cond.nDet()),
150  detIndex_(cond.nDet(), -1),
152  stripDefined_(0),
153  stripUpdated_(0),
154  stripRegions_(0) {}
std::vector< DetSetHelper > detSet_
std::vector< bool > stripDefined_
const StMeasurementConditionSet * conditionSet_
std::vector< uint32_t > theRawInactiveStripDetIds_
std::vector< bool > activeThisEvent_
std::vector< std::pair< unsigned int, unsigned int > > stripRegions_
std::vector< int > detIndex_
std::vector< bool > stripUpdated_

◆ ~StMeasurementDetSet()

StMeasurementDetSet::~StMeasurementDetSet ( )
inline

Definition at line 156 of file TkMeasurementDetSet.h.

References printStat().

156 { printStat(); }

Member Function Documentation

◆ conditions()

const StMeasurementConditionSet& StMeasurementDetSet::conditions ( ) const
inline

Definition at line 158 of file TkMeasurementDetSet.h.

References conditionSet_.

Referenced by find(), id(), isActive(), and size().

158 { return *conditionSet_; }
const StMeasurementConditionSet * conditionSet_

◆ defineStrip()

void StMeasurementDetSet::defineStrip ( int  i,
std::pair< unsigned int, unsigned int >  range 
)
inline

Definition at line 226 of file TkMeasurementDetSet.h.

References mps_fire::i, FastTimerService_cff::range, stripDefined_, stripRegions_, and stripUpdated_.

226  {
227  stripDefined_[i] = true;
228  stripUpdated_[i] = false;
229  stripRegions_[i] = range;
230  }
std::vector< bool > stripDefined_
std::vector< std::pair< unsigned int, unsigned int > > stripRegions_
std::vector< bool > stripUpdated_

◆ detSet()

const StripDetset& StMeasurementDetSet::detSet ( int  i) const
inline

Definition at line 210 of file TkMeasurementDetSet.h.

References detSet_, getDetSet(), mps_fire::i, and kSet.

Referenced by TkStripMeasurementDet::detSet(), TkStripMeasurementDet::theSet(), and update().

210  {
211  if (detSet_[i].ready_.load(std::memory_order_acquire) != ReadyState::kSet)
212  getDetSet(i);
213  return detSet_[i].detSet_;
214  }
std::vector< DetSetHelper > detSet_
void getDetSet(int i) const

◆ empty()

bool StMeasurementDetSet::empty ( int  i) const
inline

Definition at line 179 of file TkMeasurementDetSet.h.

References detSet_, and mps_fire::i.

Referenced by TkStripMeasurementDet::isEmpty().

179 { return detSet_[i].empty_.load(std::memory_order_relaxed); }
std::vector< DetSetHelper > detSet_

◆ find()

int StMeasurementDetSet::find ( unsigned int  jd,
int  i = 0 
) const
inline

Definition at line 177 of file TkMeasurementDetSet.h.

References conditions(), StMeasurementConditionSet::find(), and mps_fire::i.

Referenced by MeasurementTrackerEventProducer::updateStrips().

177 { return conditions().find(jd, i); }
int find(unsigned int jd, int i=0) const
const StMeasurementConditionSet & conditions() const

◆ getDetSet()

void StMeasurementDetSet::getDetSet ( int  i) const
inlineprivate

Definition at line 233 of file TkMeasurementDetSet.h.

References detIndex_, detSet_, handle_, mps_fire::i, incAct(), incSet(), edmNew::DetSetVector< T >::item(), kSet, kSetting, and kUnset.

Referenced by detSet().

233  {
234  const auto& det = detSet_[i];
235 
236  ReadyState expected = ReadyState::kUnset;
237  if (det.ready_.compare_exchange_strong(expected, ReadyState::kSetting, std::memory_order_acq_rel)) {
238  if (detIndex_[i] >= 0) {
239  det.detSet_ = StripDetset(*handle_, handle_->item(detIndex_[i]), true);
240  det.empty_.store(false, std::memory_order_relaxed); // better be false already
241  incAct();
242  } else { // we should not be here
243  det.detSet_ = StripDetset();
244  det.empty_.store(true, std::memory_order_relaxed);
245  }
246  det.ready_.store(ReadyState::kSet, std::memory_order_release);
247  incSet();
248  } else {
249  // need to wait
250  while (ReadyState::kSet != det.ready_.load(std::memory_order_acquire)) {
251  }
252  }
253  }
std::vector< DetSetHelper > detSet_
edmNew::DetSet< SiStripCluster > StripDetset
Item const & item(size_t cell) const
edm::Handle< edmNew::DetSetVector< SiStripCluster > > handle_
std::vector< int > detIndex_

◆ handle() [1/2]

edm::Handle<edmNew::DetSetVector<SiStripCluster> >& StMeasurementDetSet::handle ( )
inline

Definition at line 207 of file TkMeasurementDetSet.h.

References handle_.

Referenced by MeasurementTrackerEvent::MeasurementTrackerEvent(), and MeasurementTrackerEventProducer::updateStrips().

207 { return handle_; }
edm::Handle< edmNew::DetSetVector< SiStripCluster > > handle_

◆ handle() [2/2]

const edm::Handle<edmNew::DetSetVector<SiStripCluster> >& StMeasurementDetSet::handle ( ) const
inline

Definition at line 208 of file TkMeasurementDetSet.h.

References handle_.

208 { return handle_; }
edm::Handle< edmNew::DetSetVector< SiStripCluster > > handle_

◆ id()

unsigned int StMeasurementDetSet::id ( int  i) const
inline

Definition at line 176 of file TkMeasurementDetSet.h.

References conditions(), mps_fire::i, and StMeasurementConditionSet::id().

Referenced by MeasurementTrackerEventProducer::updateStrips().

176 { return conditions().id(i); }
unsigned int id(int i) const
const StMeasurementConditionSet & conditions() const

◆ incAct()

static void StMeasurementDetSet::incAct ( )
inlinestaticprivate

Definition at line 311 of file TkMeasurementDetSet.h.

Referenced by getDetSet().

311 {}

◆ incReady()

static void StMeasurementDetSet::incReady ( )
inlinestaticprivate

Definition at line 309 of file TkMeasurementDetSet.h.

Referenced by update().

309 {}

◆ incSet()

static void StMeasurementDetSet::incSet ( )
inlinestaticprivate

Definition at line 310 of file TkMeasurementDetSet.h.

Referenced by getDetSet().

310 {}

◆ incTot()

static void StMeasurementDetSet::incTot ( int  )
inlinestaticprivate

Definition at line 308 of file TkMeasurementDetSet.h.

Referenced by setEmpty().

308 {}

◆ isActive()

bool StMeasurementDetSet::isActive ( int  i) const
inline

◆ nDet()

int StMeasurementDetSet::nDet ( ) const
inline

Definition at line 175 of file TkMeasurementDetSet.h.

References size().

175 { return size(); }

◆ printStat()

static void StMeasurementDetSet::printStat ( )
inlinestaticprivate

Definition at line 312 of file TkMeasurementDetSet.h.

Referenced by setEmpty(), and ~StMeasurementDetSet().

312 {}

◆ rawInactiveStripDetIds() [1/2]

std::vector<uint32_t>& StMeasurementDetSet::rawInactiveStripDetIds ( )
inline

Definition at line 217 of file TkMeasurementDetSet.h.

References theRawInactiveStripDetIds_.

217 { return theRawInactiveStripDetIds_; }
std::vector< uint32_t > theRawInactiveStripDetIds_

◆ rawInactiveStripDetIds() [2/2]

const std::vector<uint32_t>& StMeasurementDetSet::rawInactiveStripDetIds ( ) const
inline

Definition at line 218 of file TkMeasurementDetSet.h.

References theRawInactiveStripDetIds_.

218 { return theRawInactiveStripDetIds_; }
std::vector< uint32_t > theRawInactiveStripDetIds_

◆ resetOnDemandStrips()

void StMeasurementDetSet::resetOnDemandStrips ( )
inline

Definition at line 220 of file TkMeasurementDetSet.h.

References ntuplemaker::fill, stripDefined_, and stripUpdated_.

220  {
221  std::fill(stripDefined_.begin(), stripDefined_.end(), false);
222  std::fill(stripUpdated_.begin(), stripUpdated_.end(), false);
223  }
std::vector< bool > stripDefined_
std::vector< bool > stripUpdated_

◆ setActiveThisEvent()

void StMeasurementDetSet::setActiveThisEvent ( int  i,
bool  active 
)
inline

Turn on/off the module for reconstruction for one events. This per-event flag is cleared by any call to 'update' or 'setEmpty'.

Definition at line 201 of file TkMeasurementDetSet.h.

References activeThisEvent_, detSet_, and mps_fire::i.

Referenced by TkStripMeasurementDet::setActiveThisEvent(), and MeasurementTrackerEventProducer::updateStrips().

201  {
202  activeThisEvent_[i] = active;
203  if (!active)
204  detSet_[i].empty_ = true;
205  }
std::vector< DetSetHelper > detSet_
std::vector< bool > activeThisEvent_

◆ setEmpty() [1/2]

void StMeasurementDetSet::setEmpty ( int  i)
inline

Definition at line 182 of file TkMeasurementDetSet.h.

References activeThisEvent_, detSet_, and mps_fire::i.

Referenced by TkStripMeasurementDet::setEmpty(), and MeasurementTrackerEventProducer::updateStrips().

182  {
183  detSet_[i].empty_ = true;
184  activeThisEvent_[i] = true;
185  }
std::vector< DetSetHelper > detSet_
std::vector< bool > activeThisEvent_

◆ setEmpty() [2/2]

void StMeasurementDetSet::setEmpty ( )
inline

Definition at line 188 of file TkMeasurementDetSet.h.

References activeThisEvent_, ztail::d, detIndex_, detSet_, ntuplemaker::fill, incTot(), kUnset, printStat(), and size().

188  {
189  printStat();
190  for (auto& d : detSet_) {
191  d.empty_ = true;
192  d.ready_ = ReadyState::kUnset;
193  }
194  std::fill(detIndex_.begin(), detIndex_.end(), -1);
195  std::fill(activeThisEvent_.begin(), activeThisEvent_.end(), true);
196  incTot(size());
197  }
std::vector< DetSetHelper > detSet_
d
Definition: ztail.py:151
static void incTot(int)
std::vector< bool > activeThisEvent_
std::vector< int > detIndex_

◆ setUpdated()

void StMeasurementDetSet::setUpdated ( int  i)
inline

Definition at line 186 of file TkMeasurementDetSet.h.

References mps_fire::i, and stripUpdated_.

186 { stripUpdated_[i] = true; }
std::vector< bool > stripUpdated_

◆ size()

int StMeasurementDetSet::size ( void  ) const
inline

◆ stripDefined()

const bool StMeasurementDetSet::stripDefined ( int  i) const
inline

Definition at line 224 of file TkMeasurementDetSet.h.

References mps_fire::i, and stripDefined_.

224 { return stripDefined_[i]; }
std::vector< bool > stripDefined_

◆ stripUpdated()

const bool StMeasurementDetSet::stripUpdated ( int  i) const
inline

Definition at line 225 of file TkMeasurementDetSet.h.

References mps_fire::i, and stripUpdated_.

225 { return stripUpdated_[i]; }
std::vector< bool > stripUpdated_

◆ update() [1/2]

void StMeasurementDetSet::update ( int  i,
const StripDetset detSet 
)
inline

◆ update() [2/2]

void StMeasurementDetSet::update ( int  i,
int  j 
)
inline

◆ zeroStat()

static void StMeasurementDetSet::zeroStat ( )
inlinestaticprivate

Definition at line 307 of file TkMeasurementDetSet.h.

307 {}

Friends And Related Function Documentation

◆ MeasurementTrackerImpl

friend class MeasurementTrackerImpl
friend

Definition at line 255 of file TkMeasurementDetSet.h.

Member Data Documentation

◆ activeThisEvent_

std::vector<bool> StMeasurementDetSet::activeThisEvent_
private

Definition at line 273 of file TkMeasurementDetSet.h.

Referenced by isActive(), setActiveThisEvent(), and setEmpty().

◆ conditionSet_

const StMeasurementConditionSet* StMeasurementDetSet::conditionSet_
private

Definition at line 257 of file TkMeasurementDetSet.h.

Referenced by conditions().

◆ detIndex_

std::vector<int> StMeasurementDetSet::detIndex_
private

Definition at line 277 of file TkMeasurementDetSet.h.

Referenced by getDetSet(), setEmpty(), and update().

◆ detSet_

std::vector<DetSetHelper> StMeasurementDetSet::detSet_
private

Definition at line 276 of file TkMeasurementDetSet.h.

Referenced by detSet(), empty(), getDetSet(), setActiveThisEvent(), setEmpty(), and update().

◆ handle_

edm::Handle<edmNew::DetSetVector<SiStripCluster> > StMeasurementDetSet::handle_
private

Definition at line 260 of file TkMeasurementDetSet.h.

Referenced by getDetSet(), and handle().

◆ stripDefined_

std::vector<bool> StMeasurementDetSet::stripDefined_
private

Definition at line 282 of file TkMeasurementDetSet.h.

Referenced by defineStrip(), resetOnDemandStrips(), and stripDefined().

◆ stripRegions_

std::vector<std::pair<unsigned int, unsigned int> > StMeasurementDetSet::stripRegions_
private

Definition at line 283 of file TkMeasurementDetSet.h.

Referenced by defineStrip().

◆ stripUpdated_

std::vector<bool> StMeasurementDetSet::stripUpdated_
private

Definition at line 282 of file TkMeasurementDetSet.h.

Referenced by defineStrip(), resetOnDemandStrips(), setUpdated(), and stripUpdated().

◆ theRawInactiveStripDetIds_

std::vector<uint32_t> StMeasurementDetSet::theRawInactiveStripDetIds_
private

Definition at line 280 of file TkMeasurementDetSet.h.

Referenced by rawInactiveStripDetIds().