CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

muonisolation::PixelTrackExtractor Class Reference

#include <PixelTrackExtractor.h>

Inheritance diagram for muonisolation::PixelTrackExtractor:
reco::isodeposit::IsoDepositExtractor

List of all members.

Public Member Functions

virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const
virtual void fillVetos (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackCollection &track)
 PixelTrackExtractor ()
 PixelTrackExtractor (const edm::ParameterSet &par)
virtual reco::IsoDeposit::Vetos vetos (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
virtual ~PixelTrackExtractor ()

Private Member Functions

reco::isodeposit::Direction directionAtPresetRadius (const reco::Track &tk, double bz) const
reco::IsoDeposit::Veto veto (const reco::IsoDeposit::Direction &dir) const

Private Attributes

std::string theBeamlineOption
 Veto cone angle.
edm::InputTag theBeamSpotLabel
 "NONE", "BeamSpotFromEvent"
double theChi2Ndof_Max
 trk.numberOfValidHits >= theNHits_Min
double theChi2Prob_Min
 trk.normalizedChi2 < theChi2Ndof_Max
std::string theDepositLabel
 Track Collection Label.
double theDiff_r
 name for deposit
double theDiff_z
 transverse distance to vertex
double theDR_Max
 z distance to vertex
double theDR_Veto
 Maximum cone angle for deposits.
double theDR_VetoPt
 .. it is above this threshold
unsigned int theNHits_Min
 BeamSpot name.
bool thePropagateTracksToRadius
 min track pt to include into iso deposit
double thePt_Min
 ChiSquaredProbability(trk.chi2,trk.ndof) > theChi2Prob_Min.
double thePtVeto_Min
 will veto leading track if
double theReferenceRadius
 If set to true will compare track eta-phi at ...
edm::InputTag theTrackCollectionTag
bool theVetoLeadingTrack
 ... this radius

Detailed Description

Definition at line 15 of file PixelTrackExtractor.h.


Constructor & Destructor Documentation

muonisolation::PixelTrackExtractor::PixelTrackExtractor ( ) [inline]

Definition at line 19 of file PixelTrackExtractor.h.

{};
PixelTrackExtractor::PixelTrackExtractor ( const edm::ParameterSet par)

Definition at line 24 of file PixelTrackExtractor.cc.

                                                                  :
  theTrackCollectionTag(par.getParameter<edm::InputTag>("inputTrackCollection")),
  theDepositLabel(par.getUntrackedParameter<string>("DepositLabel")),
  theDiff_r(par.getParameter<double>("Diff_r")),
  theDiff_z(par.getParameter<double>("Diff_z")),
  theDR_Max(par.getParameter<double>("DR_Max")),
  theDR_Veto(par.getParameter<double>("DR_Veto")),
  theBeamlineOption(par.getParameter<string>("BeamlineOption")),
  theBeamSpotLabel(par.getParameter<edm::InputTag>("BeamSpotLabel")),
  theNHits_Min(par.getParameter<unsigned int>("NHits_Min")),
  theChi2Ndof_Max(par.getParameter<double>("Chi2Ndof_Max")),
  theChi2Prob_Min(par.getParameter<double>("Chi2Prob_Min")),
  thePt_Min(par.getParameter<double>("Pt_Min")),
  thePropagateTracksToRadius(par.getParameter<bool>("PropagateTracksToRadius")),
  theReferenceRadius(par.getParameter<double>("ReferenceRadius")),
  theVetoLeadingTrack(par.getParameter<bool>("VetoLeadingTrack")), 
  thePtVeto_Min(par.getParameter<double>("PtVeto_Min")),           
  theDR_VetoPt(par.getParameter<double>("DR_VetoPt"))              
{
}
virtual muonisolation::PixelTrackExtractor::~PixelTrackExtractor ( ) [inline, virtual]

Definition at line 22 of file PixelTrackExtractor.h.

{}

Member Function Documentation

IsoDeposit PixelTrackExtractor::deposit ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Track track 
) const [virtual]

make single IsoDeposit based on track as input purely virtual: have to implement in concrete implementations

Note, this can be reset below if theVetoLeadingTrack is set and conditions are met

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 76 of file PixelTrackExtractor.cc.

References reco::IsoDeposit::addCandEnergy(), reco::IsoDeposit::addDeposit(), SiPixelRawToDigiRegional_cfi::beamSpot, ecalTB2006H4_GenSimDigiReco_cfg::bField, deltaR(), directionAtPresetRadius(), reco::TrackBase::eta(), reco::isodeposit::Direction::eta(), edm::EventSetup::get(), edm::HandleBase::isValid(), LogTrace, metname, reco::isodeposit::Direction::phi(), reco::TrackBase::phi(), reco::TrackBase::pt(), corrVsCorr::selection, reco::IsoDeposit::setVeto(), AlCaHLTBitMon_QueryRunRegistry::string, theBeamlineOption, theBeamSpotLabel, theChi2Ndof_Max, theChi2Prob_Min, theDiff_r, theDiff_z, theDR_Max, theDR_VetoPt, theNHits_Min, thePt_Min, thePtVeto_Min, theTrackCollectionTag, theVetoLeadingTrack, veto(), and reco::TrackBase::vz().

{
  static std::string metname = "MuonIsolation|PixelTrackExtractor";

  edm::ESHandle<MagneticField> bField;
  eventSetup.get<IdealMagneticFieldRecord>().get(bField);
  double bz = bField->inInverseGeV(GlobalPoint(0.,0.,0.)).z();

  Direction muonDir(directionAtPresetRadius(muon, bz));
  IsoDeposit deposit(muonDir );
  deposit.setVeto( veto(muonDir) );

  deposit.addCandEnergy(muon.pt());

  Handle<View<Track> > tracksH;
  event.getByLabel(theTrackCollectionTag, tracksH);
  //  const TrackCollection tracks = *(tracksH.product());
  LogTrace(metname)<<"***** TRACK COLLECTION SIZE: "<<tracksH->size();

  double vtx_z = muon.vz();
  LogTrace(metname)<<"***** Muon vz: "<<vtx_z;
  reco::TrackBase::Point beamPoint(0,0, 0);

  if (theBeamlineOption.compare("BeamSpotFromEvent") == 0){
    //pick beamSpot
    reco::BeamSpot beamSpot;
    edm::Handle<reco::BeamSpot> beamSpotH;

    event.getByLabel(theBeamSpotLabel,beamSpotH);

    if (beamSpotH.isValid()){
      beamPoint = beamSpotH->position();
      LogTrace(metname)<<"Extracted beam point at "<<beamPoint<<std::endl;
    }
  }

  LogTrace(metname)<<"Using beam point at "<<beamPoint<<std::endl;

  TrackSelector::Parameters pars(TrackSelector::Range(vtx_z-theDiff_z, vtx_z+theDiff_z),
                                 theDiff_r, muonDir, theDR_Max, beamPoint);

  pars.nHitsMin = theNHits_Min;
  pars.chi2NdofMax = theChi2Ndof_Max;
  pars.chi2ProbMin = theChi2Prob_Min;
  pars.ptMin = thePt_Min;

  TrackSelector selection(pars);
  TrackSelector::result_type sel_tracks = selection(*tracksH);
  LogTrace(metname)<<"all tracks: "<<tracksH->size()<<" selected: "<<sel_tracks.size();

  
  double maxPt = -1;
  Direction maxPtDir;
  TrackSelector::result_type::const_iterator tkI = sel_tracks.begin();
  for (; tkI != sel_tracks.end(); ++tkI) {
    const reco::Track* tk = *tkI;
    LogTrace(metname) << "This track has: pt= " << tk->pt() << ", eta= " 
        << tk->eta() <<", phi= "<<tk->phi();
    Direction dirTrk(directionAtPresetRadius(*tk, bz));
    deposit.addDeposit(dirTrk, tk->pt());
    double tkDr = (muonDir-dirTrk).deltaR;
    double tkPt = tk->pt();
    if (theVetoLeadingTrack && tkPt > thePtVeto_Min 
        && tkDr < theDR_VetoPt  
        && maxPt < tkPt ){
      maxPt = tkPt;
      maxPtDir = dirTrk;
    }
  }
  if (maxPt > 0){
    deposit.setVeto(veto(maxPtDir));
    LogTrace(metname)<<" Set track veto the leading track with pt "
                     <<maxPt<<" in direction  (eta,phi) "
                     <<maxPtDir.eta()<<", "<<maxPtDir.phi();
  }

  return deposit;
}
Direction PixelTrackExtractor::directionAtPresetRadius ( const reco::Track tk,
double  bz 
) const [private]

Definition at line 60 of file PixelTrackExtractor.cc.

References reco::TrackBase::charge(), dPhi(), reco::TrackBase::dxy(), reco::TrackBase::eta(), reco::TrackBase::phi(), reco::TrackBase::pt(), mathSSE::sqrt(), thePropagateTracksToRadius, and theReferenceRadius.

Referenced by deposit().

                                                                                       {
  if (! thePropagateTracksToRadius ){
    return Direction(tk.eta(), tk.phi());
  }

  // this should represent a cylinder in global frame at R=refRadius cm, roughly where mid-layer of pixels is
  double psRadius = theReferenceRadius;
  double tkDxy = tk.dxy();
  double s2D = fabs(tk.dxy()) < psRadius ? sqrt(psRadius*psRadius - tkDxy*tkDxy) : 0;

  // the field we get from the caller is already in units of GeV/cm
  double dPhi = -s2D*tk.charge()*bz/tk.pt();

  return Direction(tk.eta(), tk.phi()+dPhi);
}
virtual void muonisolation::PixelTrackExtractor::fillVetos ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::TrackCollection tracks 
) [inline, virtual]

fill vetoes: to exclude deposits at IsoDeposit creation stage check concrete extractors if it's no-op !

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 24 of file PixelTrackExtractor.h.

                                                                        {}
reco::IsoDeposit::Veto PixelTrackExtractor::veto ( const reco::IsoDeposit::Direction dir) const [private]
reco::IsoDeposit::Vetos PixelTrackExtractor::vetos ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Track track 
) const [virtual]

Definition at line 45 of file PixelTrackExtractor.cc.

References dir, reco::TrackBase::eta(), reco::TrackBase::phi(), and veto().

{
  Direction dir(track.eta(),track.phi());
  return reco::IsoDeposit::Vetos(1,veto(dir));
}

Member Data Documentation

Veto cone angle.

Definition at line 45 of file PixelTrackExtractor.h.

Referenced by deposit().

"NONE", "BeamSpotFromEvent"

Definition at line 46 of file PixelTrackExtractor.h.

Referenced by deposit().

trk.numberOfValidHits >= theNHits_Min

Definition at line 48 of file PixelTrackExtractor.h.

Referenced by deposit().

trk.normalizedChi2 < theChi2Ndof_Max

Definition at line 49 of file PixelTrackExtractor.h.

Referenced by deposit().

Track Collection Label.

Definition at line 40 of file PixelTrackExtractor.h.

name for deposit

Definition at line 41 of file PixelTrackExtractor.h.

Referenced by deposit().

transverse distance to vertex

Definition at line 42 of file PixelTrackExtractor.h.

Referenced by deposit().

z distance to vertex

Definition at line 43 of file PixelTrackExtractor.h.

Referenced by deposit().

Maximum cone angle for deposits.

Definition at line 44 of file PixelTrackExtractor.h.

Referenced by veto().

.. it is above this threshold

Definition at line 57 of file PixelTrackExtractor.h.

Referenced by deposit().

BeamSpot name.

Definition at line 47 of file PixelTrackExtractor.h.

Referenced by deposit().

min track pt to include into iso deposit

Definition at line 52 of file PixelTrackExtractor.h.

Referenced by directionAtPresetRadius().

ChiSquaredProbability(trk.chi2,trk.ndof) > theChi2Prob_Min.

Definition at line 50 of file PixelTrackExtractor.h.

Referenced by deposit().

will veto leading track if

Definition at line 56 of file PixelTrackExtractor.h.

Referenced by deposit().

If set to true will compare track eta-phi at ...

Definition at line 53 of file PixelTrackExtractor.h.

Referenced by directionAtPresetRadius().

Definition at line 39 of file PixelTrackExtractor.h.

Referenced by deposit().

... this radius

Definition at line 55 of file PixelTrackExtractor.h.

Referenced by deposit().