00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00026
00027 #include <stdio.h>
00028 #include <iostream>
00029 #include <iomanip>
00030 #include "siscone/momentum.h"
00031 #include "siscone/siscone.h"
00032
00033 #define R 0.7
00034 #define f 0.5
00035 #define f_alt 0.75
00036
00037 using namespace std;
00038 using namespace siscone;
00039
00040 int main(int argc, char *argv[]){
00041 vector<Cmomentum> particles;
00042 Csiscone siscone;
00043 int i;
00044 int N;
00045 double px,py,pz,E;
00046 char fline[512];
00047
00048
00049 FILE *flux;
00050 flux = fopen("events/single-event.dat", "r");
00051 if (flux==NULL){
00052 cerr << "cannot read event" << endl;
00053 return 1;
00054 }
00055
00056 N=0;
00057 while (fgets(fline, 512, flux)!=NULL){
00058 if (fline[0]!='#'){
00059 if (sscanf(fline, "%le%le%le%le", &px, &py, &pz, &E)==4){
00060 particles.push_back(Cmomentum(px, py, pz, E));
00061 N++;
00062 } else {
00063 cout << "error in reading event file Giving up." << endl;
00064 fclose(flux);
00065 return 2;
00066 }
00067 }
00068 }
00069 fclose(flux);
00070
00071
00072
00073 i=siscone.compute_jets(particles, R, f);
00074 cout << " " << i << " jets found in multi-pass run" << endl;
00075
00076
00077 i=siscone.recompute_jets(f_alt);
00078 cout << " " << i << " jets found with alterntive f" << endl;
00079
00080
00081 i=siscone.compute_jets(particles, R, f, 1);
00082 cout << " " << i << " jets found in single-pass run" << endl;
00083
00084
00085 vector<Cjet>::iterator it_j;
00086 int i1;
00087 fprintf(stdout, "# pT eta phi px py pz E \n");
00088 for (it_j = siscone.jets.begin(), i1=0 ;
00089 it_j != siscone.jets.end() ; it_j++, i1++){
00090 fprintf(stdout, "Jet %3d: %10.3lf %8.3lf %8.3lf %10.3lf %10.3lf %10.3lf %10.3lf\n",
00091 i1, it_j->v.perp(), it_j->v.eta, it_j->v.phi, it_j->v.px, it_j->v.py, it_j->v.pz, it_j->v.E);
00092 }
00093
00094 return 0;
00095 }