#include "fastjet/PseudoJet.hh"#include "fastjet/ClusterSequenceActiveArea.hh"#include <iostream>#include <sstream>#include <vector>Include dependency graph for fastjet_subtraction.cc:

Go to the source code of this file.
Functions | |
| void | print_jets (const fastjet::ClusterSequenceActiveArea &, const vector< fastjet::PseudoJet > &) |
| a function that pretty prints a list of jets, and performs the subtraction in two different ways | |
| int | main (int argc, char **argv) |
| an example program showing how to use fastjet | |
|
||||||||||||
|
an example program showing how to use fastjet
Definition at line 59 of file fastjet_subtraction.cc. References fastjet::Best, fastjet::ClusterSequence::inclusive_jets(), fastjet::kt_algorithm, print_jets(), fastjet::PseudoJet::rap(), fastjet::PseudoJet::set_user_index(), and fastjet::ClusterSequence::strategy_string(). 00059 {
00060
00061 // since we use here simulated data we can split the hard event
00062 // from the full (i.e. with pileup added) one
00063 vector<fastjet::PseudoJet> hard_event, full_event;
00064
00065 // maximum rapidity that we accept for the input particles
00066 double etamax = 6.0;
00067
00068 // read in input particles. Keep the hard event generated by PYTHIA
00069 // separated from the full event, so as to be able to gauge the
00070 // "goodness" of the subtraction from the full event which also
00071 // includes pileup
00072 string line;
00073 int nsub = 0;
00074 while (getline(cin, line)) {
00075 istringstream linestream(line);
00076 // take substrings to avoid problems when there are extra "pollution"
00077 // characters (e.g. line-feed).
00078 if (line.substr(0,4) == "#END") {break;}
00079 if (line.substr(0,9) == "#SUBSTART") {
00080 // if more sub events follow, make copy of hard one here
00081 if (nsub == 1) hard_event = full_event;
00082 nsub += 1;
00083 }
00084 if (line.substr(0,1) == "#") {continue;}
00085 valarray<double> fourvec(4);
00086 linestream >> fourvec[0] >> fourvec[1] >> fourvec[2] >> fourvec[3];
00087 fastjet::PseudoJet psjet(fourvec);
00088 psjet.set_user_index(0);
00089 // push event onto back of full_event vector
00090 if (abs(psjet.rap()) < etamax) {full_event.push_back(psjet);}
00091 }
00092
00093 // if we have read in only one event, copy it across here...
00094 if (nsub == 1) hard_event = full_event;
00095
00096 // if there was nothing in the event
00097 if (nsub == 0) {
00098 cerr << "Error: read empty event\n";
00099 exit(-1);
00100 }
00101
00102
00103 // create an object that represents your choice of jet finder and
00104 // the associated parameters
00105 double R = 0.7;
00106 fastjet::Strategy strategy = fastjet::Best;
00107 fastjet::JetDefinition jet_def(fastjet::kt_algorithm, R, strategy);
00108
00109 // create an object that specifies how we to define the (active) area
00110 double ghost_etamax = 6.0;
00111 int active_area_repeats = 1;
00112 double ghost_area = 0.01;
00113 fastjet::ActiveAreaSpec area_spec(ghost_etamax, active_area_repeats,
00114 ghost_area);
00115
00116 // run the jet clustering with the above jet definition. hard event first
00117 fastjet::ClusterSequenceActiveArea clust_seq(hard_event,
00118 jet_def, area_spec);
00119
00120
00121 // extract the inclusive jets with pt > 5 GeV, sorted by pt
00122 double ptmin = 5.0;
00123 vector<fastjet::PseudoJet> inclusive_jets = clust_seq.inclusive_jets(ptmin);
00124
00125 // print them out
00126 cout << "" <<endl;
00127 cout << "Hard event only"<<endl;
00128 cout << "Number of input particles: "<<hard_event.size()<<endl;
00129 cout << "Strategy used: "<<clust_seq.strategy_string()<<endl;
00130 cout << "Printing inclusive jets with pt > "<< ptmin<<" GeV\n";
00131 cout << "---------------------------------------\n";
00132 print_jets(clust_seq, inclusive_jets);
00133 cout << endl;
00134
00135
00136 // repeat everything on the full event
00137
00138 // run the jet clustering with the above jet definition
00139 fastjet::ClusterSequenceActiveArea clust_seq_full(full_event,
00140 jet_def, area_spec);
00141
00142 // extract the inclusive jets with pt > 20 GeV, sorted by pt
00143 ptmin = 20.0;
00144 inclusive_jets = clust_seq_full.inclusive_jets(ptmin);
00145
00146 // print them out
00147 cout << "Full event, with pileup, and its subtraction"<<endl;
00148 cout << "Number of input particles: "<<full_event.size()<<endl;
00149 cout << "Strategy used: "<<clust_seq_full.strategy_string()<<endl;
00150 cout << "Printing inclusive jets with pt > "<< ptmin<<" GeV (before subtraction)\n";
00151 cout << "---------------------------------------\n";
00152 print_jets(clust_seq_full, inclusive_jets);
00153 cout << endl;
00154
00155
00156 }
|
|
||||||||||||
|
a function that pretty prints a list of jets, and performs the subtraction in two different ways
Definition at line 162 of file fastjet_subtraction.cc. References fastjet::ClusterSequenceActiveArea::area(), fastjet::ClusterSequenceActiveArea::area_4vector(), fastjet::PseudoJet::E(), fastjet::PseudoJet::perp2(), fastjet::ClusterSequenceActiveArea::pt_per_unit_area(), and fastjet::sorted_by_pt(). 00163 {
00164
00165 // sort jets into increasing pt
00166 vector<fastjet::PseudoJet> jets = sorted_by_pt(unsorted_jets);
00167
00168 // the corrected jets will go in here
00169 vector<fastjet::PseudoJet> corrected_jets(jets.size());
00170
00171 // get median pt per unit area
00172 // NB pt_per_unit_area exists only in ClusterSequenceActiveArea, and
00173 // not in the base class ClusterSequenceWithArea.
00174 // This might change in a future release
00175 double median_pt_per_area = clust_seq.pt_per_unit_area();
00176
00177 printf(" ijet rap phi Pt area Pt corr (rap corr phi corr Pt corr)ext\n");
00178 for (size_t j = 0; j < jets.size(); j++) {
00179
00180 // get area of each jet
00181 double area = clust_seq.area(jets[j]);
00182
00183 // "standard" correction. Subtract only the Pt
00184 double pt_corr = jets[j].perp() - area*median_pt_per_area;
00185
00186 // "extended" correction
00187 fastjet::PseudoJet area_4vect =
00188 median_pt_per_area*clust_seq.area_4vector(jets[j]);
00189 if (area_4vect.perp2() >= jets[j].perp2() ||
00190 area_4vect.E() >= jets[j].E()) {
00191 // if the correction is too large, set the jet to zero
00192 corrected_jets[j] = 0.0 * jets[j];
00193 } else {
00194 // otherwise do an E-scheme subtraction
00195 corrected_jets[j] = jets[j] - area_4vect;
00196 }
00197 // NB We could also leave out the above "if":
00198 // corrected_jets[j] = jets[j] - area_4vect;
00199 // but the result would be different, since we would not avoid
00200 // jets with negative Pt or energy
00201
00202 printf("%5u %7.3f %7.3f %9.3f %7.3f %9.3f %7.3f %7.3f %9.3f\n",
00203 j,jets[j].rap(),jets[j].phi(),jets[j].perp(), area, pt_corr,
00204 corrected_jets[j].rap(),corrected_jets[j].phi(), corrected_jets[j].perp());
00205 }
00206
00207 cout << endl;
00208 cout << "median pt_over_area = " << median_pt_per_area << endl << endl;
00209
00210
00211 }
|
1.4.2