FastJet
3.5.2
Toggle main menu visibility
Loading...
Searching...
No Matches
example
01-basic.cc
Go to the documentation of this file.
1
//----------------------------------------------------------------------
2
/// \file
3
/// \page Example01 01 - basic usage example
4
///
5
/// fastjet basic example program:
6
/// simplest illustration of the usage of the basic classes:
7
/// fastjet::PseudoJet, fastjet::JetDefinition and
8
/// fastjet::ClusterSequence
9
///
10
/// run it with : ./01-basic < data/single-event.dat
11
///
12
/// Source code: 01-basic.cc
13
//----------------------------------------------------------------------
14
15
//FJSTARTHEADER
16
// $Id$
17
//
18
// Copyright (c) 2005-2026, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
19
//
20
//----------------------------------------------------------------------
21
// This file is part of FastJet.
22
//
23
// FastJet is free software; you can redistribute it and/or modify
24
// it under the terms of the GNU General Public License as published by
25
// the Free Software Foundation; either version 2 of the License, or
26
// (at your option) any later version.
27
//
28
// The algorithms that underlie FastJet have required considerable
29
// development. They are described in the original FastJet paper,
30
// hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
31
// FastJet as part of work towards a scientific publication, please
32
// quote the version you use and include a citation to the manual and
33
// optionally also to hep-ph/0512210.
34
//
35
// FastJet is distributed in the hope that it will be useful,
36
// but WITHOUT ANY WARRANTY; without even the implied warranty of
37
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38
// GNU General Public License for more details.
39
//
40
// You should have received a copy of the GNU General Public License
41
// along with FastJet. If not, see <http://www.gnu.org/licenses/>.
42
//----------------------------------------------------------------------
43
//FJENDHEADER
44
45
#include "fastjet/ClusterSequence.hh"
46
#include <iostream>
// needed for io
47
#include <cstdio>
// needed for io
48
49
using namespace
std;
50
51
/// an example program showing how to use fastjet
52
int
main
(){
53
54
// read in input particles
55
//----------------------------------------------------------
56
vector<fastjet::PseudoJet> input_particles;
57
58
double
px, py , pz, E;
59
while
(cin >> px >> py >> pz >> E) {
60
// create a fastjet::PseudoJet with these components and put it onto
61
// back of the input_particles vector
62
input_particles.push_back(
fastjet::PseudoJet
(px,py,pz,E));
63
}
64
65
66
// create a jet definition:
67
// a jet algorithm with a given radius parameter
68
//----------------------------------------------------------
69
double
R = 0.6;
70
fastjet::JetDefinition
jet_def(
fastjet::antikt_algorithm
, R);
71
72
73
// run the jet clustering with the above jet definition
74
//----------------------------------------------------------
75
fastjet::ClusterSequence
clust_seq(input_particles, jet_def);
76
77
78
// get the resulting jets ordered in pt
79
//----------------------------------------------------------
80
double
ptmin = 5.0;
81
vector<fastjet::PseudoJet> inclusive_jets = sorted_by_pt(clust_seq.
inclusive_jets
(ptmin));
82
83
84
// tell the user what was done
85
// - the description of the algorithm used
86
// - extract the inclusive jets with pt > 5 GeV
87
// show the output as
88
// {index, rap, phi, pt}
89
//----------------------------------------------------------
90
cout <<
"Ran "
<< jet_def.
description
() << endl;
91
92
// label the columns
93
printf(
"%5s %15s %15s %15s\n"
,
"jet #"
,
"rapidity"
,
"phi"
,
"pt"
);
94
95
// print out the details for each jet
96
for
(
unsigned
int
i = 0; i < inclusive_jets.size(); i++) {
97
printf(
"%5u %15.8f %15.8f %15.8f\n"
,
98
i, inclusive_jets[i].rap(), inclusive_jets[i].phi(),
99
inclusive_jets[i].perp());
100
}
101
102
return
0;
103
}
main
int main()
an example program showing how to use fastjet
Definition
01-basic.cc:52
fastjet::ClusterSequence
deals with clustering
Definition
ClusterSequence.hh:63
fastjet::ClusterSequence::inclusive_jets
std::vector< PseudoJet > inclusive_jets(const double ptmin=0.0) const
return a vector of all jets (in the sense of the inclusive algorithm) with pt >= ptmin.
Definition
ClusterSequence.cc:924
fastjet::JetDefinition
class that is intended to hold a full definition of the jet clusterer
Definition
JetDefinition.hh:257
fastjet::JetDefinition::description
std::string description() const
return a textual description of the current jet definition
Definition
JetDefinition.cc:106
fastjet::PseudoJet
Class to contain pseudojets, including minimal information of use to jet-clustering routines.
Definition
PseudoJet.hh:68
fastjet::antikt_algorithm
@ 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
Definition
JetDefinition.hh:153
Generated on
for FastJet by
1.18.0