This file is indexed.

/usr/share/siscone/examples/options.cpp is in siscone-examples 2.0.6-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
///////////////////////////////////////////////////////////////////////////////
// File: options.cpp                                                         //
// Description: management of the cmdline options of the main program        //
// This file is part of the SISCone project.                                 //
// For more details, see http://projects.hepforge.org/siscone                //
//                                                                           //
// Copyright (c) 2006 Gavin Salam and Gregory Soyez                          //
//                                                                           //
// This program is free software; you can redistribute it and/or modify      //
// it under the terms of the GNU General Public License as published by      //
// the Free Software Foundation; either version 2 of the License, or         //
// (at your option) any later version.                                       //
//                                                                           //
// This program is distributed in the hope that it will be useful,           //
// but WITHOUT ANY WARRANTY; without even the implied warranty of            //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             //
// GNU General Public License for more details.                              //
//                                                                           //
// You should have received a copy of the GNU General Public License         //
// along with this program; if not, write to the Free Software               //
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
//                                                                           //
// $Revision:: 213                                                          $//
// $Date:: 2008-03-17 17:05:59 +0100 (Mon, 17 Mar 2008)                     $//
///////////////////////////////////////////////////////////////////////////////

#include "options.h"
#include <string.h>
#include <getopt.h>
#include <iostream>

using namespace std;
using namespace siscone;

#define N_DEFAULT          -1
#define R_DEFAULT          0.7
#define THRESHOLD_DEFAULT  0.5
#define PTMIN_DEFAULT      0.0
#define NPASS_DEFAULT      0
#define DEFAULT_EVENT      "events/single-event.dat"
#define SM_DEFAULT         SM_pttilde

/*******************************************
 * Coptions implementation                 *
 * options for the 'cone' sample           *
 *******************************************/

// default ctor
//--------------
Coptions::Coptions(){
  // set default flags values
  help_flag=0;
  version_flag=0;
  verbose_flag=1;

  // set default options values
  N_stop = N_DEFAULT;
  R = R_DEFAULT;
  f = THRESHOLD_DEFAULT;
  npass = NPASS_DEFAULT;
  ev_name = NULL;
  SM_var = SM_DEFAULT;
}


// default dtor
//--------------
Coptions::~Coptions(){
  if (ev_name!=NULL)
    delete[] ev_name;
}


// parse oprions
//  - argc  number of arguments from the command line
//  - argv  arguments from the command line
// return 1 on error, 0 on success
//---------------------------------
int Coptions::parse_options(int argc, char **argv){
  int opt_param;
  int option_index;
  bool stop=false;

  // browse the command-line options{
  static struct option siscone_options[]={
    // options that set a flag
    {"verbose",  no_argument, &verbose_flag, 1},
    {"quiet",    no_argument, &verbose_flag, 0},
    {"help",     no_argument, &help_flag   , 1},
    {"version",  no_argument, &version_flag, 1},
    // options setting parameters
    {"number",   required_argument, NULL, 'N'},
    {"radius",   required_argument, NULL, 'R'},
    {"fraction", required_argument, NULL, 'f'},
    {"ptmin",    required_argument, NULL, 'p'},
    {"npass",    required_argument, NULL, 'n'},
    {"event",    required_argument, NULL, 'e'},
    {"sm",       required_argument, NULL, 's'},
    {0,0,0,0}
  };

  
  do{
    // getopt_long stores the option index here.
    option_index=0;

    // retreive options
    opt_param = getopt_long(argc, argv, "hvqN:R:f:p:n:e:s:", 
			    siscone_options, &option_index);

    // Detect the end of the options.
    if (opt_param == -1)
      stop=true;

    // branch according to 'opt_param'
    switch (opt_param){
    case 'h': help_flag = 1;      break;  // help
    case 'v': verbose_flag = 1;   break;  // verbose
    case 'q': verbose_flag = 0;   break;  // quiet
    case 'N':  // max number of paprticles
      sscanf(optarg, "%d", &N_stop);
      if (N_stop<=0){
	cout << "Warning: the specified number of particles must be positive. Using default one" << endl;
	N_stop = N_DEFAULT;
      }
      break;
    case 'R':
      sscanf(optarg, "%lf", &R);
      if (R<=0){
	cout << "Warning: the specified cone radius must be positive. Using default one" << endl;
	R = R_DEFAULT;
      }      
      break;
    case 'f':
      sscanf(optarg, "%lf", &f);
      if ((f<0) || (f>1)){
	cout << "Warning: the specified split/merge threshold must be in [0,1]. Using default one" << endl;
	f = THRESHOLD_DEFAULT;
      }            
      break;
    case 'p':
      sscanf(optarg, "%lf", &ptmin);
      if (ptmin<0){
	cout << "Warning: the specified minimal pT must be non-negative. Using default one" << endl;
	ptmin = PTMIN_DEFAULT;
      }            
      break;
    case 'n':  // max number of paprticles
      sscanf(optarg, "%d", &npass);
      if (npass<0){
	cout << "Warning: the specified number of passes must be non negative. Using default one" << endl;
	npass = NPASS_DEFAULT;
      }
      break;
    case 'e':
      if (ev_name==NULL){
	ev_name = new char[strlen(optarg)+1];
	strcpy(ev_name, optarg);
      }
      break;
    case 's':
      char tmp[512];
      strcpy(tmp, optarg);
      if (strcmp(tmp, "pttilde")==0){
	SM_var = SM_pttilde;
      } else if (strcmp(tmp, "mt")==0){
	SM_var = SM_mt;
      } else if (strcmp(tmp, "pt")==0){
	SM_var = SM_pt;
      } else if (strcmp(tmp, "Et")==0){
	SM_var = SM_Et;
      } else {
	cout << "Warning: the specified varible for split--merge is not valid (should be pttilde, pt, mt or Et). Using pttilde as the default one." << endl;
	SM_var = SM_pttilde;
      }
      break;
    case 0:
    case -1:
      break;
    case '?':
      fprintf(stderr, "Giving up.\n");
      return 1;
      break;
    default:
      if (!help_flag){
	fprintf(stderr, "unrecognized option %c. Giving up.\n", opt_param);
	return 1;
      }
    }
  } while (!stop);
  
  if (ev_name==NULL){
    ev_name = new char[strlen(DEFAULT_EVENT)+1];
    strcpy(ev_name, DEFAULT_EVENT);
  }
  
  return 0;
}


// print the help message
//------------------------
int Coptions::print_help(){
  cout << siscone_package_name() << " " << siscone_version() << endl;
  cout << "Usage: " << siscone_package_name() << " <args>" << endl;
  cout << endl;
  cout << "Here is an exhaustive list of the arguments:" << endl;
  cout << "Parameters control (with default values):" << endl;
  cout << "  -n <val>, --number=<val>  : set the maximum number of particles allowed (all)" << endl;
  cout << "  -R <val>, --radius=<val>  : set the radius (" << R_DEFAULT << ")" << endl;
  cout << "  -f <val>, --fraction=<val>: set the overlap parameter (" << THRESHOLD_DEFAULT << ")" << endl;
  cout << "  -p <val>, --ptmin=<val>   : set the minimal pT for protojets (" << PTMIN_DEFAULT << ")" << endl;
  cout << "  -n <val>, --npass=<val>   : set the maximal number of passes (0 for no limit) (" << NPASS_DEFAULT << ")" << endl;
  cout << "  -e <val>, --event=<val>   : set the event filename (" << DEFAULT_EVENT << ")" << endl;
  cout << "  -s <val>, --sm=<val>      : variable for split--merge: pttilde, mt, pt or Et (pttilde)" << endl;
  cout << endl;
  cout << "Output flags" << endl;
  cout << "  --version    : show version information" << endl;
  cout << "  -h, --help   : show this message" << endl;
  cout << "  -v, --verbose: be verbose (on by default)" << endl;
  cout << "  -q, --quiet  : be quiet" << endl;
  cout << endl;

  return 0;
}


// print program version
//-----------------------
int Coptions::print_version(){
  cout << siscone_package_name() << " " << siscone_version() << endl;
  cout << "Copyright (C) 2006." << endl;
  cout << siscone_package_name() << " comes with NO WARRANTY," << endl;
  cout << "to the extent permitted by law." << endl;
  cout << "You may redistribute copies of " << siscone_package_name() << endl;
  cout << "under the terms of the GNU General Public License." << endl;
  cout << "For more information about these matters," << endl;
  cout << "see the files named COPYING." << endl;
  cout << "Please send bugs or comments to AUTHORS" << endl;

  return 0;
}