SToGS
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Geometry_Utilities.C
Go to the documentation of this file.
1 
2 
4 void ConvertAeulerTodfb(const Char_t *aeuler, const Char_t *dfb)
5 {
6  ifstream infil; infil.open(aeuler);
7  if ( !infil.is_open() ) {
8  G4cout << "[ConvertAeulerTodfb] *** Cannot open input file " << aeuler << endl; // end read the file.
9  return 0x0 ;
10  }
11  ofstream oufil; oufil.open(dfb);
12  if ( !oufil.is_open() ) {
13  G4cout << "[ConvertAeulerTodfb] *** Cannot open input file " << dfb << endl; // end read the file.
14  return 0x0 ;
15  }
16  std::string line; Int_t lline, i1, i2, nclust = 0; Double_t ps, th, ph, x, y, z; std::string sign_p[3], sign_r[3];
17 
18  //
19  oufil << "# " << endl;
20  oufil << "# First the world / detector envelop. if detector does not exist, box with dim given otherwise dim ignored " << endl;
21  oufil << "# " << endl;
22  oufil << "w AGATA +2. +2. +2. m " << endl;
23  oufil << "# " << endl;
24  oufil << "@ 0 -> " << endl;
25  oufil << "# " << endl;
26  oufil << "# " << endl;
27 
28  // read the input file
29  while( infil.good() ) {
30 
31  getline(infil,line);
32  //
33  if ( line.size() < 2u )
34  continue;
35  if ( line[0] == '#' )
36  continue;
37 
38  // decode the line
39  if(sscanf(line.data(),"%d %d %lf %lf %lf %lf %lf %lf", &i1, &i2, &ps, &th, &ph, &x, &y, &z) != 8) {
40  break;
41  }
42  if ( ps < 0.0 ) {
43  sign_r[0] = "";
44  }
45  else sign_r[0] = "+";
46  if ( th < 0.0 ) {
47  sign_r[1] = "";
48  }
49  else sign_r[1] = "+";
50  if ( ph < 0.0 ) {
51  sign_r[2] = "";
52  }
53  else sign_r[2] = "+";
54  //
55  if ( x < 0.0 ) {
56  sign_p[0] = "";
57  }
58  else sign_p[0] = "+";
59  if ( y < 0.0 ) {
60  sign_p[1] = "";
61  }
62  else sign_p[1] = "+";
63  if ( z < 0.0 ) {
64  sign_p[2] = "";
65  }
66  else sign_p[2] = "+";
67 
68  oufil << "* DetectorFactory/SemiConductors/Ge/AGATA-TC\t"
69  << sign_p[0] << x << "\t" << sign_p[1] << y << "\t" << sign_p[2] << z << "\tmm"
70  << "\tRz " << sign_r[0] << ps << "\tRy " << sign_r[1] << th << "\tRz " << sign_r[2] << ph << "" << endl;
71  }
72  oufil << "# " << endl;
73  oufil << "# end " << endl;
74 
75 }
void ConvertAeulerTodfb(const Char_t *aeuler, const Char_t *dfb)
read aeuler file as given in the AGATA G4 package and creates a .dfb that can be used in SToGS ...