CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

MeasurementTrackerImpl Class Reference

#include <MeasurementTrackerImpl.h>

Inheritance diagram for MeasurementTrackerImpl:
MeasurementTracker MeasurementDetSystem OnDemandMeasurementTracker

List of all members.

Public Types

typedef std::unordered_map
< unsigned int, MeasurementDet * > 
DetContainer
enum  QualityFlags {
  BadModules = 1, BadAPVFibers = 2, BadStrips = 4, MaskBad128StripBlocks = 8,
  BadROCs = 2
}

Public Member Functions

const DetContainerallDets () const
 For debug only.
TkStripMeasurementDetconcreteDetUpdatable (DetId id) const
const MeasurementDetfindDet (const DetId &id) const
const GeometricSearchTrackergeometricSearchTracker () const
const TrackingGeometrygeomTracker () const
const std::vector
< TkGluedMeasurementDet > & 
gluedDets () const
virtual const MeasurementDetidToDet (const DetId &id) const
 MeasurementDetSystem interface (can be overloaded!)
 MeasurementTrackerImpl (const edm::ParameterSet &conf, const PixelClusterParameterEstimator *pixelCPE, const StripClusterParameterEstimator *stripCPE, const SiStripRecHitMatcher *hitMatcher, const TrackerGeometry *trackerGeom, const GeometricSearchTracker *geometricSearchTracker, const SiStripQuality *stripQuality, int stripQualityFlags, int stripQualityDebugFlags, const SiPixelQuality *pixelQuality, const SiPixelFedCabling *pixelCabling, int pixelQualityFlags, int pixelQualityDebugFlags, bool isRegional=false)
const std::vector
< TkPixelMeasurementDet * > & 
pixelDets () const
void setClusterToSkip (const edm::InputTag &cluster, const edm::Event &event) const
const std::vector
< TkStripMeasurementDet > & 
stripDets () const
void unsetClusterToSkip () const
virtual void update (const edm::Event &) const
void updatePixels (const edm::Event &) const
void updateStrips (const edm::Event &) const
virtual ~MeasurementTrackerImpl ()

Protected Member Functions

void addGluedDet (const GluedGeomDet *gd)
void addPixelDet (const GeomDet *gd, const PixelClusterParameterEstimator *cpe)
void addPixelDets (const TrackingGeometry::DetContainer &dets)
void addStripDet (const GeomDet *gd)
void addStripDets (const TrackingGeometry::DetContainer &dets)
void getInactiveStrips (const edm::Event &event, std::vector< uint32_t > &rawInactiveDetIds) const
void initGluedDet (TkGluedMeasurementDet &det)
void initialize ()
void initializePixelStatus (const SiPixelQuality *stripQuality, const SiPixelFedCabling *pixelCabling, int qualityFlags, int qualityDebugFlags)
void initializeStripStatus (const SiStripQuality *stripQuality, int qualityFlags, int qualityDebugFlags)

Protected Attributes

const std::string name_
const edm::ParameterSetpset_
bool selfUpdateSkipClusters_
DetContainer theDetMap
std::vector
< TkGluedMeasurementDet
theGluedDets
const std::vector< edm::InputTagtheInactivePixelDetectorLabels
const std::vector< edm::InputTagtheInactiveStripDetectorLabels
const SiPixelFedCablingthePixelCabling
const
PixelClusterParameterEstimator
thePixelCPE
std::vector
< TkPixelMeasurementDet * > 
thePixelDets
std::vector< bool > thePixelsToSkip
StMeasurementDetSet theStDets
std::vector
< TkStripMeasurementDet
theStripDets

Detailed Description

Definition at line 44 of file MeasurementTrackerImpl.h.


Member Typedef Documentation

typedef std::unordered_map<unsigned int,MeasurementDet*> MeasurementTrackerImpl::DetContainer

Definition at line 97 of file MeasurementTrackerImpl.h.


Member Enumeration Documentation

Enumerator:
BadModules 
BadAPVFibers 
BadStrips 
MaskBad128StripBlocks 
BadROCs 

Reimplemented from MeasurementTracker.

Definition at line 46 of file MeasurementTrackerImpl.h.

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

Constructor & Destructor Documentation

MeasurementTrackerImpl::MeasurementTrackerImpl ( const edm::ParameterSet conf,
const PixelClusterParameterEstimator pixelCPE,
const StripClusterParameterEstimator stripCPE,
const SiStripRecHitMatcher hitMatcher,
const TrackerGeometry trackerGeom,
const GeometricSearchTracker geometricSearchTracker,
const SiStripQuality stripQuality,
int  stripQualityFlags,
int  stripQualityDebugFlags,
const SiPixelQuality pixelQuality,
const SiPixelFedCabling pixelCabling,
int  pixelQualityFlags,
int  pixelQualityDebugFlags,
bool  isRegional = false 
)

Definition at line 95 of file MeasurementTrackerImpl.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), initialize(), initializePixelStatus(), initializeStripStatus(), LogDebug, selfUpdateSkipClusters_, and createPayload::skip.

                                                        :
  MeasurementTracker(trackerGeom,geometricSearchTracker),
  pset_(conf),
  name_(conf.getParameter<std::string>("ComponentName")),
  theStDets(hitMatcher,stripCPE,isRegional),
  thePixelCPE(pixelCPE),
  theInactivePixelDetectorLabels(conf.getParameter<std::vector<edm::InputTag> >("inactivePixelDetectorLabels")),
  theInactiveStripDetectorLabels(conf.getParameter<std::vector<edm::InputTag> >("inactiveStripDetectorLabels"))
{
  this->initialize();
  this->initializeStripStatus(stripQuality, stripQualityFlags, stripQualityDebugFlags);
  this->initializePixelStatus(pixelQuality, pixelCabling, pixelQualityFlags, pixelQualityDebugFlags);
  //the measurement tracking is set to skip clusters, the other option is set from outside
  selfUpdateSkipClusters_=conf.exists("skipClusters");
  if (selfUpdateSkipClusters_)
    {
      edm::InputTag skip=conf.getParameter<edm::InputTag>("skipClusters");
      if (skip==edm::InputTag("")) selfUpdateSkipClusters_=false;
    }


  LogDebug("MeasurementTracker")<<"skipping clusters: "<<selfUpdateSkipClusters_;
}
MeasurementTrackerImpl::~MeasurementTrackerImpl ( ) [virtual]

Definition at line 132 of file MeasurementTrackerImpl.cc.

References thePixelDets.

{
  for(vector<TkPixelMeasurementDet*>::const_iterator it=thePixelDets.begin(); it!=thePixelDets.end(); ++it){
    delete *it;
  }
  
}

Member Function Documentation

void MeasurementTrackerImpl::addGluedDet ( const GluedGeomDet gd) [protected]
void MeasurementTrackerImpl::addPixelDet ( const GeomDet gd,
const PixelClusterParameterEstimator cpe 
) [protected]
void MeasurementTrackerImpl::addPixelDets ( const TrackingGeometry::DetContainer dets) [protected]

Definition at line 168 of file MeasurementTrackerImpl.cc.

References addPixelDet(), and thePixelCPE.

Referenced by initialize().

{
  for (TrackerGeometry::DetContainer::const_iterator gd=dets.begin();
       gd != dets.end(); gd++) {
    addPixelDet(*gd, thePixelCPE);
  }  
}
void MeasurementTrackerImpl::addStripDet ( const GeomDet gd) [protected]

Definition at line 201 of file MeasurementTrackerImpl.cc.

References theStDets, theStripDets, and cms::Exception::what().

Referenced by addStripDets().

{
  try {
    theStripDets.push_back(TkStripMeasurementDet( gd, theStDets));
  }
  catch(MeasurementDetException& err){
    edm::LogError("MeasurementDet") << "Oops, got a MeasurementDetException: " << err.what() ;
  }
}
void MeasurementTrackerImpl::addStripDets ( const TrackingGeometry::DetContainer dets) [protected]

Definition at line 176 of file MeasurementTrackerImpl.cc.

References addGluedDet(), and addStripDet().

Referenced by initialize().

{
  for (TrackerGeometry::DetContainer::const_iterator gd=dets.begin();
       gd != dets.end(); gd++) {

    const GeomDetUnit* gdu = dynamic_cast<const GeomDetUnit*>(*gd);

    //    StripSubdetector stripId( (**gd).geographicalId());
    //     bool isDetUnit( gdu != 0);
    //     cout << "StripSubdetector glued? " << stripId.glued() 
    //   << " is DetUnit? " << isDetUnit << endl;

    if (gdu != 0) {
      addStripDet(*gd);
    }
    else {
      const GluedGeomDet* gluedDet = dynamic_cast<const GluedGeomDet*>(*gd);
      if (gluedDet == 0) {
        throw MeasurementDetException("MeasurementTracker ERROR: GeomDet neither DetUnit nor GluedDet");
      }
      addGluedDet(gluedDet);
    }  
  }
}
const DetContainer& MeasurementTrackerImpl::allDets ( ) const [inline]

For debug only.

Definition at line 100 of file MeasurementTrackerImpl.h.

References theDetMap.

{return theDetMap;}
TkStripMeasurementDet * MeasurementTrackerImpl::concreteDetUpdatable ( DetId  id) const

Definition at line 528 of file MeasurementTrackerImpl.cc.

References findDet(), and idToDet().

Referenced by updateStrips().

                                                                                   {
#ifdef EDM_DEBUG //or similar
  const TkStripMeasurementDet* theConcreteDet = 
    dynamic_cast<const TkStripMeasurementDet*>(findDet(id));
  if(theConcreteDet == 0)
    throw MeasurementDetException("failed casting to TkStripMeasurementDet*");      
#endif
  // will trigger ondemand unpacking
  return const_cast<TkStripMeasurementDet*>(static_cast<const TkStripMeasurementDet*>(idToDet(id)));
}
const MeasurementDet* MeasurementTrackerImpl::findDet ( const DetId id) const [inline]

Definition at line 82 of file MeasurementTrackerImpl.h.

References theDetMap.

Referenced by concreteDetUpdatable(), idToDet(), and initGluedDet().

  {
    auto it = theDetMap.find(id);
    if(it !=theDetMap.end()) {
      return it->second;
    }else{
      //throw exception;
    }
    
    return 0; //to avoid compile warning
  }
const GeometricSearchTracker* MeasurementTrackerImpl::geometricSearchTracker ( ) const [inline]

Reimplemented from MeasurementTracker.

Definition at line 73 of file MeasurementTrackerImpl.h.

References MeasurementTracker::theGeometricSearchTracker.

const TrackingGeometry* MeasurementTrackerImpl::geomTracker ( ) const [inline]

Reimplemented from MeasurementTracker.

Definition at line 71 of file MeasurementTrackerImpl.h.

References MeasurementTracker::theTrackerGeom.

{ return theTrackerGeom;}
void MeasurementTrackerImpl::getInactiveStrips ( const edm::Event event,
std::vector< uint32_t > &  rawInactiveDetIds 
) const [protected]

Definition at line 386 of file MeasurementTrackerImpl.cc.

References python::multivaluedict::sort(), and theInactiveStripDetectorLabels.

Referenced by OnDemandMeasurementTracker::updateStrips(), and updateStrips().

                                                                                              {
  if (!theInactiveStripDetectorLabels.empty()) {
    edm::Handle<DetIdCollection> detIds;
    for (std::vector<edm::InputTag>::const_iterator itt = theInactiveStripDetectorLabels.begin(), edt = theInactiveStripDetectorLabels.end(); 
         itt != edt; ++itt) {
      event.getByLabel(*itt, detIds);
      rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
    }
    if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
  }
}
const std::vector<TkGluedMeasurementDet>& MeasurementTrackerImpl::gluedDets ( ) const [inline]

Definition at line 103 of file MeasurementTrackerImpl.h.

References theGluedDets.

{return theGluedDets;}
virtual const MeasurementDet* MeasurementTrackerImpl::idToDet ( const DetId id) const [inline, virtual]

MeasurementDetSystem interface (can be overloaded!)

Implements MeasurementTracker.

Reimplemented in OnDemandMeasurementTracker.

Definition at line 77 of file MeasurementTrackerImpl.h.

References findDet().

Referenced by concreteDetUpdatable().

                                 {
    return findDet(id);
  }
void MeasurementTrackerImpl::initGluedDet ( TkGluedMeasurementDet det) [protected]

Definition at line 225 of file MeasurementTrackerImpl.cc.

References findDet(), GeomDet::geographicalId(), TkGluedMeasurementDet::init(), GluedGeomDet::monoDet(), TkGluedMeasurementDet::specificGeomDet(), GluedGeomDet::stereoDet(), and theDetMap.

Referenced by initialize().

{
  const GluedGeomDet& gd = det.specificGeomDet();
  const MeasurementDet* monoDet = findDet( gd.monoDet()->geographicalId());
  const MeasurementDet* stereoDet = findDet( gd.stereoDet()->geographicalId());
  if (monoDet == 0 || stereoDet == 0) {
    edm::LogError("MeasurementDet") << "MeasurementTracker ERROR: GluedDet components not found as MeasurementDets ";
    throw MeasurementDetException("MeasurementTracker ERROR: GluedDet components not found as MeasurementDets");
  }
  det.init(monoDet,stereoDet);
  theDetMap[gd.geographicalId()] = &det;
}
void MeasurementTrackerImpl::initialize ( ) [protected]
void MeasurementTrackerImpl::initializePixelStatus ( const SiPixelQuality stripQuality,
const SiPixelFedCabling pixelCabling,
int  qualityFlags,
int  qualityDebugFlags 
) [protected]

Definition at line 545 of file MeasurementTrackerImpl.cc.

References BadModules, BadROCs, cond::rpcobgas::detid, SiPixelQuality::getBadRocPositions(), SiPixelQuality::getBadRocs(), i, SiPixelQuality::IsModuleUsable(), thePixelDets, and MeasurementTracker::theTrackerGeom.

Referenced by MeasurementTrackerImpl().

                                                                                                                                                                {
  if ((quality != 0) && (qualityFlags != 0))  {
    edm::LogInfo("MeasurementTracker") << "qualityFlags = " << qualityFlags;
    unsigned int on = 0, tot = 0, badrocs = 0; 
    for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
         i!=thePixelDets.end(); i++) {
      uint32_t detid = ((**i).geomDet().geographicalId()).rawId();
      if (qualityFlags & BadModules) {
          bool isOn = quality->IsModuleUsable(detid);
          (*i)->setActive(isOn);
          tot++; on += (unsigned int) isOn;
          if (qualityDebugFlags & BadModules) {
            edm::LogInfo("MeasurementTracker")<< "MeasurementTrackerImpl::initializePixelStatus : detid " << detid << " is " << (isOn ?  "on" : "off");
          }
       } else {
          (*i)->setActive(true);
       }
       if ((qualityFlags & BadROCs) && (quality->getBadRocs(detid) != 0)) {
          std::vector<LocalPoint> badROCs = quality->getBadRocPositions(detid, *theTrackerGeom, pixelCabling);
          badrocs += badROCs.size();
          (*i)->setBadRocPositions(badROCs);
       } else {
          (*i)->clearBadRocPositions();  
       }
    }
    if (qualityDebugFlags & BadModules) {
        edm::LogInfo("MeasurementTracker PixelModuleStatus") << 
            " Total modules: " << tot << ", active " << on <<", inactive " << (tot - on);
    }
    if (qualityDebugFlags & BadROCs) {
        edm::LogInfo("MeasurementTracker PixelROCStatus") << " Total of bad ROCs: " << badrocs ;
    }
  } else {
    for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
         i!=thePixelDets.end(); i++) {
      (*i)->setActive(true);          // module ON
    }
  }
}
void MeasurementTrackerImpl::initializeStripStatus ( const SiStripQuality stripQuality,
int  qualityFlags,
int  qualityDebugFlags 
) [protected]

Definition at line 540 of file MeasurementTrackerImpl.cc.

References edm::ParameterSet::getParameter(), StMeasurementDetSet::initializeStripStatus(), pset_, and theStDets.

Referenced by MeasurementTrackerImpl().

                                                                                                                         {
  edm::ParameterSet cutPset = pset_.getParameter<edm::ParameterSet>("badStripCuts");
   theStDets.initializeStripStatus(quality, qualityFlags, qualityDebugFlags, cutPset);
}
const std::vector<TkPixelMeasurementDet*>& MeasurementTrackerImpl::pixelDets ( ) const [inline]

Definition at line 102 of file MeasurementTrackerImpl.h.

References thePixelDets.

{return thePixelDets;}
void MeasurementTrackerImpl::setClusterToSkip ( const edm::InputTag cluster,
const edm::Event event 
) const [virtual]

Implements MeasurementTracker.

Definition at line 259 of file MeasurementTrackerImpl.cc.

References LogDebug, selfUpdateSkipClusters_, thePixelsToSkip, theStDets, and StMeasurementDetSet::theStripsToSkip.

{
  //method called by user of the measurement tracker to tell what needs to be skiped from the event.
  //there it is incompatible with a configuration in which the measurement tracker already knows what to skip
  // i.e selfUpdateSkipClusters_=True

  LogDebug("MeasurementTracker")<<"setClusterToSkip";
  if (selfUpdateSkipClusters_)
    edm::LogError("MeasurementTracker")<<"this mode of operation is not supported, either the measurement tracker is set to skip clusters, or is being told to skip clusters. not both";

  edm::Handle<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > > pixelClusterMask;
  event.getByLabel(cluster,pixelClusterMask);


  thePixelsToSkip.resize(pixelClusterMask->size());
  pixelClusterMask->copyMaskTo(thePixelsToSkip);
    
  edm::Handle<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > > stripClusterMask;
  event.getByLabel(cluster,stripClusterMask);

  theStDets.theStripsToSkip.resize(stripClusterMask->size());
  stripClusterMask->copyMaskTo(theStDets.theStripsToSkip);
  
}
const std::vector<TkStripMeasurementDet>& MeasurementTrackerImpl::stripDets ( ) const [inline]

Definition at line 101 of file MeasurementTrackerImpl.h.

References theStripDets.

{return theStripDets;}
void MeasurementTrackerImpl::unsetClusterToSkip ( ) const [virtual]

Implements MeasurementTracker.

Definition at line 284 of file MeasurementTrackerImpl.cc.

References LogDebug, selfUpdateSkipClusters_, thePixelsToSkip, theStDets, and StMeasurementDetSet::theStripsToSkip.

                                                      {
  //method called by user of the measurement tracker to tell what needs to be skiped from the event.
  //there it is incompatible with a configuration in which the measurement tracker already knows what to skip
  // i.e selfUpdateSkipClusters_=True
  
  LogDebug("MeasurementTracker")<<"unsetClusterToSkip";
  if (selfUpdateSkipClusters_)
    edm::LogError("MeasurementTracker")<<"this mode of operation is not supported, either the measurement tracker is set to skip clusters, or is being told to skip clusters. not both";

  thePixelsToSkip.clear();
  theStDets.theStripsToSkip.clear();
}
void MeasurementTrackerImpl::update ( const edm::Event event) const [virtual]

Implements MeasurementTracker.

Reimplemented in OnDemandMeasurementTracker.

Definition at line 239 of file MeasurementTrackerImpl.cc.

References updatePixels(), and updateStrips().

{
  updatePixels(event);
  updateStrips(event);
  
  /*
  for (std::vector<TkStripMeasurementDet>::const_iterator i=theStripDets.begin();
       i!=theStripDets.end(); i++) {
    if( (*i).isEmpty()){
      std::cout << "stripDet id, #hits: " 
                <<  (*i).geomDet().geographicalId().rawId() << " , "
                << 0 << std::endl;
    }else{
      std::cout << "stripDet id, #hits: " 
                <<  (*i).geomDet().geographicalId().rawId() << " , "
                << (*i).size() << " " << (*i).detSet().size() std::endl;
    }
  }
  */
}
void MeasurementTrackerImpl::updatePixels ( const edm::Event event) const [virtual]

Implements MeasurementTracker.

Definition at line 297 of file MeasurementTrackerImpl.cc.

References edmNew::DetSetVector< T >::dataSize(), edmNew::DetSetVector< T >::empty(), edmNew::DetSetVector< T >::end(), edm::ParameterSet::existsAs(), edm::HandleBase::failedToGet(), lumiContext::fill, edmNew::DetSetVector< T >::find(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), i, edm::HandleBase::id(), errorMatrix2Lands_multiChannel::id, LogDebug, name_, clustersummaryproducer_cfg::pixelClusters, edm::Handle< T >::product(), pset_, selfUpdateSkipClusters_, python::multivaluedict::sort(), theInactivePixelDetectorLabels, thePixelDets, and thePixelsToSkip.

Referenced by update(), and OnDemandMeasurementTracker::update().

{
  // avoid to update twice from the same event
  if (!edm::Service<UpdaterService>()->checkOnce("MeasurementTrackerImpl::updatePixels::"+name_)) return;

  typedef edmNew::DetSet<SiPixelCluster> PixelDetSet;

  bool switchOffPixelsIfEmpty = (!pset_.existsAs<bool>("switchOffPixelsIfEmpty")) ||
                                (pset_.getParameter<bool>("switchOffPixelsIfEmpty"));

  std::vector<uint32_t> rawInactiveDetIds; 
  if (!theInactivePixelDetectorLabels.empty()) {
    edm::Handle<DetIdCollection> detIds;
    for (std::vector<edm::InputTag>::const_iterator itt = theInactivePixelDetectorLabels.begin(), edt = theInactivePixelDetectorLabels.end(); 
            itt != edt; ++itt) {
      if (event.getByLabel(*itt, detIds)){
        rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
      }else{
        static bool iFailedAlready=false;
        if (!iFailedAlready){
          edm::LogError("MissingProduct")<<"I fail to get the list of inactive pixel modules, because of 4.2/4.4 event content change.";
          iFailedAlready=true;
        }
      }
    }
    if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
  }
  // Pixel Clusters
  std::string pixelClusterProducer = pset_.getParameter<std::string>("pixelClusterProducer");
  if( pixelClusterProducer.empty() ) { //clusters have not been produced
    for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
    i!=thePixelDets.end(); i++) {
      if (switchOffPixelsIfEmpty) {
        (**i).setActiveThisEvent(false);
      }else{
        (**i).setEmpty();
      }
    }
  }else{  

    edm::Handle<edmNew::DetSetVector<SiPixelCluster> > pixelClusters;
    event.getByLabel(pixelClusterProducer, pixelClusters);
    const  edmNew::DetSetVector<SiPixelCluster>* pixelCollection = pixelClusters.product();
   
    if (switchOffPixelsIfEmpty && pixelCollection->empty()) {
        for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
             i!=thePixelDets.end(); i++) {
              (**i).setActiveThisEvent(false);
        }
    } else { 

       //std::cout <<"updatePixels "<<pixelCollection->dataSize()<<std::endl;
       thePixelsToSkip.resize(pixelCollection->dataSize());
       std::fill(thePixelsToSkip.begin(),thePixelsToSkip.end(),false);
       
       if(selfUpdateSkipClusters_) {
          edm::Handle<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > > pixelClusterMask;
         //and get the collection of pixel ref to skip
         event.getByLabel(pset_.getParameter<edm::InputTag>("skipClusters"),pixelClusterMask);
         LogDebug("MeasurementTracker")<<"getting pxl refs to skip";
         if (pixelClusterMask.failedToGet())edm::LogError("MeasurementTracker")<<"not getting the pixel clusters to skip";
         if (pixelClusterMask->refProd().id()!=pixelClusters.id()){
           edm::LogError("ProductIdMismatch")<<"The pixel masking does not point to the proper collection of clusters: "<<pixelClusterMask->refProd().id()<<"!="<<pixelClusters.id();
         }
         pixelClusterMask->copyMaskTo(thePixelsToSkip);
       }
          
       for (std::vector<TkPixelMeasurementDet*>::const_iterator i=thePixelDets.begin();
       i!=thePixelDets.end(); i++) {

         // foreach det get cluster range
         unsigned int id = (**i).geomDet().geographicalId().rawId();
         if (!rawInactiveDetIds.empty() && std::binary_search(rawInactiveDetIds.begin(), rawInactiveDetIds.end(), id)) {
           (**i).setActiveThisEvent(false); continue;
         }
         //FIXME
         //fill the set with what needs to be skipped
         edmNew::DetSetVector<SiPixelCluster>::const_iterator it = pixelCollection->find( id );
         if ( it != pixelCollection->end() ){            
           // push cluster range in det
           (**i).update( *it, pixelClusters, id );
         } else{
           (**i).setEmpty();
         }
       }
    }
  }
}
void MeasurementTrackerImpl::updateStrips ( const edm::Event event) const [virtual]

Implements MeasurementTracker.

Reimplemented in OnDemandMeasurementTracker.

Definition at line 399 of file MeasurementTrackerImpl.cc.

References edm::RegionIndex< T >::begin(), concreteDetUpdatable(), edm::RegionIndex< T >::end(), edm::HandleBase::failedToGet(), StMeasurementDetSet::find(), getInactiveStrips(), edm::ParameterSet::getParameter(), StMeasurementDetSet::handle_, i, edm::HandleBase::id(), edmNew::DetSetVector< T >::id(), StMeasurementDetSet::id(), errorMatrix2Lands_multiChannel::id, StMeasurementDetSet::id_, getHLTprescales::index, StMeasurementDetSet::isActive(), StMeasurementDetSet::isRegional(), LogDebug, name_, edm::Handle< T >::product(), pset_, StMeasurementDetSet::regionalHandle_, selfUpdateSkipClusters_, StMeasurementDetSet::setActiveThisEvent(), StMeasurementDetSet::setEmpty(), theStDets, StMeasurementDetSet::theStripsToSkip, and StMeasurementDetSet::update().

Referenced by update().

{
  // avoid to update twice from the same event
  if (!edm::Service<UpdaterService>()->checkOnce("MeasurementTrackerImpl::updateStrips::"+name_)) return;

  typedef edmNew::DetSet<SiStripCluster>   StripDetSet;

  std::vector<uint32_t> rawInactiveDetIds;
  getInactiveStrips(event,rawInactiveDetIds);

  // Strip Clusters
  std::string stripClusterProducer = pset_.getParameter<std::string>("stripClusterProducer");
  //first clear all of them
  theStDets.setEmpty();


  if( !stripClusterProducer.compare("") )  return;  //clusters have not been produced

  const int endDet = theStDets.id_.size();
 

  // mark as inactive if in rawInactiveDetIds
  int i=0;
  unsigned int idp=0;
  for ( auto id : rawInactiveDetIds) {
    if (id==idp) continue; // skip multiple id
    idp=id;
    i=theStDets.find(id,i);
    assert(i!=endDet && id == theStDets.id(i));
    theStDets.setActiveThisEvent(i,false);
  }

  //=========  actually load cluster =============
  if(!theStDets.isRegional()){
    edm::Handle<edmNew::DetSetVector<SiStripCluster> > clusterHandle;
    event.getByLabel(stripClusterProducer, clusterHandle);
    const edmNew::DetSetVector<SiStripCluster>* clusterCollection = clusterHandle.product();
    
    
    if (selfUpdateSkipClusters_){
      edm::Handle<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > > stripClusterMask;
      //and get the collection of pixel ref to skip
      LogDebug("MeasurementTracker")<<"getting strp refs to skip";
      event.getByLabel(pset_.getParameter<edm::InputTag>("skipClusters"),stripClusterMask);
      if (stripClusterMask.failedToGet())  edm::LogError("MeasurementTracker")<<"not getting the strip clusters to skip";
      if (stripClusterMask->refProd().id()!=clusterHandle.id()){
        edm::LogError("ProductIdMismatch")<<"The strip masking does not point to the proper collection of clusters: "<<stripClusterMask->refProd().id()<<"!="<<clusterHandle.id();
      }
      stripClusterMask->copyMaskTo(theStDets.theStripsToSkip);
    }
    
    theStDets.handle_ = clusterHandle;
    int i=0;
    edmNew::DetSetVector<SiStripCluster>::const_iterator it = (*clusterCollection).begin();
    edmNew::DetSetVector<SiStripCluster>::const_iterator endColl = (*clusterCollection).end();
    // cluster and det and in order (both) and unique so let's use set intersection
    for (;it!=endColl; ++it) {
      StripDetSet detSet = *it;
      unsigned int id = detSet.id();
      while ( id != theStDets.id(i)) { // eventually change to lower_bound
        ++i;
        if (endDet==i) throw "we have a problem!!!!";
      }
      
      // push cluster range in det
      if ( theStDets.isActive(i) )
        theStDets.update(i,detSet);
    }

  }else{   // regional
    
    //then set the not-empty ones only
    edm::Handle<edm::RefGetter<SiStripCluster> > refClusterHandle;
    event.getByLabel(stripClusterProducer, refClusterHandle);
    
    std::string lazyGetter = pset_.getParameter<std::string>("stripLazyGetterProducer");
    edm::Handle<edm::LazyGetter<SiStripCluster> > lazyClusterHandle;
    event.getByLabel(lazyGetter,lazyClusterHandle);
    
    if(selfUpdateSkipClusters_){
      edm::Handle<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > > stripClusterMask;
      LogDebug("MeasurementTracker")<<"getting reg strp refs to skip";
      event.getByLabel(pset_.getParameter<edm::InputTag>("skipClusters"),stripClusterMask);
      if (stripClusterMask.failedToGet())edm::LogError("MeasurementTracker")<<"not getting the strip clusters to skip";
      if (stripClusterMask->refProd().id()!=lazyClusterHandle.id()){
        edm::LogError("ProductIdMismatch")<<"The strip masking does not point to the proper collection of clusters: "<<stripClusterMask->refProd().id()<<"!="<<lazyClusterHandle.id();
      }       
      stripClusterMask->copyMaskTo(theStDets.theStripsToSkip);
    }
    
    theStDets.regionalHandle_ =  lazyClusterHandle;
    
    uint32_t tmpId=0;
    vector<SiStripCluster>::const_iterator beginIterator;
    edm::RefGetter<SiStripCluster>::const_iterator iregion = refClusterHandle->begin();
    for(;iregion!=refClusterHandle->end();++iregion) {
      const edm::RegionIndex<SiStripCluster>& region = *iregion;
      vector<SiStripCluster>::const_iterator icluster = region.begin();
      const vector<SiStripCluster>::const_iterator endIterator = region.end();
      tmpId = icluster->geographicalId();
      beginIterator = icluster;
      
      //std::cout << "== tmpId ad inizio loop dentro region: " << tmpId << std::endl;
      
      for (;icluster!=endIterator;icluster++) {
        //std::cout << "===== cluster id,pos " 
        //  << icluster->geographicalId() << " , " << icluster->barycenter()
        //  << std::endl;
        //std::cout << "=====making ref in recHits() " << std::endl;
        if( icluster->geographicalId() != tmpId){ 
          //std::cout << "geo!=tmpId" << std::endl;
          
          //cannot we avoid to update the det with detId of itself??  (sure we can!, done!)
          theStDets.update(concreteDetUpdatable(tmpId)->index(),beginIterator,icluster);
          
          tmpId = icluster->geographicalId();
          beginIterator = icluster;
          if( icluster == (endIterator-1)){
            theStDets.update(concreteDetUpdatable(tmpId)->index(),icluster,endIterator);
          }   
        }else if( icluster == (endIterator-1)){    
          theStDets.update(concreteDetUpdatable(tmpId)->index(),beginIterator,endIterator);      
        }
      }//end loop cluster in one ragion
    }
  }//end of block for updating with regional clusters 
}

Member Data Documentation

const std::string MeasurementTrackerImpl::name_ [protected]

Definition at line 120 of file MeasurementTrackerImpl.h.

Referenced by addGluedDet(), gluedDets(), and initialize().

Definition at line 127 of file MeasurementTrackerImpl.h.

Referenced by updatePixels().

Definition at line 125 of file MeasurementTrackerImpl.h.

Definition at line 124 of file MeasurementTrackerImpl.h.

Referenced by addPixelDets().

std::vector<TkPixelMeasurementDet*> MeasurementTrackerImpl::thePixelDets [mutable, protected]
std::vector<bool> MeasurementTrackerImpl::thePixelsToSkip [mutable, protected]

Definition at line 119 of file MeasurementTrackerImpl.h.

Referenced by addStripDet(), initialize(), and stripDets().