59#include "fastjet/ClusterSequence.hh"
60#include "fastjet/Selector.hh"
83 MyUserInfo(
const int & pdg_id_in,
const int & vertex_number_in) :
84 _pdg_id(pdg_id_in), _vertex_number(vertex_number_in){}
87 int pdg_id()
const {
return _pdg_id;}
90 int vertex_number()
const {
return _vertex_number;}
117 return "neutral pions or photons";
132 const int & pdgid = p.
user_info<MyUserInfo>().pdg_id();
133 return (pdgid == 111) || (pdgid == 22);
140 return Selector(
new SW_IsPi0Gamma());
158 SW_VertexNumber(
const int & vertex_number) : _vertex_number(vertex_number){}
163 oss <<
"vertex number " << _vertex_number;
179 return p.
user_info<MyUserInfo>().vertex_number()==_vertex_number;
189Selector SelectorVertexNumber(
const int & vertex_number){
190 return Selector(
new SW_VertexNumber(vertex_number));
199 vector<PseudoJet> input_particles;
201 double px, py , pz, E;
203 int vertex_number=-1;
205 while (getline(cin, str)){
209 istringstream iss(str);
210 if (! (iss >> px >> py >> pz >> E >> pdg_id)){
211 cerr <<
"Wrong file format: particles must be specified with" << endl;
212 cerr <<
" px py pz E pdg_id" << endl;
231 p.set_user_info(
new MyUserInfo(pdg_id, vertex_number));
234 input_particles.push_back(p);
239 if ((str.length()>=9) && (str.compare(0,9,
"#SUBSTART")==0)){
260 vector<PseudoJet> inclusive_jets =
sorted_by_pt(clust_seq.inclusive_jets(ptmin));
269 cout <<
"Ran " << jet_def.description() << endl;
272 printf(
"%5s %15s %15s %15s %15s %15s\n",
"jet #",
273 "rapidity",
"phi",
"pt",
274 "pt_hard",
"pt_pi0+gamma");
277 Selector sel_vtx0 = SelectorVertexNumber(0);
280 Selector sel_pi0gamma = SelectorIsPi0Gamma();
283 for (
unsigned int i = 0; i < inclusive_jets.size(); i++) {
284 const PseudoJet & full = inclusive_jets[i];
285 const vector<PseudoJet> constituents = full.
constituents();
288 PseudoJet hard = join(sel_vtx0(constituents));
291 PseudoJet pi0gamma = join(sel_pi0gamma(constituents));
294 printf(
"%5u %15.8f %15.8f %15.8f %15.8f %15.8f\n", i,
int main()
an example program showing how to use fastjet
class that is intended to hold a full definition of the jet clusterer
a base class to hold extra user information in a PseudoJet
Class to contain pseudojets, including minimal information of use to jet-clustering routines.
virtual std::vector< PseudoJet > constituents() const
retrieve the constituents.
double rap() const
returns the rapidity or some large value when the rapidity is infinite
const L & user_info() const
returns a reference to the dynamic cast conversion of user_info to type L.
double phi() const
returns phi (in the range 0..2pi)
double perp() const
returns the scalar transverse momentum
default selector worker is an abstract virtual base class
virtual std::string description() const
returns a description of the worker
virtual bool pass(const PseudoJet &jet) const =0
returns true if a given object passes the selection criterion, and is the main function that needs to...
Class that encodes information about cuts and other selection criteria that can be applied to PseudoJ...
@ antikt_algorithm
like the k_t but with distance measures dij = min(1/kti^2,1/ktj^2) Delta R_{ij}^2 / R^2 diB = 1/kti^2
vector< PseudoJet > sorted_by_pt(const vector< PseudoJet > &jets)
return a vector of jets sorted into decreasing kt2