57 #include "fastjet/ClusterSequence.hh"
58 #include "fastjet/TrackJetPlugin.hh"
67 FASTJET_BEGIN_NAMESPACE
74 class TrackJetParticlePtr{
76 TrackJetParticlePtr(
int i_index,
double i_perp2)
77 : index(i_index), perp2(i_perp2){}
82 bool operator <(
const TrackJetParticlePtr &other)
const {
83 return perp2>other.perp2;
91 bool TrackJetPlugin::_first_time =
true;
93 string TrackJetPlugin::description ()
const {
95 desc <<
"TrackJet algorithm with R = " << R();
104 vector<TrackJetParticlePtr> particle_list;
106 const vector<PseudoJet> & jets = clust_seq.
jets();
108 for (vector<PseudoJet>::const_iterator mom_it = jets.begin(); mom_it != jets.end(); mom_it++){
109 particle_list.push_back(TrackJetParticlePtr(index, mom_it->perp2()));
114 stable_sort(particle_list.begin(), particle_list.end());
120 vector<PseudoJet> tuned_particles = clust_seq.
jets();
121 vector<PseudoJet> tuned_tracks = clust_seq.
jets();
122 for (vector<PseudoJet>::iterator pit = tuned_particles.begin();
123 pit != tuned_particles.end(); pit++)
124 _jet_recombiner.preprocess(*pit);
125 for (vector<PseudoJet>::iterator pit = tuned_tracks.begin();
126 pit != tuned_tracks.end(); pit++)
127 _track_recombiner.preprocess(*pit);
131 list<int> sorted_pt_index;
132 for (vector<TrackJetParticlePtr>::iterator mom_it = particle_list.begin();
133 mom_it != particle_list.end(); mom_it++)
134 sorted_pt_index.push_back(mom_it->index);
137 while (sorted_pt_index.size()){
141 int current_jet_index = sorted_pt_index.front();
142 PseudoJet current_jet = tuned_particles[current_jet_index];
143 PseudoJet current_track = tuned_tracks[current_jet_index];
146 list<int>::iterator index_it = sorted_pt_index.begin();
147 sorted_pt_index.erase(index_it);
150 index_it = sorted_pt_index.begin();
151 while (index_it != sorted_pt_index.end()){
152 const PseudoJet & current_particle = tuned_particles[*index_it];
153 const PseudoJet & current_particle_track = tuned_tracks[*index_it];
156 double distance2 = current_track.
plain_distance(current_particle_track);
157 if (distance2 <= _radius2){
161 _jet_recombiner.recombine(current_jet, current_particle, new_jet);
162 _track_recombiner.recombine(current_track, current_particle_track, new_track);
167 current_jet = new_jet;
168 current_track = new_track;
169 current_jet_index = new_jet_index;
172 sorted_pt_index.erase(index_it);
176 index_it = sorted_pt_index.begin();
189 void TrackJetPlugin::_print_banner(ostream *ostr)
const{
190 if (! _first_time)
return;
196 (*ostr) <<
"#-------------------------------------------------------------------------" << endl;
197 (*ostr) <<
"# You are running the TrackJet plugin for FastJet. It is based on " << endl;
198 (*ostr) <<
"# the implementation by Andy Buckley and Manuel Bahr that is to be " << endl;
199 (*ostr) <<
"# found in Rivet 1.1.2. See http://www.hepforge.org/downloads/rivet. " << endl;
200 (*ostr) <<
"#-------------------------------------------------------------------------" << endl;
206 FASTJET_END_NAMESPACE
double plain_distance(const PseudoJet &other) const
returns squared cylinder (rap-phi) distance between this jet and another
const std::vector< PseudoJet > & jets() const
allow the user to access the internally stored _jets() array, which contains both the initial particl...
void plugin_record_ij_recombination(int jet_i, int jet_j, double dij, int &newjet_k)
record the fact that there has been a recombination between jets()[jet_i] and jets()[jet_k], with the specified dij, and return the index (newjet_k) allocated to the new jet, whose momentum is assumed to be the 4-vector sum of that of jet_i and jet_j
void plugin_record_iB_recombination(int jet_i, double diB)
record the fact that there has been a recombination between jets()[jet_i] and the beam...
static std::ostream * fastjet_banner_stream()
returns a pointer to the stream to be used to print banners (cout by default).
Class to contain pseudojets, including minimal information of use to jet-clustering routines...