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;}
114 string description()
const{
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){}
159 string description()
const{
161 oss <<
"vertex number " << _vertex_number;
177 return p.
user_info<MyUserInfo>().vertex_number()==_vertex_number;
187 Selector 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,
vector< PseudoJet > sorted_by_pt(const vector< PseudoJet > &jets)
return a vector of jets sorted into decreasing kt2
virtual std::vector< PseudoJet > constituents() const
retrieve the constituents.
double perp() const
returns the scalar transverse momentum
int main()
an example program showing how to use fastjet
double phi() const
returns phi (in the range 0..2pi)
double rap() const
returns the rapidity or some large value when the rapidity is infinite
Class that encodes information about cuts and other selection criteria that can be applied to PseudoJ...
const L & user_info() const
returns a reference to the dynamic cast conversion of user_info to type L.
a base class to hold extra user information in a PseudoJet
default selector worker is an abstract virtual base class
Class to contain pseudojets, including minimal information of use to jet-clustering routines...
class that is intended to hold a full definition of the jet clusterer