CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CosmicMuonTrajectoryBuilder Class Reference

#include <CosmicMuonTrajectoryBuilder.h>

Inheritance diagram for CosmicMuonTrajectoryBuilder:
MuonTrajectoryBuilder

List of all members.

Public Member Functions

MuonTrajectoryUpdatorbackwardUpdator () const
MuonBestMeasurementFinderbestMeasurementFinder () const
PropagationDirection checkDirectionByT0 (const DTRecSegment4D *, const DTRecSegment4D *) const
 CosmicMuonTrajectoryBuilder (const edm::ParameterSet &, const MuonServiceProxy *service)
 Constructor.
DirectMuonNavigationnavigation () const
const Propagatorpropagator () const
const PropagatorpropagatorAlong () const
const PropagatorpropagatorOpposite () const
virtual void setEvent (const edm::Event &)
 pass the Event to the algo at each event
CosmicMuonSmoothersmoother () const
double t0 (const DTRecSegment4D *deseg) const
virtual CandidateContainer trajectories (const TrackCand &)
 dummy implementation, unused in this class
std::vector< Trajectory * > trajectories (const TrajectorySeed &)
 build trajectories from seed
MuonTrajectoryUpdatorupdator () const
CosmicMuonUtilitiesutilities () const
virtual ~CosmicMuonTrajectoryBuilder ()
 Destructor.

Private Member Functions

void build (const TrajectoryStateOnSurface &, const NavigationDirection &, Trajectory &)
void buildSecondHalf (Trajectory &)
void estimateDirection (Trajectory &) const
 check the direction of trajectory by checking eta spread
std::vector
< TrajectoryMeasurement
findBestMeasurements (const DetLayer *, const TrajectoryStateOnSurface &, const Propagator *, const MeasurementEstimator *)
void flipTrajectory (Trajectory &) const
 flip a trajectory with refit (the momentum direction is opposite)
void getDirectionByTime (Trajectory &) const
 check the direction of trajectory by checking the timing
void incrementChamberCounters (const DetLayer *layer, int &dtChambers, int &cscChambers, int &rpcChambers, int &totalChambers)
TrajectoryStateOnSurface intermediateState (const TrajectoryStateOnSurface &) const
void reverseTrajectory (Trajectory &) const
 reverse a trajectory without refit (out the measurements order changed)
void reverseTrajectoryPropagationDirection (Trajectory &) const
 reverse the propagation direction of a trajectory
void selectHits (MuonTransientTrackingRecHit::MuonRecHitContainer &) const
bool selfDuplicate (const Trajectory &) const
 check if the trajectory iterates the same hit more than once
MuonTransientTrackingRecHit::MuonRecHitContainer unusedHits (const DetLayer *, const TrajectoryMeasurement &) const

Private Attributes

std::string category_
edm::Handle
< CSCRecHit2DCollection
cschits_
edm::Handle< DTRecHitCollectiondthits_
MuonBestMeasurementFindertheBestMeasurementFinder
MuonTrajectoryUpdatortheBKUpdator
unsigned long long theCacheId_DG
MuonDetLayerMeasurementstheLayerMeasurements
DirectMuonNavigationtheNavigation
edm::ParameterSet theNavigationPSet
int theNSuccess
int theNTraversing
std::string thePropagatorName
const MuonServiceProxytheService
CosmicMuonSmoothertheSmoother
bool theStrict1LegFlag
bool theTraversingMuonFlag
MuonTrajectoryUpdatortheUpdator

Detailed Description

Definition at line 39 of file CosmicMuonTrajectoryBuilder.h.


Constructor & Destructor Documentation

CosmicMuonTrajectoryBuilder::CosmicMuonTrajectoryBuilder ( const edm::ParameterSet par,
const MuonServiceProxy *  service 
)

Constructor.

Definition at line 46 of file CosmicMuonTrajectoryBuilder.cc.

References category_, ExpressReco_HICollisions_FallBack::CSCRecSegmentLabel, ExpressReco_HICollisions_FallBack::DTRecSegmentLabel, edm::ParameterSet::getParameter(), insideOut, outsideIn, ExpressReco_HICollisions_FallBack::RPCRecSegmentLabel, theBestMeasurementFinder, theBKUpdator, theCacheId_DG, theLayerMeasurements, theNavigation, theNavigationPSet, theNSuccess, theNTraversing, thePropagatorName, theService, theSmoother, theStrict1LegFlag, theTraversingMuonFlag, and theUpdator.

                                                                                                                    : theService(service) { 

  thePropagatorName = par.getParameter<string>("Propagator");

  bool enableDTMeasurement = par.getParameter<bool>("EnableDTMeasurement");
  bool enableCSCMeasurement = par.getParameter<bool>("EnableCSCMeasurement");
  bool enableRPCMeasurement = par.getParameter<bool>("EnableRPCMeasurement");

//  if(enableDTMeasurement)
  InputTag DTRecSegmentLabel = par.getParameter<InputTag>("DTRecSegmentLabel");

//  if(enableCSCMeasurement)
  InputTag CSCRecSegmentLabel = par.getParameter<InputTag>("CSCRecSegmentLabel");

//  if(enableRPCMeasurement)
  InputTag RPCRecSegmentLabel = par.getParameter<InputTag>("RPCRecSegmentLabel");

  theLayerMeasurements= new MuonDetLayerMeasurements(DTRecSegmentLabel,
                                                     CSCRecSegmentLabel,
                                                     RPCRecSegmentLabel,
                                                     enableDTMeasurement,
                                                     enableCSCMeasurement,
                                                     enableRPCMeasurement);

  ParameterSet muonUpdatorPSet = par.getParameter<ParameterSet>("MuonTrajectoryUpdatorParameters");
  
  theNavigation = 0; // new DirectMuonNavigation(theService->detLayerGeometry());
  theUpdator = new MuonTrajectoryUpdator(muonUpdatorPSet, insideOut);

  theBestMeasurementFinder = new MuonBestMeasurementFinder();

  ParameterSet muonBackwardUpdatorPSet = par.getParameter<ParameterSet>("BackwardMuonTrajectoryUpdatorParameters");

  theBKUpdator = new MuonTrajectoryUpdator(muonBackwardUpdatorPSet, outsideIn);

  theTraversingMuonFlag = par.getParameter<bool>("BuildTraversingMuon");

  theStrict1LegFlag = par.getParameter<bool>("Strict1Leg");

  ParameterSet smootherPSet = par.getParameter<ParameterSet>("MuonSmootherParameters");

  theNavigationPSet = par.getParameter<ParameterSet>("MuonNavigationParameters");

  theSmoother = new CosmicMuonSmoother(smootherPSet,theService);

  theNTraversing = 0;
  theNSuccess = 0;
  theCacheId_DG = 0;
  category_ = "Muon|RecoMuon|CosmicMuon|CosmicMuonTrajectoryBuilder";

}
CosmicMuonTrajectoryBuilder::~CosmicMuonTrajectoryBuilder ( ) [virtual]

Destructor.

Definition at line 99 of file CosmicMuonTrajectoryBuilder.cc.

References category_, LogTrace, theBestMeasurementFinder, theBKUpdator, theLayerMeasurements, theNavigation, theNSuccess, theNTraversing, theSmoother, and theUpdator.

                                                          {

  LogTrace(category_)<< "CosmicMuonTrajectoryBuilder dtor called";
  if (theUpdator) delete theUpdator;
  if (theBKUpdator) delete theBKUpdator;
  if (theLayerMeasurements) delete theLayerMeasurements;
  if (theSmoother) delete theSmoother;
  if (theNavigation) delete theNavigation; 
  delete theBestMeasurementFinder;

  LogTrace(category_)<< "CosmicMuonTrajectoryBuilder Traversing: "<<theNSuccess<<"/"<<theNTraversing;

}

Member Function Documentation

MuonTrajectoryUpdator* CosmicMuonTrajectoryBuilder::backwardUpdator ( ) const [inline]

Definition at line 68 of file CosmicMuonTrajectoryBuilder.h.

References theBKUpdator.

Referenced by build(), and trajectories().

{return theBKUpdator;}
MuonBestMeasurementFinder* CosmicMuonTrajectoryBuilder::bestMeasurementFinder ( ) const [inline]

Definition at line 76 of file CosmicMuonTrajectoryBuilder.h.

References theBestMeasurementFinder.

void CosmicMuonTrajectoryBuilder::build ( const TrajectoryStateOnSurface ts,
const NavigationDirection startingDir,
Trajectory traj 
) [private]

Definition at line 473 of file CosmicMuonTrajectoryBuilder.cc.

References alongMomentum, backwardUpdator(), PV3DBase< T, PVType, FrameType >::basicVector(), category_, DirectMuonNavigation::compatibleEndcapLayers(), DirectMuonNavigation::compatibleLayers(), Trajectory::empty(), ExpressReco_HICollisions_FallBack::estimator, findBestMeasurements(), Trajectory::firstMeasurement(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::globalPosition(), if(), incrementChamberCounters(), TrajectoryStateOnSurface::isValid(), Trajectory::lastMeasurement(), LogTrace, MuonTrajectoryUpdator::makeFirstTime(), FreeTrajectoryState::momentum(), navigation(), oppositeToMomentum, FreeTrajectoryState::position(), Propagator::propagate(), propagator(), propagatorAlong(), propagatorOpposite(), TrajectoryStateOnSurface::rescaleError(), MuonTrajectoryUpdator::setFitDirection(), theBKUpdator, theStrict1LegFlag, theTraversingMuonFlag, MuonTrajectoryUpdator::update(), TrajectoryMeasurement::updatedState(), updator(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by buildSecondHalf().

                                                          {

  if ( !ts.isValid() ) return;

  FreeTrajectoryState* fts = ts.freeState();
  if ( !fts ) return;

  vector<const DetLayer*> navLayers;

  if (fabs(fts->momentum().basicVector().eta()) < 1.0) {
    //DT
    if (fts->position().basicVector().dot(fts->momentum().basicVector())>0){
       navLayers = navigation()->compatibleLayers((*fts), alongMomentum);
      } else {
        navLayers = navigation()->compatibleLayers((*fts), oppositeToMomentum);
    }

  } else if (theTraversingMuonFlag && theStrict1LegFlag) {
    //CSC
      if (fts->position().basicVector().dot(fts->momentum().basicVector())>0){
           navLayers = navigation()->compatibleEndcapLayers((*fts), alongMomentum);
         } else {
            navLayers = navigation()->compatibleEndcapLayers((*fts), oppositeToMomentum);
          }
  } else {

    if (fts->position().basicVector().dot(fts->momentum().basicVector())>0){
       navLayers = navigation()->compatibleLayers((*fts), alongMomentum);
      } else {
        navLayers = navigation()->compatibleLayers((*fts), oppositeToMomentum);
   }

}

  if (navLayers.empty()) return;

  theBKUpdator->setFitDirection(startingDir);

  int DTChamberUsedBack = 0;
  int CSCChamberUsedBack = 0;
  int RPCChamberUsedBack = 0;
  int TotalChamberUsedBack = 0;

  TrajectoryStateOnSurface lastTsos = 
      (traj.lastMeasurement().updatedState().globalPosition().y() <
      traj.firstMeasurement().updatedState().globalPosition().y()) ? 
      propagatorAlong()->propagate((*fts),navLayers.front()->surface()) : propagatorOpposite()->propagate((*fts),navLayers.front()->surface());

  if ( !lastTsos.isValid() ) { 
    LogTrace(category_)<<"propagation failed from fts to inner cylinder";
    return;
  }
  LogTrace(category_)<<"tsos  "<<lastTsos.globalPosition();
  lastTsos.rescaleError(10.);
  vector<TrajectoryMeasurement> measL;
  for (vector<const DetLayer*>::const_iterator rnxtlayer = navLayers.begin();
      rnxtlayer!= navLayers.end(); ++rnxtlayer) {

    measL.clear();
    measL = findBestMeasurements(*rnxtlayer, lastTsos, propagator(), (backwardUpdator()->estimator()));

    if ( measL.empty() ) continue;

    for (vector<TrajectoryMeasurement>::const_iterator theMeas = measL.begin(); theMeas != measL.end(); ++theMeas) {

      pair<bool,TrajectoryStateOnSurface> bkresult
             = backwardUpdator()->update((&*theMeas), traj, propagator());
      if (bkresult.first ) {
        LogTrace(category_)<<"update ok : "<<(theMeas)->recHit()->globalPosition() ;

        incrementChamberCounters((*rnxtlayer), DTChamberUsedBack, CSCChamberUsedBack, RPCChamberUsedBack, TotalChamberUsedBack);

        if ( (!traj.empty()) && bkresult.second.isValid() ) 
          lastTsos = bkresult.second;
        else if ((theMeas)->predictedState().isValid()) 
          lastTsos = (theMeas)->predictedState();
      }
    }
  }
  navLayers.clear();
  updator()->makeFirstTime();
  backwardUpdator()->makeFirstTime();

  measL.clear();

  return;

}
void CosmicMuonTrajectoryBuilder::buildSecondHalf ( Trajectory traj) [private]
PropagationDirection CosmicMuonTrajectoryBuilder::checkDirectionByT0 ( const DTRecSegment4D dtseg1,
const DTRecSegment4D dtseg2 
) const

Definition at line 937 of file CosmicMuonTrajectoryBuilder.cc.

References alongMomentum, anyDirection, category_, LogTrace, oppositeToMomentum, query::result, and t0().

                                                                                                         {

   LogTrace(category_) << "comparing dtseg: " << dtseg1 << " " << dtseg2 << endl;
   if (dtseg1 == dtseg2 || t0(dtseg1) == t0(dtseg2)) return anyDirection; 

   PropagationDirection result =
    ( t0(dtseg1) < t0(dtseg2) ) ? alongMomentum : oppositeToMomentum;

   return result;

}
void CosmicMuonTrajectoryBuilder::estimateDirection ( Trajectory traj) const [private]

check the direction of trajectory by checking eta spread

Definition at line 768 of file CosmicMuonTrajectoryBuilder.cc.

References category_, PV3DBase< T, PVType, FrameType >::eta(), Trajectory::firstMeasurement(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), Trajectory::lastMeasurement(), LogTrace, Trajectory::recHits(), CosmicMuonUtilities::reverseDirection(), Trajectory::seed(), theService, theSmoother, CosmicMuonSmoother::trajectories(), TrajectoryMeasurement::updatedState(), and utilities().

Referenced by trajectories().

                                                                          {

  TransientTrackingRecHit::ConstRecHitContainer hits = traj.recHits();

  TrajectoryStateOnSurface firstTSOS = traj.firstMeasurement().updatedState();

  TrajectoryStateOnSurface lastTSOS = traj.lastMeasurement().updatedState();

  if ( !firstTSOS.isValid() || !lastTSOS.isValid() ) return;

  LogTrace(category_) <<"Two ends of the traj "<<firstTSOS.globalPosition()
                      <<", "<<lastTSOS.globalPosition();

  LogTrace(category_) <<"Their mom: "<<firstTSOS.globalMomentum()
                      <<", "<<lastTSOS.globalMomentum();

  LogTrace(category_) <<"Their mom eta: "<<firstTSOS.globalMomentum().eta()
                      <<", "<<lastTSOS.globalMomentum().eta();

  // momentum eta can be used to estimate direction
  // the beam-halo muon seems enter with a larger |eta|

  if ( fabs(firstTSOS.globalMomentum().eta()) > fabs(lastTSOS.globalMomentum().eta()) ) {

    vector<Trajectory> refitted = theSmoother->trajectories(traj.seed(),hits,firstTSOS);
    if ( !refitted.empty() ) traj = refitted.front();

  } else {
    std::reverse(hits.begin(), hits.end());
    utilities()->reverseDirection(lastTSOS,&*theService->magneticField());
    vector<Trajectory> refittedback = theSmoother->trajectories(traj.seed(),hits,lastTSOS);
    if ( !refittedback.empty() ) traj = refittedback.front();

  }

  return;

}
std::vector< TrajectoryMeasurement > CosmicMuonTrajectoryBuilder::findBestMeasurements ( const DetLayer layer,
const TrajectoryStateOnSurface tsos,
const Propagator propagator,
const MeasurementEstimator estimator 
) [private]

Definition at line 856 of file CosmicMuonTrajectoryBuilder.cc.

References MuonBestMeasurementFinder::findBestMeasurement(), MuonDetLayerMeasurements::groupedMeasurements(), GeometricSearchDet::hasGroups(), MuonDetLayerMeasurements::measurements(), query::result, theBestMeasurementFinder, and theLayerMeasurements.

Referenced by build(), and trajectories().

                                                                                         {

  std::vector<TrajectoryMeasurement> result;
  std::vector<TrajectoryMeasurement> measurements;

  if ( layer->hasGroups() ) {
    std::vector<TrajectoryMeasurementGroup> measurementGroups =
      theLayerMeasurements->groupedMeasurements(layer, tsos, *propagator, *estimator);

    for (std::vector<TrajectoryMeasurementGroup>::const_iterator tmGroupItr = measurementGroups.begin();
        tmGroupItr != measurementGroups.end(); ++tmGroupItr) {
    
      measurements = tmGroupItr->measurements();
      const TrajectoryMeasurement* bestMeasurement 
        = theBestMeasurementFinder->findBestMeasurement(measurements, propagator);
      
      if (bestMeasurement) result.push_back(*bestMeasurement);
    }
  } 
  else {
    measurements = theLayerMeasurements->measurements(layer, tsos, *propagator, *estimator);
    const TrajectoryMeasurement* bestMeasurement 
      = theBestMeasurementFinder->findBestMeasurement(measurements, propagator);

    if (bestMeasurement) result.push_back(*bestMeasurement);
  }
  measurements.clear();

  return result;

}
void CosmicMuonTrajectoryBuilder::flipTrajectory ( Trajectory traj) const [private]

flip a trajectory with refit (the momentum direction is opposite)

Definition at line 714 of file CosmicMuonTrajectoryBuilder.cc.

References category_, CosmicMuonSmoother::fit(), TrajectoryStateOnSurface::isValid(), Trajectory::lastMeasurement(), LogTrace, Trajectory::recHits(), CosmicMuonUtilities::reverseDirection(), Trajectory::seed(), theService, theSmoother, TrajectoryMeasurement::updatedState(), and utilities().

Referenced by trajectories().

                                                                       {

  TrajectoryStateOnSurface lastTSOS = traj.lastMeasurement().updatedState();
  if ( !lastTSOS.isValid() ) {
    LogTrace(category_) << "Error: last TrajectoryState invalid.";
  }  
  TransientTrackingRecHit::ConstRecHitContainer hits = traj.recHits();
  std::reverse(hits.begin(), hits.end());

  LogTrace(category_) << "last tsos before flipping "<<lastTSOS;
  utilities()->reverseDirection(lastTSOS,&*theService->magneticField());
  LogTrace(category_) << "last tsos after flipping "<<lastTSOS;

  vector<Trajectory> refittedback = theSmoother->fit(traj.seed(),hits,lastTSOS);
  if ( refittedback.empty() ) {
    LogTrace(category_) <<"flipTrajectory fail. "<<endl;
    return;
  }
  LogTrace(category_) <<"flipTrajectory: first "<< refittedback.front().firstMeasurement().updatedState()
                       <<"\nflipTrajectory: last "<<refittedback.front().lastMeasurement().updatedState();

  traj = refittedback.front();

  return;

}
void CosmicMuonTrajectoryBuilder::getDirectionByTime ( Trajectory traj) const [private]

check the direction of trajectory by checking the timing

Definition at line 811 of file CosmicMuonTrajectoryBuilder.cc.

References category_, CSCDetId, cschits_, dthits_, DTLayerId, LogTrace, PV3DBase< T, PVType, FrameType >::perp(), pos, and Trajectory::recHits().

                                                                           {

  TransientTrackingRecHit::ConstRecHitContainer hits = traj.recHits();
  LogTrace(category_) << "getDirectionByTime"<<endl;
  for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator ir = hits.begin(); ir != hits.end(); ir++ ) {
    if ( !(*ir)->isValid() ) {
      LogTrace(category_) << "invalid RecHit"<<endl;
      continue;
    }

    const GlobalPoint& pos = (*ir)->globalPosition();
    LogTrace(category_)
    << "pos" << pos
    << "radius " << pos.perp()
    << "  dim " << (*ir)->dimension()
    << "  det " << (*ir)->det()->geographicalId().det()
    << "  sub det " << (*ir)->det()->subDetector()<<endl;

    if ((*ir)->det()->geographicalId().det() == 2 && (*ir)->det()->subDetector() == 6) { 
//      const CSCRecHit2D* iCSC = dynamic_cast<const CSCRecHit2D*>(&**ir);
//      if (iCSC) LogTrace(category_)<<"csc from cast tpeak "<<iCSC->tpeak(); 
      CSCRecHit2DCollection::range thisrange = cschits_->get(CSCDetId((*ir)->geographicalId()));
      for (CSCRecHit2DCollection::const_iterator rechit = thisrange.first; rechit!=thisrange.second;++rechit) {
         if ((*rechit).isValid()) LogTrace(category_)<<"csc from collection tpeak "<<(*rechit).tpeak();
      }
    }
    if ((*ir)->det()->geographicalId().det() == 2 && (*ir)->det()->subDetector() == 7) {
//      const DTRecHit1D* iDT = dynamic_cast<const DTRecHit1D*>(&**ir);
//      if (iDT) LogTrace(category_)<<"dt digitime "<<iDT->digiTime();
      DTRecHitCollection::range thisrange = dthits_->get(DTLayerId((*ir)->geographicalId()));
      for (DTRecHitCollection::const_iterator rechit = thisrange.first; rechit!=thisrange.second;++rechit) {
         if ((*rechit).isValid()) LogTrace(category_)<<"dt from collection digitime "<<(*rechit).digiTime();
      }
    }
  }

  return;

}
void CosmicMuonTrajectoryBuilder::incrementChamberCounters ( const DetLayer layer,
int &  dtChambers,
int &  cscChambers,
int &  rpcChambers,
int &  totalChambers 
) [private]

Definition at line 895 of file CosmicMuonTrajectoryBuilder.cc.

References CSC(), GeomDetEnumerators::DT, GeomDetEnumerators::RPCBarrel, GeomDetEnumerators::RPCEndcap, and DetLayer::subDetector().

Referenced by build(), and trajectories().

                                                                               {

  if (layer->subDetector()==GeomDetEnumerators::DT) dtChambers++; 
  else if (layer->subDetector()==GeomDetEnumerators::CSC) cscChambers++; 
  else if (layer->subDetector()==GeomDetEnumerators::RPCBarrel || layer->subDetector()==GeomDetEnumerators::RPCEndcap) rpcChambers++; 
  totalChambers++;

}
TrajectoryStateOnSurface CosmicMuonTrajectoryBuilder::intermediateState ( const TrajectoryStateOnSurface tsos) const [private]

Definition at line 595 of file CosmicMuonTrajectoryBuilder.cc.

References category_, TrajectoryStateOnSurface::globalDirection(), LogTrace, pos, Propagator::propagate(), and propagator().

Referenced by buildSecondHalf().

                                                                                                                  {

  PerpendicularBoundPlaneBuilder planeBuilder;
  GlobalPoint pos(0.0, 0.0, 0.0);
  BoundPlane* SteppingPlane = planeBuilder(pos,tsos.globalDirection());

  TrajectoryStateOnSurface predTsos = propagator()->propagate(tsos, *SteppingPlane);
  if ( predTsos.isValid() )
  LogTrace(category_)<<"intermediateState: a intermediate state: pos: "<<predTsos.globalPosition() << "mom: " << predTsos.globalMomentum();

  return predTsos;

}
DirectMuonNavigation* CosmicMuonTrajectoryBuilder::navigation ( ) const [inline]

Definition at line 74 of file CosmicMuonTrajectoryBuilder.h.

References theNavigation.

Referenced by build(), and trajectories().

{return theNavigation;}
const Propagator* CosmicMuonTrajectoryBuilder::propagator ( void  ) const [inline]
const Propagator* CosmicMuonTrajectoryBuilder::propagatorAlong ( ) const [inline]

Definition at line 62 of file CosmicMuonTrajectoryBuilder.h.

References MuonServiceProxy::propagator(), and theService.

Referenced by build().

{return &*theService->propagator("SteppingHelixPropagatorAlong");}
const Propagator* CosmicMuonTrajectoryBuilder::propagatorOpposite ( ) const [inline]

Definition at line 64 of file CosmicMuonTrajectoryBuilder.h.

References MuonServiceProxy::propagator(), and theService.

Referenced by build().

{return &*theService->propagator("SteppingHelixPropagatorOpposite");}
void CosmicMuonTrajectoryBuilder::reverseTrajectory ( Trajectory traj) const [private]

reverse a trajectory without refit (out the measurements order changed)

Definition at line 693 of file CosmicMuonTrajectoryBuilder.cc.

References alongMomentum, Trajectory::firstMeasurement(), Trajectory::lastMeasurement(), Trajectory::measurements(), oppositeToMomentum, TrajectoryMeasurement::recHit(), and Trajectory::seed().

Referenced by buildSecondHalf().

                                                                          {

  PropagationDirection newDir = (traj.firstMeasurement().recHit()->globalPosition().y()
      < traj.lastMeasurement().recHit()->globalPosition().y())
  ? oppositeToMomentum : alongMomentum;
  Trajectory newTraj(traj.seed(), newDir);
  
 const std::vector<TrajectoryMeasurement>& meas = traj.measurements();

  for (std::vector<TrajectoryMeasurement>::const_reverse_iterator itm = meas.rbegin();
       itm != meas.rend(); ++itm ) {
    newTraj.push(*itm);
  }
  traj = newTraj;

}
void CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection ( Trajectory traj) const [private]

reverse the propagation direction of a trajectory

Definition at line 745 of file CosmicMuonTrajectoryBuilder.cc.

References alongMomentum, anyDirection, Trajectory::direction(), Trajectory::empty(), Trajectory::measurements(), oppositeToMomentum, Trajectory::pop(), and Trajectory::seed().

Referenced by trajectories().

                                                                                              {

  if ( traj.direction() == anyDirection ) return;
  PropagationDirection newDir = (traj.direction() == alongMomentum)? oppositeToMomentum : alongMomentum;
  Trajectory newTraj(traj.seed(), newDir);
  const std::vector<TrajectoryMeasurement>& meas = traj.measurements();

  for (std::vector<TrajectoryMeasurement>::const_iterator itm = meas.begin(); itm != meas.end(); ++itm) {
    newTraj.push(*itm);
  }

  while (!traj.empty()) {
    traj.pop();
  }

  traj = newTraj;

}
void CosmicMuonTrajectoryBuilder::selectHits ( MuonTransientTrackingRecHit::MuonRecHitContainer hits) const [private]

Definition at line 613 of file CosmicMuonTrajectoryBuilder.cc.

References i, j, keep, and tmp.

                                                                                                       {

  if ( hits.size() < 2 ) return;

  MuonRecHitContainer tmp;
  vector<bool> keep(hits.size(),true);
  int i(0);
  int j(0);

  for (MuonRecHitContainer::const_iterator ihit = hits.begin();
       ihit != hits.end(); ++ihit ) {
    if ( !keep[i] ) { i++; continue; };
    j = i + 1;
    for (MuonRecHitContainer::const_iterator ihit2 = ihit + 1;
         ihit2 != hits.end(); ++ihit2 ) {
         if ( !keep[j] ) { j++; continue; }
         if ((*ihit)->geographicalId() == (*ihit2)->geographicalId() ) {
           if ( (*ihit)->dimension() > (*ihit2)->dimension() ) {
              keep[j] = false;
           } else if ( (*ihit)->dimension() < (*ihit2)->dimension() ) {
              keep[i] = false;
           } else  {
           if ( (*ihit)->transientHits().size()>(*ihit2)->transientHits().size() ) { 
              keep[j] = false;
           } else if ( (*ihit)->transientHits().size()<(*ihit2)->transientHits().size() ) {
              keep[i] = false;
           } 
            else if ( (*ihit)->degreesOfFreedom() != 0 && (*ihit2)->degreesOfFreedom() != 0)  {
            if (((*ihit)->chi2()/(*ihit)->degreesOfFreedom()) > ((*ihit2)->chi2()/(*ihit)->degreesOfFreedom())) keep[i] = false;
            else keep[j] = false;
           }
          }
         } // if same geomid 
      j++;
    }
    i++;
  }

  i = 0;
  for (MuonRecHitContainer::const_iterator ihit = hits.begin();
       ihit != hits.end(); ++ihit ) {
     if (keep[i] ) tmp.push_back(*ihit);
     i++;
  }

  hits.clear();
  hits.swap(tmp);

  return;

}
bool CosmicMuonTrajectoryBuilder::selfDuplicate ( const Trajectory traj) const [private]

check if the trajectory iterates the same hit more than once

Definition at line 669 of file CosmicMuonTrajectoryBuilder.cc.

References Trajectory::empty(), Trajectory::recHits(), and query::result.

Referenced by trajectories().

                                                                            {

  TransientTrackingRecHit::ConstRecHitContainer hits = traj.recHits();

  if (traj.empty()) return true;

  bool result = false;
  for (ConstRecHitContainer::const_iterator ir = hits.begin(); ir != hits.end(); ir++ ) {
    if ( !(*ir)->isValid() )  continue;
    for (ConstRecHitContainer::const_iterator ir2 = ir+1; ir2 != hits.end(); ir2++ ) {
      if ( !(*ir2)->isValid() )  continue;
      if ( (*ir) == (*ir2) ) result = true;
    }
  }

  return result;

}
void CosmicMuonTrajectoryBuilder::setEvent ( const edm::Event event) [virtual]

pass the Event to the algo at each event

Implements MuonTrajectoryBuilder.

Definition at line 114 of file CosmicMuonTrajectoryBuilder.cc.

References category_, LogTrace, MuonDetLayerMeasurements::setEvent(), theCacheId_DG, theLayerMeasurements, theNavigation, theNavigationPSet, and theService.

                                                                {

  theLayerMeasurements->setEvent(event);

  // DetLayer Geometry
  unsigned long long newCacheId_DG = theService->eventSetup().get<MuonRecoGeometryRecord>().cacheIdentifier();
  if ( newCacheId_DG != theCacheId_DG ) {
    LogTrace(category_) << "Muon Reco Geometry changed!";
    theCacheId_DG = newCacheId_DG;
    if (theNavigation) delete theNavigation;
    theNavigation = new DirectMuonNavigation(theService->detLayerGeometry(), theNavigationPSet);
  }

//  event.getByLabel("csc2DRecHits", cschits_);
//  event.getByLabel("dt1DRecHits", dthits_);

}
CosmicMuonSmoother* CosmicMuonTrajectoryBuilder::smoother ( ) const [inline]

Definition at line 70 of file CosmicMuonTrajectoryBuilder.h.

References theSmoother.

Referenced by utilities().

{return theSmoother;}
double CosmicMuonTrajectoryBuilder::t0 ( const DTRecSegment4D deseg) const

Definition at line 912 of file CosmicMuonTrajectoryBuilder.cc.

References category_, DTRecSegment4D::hasPhi(), DTRecSegment2D::ist0Valid(), LogTrace, DTRecSegment4D::phiSegment(), query::result, DTRecSegment2D::specificRecHits(), and DTRecSegment2D::t0().

Referenced by checkDirectionByT0().

                                                                        {

   if ( (dtseg == 0) || (!dtseg->hasPhi()) ) return 0;
   // timing information
   double result = 0;
   if ( dtseg->phiSegment() == 0 ) return 0; 
   int phiHits = dtseg->phiSegment()->specificRecHits().size();
   LogTrace(category_) << "phiHits " << phiHits;
   if ( phiHits > 5 ) {
     if(dtseg->phiSegment()->ist0Valid()) result = dtseg->phiSegment()->t0();
     if (dtseg->phiSegment()->ist0Valid()){
       LogTrace(category_) << " Phi t0: " << dtseg->phiSegment()->t0() << " hits: " << phiHits;
     } else {
       LogTrace(category_) << " Phi t0 is invalid: " << dtseg->phiSegment()->t0() << " hits: " << phiHits;
     }
   }

   return result;

}
virtual CandidateContainer CosmicMuonTrajectoryBuilder::trajectories ( const TrackCand ) [inline, virtual]

dummy implementation, unused in this class

Implements MuonTrajectoryBuilder.

Definition at line 53 of file CosmicMuonTrajectoryBuilder.h.

                                                            {
    return CandidateContainer();
  }
MuonTrajectoryBuilder::TrajectoryContainer CosmicMuonTrajectoryBuilder::trajectories ( const TrajectorySeed seed) [virtual]

build trajectories from seed

Implements MuonTrajectoryBuilder.

Definition at line 134 of file CosmicMuonTrajectoryBuilder.cc.

References alongMomentum, backwardUpdator(), PV3DBase< T, PVType, FrameType >::basicVector(), buildSecondHalf(), category_, Trajectory::chiSquared(), DirectMuonNavigation::compatibleEndcapLayers(), DirectMuonNavigation::compatibleLayers(), CSC(), debug, dir, Trajectory::direction(), GeomDetEnumerators::DT, MuonPatternRecoDumper::dumpLayer(), MuonPatternRecoDumper::dumpMuonId(), Trajectory::empty(), Reference_intrackfit_cff::endcap, estimateDirection(), ExpressReco_HICollisions_FallBack::estimator, MuonTrajectoryUpdator::estimator(), PV3DBase< T, PVType, FrameType >::eta(), findBestMeasurements(), Trajectory::firstMeasurement(), flipTrajectory(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), if(), incrementChamberCounters(), insideOut, Trajectory::isValid(), TrajectoryStateOnSurface::isValid(), Trajectory::lastMeasurement(), LogTrace, PV3DBase< T, PVType, FrameType >::mag(), Trajectory::measurements(), navigation(), oppositeToMomentum, outsideIn, Trajectory::pop(), propagator(), MuonDetLayerMeasurements::recHits(), TrajectoryStateOnSurface::rescaleError(), query::result, reverseTrajectoryPropagationDirection(), selfDuplicate(), MuonTrajectoryUpdator::setFitDirection(), TrajectorySeed::startingState(), matplotRender::t, theBKUpdator, theLayerMeasurements, theService, theSmoother, theStrict1LegFlag, theTraversingMuonFlag, CosmicMuonSmoother::trajectories(), unusedHits(), MuonTrajectoryUpdator::update(), TrajectoryMeasurement::updatedState(), updator(), utilities(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

                                                                    {

  vector<Trajectory*> trajL = vector<Trajectory*>();
  TrajectoryStateTransform tsTransform;
  MuonPatternRecoDumper debug;

  PTrajectoryStateOnDet ptsd1(seed.startingState());
  DetId did(ptsd1.detId());
  const BoundPlane& bp = theService->trackingGeometry()->idToDet(did)->surface();
  TrajectoryStateOnSurface lastTsos = tsTransform.transientState(ptsd1,&bp,&*theService->magneticField());
  LogTrace(category_) << "Seed: mom "<<lastTsos.globalMomentum()
                          <<"pos: " <<lastTsos.globalPosition();
  LogTrace(category_)  << "Seed: mom eta "<<lastTsos.globalMomentum().eta()
                          <<"pos eta: " <<lastTsos.globalPosition().eta();
  
  bool beamhaloFlag =  ( (did.subdetId() == MuonSubdetId::CSC) && fabs(lastTsos.globalMomentum().eta()) > 4.0);

  vector<const DetLayer*> navLayers;

  if (did.subdetId() == MuonSubdetId::DT) {
    //DT
    navLayers = navigation()->compatibleLayers(*(lastTsos.freeState()), alongMomentum);
  } 
  else if (beamhaloFlag || (theTraversingMuonFlag && theStrict1LegFlag)) {
    //CSC
    navLayers = navigation()->compatibleEndcapLayers(*(lastTsos.freeState()), alongMomentum);
  } else {
    navLayers = navigation()->compatibleLayers(*(lastTsos.freeState()), alongMomentum);
  }

  LogTrace(category_) <<"found "<<navLayers.size()<<" compatible DetLayers for the Seed";

  if (navLayers.empty()) return trajL;
  
  vector<DetWithState> detsWithStates;
  LogTrace(category_) << "Compatible layers: ";
  for ( vector<const DetLayer*>::const_iterator layer = navLayers.begin();
        layer != navLayers.end(); layer++) {
    LogTrace(category_) << debug.dumpMuonId((*layer)->basicComponents().front()->geographicalId()) 
                        << debug.dumpLayer(*layer);
  }

  detsWithStates = navLayers.front()->compatibleDets(lastTsos, *propagator(), *(updator()->estimator()));
  LogTrace(category_) << "Number of compatible dets: " << detsWithStates.size() << endl;

  if ( !detsWithStates.empty() ) {
    // get the updated TSOS
    if ( detsWithStates.front().second.isValid() ) {
      LogTrace(category_) << "New starting TSOS is on det: " << endl;
      LogTrace(category_) << debug.dumpMuonId(detsWithStates.front().first->geographicalId())
                        << debug.dumpLayer(navLayers.front());
      lastTsos = detsWithStates.front().second;
      LogTrace(category_) << "Seed after extrapolation: mom " << lastTsos.globalMomentum()
                          << "pos: " << lastTsos.globalPosition();
    }
  }
  detsWithStates.clear();
  if ( !lastTsos.isValid() ) return trajL;

  TrajectoryStateOnSurface secondLast = lastTsos;

  lastTsos.rescaleError(10.0);

  Trajectory* theTraj = new Trajectory(seed,alongMomentum);

  navLayers.clear();

  if (fabs(lastTsos.globalMomentum().eta()) < 1.0) {
    //DT
    navLayers = navigation()->compatibleLayers(*(lastTsos.freeState()), alongMomentum);
  } else if (beamhaloFlag || (theTraversingMuonFlag && theStrict1LegFlag)) {
    //CSC
    navLayers = navigation()->compatibleEndcapLayers(*(lastTsos.freeState()), alongMomentum);
  } else {
    navLayers = navigation()->compatibleLayers(*(lastTsos.freeState()), alongMomentum);
  }


  int DTChamberUsedBack = 0;
  int CSCChamberUsedBack = 0;
  int RPCChamberUsedBack = 0;
  int TotalChamberUsedBack = 0;
  MuonTransientTrackingRecHit::MuonRecHitContainer allUnusedHits;
  vector<TrajectoryMeasurement> measL;

  LogTrace(category_) << "Begin forward fit " << navLayers.size();

  for ( vector<const DetLayer*>::const_iterator rnxtlayer = navLayers.begin(); rnxtlayer!= navLayers.end(); ++rnxtlayer) {
     LogTrace(category_) << "new layer ";
     measL.clear();
     LogTrace(category_) << debug.dumpMuonId((*rnxtlayer)->basicComponents().front()->geographicalId())
                         << debug.dumpLayer(*rnxtlayer);
     LogTrace(category_) << "from lastTsos " << lastTsos.globalMomentum()<< " at " <<lastTsos.globalPosition();
 
     measL = findBestMeasurements(*rnxtlayer, lastTsos, propagator(), (updator()->estimator()));

     if ( measL.empty() &&  (fabs(theService->magneticField()->inTesla(GlobalPoint(0,0,0)).z()) < 0.01) && (theService->propagator("StraightLinePropagator").isValid() ) )  {
       LogTrace(category_) << "try straight line propagator ";
       measL = findBestMeasurements(*rnxtlayer, lastTsos, &*theService->propagator("StraightLinePropagator"), (updator()->estimator()));
     }
     if ( measL.empty() ) continue;

     for (vector<TrajectoryMeasurement>::const_iterator theMeas = measL.begin(); theMeas != measL.end(); ++theMeas) {
       pair<bool,TrajectoryStateOnSurface> result = updator()->update((&*theMeas), *theTraj, propagator());

       if (result.first ) {
         LogTrace(category_) << "update ok ";
         incrementChamberCounters((*rnxtlayer), DTChamberUsedBack, CSCChamberUsedBack, RPCChamberUsedBack, TotalChamberUsedBack);
         secondLast = lastTsos;
         if ( (!theTraj->empty()) && result.second.isValid() ) {
           lastTsos = result.second;
           LogTrace(category_) << "get new lastTsos here " << lastTsos.globalMomentum() << " at " << lastTsos.globalPosition();
         }  else if ((theMeas)->predictedState().isValid()) lastTsos = (theMeas)->predictedState();
       }
     }
  } 
  measL.clear();
  while (!theTraj->empty()) {
    theTraj->pop();
  }

  if (!theTraj->isValid() || TotalChamberUsedBack < 2 || (DTChamberUsedBack+CSCChamberUsedBack) == 0 || !lastTsos.isValid()) {
    delete theTraj;
    return trajL;
  }
  delete theTraj;


  // if got good trajectory, then do backward refitting
  DTChamberUsedBack = 0;
  CSCChamberUsedBack = 0;
  RPCChamberUsedBack = 0;
  TotalChamberUsedBack = 0;

  Trajectory myTraj(seed, oppositeToMomentum);

  // set starting navigation direction for MuonTrajectoryUpdator

  GlobalPoint lastPos = lastTsos.globalPosition();
  GlobalPoint secondLastPos = secondLast.globalPosition();
  GlobalVector momDir = secondLastPos - lastPos;

  if ( lastPos.basicVector().dot(momDir.basicVector()) > 0 ) { 
//      LogTrace("CosmicMuonTrajectoryBuilder")<<"Fit direction changed to insideOut";
      theBKUpdator->setFitDirection(insideOut);
    } else theBKUpdator->setFitDirection(outsideIn);

  if (fabs(lastTsos.globalMomentum().eta()) < 1.0) {
    //DT
    navLayers = navigation()->compatibleLayers(*(lastTsos.freeState()), oppositeToMomentum);
  } else if (beamhaloFlag || (theTraversingMuonFlag && theStrict1LegFlag)) {
    //CSC
    std::reverse(navLayers.begin(), navLayers.end());
  } else {
    navLayers = navigation()->compatibleLayers(*(lastTsos.freeState()), oppositeToMomentum);  
  } 

  LogTrace(category_) << "Begin backward refitting, with " << navLayers.size() << " layers" << endl;

  for (vector<const DetLayer*>::const_iterator rnxtlayer = navLayers.begin();
      rnxtlayer!= navLayers.end(); ++rnxtlayer) {

     measL.clear();

     measL = findBestMeasurements(*rnxtlayer, lastTsos, propagator(), (backwardUpdator()->estimator()));

     if ( measL.empty() ) {
         MuonTransientTrackingRecHit::MuonRecHitContainer tmpHits = theLayerMeasurements->recHits(*rnxtlayer);
         for (MuonRecHitContainer::const_iterator ihit = tmpHits.begin();
                                           ihit != tmpHits.end(); ++ihit ) {
         allUnusedHits.push_back(*ihit);
         } 
         continue;
      }

     for (vector<TrajectoryMeasurement>::const_iterator theMeas = measL.begin(); theMeas != measL.end(); ++theMeas) {

      // if the part change, we need to reconsider the fit direction
       if (rnxtlayer != navLayers.begin()) {

         vector<const DetLayer*>::const_iterator lastlayer = rnxtlayer;
         lastlayer--;

         if ( (*rnxtlayer)->location() != (*lastlayer)->location() ) {

           lastPos = lastTsos.globalPosition();
           GlobalPoint thisPos = (theMeas)->predictedState().globalPosition();
           GlobalVector momDir = thisPos - lastPos;
//         LogTrace("CosmicMuonTrajectoryBuilder")<<"momDir "<<momDir;
 
           if ( momDir.mag() > 0.01 ) { //if lastTsos is on the surface, no need
             if ( thisPos.basicVector().dot(momDir.basicVector()) > 0 ) {
               theBKUpdator->setFitDirection(insideOut);
             } else theBKUpdator->setFitDirection(outsideIn);
           }
         }
         if ( ((*lastlayer)->location() == GeomDetEnumerators::endcap) && 
              ((*rnxtlayer)->location() == GeomDetEnumerators::endcap) && 
              (lastTsos.globalPosition().z() * (theMeas)->predictedState().globalPosition().z() < 0)  ) {
           theBKUpdator->setFitDirection(insideOut);
         }
     }

//       if (theBKUpdator->fitDirection() == insideOut) 
//          LogTrace("CosmicMuonTrajectoryBuilder")<<"Fit direction insideOut";
//       else LogTrace("CosmicMuonTrajectoryBuilder")<<"Fit direction outsideIn";
         pair<bool,TrajectoryStateOnSurface> bkresult
              = backwardUpdator()->update((&*theMeas), myTraj, propagator());

         if (bkresult.first ) {

              incrementChamberCounters((*rnxtlayer), DTChamberUsedBack, CSCChamberUsedBack, RPCChamberUsedBack, TotalChamberUsedBack);

            if ( theTraversingMuonFlag ) {

              MuonRecHitContainer tmpUnusedHits = unusedHits(*rnxtlayer,*theMeas);
              allUnusedHits.insert(allUnusedHits.end(),tmpUnusedHits.begin(),tmpUnusedHits.end());
            }
            if ( (!myTraj.empty()) && bkresult.second.isValid() ) 
               lastTsos = bkresult.second;
            else if ((theMeas)->predictedState().isValid()) 
               lastTsos = (theMeas)->predictedState();
          }
       }
  }

  for ( vector<Trajectory*>::iterator t = trajL.begin(); t != trajL.end(); ++t ) delete *t;

  trajL.clear();

  if (( !myTraj.isValid() ) || ( myTraj.empty() ) || ( (selfDuplicate(myTraj)) )|| TotalChamberUsedBack < 2 || (DTChamberUsedBack+CSCChamberUsedBack) < 1) {
      return trajL;
  }

  if ( theTraversingMuonFlag && ( allUnusedHits.size() >= 2 )) { 
//      LogTrace(category_)<<utilities()->print(allUnusedHits);
      LogTrace(category_)<<"Building trajectory in second hemisphere...";
      buildSecondHalf(myTraj);
      // check if traversing trajectory has hits in both hemispheres

      if ( theStrict1LegFlag && !utilities()->isTraversing(myTraj) ) {trajL.clear(); return trajL;}
  } else if (theStrict1LegFlag && theTraversingMuonFlag) {trajL.clear(); return trajL;} 

  LogTrace(category_) <<" traj ok ";

//     getDirectionByTime(myTraj);
  if (beamhaloFlag) estimateDirection(myTraj);
  if ( myTraj.empty() ) return trajL;

  // try to smooth it 
  vector<Trajectory> smoothed = theSmoother->trajectories(myTraj); 

  if ( !smoothed.empty() && smoothed.front().foundHits()> 3 )  {  
    LogTrace(category_) <<" Smoothed successfully."; 
    myTraj = smoothed.front(); 
  } 
  else {  
    LogTrace(category_) <<" Smooth failed."; 
  } 

  LogTrace(category_) <<"first "<< myTraj.firstMeasurement().updatedState()
                      <<"\n last "<<myTraj.lastMeasurement().updatedState();
  if ( myTraj.direction() == alongMomentum ) LogTrace(category_)<<"alongMomentum";
  else if (myTraj.direction() == oppositeToMomentum ) LogTrace(category_)<<"oppositeMomentum";
  else LogTrace(category_)<<"anyDirection";

  if (!beamhaloFlag) {
      if ( myTraj.lastMeasurement().updatedState().globalMomentum().y() > 0 ) {
          LogTrace(category_)<<"flip trajectory ";
          flipTrajectory(myTraj);
      }

      if ( ( myTraj.direction() == alongMomentum && 
           (myTraj.firstMeasurement().updatedState().globalPosition().y() 
           < myTraj.lastMeasurement().updatedState().globalPosition().y()))
        || (myTraj.direction() == oppositeToMomentum && 
           (myTraj.firstMeasurement().updatedState().globalPosition().y() 
           > myTraj.lastMeasurement().updatedState().globalPosition().y())) ) {
           LogTrace(category_)<<"reverse propagation direction";
          reverseTrajectoryPropagationDirection(myTraj); 
      }
  }
//  getDirectionByTime(myTraj);
  if ( !myTraj.isValid() ) return trajL;

  // check direction agree with position!
  PropagationDirection dir = myTraj.direction();
  GlobalVector dirFromPos = myTraj.measurements().back().recHit()->globalPosition() - myTraj.measurements().front().recHit()->globalPosition();

  if ( theStrict1LegFlag && !utilities()->isTraversing(myTraj) ) {trajL.clear(); return trajL;}

  LogTrace(category_)<< "last hit " <<myTraj.measurements().back().recHit()->globalPosition()<<endl;
  LogTrace(category_)<< "first hit " <<myTraj.measurements().front().recHit()->globalPosition()<<endl;

  LogTrace(category_)<< "last tsos " <<myTraj.measurements().back().updatedState().globalPosition()<<" mom "<<myTraj.measurements().back().updatedState().globalMomentum()<<endl;
  LogTrace(category_)<< "first tsos " <<myTraj.measurements().front().updatedState().globalPosition()<<" mom "<<myTraj.measurements().front().updatedState().globalMomentum()<<endl;

  PropagationDirection propDir =
      ( dirFromPos.basicVector().dot(myTraj.firstMeasurement().updatedState().globalMomentum().basicVector()) > 0) ? alongMomentum : oppositeToMomentum;
  LogTrace(category_)<<" dir "<<dir <<" propDir "<<propDir<<endl;

  LogTrace(category_)<<"chi2 "<<myTraj.chiSquared() <<endl;

  if (dir != propDir ) {
      LogTrace(category_)<< "reverse propagation direction ";
      reverseTrajectoryPropagationDirection(myTraj);
  }
  if ( myTraj.empty() ) return trajL;

  trajL.push_back(new Trajectory(myTraj));
  navLayers.clear();
  return trajL;
}
MuonTransientTrackingRecHit::MuonRecHitContainer CosmicMuonTrajectoryBuilder::unusedHits ( const DetLayer layer,
const TrajectoryMeasurement meas 
) const [private]

Definition at line 453 of file CosmicMuonTrajectoryBuilder.cc.

References category_, LogTrace, TrajectoryMeasurement::recHit(), MuonDetLayerMeasurements::recHits(), query::result, and theLayerMeasurements.

Referenced by trajectories().

                                                                                                      {

  MuonTransientTrackingRecHit::MuonRecHitContainer tmpHits = theLayerMeasurements->recHits(layer);
  MuonRecHitContainer result;
  for (MuonRecHitContainer::const_iterator ihit = tmpHits.begin();
       ihit != tmpHits.end(); ++ihit ) {
       if ((*ihit)->geographicalId() != meas.recHit()->geographicalId() ){ 
         result.push_back(*ihit);
         LogTrace(category_) << "Unused hit: " << (*ihit)->globalPosition() << endl;
    }
  }

  return result;

}
MuonTrajectoryUpdator* CosmicMuonTrajectoryBuilder::updator ( ) const [inline]

Definition at line 66 of file CosmicMuonTrajectoryBuilder.h.

References theUpdator.

Referenced by build(), and trajectories().

{return theUpdator;}
CosmicMuonUtilities* CosmicMuonTrajectoryBuilder::utilities ( ) const [inline]

Member Data Documentation

Definition at line 139 of file CosmicMuonTrajectoryBuilder.h.

Referenced by getDirectionByTime().

Definition at line 140 of file CosmicMuonTrajectoryBuilder.h.

Referenced by getDirectionByTime().

unsigned long long CosmicMuonTrajectoryBuilder::theCacheId_DG [private]

Definition at line 138 of file CosmicMuonTrajectoryBuilder.h.

Referenced by CosmicMuonTrajectoryBuilder(), and setEvent().

Definition at line 118 of file CosmicMuonTrajectoryBuilder.h.

Referenced by CosmicMuonTrajectoryBuilder(), and setEvent().

Definition at line 129 of file CosmicMuonTrajectoryBuilder.h.

Referenced by CosmicMuonTrajectoryBuilder(), and propagator().

Definition at line 132 of file CosmicMuonTrajectoryBuilder.h.

Referenced by build(), CosmicMuonTrajectoryBuilder(), and trajectories().

Definition at line 131 of file CosmicMuonTrajectoryBuilder.h.

Referenced by build(), CosmicMuonTrajectoryBuilder(), and trajectories().