siscone is hosted by Hepforge, IPPP Durham

The SISCone Jet Algorithm

Version 3.0.6



SISCone 3.0.6
spherical.cpp
1
2// File: spherical.cpp //
3// Description: example program for the CSphsiscone class (spherical SISCone)//
4// This file is part of the SISCone project. //
5// WARNING: this is not the main SISCone trunk but //
6// an adaptation to spherical coordinates //
7// For more details, see http://projects.hepforge.org/siscone //
8// //
9// Copyright (c) 2006 Gavin Salam and Gregory Soyez //
10// //
11// This program is free software; you can redistribute it and/or modify //
12// it under the terms of the GNU General Public License as published by //
13// the Free Software Foundation; either version 2 of the License, or //
14// (at your option) any later version. //
15// //
16// This program is distributed in the hope that it will be useful, //
17// but WITHOUT ANY WARRANTY; without even the implied warranty of //
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
19// GNU General Public License for more details. //
20// //
21// You should have received a copy of the GNU General Public License //
22// along with this program; if not, write to the Free Software //
23// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
24// //
25// $Revision:: 227 $//
26// $Date:: 2008-06-12 20:00:44 -0400 (Thu, 12 Jun 2008) $//
28
29#include <stdio.h>
30#include <iostream>
31#include <iomanip>
32#include "siscone/spherical/momentum.h"
33#include "siscone/spherical/siscone.h"
34
35#define R 0.7
36#define f 0.5
37#define f_alt 0.75
38
39using namespace std;
40using namespace siscone_spherical;
41
42int main(){
43 vector<CSphmomentum> particles; // list of particles
44 CSphsiscone siscone; // main object for the cone algorithm
45 int i; // loop index
46 int N; // number of particles
47 double px,py,pz,E; // particles 4-momentum
48 char fline[512]; // line to read from a file
49
50 // read particles
51 FILE *flux;
52 flux = fopen("events/single-event.dat", "r");
53 if (flux==NULL){
54 cerr << "cannot read event" << endl;
55 return 1;
56 }
57
58 N=0;
59 while (fgets(fline, 512, flux)!=NULL){
60 if (fline[0]!='#'){ // skip lines beginning with '#'
61 if (sscanf(fline, "%le%le%le%le", &px, &py, &pz, &E)==4){
62 particles.push_back(CSphmomentum(px, py, pz, E));
63 N++;
64 } else {
65 cout << "error in reading event file Giving up." << endl;
66 fclose(flux);
67 return 2;
68 }
69 }
70 }
71 fclose(flux);
72
73 // compute jets
74 // first compute with multiple passes (default)
75 i=siscone.compute_jets(particles, R, f);
76 cout << " " << i << " jets found in multi-pass run" << endl;
77
78 // then, recompute it with a different f
79 i=siscone.recompute_jets(f_alt);
80 cout << " " << i << " jets found with alternative f" << endl;
81
82 // one pass
83 i=siscone.compute_jets(particles, R, f, 1);
84 cout << " " << i << " jets found in single-pass run" << endl;
85
86 // show jets
87 vector<CSphjet>::iterator it_j;
88 int i1;
89 fprintf(stdout, "# theta phi px py pz E \n");
90 for (it_j = siscone.jets.begin(), i1=0 ;
91 it_j != siscone.jets.end() ; it_j++, i1++){
92 fprintf(stdout, "Jet %3d: %8.3f %8.3f %10.3f %10.3f %10.3f %10.3f\n",
93 i1, it_j->v._theta, it_j->v._phi, it_j->v.px, it_j->v.py, it_j->v.pz, it_j->v.E);
94 }
95
96 return 0;
97}
base class for dynamic coordinates management
Definition: momentum.h:158
final class: gather everything to compute the jet contents.
Definition: siscone.h:50
int compute_jets(std::vector< CSphmomentum > &_particles, double _radius, double _f, int _n_pass_max=0, double _Emin=0.0, Esplit_merge_scale _split_merge_scale=SM_Etilde)
compute the jets from a given particle set.
Definition: siscone.cpp:81
int recompute_jets(double _f, double _Emin=0.0, Esplit_merge_scale _split_merge_scale=SM_Etilde)
recompute the jets with a different overlap parameter.
Definition: siscone.cpp:215
std::vector< CSphjet > jets
list of jets
Definition: split_merge.h:357

The SISCone project has been developed by Gavin Salam and Gregory Soyez
Documentation generated on Tue Jun 20 2023 18:08:37 for SISCone by  Doxygen 1.9.4