ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/FGolf/Tools/goodrun.cc
(Generate patch)

Comparing UserCode/FGolf/Tools/goodrun.cc (file contents):
Revision 1.1 by fgolf, Sun Aug 29 18:25:19 2010 UTC vs.
Revision 1.2 by fgolf, Thu May 26 03:34:52 2011 UTC

# Line 1 | Line 1
1   // $Id$
2  
3   // CINT is allowed to see this, but nothing else:
4 < bool goodrun (unsigned int run, unsigned int lumi_block);
5 < bool goodrun_json (unsigned int run, unsigned int lumi_block);
6 < void set_goodrun_file (const char* filename);
7 < void set_goodrun_file_json (const char* filename);
4 > #include "goodrun.h"
5  
6   #ifndef __CINT__
7  
8   #include <assert.h>
9   #include <stdio.h>
10 + #include <stdlib.h>
11   #include <string.h>
12   #include <unistd.h>
13   #include <sys/types.h>
# Line 142 | Line 140 | static int load_runs (const char *fname,
140                 // printf("Read a line from the good run list: %s\n", buf);
141                 unsigned int run;
142                 char *pbuf = buf;
143 <               int s = sscanf(pbuf, " %u%n", &run, &n);
143 >                   s = sscanf(pbuf, " %u%n", &run, &n);
144                 if (s != 1) {
145                      fprintf(stderr, "Expected a run number (unsigned int)"
146                              " in the first position of line %d: %s\n", line, buf);
# Line 214 | Line 212 | bool goodrun (unsigned int run, unsigned
212       return false;
213   }
214  
215 + int min_run ()
216 + {
217 +     if (not good_runs_loaded_)
218 +          return -1;
219 +     set_t::const_iterator first = good_runs_.begin();
220 +     if (first != good_runs_.end())
221 +          return first->run;
222 +     return -1;
223 + }
224 +
225 + int max_run ()
226 + {
227 +     if (not good_runs_loaded_)
228 +          return -1;
229 +     set_t::const_iterator last = good_runs_.end();
230 +     if (last != good_runs_.begin()) {
231 +          last--;
232 +          return last->run;
233 +     }
234 +     return -1;
235 + }
236 +
237   bool goodrun_json (unsigned int run, unsigned int lumi_block)
238   {
239       if (not good_runs_loaded_) {
# Line 240 | Line 260 | void set_goodrun_file_json (const char*
260       good_runs_loaded_ = true;
261   }
262  
263 + int min_run_min_lumi ()
264 + {
265 +     if (not good_runs_loaded_)
266 +      return -1;
267 +     set_t::const_iterator first = good_runs_.begin();
268 +     if (first != good_runs_.end())
269 +      return first->lumi_min;
270 +     return -1;
271 + }
272 +
273 + int max_run_max_lumi ()
274 + {
275 +     if (not good_runs_loaded_)
276 +      return -1;
277 +     set_t::const_iterator last = good_runs_.end();
278 +     if (last != good_runs_.begin()) {
279 +      last--;
280 +      return last->lumi_max;
281 +     }
282 +     return -1;
283 + }
284 +
285   #endif // __CUNT__
286 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines