CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Attributes | Static Private Attributes | Friends

StMeasurementDetSet Class Reference

#include <TkMeasurementDetSet.h>

List of all members.

Classes

struct  BadStripBlock
struct  BadStripCuts

Public Types

typedef std::vector
< SiStripCluster >
::const_iterator 
const_iterator
typedef edm::LazyGetter
< SiStripCluster
LazyGetter
typedef StripDetset::const_iterator new_const_iterator
enum  QualityFlags { BadModules = 1, BadAPVFibers = 2, BadStrips = 4, MaskBad128StripBlocks = 8 }
typedef edm::RefGetter
< SiStripCluster
RefGetter
typedef edmNew::DetSet
< SiStripCluster
StripDetset

Public Member Functions

std::vector< BadStripBlock >
const & 
badStripBlocks (int i) const
BadStripCutsbadStripCuts (int i)
unsigned int beginClusterI (int i) const
std::vector< bool > & clusterToSkip () const
StripDetsetdetSet (int i)
bool empty (int i) const
unsigned int endClusterI (int i) const
int find (unsigned int jd, int i=0)
std::vector< BadStripBlock > & getBadStripBlocks (int i)
edm::Handle
< edmNew::DetSetVector
< SiStripCluster > > & 
handle ()
bool hasAny128StripBad (int i) const
unsigned int id (int i) const
void init (std::vector< TkStripMeasurementDet > &stripDets)
void initializeStripStatus (const SiStripQuality *quality, int qualityFlags, int qualityDebugFlags, edm::ParameterSet cutPset)
bool isActive (int i) const
bool isMasked (int i, const SiStripCluster &cluster) const
bool isRegional () const
bool maskBad128StripBlocks () const
const SiStripRecHitMatchermatcher () const
int nDet () const
edm::Handle< edm::LazyGetter
< SiStripCluster > > & 
regionalHandle ()
void set128StripStatus (int i, bool good, int idx=-1)
void setActive (int i, bool active)
 Turn on/off the module for reconstruction, for the full run or lumi (using info from DB, usually). This also resets the 'setActiveThisEvent' to true.
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'.
void setEmpty (int i)
void setEmpty ()
void setLazyGetter (edm::Handle< LazyGetter > const &lg)
void setMaskBad128StripBlocks (bool maskThem)
 StMeasurementDetSet (const SiStripRecHitMatcher *matcher, const StripClusterParameterEstimator *cpe, bool regional)
const
StripClusterParameterEstimator
stripCPE () const
unsigned char subId (int i) const
int totalStrips (int i) const
void update (int i, const StripDetset &detSet)
void update (int i, std::vector< SiStripCluster >::const_iterator begin, std::vector< SiStripCluster >::const_iterator end)

Private Attributes

std::vector< bool > activeThisEvent_
std::vector< bool > activeThisPeriod_
std::vector< bool > bad128Strip_
std::vector< std::vector
< BadStripBlock > > 
badStripBlocks_
BadStripCuts badStripCuts_ [4]
std::vector< unsigned int > clusterI_
std::vector< StripDetsetdetSet_
std::vector< bool > empty_
edm::Handle
< edmNew::DetSetVector
< SiStripCluster > > 
handle_
std::vector< bool > hasAny128StripBad_
std::vector< unsigned int > id_
bool maskBad128StripBlocks_
bool regional_
edm::Handle< edm::LazyGetter
< SiStripCluster > > 
regionalHandle_
std::vector< unsigned char > subId_
const
StripClusterParameterEstimator
theCPE
const SiStripRecHitMatchertheMatcher
std::vector< bool > theStripsToSkip
std::vector< int > totalStrips_

Static Private Attributes

static const int nbad128 = 6

Friends

class MeasurementTrackerImpl

Detailed Description

Definition at line 24 of file TkMeasurementDetSet.h.


Member Typedef Documentation

Definition at line 30 of file TkMeasurementDetSet.h.

Definition at line 32 of file TkMeasurementDetSet.h.

Definition at line 28 of file TkMeasurementDetSet.h.

Definition at line 33 of file TkMeasurementDetSet.h.

Definition at line 27 of file TkMeasurementDetSet.h.


Member Enumeration Documentation

Enumerator:
BadModules 
BadAPVFibers 
BadStrips 
MaskBad128StripBlocks 

Definition at line 35 of file TkMeasurementDetSet.h.

                     { BadModules=1, // for everybody
                       /* Strips: */ BadAPVFibers=2, BadStrips=4, MaskBad128StripBlocks=8 }; 

Constructor & Destructor Documentation

StMeasurementDetSet::StMeasurementDetSet ( const SiStripRecHitMatcher matcher,
const StripClusterParameterEstimator cpe,
bool  regional 
) [inline]

Definition at line 54 of file TkMeasurementDetSet.h.

                                    :
    theMatcher(matcher), theCPE(cpe), regional_(regional){}

Member Function Documentation

std::vector<BadStripBlock> const& StMeasurementDetSet::badStripBlocks ( int  i) const [inline]

Definition at line 132 of file TkMeasurementDetSet.h.

References badStripBlocks_, and i.

{return badStripBlocks_[i]; }
BadStripCuts& StMeasurementDetSet::badStripCuts ( int  i) [inline]

Definition at line 125 of file TkMeasurementDetSet.h.

References badStripCuts_, i, and subId_.

{ return  badStripCuts_[subId_[i]];}
unsigned int StMeasurementDetSet::beginClusterI ( int  i) const [inline]

Definition at line 117 of file TkMeasurementDetSet.h.

References clusterI_, and i.

{return clusterI_[2*i];}
std::vector<bool>& StMeasurementDetSet::clusterToSkip ( ) const [inline]

Definition at line 63 of file TkMeasurementDetSet.h.

References theStripsToSkip.

Referenced by OnDemandMeasurementTracker::updateStrips().

{ return theStripsToSkip; }
StripDetset& StMeasurementDetSet::detSet ( int  i) [inline]

Definition at line 114 of file TkMeasurementDetSet.h.

References detSet_, and i.

Referenced by update().

{ return detSet_[i];}
bool StMeasurementDetSet::empty ( int  i) const [inline]

Definition at line 95 of file TkMeasurementDetSet.h.

References empty_, and i.

{ return empty_[i];}  
unsigned int StMeasurementDetSet::endClusterI ( int  i) const [inline]

Definition at line 118 of file TkMeasurementDetSet.h.

References clusterI_.

{return clusterI_[2*i+1];}
int StMeasurementDetSet::find ( unsigned int  jd,
int  i = 0 
) [inline]

Definition at line 90 of file TkMeasurementDetSet.h.

References i, and id_.

Referenced by MeasurementTrackerImpl::updateStrips().

                                     {
    return std::lower_bound(id_.begin()+i,id_.end(),jd)-id_.begin();
  }
std::vector<BadStripBlock>& StMeasurementDetSet::getBadStripBlocks ( int  i) [inline]

Definition at line 131 of file TkMeasurementDetSet.h.

References badStripBlocks_, and i.

Referenced by initializeStripStatus().

{ return badStripBlocks_[i]; }
edm::Handle<edmNew::DetSetVector<SiStripCluster> >& StMeasurementDetSet::handle ( ) [inline]

Definition at line 113 of file TkMeasurementDetSet.h.

References handle_.

{  return handle_;}
bool StMeasurementDetSet::hasAny128StripBad ( int  i) const [inline]

Definition at line 129 of file TkMeasurementDetSet.h.

References hasAny128StripBad_, and i.

{ return  hasAny128StripBad_[i];}
unsigned int StMeasurementDetSet::id ( int  i) const [inline]

Definition at line 87 of file TkMeasurementDetSet.h.

References i, and id_.

Referenced by MeasurementTrackerImpl::initialize(), initializeStripStatus(), and MeasurementTrackerImpl::updateStrips().

{ return id_[i]; }
void StMeasurementDetSet::init ( std::vector< TkStripMeasurementDet > &  stripDets)

Definition at line 8 of file TkMeasurementDetSet.cc.

References activeThisEvent_, activeThisPeriod_, bad128Strip_, badStripBlocks_, clusterI_, detSet_, empty_, hasAny128StripBad_, i, id_, isRegional(), findQualityFiles::size, DetId::subdetId(), subId_, and totalStrips_.

Referenced by MeasurementTrackerImpl::initialize().

                                                                           {
  // assume vector is full and ordered!
  int size = stripDets.size();
  
  empty_.resize(size,true);
  activeThisEvent_.resize(size,true);
  activeThisPeriod_.resize(size,true);
  id_.resize(size);
  subId_.resize(size);
  totalStrips_.resize(size);
  
  bad128Strip_.resize(size*6);
  hasAny128StripBad_.resize(size);
  badStripBlocks_.resize(size);

  if (isRegional()) {
    clusterI_.resize(2*size);
  }  else {
    detSet_.resize(size);
  }
  
  for (int i=0; i!=size; ++i) {
    auto & mdet =  stripDets[i]; 
    mdet.setIndex(i);
    //intialize the detId !
    id_[i] = mdet.specificGeomDet().geographicalId().rawId();
    subId_[i]=SiStripDetId(id_[i]).subdetId()-3;
    //initalize the total number of strips
    totalStrips_[i] =  mdet.specificGeomDet().specificTopology().nstrips();
  }
}
void StMeasurementDetSet::initializeStripStatus ( const SiStripQuality quality,
int  qualityFlags,
int  qualityDebugFlags,
edm::ParameterSet  cutPset 
)

Definition at line 62 of file TkMeasurementDetSet.cc.

References BadAPVFibers, BadModules, badStripCuts_, BadStrips, SiStripBadStrip::decode(), cond::rpcobgas::detid, SiStripQuality::getBadApvs(), SiStripQuality::getBadFibers(), getBadStripBlocks(), edm::ParameterSet::getParameter(), SiStripBadStrip::getRange(), i, id(), SiStripQuality::IsModuleUsable(), j, MaskBad128StripBlocks, nDet(), set128StripStatus(), setActive(), setMaskBad128StripBlocks(), SiStripDetId::TEC, SiStripDetId::TIB, SiStripDetId::TID, and SiStripDetId::TOB.

Referenced by MeasurementTrackerImpl::initializeStripStatus().

                                                                                                                                               {
  if (qualityFlags & BadStrips) {
     badStripCuts_[SiStripDetId::TIB-3] = BadStripCuts(cutPset.getParameter<edm::ParameterSet>("TIB"));
    badStripCuts_[SiStripDetId::TOB-3] = BadStripCuts(cutPset.getParameter<edm::ParameterSet>("TOB"));
    badStripCuts_[SiStripDetId::TID-3] = BadStripCuts(cutPset.getParameter<edm::ParameterSet>("TID"));
    badStripCuts_[SiStripDetId::TEC-3] = BadStripCuts(cutPset.getParameter<edm::ParameterSet>("TEC"));
  }
  setMaskBad128StripBlocks((qualityFlags & MaskBad128StripBlocks) != 0);
  
  
  if ((quality != 0) && (qualityFlags != 0))  {
    edm::LogInfo("MeasurementTracker") << "qualityFlags = " << qualityFlags;
    unsigned int on = 0, tot = 0; 
    unsigned int foff = 0, ftot = 0, aoff = 0, atot = 0; 
    for (int i=0; i!=nDet(); i++) {
      uint32_t detid = id(i);
      if (qualityFlags & BadModules) {
        bool isOn = quality->IsModuleUsable(detid);
        setActive(i,isOn);
        tot++; on += (unsigned int) isOn;
        if (qualityDebugFlags & BadModules) {
          edm::LogInfo("MeasurementTracker")<< "MeasurementTrackerImpl::initializeStripStatus : detid " << detid << " is " << (isOn ?  "on" : "off");
        }
      } else {
        setActive(i,true);
      }
      // first turn all APVs and fibers ON
      set128StripStatus(i,true); 
      if (qualityFlags & BadAPVFibers) {
        short badApvs   = quality->getBadApvs(detid);
        short badFibers = quality->getBadFibers(detid);
        for (int j = 0; j < 6; j++) {
          atot++;
          if (badApvs & (1 << j)) {
            set128StripStatus(i,false, j);
            aoff++;
          }
        }
        for (int j = 0; j < 3; j++) {
          ftot++;
             if (badFibers & (1 << j)) {
               set128StripStatus(i,false, 2*j);
               set128StripStatus(i,false, 2*j+1);
               foff++;
             }
        }
      } 
      auto & badStrips = getBadStripBlocks(i);
       badStrips.clear();
       if (qualityFlags & BadStrips) {
         SiStripBadStrip::Range range = quality->getRange(detid);
         for (SiStripBadStrip::ContainerIterator bit = range.first; bit != range.second; ++bit) {
           badStrips.push_back(quality->decode(*bit));
         }
       }
    }
    if (qualityDebugFlags & BadModules) {
      edm::LogInfo("MeasurementTracker StripModuleStatus") << 
        " Total modules: " << tot << ", active " << on <<", inactive " << (tot - on);
    }
    if (qualityDebugFlags & BadAPVFibers) {
      edm::LogInfo("MeasurementTracker StripAPVStatus") << 
        " Total APVs: " << atot << ", active " << (atot-aoff) <<", inactive " << (aoff);
        edm::LogInfo("MeasurementTracker StripFiberStatus") << 
          " Total Fibers: " << ftot << ", active " << (ftot-foff) <<", inactive " << (foff);
    }
  } else {
    for (int i=0; i!=nDet(); i++) {
      setActive(i,true);          // module ON
      set128StripStatus(i,true);  // all APVs and fibers ON
    }
  }
}
bool StMeasurementDetSet::isActive ( int  i) const [inline]

Definition at line 96 of file TkMeasurementDetSet.h.

References activeThisEvent_, activeThisPeriod_, and i.

Referenced by MeasurementTrackerImpl::updateStrips().

bool StMeasurementDetSet::isMasked ( int  i,
const SiStripCluster cluster 
) const [inline]

Definition at line 135 of file TkMeasurementDetSet.h.

References SiStripCluster::amplitudes(), bad128Strip_, SiStripCluster::barycenter(), SiStripCluster::firstStrip(), i, nbad128, and evf::evtn::offset().

                                                            {
    int offset =  nbad128*i;
    if ( bad128Strip_[offset+( cluster.firstStrip() >> 7)] ) {
      if ( bad128Strip_[offset+( (cluster.firstStrip()+cluster.amplitudes().size())  >> 7)] ||
           bad128Strip_[offset+( static_cast<int32_t>(cluster.barycenter()-0.499999) >> 7)] ) {
        return true;
      }
    } else {
      if ( bad128Strip_[offset+( (cluster.firstStrip()+cluster.amplitudes().size())  >> 7)] &&
           bad128Strip_[offset+( static_cast<int32_t>(cluster.barycenter()-0.499999) >> 7)] ) {
        return true;
      }
    }
    return false;
  }
bool StMeasurementDetSet::isRegional ( ) const [inline]

Definition at line 94 of file TkMeasurementDetSet.h.

References regional_.

Referenced by init(), and MeasurementTrackerImpl::updateStrips().

{ return regional_;}
bool StMeasurementDetSet::maskBad128StripBlocks ( ) const [inline]

Definition at line 128 of file TkMeasurementDetSet.h.

References maskBad128StripBlocks_.

const SiStripRecHitMatcher* StMeasurementDetSet::matcher ( ) const [inline]

Definition at line 81 of file TkMeasurementDetSet.h.

References theMatcher.

Referenced by MeasurementTrackerImpl::addGluedDet().

{ return theMatcher;}
int StMeasurementDetSet::nDet ( ) const [inline]

Definition at line 85 of file TkMeasurementDetSet.h.

References id_.

Referenced by initializeStripStatus().

{ return id_.size();}
edm::Handle<edm::LazyGetter<SiStripCluster> >& StMeasurementDetSet::regionalHandle ( ) [inline]

Definition at line 116 of file TkMeasurementDetSet.h.

References regionalHandle_.

{ return regionalHandle_;}
void StMeasurementDetSet::set128StripStatus ( int  i,
bool  good,
int  idx = -1 
)

Definition at line 41 of file TkMeasurementDetSet.cc.

References bad128Strip_, lumiContext::fill, hasAny128StripBad_, i, UserOptions_cff::idx, j, nbad128, and evf::evtn::offset().

Referenced by initializeStripStatus().

                                                                     { 
    int offset =  nbad128*i;
    if (idx == -1) {
      std::fill(bad128Strip_.begin()+offset, bad128Strip_.begin()+offset+6, !good);
      hasAny128StripBad_[i] = !good;
    } else {
      bad128Strip_[offset+idx] = !good;
      if (good == false) {
        hasAny128StripBad_[i] = false;
      } else { // this should not happen, as usually you turn on all fibers
        // and then turn off the bad ones, and not vice-versa,
        // so I don't care if it's not optimized
        hasAny128StripBad_[i] = true;
        for (int j = 0; i < (totalStrips_[j] >> 7); j++) {
          if (bad128Strip_[j+offset] == false) hasAny128StripBad_[i] = false; break;
        }
      }    
    } 
  }
void StMeasurementDetSet::setActive ( int  i,
bool  active 
) [inline]

Turn on/off the module for reconstruction, for the full run or lumi (using info from DB, usually). This also resets the 'setActiveThisEvent' to true.

Definition at line 107 of file TkMeasurementDetSet.h.

References activeThisEvent_, activeThisPeriod_, empty_, and i.

Referenced by initializeStripStatus().

{ activeThisPeriod_[i] = active; activeThisEvent_[i] = true; if (!active) empty_[i] = true; }
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 110 of file TkMeasurementDetSet.h.

References activeThisEvent_, empty_, and i.

Referenced by MeasurementTrackerImpl::updateStrips().

{ activeThisEvent_[i] = active;  if (!active) empty_[i] = true; }
void StMeasurementDetSet::setEmpty ( int  i) [inline]

Definition at line 98 of file TkMeasurementDetSet.h.

References activeThisEvent_, empty_, and i.

Referenced by MeasurementTrackerImpl::updateStrips().

{empty_[i] = true; activeThisEvent_[i] = true; }
void StMeasurementDetSet::setEmpty ( ) [inline]

Definition at line 100 of file TkMeasurementDetSet.h.

References activeThisEvent_, empty_, and lumiContext::fill.

                  {
    std::fill(empty_.begin(),empty_.end(),true);
    std::fill(activeThisEvent_.begin(), activeThisEvent_.end(),true);
  }
void StMeasurementDetSet::setLazyGetter ( edm::Handle< LazyGetter > const &  lg) [inline]
void StMeasurementDetSet::setMaskBad128StripBlocks ( bool  maskThem) [inline]

Definition at line 124 of file TkMeasurementDetSet.h.

References maskBad128StripBlocks_.

Referenced by initializeStripStatus().

{ maskBad128StripBlocks_ = maskThem; }
const StripClusterParameterEstimator* StMeasurementDetSet::stripCPE ( ) const [inline]

Definition at line 82 of file TkMeasurementDetSet.h.

References theCPE.

Referenced by MeasurementTrackerImpl::addGluedDet().

{ return theCPE;}
unsigned char StMeasurementDetSet::subId ( int  i) const [inline]

Definition at line 88 of file TkMeasurementDetSet.h.

References i, and subId_.

{ return subId_[i];}
int StMeasurementDetSet::totalStrips ( int  i) const [inline]

Definition at line 120 of file TkMeasurementDetSet.h.

References i, and totalStrips_.

{ return totalStrips_[i];}
void StMeasurementDetSet::update ( int  i,
std::vector< SiStripCluster >::const_iterator  begin,
std::vector< SiStripCluster >::const_iterator  end 
) [inline]

Definition at line 72 of file TkMeasurementDetSet.h.

References activeThisEvent_, clusterI_, empty_, i, and regionalHandle_.

                                                                                                                 { 
    clusterI_[2*i] = begin - regionalHandle_->begin_record();
    clusterI_[2*i+1] = end - regionalHandle_->begin_record();
    
    empty_[i] = false;
    activeThisEvent_[i] = true;
  }
void StMeasurementDetSet::update ( int  i,
const StripDetset detSet 
) [inline]

Definition at line 67 of file TkMeasurementDetSet.h.

References detSet(), detSet_, empty_, and i.

Referenced by MeasurementTrackerImpl::updateStrips().

                                                 { 
    detSet_[i] = detSet;     
    empty_[i] = false;
  }

Friends And Related Function Documentation

friend class MeasurementTrackerImpl [friend]

Definition at line 158 of file TkMeasurementDetSet.h.


Member Data Documentation

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

Definition at line 189 of file TkMeasurementDetSet.h.

Referenced by init(), isActive(), setActive(), setActiveThisEvent(), setEmpty(), and update().

std::vector<bool> StMeasurementDetSet::activeThisPeriod_ [private]

Definition at line 189 of file TkMeasurementDetSet.h.

Referenced by init(), isActive(), and setActive().

std::vector<bool> StMeasurementDetSet::bad128Strip_ [private]

Definition at line 181 of file TkMeasurementDetSet.h.

Referenced by init(), isMasked(), and set128StripStatus().

std::vector<std::vector<BadStripBlock> > StMeasurementDetSet::badStripBlocks_ [private]

Definition at line 184 of file TkMeasurementDetSet.h.

Referenced by badStripBlocks(), getBadStripBlocks(), and init().

Definition at line 172 of file TkMeasurementDetSet.h.

Referenced by badStripCuts(), and initializeStripStatus().

std::vector<unsigned int> StMeasurementDetSet::clusterI_ [private]

Definition at line 197 of file TkMeasurementDetSet.h.

Referenced by beginClusterI(), endClusterI(), init(), and update().

std::vector<StripDetset> StMeasurementDetSet::detSet_ [private]

Definition at line 192 of file TkMeasurementDetSet.h.

Referenced by detSet(), init(), and update().

std::vector<bool> StMeasurementDetSet::empty_ [private]

Definition at line 187 of file TkMeasurementDetSet.h.

Referenced by empty(), init(), setActive(), setActiveThisEvent(), setEmpty(), and update().

Definition at line 164 of file TkMeasurementDetSet.h.

Referenced by handle(), and MeasurementTrackerImpl::updateStrips().

std::vector<bool> StMeasurementDetSet::hasAny128StripBad_ [private]

Definition at line 182 of file TkMeasurementDetSet.h.

Referenced by hasAny128StripBad(), init(), and set128StripStatus().

std::vector<unsigned int> StMeasurementDetSet::id_ [private]

Definition at line 175 of file TkMeasurementDetSet.h.

Referenced by find(), id(), init(), nDet(), and MeasurementTrackerImpl::updateStrips().

Definition at line 171 of file TkMeasurementDetSet.h.

Referenced by maskBad128StripBlocks(), and setMaskBad128StripBlocks().

const int StMeasurementDetSet::nbad128 = 6 [static, private]

Definition at line 180 of file TkMeasurementDetSet.h.

Referenced by isMasked(), and set128StripStatus().

Definition at line 169 of file TkMeasurementDetSet.h.

Referenced by isRegional().

std::vector<unsigned char> StMeasurementDetSet::subId_ [private]

Definition at line 176 of file TkMeasurementDetSet.h.

Referenced by badStripCuts(), init(), and subId().

Definition at line 162 of file TkMeasurementDetSet.h.

Referenced by stripCPE().

Definition at line 161 of file TkMeasurementDetSet.h.

Referenced by matcher().

std::vector<bool> StMeasurementDetSet::theStripsToSkip [mutable, private]
std::vector<int> StMeasurementDetSet::totalStrips_ [private]

Definition at line 178 of file TkMeasurementDetSet.h.

Referenced by init(), and totalStrips().