CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MuonTrackingRegionBuilder Class Reference

#include <MuonTrackingRegionBuilder.h>

List of all members.

Public Member Functions

void init (const MuonServiceProxy *)
 MuonTrackingRegionBuilder (const edm::ParameterSet &par, const MuonServiceProxy *service)
 MuonTrackingRegionBuilder (const edm::ParameterSet &)
 constructor
RectangularEtaPhiTrackingRegionregion (const reco::TrackRef &) const
 define tracking region
RectangularEtaPhiTrackingRegionregion (const reco::Track &) const
 define tracking region
virtual void setEvent (const edm::Event &)
 pass the Event to the algo at each event
virtual ~MuonTrackingRegionBuilder ()
 destructor

Private Member Functions

void build (const edm::ParameterSet &)

Private Attributes

edm::InputTag theBeamSpotTag
double theDeltaR
double theEtaFixed
double theEtaMin
double theEtaRegionPar1
double theEtaRegionPar2
const edm::EventtheEvent
double theHalfZ
std::string theMeasurementTrackerName
double theNsigmaDz
double theNsigmaEta
double theNsigmaPhi
double theOnDemand
double thePhiFixed
double thePhiMin
double thePhiRegionPar1
double thePhiRegionPar2
const MuonServiceProxytheService
double theTkEscapePt
edm::InputTag theVertexCollTag
GlobalPoint theVertexPos
bool useFixedRegion
bool useVertex

Detailed Description

Build a TrackingRegion around a standalone muon

Date:
2010/09/06 18:41:59
Revision:
1.11
Author:
A. Everett - Purdue University
A. Grelli - Purdue University, Pavia University

Definition at line 30 of file MuonTrackingRegionBuilder.h.


Constructor & Destructor Documentation

MuonTrackingRegionBuilder::MuonTrackingRegionBuilder ( const edm::ParameterSet par)

constructor

Definition at line 43 of file MuonTrackingRegionBuilder.cc.

References newFWLiteAna::build.

{
  build(par);
}
MuonTrackingRegionBuilder::MuonTrackingRegionBuilder ( const edm::ParameterSet par,
const MuonServiceProxy service 
) [inline]

Definition at line 36 of file MuonTrackingRegionBuilder.h.

References build(), and init().

                                                             { build(par);init(service);}
virtual MuonTrackingRegionBuilder::~MuonTrackingRegionBuilder ( ) [inline, virtual]

destructor

Definition at line 41 of file MuonTrackingRegionBuilder.h.

{}

Member Function Documentation

void MuonTrackingRegionBuilder::build ( const edm::ParameterSet par) [private]

Definition at line 47 of file MuonTrackingRegionBuilder.cc.

References edm::ParameterSet::getParameter().

Referenced by MuonTrackingRegionBuilder().

                                                               {
  // vertex Collection and Beam Spot
  theBeamSpotTag = par.getParameter<edm::InputTag>("beamSpot");
  theVertexCollTag = par.getParameter<edm::InputTag>("vertexCollection");

  // parmeters
  theNsigmaEta  = par.getParameter<double>("Rescale_eta");
  theNsigmaPhi  = par.getParameter<double>("Rescale_phi");
  theNsigmaDz   = par.getParameter<double>("Rescale_Dz");
  theTkEscapePt = par.getParameter<double>("EscapePt");

  // upper limits parameters   
  theEtaRegionPar1 = par.getParameter<double>("EtaR_UpperLimit_Par1"); 
  theEtaRegionPar2 = par.getParameter<double>("EtaR_UpperLimit_Par2");
  thePhiRegionPar1 = par.getParameter<double>("PhiR_UpperLimit_Par1");
  thePhiRegionPar2 = par.getParameter<double>("PhiR_UpperLimit_Par2");

  useVertex = par.getParameter<bool>("UseVertex");
  useFixedRegion = par.getParameter<bool>("UseFixedRegion");

  // fixed limits
  thePhiFixed = par.getParameter<double>("Phi_fixed");
  theEtaFixed = par.getParameter<double>("Eta_fixed");

  thePhiMin = par.getParameter<double>("Phi_min");
  theEtaMin = par.getParameter<double>("Eta_min");
  theHalfZ  = par.getParameter<double>("DeltaZ_Region");
  theDeltaR = par.getParameter<double>("DeltaR");

  // perigee reference point

  theOnDemand = par.getParameter<double>("OnDemand");
  theMeasurementTrackerName = par.getParameter<std::string>("MeasurementTrackerName");
}
void MuonTrackingRegionBuilder::init ( const MuonServiceProxy *  service)
RectangularEtaPhiTrackingRegion * MuonTrackingRegionBuilder::region ( const reco::TrackRef track) const
RectangularEtaPhiTrackingRegion * MuonTrackingRegionBuilder::region ( const reco::Track staTrack) const

define tracking region

Definition at line 108 of file MuonTrackingRegionBuilder.cc.

References deltaR(), eta(), PerigeeConversions::ftsToPerigeeError(), TrajectoryStateTransform::initialFreeState(), reco::Track::innerMomentum(), TrajectoryStateClosestToBeamLine::isValid(), LogDebug, max(), min, ExpressReco_HICollisions_FallBack::minPt, FreeTrajectoryState::momentum(), reco::TrackBase::p(), phi, PerigeeTrajectoryError::phiError(), ExpressReco_HICollisions_FallBack::pt, funct::sin(), theta(), PV3DBase< T, PVType, FrameType >::theta(), PerigeeTrajectoryError::thetaError(), TrajectoryStateClosestToBeamLine::trackStateAtPCA(), ExpressReco_HICollisions_FallBack::vertexCollection, reco::BeamSpot::x0(), reco::BeamSpot::y0(), and reco::BeamSpot::z0().

                                                                 {

  // get the free trajectory state of the muon updated at vertex
  TSCPBuilderNoMaterial tscpBuilder; 
  TrajectoryStateTransform tsTransform;
  FreeTrajectoryState muFTS = tsTransform.initialFreeState(staTrack,&*theService->magneticField());

  LogDebug("MuonTrackingRegionBuilder")<<"from state: "<<muFTS;

  // get track direction at vertex
  GlobalVector dirVector(muFTS.momentum());

  // get track momentum
  const math::XYZVector& mo = staTrack.innerMomentum();
  GlobalVector mom(mo.x(),mo.y(),mo.z());
  if ( staTrack.p() > 1.5 ) {
    mom = dirVector; 
  }

  // initial vertex position -  in the following it is replaced with beam spot/vertexing
  GlobalPoint vertexPos(0.0,0.0,0.0);
  double deltaZatVTX = 0.0;

  // retrieve beam spot information
  edm::Handle<reco::BeamSpot> bsHandle;
  bool bsHandleFlag = theEvent->getByLabel(theBeamSpotTag, bsHandle);
  // check the validity, otherwise vertexing
  // inizialization of BS

  if ( bsHandleFlag && !useVertex ) {
    const reco::BeamSpot& bs =  *bsHandle;
    vertexPos = GlobalPoint(bs.x0(), bs.y0(), bs.z0());
  } else {
    // get originZPos from list of reconstructed vertices (first or all)
    edm::Handle<reco::VertexCollection> vertexCollection;
    bool vtxHandleFlag = theEvent->getByLabel(theVertexCollTag,vertexCollection);
    // check if there exists at least one reconstructed vertex
    if ( vtxHandleFlag && !vertexCollection->empty() ) {
      // use the first vertex in the collection and assume it is the primary event vertex 
      reco::VertexCollection::const_iterator vtx = vertexCollection->begin();
      vertexPos = GlobalPoint(0.0,0.0,vtx->z());
      // delta Z from vertex error
      deltaZatVTX = vtx->zError() * theNsigmaDz;
    }
  }


 // inizialize to the maximum possible value to avoit 
 // problems with TSCBL

  double deta = 0.4;
  double dphi = 0.6;

  // take into account the correct beanspot rotation
  if ( bsHandleFlag ) {

  const reco::BeamSpot& bs =  *bsHandle;

  TSCBLBuilderNoMaterial tscblBuilder;
  TrajectoryStateClosestToBeamLine tscbl = tscblBuilder(muFTS,bs);

 
    // evaluate the dynamical region if possible
    if(tscbl.isValid()){

      PerigeeConversions tspConverter;
      PerigeeTrajectoryError trackPerigeeErrors = tspConverter.ftsToPerigeeError(tscbl.trackStateAtPCA());
      GlobalVector pTrack = tscbl.trackStateAtPCA().momentum();

    // calculate deltaEta from deltaTheta
      double deltaTheta = trackPerigeeErrors.thetaError();
      double theta      = pTrack.theta();
      double sin_theta  = sin(theta);

    // get dEta and dPhi
      deta = theNsigmaEta*(1/fabs(sin_theta))*deltaTheta;
      dphi = theNsigmaPhi*(trackPerigeeErrors.phiError());

    }
 }

  /* Region_Parametrizations to take into account possible 
     L2 error matrix inconsistencies. Detailed Explanation in TWIKI
     page.
  */
  double region_dEta = 0;
  double region_dPhi = 0;
  double eta=0; double phi=0;

  // eta, pt parametrization from MC study
  float pt = fabs(mom.perp());

  if ( pt <= 10. ) {
     // angular coefficients
     float acoeff_Phi = (thePhiRegionPar2 - thePhiRegionPar1)/5;
     float acoeff_Eta = (theEtaRegionPar2 - theEtaRegionPar1)/5;

     eta = theEtaRegionPar1 + (acoeff_Eta)*(mom.perp()-5.);
     phi = thePhiRegionPar1 + (acoeff_Phi)*(mom.perp()-5.) ;
   }
   // parametrization 2nd bin in pt from MC study  
   if ( pt > 10. && pt < 100. ) {
     eta = theEtaRegionPar2;
     phi = thePhiRegionPar2;
   }
   // parametrization 3rd bin in pt from MC study
   if ( pt >= 100. ) {
     // angular coefficients
     float acoeff_Phi = (thePhiRegionPar1 - thePhiRegionPar2)/900;
     float acoeff_Eta = (theEtaRegionPar1 - theEtaRegionPar2)/900;

     eta = theEtaRegionPar2 + (acoeff_Eta)*(mom.perp()-100.);
     phi = thePhiRegionPar2 + (acoeff_Phi)*(mom.perp()-100.);
   }

  // decide to use either a parametrization or a dynamical region
  double region_dPhi1 = min(phi,dphi);
  double region_dEta1 = min(eta,deta);

  // minimum size
  region_dPhi = max(thePhiMin,region_dPhi1);
  region_dEta = max(theEtaMin,region_dEta1);

  float deltaZ = 0.0;
  // standard 15.9 is useVertex than region from vertexing
  if ( useVertex ) {
    deltaZ = deltaZatVTX;
  } else { 
    deltaZ = theHalfZ;
  }

  float deltaR = theDeltaR;
  double minPt = max(theTkEscapePt,mom.perp()*0.6);

  RectangularEtaPhiTrackingRegion* region = 0;  

  if (useFixedRegion) {
     region_dEta = theEtaFixed;
     region_dPhi = thePhiFixed;
  }

  region = new RectangularEtaPhiTrackingRegion(dirVector, vertexPos,
                                               minPt, deltaR,
                                               deltaZ, region_dEta, region_dPhi,
                                               theOnDemand,
                                               true,/*default in the header*/
                                               theMeasurementTrackerName);

  LogDebug("MuonTrackingRegionBuilder")<<"the region parameters are:\n"
                                       <<"\n dirVector: "<<dirVector
                                       <<"\n vertexPos: "<<vertexPos
                                       <<"\n minPt: "<<minPt
                                       <<"\n deltaR:"<<deltaR
                                       <<"\n deltaZ:"<<deltaZ
                                       <<"\n region_dEta:"<<region_dEta
                                       <<"\n region_dPhi:"<<region_dPhi
                                       <<"\n on demand parameter: "<<theOnDemand;

  
  return region;
  
}
void MuonTrackingRegionBuilder::setEvent ( const edm::Event event) [virtual]

Member Data Documentation

Definition at line 55 of file MuonTrackingRegionBuilder.h.

Definition at line 74 of file MuonTrackingRegionBuilder.h.

Definition at line 75 of file MuonTrackingRegionBuilder.h.

Definition at line 73 of file MuonTrackingRegionBuilder.h.

Definition at line 67 of file MuonTrackingRegionBuilder.h.

Definition at line 68 of file MuonTrackingRegionBuilder.h.

Definition at line 58 of file MuonTrackingRegionBuilder.h.

Definition at line 74 of file MuonTrackingRegionBuilder.h.

Definition at line 80 of file MuonTrackingRegionBuilder.h.

Definition at line 65 of file MuonTrackingRegionBuilder.h.

Definition at line 65 of file MuonTrackingRegionBuilder.h.

Definition at line 65 of file MuonTrackingRegionBuilder.h.

Definition at line 79 of file MuonTrackingRegionBuilder.h.

Definition at line 75 of file MuonTrackingRegionBuilder.h.

Definition at line 72 of file MuonTrackingRegionBuilder.h.

Definition at line 69 of file MuonTrackingRegionBuilder.h.

Definition at line 70 of file MuonTrackingRegionBuilder.h.

Definition at line 59 of file MuonTrackingRegionBuilder.h.

Definition at line 64 of file MuonTrackingRegionBuilder.h.

Definition at line 56 of file MuonTrackingRegionBuilder.h.

Definition at line 77 of file MuonTrackingRegionBuilder.h.

Definition at line 61 of file MuonTrackingRegionBuilder.h.

Definition at line 62 of file MuonTrackingRegionBuilder.h.