CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions
BPHTrackReference Class Reference

#include <BPHTrackReference.h>

Public Types

typedef pat::PackedCandidate candidate
 

Public Member Functions

 BPHTrackReference ()
 
 ~BPHTrackReference ()
 

Static Public Member Functions

static const reco::TrackgetElecPF (const reco::Candidate &rc)
 
static const reco::TrackgetElecPF (const pat::Electron *el)
 
static const reco::TrackgetFromBT (const reco::Candidate &rc)
 
static const reco::TrackgetFromGP (const reco::Candidate &rc)
 
static const reco::TrackgetFromPC (const reco::Candidate &rc)
 
static const reco::TrackgetFromPF (const reco::Candidate &rc)
 
static const reco::TrackgetFromRC (const reco::Candidate &rc)
 
static const reco::TrackgetMuonBT (const reco::Candidate &rc)
 
static const reco::TrackgetMuonBT (const reco::Muon *mu)
 
static const reco::TrackgetMuonGT (const reco::Candidate &rc)
 
static const reco::TrackgetMuonGT (const pat::Muon *mu)
 
static const reco::TrackgetMuonIT (const reco::Candidate &rc)
 
static const reco::TrackgetMuonIT (const pat::Muon *mu)
 
static const reco::TrackgetMuonPF (const reco::Candidate &rc)
 
static const reco::TrackgetMuonPF (const pat::Muon *mu)
 
static const reco::TrackgetMuonSA (const reco::Candidate &rc)
 
static const reco::TrackgetMuonSA (const pat::Muon *mu)
 
static const reco::TrackgetTrack (const reco::Candidate &rc, const char *modeList="cfhbpmnigse", char *modeFlag=0)
 

Private Member Functions

 BPHTrackReference (const BPHTrackReference &x)
 
BPHTrackReferenceoperator= (const BPHTrackReference &x)
 

Detailed Description

Description: class to have uniform access to reco::Track for different particle objects

Author
Paolo Ronchese INFN Padova

Definition at line 38 of file BPHTrackReference.h.

Member Typedef Documentation

Definition at line 42 of file BPHTrackReference.h.

Constructor & Destructor Documentation

BPHTrackReference::BPHTrackReference ( )

Constructor

Referenced by getElecPF().

BPHTrackReference::~BPHTrackReference ( )

Destructor

BPHTrackReference::BPHTrackReference ( const BPHTrackReference x)
private

Member Function Documentation

static const reco::Track* BPHTrackReference::getElecPF ( const reco::Candidate rc)
inlinestatic

Definition at line 235 of file BPHTrackReference.h.

235  {
236 // std::cout << "getElecPF" << std::endl;
237  const pat::Electron* el = dynamic_cast<const pat::Electron*>( &rc );
238  if ( el == 0 ) return 0;
239  return getElecPF( el );
240  }
Analysis-level electron class.
Definition: Electron.h:52
static const reco::Track * getElecPF(const reco::Candidate &rc)
static const reco::Track* BPHTrackReference::getElecPF ( const pat::Electron el)
inlinestatic

Definition at line 241 of file BPHTrackReference.h.

References BPHTrackReference(), MillePedeFileConverter_cfg::e, edm::Ref< C, T, F >::get(), edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNonnull(), operator=(), pat::Electron::pfCandidateRef(), and x.

241  {
242  try {
243  const reco::PFCandidateRef& pcr = el->pfCandidateRef();
244  if ( pcr.isNonnull() && pcr.isAvailable() ) {
245  const reco::TrackRef& tkr = pcr->trackRef();
246  if ( tkr.isNonnull() && tkr.isAvailable() ) return tkr.get();
247  }
248  }
249  catch ( edm::Exception e ) {
250  }
251  return 0;
252  }
bool isAvailable() const
Definition: Ref.h:576
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
reco::PFCandidateRef pfCandidateRef() const
reference to the source PFCandidates; null if this has been built from a standard electron ...
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
static const reco::Track* BPHTrackReference::getFromBT ( const reco::Candidate rc)
inlinestatic

Definition at line 131 of file BPHTrackReference.h.

References reco::Candidate::bestTrack(), and MillePedeFileConverter_cfg::e.

131  {
132 // std::cout << "getFromBT" << std::endl;
133  try {
134  const reco::Track* trk = rc.bestTrack();
135  return trk;
136  }
137  catch ( edm::Exception e ) {
138  }
139  return 0;
140  }
virtual const Track * bestTrack() const
Definition: Candidate.h:247
static const reco::Track* BPHTrackReference::getFromGP ( const reco::Candidate rc)
inlinestatic

Definition at line 118 of file BPHTrackReference.h.

References MillePedeFileConverter_cfg::e, edm::Ref< C, T, F >::get(), runTauDisplay::gp, edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNonnull(), and pat::GenericParticle::track().

118  {
119 // std::cout << "getFromGC" << std::endl;
120  const pat::GenericParticle* gp =
121  dynamic_cast<const pat::GenericParticle*>( &rc );
122  if ( gp == 0 ) return 0;
123  try {
124  const reco::TrackRef& tkr = gp->track();
125  if ( tkr.isNonnull() && tkr.isAvailable() ) return tkr.get();
126  }
127  catch ( edm::Exception e ) {
128  }
129  return 0;
130  }
bool isAvailable() const
Definition: Ref.h:576
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
Analysis-level Generic Particle class (e.g. for hadron or muon not fully reconstructed) ...
virtual reco::TrackRef track() const
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
static const reco::Track* BPHTrackReference::getFromPC ( const reco::Candidate rc)
inlinestatic

Definition at line 141 of file BPHTrackReference.h.

References MillePedeFileConverter_cfg::e, createTree::pp, and pat::PackedCandidate::pseudoTrack().

141  {
142 // std::cout << "getFromPC" << std::endl;
143  const pat::PackedCandidate* pp =
144  dynamic_cast<const pat::PackedCandidate*>( &rc );
145  if ( pp == 0 ) return 0;
146  try {
147  const reco::Track* trk = &pp->pseudoTrack();
148  return trk;
149  }
150  catch ( edm::Exception e ) {
151  }
152  return 0;
153  }
virtual const reco::Track & pseudoTrack() const
Return reference to a pseudo track made with candidate kinematics, parameterized error for eta...
static const reco::Track* BPHTrackReference::getFromPF ( const reco::Candidate rc)
inlinestatic

Definition at line 105 of file BPHTrackReference.h.

References MillePedeFileConverter_cfg::e, edm::Ref< C, T, F >::get(), edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNonnull(), packedPFCandidateRefMixer_cfi::pf, and reco::PFCandidate::trackRef().

Referenced by BPHRecoBuilder::sameTrack().

105  {
106 // std::cout << "getFromPF" << std::endl;
107  const reco::PFCandidate* pf =
108  dynamic_cast<const reco::PFCandidate*>( &rc );
109  if ( pf == 0 ) return 0;
110  try {
111  const reco::TrackRef& tkr = pf->trackRef();
112  if ( tkr.isNonnull() && tkr.isAvailable() ) return tkr.get();
113  }
114  catch ( edm::Exception e ) {
115  }
116  return 0;
117  }
bool isAvailable() const
Definition: Ref.h:576
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:438
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
static const reco::Track* BPHTrackReference::getFromRC ( const reco::Candidate rc)
inlinestatic

Definition at line 95 of file BPHTrackReference.h.

References MillePedeFileConverter_cfg::e, reco::Candidate::get(), edm::Ref< C, T, F >::get(), edm::Ref< C, T, F >::isAvailable(), and edm::Ref< C, T, F >::isNonnull().

Referenced by BPHRecoBuilder::sameTrack().

95  {
96 // std::cout << "getFromRC" << std::endl;
97  try {
98  const reco::TrackRef& tkr = rc.get<reco::TrackRef>();
99  if ( tkr.isNonnull() && tkr.isAvailable() ) return tkr.get();
100  }
101  catch ( edm::Exception e ) {
102  }
103  return 0;
104  }
bool isAvailable() const
Definition: Ref.h:576
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
T get() const
get a component
Definition: Candidate.h:217
static const reco::Track* BPHTrackReference::getMuonBT ( const reco::Candidate rc)
inlinestatic

Definition at line 172 of file BPHTrackReference.h.

References RPCpg::mu.

172  {
173 // std::cout << "getMuonBT" << std::endl;
174  const reco::Muon* mu = dynamic_cast<const reco::Muon*>( &rc );
175  if ( mu == 0 ) return 0;
176  return getMuonBT( mu );
177  }
const int mu
Definition: Constants.h:22
static const reco::Track * getMuonBT(const reco::Candidate &rc)
static const reco::Track* BPHTrackReference::getMuonBT ( const reco::Muon mu)
inlinestatic

Definition at line 178 of file BPHTrackReference.h.

References MillePedeFileConverter_cfg::e, edm::Ref< C, T, F >::get(), edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNonnull(), and reco::Muon::muonBestTrack().

178  {
179  try {
180  const reco::TrackRef& tkr = mu->muonBestTrack();
181  if ( tkr.isNonnull() && tkr.isAvailable() ) return tkr.get();
182  }
183  catch ( edm::Exception e ) {
184  }
185  return 0;
186  }
bool isAvailable() const
Definition: Ref.h:576
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
virtual TrackRef muonBestTrack() const
Definition: Muon.h:63
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
static const reco::Track* BPHTrackReference::getMuonGT ( const reco::Candidate rc)
inlinestatic

Definition at line 203 of file BPHTrackReference.h.

References RPCpg::mu.

203  {
204 // std::cout << "getMuonGT" << std::endl;
205  const pat::Muon* mu = dynamic_cast<const pat::Muon*>( &rc );
206  if ( mu == 0 ) return 0;
207  return getMuonGT( mu );
208  }
static const reco::Track * getMuonGT(const reco::Candidate &rc)
const int mu
Definition: Constants.h:22
Analysis-level muon class.
Definition: Muon.h:49
static const reco::Track* BPHTrackReference::getMuonGT ( const pat::Muon mu)
inlinestatic

Definition at line 209 of file BPHTrackReference.h.

References MillePedeFileConverter_cfg::e, edm::Ref< C, T, F >::get(), pat::Muon::globalTrack(), edm::Ref< C, T, F >::isAvailable(), reco::Muon::isGlobalMuon(), and edm::Ref< C, T, F >::isNonnull().

209  {
210  if ( !mu->isGlobalMuon() ) return 0;
211  try {
212  const reco::TrackRef& mgt = mu->globalTrack();
213  if ( mgt.isNonnull() && mgt.isAvailable() ) return mgt.get();
214  }
215  catch ( edm::Exception e ) {
216  }
217  return 0;
218  }
bool isAvailable() const
Definition: Ref.h:576
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
bool isGlobalMuon() const
Definition: Muon.h:225
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
reco::TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon) ...
Definition: Muon.h:80
static const reco::Track* BPHTrackReference::getMuonIT ( const reco::Candidate rc)
inlinestatic

Definition at line 187 of file BPHTrackReference.h.

References RPCpg::mu.

187  {
188 // std::cout << "getMuonIT" << std::endl;
189  const pat::Muon* mu = dynamic_cast<const pat::Muon*>( &rc );
190  if ( mu == 0 ) return 0;
191  return getMuonIT( mu );
192  }
static const reco::Track * getMuonIT(const reco::Candidate &rc)
const int mu
Definition: Constants.h:22
Analysis-level muon class.
Definition: Muon.h:49
static const reco::Track* BPHTrackReference::getMuonIT ( const pat::Muon mu)
inlinestatic

Definition at line 193 of file BPHTrackReference.h.

References MillePedeFileConverter_cfg::e, edm::Ref< C, T, F >::get(), pat::Muon::innerTrack(), edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNonnull(), and reco::Muon::isTrackerMuon().

193  {
194  if ( !mu->isTrackerMuon() ) return 0;
195  try {
196  const reco::TrackRef& mit = mu->innerTrack();
197  if ( mit.isNonnull() && mit.isAvailable() ) return mit.get();
198  }
199  catch ( edm::Exception e ) {
200  }
201  return 0;
202  }
bool isAvailable() const
Definition: Ref.h:576
reco::TrackRef innerTrack() const
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
Definition: Muon.h:72
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
bool isTrackerMuon() const
Definition: Muon.h:226
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
static const reco::Track* BPHTrackReference::getMuonPF ( const reco::Candidate rc)
inlinestatic

Definition at line 154 of file BPHTrackReference.h.

References RPCpg::mu.

154  {
155 // std::cout << "getMuonPF" << std::endl;
156  const pat::Muon* mu = dynamic_cast<const pat::Muon*>( &rc );
157  if ( mu == 0 ) return 0;
158  return getMuonPF( mu );
159  }
static const reco::Track * getMuonPF(const reco::Candidate &rc)
const int mu
Definition: Constants.h:22
Analysis-level muon class.
Definition: Muon.h:49
static const reco::Track* BPHTrackReference::getMuonPF ( const pat::Muon mu)
inlinestatic

Definition at line 160 of file BPHTrackReference.h.

References MillePedeFileConverter_cfg::e, edm::Ref< C, T, F >::get(), edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNonnull(), and pat::Muon::pfCandidateRef().

160  {
161  try {
162  const reco::PFCandidateRef& pcr = mu->pfCandidateRef();
163  if ( pcr.isNonnull() && pcr.isAvailable() ) {
164  const reco::TrackRef& tkr = pcr->trackRef();
165  if ( tkr.isNonnull() && tkr.isAvailable() ) return tkr.get();
166  }
167  }
168  catch ( edm::Exception e ) {
169  }
170  return 0;
171  }
bool isAvailable() const
Definition: Ref.h:576
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
reco::PFCandidateRef pfCandidateRef() const
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
static const reco::Track* BPHTrackReference::getMuonSA ( const reco::Candidate rc)
inlinestatic

Definition at line 219 of file BPHTrackReference.h.

References RPCpg::mu.

219  {
220 // std::cout << "getMuonGT" << std::endl;
221  const pat::Muon* mu = dynamic_cast<const pat::Muon*>( &rc );
222  if ( mu == 0 ) return 0;
223  return getMuonSA( mu );
224  }
static const reco::Track * getMuonSA(const reco::Candidate &rc)
const int mu
Definition: Constants.h:22
Analysis-level muon class.
Definition: Muon.h:49
static const reco::Track* BPHTrackReference::getMuonSA ( const pat::Muon mu)
inlinestatic

Definition at line 225 of file BPHTrackReference.h.

References MillePedeFileConverter_cfg::e, edm::Ref< C, T, F >::get(), edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNonnull(), reco::Muon::isStandAloneMuon(), and pat::Muon::standAloneMuon().

225  {
226  if ( !mu->isStandAloneMuon() ) return 0;
227  try {
228  const reco::TrackRef& msa = mu->standAloneMuon();
229  if ( msa.isNonnull() && msa.isAvailable() ) return msa.get();
230  }
231  catch ( edm::Exception e ) {
232  }
233  return 0;
234  }
bool isAvailable() const
Definition: Ref.h:576
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
bool isStandAloneMuon() const
Definition: Muon.h:227
reco::TrackRef standAloneMuon() const
reference to Track reconstructed in the muon detector only (reimplemented from reco::Muon) ...
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
static const reco::Track* BPHTrackReference::getTrack ( const reco::Candidate rc,
const char *  modeList = "cfhbpmnigse",
char *  modeFlag = 0 
)
inlinestatic

Operationsget associated reco::Track calling a sequence of functions until a track is found; the list of functions to call is given as a string where each character identify a function: c : reco :: Candidate :: get<reco::TrackRef> () f : reco :: PFCandidate :: trackRef () h : pat :: GenericParticle :: track () b : reco :: Candidate :: bestTrack () p : pat :: PackedCandidate :: pseudoTrack () m : pat :: Muon :: pfCandidateRef () n : pat :: Muon :: muonBestTrack () i : pat :: Muon :: innerTrack () g : pat :: Muon :: globalTrack () s : pat :: Muon :: standAloneMuon () e : pat :: Electron :: pfCandidateRef ()

Definition at line 68 of file BPHTrackReference.h.

Referenced by BPHDecayVertex::tTracks().

70  {
71  if ( rc.charge() == 0 ) return 0;
72  const char* mptr = modeList;
73  char c;
74  if ( modeFlag == 0 ) modeFlag = &c;
75  char& mode = *modeFlag;
76  const reco::Track* tkp = 0;
77  while ( ( mode = *mptr++ ) ) {
78  switch ( mode ) {
79  case 'c': if ( ( tkp = getFromRC( rc ) ) != 0 ) return tkp; break;
80  case 'f': if ( ( tkp = getFromPF( rc ) ) != 0 ) return tkp; break;
81  case 'h': if ( ( tkp = getFromGP( rc ) ) != 0 ) return tkp; break;
82  case 'b': if ( ( tkp = getFromBT( rc ) ) != 0 ) return tkp; break;
83  case 'p': if ( ( tkp = getFromPC( rc ) ) != 0 ) return tkp; break;
84  case 'm': if ( ( tkp = getMuonPF( rc ) ) != 0 ) return tkp; break;
85  case 'n': if ( ( tkp = getMuonBT( rc ) ) != 0 ) return tkp; break;
86  case 'i': if ( ( tkp = getMuonIT( rc ) ) != 0 ) return tkp; break;
87  case 'g': if ( ( tkp = getMuonGT( rc ) ) != 0 ) return tkp; break;
88  case 's': if ( ( tkp = getMuonSA( rc ) ) != 0 ) return tkp; break;
89  case 'e': if ( ( tkp = getElecPF( rc ) ) != 0 ) return tkp; break;
90  }
91  }
92  return 0;
93  }
static const reco::Track * getMuonPF(const reco::Candidate &rc)
static const reco::Track * getFromPF(const reco::Candidate &rc)
static const reco::Track * getMuonSA(const reco::Candidate &rc)
static const reco::Track * getFromRC(const reco::Candidate &rc)
static const reco::Track * getMuonIT(const reco::Candidate &rc)
static const reco::Track * getMuonGT(const reco::Candidate &rc)
static const reco::Track * getElecPF(const reco::Candidate &rc)
virtual int charge() const =0
electric charge
static const reco::Track * getFromPC(const reco::Candidate &rc)
static const reco::Track * getFromGP(const reco::Candidate &rc)
static const reco::Track * getMuonBT(const reco::Candidate &rc)
static const reco::Track * getFromBT(const reco::Candidate &rc)
BPHTrackReference& BPHTrackReference::operator= ( const BPHTrackReference x)
private

Referenced by getElecPF().