StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ConverL.C
1 #include "LASERINO_TABLE.h"
2 void ConverL() {
3  ofstream &out = cout;
4  // out.open("laserino.h", ios::out);
5  out << "static LASERINO_t Bundles[14][6] = " << endl;
6  // cout << " ===== Bundles ======= " << endl;
7  LASERINO_t Bundles[14][6];
8  for (Int_t r = 0; r < 14; r++) {
9  Int_t sector = Locals[r][0][0].Sector;
10  Int_t s = (sector-1)/2;
11  for (Int_t b = 0; b < 6; b++) {
12  Int_t m = 3;
13  Bundles[r][b] = Locals[r][b][m];
14  Bundles[r][b].dX = Bundles[r][b].ddX = Bundles[r][b].dY = Bundles[r][b].ddY = 0;
15 
16  Bundles[r][b].DeltaPhi = - 1.e-3*(dPhiC[s].Angle+dPhiC2[s].Angle);
17  if (r == 0 && b == 0) out << " {{{";
18  else {
19  if (b == 0) out << " {{";
20  else out << " {";
21  }
22  // Bundles[r][b].Print();
23  Bundles[r][b].Write(out);
24  if (r == 13 && b == 5) out << "}}};";
25  else {
26  if (b == 5) out << "}},";
27  else out << "},";
28  }
29  out << endl;
30  }
31  }
32  // cout << " ===== Mirrors ======= " << endl;
33  LASERINO_t Mirrors[7];
34  out << "static LASERINO_t Mirrors[14][6][7] = " << endl;
35  for (Int_t r = 0; r < 14; r++) {
36  for (Int_t b = 0; b < 6; b++) {
37  Double_t phi0 = 0;
38  for (Int_t m = 0; m < 3; m++) phi0 += Locals[r][b][m].DeltaPhi;
39  Double_t phiM = -phi0;
40  for (Int_t m = 0; m < 7; m++) {
41  Mirrors[m] = Locals[r][b][m];
42  Mirrors[m].X -= Bundles[r][b].X;
43  Mirrors[m].Y -= Bundles[r][b].Y;
44  Mirrors[m].Z -= Bundles[r][b].Z;
45  Mirrors[m].ThetaZ -= Bundles[r][b].ThetaZ;
46  Mirrors[m].dX -= Bundles[r][b].dX;
47  Mirrors[m].dY -= Bundles[r][b].dY;
48  Mirrors[m].DeltaPhi = phiM;
49  phiM += Locals[r][b][m].DeltaPhi;
50  // Mirrors[m].Print();
51  }
52  // cout << " ------------- " << endl;
53  if ( Mirrors[0].Z > Mirrors[1].Z) { Mirrors[0].Status += 100; Mirrors[1].Status += 100;/* cout << "Z 1 > 2" << endl; Mirrors[0].Print(); Mirrors[1].Print(); */}
54  if ( Mirrors[0].Z > Mirrors[4].Z) { Mirrors[0].Status += 100; Mirrors[3].Status += 100;/* cout << "Z 1 > 4" << endl; Mirrors[0].Print(); Mirrors[3].Print(); */}
55  if ( Mirrors[6].Z > Mirrors[3].Z) { Mirrors[6].Status += 100; Mirrors[3].Status += 100;/* cout << "Z 7 > 4" << endl; Mirrors[6].Print(); Mirrors[3].Print(); */}
56  if ( Mirrors[6].Z > Mirrors[5].Z) { Mirrors[6].Status += 100; Mirrors[5].Status += 100;/* cout << "Z 7 > 6" << endl; Mirrors[6].Print(); Mirrors[5].Print(); */}
57 
58  if ( Mirrors[1].Z > Mirrors[2].Z) { Mirrors[1].Status += 100; Mirrors[4].Status += 100;/* cout << "Z 2 > 3" << endl; Mirrors[1].Print(); Mirrors[4].Print(); */}
59  if ( Mirrors[3].Z > Mirrors[2].Z) { Mirrors[3].Status += 100; Mirrors[2].Status += 100;/* cout << "Z 4 > 3" << endl; Mirrors[3].Print(); Mirrors[2].Print(); */}
60  if ( Mirrors[3].Z > Mirrors[4].Z) { Mirrors[3].Status += 100; Mirrors[4].Status += 100;/* cout << "Z 4 > 5" << endl; Mirrors[3].Print(); Mirrors[4].Print(); */}
61  if ( Mirrors[5].Z > Mirrors[4].Z) { Mirrors[5].Status += 100; Mirrors[4].Status += 100;/* cout << "Z 6 > 5" << endl; Mirrors[5].Print(); Mirrors[4].Print(); */}
62 
63  if ( Mirrors[0].X > Mirrors[1].X) { Mirrors[0].Status += 1; Mirrors[1].Status += 1;/* cout << "X 1 > 2" << endl; Mirrors[0].Print(); Mirrors[1].Print(); */}
64  if ( Mirrors[0].X > Mirrors[3].X) { Mirrors[0].Status += 1; Mirrors[3].Status += 1;/* cout << "X 1 > 4" << endl; Mirrors[0].Print(); Mirrors[3].Print(); */}
65  if ( Mirrors[0].X > Mirrors[5].X) { Mirrors[0].Status += 1; Mirrors[5].Status += 1;/* cout << "X 1 > 6" << endl; Mirrors[0].Print(); Mirrors[5].Print(); */}
66 
67  if ( Mirrors[6].X > Mirrors[1].X) { Mirrors[6].Status += 1; Mirrors[1].Status += 1;/* cout << "X 7 > 2" << endl; Mirrors[6].Print(); Mirrors[1].Print(); */}
68  if ( Mirrors[6].X > Mirrors[3].X) { Mirrors[6].Status += 1; Mirrors[3].Status += 1;/* cout << "X 7 > 4" << endl; Mirrors[6].Print(); Mirrors[3].Print(); */}
69  if ( Mirrors[6].X > Mirrors[5].X) { Mirrors[6].Status += 1; Mirrors[5].Status += 1;/* cout << "X 7 > 6" << endl; Mirrors[6].Print(); Mirrors[5].Print(); */}
70 
71  if ( Mirrors[1].X > Mirrors[2].X) { Mirrors[0].Status += 1; Mirrors[2].Status += 1;/* cout << "X 1 > 3" << endl; Mirrors[0].Print(); Mirrors[2].Print(); */}
72  if ( Mirrors[3].X > Mirrors[2].X) { Mirrors[3].Status += 1; Mirrors[2].Status += 1;/* cout << "X 4 > 3" << endl; Mirrors[3].Print(); Mirrors[2].Print(); */}
73  if ( Mirrors[5].X > Mirrors[2].X) { Mirrors[5].Status += 1; Mirrors[2].Status += 1;/* cout << "X 6 > 3" << endl; Mirrors[5].Print(); Mirrors[2].Print(); */}
74 
75  if ( Mirrors[1].X > Mirrors[4].X) { Mirrors[0].Status += 1; Mirrors[4].Status += 1;/* cout << "X 1 > 5" << endl; Mirrors[0].Print(); Mirrors[4].Print(); */}
76  if ( Mirrors[3].X > Mirrors[4].X) { Mirrors[3].Status += 1; Mirrors[4].Status += 1;/* cout << "X 4 > 5" << endl; Mirrors[3].Print(); Mirrors[4].Print(); */}
77  if ( Mirrors[5].X > Mirrors[4].X) { Mirrors[5].Status += 1; Mirrors[4].Status += 1;/* cout << "X 6 > 5" << endl; Mirrors[5].Print(); Mirrors[4].Print(); */}
78 
79  if ( Mirrors[1].Y > Mirrors[0].Y) { Mirrors[1].Status += 10; Mirrors[0].Status += 10;/* cout << "Y 2 > 1" << endl; Mirrors[1].Print(); Mirrors[0].Print(); */}
80  if ( Mirrors[1].Y > Mirrors[2].Y) { Mirrors[1].Status += 10; Mirrors[2].Status += 10;/* cout << "Y 2 > 3" << endl; Mirrors[1].Print(); Mirrors[2].Print(); */}
81 
82  if ( Mirrors[0].Y > Mirrors[3].Y) { Mirrors[0].Status += 10; Mirrors[4].Status += 10;/* cout << "Y 1 > 4" << endl; Mirrors[0].Print(); Mirrors[4].Print(); */}
83  if ( Mirrors[2].Y > Mirrors[3].Y) { Mirrors[2].Status += 10; Mirrors[4].Status += 10;/* cout << "Y 3 > 4" << endl; Mirrors[2].Print(); Mirrors[4].Print(); */}
84  if ( Mirrors[3].Y > Mirrors[4].Y) { Mirrors[3].Status += 10; Mirrors[4].Status += 10;/* cout << "Y 4 > 5" << endl; Mirrors[3].Print(); Mirrors[4].Print(); */}
85  if ( Mirrors[3].Y > Mirrors[6].Y) { Mirrors[3].Status += 10; Mirrors[6].Status += 10;/* cout << "Y 4 > 7" << endl; Mirrors[3].Print(); Mirrors[6].Print(); */}
86  if ( Mirrors[4].Y > Mirrors[5].Y) { Mirrors[4].Status += 10; Mirrors[5].Status += 10;/* cout << "Y 5 > 6" << endl; Mirrors[4].Print(); Mirrors[5].Print(); */}
87  if ( Mirrors[6].Y > Mirrors[5].Y) { Mirrors[6].Status += 10; Mirrors[5].Status += 10;/* cout << "Y 7 > 6" << endl; Mirrors[6].Print(); Mirrors[5].Print(); */}
88  for (Int_t m = 0; m < 7; m++) {
89  if (r == 0 && b == 0 && m == 0) out << " {{{{";
90  else {
91  if (b == 0 && m == 0) out << " {{{";
92  else {
93  if (m == 0) out << " {{";
94  else out << " {";
95  }
96  }
97  // Bundles[r][b].Print();
98  Mirrors[m].Write(out);
99  if (r == 13 && b == 5 && m == 6) out << "}}}};";
100  else {
101  if (b == 5 && m == 6) out << "}}},";
102  else {
103  if (m == 6) out << "}}";
104  else out << "},";
105  }
106  }
107  out << endl;
108  }
109  // cout << " ------------- " << endl;
110  }
111  }
112  // out.close();
113 }