CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

pf2pat::FastJetAlgo Class Reference

#include <FastJetAlgo.h>

List of all members.

Public Types

typedef std::vector< InputTypeInputCollection
typedef edm::Handle
< InputCollection
InputHandle
typedef reco::PFCandidate InputType
typedef std::vector< JetTypeJetCollection
typedef reco::PFJet JetType
typedef
JetCollection::const_iterator 
JI
typedef
PseudoJetCollection::const_iterator 
PJI
typedef std::vector
< fastjet::PseudoJet > 
PseudoJetCollection

Public Member Functions

 FastJetAlgo (const edm::ParameterSet &ps)
void printJets (std::ostream &out=std::cout) const
 print output jets
void printPseudoJets (std::ostream &out=std::cout) const
 print internal pseudojets
const JetCollectionproduce (const InputHandle &inputColl)
 run the jet clustering on the input collection, and produce the reco jets
void setJetDefinition (const fastjet::JetDefinition &jetDef)
 set user defined jet definition
void setJetDefinition (const edm::ParameterSet &ps)
 get jet definition from parameter set

Private Member Functions

const JetCollectionfastJetToReco ()
 convert fastjet output to RECO data format (e.g. PFJet)
reco::Jet::Constituents makeConstituents (const fastjet::PseudoJet &pseudoJet) const
JetType makeJet (const fastjet::PseudoJet &pseudoJet) const
void recoToFastJet (const InputCollection &inputColl)
void runJetClustering ()
 run fast jet

Private Attributes

fastjet::ClusterSequence * clusterSequence_
 cluster sequence
PseudoJetCollection input_
 fastjet input
InputHandle inputHandle_
 keep track of the input handle - set in the produce function.
JetCollection jetCollection_
 output jet collection
fastjet::JetDefinition jetDefinition_
 definition of the algorithm, and of the algorithm parameters
PseudoJetCollection output_
 fastjet output

Detailed Description

Definition at line 19 of file FastJetAlgo.h.


Member Typedef Documentation

Definition at line 27 of file FastJetAlgo.h.

Definition at line 28 of file FastJetAlgo.h.

Definition at line 26 of file FastJetAlgo.h.

Definition at line 32 of file FastJetAlgo.h.

Definition at line 31 of file FastJetAlgo.h.

typedef JetCollection::const_iterator pf2pat::FastJetAlgo::JI

Definition at line 33 of file FastJetAlgo.h.

typedef PseudoJetCollection::const_iterator pf2pat::FastJetAlgo::PJI

Definition at line 23 of file FastJetAlgo.h.

typedef std::vector< fastjet::PseudoJet > pf2pat::FastJetAlgo::PseudoJetCollection

Definition at line 22 of file FastJetAlgo.h.


Constructor & Destructor Documentation

FastJetAlgo::FastJetAlgo ( const edm::ParameterSet ps)

Definition at line 17 of file FastJetAlgo.cc.

References setJetDefinition().


Member Function Documentation

const FastJetAlgo::JetCollection & FastJetAlgo::fastJetToReco ( ) [private]

convert fastjet output to RECO data format (e.g. PFJet)

Definition at line 71 of file FastJetAlgo.cc.

References i, jetCollection_, makeJet(), and output_.

Referenced by produce().

                                                           {
  
  jetCollection_.clear();

  for(PJI i=output_.begin(); i!=output_.end(); ++i) {
    jetCollection_.push_back( makeJet( *i ) ); 
  }

  return jetCollection_;
}
reco::Jet::Constituents FastJetAlgo::makeConstituents ( const fastjet::PseudoJet &  pseudoJet) const [private]

build the vector< Ptr<Candidate> > pointing to constituents from the PseudoJet and the Handle information.

Definition at line 100 of file FastJetAlgo.cc.

References clusterSequence_, and inputHandle_.

Referenced by makeJet().

                                                                                         {
  
  reco::Jet::Constituents ptrsToConstituents; 
  
  const PseudoJetCollection& constituents 
    = clusterSequence_->constituents(pseudoJet); 
  for(PJI jc=constituents.begin(); jc!=constituents.end(); ++jc) {
    ptrsToConstituents.push_back( edm::Ptr<reco::Candidate>(inputHandle_, jc->user_index() ) ); 
  } 

  return ptrsToConstituents;
}
FastJetAlgo::JetType FastJetAlgo::makeJet ( const fastjet::PseudoJet &  pseudoJet) const [private]

build a JetType (e.g. PFJet) from a pseudo-jet. Jet type could be a template parameter of the class.

Definition at line 83 of file FastJetAlgo.cc.

References makeConstituents(), reco::makeSpecific(), and p4.

Referenced by fastJetToReco().

                                                                         {
  
  reco::Particle::LorentzVector p4( pseudoJet.px(), 
                                    pseudoJet.py(),
                                    pseudoJet.pz(),
                                    pseudoJet.E() );
  reco::Particle::Point vertex; 
  JetType::Specific specific; 
    
  // need to add the constituents as well (see base Jet, or CompositePtrCandidate)
  reco::Jet::Constituents ptrsToConstituents = makeConstituents( pseudoJet );
  
  makeSpecific( ptrsToConstituents, &specific );
  return JetType(p4, vertex, specific, ptrsToConstituents); 
}
void FastJetAlgo::printJets ( std::ostream &  out = std::cout) const

print output jets

Definition at line 131 of file FastJetAlgo.cc.

References gather_cfg::cout, i, getHLTprescales::index, and jetCollection_.

                                               {

//   cout<<"Jet Definition:"<<endl;
//   cout<<jetDefinition_;
  cout<<"Jets:"<<endl;
  unsigned index = 0;
  for(JI i=jetCollection_.begin(); i!=jetCollection_.end(); ++i, ++index) {
    cout<<index<<" "<<(*i)<<endl;
    cout<<i->print()<<endl;
  }
}
void FastJetAlgo::printPseudoJets ( std::ostream &  out = std::cout) const

print internal pseudojets

Definition at line 114 of file FastJetAlgo.cc.

References clusterSequence_, gather_cfg::cout, i, getHLTprescales::index, and output_.

                                                     {

//   cout<<"Jet Definition:"<<endl;
//   cout<<jetDefinition_;
  cout<<"Pseudo jets:"<<endl;
  unsigned index = 0;
  for(PJI i=output_.begin(); i!=output_.end(); ++i, ++index) {
    cout<<index<<" "<<i->Et()<<endl;
    
    const PseudoJetCollection& constituents = clusterSequence_->constituents( *i );
    for(PJI jc=constituents.begin(); jc!=constituents.end(); ++jc) {
      cout<<"\t"<<jc->user_index()<<" "<<jc->Et()<<endl;
    }
  }
}
const FastJetAlgo::JetCollection & FastJetAlgo::produce ( const InputHandle inputColl)

run the jet clustering on the input collection, and produce the reco jets

Definition at line 39 of file FastJetAlgo.cc.

References fastJetToReco(), inputHandle_, recoToFastJet(), and runJetClustering().

                                                                                               {
  
  // the input handle will be necessary to build the Ptrs to the jet constituents.
  inputHandle_ = inputHandle;
  const InputCollection& inputColl = *inputHandle; 
  recoToFastJet( inputColl );
  runJetClustering();
  return fastJetToReco(); 
}
void FastJetAlgo::recoToFastJet ( const InputCollection inputColl) [private]

convert input elements from CMSSW (e.g. PFCandidates) into fastjet input. InputType could be a template parameter of the class

Definition at line 49 of file FastJetAlgo.cc.

References i, getHLTprescales::index, and input_.

Referenced by produce().

                                                                           {
  input_.clear();
  typedef InputCollection::const_iterator II;

  unsigned index = 0;
  for(II i=inputColl.begin(); i!=inputColl.end(); ++i, ++index) {
    input_.push_back( PseudoJet( i->px(), i->py(), i->pz(), i->energy() ) );
    input_.back().set_user_index( index );
  }
}
void FastJetAlgo::runJetClustering ( ) [private]

run fast jet

Definition at line 60 of file FastJetAlgo.cc.

References clusterSequence_, input_, jetDefinition_, and output_.

Referenced by produce().

                                    {
  output_.clear();
  if(clusterSequence_) delete clusterSequence_;
  clusterSequence_ = new ClusterSequence(input_, jetDefinition_);

  double ptMin_=2;//COLIN make it an attribute
  output_ = clusterSequence_->inclusive_jets( ptMin_ );
}
void FastJetAlgo::setJetDefinition ( const edm::ParameterSet ps)

get jet definition from parameter set

Definition at line 22 of file FastJetAlgo.cc.

References ExpressReco_HICollisions_FallBack::algorithm, and edm::ParameterSet::getParameter().

Referenced by FastJetAlgo().

                                                             {
  // here extract parameter set info to make the jet definition

  unsigned algorithm = ps.getParameter<unsigned>("algorithm");
  double distance = ps.getParameter<double>("distance");

  JetDefinition jetDef( static_cast<JetAlgorithm>(algorithm), distance);
  setJetDefinition( jetDef ); 
}
void FastJetAlgo::setJetDefinition ( const fastjet::JetDefinition &  jetDef)

set user defined jet definition

Definition at line 33 of file FastJetAlgo.cc.

References gather_cfg::cout, and jetDefinition_.

                                                                      {
  cout<<jetDef.description()<<endl;
  jetDefinition_ = jetDef; 
}

Member Data Documentation

fastjet::ClusterSequence* pf2pat::FastJetAlgo::clusterSequence_ [private]

cluster sequence

Definition at line 89 of file FastJetAlgo.h.

Referenced by makeConstituents(), printPseudoJets(), and runJetClustering().

fastjet input

Definition at line 77 of file FastJetAlgo.h.

Referenced by recoToFastJet(), and runJetClustering().

keep track of the input handle - set in the produce function.

Definition at line 74 of file FastJetAlgo.h.

Referenced by makeConstituents(), and produce().

output jet collection

Definition at line 83 of file FastJetAlgo.h.

Referenced by fastJetToReco(), and printJets().

fastjet::JetDefinition pf2pat::FastJetAlgo::jetDefinition_ [private]

definition of the algorithm, and of the algorithm parameters

Definition at line 86 of file FastJetAlgo.h.

Referenced by runJetClustering(), and setJetDefinition().

fastjet output

Definition at line 80 of file FastJetAlgo.h.

Referenced by fastJetToReco(), printPseudoJets(), and runJetClustering().