CMS 3D CMS Logo

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

TSiStripMatchedRecHit Class Reference

#include <TSiStripMatchedRecHit.h>

Inheritance diagram for TSiStripMatchedRecHit:
GenericTransientTrackingRecHit TransientTrackingRecHit TrackingRecHit ReferenceCountedPoolAllocated BlockWipedPoolAllocated

List of all members.

Classes

struct  DontCloneRecHit
 Dummy struct to pass to the constructor to say 'please don't clone the hit'. More...

Public Member Functions

virtual bool canImproveWithTrack () const
void clearPersistentHit ()
virtual RecHitPointer clone (const TrajectoryStateOnSurface &ts) const
void clonePersistentHit ()
 take ownership of the hit, if it wasn't owned (note: if it was owned, this code will leak it)
const GeomDetUnitdetUnit () const
virtual void getKfComponents (KfComponentsHolder &holder) const
virtual AlgebraicSymMatrix parametersError () const
virtual ConstRecHitContainer transientHits () const
 Composite interface: returns the component hits, if any.

Static Public Member Functions

static RecHitPointer build (const GeomDet *geom, const TrackingRecHit *rh, const SiStripRecHitMatcher *matcher, const StripClusterParameterEstimator *cpe=0, bool computeCoarseLocalPosition=false)
static RecHitPointer build (const GeomDet *geom, std::auto_ptr< TrackingRecHit > rh, const SiStripRecHitMatcher *matcher, const StripClusterParameterEstimator *cpe=0, bool computeCoarseLocalPosition=false)
static void buildInPlace (std::auto_ptr< TSiStripMatchedRecHit > &memory, const GeomDet *geom, const TrackingRecHit *rh, const SiStripRecHitMatcher *matcher, const StripClusterParameterEstimator *cpe=0, bool computeCoarseLocalPosition=false)

Private Member Functions

virtual TSiStripMatchedRecHitclone () const
void ComputeCoarseLocalPosition ()
 TSiStripMatchedRecHit (const GeomDet *geom, std::auto_ptr< TrackingRecHit > rh, const SiStripRecHitMatcher *matcher, const StripClusterParameterEstimator *cpe, bool computeCoarseLocalPosition)
 TSiStripMatchedRecHit (const GeomDet *geom, const TrackingRecHit *rh, const SiStripRecHitMatcher *matcher, const StripClusterParameterEstimator *cpe, bool computeCoarseLocalPosition, const DontCloneRecHit &)
 TSiStripMatchedRecHit (const GeomDet *geom, const TrackingRecHit *rh, const SiStripRecHitMatcher *matcher, const StripClusterParameterEstimator *cpe, bool computeCoarseLocalPosition)

Private Attributes

const
StripClusterParameterEstimator
theCPE
const SiStripRecHitMatchertheMatcher

Detailed Description

Definition at line 13 of file TSiStripMatchedRecHit.h.


Constructor & Destructor Documentation

TSiStripMatchedRecHit::TSiStripMatchedRecHit ( const GeomDet geom,
const TrackingRecHit rh,
const SiStripRecHitMatcher matcher,
const StripClusterParameterEstimator cpe,
bool  computeCoarseLocalPosition 
) [inline, private]

Definition at line 75 of file TSiStripMatchedRecHit.h.

References ComputeCoarseLocalPosition().

Referenced by build(), buildInPlace(), and clone().

                                                           : 
    GenericTransientTrackingRecHit(geom, *rh), theMatcher(matcher),theCPE(cpe) {
    if (computeCoarseLocalPosition) ComputeCoarseLocalPosition();
  }
TSiStripMatchedRecHit::TSiStripMatchedRecHit ( const GeomDet geom,
std::auto_ptr< TrackingRecHit rh,
const SiStripRecHitMatcher matcher,
const StripClusterParameterEstimator cpe,
bool  computeCoarseLocalPosition 
) [inline, private]

Definition at line 83 of file TSiStripMatchedRecHit.h.

References ComputeCoarseLocalPosition().

                                                          : 
    GenericTransientTrackingRecHit(geom, rh.release()), theMatcher(matcher),theCPE(cpe) {
    if (computeCoarseLocalPosition) ComputeCoarseLocalPosition();
  }
TSiStripMatchedRecHit::TSiStripMatchedRecHit ( const GeomDet geom,
const TrackingRecHit rh,
const SiStripRecHitMatcher matcher,
const StripClusterParameterEstimator cpe,
bool  computeCoarseLocalPosition,
const DontCloneRecHit  
) [inline, private]

Definition at line 90 of file TSiStripMatchedRecHit.h.

References ComputeCoarseLocalPosition().

                                                  : 
    GenericTransientTrackingRecHit(geom, const_cast<TrackingRecHit *>(rh)), theMatcher(matcher),theCPE(cpe) {
    if (computeCoarseLocalPosition) ComputeCoarseLocalPosition();
  }

Member Function Documentation

static RecHitPointer TSiStripMatchedRecHit::build ( const GeomDet geom,
const TrackingRecHit rh,
const SiStripRecHitMatcher matcher,
const StripClusterParameterEstimator cpe = 0,
bool  computeCoarseLocalPosition = false 
) [inline, static]

Definition at line 26 of file TSiStripMatchedRecHit.h.

References TSiStripMatchedRecHit().

Referenced by TkGluedMeasurementDet::HitCollectorForRecHits::add(), and TkTransientTrackingRecHitBuilder::oldbuild().

                                                                      {
    return RecHitPointer( new TSiStripMatchedRecHit( geom, rh, matcher,cpe, computeCoarseLocalPosition));
  }
static RecHitPointer TSiStripMatchedRecHit::build ( const GeomDet geom,
std::auto_ptr< TrackingRecHit rh,
const SiStripRecHitMatcher matcher,
const StripClusterParameterEstimator cpe = 0,
bool  computeCoarseLocalPosition = false 
) [inline, static]

Definition at line 33 of file TSiStripMatchedRecHit.h.

References TSiStripMatchedRecHit().

                                                                     {
    return RecHitPointer( new TSiStripMatchedRecHit( geom, rh, matcher,cpe, computeCoarseLocalPosition));
  }
static void TSiStripMatchedRecHit::buildInPlace ( std::auto_ptr< TSiStripMatchedRecHit > &  memory,
const GeomDet geom,
const TrackingRecHit rh,
const SiStripRecHitMatcher matcher,
const StripClusterParameterEstimator cpe = 0,
bool  computeCoarseLocalPosition = false 
) [inline, static]

Build this hit on the heap, but possibly starting from already allocated memory. if 'memory' is not null, it will call the placed delete, and then the placed new to make a new hit if 'memory' is null, it will fill it with a new heap-allocated hit both at entry and exit of this method any rechit in 'memory' DOES NOT own it's persistent rechit

Definition at line 51 of file TSiStripMatchedRecHit.h.

References TSiStripMatchedRecHit().

Referenced by TkGluedMeasurementDet::HitCollectorForFastMeasurements::add().

                                                                     {
        if (memory.get()) {
            memory->~TSiStripMatchedRecHit(); // call destructor
            new (memory.get()) TSiStripMatchedRecHit( geom, rh, matcher,cpe, computeCoarseLocalPosition, DontCloneRecHit());
        } else {
            memory.reset(new TSiStripMatchedRecHit( geom, rh, matcher,cpe,computeCoarseLocalPosition, DontCloneRecHit()));
        }
  }
virtual bool TSiStripMatchedRecHit::canImproveWithTrack ( ) const [inline, virtual]

Returns true if the clone( const TrajectoryStateOnSurface&) method returns an improved hit, false if it returns an identical copy. In order to avoid redundent copies one should call canImproveWithTrack() before calling clone( const TrajectoryStateOnSurface&).

Reimplemented from GenericTransientTrackingRecHit.

Definition at line 41 of file TSiStripMatchedRecHit.h.

References theMatcher.

{return (theMatcher != 0);}
void TSiStripMatchedRecHit::clearPersistentHit ( ) [inline]

drop the pointer to the hit, so that it's not deleted by the destructor. you must call this before deleting the TSiStripMatchedRecHit IF AND ONLY IF it doesn't own the rechit

Definition at line 68 of file TSiStripMatchedRecHit.h.

References GenericTransientTrackingRecHit::trackingRecHit_.

{ trackingRecHit_ = 0; }
virtual TSiStripMatchedRecHit* TSiStripMatchedRecHit::clone ( void  ) const [inline, private, virtual]

Reimplemented from GenericTransientTrackingRecHit.

Definition at line 102 of file TSiStripMatchedRecHit.h.

References TSiStripMatchedRecHit().

Referenced by clone().

                                               {
    return new TSiStripMatchedRecHit(*this);
  }
TSiStripMatchedRecHit::RecHitPointer TSiStripMatchedRecHit::clone ( const TrajectoryStateOnSurface ts) const [virtual]

Returns a copy of the hit with parameters and errors computed with respect to the TrajectoryStateOnSurface given as argument. For concrete hits not capable to improve their parameters and errors this method returns an exact copy, and is equivalent to clone() without arguments.

Reimplemented from TransientTrackingRecHit.

Definition at line 36 of file TSiStripMatchedRecHit.cc.

References clone(), TransientTrackingRecHit::det(), GeomDet::geographicalId(), gluedToStereo(), GenericTransientTrackingRecHit::hit(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localDirection(), ClusterParameterEstimator< T >::localParameters(), SiStripRecHitMatcher::match(), SiStripMatchedRecHit2D::monoCluster(), SiStripMatchedRecHit2D::monoClusterRef(), GluedGeomDet::monoDet(), GeomDet::position(), SiStripMatchedRecHit2D::stereoCluster(), SiStripMatchedRecHit2D::stereoClusterRef(), GluedGeomDet::stereoDet(), GeomDet::surface(), theCPE, theMatcher, GloballyPositioned< T >::toLocal(), and TSiStripMatchedRecHit().

{
  if (theMatcher != 0) {
    const SiStripMatchedRecHit2D *orig = static_cast<const SiStripMatchedRecHit2D *> (this->hit());
    const GeomDet *det = this->det();
    const GluedGeomDet *gdet = static_cast<const GluedGeomDet *> (det);
    //if ((orig == 0) || (gdet == 0)) return this->clone(); // or just die ?
    LocalVector tkDir = (ts.isValid() ? ts.localDirection() : 
                         det->surface().toLocal( det->position()-GlobalPoint(0,0,0)));
    
    if(theCPE != 0){    
      //approximation: the ts parameter on the glued surface are used on the mono
      // and stereo surface to re-evaluate cluster parameter. A further propagation 
      //is slow// and useless (?) in this case.

      
      const SiStripCluster& monoclust   = orig->monoCluster();  
      const SiStripCluster& stereoclust = orig->stereoCluster();
      
      StripClusterParameterEstimator::LocalValues lvMono = 
        theCPE->localParameters( monoclust, *gdet->monoDet(), ts);
      StripClusterParameterEstimator::LocalValues lvStereo = 
        theCPE->localParameters( stereoclust, *gdet->stereoDet(), gluedToStereo(ts, gdet));
      
      SiStripRecHit2D monoHit = SiStripRecHit2D( lvMono.first, lvMono.second,
                                                 gdet->monoDet()->geographicalId(),
                                                 orig->monoClusterRef());
      
      SiStripRecHit2D stereoHit = SiStripRecHit2D( lvStereo.first, lvStereo.second,
                                                   gdet->stereoDet()->geographicalId(),
                                                   orig->stereoClusterRef());
       const SiStripMatchedRecHit2D* better =  theMatcher->match(&monoHit,&stereoHit,gdet,tkDir);
      
      if (better == 0) {
        //dm::LogWarning("TSiStripMatchedRecHit") << "Refitting of a matched rechit returns NULL";
        return this->clone();
      }

      return RecHitPointer(new TSiStripMatchedRecHit( gdet, better, theMatcher,theCPE, false, DontCloneRecHit()));
      // delete better; //the ownership of the object is passed to the caller of the matcher

    }
    /*
    // not supported anymore....
    else{
       const SiStripMatchedRecHit2D *better = theMatcher->match(orig,gdet,tkDir);
       if (better == 0) {
        //edm::LogWarning("TSiStripMatchedRecHit") << "Refitting of a matched rechit returns NULL";
          return this->clone();        
        }
      return RecHitPointer(new TSiStripMatchedRecHit( gdet, better, theMatcher,theCPE, false, DontCloneRecHit()));
      // delete better; //the ownership of the object is passed to the caller of the matcher
    }
    */
  }
  return this->clone();
   
}
void TSiStripMatchedRecHit::clonePersistentHit ( ) [inline]

take ownership of the hit, if it wasn't owned (note: if it was owned, this code will leak it)

Definition at line 65 of file TSiStripMatchedRecHit.h.

References TrackingRecHit::clone(), and GenericTransientTrackingRecHit::trackingRecHit_.

void TSiStripMatchedRecHit::ComputeCoarseLocalPosition ( ) [private]

Definition at line 127 of file TSiStripMatchedRecHit.cc.

References TransientTrackingRecHit::det(), GeomDet::geographicalId(), BaseTrackerRecHit::hasPositionAndError(), ClusterParameterEstimator< T >::localParameters(), LogDebug, SiStripRecHitMatcher::match(), SiStripMatchedRecHit2D::monoCluster(), SiStripMatchedRecHit2D::monoClusterRef(), GluedGeomDet::monoDet(), GeomDet::position(), SiStripMatchedRecHit2D::stereoCluster(), SiStripMatchedRecHit2D::stereoClusterRef(), GluedGeomDet::stereoDet(), GeomDet::surface(), theCPE, theMatcher, GloballyPositioned< T >::toLocal(), and GenericTransientTrackingRecHit::trackingRecHit_.

Referenced by TSiStripMatchedRecHit().

                                                        {
  if (!theCPE || !theMatcher) return;
  const SiStripMatchedRecHit2D *orig = static_cast<const SiStripMatchedRecHit2D *> (trackingRecHit_);
  if ( (!orig)  ||  orig->hasPositionAndError()) return;

  LogDebug("TSiStripMatchedRecHit")<<"calculating coarse position/error.";
  const GeomDet *det = this->det();
  const GluedGeomDet *gdet = static_cast<const GluedGeomDet *> (det);
  LocalVector tkDir = det->surface().toLocal( det->position()-GlobalPoint(0,0,0));
  
  const SiStripCluster& monoclust   = orig->monoCluster();  
  const SiStripCluster& stereoclust = orig->stereoCluster();
  
  StripClusterParameterEstimator::LocalValues lvMono = 
    theCPE->localParameters( monoclust, *gdet->monoDet());
  StripClusterParameterEstimator::LocalValues lvStereo = 
    theCPE->localParameters( stereoclust, *gdet->stereoDet());
  
  SiStripRecHit2D monoHit = SiStripRecHit2D( lvMono.first, lvMono.second,
                                             gdet->monoDet()->geographicalId(),
                                             orig->monoClusterRef());
  
  SiStripRecHit2D stereoHit = SiStripRecHit2D( lvStereo.first, lvStereo.second,
                                               gdet->stereoDet()->geographicalId(),
                                                 orig->stereoClusterRef());
  SiStripMatchedRecHit2D* better =  theMatcher->match(&monoHit,&stereoHit,gdet,tkDir);
  
  if (!better) {
    edm::LogWarning("TSiStripMatchedRecHit")<<"could not get a matching rechit.";
  }else{
    delete trackingRecHit_;
    trackingRecHit_ = better;
  }
  
}
const GeomDetUnit* TSiStripMatchedRecHit::detUnit ( ) const [inline, virtual]

CAUTION: the GeomDetUnit* is zero for composite hits (matched hits in the tracker, segments in the muon). Always check this pointer before using it!

Reimplemented from TransientTrackingRecHit.

Definition at line 24 of file TSiStripMatchedRecHit.h.

{return 0;}
virtual void TSiStripMatchedRecHit::getKfComponents ( KfComponentsHolder holder) const [inline, virtual]
virtual AlgebraicSymMatrix TSiStripMatchedRecHit::parametersError ( ) const [inline, virtual]
TransientTrackingRecHit::ConstRecHitContainer TSiStripMatchedRecHit::transientHits ( ) const [virtual]

Composite interface: returns the component hits, if any.

Reimplemented from TransientTrackingRecHit.

Definition at line 98 of file TSiStripMatchedRecHit.cc.

References TSiStripRecHit2DLocalPos::build(), TransientTrackingRecHit::det(), GenericTransientTrackingRecHit::hit(), ClusterParameterEstimator< T >::localParameters(), m, SiStripMatchedRecHit2D::monoCluster(), SiStripMatchedRecHit2D::monoClusterRef(), GluedGeomDet::monoDet(), SiStripMatchedRecHit2D::monoHit(), query::result, alignCSCRings::s, SiStripMatchedRecHit2D::stereoCluster(), SiStripMatchedRecHit2D::stereoClusterRef(), GluedGeomDet::stereoDet(), SiStripMatchedRecHit2D::stereoHit(), and theCPE.

                                            {
  ConstRecHitContainer result;

  const GluedGeomDet *gdet = static_cast<const GluedGeomDet *> (this->det());
  const SiStripMatchedRecHit2D *orig = static_cast<const SiStripMatchedRecHit2D *> (this->hit());

  if (theCPE!=nullptr) {
    // this is at least the third place I read (write) this logic...
    const SiStripCluster& monoclust   = orig->monoCluster();  
    const SiStripCluster& stereoclust = orig->stereoCluster();
    
    StripClusterParameterEstimator::LocalValues lvMono = 
      theCPE->localParameters( monoclust, *gdet->monoDet());
    StripClusterParameterEstimator::LocalValues lvStereo = 
      theCPE->localParameters( stereoclust, *gdet->stereoDet());
    
    result.push_back(TSiStripRecHit2DLocalPos::build(lvMono.first, lvMono.second, gdet->monoDet(), 
                                                     orig->monoClusterRef(), theCPE));
    result.push_back(TSiStripRecHit2DLocalPos::build(lvStereo.first, lvStereo.second, gdet->stereoDet(), 
                                                     orig->stereoClusterRef(), theCPE));
  }
  else {
    auto m = orig->monoHit(); auto s = orig->stereoHit();
    result.push_back(TSiStripRecHit2DLocalPos::build( gdet->monoDet(),&m,theCPE));
    result.push_back(TSiStripRecHit2DLocalPos::build( gdet->stereoDet(),&s,theCPE));
  }
  return result;
}

Member Data Documentation

Definition at line 72 of file TSiStripMatchedRecHit.h.

Referenced by clone(), ComputeCoarseLocalPosition(), and transientHits().

Definition at line 71 of file TSiStripMatchedRecHit.h.

Referenced by canImproveWithTrack(), clone(), and ComputeCoarseLocalPosition().