Belle II Software  release-05-01-25
TRGCDCFrontEndImplementation.cc
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : TRGCDCFrontEndImplementation.cc
5 // Section : TRG CDC
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A program to generate VHDL code for the CDC trigger front-end.
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #define TRG_SHORT_NAMES
15 
16 #include <iostream>
17 #include <fstream>
18 #include <string>
19 #include "trg/trg/Utilities.h"
20 #include "trg/cdc/FrontEnd.h"
21 
22 using namespace std;
23 using namespace Belle2;
24 
25 #define DEBUG_LEVEL 0
26 #define NAME "TRGCDCFrontEndImplementation"
27 #define VERSION "version 0.00"
28 #define NOT_CONNECTED 99999
29 
30 int
31 main(int argc, char* argv[])
32 {
33 
34  cout << NAME << " ... " << VERSION << endl;
35  const string tab = " ";
36 
37  //...Check arguments...
38  if (argc < 2) {
39  cout << NAME << " !!! one argument necessary" << endl
40  << tab << " 1 : Version for new config file" << endl;
41  return -1;
42  }
43 
44  //...Date...
45  string ts0 = TRGUtil::dateStringF();
46  string ts1 = TRGUtil::dateString();
47 
48  //...2nd argument...
49  const string version = argv[1];
50 
51  //...1st argument...
52  const string outname = "TRGCDCFrontEndImplementation_" + version + "_"
53  + ts0 + ".vhdl";
54 
55  //...Open configuration data...
56  ofstream outfile(outname.c_str(), ios::out);
57  if (outfile.fail()) {
58  cout << NAME << " !!! can not open file" << endl
59  << " " << outname << endl;
60  return -2;
61  }
62 
63  //...Inner...
64  outfile << "-- Generated by " << NAME << " " << VERSION << endl;
65  outfile << "-- " << TRGCDCFrontEnd::version() << endl;
66  outfile << "-- " << ts1 << endl;
67  outfile << "--" << endl;
68  TRGCDCFrontEnd::implementation(TRGCDCFrontEnd::innerInside, outfile);
69  outfile.close();
70 
71  //...Termination...
72  cout << NAME << " ... terminated" << endl;
73 }
main
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:77
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19