Loading [MathJax]/extensions/tex2jax.js
Go to the documentation of this file.
1 #pragma once
2 
3 #include "fastjet/JetDefinition.hh"
4 
5 namespace qjets
6 {
7 
8 class QJetsPlugin: public fastjet::JetDefinition::Plugin
9 {
10 private:
11  double _zcut, _dcut_fctr, _exp_min, _exp_max, _rigidity, _truncation_fctr;
12  bool _rand_seed_set;
13  unsigned _seed;
14 // int _truncated_length;
15 public:
16  QJetsPlugin(double zcut, double dcut_fctr, double exp_min, double exp_max, double rigidity, double truncation_fctr = 0.);
17  void SetRandSeed(unsigned seed); /* In case you want reproducible behavior */
18  double R() const;
19  std::string description() const;
20  void run_clustering(fastjet::ClusterSequence& cs) const;
21 };
22 
23 }
24 
25 // /*
26 // * Take cells from an event, cluster them into jets, and perform Q-jet pruning on the hardest one
27 // *
28 // * Example usage: ./example sample_data/ww_1.txt sample_output/ww_1_out.txt
29 // *
30 // * The main parameters governing the behavior of the algorithm are
31 // * zcut: this is the z-cut used in the pruning algorithm (typically 0.1 or 0.15)
32 // * dcut_fctr: this is used in determining the angular dcut used in pruning.
33 // * as in the pruning algorithm, dcut = dcut_fctr * 2 m / pT (dcut_fctr is typically 0.5)
34 // * exp_min and exp_max determine the form of d_ij used in clustering the jet
35 // * we have d_ij = min(pTi,pTj)^exp_min * max(pTi,pTj)^exp_max * R_ij^2
36 // * so for kT clustering, (exp_min,exp_max) = (2,0), while for C/A clustering they are (0,0)
37 // * rigidity: this determines how close the algorithm is to "classical" C/A or kT. This
38 // * is denoted as \alpha in the Qjets paper
39 // */
40 // #include "fastjet/ClusterSequence.hh"
41 // #include "fastjet/PseudoJet.hh"
42 // #include "boca/QjetsPlugin.h"
43 // #include <iostream>
44 // #include <sstream>
45 // #include <vector>
46 // #include <fstream>
47 // #include <algorithm>
48 //
49 // using namespace std;
50 //
51 // void print_jets(fastjet::ClusterSequence const&, const vector<fastjet::PseudoJet>&);
52 //
53 //
54 // double mean(vector<double>& masses)
55 // {
56 // double ret(0.);
57 // for (vector<double>::iterator it = masses.begin(); it != masses.end(); it++)
58 // ret += (*it);
59 // return ret / masses.size();
60 // }
61 //
62 // double var(vector<double>& masses)
63 // {
64 // double ret(0.), avg(mean(masses));
65 // for (vector<double>::iterator it = masses.begin(); it != masses.end(); it++)
66 // ret += ((*it) - avg) * ((*it) - avg);
67 // return ret / masses.size();
68 // }
69 //
70 // int main(int argc, char** argv)
71 // {
72 // vector<fastjet::PseudoJet> input_particles;
73 //
74 // if (argc != 3) {
75 // cout << "Usage: example input_file output_file" << '\n';
76 // exit(0);
77 // }
78 //
79 // ifstream infile(argv[1]);
80 // if (!infile.good()) {
81 // cout << "Can't open " << argv[1] << '\n';
82 // exit(0);
83 // }
84 //
85 // ofstream outfile(argv[2]);
86 // if (!outfile.is_open()) {
87 // cout << "Can't open " << argv[2] << '\n';
88 // exit(0);
89 // }
90 //
91 // // read in input particles from the file
92 // double px, py , pz, E;
93 // while (infile >> px >> py >> pz >> E)
94 // input_particles.push_back(fastjet::PseudoJet(px, py, pz, E));
95 //
96 // // set the initial jet radius
97 // double jetR = 1.;
98 //
99 // fastjet::JetDefinition jet_def(fastjet::antikt_algorithm, jetR, fastjet::E_scheme, fastjet::Best);
100 // fastjet::ClusterSequence clust_seq(input_particles, jet_def);
101 // vector<fastjet::PseudoJet> inclusive_jets = clust_seq.inclusive_jets();
102 //
103 // cout << '\n' << "============================================" << '\n';
104 // cout << "\tJets found in initial clustering" << '\n';
105 // cout << "============================================" << '\n' << '\n';
106 //
107 // print_jets(clust_seq, inclusive_jets);
108 // cout << "============================================" << '\n';
109 //
110 //
111 // // Now recluster hardest jet many times using path-integral-pruning
112 // double zcut(0.1), dcut_fctr(0.5), exp_min(0.), exp_max(0.), rigidity(0.1);
113 // double truncation_fctr(0.0);
114 //
115 // QjetsPlugin qjet_plugin(zcut, dcut_fctr, exp_min, exp_max, rigidity, truncation_fctr);
116 // fastjet::JetDefinition qjet_def(&qjet_plugin);
117 //
118 // vector<fastjet::PseudoJet> constits = clust_seq.constituents(sorted_by_pt(inclusive_jets)[0]);
119 //
120 // vector<double> masses;
121 //
122 // for (unsigned i = 0 ; i < 100000 ; i++) {
123 // if (i % 100 == 0)
124 // cout << i << '\n';
125 // fastjet::ClusterSequence qjet_seq(constits, qjet_def);
126 // vector<fastjet::PseudoJet> inclusive_jets2 = sorted_by_pt(qjet_seq.inclusive_jets());
127 // outfile << inclusive_jets2[0].m() << '\n';
128 // masses.push_back(inclusive_jets2[0].m());
129 // }
130 //
131 // cout << '\n' << '\n' << "Pruned masses saved in file " << argv[2] << '\n' << '\n';
132 // cout << "Mean mass: " << mean(masses) << '\n';
133 // cout << "Mass variance: " << var(masses) << '\n';
134 //
135 // infile.close();
136 // outfile.close();
137 // }
138 //
139 // void print_jets(fastjet::ClusterSequence const& clust_seq, const vector<fastjet::PseudoJet>& jets)
140 // {
141 //
142 // // sort jets into increasing pt
143 // vector<fastjet::PseudoJet> sorted_jets = sorted_by_pt(jets);
144 //
145 // // label the columns
146 // printf("%5s %15s %15s %15s %15s %15s %15s\n", "jet #", "rapidity",
147 // "phi", "pt", "m", "e", "n constituents");
148 //
149 // // print out the details for each jet
150 // for (unsigned i = 0; i < sorted_jets.size(); i++) {
151 // int n_constituents = clust_seq.constituents(sorted_jets[i]).size();
152 // printf("%5u %15.8f %15.8f %15.8f %15.8f %15.8f %8u\n",
153 // i, sorted_jets[i].rap(), sorted_jets[i].phi(),
154 // sorted_jets[i].perp(), sorted_jets[i].m(), sorted_jets[i].e(), n_constituents);
155 // }
156 // }
QJetsPlugin(double zcut, double dcut_fctr, double exp_min, double exp_max, double rigidity, double truncation_fctr=0.)
Definition: QJetsPlugin.cpp:7
void SetRandSeed(unsigned seed)
Definition: QJetsPlugin.cpp:18
std::string description() const
Definition: QJetsPlugin.cpp:29
Definition: QJetsPlugin.hh:8
double R() const
Definition: QJetsPlugin.cpp:24
void run_clustering(fastjet::ClusterSequence &cs) const
Definition: QJetsPlugin.cpp:34
Qjets: A Non-Deterministic Approach to Tree-Based Jet Substructure
Definition: QJets.hh:17