57#include "fastjet/ClusterSequence.hh"
58#include "fastjet/Selector.hh"
81 MyUserInfo(
const int & pdg_id_in,
const int & vertex_number_in) :
82 _pdg_id(pdg_id_in), _vertex_number(vertex_number_in){}
85 int pdg_id()
const {
return _pdg_id;}
88 int vertex_number()
const {
return _vertex_number;}
115 return "neutral pions or photons";
130 const int & pdgid = p.
user_info<MyUserInfo>().pdg_id();
131 return (pdgid == 111) || (pdgid == 22);
138 return Selector(
new SW_IsPi0Gamma());
156 SW_VertexNumber(
const int & vertex_number) : _vertex_number(vertex_number){}
161 oss <<
"vertex number " << _vertex_number;
177 return p.
user_info<MyUserInfo>().vertex_number()==_vertex_number;
187Selector SelectorVertexNumber(
const int & vertex_number){
188 return Selector(
new SW_VertexNumber(vertex_number));
197 vector<PseudoJet> input_particles;
199 double px, py , pz, E;
201 int vertex_number=-1;
203 while (getline(cin, str)){
207 istringstream iss(str);
208 if (! (iss >> px >> py >> pz >> E >> pdg_id)){
209 cerr <<
"Wrong file format: particles must be specified with" << endl;
210 cerr <<
" px py pz E pdg_id" << endl;
229 p.set_user_info(
new MyUserInfo(pdg_id, vertex_number));
232 input_particles.push_back(p);
237 if ((str.length()>=9) && (str.compare(0,9,
"#SUBSTART")==0)){
258 vector<PseudoJet> inclusive_jets =
sorted_by_pt(clust_seq.inclusive_jets(ptmin));
267 cout <<
"Ran " << jet_def.description() << endl;
270 printf(
"%5s %15s %15s %15s %15s %15s\n",
"jet #",
271 "rapidity",
"phi",
"pt",
272 "pt_hard",
"pt_pi0+gamma");
275 Selector sel_vtx0 = SelectorVertexNumber(0);
278 Selector sel_pi0gamma = SelectorIsPi0Gamma();
281 for (
unsigned int i = 0; i < inclusive_jets.size(); i++) {
282 const PseudoJet & full = inclusive_jets[i];
283 const vector<PseudoJet> constituents = full.
constituents();
286 PseudoJet hard = join(sel_vtx0(constituents));
289 PseudoJet pi0gamma = join(sel_pi0gamma(constituents));
292 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...
vector< PseudoJet > sorted_by_pt(const vector< PseudoJet > &jets)
return a vector of jets sorted into decreasing kt2