CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

reco::TrackJet Class Reference

Jets made out of tracks. More...

#include <TrackJet.h>

Inheritance diagram for reco::TrackJet:
reco::Jet reco::CompositePtrCandidate reco::LeafCandidate reco::Candidate

List of all members.

Public Member Functions

virtual TrackJetclone () const
 Polymorphic clone.
bool fromHardVertex () const
 check jet to be associated to the hard primary vertex
size_t numberOfTracks () const
 Number of track daughters.
const reco::VertexRef primaryVertex () const
 get associated primary vertex
virtual std::string print () const
 Print object.
void resetCharge ()
 calculate and set the charge by adding up the constituting track charges
void setPrimaryVertex (const reco::VertexRef &vtx)
 set associated primary vertex
virtual edm::Ptr< reco::Tracktrack (size_t i) const
 Return Ptr to the track costituent.
 TrackJet (const LorentzVector &fP4, const Point &fVertex, const Jet::Constituents &fConstituents)
 Constructor from RecoChargedRefCandidate constituents.
 TrackJet ()
 Default constructor.
 TrackJet (const LorentzVector &fP4, const Point &fVertex)
 Constructor without constituents.
std::vector< edm::Ptr
< reco::Track > > 
tracks () const
 Return pointers to all track costituents.
virtual ~TrackJet ()
 Destructor.

Private Member Functions

virtual bool overlap (const Candidate &dummy) const
 Polymorphic overlap.

Private Attributes

reco::VertexRef vtx_
 Associated primary vertex.

Detailed Description

Jets made out of tracks.

TrackJet represents Jets with tracks as constituents. The consitutents are in this case RecoChargedRefCandidates, that preserve the Refs to the original tracks. Those Refs are used to provide transparent access to the tracks.

Author:
Steven Lowette
Id:
TrackJet.h,v 1.4 2010/06/29 09:56:50 lowette Exp

Definition at line 28 of file TrackJet.h.


Constructor & Destructor Documentation

reco::TrackJet::TrackJet ( )

Default constructor.

Definition at line 9 of file TrackJet.cc.

  : reco::Jet()
{
}
reco::TrackJet::TrackJet ( const LorentzVector fP4,
const Point fVertex 
)

Constructor without constituents.

Definition at line 15 of file TrackJet.cc.

  : reco::Jet(fP4, fVertex)
{
}
reco::TrackJet::TrackJet ( const LorentzVector fP4,
const Point fVertex,
const Jet::Constituents fConstituents 
)

Constructor from RecoChargedRefCandidate constituents.

Definition at line 21 of file TrackJet.cc.

References resetCharge().

  : reco::Jet(fP4, fVertex, fConstituents)
{
  this->resetCharge();
}
virtual reco::TrackJet::~TrackJet ( ) [inline, virtual]

Destructor.

Definition at line 39 of file TrackJet.h.

{}

Member Function Documentation

reco::TrackJet * reco::TrackJet::clone ( void  ) const [virtual]

Polymorphic clone.

Reimplemented from reco::CompositePtrCandidate.

Definition at line 29 of file TrackJet.cc.

                                         {
  return new reco::TrackJet(*this);
}
bool reco::TrackJet::fromHardVertex ( ) const [inline]

check jet to be associated to the hard primary vertex

Definition at line 57 of file TrackJet.h.

References primaryVertex().

{ return (this->primaryVertex().index() == 0); }
size_t reco::TrackJet::numberOfTracks ( ) const [inline]

Number of track daughters.

Definition at line 44 of file TrackJet.h.

References reco::CompositePtrCandidate::numberOfDaughters().

{ return numberOfDaughters(); }
bool reco::TrackJet::overlap ( const Candidate dummy) const [private, virtual]

Polymorphic overlap.

Reimplemented from reco::CompositePtrCandidate.

Definition at line 86 of file TrackJet.cc.

                                                        {
  return false;
}
const reco::VertexRef reco::TrackJet::primaryVertex ( ) const

get associated primary vertex

Definition at line 76 of file TrackJet.cc.

Referenced by fromHardVertex().

                                                      {
  return vtx_;
}
std::string reco::TrackJet::print ( void  ) const [virtual]

Print object.

Reimplemented from reco::Jet.

Definition at line 91 of file TrackJet.cc.

References i, dbtoconf::out, reco::Jet::print(), and testEve_cfg::tracks.

                                    {
  std::ostringstream out;
  out << Jet::print() // generic jet info
      << "    TrackJet specific:" << std::endl;
  if (primaryVertex().get()) {
    out << "      Associated PV:"
        << " x=" << primaryVertex()->x()
        << " y=" << primaryVertex()->y()
        << " z=" << primaryVertex()->z() << std::endl;
  } else {
    out << "      Associated PV not available on the event" << std::endl;
  }
  std::vector<edm::Ptr<reco::Track> > thetracks = tracks();
  for (unsigned i = 0; i < thetracks.size (); i++) {
    if (thetracks[i].get ()) {
      out << "      #" << i
          << " px=" << thetracks[i]->px()
          << " py=" << thetracks[i]->py()
          << " pz=" << thetracks[i]->pz()
          << " eta=" << thetracks[i]->eta()
          << " phi=" << thetracks[i]->phi() << std::endl;
    }
    else {
      out << "      #" << i << " track is not available in the event"  << std::endl;
    }
  }
  return out.str();
}
void reco::TrackJet::resetCharge ( )

calculate and set the charge by adding up the constituting track charges

Definition at line 67 of file TrackJet.cc.

References begin, DeDxDiscriminatorTools::charge(), and end.

Referenced by TrackJet().

                               {
  reco::LeafCandidate::Charge charge = 0;
  for ( reco::Candidate::const_iterator ida = this->begin(); ida != this->end(); ++ida ) {
    charge += ida->charge();
  }
  this->setCharge(charge);
}
void reco::TrackJet::setPrimaryVertex ( const reco::VertexRef vtx)

set associated primary vertex

Definition at line 81 of file TrackJet.cc.

Referenced by FastjetJetProducer::produceTrackJets().

                                                             {
  vtx_ = vtx;
}
edm::Ptr< reco::Track > reco::TrackJet::track ( size_t  i) const [virtual]

Return Ptr to the track costituent.

Definition at line 35 of file TrackJet.cc.

References Exception, edm::Ptr< T >::get(), edm::Ref< C, T, F >::get(), edm::Ref< C, T, F >::id(), edm::Ptr< T >::isAvailable(), edm::Ptr< T >::isNonnull(), edm::Ref< C, T, F >::key(), and reco::RecoChargedRefCandidate::track().

                                                    {
  Constituent dau = daughterPtr (i);
  // check the daughter to be ok
  if ( dau.isNonnull() && dau.isAvailable() ) {
    // convert to concrete candidate type
    const RecoChargedRefCandidate* trkCand = dynamic_cast <const RecoChargedRefCandidate*> (dau.get());
    // check the candidate is of the right type
    if (trkCand) {
      // check the track link in the recochargedcandidate to be there
      if (trkCand->track().get()) {
        // ok, return pointer to the originating track
        return edm::Ptr<reco::Track> ( trkCand->track().id(), trkCand->track().get(), trkCand->track().key() );
      } else {
        throw cms::Exception("TrackRef unavailable") << "TrackJet consituent track not in the event.";
      }
    } else {
     throw cms::Exception("Invalid Constituent") << "TrackJet constituent is not of RecoChargedRefCandidate type";
    }
  // otherwise return empty ptr
  } else {
    return edm::Ptr<reco::Track>();
  }
}
std::vector< edm::Ptr< reco::Track > > reco::TrackJet::tracks ( void  ) const

Return pointers to all track costituents.

Definition at line 60 of file TrackJet.cc.

References i, and query::result.

                                                         {
  std::vector <edm::Ptr<reco::Track> > result;
  for (unsigned i = 0;  i <  numberOfDaughters (); i++) result.push_back (track (i));
  return result;
}

Member Data Documentation

Associated primary vertex.

Definition at line 70 of file TrackJet.h.