CMS 3D CMS Logo

Public Member Functions | Private Attributes

SeedTransformer Class Reference

#include <SeedTransformer.h>

List of all members.

Public Member Functions

std::vector< TrajectoryseedTransform (const TrajectorySeed &) const
 Performs the fit.
 SeedTransformer (const edm::ParameterSet &)
 Constructor.
TrajectoryStateOnSurface seedTransientState (const TrajectorySeed &) const
void setServices (const edm::EventSetup &)
 Set the services needed by the SeedTransformer.
virtual ~SeedTransformer ()
 Destructor.

Private Attributes

double errorRescale
 Error rescale factor.
unsigned int nMinRecHits
 Minimum number of RecHits required to perform the fit.
edm::ESHandle< TrajectoryFittertheFitter
std::string theFitterName
edm::ESHandle< MagneticFieldtheMagneticField
edm::ESHandle
< TransientTrackingRecHitBuilder
theMuonRecHitBuilder
std::string theMuonRecHitBuilderName
edm::ESHandle< PropagatorthePropagator
std::string thePropagatorName
edm::ESHandle
< GlobalTrackingGeometry
theTrackingGeometry
bool useSubRecHits

Detailed Description

Description: this class takes a TrajectorySeed, fits its RecHits and returns a vector of Trajectories. If the fit fails, the returned vector is empty.

Date:
2008/11/11 08:01:23
Revision:
1.4
Author:
D. Trocino - University and INFN Torino

Definition at line 31 of file SeedTransformer.h.


Constructor & Destructor Documentation

SeedTransformer::SeedTransformer ( const edm::ParameterSet iConfig)

Constructor.

Definition at line 50 of file SeedTransformer.cc.

References edm::ParameterSet::getParameter(), and LogTrace.

                                                            {

  LogTrace("Reco|TrackingTools|SeedTransformer") << "SeedTransformer constructor called." << endl << endl;

  theFitterName = iConfig.getParameter<string>("Fitter");  
  theMuonRecHitBuilderName = iConfig.getParameter<string>("MuonRecHitBuilder");
  thePropagatorName = iConfig.getParameter<string>("Propagator");

  nMinRecHits = iConfig.getParameter<unsigned int>("NMinRecHits");
  errorRescale = iConfig.getParameter<double>("RescaleError");
  useSubRecHits = iConfig.getParameter<bool>("UseSubRecHits");
}
SeedTransformer::~SeedTransformer ( ) [virtual]

Destructor.

Definition at line 63 of file SeedTransformer.cc.

References LogTrace.

                                  {

  LogTrace("Reco|TrackingTools|SeedTransformer") << "SeedTransformer destructor called." << endl << endl;

}

Member Function Documentation

vector< Trajectory > SeedTransformer::seedTransform ( const TrajectorySeed aSeed) const

Performs the fit.

Definition at line 79 of file SeedTransformer.cc.

References MuonTransientTrackingRecHitBreaker::breakInSubRecHits(), filterCSVwithJSON::copy, TrajectoryStateOnSurface::isValid(), LogTrace, metname, TrajectorySeed::nHits(), TrajectorySeed::recHits(), TrajectoryStateOnSurface::rescaleError(), and TrajectoryStateOnSurface::surface().

Referenced by DirectMuonTrajectoryBuilder::trajectories(), and StandAloneMuonTrajectoryBuilder::trajectories().

                                                                                   {

  const string metname = "Reco|TrackingTools|SeedTransformer";

  LogTrace(metname) << " Number of valid RecHits:      " << aSeed.nHits() << endl;

  if( aSeed.nHits() < nMinRecHits ) {
    LogTrace(metname) << "    --- Too few RecHits, no refit performed! ---" << endl;
    return vector<Trajectory>();
  }

  TrajectoryStateOnSurface aTSOS(seedTransientState(aSeed));

  // Rescale errors before refit, not to bias the result
  aTSOS.rescaleError(errorRescale);

  vector<TransientTrackingRecHit::ConstRecHitPointer> recHits;
  unsigned int countRH = 0;

  for(TrajectorySeed::recHitContainer::const_iterator itRecHits=aSeed.recHits().first; itRecHits!=aSeed.recHits().second; ++itRecHits, ++countRH) {
    if((*itRecHits).isValid()) {
      TransientTrackingRecHit::ConstRecHitPointer ttrh(theMuonRecHitBuilder->build(&(*itRecHits)));

      if(useSubRecHits){
        TransientTrackingRecHit::ConstRecHitContainer subHits =
          MuonTransientTrackingRecHitBreaker::breakInSubRecHits(ttrh,2);
        copy(subHits.begin(),subHits.end(),back_inserter(recHits));
      }
      else{
        recHits.push_back(ttrh);
      }    
    }
  } // end for(TrajectorySeed::recHitContainer::const_iterator itRecHits=aSeed.recHits().first; itRecHits!=aSeed.recHits().second; ++itRecHits, ++countRH)

  TrajectoryStateOnSurface aInitTSOS = thePropagator->propagate(aTSOS, recHits.front()->det()->surface());

  if(!aInitTSOS.isValid()) {
    LogTrace(metname) << "    --- Initial state for refit not valid! ---" << endl;
    return vector<Trajectory>();
  }

  vector<Trajectory> refittedSeed = theFitter->fit(aSeed, recHits, aInitTSOS);

  if(refittedSeed.empty()) {
    LogTrace(metname) << "    --- Seed fit failed! ---" << endl;
    return vector<Trajectory>();
  }

  else if(!refittedSeed.front().isValid()) {
    LogTrace(metname) << "    --- Seed fitted, but trajectory not valid! ---" << endl;
    return vector<Trajectory>();
  }

  else
    LogTrace(metname) << "    +++ Seed fit succeded! +++" << endl;

  return refittedSeed;

}
TrajectoryStateOnSurface SeedTransformer::seedTransientState ( const TrajectorySeed tmpSeed) const

Definition at line 139 of file SeedTransformer.cc.

References PTrajectoryStateOnDet::detId(), TrajectorySeed::startingState(), and TrajectoryStateTransform::transientState().

Referenced by StandAloneMuonTrajectoryBuilder::trajectories().

                                                                                                {

  PTrajectoryStateOnDet tmpTSOD = tmpSeed.startingState();
  DetId tmpDetId(tmpTSOD.detId());
  const GeomDet* tmpGeomDet = theTrackingGeometry->idToDet(tmpDetId);

  TrajectoryStateTransform tsTransform;
  TrajectoryStateOnSurface tmpTSOS = tsTransform.transientState(tmpTSOD, &(tmpGeomDet->surface()), &(*theMagneticField));

  return tmpTSOS;

}
void SeedTransformer::setServices ( const edm::EventSetup iSetup)

Member Data Documentation

Error rescale factor.

Definition at line 64 of file SeedTransformer.h.

unsigned int SeedTransformer::nMinRecHits [private]

Minimum number of RecHits required to perform the fit.

Definition at line 61 of file SeedTransformer.h.

Definition at line 52 of file SeedTransformer.h.

std::string SeedTransformer::theFitterName [private]

Definition at line 56 of file SeedTransformer.h.

Definition at line 51 of file SeedTransformer.h.

Definition at line 53 of file SeedTransformer.h.

Definition at line 57 of file SeedTransformer.h.

Definition at line 54 of file SeedTransformer.h.

std::string SeedTransformer::thePropagatorName [private]

Definition at line 58 of file SeedTransformer.h.

Definition at line 50 of file SeedTransformer.h.

Definition at line 66 of file SeedTransformer.h.