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
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, std::vector< SiStripCluster >::const_iterator begin, std::vector< SiStripCluster >::const_iterator end)
void update (int i, const StripDetset &detSet)

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 131 of file TkMeasurementDetSet.h.

References badStripBlocks_, and i.

Referenced by TkStripMeasurementDet::badStripBlocks().

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

Definition at line 124 of file TkMeasurementDetSet.h.

References badStripCuts_, i, and subId_.

Referenced by TkStripMeasurementDet::badStripCuts().

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

Definition at line 116 of file TkMeasurementDetSet.h.

References clusterI_, and i.

Referenced by TkStripMeasurementDet::beginClusterI().

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

Definition at line 113 of file TkMeasurementDetSet.h.

References detSet_, and i.

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

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

Definition at line 94 of file TkMeasurementDetSet.h.

References empty_, and i.

Referenced by TkStripMeasurementDet::isEmpty().

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

Definition at line 117 of file TkMeasurementDetSet.h.

References clusterI_.

Referenced by TkStripMeasurementDet::endClusterI().

{return clusterI_[2*i+1];}
std::vector<BadStripBlock>& StMeasurementDetSet::getBadStripBlocks ( int  i) [inline]

Definition at line 130 of file TkMeasurementDetSet.h.

References badStripBlocks_, and i.

Referenced by TkStripMeasurementDet::getBadStripBlocks(), and initializeStripStatus().

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

Definition at line 112 of file TkMeasurementDetSet.h.

References handle_.

Referenced by TkStripMeasurementDet::handle().

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

Definition at line 128 of file TkMeasurementDetSet.h.

References hasAny128StripBad_, and i.

Referenced by TkStripMeasurementDet::hasAny128StripBad().

{ return  hasAny128StripBad_[i];}
unsigned int StMeasurementDetSet::id ( int  i) const [inline]
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 95 of file TkMeasurementDetSet.h.

References activeThisEvent_, activeThisPeriod_, and i.

Referenced by TkStripMeasurementDet::isActive().

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

Definition at line 134 of file TkMeasurementDetSet.h.

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

Referenced by TkStripMeasurementDet::isMasked().

                                                            {
    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 93 of file TkMeasurementDetSet.h.

References regional_.

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

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

Definition at line 82 of file TkMeasurementDetSet.h.

References theMatcher.

Referenced by MeasurementTrackerImpl::addGluedDet().

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

Definition at line 86 of file TkMeasurementDetSet.h.

References id_.

Referenced by initializeStripStatus().

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

Definition at line 115 of file TkMeasurementDetSet.h.

References regionalHandle_.

Referenced by TkStripMeasurementDet::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(), and TkStripMeasurementDet::set128StripStatus().

                                                                     { 
    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 106 of file TkMeasurementDetSet.h.

References activeThisEvent_, activeThisPeriod_, empty_, and i.

Referenced by initializeStripStatus(), and TkStripMeasurementDet::setActive().

{ 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 109 of file TkMeasurementDetSet.h.

References activeThisEvent_, empty_, and i.

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

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

Definition at line 99 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::setEmpty ( int  i) [inline]

Definition at line 97 of file TkMeasurementDetSet.h.

References activeThisEvent_, empty_, and i.

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

{empty_[i] = true; activeThisEvent_[i] = true; }
void StMeasurementDetSet::setLazyGetter ( edm::Handle< LazyGetter > const &  lg) [inline]
void StMeasurementDetSet::setMaskBad128StripBlocks ( bool  maskThem) [inline]

Definition at line 123 of file TkMeasurementDetSet.h.

References maskBad128StripBlocks_.

Referenced by initializeStripStatus().

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

Definition at line 83 of file TkMeasurementDetSet.h.

References theCPE.

Referenced by MeasurementTrackerImpl::addGluedDet(), and TkStripMeasurementDet::cpe().

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

Definition at line 89 of file TkMeasurementDetSet.h.

References i, and subId_.

Referenced by TkStripMeasurementDet::subId().

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

Definition at line 119 of file TkMeasurementDetSet.h.

References i, and totalStrips_.

Referenced by TkStripMeasurementDet::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 73 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 TkStripMeasurementDet::update(), and MeasurementTrackerImpl::updateStrips().

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

Friends And Related Function Documentation

friend class MeasurementTrackerImpl [friend]

Definition at line 157 of file TkMeasurementDetSet.h.


Member Data Documentation

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

Definition at line 188 of file TkMeasurementDetSet.h.

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

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

Definition at line 188 of file TkMeasurementDetSet.h.

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

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

Definition at line 180 of file TkMeasurementDetSet.h.

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

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

Definition at line 183 of file TkMeasurementDetSet.h.

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

Definition at line 171 of file TkMeasurementDetSet.h.

Referenced by badStripCuts(), and initializeStripStatus().

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

Definition at line 196 of file TkMeasurementDetSet.h.

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

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

Definition at line 191 of file TkMeasurementDetSet.h.

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

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

Definition at line 186 of file TkMeasurementDetSet.h.

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

Definition at line 163 of file TkMeasurementDetSet.h.

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

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

Definition at line 181 of file TkMeasurementDetSet.h.

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

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

Definition at line 174 of file TkMeasurementDetSet.h.

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

Definition at line 170 of file TkMeasurementDetSet.h.

Referenced by maskBad128StripBlocks(), and setMaskBad128StripBlocks().

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

Definition at line 179 of file TkMeasurementDetSet.h.

Referenced by isMasked(), and set128StripStatus().

Definition at line 168 of file TkMeasurementDetSet.h.

Referenced by isRegional().

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

Definition at line 175 of file TkMeasurementDetSet.h.

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

Definition at line 161 of file TkMeasurementDetSet.h.

Referenced by stripCPE().

Definition at line 160 of file TkMeasurementDetSet.h.

Referenced by matcher().

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

Definition at line 177 of file TkMeasurementDetSet.h.

Referenced by init(), and totalStrips().