CMS 3D CMS Logo

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

OnDemandMeasurementTracker Class Reference

#include <OnDemandMeasurementTracker.h>

Inheritance diagram for OnDemandMeasurementTracker:
MeasurementTracker MeasurementDetSystem

List of all members.

Classes

class  DetODStatus
 a class that holds flags, region_range (in RefGetter) for a given MeasurementDet More...

Public Types

typedef edm::LazyGetter
< SiStripCluster
LazyGetter
typedef edm::RefGetter
< SiStripCluster
RefGetter

Public Member Functions

void define (const edm::Handle< edm::LazyGetter< SiStripCluster > > &, std::auto_ptr< RefGetter > &) const
 OnDemandMeasurementTracker specific function to be called to define the region in the RefGetter according to MeasurementDet content.
virtual const MeasurementDetidToDet (const DetId &id) const
 MeasurementDetSystem interface.
 OnDemandMeasurementTracker (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, const SiStripRegionCabling *stripRegionCabling, bool isRegional=false)
 constructor
void update (const edm::Event &) const
 MeasurementTracker overloaded function.
void updateStrips (const edm::Event &event) const
virtual ~OnDemandMeasurementTracker ()
 destructor

Private Types

typedef std::map< DetId,
DetODStatus
DetODContainer

Private Member Functions

void assign (const TkStripMeasurementDet *csmdet, DetODContainer::iterator *alreadyFound=0) const
 assigne the cluster iterator to the TkStipMeasurementDet (const_cast in the way)
std::string dumpCluster (const std::vector< SiStripCluster >::const_iterator &begin, const std::vector< SiStripCluster >::const_iterator &end) const
 some printouts, exclusively under LogDebug
std::string dumpRegion (std::pair< unsigned int, unsigned int > indexes, const RefGetter &theGetter, bool stayUnpacked=false) const

Private Attributes

std::string category_
 log category
bool PixelOnDemand_
 internal flag to do pixel on demand (not configurable) false by default
std::map
< SiStripRegionCabling::ElementIndex,
std::vector
< DetODContainer::iterator > > 
region_mapping
 mapping of elementIndex -> iterator to the DetODMap: to know what are the regions that needs to be defined in the ref getter
bool StayPacked_
 internal flag to avoid unpacking things with LogDebug on
bool StripOnDemand_
 internal flag to do strip on demand (not configurable) true by default
DetODContainer theDetODMap
 mapping of detid -> MeasurementDet+flags+region_range
edm::Handle< edm::LazyGetter
< SiStripCluster > > 
theLazyGetterH
edm::Handle< edm::RefGetter
< SiStripCluster > > 
theRefGetterH
 the handle is retrieved from the event to make reference to cluster in it
const SiStripRegionCablingtheStripRegionCabling
 the cabling region tool to update a RefGetter

Detailed Description

Definition at line 10 of file OnDemandMeasurementTracker.h.


Member Typedef Documentation

Definition at line 73 of file OnDemandMeasurementTracker.h.

Definition at line 35 of file OnDemandMeasurementTracker.h.

Definition at line 36 of file OnDemandMeasurementTracker.h.


Constructor & Destructor Documentation

OnDemandMeasurementTracker::OnDemandMeasurementTracker ( 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,
const SiStripRegionCabling stripRegionCabling,
bool  isRegional = false 
)

constructor

Definition at line 53 of file OnDemandMeasurementTracker.cc.

References category_, SiStripRegionCabling::elementIndex(), eta(), PV3DBase< T, PVType, FrameType >::eta(), first, SiStripRegionCabling::layerFromDetId(), LogDebug, PV3DBase< T, PVType, FrameType >::phi(), phi, GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, SiStripRegionCabling::position(), SiStripRegionCabling::positionIndex(), SiStripRegionCabling::region(), region_mapping, edm::second(), SiStripRegionCabling::subdetFromDetId(), GeomDetEnumerators::TEC, MeasurementTracker::theDetMap, theDetODMap, theStripRegionCabling, GeomDetEnumerators::TIB, GeomDetEnumerators::TID, and GeomDetEnumerators::TOB.

                                                                       :
  MeasurementTracker(conf,pixelCPE,stripCPE,hitMatcher,trackerGeom,geometricSearchTracker,
        stripQuality,stripQualityFlags,stripQualityDebugFlags,
        pixelQuality,pixelCabling,pixelQualityFlags,pixelQualityDebugFlags,
        isRegional)
  , category_("OnDemandMeasurementTracker")
  , StayPacked_(true)
  , StripOnDemand_(true)
  , PixelOnDemand_(false)
  , theStripRegionCabling(stripRegionCabling)
{
  //  the constructor does construct the regular MeasurementTracker
  //  then a smart copy of the DetMap is made into DetODMap: this could be avoided with modification to MeasurementDet interface
  //  the elementIndex to be defined in the refgetter is mapped to the detId
  //  flags are set to initialize the DetODMap

  for (DetContainer::iterator it=theDetMap.begin(); it!= theDetMap.end();++it)
    {
      DetODContainer::iterator inserted = theDetODMap.insert(make_pair(it->first,DetODStatus(const_cast<MeasurementDet*>(it->second)))).first;


      GeomDet::SubDetector subdet = it->second->geomDet().subDetector();
      if (subdet == GeomDetEnumerators::PixelBarrel  || subdet == GeomDetEnumerators::PixelEndcap ){
        //special flag treatement for pixels
        //one can never be updated and not defined. except if we don't need to care about them: pixels
        inserted->second.defined=false;
        inserted->second.updated=true;
      }//pixel module
      else if (subdet == GeomDetEnumerators::TIB || subdet == GeomDetEnumerators::TOB ||
          subdet == GeomDetEnumerators::TID || subdet == GeomDetEnumerators::TEC )
        {
          //set flag to false
          inserted->second.defined=false;
          inserted->second.updated=false;

          //what will be the element index in the refgetter
          GlobalPoint center = it->second->geomDet().position();
          double eta = center.eta();
          double phi = center.phi();
          uint32_t id = it->first.rawId();
          SiStripRegionCabling::ElementIndex eIndex = theStripRegionCabling->elementIndex(SiStripRegionCabling::Position(eta,phi),
                                                                                          SiStripRegionCabling::subdetFromDetId(id),
                                                                                          SiStripRegionCabling::layerFromDetId(id));
          LogDebug(category_)<<"region selected (from "<<id<<" center) is:\n"
                             <<"position: "<<center
                             <<"\n center absolute index: "<<theStripRegionCabling->region(theStripRegionCabling->positionIndex(SiStripRegionCabling::Position(eta,phi)))
                             <<"\n center position index: "<<theStripRegionCabling->positionIndex(SiStripRegionCabling::Position(eta,phi)).first<<
            " "<<theStripRegionCabling->positionIndex(SiStripRegionCabling::Position(eta,phi)).second
                             <<"\n center postion: "<<theStripRegionCabling->position(theStripRegionCabling->positionIndex(SiStripRegionCabling::Position(eta,phi))).first<<
            " "<<theStripRegionCabling->position(theStripRegionCabling->positionIndex(SiStripRegionCabling::Position(eta,phi))).second
                             <<"\n eta: "<<eta
                             <<"\n phi: "<<phi
                             <<"\n subedet: "<<SiStripRegionCabling::subdetFromDetId(id)
                             <<" layer: "<<SiStripRegionCabling::layerFromDetId(id);

          //      register those in a map
          //to be able to know what are the detid in a given elementIndex
          region_mapping[eIndex].push_back(inserted);
        }//strip module
      else{
        //abort
        edm::LogError(category_)<<"not a tracker geomdet in constructor: "<<it->first.rawId();
        throw MeasurementDetException("OnDemandMeasurementTracker dealing with a non tracker GeomDet.");
      }//abort
    }//loop over DetMap
}
virtual OnDemandMeasurementTracker::~OnDemandMeasurementTracker ( ) [inline, virtual]

destructor

Definition at line 29 of file OnDemandMeasurementTracker.h.

{}

Member Function Documentation

void OnDemandMeasurementTracker::assign ( const TkStripMeasurementDet csmdet,
DetODContainer::iterator *  alreadyFound = 0 
) const [private]

assigne the cluster iterator to the TkStipMeasurementDet (const_cast in the way)

Definition at line 261 of file OnDemandMeasurementTracker.cc.

References category_, dumpCluster(), dumpRegion(), GeomDet::geographicalId(), MeasurementDet::geomDet(), LogDebug, TkStripMeasurementDet::setEmpty(), theDetODMap, theLazyGetterH, theRefGetterH, and TkStripMeasurementDet::update().

Referenced by idToDet().

                                                                              {
  //  assign is using the handle to the refgetter and the region index range to update the MeasurementDet with their clusters
  
  TkStripMeasurementDet * smdet = const_cast<TkStripMeasurementDet *>(csmdet);
  DetId id = smdet->geomDet().geographicalId();
  
  LogDebug(category_)<<"assigning: "<<id.rawId();

  // what is the iterator. do not look again if already found and provided with
  DetODContainer::iterator elementInMap;
  if (alreadyFound){ elementInMap=*alreadyFound;}
  else{ elementInMap = theDetODMap.find(id);}
  
  if  ( elementInMap != theDetODMap.end()){
    //flag it as updated
    elementInMap->second.updated = true;
    //retrieve the region range index for this module
    std::pair<unsigned int,unsigned int> & indexes =elementInMap->second.region_range;

    //this printout will trigger unpacking. no problem. it is done on the next regular line (find(id.rawId())
    LogDebug(category_)<<"between index: "<<indexes.first<<" and: "<<indexes.second
                       <<"\nretrieved for module: "<<id.rawId()
                       <<"\n"<<dumpRegion(indexes,*theRefGetterH);
    
    //look for iterator range in the regions defined for that module
    for (unsigned int iRegion = indexes.first; iRegion != indexes.second; ++iRegion){
      RefGetter::record_pair range = (*theRefGetterH)[iRegion].find(id.rawId());
      if (range.first!=range.second){
        //      found something not empty
        //update the measurementDet
        smdet->update(range.first, range.second, theLazyGetterH, id);
        LogDebug(category_)<<"Valid clusters for: "<<id.rawId()
                           <<"\nnumber of regions defined here: "<< indexes.second-indexes.first
                           <<"\n"<<dumpCluster(range.first,range.second);
        //and you are done
        return;}
    }//loop over regions, between indexes

    //if reached. no cluster are found. set the TkStripMeasurementDet to be empty
    smdet->setEmpty();

  }//found in the map
  else{
    //throw excpetion
    edm::LogError(category_)<<"failed to find the MeasurementDet for: "<<id.rawId();
    throw MeasurementDetException("failed to find the MeasurementDet for: <see message logger>");
  }
}
void OnDemandMeasurementTracker::define ( const edm::Handle< edm::LazyGetter< SiStripCluster > > &  ,
std::auto_ptr< RefGetter > &   
) const

OnDemandMeasurementTracker specific function to be called to define the region in the RefGetter according to MeasurementDet content.

Definition at line 135 of file OnDemandMeasurementTracker.cc.

References category_, dumpRegion(), LogDebug, Association::map, region_mapping, StayPacked_, theDetODMap, theLazyGetterH, theStripRegionCabling, and SiStripRegionCabling::updateSiStripRefGetter().

Referenced by MeasurementTrackerSiStripRefGetterProducer::produce().

{
  //  define is supposed to be call by an EDProducer module, which wil put the RefGetter in the event
  //  so that reference can be made to it.
  //  the lazy getter is retrieved by the calling module and passed along with the event
  //  the map is cleared, except for pixel
  //  then the known elementIndex are defined to the RefGetter. no unpacking is done at this time
  //  the defined region range is registered in the DetODMap for further use.

  //clear all defined tags to start from scratch (except for pixel)
  for (DetODContainer::iterator it=theDetODMap.begin(); it!= theDetODMap.end();++it)
    {
      if (it->second.updated && !it->second.defined) continue; //special treatement for pixels
      it->second.defined= false; 
      it->second.updated = false;
    }

  //define all the elementindex in the refgetter
  for( std::map<SiStripRegionCabling::ElementIndex, std::vector<DetODContainer::iterator> >::iterator eIt= region_mapping.begin();
       eIt!=region_mapping.end();++eIt){
    std::pair<unsigned int, unsigned int> region_range; 
    
    //before update of the refgetter
    region_range.first = theGetter->size();
    //update the refegetter with the elementindex
    theStripRegionCabling->updateSiStripRefGetter<SiStripCluster> (*theGetter, theLazyGetterH, eIt->first);
    //after update of the refgetter
    region_range.second = theGetter->size();

    LogDebug(category_)<<"between index: "<<region_range.first<<" "<<region_range.second
                       <<"\n"<<dumpRegion(region_range,*theGetter,StayPacked_);
    
    //now assign to each measurement det for that element index
    for (std::vector<DetODContainer::iterator>::iterator dIt=eIt->second.begin();
         dIt!=eIt->second.end();++dIt){
      (*dIt)->second.region_range = region_range;
      (*dIt)->second.defined=true;
      LogDebug(category_)<<"detId: "<<(*dIt)->first.rawId()<<" in region range: "<<region_range.first<<" "<<region_range.second;
    }//loop over MeasurementDet attached to that elementIndex
  }//loop over know elementindex
}
std::string OnDemandMeasurementTracker::dumpCluster ( const std::vector< SiStripCluster >::const_iterator &  begin,
const std::vector< SiStripCluster >::const_iterator &  end 
) const [private]

some printouts, exclusively under LogDebug

Definition at line 223 of file OnDemandMeasurementTracker.cc.

References begin, end, and i.

Referenced by assign(), and dumpRegion().

{
  //  dumpCluster is a printout of all the clusters between the iterator. returns a string
  std::string tab="      ";
  std::stringstream ss;
  std::vector<SiStripCluster> ::const_iterator it = begin;
  unsigned int i=0;
  for (;it!=end;++it){
    ss<<tab<<i++<<") center: "<<it->barycenter()<<",id: "<<it->geographicalId()<<" with: "<<it->amplitudes().size()<<" strips\n"<<tab<<tab<<"{";
    for (unsigned int is=0;is!=it->amplitudes().size();++is){
      ss<<it->amplitudes()[is]<<" ";
    }ss<<"}\n";
  }
  return ss.str();
}
std::string OnDemandMeasurementTracker::dumpRegion ( std::pair< unsigned int, unsigned int >  indexes,
const RefGetter theGetter,
bool  stayUnpacked = false 
) const [private]

Definition at line 239 of file OnDemandMeasurementTracker.cc.

References begin, dumpCluster(), end, pos, SiStripRegionCabling::position(), SiStripRegionCabling::positionIndex(), SiStripRegionCabling::region(), and theStripRegionCabling.

Referenced by assign(), and define().

{
  //  dumpRegion is a printout of all the clusters in a region defined on the RefGetter. returns a string
  std::stringstream ss;
  ss<<"cluster between: "<<indexes.first<<" and: "<<indexes.second<<"\n";
  for (unsigned int iRegion = indexes.first; iRegion != indexes.second; ++iRegion){    
    uint32_t reg = SiStripRegionCabling::region((theGetter)[iRegion].region());
    SiStripRegionCabling::Position pos = theStripRegionCabling->position(reg);
    SiStripRegionCabling::PositionIndex posI = theStripRegionCabling->positionIndex(reg);
    
    ss<<"Clusters for region:["<<iRegion<<"]"
      <<"\n element index: "<<(theGetter)[iRegion].region()
      <<"\n region absolute index: "<<reg
      <<"\n region position index: "<<posI.first<<" "<<posI.second
      <<"\n region position: "<<pos.first<<" "<<pos.second
      <<"\n"<< (stayPacked? " hidden to avoid unpacking." : dumpCluster((theGetter)[iRegion].begin(),(theGetter)[iRegion].end()));
  }
  return ss.str();
}
const MeasurementDet * OnDemandMeasurementTracker::idToDet ( const DetId id) const [virtual]

MeasurementDetSystem interface.

Reimplemented from MeasurementTracker.

Definition at line 314 of file OnDemandMeasurementTracker.cc.

References assign(), category_, LogDebug, TkGluedMeasurementDet::monoDet(), TkGluedMeasurementDet::stereoDet(), StripOnDemand_, and theDetODMap.

{
  //  overloaded from MeasurementTracker
  //  find the detid. if not found throw exception
  //  if already updated: always for pixel or strip already queried. return it
  DetODContainer::iterator it = theDetODMap.find(id);
  if ( it != theDetODMap.end()) {
    
    //it has already been queried. and so already updated: nothing to be done here (valid for pixels too)
    if (it->second.updated){LogDebug(category_)<<"found id: "<<id.rawId()<<" as aleardy updated."; return it->second.mdet;}
    
    if (StripOnDemand_){
      //check glued or single
      std::vector< const GeomDet*> comp = it->second.mdet->geomDet().components();
      if (!comp.empty()){
        //glued det
        LogDebug(category_)<<"updating glued id: "<<id.rawId()<<" ("<<comp.size()<<").";
        //cast to specific type
        TkGluedMeasurementDet*  theConcreteDet = dynamic_cast<TkGluedMeasurementDet*>(it->second.mdet);
        //FIXME. do not require the dynamic cast, since we know what we do here
        //              const TkGluedMeasurementDet*  theConcreteDet = (const TkGluedMeasurementDet*) it->second.mdet;
        if (!theConcreteDet){
          edm::LogError(category_)<<"failed to cast to glued measurement det:"<<it->first.rawId();
          throw MeasurementDetException("failed to cast. see log file.");}
                
        //      update the two components
        //update the mono
        assign(theConcreteDet->monoDet());
        //update the stereo
        assign(theConcreteDet->stereoDet());
              
        //flag the glued det as updated (components are flagged in assign)
        it->second.updated=true;
      }//glued det
      else{
        //single layer 
        LogDebug(category_)<<"updating singel id: "<<id.rawId();
        //cast to specific type
        TkStripMeasurementDet*  theConcreteDet = dynamic_cast<TkStripMeasurementDet*>(it->second.mdet);
        //FIXME. do not require the dynamic cast, since we know what we do here
        //              const TkStripMeasurementDet*  theConcreteDet = (const TkStripMeasurementDet*)it->second.mdet;
        if (!theConcreteDet){
          edm::LogError(category_)<<"failed to cast to strip measurement det:"<<it->first.rawId();
          throw MeasurementDetException("failed to cast. see log file.");}

        //update the single layer
        assign(theConcreteDet,&it);
      }//single det
    }
    //eventually return it
    return it->second.mdet;
  }//found in the DetODMap
  else{
    //throw excpetion
    edm::LogError(category_)<<"failed to find the MeasurementDet for: "<<id.rawId();
    throw MeasurementDetException("failed to find the MeasurementDet for: <see message logger>");
  }
  return 0;
}
void OnDemandMeasurementTracker::update ( const edm::Event event) const [virtual]

MeasurementTracker overloaded function.

Reimplemented from MeasurementTracker.

Definition at line 198 of file OnDemandMeasurementTracker.cc.

References category_, LogDebug, PixelOnDemand_, StripOnDemand_, MeasurementTracker::updatePixels(), and updateStrips().

{
  //  update is supposed to be called by any module that is useing the MeasurementTracker
  //  after checking the the event has not yet been seen
  //  update the pixel using MeasurementTracekr specific function
  //  retreive the RefGetter from the event: the very one that has been pass to define(...) and put into the event

  if (!PixelOnDemand_) {
    LogDebug(category_)<<"pixel are not OnDemand. updating them a la MeasurmentTracker.";
    MeasurementTracker::updatePixels(event);}
  else{
    edm::LogError(category_)<<"trying to update siPixel as on-demand. Not Implemented yet.";
  }

  if (!StripOnDemand_) {
    LogDebug(category_)<<"strip are not OnDemand. updating them a la MeasurmentTracker.";
    MeasurementTracker::updateStrips(event);}
  else{
    LogDebug(category_)<<"strip are OnDemand. updating them a la OnDemandMeasurmentTracker."; 
    updateStrips(event);
  }
}
void OnDemandMeasurementTracker::updateStrips ( const edm::Event event) const

Reimplemented from MeasurementTracker.

Definition at line 310 of file MeasurementTracker.cc.

References edm::RegionIndex< T >::begin(), edm::RegionIndex< T >::end(), end, i, edmNew::DetSetVector< T >::id(), ExpressReco_HICollisions_FallBack::id, edm::Handle< T >::product(), python::multivaluedict::sort(), ExpressReco_HICollisions_FallBack::stripClusterProducer, and TkStripMeasurementDet::update().

Referenced by update().

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

  typedef edmNew::DetSet<SiStripCluster>   StripDetSet;

  std::vector<uint32_t> rawInactiveDetIds;
  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());
  }

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

  {
    std::vector<TkStripMeasurementDet*>::const_iterator end = theStripDets.end()-200;
    for (std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
         i!=end; i++) {
      (**i).setEmpty();
#ifdef __SSE2__
      _mm_prefetch(((char *)(*(i+200))),_MM_HINT_T0); 
#endif
    }
   for (std::vector<TkStripMeasurementDet*>::const_iterator i=end;
         i!=theStripDets.end(); i++)
      (**i).setEmpty();
  }
  if( !stripClusterProducer.compare("") ) { //clusters have not been produced
  }else{
    //=========  actually load cluster =============
    if(!isRegional_){
      edm::Handle<edmNew::DetSetVector<SiStripCluster> > clusterHandle;
      event.getByLabel(stripClusterProducer, clusterHandle);
      const edmNew::DetSetVector<SiStripCluster>* clusterCollection = clusterHandle.product();

      std::vector<TkStripMeasurementDet*>::const_iterator i=theStripDets.begin();
      std::vector<TkStripMeasurementDet*>::const_iterator endDet=theStripDets.end();
      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 != (**i).rawId()) { // eventually change to lower_range
          ++i;
          if (i==endDet) throw "we have a problem!!!!";
        }

        if (!rawInactiveDetIds.empty() && std::binary_search(rawInactiveDetIds.begin(), rawInactiveDetIds.end(), id)) {
            (**i).setActiveThisEvent(false); continue;
        }
          // push cluster range in det
        (**i).update( detSet, clusterHandle, id );
          
      }
    }else{
              
      //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);

      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;
            //we should find a way to avoid this casting. it is slow
            //create also another map for TkStripMeasurementDet ??

            // the following castings are really ugly. To be corrected ASAP
            const TkStripMeasurementDet* theConcreteDet = 
              dynamic_cast<const TkStripMeasurementDet*>(idToDet(DetId(tmpId)));
            
            if(theConcreteDet == 0)
              throw MeasurementDetException("failed casting to TkStripMeasurementDet*");            
            TkStripMeasurementDet*  theConcreteDetUpdatable = 
              const_cast<TkStripMeasurementDet*>(theConcreteDet);
            theConcreteDetUpdatable->update(beginIterator,icluster,lazyClusterHandle,tmpId);
            //cannot we avoid to update the det with detId of itself??

            tmpId = icluster->geographicalId();
            beginIterator = icluster;
            if( icluster == (endIterator-1)){
              const TkStripMeasurementDet* theConcreteDet = 
              dynamic_cast<const TkStripMeasurementDet*>(idToDet(DetId(tmpId)));
              
              if(theConcreteDet == 0)
              throw MeasurementDetException("failed casting to TkStripMeasurementDet*");            
              TkStripMeasurementDet*  theConcreteDetUpdatable = 
              const_cast<TkStripMeasurementDet*>(theConcreteDet);
              theConcreteDetUpdatable->update(icluster,endIterator,lazyClusterHandle,tmpId);
            }    
          }else if( icluster == (endIterator-1)){          
            const TkStripMeasurementDet* theConcreteDet = 
              dynamic_cast<const TkStripMeasurementDet*>(idToDet(DetId(tmpId)));
            
            if(theConcreteDet == 0)
              throw MeasurementDetException("failed casting to TkStripMeasurementDet*");            
            TkStripMeasurementDet*  theConcreteDetUpdatable = 
              const_cast<TkStripMeasurementDet*>(theConcreteDet);
            //std::cout << "=== option3. fill det with id,#clust: " << tmpId  << " , " 
            //      << iregion->end() - beginIterator << std::endl;
            theConcreteDetUpdatable->update(beginIterator,endIterator,lazyClusterHandle,tmpId);  
          }       
        }//end loop cluster in one ragion
      }
    }//end of block for updating with regional clusters 
  }

}

Member Data Documentation

log category

Definition at line 47 of file OnDemandMeasurementTracker.h.

Referenced by assign(), define(), idToDet(), OnDemandMeasurementTracker(), and update().

internal flag to do pixel on demand (not configurable) false by default

Definition at line 54 of file OnDemandMeasurementTracker.h.

Referenced by update().

std::map<SiStripRegionCabling::ElementIndex, std::vector< DetODContainer::iterator> > OnDemandMeasurementTracker::region_mapping [mutable, private]

mapping of elementIndex -> iterator to the DetODMap: to know what are the regions that needs to be defined in the ref getter

Definition at line 78 of file OnDemandMeasurementTracker.h.

Referenced by define(), and OnDemandMeasurementTracker().

internal flag to avoid unpacking things with LogDebug on

Definition at line 49 of file OnDemandMeasurementTracker.h.

Referenced by define().

internal flag to do strip on demand (not configurable) true by default

Definition at line 52 of file OnDemandMeasurementTracker.h.

Referenced by idToDet(), and update().

mapping of detid -> MeasurementDet+flags+region_range

Definition at line 75 of file OnDemandMeasurementTracker.h.

Referenced by assign(), define(), idToDet(), and OnDemandMeasurementTracker().

Definition at line 61 of file OnDemandMeasurementTracker.h.

Referenced by assign(), and define().

the handle is retrieved from the event to make reference to cluster in it

Definition at line 60 of file OnDemandMeasurementTracker.h.

Referenced by assign().

the cabling region tool to update a RefGetter

Definition at line 57 of file OnDemandMeasurementTracker.h.

Referenced by define(), dumpRegion(), and OnDemandMeasurementTracker().