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, float weight=1., float annealing=1., bool computeCoarseLocalPosition=false)
static RecHitPointer build (const GeomDet *geom, std::auto_ptr< TrackingRecHit > rh, const SiStripRecHitMatcher *matcher, const StripClusterParameterEstimator *cpe=0, float weight=1., float annealing=1., bool computeCoarseLocalPosition=false)
static void buildInPlace (std::auto_ptr< TSiStripMatchedRecHit > &memory, const GeomDet *geom, const TrackingRecHit *rh, const SiStripRecHitMatcher *matcher, const StripClusterParameterEstimator *cpe=0, float weight=1., float annealing=1., 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, float weight, float annealing, bool computeCoarseLocalPosition)
 TSiStripMatchedRecHit (const GeomDet *geom, const TrackingRecHit *rh, const SiStripRecHitMatcher *matcher, const StripClusterParameterEstimator *cpe, float weight, float annealing, bool computeCoarseLocalPosition, const DontCloneRecHit &)
 TSiStripMatchedRecHit (const GeomDet *geom, const TrackingRecHit *rh, const SiStripRecHitMatcher *matcher, const StripClusterParameterEstimator *cpe, float weight, float annealing, 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,
float  weight,
float  annealing,
bool  computeCoarseLocalPosition 
) [inline, private]

Definition at line 76 of file TSiStripMatchedRecHit.h.

References ComputeCoarseLocalPosition().

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

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

Definition at line 85 of file TSiStripMatchedRecHit.h.

References ComputeCoarseLocalPosition().

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

Definition at line 93 of file TSiStripMatchedRecHit.h.

References ComputeCoarseLocalPosition().

                                                  : 
    GenericTransientTrackingRecHit(geom, const_cast<TrackingRecHit *>(rh), weight, annealing), 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,
float  weight = 1.,
float  annealing = 1.,
bool  computeCoarseLocalPosition = false 
) [inline, static]
static RecHitPointer TSiStripMatchedRecHit::build ( const GeomDet geom,
std::auto_ptr< TrackingRecHit rh,
const SiStripRecHitMatcher matcher,
const StripClusterParameterEstimator cpe = 0,
float  weight = 1.,
float  annealing = 1.,
bool  computeCoarseLocalPosition = false 
) [inline, static]

Definition at line 34 of file TSiStripMatchedRecHit.h.

References TSiStripMatchedRecHit(), and TransientTrackingRecHit::weight().

                                                                     {
    return RecHitPointer( new TSiStripMatchedRecHit( geom, rh, matcher,cpe,weight, annealing, computeCoarseLocalPosition));
  }
static void TSiStripMatchedRecHit::buildInPlace ( std::auto_ptr< TSiStripMatchedRecHit > &  memory,
const GeomDet geom,
const TrackingRecHit rh,
const SiStripRecHitMatcher matcher,
const StripClusterParameterEstimator cpe = 0,
float  weight = 1.,
float  annealing = 1.,
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 53 of file TSiStripMatchedRecHit.h.

References TSiStripMatchedRecHit(), and TransientTrackingRecHit::weight().

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

                                                                     {
        if (memory.get()) {
            memory->~TSiStripMatchedRecHit(); // call destructor
            new (memory.get()) TSiStripMatchedRecHit( geom, rh, matcher,cpe,weight, annealing, computeCoarseLocalPosition, DontCloneRecHit());
        } else {
            memory.reset(new TSiStripMatchedRecHit( geom, rh, matcher,cpe,weight, annealing, 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 43 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 71 of file TSiStripMatchedRecHit.h.

References GenericTransientTrackingRecHit::trackingRecHit_.

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

Reimplemented from GenericTransientTrackingRecHit.

Definition at line 158 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 build(), clone(), SiStripRecHit2D::cluster(), SiStripRecHit2D::cluster_regional(), TransientTrackingRecHit::det(), GeomDet::geographicalId(), TransientTrackingRecHit::getAnnealingFactor(), gluedToStereo(), GenericTransientTrackingRecHit::hit(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localDirection(), ClusterParameterEstimator< T >::localParameters(), SiStripRecHitMatcher::match(), GluedGeomDet::monoDet(), SiStripMatchedRecHit2D::monoHit(), GeomDet::position(), query::result, GluedGeomDet::stereoDet(), SiStripMatchedRecHit2D::stereoHit(), GeomDet::surface(), theCPE, theMatcher, GloballyPositioned< T >::toLocal(), and TransientTrackingRecHit::weight().

{
  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 SiStripMatchedRecHit2D* better;

      if(!orig->monoHit()->cluster().isNull()){
        const SiStripCluster& monoclust   = *orig->monoHit()->cluster();  
        const SiStripCluster& stereoclust = *orig->stereoHit()->cluster();

        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->monoHit()->cluster());
        
        SiStripRecHit2D stereoHit = SiStripRecHit2D( lvStereo.first, lvStereo.second,
                                     gdet->stereoDet()->geographicalId(),
                                     orig->stereoHit()->cluster());
        better =  theMatcher->match(&monoHit,&stereoHit,gdet,tkDir);
      }else{
        const SiStripCluster& monoclust   = *orig->monoHit()->cluster_regional();  
        const SiStripCluster& stereoclust = *orig->stereoHit()->cluster_regional();
        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->monoHit()->cluster_regional());
        
        SiStripRecHit2D stereoHit = SiStripRecHit2D( lvStereo.first, lvStereo.second,
                                                     gdet->stereoDet()->geographicalId(),
                                                     orig->stereoHit()->cluster_regional());
        better =  theMatcher->match(&monoHit,&stereoHit,gdet,tkDir);
      }
      
      if (better == 0) {
        //dm::LogWarning("TSiStripMatchedRecHit") << "Refitting of a matched rechit returns NULL";
        return this->clone();
      }

      RecHitPointer result = TSiStripMatchedRecHit::build( gdet, better, theMatcher,theCPE, weight(), getAnnealingFactor()  );
      delete better; //the ownership of the object is passed to the caller of the matcher
      return result;

    }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();        
      }
      RecHitPointer result = TSiStripMatchedRecHit::build( gdet, better, theMatcher,theCPE, weight(), getAnnealingFactor()  );
      delete better; //the ownership of the object is passed to the caller of the matcher
      return result;
    }
  }
  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 68 of file TSiStripMatchedRecHit.h.

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

void TSiStripMatchedRecHit::ComputeCoarseLocalPosition ( ) [inline, private]

Definition at line 104 of file TSiStripMatchedRecHit.h.

References SiStripMatchedRecHit2D::clone(), SiStripRecHit2D::cluster(), SiStripRecHit2D::cluster_regional(), TransientTrackingRecHit::det(), GeomDet::geographicalId(), BaseSiTrackerRecHit2DLocalPos::hasPositionAndError(), ClusterParameterEstimator< T >::localParameters(), LogDebug, SiStripRecHitMatcher::match(), GluedGeomDet::monoDet(), SiStripMatchedRecHit2D::monoHit(), GeomDet::position(), GluedGeomDet::stereoDet(), SiStripMatchedRecHit2D::stereoHit(), 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()){
        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 SiStripMatchedRecHit2D* better=0;
        
        if(!orig->monoHit()->cluster().isNull()){
          const SiStripCluster& monoclust   = *orig->monoHit()->cluster();  
          const SiStripCluster& stereoclust = *orig->stereoHit()->cluster();
          
          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->monoHit()->cluster());
          
          SiStripRecHit2D stereoHit = SiStripRecHit2D( lvStereo.first, lvStereo.second,
                                                       gdet->stereoDet()->geographicalId(),
                                                       orig->stereoHit()->cluster());
          better =  theMatcher->match(&monoHit,&stereoHit,gdet,tkDir);
        }else{
          const SiStripCluster& monoclust   = *orig->monoHit()->cluster_regional();  
          const SiStripCluster& stereoclust = *orig->stereoHit()->cluster_regional();
          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->monoHit()->cluster_regional());
          
          SiStripRecHit2D stereoHit = SiStripRecHit2D( lvStereo.first, lvStereo.second,
                                                       gdet->stereoDet()->geographicalId(),
                                                       orig->stereoHit()->cluster_regional());
          better =  theMatcher->match(&monoHit,&stereoHit,gdet,tkDir);
          
        }
        if (!better) {
          edm::LogWarning("TSiStripMatchedRecHit")<<"could not get a matching rechit.";
        }else{
          trackingRecHit_ = better->clone();
        }
      }
    }
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 115 of file TSiStripMatchedRecHit.cc.

References TSiStripRecHit2DLocalPos::build(), TransientTrackingRecHit::det(), GenericTransientTrackingRecHit::hit(), GluedGeomDet::monoDet(), SiStripMatchedRecHit2D::monoHit(), query::result, 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());

  result.push_back(TSiStripRecHit2DLocalPos::build( gdet->monoDet(),orig->monoHit(),theCPE));
  result.push_back(TSiStripRecHit2DLocalPos::build( gdet->stereoDet(),orig->stereoHit(),theCPE));
  return result;
}

Member Data Documentation

Definition at line 75 of file TSiStripMatchedRecHit.h.

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

Definition at line 74 of file TSiStripMatchedRecHit.h.

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