CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SubJetAlgorithm.cc
Go to the documentation of this file.
4 #include "fastjet/ClusterSequenceArea.hh"
5 
6 using namespace std;
7 using namespace edm;
8 
10  zcut_ = z;
11 }
12 
14  rcut_factor_ = r;
15 }
16 
17 
18 // Run the algorithm
19 // ------------------
20 void SubJetAlgorithm::run( const vector<fastjet::PseudoJet> & cell_particles,
21  vector<CompoundPseudoJet> & hardjetsOutput ) {
22 
23  //for actual jet clustering, either the pruned or the original version is used.
24  //For the pruned version, a new jet definition using the PrunedRecombPlugin is required:
25  fastjet::FastPrunePlugin PRplugin(*fjJetDefinition_,
26  *fjJetDefinition_,
27  zcut_,
28  rcut_factor_);
29  fastjet::JetDefinition pjetdef(&PRplugin);
30 
31 
32 
33  // cluster the jets with the jet definition jetDef:
34  // run algorithm
35  boost::shared_ptr<fastjet::ClusterSequence> fjClusterSeq;
36  if ( !doAreaFastjet_ ) {
37  fjClusterSeq =
38  boost::shared_ptr<fastjet::ClusterSequence>( new fastjet::ClusterSequence( cell_particles,
39  pjetdef ) );
40  } else if (voronoiRfact_ <= 0) {
41  fjClusterSeq =
42  boost::shared_ptr<fastjet::ClusterSequence>( new fastjet::ClusterSequenceActiveArea( cell_particles,
43  pjetdef ,
44  *fjActiveArea_ ) );
45  } else {
46  fjClusterSeq =
47  boost::shared_ptr<fastjet::ClusterSequence>( new fastjet::ClusterSequenceVoronoiArea( cell_particles,
48  pjetdef ,
49  fastjet::VoronoiAreaSpec(voronoiRfact_) ) );
50  }
51 
52  vector<fastjet::PseudoJet> inclusiveJets = fjClusterSeq->inclusive_jets(ptMin_);
53 
54  // These will store the indices of each subjet that
55  // are present in each jet
56  vector<vector<int> > indices(inclusiveJets.size());
57  // Loop over inclusive jets, attempt to find substructure
58  vector<fastjet::PseudoJet>::iterator jetIt = inclusiveJets.begin();
59  for ( ; jetIt != inclusiveJets.end(); ++jetIt ) {
60  //decompose into requested number of subjets:
61  vector<fastjet::PseudoJet> subjets = fjClusterSeq->exclusive_subjets(*jetIt, nSubjets_);
62  //create the subjets objects to put into the "output" objects
63  vector<CompoundPseudoSubJet> subjetsOutput;
64  std::vector<fastjet::PseudoJet>::const_iterator itSubJetBegin = subjets.begin(),
65  itSubJet = itSubJetBegin, itSubJetEnd = subjets.end();
66  for (; itSubJet != itSubJetEnd; ++itSubJet ){
67  // Get the transient subjet constituents from fastjet
68  vector<fastjet::PseudoJet> subjetFastjetConstituents = fjClusterSeq->constituents( *itSubJet );
69  // Get the indices of the constituents:
70  vector<int> constituents;
71  vector<fastjet::PseudoJet>::const_iterator fastSubIt = subjetFastjetConstituents.begin(),
72  transConstEnd = subjetFastjetConstituents.end();
73  for ( ; fastSubIt != transConstEnd; ++fastSubIt ) {
74  if (fastSubIt->user_index() >= 0) {
75  constituents.push_back( fastSubIt->user_index() );
76  }
77  }
78 
79  double subJetArea = (doAreaFastjet_) ?
80  dynamic_cast<fastjet::ClusterSequenceActiveArea&>(*fjClusterSeq).area(*itSubJet) : 0.0;
81 
82 
83  // Make a CompoundPseudoSubJet object to hold this subjet and the indices of its constituents
84  subjetsOutput.push_back( CompoundPseudoSubJet( *itSubJet, subJetArea, constituents ) );
85 
86  }
87 
88 
89  double fatJetArea = (doAreaFastjet_) ?
90  dynamic_cast<fastjet::ClusterSequenceActiveArea&>(*fjClusterSeq).area(*jetIt) : 0.0;
91 
92  // Make a CompoundPseudoJet object to hold this hard jet, and the subjets that make it up
93  hardjetsOutput.push_back( CompoundPseudoJet( *jetIt,fatJetArea,subjetsOutput));
94  }
95 }
void set_rcut_factor(double r)
double double double z
void set_zcut(double z)
CompoundPseudoJet holds an association of fastjet::PseudoJets that represent a &quot;hard&quot; top jet with su...
void run(const std::vector< fastjet::PseudoJet > &cell_particles, std::vector< CompoundPseudoJet > &hardjetsOutput)
Find the ProtoJets from the collection of input Candidates.