CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Friends

MuonTransientTrackingRecHit Class Reference

#include <MuonTransientTrackingRecHit.h>

Inheritance diagram for MuonTransientTrackingRecHit:
GenericTransientTrackingRecHit TValidTrackingRecHit TransientTrackingRecHit TrackingRecHit ReferenceCountedPoolAllocated BlockWipedPoolAllocated

List of all members.

Public Types

typedef std::vector
< ConstMuonRecHitPointer
ConstMuonRecHitContainer
typedef
ConstReferenceCountingPointer
< MuonTransientTrackingRecHit
ConstMuonRecHitPointer
typedef std::vector
< MuonRecHitPointer
MuonRecHitContainer
typedef
ReferenceCountingPointer
< MuonTransientTrackingRecHit
MuonRecHitPointer

Public Member Functions

virtual double chi2 () const
 Chi square of the fit for segments, else 0.
virtual int degreesOfFreedom () const
 Degrees of freedom for segments, else 0.
virtual GlobalVector globalDirection () const
 Direction in 3D for segments, otherwise (0,0,0)
virtual GlobalError globalDirectionError () const
 Error on the global direction.
void invalidateHit ()
bool isCSC () const
 if this rec hit is a CSC rec hit
bool isDT () const
 if this rec hit is a DT rec hit
bool isRPC () const
 if this rec hit is a RPC rec hit
virtual LocalVector localDirection () const
 Direction in 3D for segments, otherwise (0,0,0)
virtual LocalError localDirectionError () const
 Error on the local direction.
virtual AlgebraicSymMatrix parametersError () const
virtual ConstRecHitContainer transientHits () const
 return the sub components of this transient rechit
virtual ~MuonTransientTrackingRecHit ()

Static Public Member Functions

static RecHitPointer build (const GeomDet *geom, const TrackingRecHit *rh)
 FIXME virtual ConstMuonRecHitContainer specificTransientHits() const;.
static MuonRecHitPointer specificBuild (const GeomDet *geom, const TrackingRecHit *rh)

Private Member Functions

virtual
MuonTransientTrackingRecHit
clone () const
 MuonTransientTrackingRecHit (const GeomDet *geom, const TrackingRecHit *rh)
 Construct from a TrackingRecHit and its GeomDet.
 MuonTransientTrackingRecHit (const MuonTransientTrackingRecHit &other)
 Copy ctor.

Friends

class kkkwwwxxxyyyzzz

Detailed Description

A TransientTrackingRecHit for muons.

Date:
2012/05/01 09:45:52
Revision:
1.18
Author:
C. Liu Purdue University

Definition at line 19 of file MuonTransientTrackingRecHit.h.


Member Typedef Documentation

Definition at line 24 of file MuonTransientTrackingRecHit.h.

Definition at line 22 of file MuonTransientTrackingRecHit.h.

Definition at line 23 of file MuonTransientTrackingRecHit.h.

Definition at line 21 of file MuonTransientTrackingRecHit.h.


Constructor & Destructor Documentation

virtual MuonTransientTrackingRecHit::~MuonTransientTrackingRecHit ( ) [inline, virtual]

Definition at line 26 of file MuonTransientTrackingRecHit.h.

{}
MuonTransientTrackingRecHit::MuonTransientTrackingRecHit ( const GeomDet geom,
const TrackingRecHit rh 
) [private]

Construct from a TrackingRecHit and its GeomDet.

Definition at line 23 of file MuonTransientTrackingRecHit.cc.

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

MuonTransientTrackingRecHit::MuonTransientTrackingRecHit ( const MuonTransientTrackingRecHit other) [private]

Copy ctor.

Definition at line 26 of file MuonTransientTrackingRecHit.cc.

                                                                                                  :
  GenericTransientTrackingRecHit(other.det(), *(other.hit())) {}

Member Function Documentation

static RecHitPointer MuonTransientTrackingRecHit::build ( const GeomDet geom,
const TrackingRecHit rh 
) [inline, static]

FIXME virtual ConstMuonRecHitContainer specificTransientHits() const;.

Reimplemented from GenericTransientTrackingRecHit.

Definition at line 62 of file MuonTransientTrackingRecHit.h.

References MuonTransientTrackingRecHit().

Referenced by GlobalTrajectoryBuilderBase::fixTEC().

                                                                              {
    return RecHitPointer( new MuonTransientTrackingRecHit(geom, rh));
  }
double MuonTransientTrackingRecHit::chi2 ( void  ) const [virtual]

Chi square of the fit for segments, else 0.

Definition at line 87 of file MuonTransientTrackingRecHit.cc.

References GenericTransientTrackingRecHit::hit().

{
  if (dynamic_cast<const RecSegment*>(hit()))
    return dynamic_cast<const RecSegment*>(hit())->chi2();
  else return 0.;
}
virtual MuonTransientTrackingRecHit* MuonTransientTrackingRecHit::clone ( void  ) const [inline, private, virtual]

Reimplemented from GenericTransientTrackingRecHit.

Definition at line 82 of file MuonTransientTrackingRecHit.h.

References MuonTransientTrackingRecHit().

                                                     {
    return new MuonTransientTrackingRecHit(*this);
  }
int MuonTransientTrackingRecHit::degreesOfFreedom ( ) const [virtual]

Degrees of freedom for segments, else 0.

Definition at line 94 of file MuonTransientTrackingRecHit.cc.

References GenericTransientTrackingRecHit::hit().

{
  if (dynamic_cast<const RecSegment*>(hit()))
    return dynamic_cast<const RecSegment*>(hit())->degreesOfFreedom();
  else return 0;
}
GlobalVector MuonTransientTrackingRecHit::globalDirection ( ) const [virtual]

Direction in 3D for segments, otherwise (0,0,0)

Definition at line 46 of file MuonTransientTrackingRecHit.cc.

References TValidTrackingRecHit::det(), localDirection(), and TValidTrackingRecHit::surface().

{
  return  (det()->surface().toGlobal(localDirection()));
}
GlobalError MuonTransientTrackingRecHit::globalDirectionError ( ) const [virtual]
void MuonTransientTrackingRecHit::invalidateHit ( )

Definition at line 175 of file MuonTransientTrackingRecHit.cc.

References TrackingRecHit::bad, GenericTransientTrackingRecHit::dimension(), isCSC(), isDT(), GenericTransientTrackingRecHit::recHits(), TrackingRecHit::setType(), and GenericTransientTrackingRecHit::trackingRecHit_.

                                               { 
  setType(bad); trackingRecHit_->setType(bad); 


  if (isDT()){
    if(dimension() > 1){ // MB4s have 2D, but formatted in 4D segments 
      std::vector<TrackingRecHit*> seg2D = recHits(); // 4D --> 2D
      // load 1D hits (2D --> 1D)
      for(std::vector<TrackingRecHit*>::iterator it = seg2D.begin(); it != seg2D.end(); ++it){
        std::vector<TrackingRecHit*> hits1D =  (*it)->recHits();
        (*it)->setType(bad);
        for(std::vector<TrackingRecHit*>::iterator it2 = hits1D.begin(); it2 != hits1D.end(); ++it2)
          (*it2)->setType(bad);
      }
    }
  }
  else if(isCSC())
    if(dimension() == 4){
      std::vector<TrackingRecHit*>  hits = recHits(); // load 2D hits (4D --> 1D)
      for(std::vector<TrackingRecHit*>::iterator it = hits.begin(); it != hits.end(); ++it)
        (*it)->setType(bad);
    }
  
  
}
bool MuonTransientTrackingRecHit::isCSC ( ) const

if this rec hit is a CSC rec hit

Definition at line 105 of file MuonTransientTrackingRecHit.cc.

References MuonSubdetId::CSC, and TrackingRecHit::geographicalId().

Referenced by invalidateHit().

                                             {
  return  (geographicalId().subdetId() == MuonSubdetId::CSC);
}
bool MuonTransientTrackingRecHit::isDT ( ) const

if this rec hit is a DT rec hit

Definition at line 101 of file MuonTransientTrackingRecHit.cc.

References MuonSubdetId::DT, and TrackingRecHit::geographicalId().

Referenced by invalidateHit(), and transientHits().

                                            {
  return  (geographicalId().subdetId() == MuonSubdetId::DT);
}
bool MuonTransientTrackingRecHit::isRPC ( ) const

if this rec hit is a RPC rec hit

Definition at line 109 of file MuonTransientTrackingRecHit.cc.

References TrackingRecHit::geographicalId(), and MuonSubdetId::RPC.

                                             {
  return  (geographicalId().subdetId() == MuonSubdetId::RPC);
}
LocalVector MuonTransientTrackingRecHit::localDirection ( ) const [virtual]

Direction in 3D for segments, otherwise (0,0,0)

Definition at line 30 of file MuonTransientTrackingRecHit.cc.

References GenericTransientTrackingRecHit::hit().

Referenced by globalDirection().

                                                              {

  if (dynamic_cast<const RecSegment*>(hit()) )
     return dynamic_cast<const RecSegment*>(hit())->localDirection(); 
  else return LocalVector(0.,0.,0.);

}
LocalError MuonTransientTrackingRecHit::localDirectionError ( ) const [virtual]

Error on the local direction.

Definition at line 38 of file MuonTransientTrackingRecHit.cc.

References GenericTransientTrackingRecHit::hit().

Referenced by globalDirectionError().

                                                                  {

  if (dynamic_cast<const RecSegment*>(hit()))
     return dynamic_cast<const RecSegment*>(hit())->localDirectionError();
  else return LocalError(0.,0.,0.);

}
AlgebraicSymMatrix MuonTransientTrackingRecHit::parametersError ( ) const [virtual]

Reimplemented from GenericTransientTrackingRecHit.

Definition at line 57 of file MuonTransientTrackingRecHit.cc.

References TValidTrackingRecHit::det(), GeomDet::localAlignmentError(), GenericTransientTrackingRecHit::projectionMatrix(), LocalError::valid(), LocalError::xx(), LocalError::xy(), and LocalError::yy().

                                                                      {
  
  AlgebraicSymMatrix err = GenericTransientTrackingRecHit::parametersError();
 
    LocalError lape = det()->localAlignmentError();
    if (lape.valid()) {

    // Just for speed up the code, the "else" branch can handle also the case of dim = 1.
    if(err.num_row() == 1) err[0][0] += lape.xx();
    else{
      AlgebraicSymMatrix lapeMatrix(5,0);
      lapeMatrix[3][3] = lape.xx();
      lapeMatrix[3][4] = lape.xy();
      lapeMatrix[4][4] = lape.yy();
      
      AlgebraicSymMatrix lapeMatrixProj = lapeMatrix.similarity(projectionMatrix());
      
      if(err.num_row() != lapeMatrixProj.num_row())
        throw cms::Exception("MuonTransientTrackingRecHit::parametersError") 
          <<"Discrepancy between alignment error matrix and error matrix: APE " 
          << lapeMatrixProj.num_row()
          << ", error matrix " << err.num_row() 
          << std::endl;
      
      err += lapeMatrixProj;
    }
  }
  return err;
}
static MuonRecHitPointer MuonTransientTrackingRecHit::specificBuild ( const GeomDet geom,
const TrackingRecHit rh 
) [inline, static]
TransientTrackingRecHit::ConstRecHitContainer MuonTransientTrackingRecHit::transientHits ( ) const [virtual]

return the sub components of this transient rechit

Reimplemented from TransientTrackingRecHit.

Definition at line 115 of file MuonTransientTrackingRecHit.cc.

References GeomDet::components(), filterCSVwithJSON::copy, TValidTrackingRecHit::det(), GenericTransientTrackingRecHit::dimension(), GeomDet::geographicalId(), isDT(), GenericTransientTrackingRecHit::recHits(), and tmp.

                                                                                            {

  ConstRecHitContainer theSubTransientRecHits;
  
  // the sub rec hit of this TransientRecHit
  std::vector<const TrackingRecHit*> ownRecHits = recHits();

  if(ownRecHits.size() == 0){
    theSubTransientRecHits.push_back(this);
    return theSubTransientRecHits;
  }
  
  // the components of the geom det on which reside this rechit
  std::vector<const GeomDet *> geomDets = det()->components();

  if(isDT() && dimension() == 2 && ownRecHits.front()->dimension() == 1 
     && (geomDets.size() == 3 || geomDets.size() == 2) ){ // it is a phi segment!!
    
    std::vector<const GeomDet *> subGeomDets;

    int sl = 1;
    for(std::vector<const GeomDet *>::const_iterator geoDet = geomDets.begin();
        geoDet != geomDets.end(); ++geoDet){
      if(sl != 3){ // FIXME!! this maybe is not always true
        std::vector<const GeomDet *> tmp = (*geoDet)->components();
        std::copy(tmp.begin(),tmp.end(),back_inserter(subGeomDets));
      }
      ++sl;
    }
    geomDets.clear();
    geomDets = subGeomDets;
  }
  
  // Fill the GeomDet map
  std::map<DetId,const GeomDet*> gemDetMap;
  
  for (std::vector<const GeomDet*>::const_iterator subDet = geomDets.begin(); 
       subDet != geomDets.end(); ++subDet)
    gemDetMap[ (*subDet)->geographicalId() ] = *subDet;
  
  std::map<DetId,const GeomDet*>::iterator gemDetMap_iter;
  
  // Loop in order to check the ids
  for (std::vector<const TrackingRecHit*>::const_iterator rechit = ownRecHits.begin(); 
       rechit != ownRecHits.end(); ++rechit){
    
    gemDetMap_iter = gemDetMap.find( (*rechit)->geographicalId() );
    
    if(gemDetMap_iter != gemDetMap.end() )
      theSubTransientRecHits.push_back(new MuonTransientTrackingRecHit(gemDetMap_iter->second, 
                                                                         *rechit) );
    else if( (*rechit)->geographicalId() == det()->geographicalId() ) // Phi in DT is on Chamber
      theSubTransientRecHits.push_back(new MuonTransientTrackingRecHit(det(), 
                                                                       *rechit) );
  }
  return theSubTransientRecHits;

}

Friends And Related Function Documentation

friend class kkkwwwxxxyyyzzz [friend]

Definition at line 74 of file MuonTransientTrackingRecHit.h.