CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TrackTransformerForGlobalCosmicMuons Class Reference

#include <TrackTransformerForGlobalCosmicMuons.h>

Inheritance diagram for TrackTransformerForGlobalCosmicMuons:
TrackTransformerBase

List of all members.

Public Member Functions

edm::ESHandle< TrajectoryFitterfitter (bool) const
 the refitter used to refit the reco::Track
TransientTrackingRecHit::ConstRecHitContainer getTransientRecHits (const reco::TransientTrack &track) const
const MagneticFieldmagneticField () const
 the magnetic field
bool MuonKeep (DetId id) const
 check (via options) if this is a muon rec hit for removal
virtual void setServices (const edm::EventSetup &)
 set the services needed by the TrackTransformer
edm::ESHandle< TrajectorySmoothersmoother (bool) const
 the smoother used to smooth the trajectory which came from the refitting step
bool TrackerKeep (DetId id) const
 check (via options) if this is a tracker rec hit for removal
edm::ESHandle
< GlobalTrackingGeometry
trackingGeometry () const
 the tracking geometry
 TrackTransformerForGlobalCosmicMuons (const edm::ParameterSet &)
 Constructor.
virtual std::vector< Trajectorytransform (const reco::Track &) const
 Convert a reco::Track into Trajectory.
virtual ~TrackTransformerForGlobalCosmicMuons ()
 Destructor.

Private Member Functions

edm::ESHandle< Propagatorpropagator (bool) const

Private Attributes

unsigned long long theCacheId_GTG
unsigned long long theCacheId_MG
unsigned long long theCacheId_TC
unsigned long long theCacheId_TRH
edm::ESHandle< TrajectoryFittertheFitterIO
edm::ESHandle< TrajectoryFittertheFitterOI
edm::ESHandle< MagneticFieldtheMGField
edm::ESHandle
< TransientTrackingRecHitBuilder
theMuonRecHitBuilder
std::string theMuonRecHitBuilderName
edm::ESHandle< PropagatorthePropagatorIO
edm::ESHandle< PropagatorthePropagatorOI
bool theRPCInTheFit
int theSkipStationCSC
int theSkipStationDT
int theSkipWheelDT
edm::ESHandle< TrajectorySmoothertheSmootherIO
edm::ESHandle< TrajectorySmoothertheSmootherOI
edm::ESHandle
< TransientTrackingRecHitBuilder
theTrackerRecHitBuilder
std::string theTrackerRecHitBuilderName
int theTrackerSkipSection
int theTrackerSkipSystem
edm::ESHandle
< GlobalTrackingGeometry
theTrackingGeometry
const TrackerTopologytTopo_

Detailed Description

Definition at line 40 of file TrackTransformerForGlobalCosmicMuons.h.


Constructor & Destructor Documentation

TrackTransformerForGlobalCosmicMuons::TrackTransformerForGlobalCosmicMuons ( const edm::ParameterSet parameterSet)

Constructor.

Definition at line 37 of file TrackTransformerForGlobalCosmicMuons.cc.

References edm::ParameterSet::getParameter().

                                                                                                          {
  
  theTrackerRecHitBuilderName = parameterSet.getParameter<string>("TrackerRecHitBuilder");
  theMuonRecHitBuilderName = parameterSet.getParameter<string>("MuonRecHitBuilder");

  theRPCInTheFit = parameterSet.getParameter<bool>("RefitRPCHits");

  theCacheId_TC = theCacheId_GTG = theCacheId_MG = theCacheId_TRH = 0;
  theSkipStationDT      = parameterSet.getParameter<int>("SkipStationDT");
  theSkipStationCSC     = parameterSet.getParameter<int>("SkipStationCSC");
  theSkipWheelDT                = parameterSet.getParameter<int>("SkipWheelDT");
  theTrackerSkipSystem  = parameterSet.getParameter<int>("TrackerSkipSystem");
  theTrackerSkipSection = parameterSet.getParameter<int>("TrackerSkipSection");//layer, wheel, or disk depending on the system 
}
TrackTransformerForGlobalCosmicMuons::~TrackTransformerForGlobalCosmicMuons ( ) [virtual]

Destructor.

Definition at line 53 of file TrackTransformerForGlobalCosmicMuons.cc.

{}

Member Function Documentation

ESHandle< TrajectoryFitter > TrackTransformerForGlobalCosmicMuons::fitter ( bool  up) const

the refitter used to refit the reco::Track

Definition at line 663 of file TkLasBeamFitter.cc.

References asciidump::at, TkLasBeamFitter::atFunction(), cuy::col, TkLasBeamFitter::fitBeamSplitters_, TkLasBeamFitter::gBSparam, TkLasBeamFitter::gHitZprime, fitWZ::gMinuit, TkLasBeam::isAlignmentTube(), TkLasBeam::isTecInternal(), TkLasBeamFitter::tecMinusFunction(), and TkLasBeamFitter::tecPlusFunction().

{
  TGraphErrors *lasData = new TGraphErrors(gHitZprime.size(), 
                                           &(gHitZprime[0]), &(hitPhi[0]), 
                                           &(hitZprimeError[0]), &(hitPhiError[0]));
  
  // do fit (R = entire range)
  if(beam.isTecInternal(1)){
    TF1 tecPlus("tecPlus", tecPlusFunction, zMin, zMax, nFitParams );
    tecPlus.SetParameter( 1, 0 ); // slope
    tecPlus.SetParameter( nFitParams - 1, 0 ); // BS 
    lasData->Fit("tecPlus", "R"); // "R", "RV" or "RQ"
  }
  else if(beam.isTecInternal(-1)){
    TF1 tecMinus("tecMinus", tecMinusFunction, zMin, zMax, nFitParams );
    tecMinus.SetParameter( 1, 0 ); // slope
    tecMinus.SetParameter( nFitParams - 1, 0 ); // BS 
    lasData->Fit("tecMinus", "R");
  }
  else{
    TF1 at("at", atFunction, zMin, zMax, nFitParams );
    at.SetParameter( 1, 0 ); // slope
    at.SetParameter( nFitParams - 1, 0 ); // BS 
    lasData->Fit("at","R");
  }
  
  // get values and errors for offset and slope
  gMinuit->GetParameter(0, offset, offsetError);
  gMinuit->GetParameter(1, slope, slopeError);

  // additional AT parameters
  // define param errors that are not used later
  double bsAngleParamError(0.), phiAtMinusParamError(0.),
    phiAtPlusParamError(0.), atThetaSplitParamError(0.);

  if(beam.isAlignmentTube()){
    gMinuit->GetParameter(2, phiAtMinusParam, phiAtMinusParamError);
    gMinuit->GetParameter(3, phiAtPlusParam, phiAtPlusParamError);
    gMinuit->GetParameter(4, atThetaSplitParam, atThetaSplitParamError);
  }
  // get Beam Splitter parameters
  if(fitBeamSplitters_){
    if(beam.isAlignmentTube() && hitsAtTecPlus == 0){
      bsAngleParam = gBSparam;
    }
    else{
      gMinuit->GetParameter( nFitParams - 1 , bsAngleParam, bsAngleParamError);
    }
  }
  else{
    bsAngleParam = gBSparam;
  }

  // fill covariance matrix
  vector<double> vec( covMatrix.num_col() * covMatrix.num_col() );
  gMinuit->mnemat( &vec[0], covMatrix.num_col() );
  for(int col = 0; col < covMatrix.num_col(); col++){
    for(int row = 0; row < covMatrix.num_col(); row++){
      covMatrix[col][row] = vec[row + covMatrix.num_col()*col];
    }
  }
  // compute correlation between parameters
//   double corr01 = covMatrix[1][0]/(offsetError*slopeError);

  delete lasData;
}
TransientTrackingRecHit::ConstRecHitContainer TrackTransformerForGlobalCosmicMuons::getTransientRecHits ( const reco::TransientTrack track) const

Definition at line 108 of file TrackTransformerForGlobalCosmicMuons.cc.

References filterCSVwithJSON::copy, CSC(), CSCDetId, DetId::det(), GeomDetEnumerators::DT, LogTrace, DetId::Muon, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, reco::TransientTrack::recHitsBegin(), reco::TransientTrack::recHitsEnd(), dedefs::RPC, RPCDetId, DetId::subdetId(), sistripsummary::TEC, sistripsummary::TIB, sistripsummary::TID, sistripsummary::TOB, align::Tracker, and DetId::Tracker.

                                                                                               {

  TransientTrackingRecHit::ConstRecHitContainer tkHits;
  TransientTrackingRecHit::ConstRecHitContainer staHits;

  for (trackingRecHit_iterator hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit) {
    if((*hit)->isValid()) {
      if ( (*hit)->geographicalId().det() == DetId::Tracker && TrackerKeep((*hit)->geographicalId())) {
                tkHits.push_back(theTrackerRecHitBuilder->build(&**hit));
      } else if ( (*hit)->geographicalId().det() == DetId::Muon && MuonKeep((*hit)->geographicalId())){
                if( (*hit)->geographicalId().subdetId() == 3 && !theRPCInTheFit){
                LogTrace("Reco|TrackingTools|TrackTransformer") << "RPC Rec Hit discarged"; 
                continue;
                }
                staHits.push_back(theMuonRecHitBuilder->build(&**hit));
      }
    }
  }
  
  if(staHits.empty()) return staHits;

/*
  bool up = staHits.front()->globalPosition().y()>0 ? true : false;

  if(up){
    reverse(staHits.begin(),staHits.end());
    reverse(tkHits.begin(),tkHits.end());
  }
*/
  copy(staHits.begin(),staHits.end(),back_inserter(tkHits));

  for(TransientTrackingRecHit::ConstRecHitContainer::const_iterator hit = tkHits.begin();
      hit !=tkHits.end(); ++hit){

    DetId hitId = (*hit)->geographicalId();
    GlobalPoint glbpoint = trackingGeometry()->idToDet(hitId)->position();

    if(hitId.det() == DetId::Tracker) {
      if (hitId.subdetId() == StripSubdetector::TIB )  
        LogTrace("TrackFitters") << glbpoint << " I am TIB " << tTopo_->tibLayer(hitId);
      else if (hitId.subdetId() == StripSubdetector::TOB ) 
        LogTrace("TrackFitters") << glbpoint << " I am TOB " << tTopo_->tobLayer(hitId);
      else if (hitId.subdetId() == StripSubdetector::TEC ) 
        LogTrace("TrackFitters") << glbpoint << " I am TEC " << tTopo_->tecWheel(hitId);
      else if (hitId.subdetId() == StripSubdetector::TID ) 
        LogTrace("TrackFitters") << glbpoint << " I am TID " << tTopo_->tidWheel(hitId);
      else if (hitId.subdetId() == (int) PixelSubdetector::PixelBarrel ) 
        LogTrace("TrackFitters") << glbpoint << " I am PixBar " << tTopo_->pxbLayer(hitId);
      else if (hitId.subdetId() == (int) PixelSubdetector::PixelEndcap )
        LogTrace("TrackFitters") << glbpoint << " I am PixFwd " << tTopo_->pxfDisk(hitId);
      else 
        LogTrace("TrackFitters") << " UNKNOWN TRACKER HIT TYPE ";
    } else if(hitId.det() == DetId::Muon) {
      if(hitId.subdetId() == MuonSubdetId::DT)
        LogTrace("TrackFitters") << glbpoint << " I am DT " << DTWireId(hitId);
      else if (hitId.subdetId() == MuonSubdetId::CSC )
        LogTrace("TrackFitters") << glbpoint << " I am CSC " << CSCDetId(hitId);
      else if (hitId.subdetId() == MuonSubdetId::RPC )
        LogTrace("TrackFitters") << glbpoint << " I am RPC " << RPCDetId(hitId);
      else 
        LogTrace("TrackFitters") << " UNKNOWN MUON HIT TYPE ";
    } else
      LogTrace("TrackFitters") << " UNKNOWN HIT TYPE ";
  } 
  
  return tkHits;
}
const MagneticField* TrackTransformerForGlobalCosmicMuons::magneticField ( ) const [inline]

the magnetic field

Definition at line 56 of file TrackTransformerForGlobalCosmicMuons.h.

References theMGField.

{return &*theMGField;}
bool TrackTransformerForGlobalCosmicMuons::MuonKeep ( DetId  id) const

check (via options) if this is a muon rec hit for removal

Definition at line 272 of file TrackTransformerForGlobalCosmicMuons.cc.

References MuonSubdetId::CSC, MuonSubdetId::DT, DetId::Muon, MuonSubdetId::RPC, relativeConstraints::station, RPCDetId::station(), DTChamberId::station(), CSCDetId::station(), and DTChamberId::wheel().

                                                                  {

        if (id.det() != DetId::Muon) return false;
        if (theSkipStationDT < 0 && theSkipStationCSC < 0) return true;

        int station = -999;
        int wheel       = -999;
        bool isRPC      = false;
        bool isDT       = false;
        bool isCSC      = false;
                
    if ( id.subdetId() == MuonSubdetId::DT ) {
                DTChamberId did(id.rawId());
                station = did.station();
                wheel = did.wheel();
                isDT = true;
    } else if ( id.subdetId() == MuonSubdetId::CSC ) {
                CSCDetId did(id.rawId());
                station = did.station();
                isCSC = true;
    } else if ( id.subdetId() == MuonSubdetId::RPC ) {
                RPCDetId rpcid(id.rawId());
                station = rpcid.station();
                isRPC = true;
    }
        
        if (isRPC       && (station     == theSkipStationCSC || station == theSkipStationDT)) return false;
        if (isDT        && station      == theSkipStationDT             ) return false;
        if (isCSC       && station      == theSkipStationCSC    ) return false;

        if (isDT && theSkipWheelDT > -998 && wheel == theSkipWheelDT) return false;
        
        return true;
}
ESHandle< Propagator > TrackTransformerForGlobalCosmicMuons::propagator ( bool  up) const [private]

Definition at line 132 of file MuonServiceProxy.cc.

                                                                               {
  
  propagators::const_iterator prop = thePropagators.find(propagatorName);
  
  if (prop == thePropagators.end()){
    LogError("Muon|RecoMuon|MuonServiceProxy") 
      << "MuonServiceProxy: propagator with name: "<< propagatorName <<" not found! Please load it in the MuonServiceProxy.cff"; 
    return ESHandle<Propagator>(0);
  }
  
  return prop->second;
}
void TrackTransformerForGlobalCosmicMuons::setServices ( const edm::EventSetup setup) [virtual]

set the services needed by the TrackTransformer

Implements TrackTransformerBase.

Definition at line 56 of file TrackTransformerForGlobalCosmicMuons.cc.

References edm::EventSetup::get(), LogTrace, metname, edm::ESHandle< T >::product(), and AlCaHLTBitMon_QueryRunRegistry::string.

                                                                             {
  
  const std::string metname = "Reco|TrackingTools|TrackTransformer";

  setup.get<TrajectoryFitter::Record>().get("KFFitterForRefitInsideOut",theFitterIO);
  setup.get<TrajectoryFitter::Record>().get("KFSmootherForRefitInsideOut",theSmootherIO);
  setup.get<TrajectoryFitter::Record>().get("KFFitterForRefitOutsideIn",theFitterOI);
  setup.get<TrajectoryFitter::Record>().get("KFSmootherForRefitOutsideIn",theSmootherOI);
  
  unsigned long long newCacheId_TC = setup.get<TrackingComponentsRecord>().cacheIdentifier();

  if ( newCacheId_TC != theCacheId_TC ){
    LogTrace(metname) << "Tracking Component changed!";
    theCacheId_TC = newCacheId_TC;
    setup.get<TrackingComponentsRecord>().get("SmartPropagatorRK",thePropagatorIO);
    setup.get<TrackingComponentsRecord>().get("SmartPropagatorRKOpposite",thePropagatorOI);

  }

  // Global Tracking Geometry
  unsigned long long newCacheId_GTG = setup.get<GlobalTrackingGeometryRecord>().cacheIdentifier();
  if ( newCacheId_GTG != theCacheId_GTG ) {
    LogTrace(metname) << "GlobalTrackingGeometry changed!";
    theCacheId_GTG = newCacheId_GTG;
    setup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry); 
  }
  
  // Magfield Field
  unsigned long long newCacheId_MG = setup.get<IdealMagneticFieldRecord>().cacheIdentifier();
  if ( newCacheId_MG != theCacheId_MG ) {
    LogTrace(metname) << "Magnetic Field changed!";
    theCacheId_MG = newCacheId_MG;
    setup.get<IdealMagneticFieldRecord>().get(theMGField);
  }
  
  // Transient Rechit Builders
  unsigned long long newCacheId_TRH = setup.get<TransientRecHitRecord>().cacheIdentifier();
  if ( newCacheId_TRH != theCacheId_TRH ) {
    theCacheId_TRH = newCacheId_TRH;
    LogTrace(metname) << "TransientRecHitRecord changed!";
    setup.get<TransientRecHitRecord>().get(theTrackerRecHitBuilderName,theTrackerRecHitBuilder);
    setup.get<TransientRecHitRecord>().get(theMuonRecHitBuilderName,theMuonRecHitBuilder);
  }

  //Retrieve tracker topology from geometry
  edm::ESHandle<TrackerTopology> tTopoHand;
  setup.get<IdealGeometryRecord>().get(tTopoHand);
  tTopo_=tTopoHand.product();
}
ESHandle< TrajectorySmoother > TrackTransformerForGlobalCosmicMuons::smoother ( bool  up) const

the smoother used to smooth the trajectory which came from the refitting step

Definition at line 184 of file TrackTransformerForGlobalCosmicMuons.cc.

                                                                                        {
  if(up) return theSmootherOI;
  else return theSmootherIO;
}
bool TrackTransformerForGlobalCosmicMuons::TrackerKeep ( DetId  id) const

check (via options) if this is a tracker rec hit for removal

Definition at line 254 of file TrackTransformerForGlobalCosmicMuons.cc.

References DetId::Tracker.

                                                                    {
        
  if (id.det() != DetId::Tracker ) return false;
  if (theTrackerSkipSystem < 0 ) return true;
  bool retVal = true;

  int layer = -999;
  
  if ( id.subdetId() == theTrackerSkipSystem)
    layer=tTopo_->layer(id);
  
  if (theTrackerSkipSection > -998 && layer == theTrackerSkipSection) retVal = false;
  
  return retVal;
}
edm::ESHandle<GlobalTrackingGeometry> TrackTransformerForGlobalCosmicMuons::trackingGeometry ( ) const [inline]

the tracking geometry

Definition at line 59 of file TrackTransformerForGlobalCosmicMuons.h.

References theTrackingGeometry.

vector< Trajectory > TrackTransformerForGlobalCosmicMuons::transform ( const reco::Track tr) const [virtual]

Convert a reco::Track into Trajectory.

Convert Tracks into Trajectories.

Implements TrackTransformerBase.

Definition at line 197 of file TrackTransformerForGlobalCosmicMuons.cc.

References alongMomentum, reco::TransientTrack::innermostMeasurementState(), LogTrace, metname, oppositeToMomentum, reco::TransientTrack::outermostMeasurementState(), LargeD0_PixelPairStep_cff::propagator, AlCaHLTBitMon_QueryRunRegistry::string, and reco::TransientTrack::track().

                                                                                            {

  const std::string metname = "Reco|TrackingTools|TrackTransformer";
  
  reco::TransientTrack track(tr,magneticField(),trackingGeometry());   

  // Build the transient Rechits
  TransientTrackingRecHit::ConstRecHitContainer recHitsForReFit = getTransientRecHits(track);

  if(recHitsForReFit.size() < 2) return vector<Trajectory>();

  bool up = recHitsForReFit.back()->globalPosition().y()>0 ? true : false;
  LogTrace(metname) << "Up ? " << up;

  PropagationDirection propagationDirection = up ? oppositeToMomentum : alongMomentum;
  TrajectoryStateOnSurface firstTSOS = up ? track.outermostMeasurementState() : track.innermostMeasurementState();
  unsigned int innerId = up ? track.track().outerDetId() : track.track().innerDetId();

  LogTrace(metname) << "Prop Dir: " << propagationDirection << " FirstId " << innerId << " firstTSOS " << firstTSOS;

  TrajectorySeed seed(PTrajectoryStateOnDet(),TrajectorySeed::recHitContainer(),propagationDirection);


  if(recHitsForReFit.front()->geographicalId() != DetId(innerId)){
    LogTrace(metname)<<"Propagation occurring"<<endl;
    firstTSOS = propagator(up)->propagate(firstTSOS, recHitsForReFit.front()->det()->surface());
    LogTrace(metname)<<"Final destination: " << recHitsForReFit.front()->det()->surface().position() << endl;
    if(!firstTSOS.isValid()){
      LogTrace(metname)<<"Propagation error!"<<endl;
      return vector<Trajectory>();
    }
  }
  

  vector<Trajectory> trajectories = fitter(up)->fit(seed,recHitsForReFit,firstTSOS);
  
  if(trajectories.empty()){
    LogTrace(metname)<<"No Track refitted!"<<endl;
    return vector<Trajectory>();
  }
  
  Trajectory trajectoryBW = trajectories.front();
    
  vector<Trajectory> trajectoriesSM = smoother(up)->trajectories(trajectoryBW);

  if(trajectoriesSM.empty()){
    LogTrace(metname)<<"No Track smoothed!"<<endl;
    return vector<Trajectory>();
  }
  
  return trajectoriesSM;

}

Member Data Documentation

Definition at line 89 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 90 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 88 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 91 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 103 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 104 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 101 of file TrackTransformerForGlobalCosmicMuons.h.

Referenced by magneticField().

Definition at line 113 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 112 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 82 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 83 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 93 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 95 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 94 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 96 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 106 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 107 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 110 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 109 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 98 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 97 of file TrackTransformerForGlobalCosmicMuons.h.

Definition at line 100 of file TrackTransformerForGlobalCosmicMuons.h.

Referenced by trackingGeometry().

Definition at line 115 of file TrackTransformerForGlobalCosmicMuons.h.