Example program to test combinatorics of pairs of indices (class JTOOLS::JCombinatorics).  
More...
#include <string>
#include <iostream>
#include <iomanip>
#include "JTools/JCombinatorics.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
 
Go to the source code of this file.
 | 
| int  | main (int argc, char **argv) | 
|   | 
Example program to test combinatorics of pairs of indices (class JTOOLS::JCombinatorics). 
- Author
 - mdejong 
 
Definition in file JCombinatorics.cc.
 
◆ main()
      
        
          | int main  | 
          ( | 
          int |           argc,  | 
        
        
           | 
           | 
          char ** |           argv ) | 
        
      
 
Definition at line 15 of file JCombinatorics.cc.
   16{
   18 
   19  int     numberOfElements;
   21 
   22  try { 
   23 
   24    JParser<> zap(
"Example program to test combinatorics of pairs of indices.");
 
   25    
   28 
   29    zap(argc, argv);
   30  }
   31  catch(const exception &error) {
   32    FATAL(error.what() << endl);
 
   33  }
   34 
   35 
   37 
   38  if (numberOfElements <= 0) {
   39    FATAL(
"Number of elements " << numberOfElements << 
" <= 0" << endl);
 
   40  }
   41 
   42 
   44 
   46 
   47  for (int i = 0; i != (int) combinatorics.getNumberOfPairs(); ++i) {
   48 
   50 
   51    STATUS(
"pair[" << setw(4) << i << 
"] => (" << setw(3) << 
pair.first << 
"," << setw(3) << 
pair.second << 
")" << endl);
 
   52 
   53    if (i != combinatorics.getIndex(
pair.first, 
pair.second)) {
 
   54 
   56 
   58            setw(3) << 
pair.first  << 
' ' <<
 
   59            setw(3) << 
pair.second << 
' ' <<
 
   60            setw(4) << combinatorics.getIndex(
pair.first, 
pair.second) << endl);
 
   61    }
   62  }
   64 
   65  NOTICE(
"Number of elements " << setw(8) << right << numberOfElements                 << endl);
 
   66  NOTICE(
"Number of pairs    " << setw(8) << right << combinatorics.getNumberOfPairs() << endl);
 
   67  NOTICE(
"Number of errors   " << setw(8) << right << n                                << endl);
 
   68 
   70}
#define DEBUG(A)
Message macros.
 
#define ASSERT(A,...)
Assert macro.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Utility class to parse command line options.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).