FairRoot/PandaRoot
PndGeoHypGeDoubleCluster.cxx
Go to the documentation of this file.
1 // ******** Implementation of class to build HypGe Double Cluster Geometry *************
2 // by steinen@kph.uni-mainz.de
4 #include "PndGeoHypGeCrystal.h"
5 #include <iostream>
6 
7 
9 
10 using namespace std;
11 //double Pi = TMath::Pi();
12 // ----- Default constructor -------------------------------------------
14 {
15  // Constructor
16 }
17 // ----- constructor to use -------------------------------------------
18 PndGeoHypGeDoubleCluster::PndGeoHypGeDoubleCluster(TGeoMedium *ExtGe, TGeoMedium *ExtAl,Int_t ExtClusterNumber)
19 {
20  MakeTop = true;
21 
22  Ge = ExtGe;
23  Al = ExtAl;
24  ClusterNumber= ExtClusterNumber;
25  StartClusterNumber = ExtClusterNumber;
31  //ClusterAssembly = new TGeoVolumeAssembly("ClusterAssembly"); //z = 0 only once, every other z value twice (outer and inner); always x and y coordinate
32 
33  //read coordinates from file
34  char* InputTitleBuffer;
37  string Filename = getenv("VMCWORKDIR");
38  Filename +="/hypGe/geometry/PndGeoHypGeDoubleClusterParfile.txt";
39 
40  ParametersInputFile.open(Filename.data());
43  ParametersInputFile.close();
44 
46  CryostatLowerArb8Heigt = ZValuesInputArray[2]-ZValuesInputArray[1];
47  CryostatMiddleArb8Heigt= ZValuesInputArray[3]-ZValuesInputArray[2];
48  CryostatUpperArb8Heigt= ZValuesInputArray[4]-ZValuesInputArray[3];
50 }
51 
52 
53 
54 // ------- destructor --------------
56 {
57  cout << "Destrucor called" << endl;
58 };
59 
60 // --------------- build the crystals ---------------------------
61 
62 void PndGeoHypGeDoubleCluster::BuildCrystals(Int_t *CrystalNumber)
63 {
64  //create 2 crystals. The copy number of a crystal is composed of the number of the cluster and a running number for every placed crystal like e.g.: cluster 4, crystal 7: 407 ; cluster 11, crystal 21: 1121
65  Crystal1Number = *CrystalNumber;
66  *CrystalNumber+=1;
67  Crystal2Number = *CrystalNumber;
68  *CrystalNumber+=1;
69  cout << "Cluster:" << ClusterNumber << "\tCrystal1Number: "<< Crystal1Number<<endl;
70  cout << "Cluster:" << ClusterNumber << "\tCrystal2Number: "<< Crystal2Number<<endl;
71 
74 
75 
76  //set positions of the 2 crystals
77 
78  DoubleCrystalYOffset = 6.1141/2; //measured in CAD
79  DoubleCrystalZOffset = 0.7704; //measured in CAD
80 
81  Crystal1Rotation = new TGeoRotation("Crystal1Rotation", 0,-4.125,0); //angles measured in CAD drawing
82  Crystal1Rotation ->RegisterYourself();
83  Crystal2Rotation = new TGeoRotation("Crystal2Rotation", 0,4.125,0);
84  Crystal2Rotation ->RegisterYourself();
85 
86  //maybe some signs needs adaption
88  Crystal1Position->RegisterYourself();
90  Crystal2Position->RegisterYourself();
91 
92 
95 };
96 
97 // --------------- build the cryostat --------------------------
99 {
100  // the cryostat is a combination front, side and top parts. The front and the top is build of 4 TGeoArb8. The side parts are split into 10 lower, 10 middle and 10 upper parts. All are TGeoArb8. This parts are all combined to a TGeoCompositeShape
101 
102  string CompositeShapeExpression;
103 //the front of the cryostat
104 
113 
114  CryostatFrontArb8_1 = new TGeoArb8 ("CryostatDoubleFrontArb8_1",CryostatFrontThickness/2,CryostatFrontArb8XY_1);
115  CryostatFrontArb8_2 = new TGeoArb8 ("CryostatDoubleFrontArb8_2",CryostatFrontThickness/2,CryostatFrontArb8XY_2);
116  CryostatFrontArb8_3 = new TGeoArb8 ("CryostatDoubleFrontArb8_3",CryostatFrontThickness/2,CryostatFrontArb8XY_3);
117  CryostatFrontArb8_4 = new TGeoArb8 ("CryostatDoubleFrontArb8_4",CryostatFrontThickness/2,CryostatFrontArb8XY_4);
118 
119  CryostatFrontTranslation = new TGeoTranslation("CryostatDoubleFrontTranslation",0,0,CryostatFrontThickness/2);
120  CryostatFrontTranslation->RegisterYourself();
121 
122  for (Int_t i = 1; i < NumberOfFrontArb8+1; i++)
123  {
124  char buffer[100];
125  sprintf(buffer, "CryostatDoubleFrontArb8_%d : CryostatDoubleFrontTranslation",i);
126  CompositeShapeExpression += buffer;
127  //if (i<NumberOfFrontArb8) //uncomment if last part of composite shape
128  {
129  CompositeShapeExpression += "+";
130  }
131  }
132 
133 //the lower part of the cryostat
134 
155 
156 
157 
158  CryostatLowerArb8_1 = new TGeoArb8 ("CryostatDoubleLowerArb8_1",CryostatLowerArb8Heigt/2,CryostatLowerArb8XY_1);
159  CryostatLowerArb8_2 = new TGeoArb8 ("CryostatDoubleLowerArb8_2",CryostatLowerArb8Heigt/2,CryostatLowerArb8XY_2);
160  CryostatLowerArb8_3 = new TGeoArb8 ("CryostatDoubleLowerArb8_3",CryostatLowerArb8Heigt/2,CryostatLowerArb8XY_3);
161  CryostatLowerArb8_4 = new TGeoArb8 ("CryostatDoubleLowerArb8_4",CryostatLowerArb8Heigt/2,CryostatLowerArb8XY_4);
162  CryostatLowerArb8_5 = new TGeoArb8 ("CryostatDoubleLowerArb8_5",CryostatLowerArb8Heigt/2,CryostatLowerArb8XY_5);
163  CryostatLowerArb8_6 = new TGeoArb8 ("CryostatDoubleLowerArb8_6",CryostatLowerArb8Heigt/2,CryostatLowerArb8XY_6);
164  CryostatLowerArb8_7 = new TGeoArb8 ("CryostatDoubleLowerArb8_7",CryostatLowerArb8Heigt/2,CryostatLowerArb8XY_7);
165  CryostatLowerArb8_8 = new TGeoArb8 ("CryostatDoubleLowerArb8_8",CryostatLowerArb8Heigt/2,CryostatLowerArb8XY_8);
166  CryostatLowerArb8_9 = new TGeoArb8 ("CryostatDoubleLowerArb8_9",CryostatLowerArb8Heigt/2,CryostatLowerArb8XY_9);
167  CryostatLowerArb8_10 = new TGeoArb8 ("CryostatDoubleLowerArb8_10",CryostatLowerArb8Heigt/2,CryostatLowerArb8XY_10);
168 
169  CryostatLowerTranslation = new TGeoTranslation("CryostatDoubleLowerTranslation",0,0,CryostatFrontThickness+CryostatLowerArb8Heigt/2);
170  CryostatLowerTranslation->RegisterYourself();
171 
172  for (Int_t i = 1; i < NumberOfCryostatEdges+1; i++)
173  {
174  char buffer[100];
175  sprintf(buffer, "CryostatDoubleLowerArb8_%d : CryostatDoubleLowerTranslation",i);
176  CompositeShapeExpression += buffer;
177  //if (i<NumberOfCryostatEdges) //uncomment if last part of composite shape
178  {
179  CompositeShapeExpression += "+";
180  }
181  }
182 
183 //the middle part of the cryostat
184 
205 
206 
207 
208  CryostatMiddleArb8_1 = new TGeoArb8 ("CryostatDoubleMiddleArb8_1",CryostatMiddleArb8Heigt/2,CryostatMiddleArb8XY_1);
209  CryostatMiddleArb8_2 = new TGeoArb8 ("CryostatDoubleMiddleArb8_2",CryostatMiddleArb8Heigt/2,CryostatMiddleArb8XY_2);
210  CryostatMiddleArb8_3 = new TGeoArb8 ("CryostatDoubleMiddleArb8_3",CryostatMiddleArb8Heigt/2,CryostatMiddleArb8XY_3);
211  CryostatMiddleArb8_4 = new TGeoArb8 ("CryostatDoubleMiddleArb8_4",CryostatMiddleArb8Heigt/2,CryostatMiddleArb8XY_4);
212  CryostatMiddleArb8_5 = new TGeoArb8 ("CryostatDoubleMiddleArb8_5",CryostatMiddleArb8Heigt/2,CryostatMiddleArb8XY_5);
213  CryostatMiddleArb8_6 = new TGeoArb8 ("CryostatDoubleMiddleArb8_6",CryostatMiddleArb8Heigt/2,CryostatMiddleArb8XY_6);
214  CryostatMiddleArb8_7 = new TGeoArb8 ("CryostatDoubleMiddleArb8_7",CryostatMiddleArb8Heigt/2,CryostatMiddleArb8XY_7);
215  CryostatMiddleArb8_8 = new TGeoArb8 ("CryostatDoubleMiddleArb8_8",CryostatMiddleArb8Heigt/2,CryostatMiddleArb8XY_8);
216  CryostatMiddleArb8_9 = new TGeoArb8 ("CryostatDoubleMiddleArb8_9",CryostatMiddleArb8Heigt/2,CryostatMiddleArb8XY_9);
217  CryostatMiddleArb8_10 = new TGeoArb8 ("CryostatDoubleMiddleArb8_10",CryostatMiddleArb8Heigt/2,CryostatMiddleArb8XY_10);
218 
219  CryostatMiddleTranslation = new TGeoTranslation("CryostatDoubleMiddleTranslation",0,0,CryostatFrontThickness +CryostatLowerArb8Heigt+CryostatMiddleArb8Heigt/2);
220  CryostatMiddleTranslation->RegisterYourself();
221 
222  for (Int_t i = 1; i < NumberOfCryostatEdges+1; i++)
223  {
224  char buffer[100];
225  sprintf(buffer, "CryostatDoubleMiddleArb8_%d : CryostatDoubleMiddleTranslation",i);
226  CompositeShapeExpression += buffer;
227  //if (i< NumberOfCryostatEdges) //uncomment if last part of composite shape
228  {
229  CompositeShapeExpression += "+";
230  }
231  }
232 
233 
234  //the upper part of the cryostat
235 
256 
257  CryostatUpperArb8_1 = new TGeoArb8 ("CryostatDoubleUpperArb8_1",CryostatUpperArb8Heigt/2,CryostatUpperArb8XY_1);
258  CryostatUpperArb8_2 = new TGeoArb8 ("CryostatDoubleUpperArb8_2",CryostatUpperArb8Heigt/2,CryostatUpperArb8XY_2);
259  CryostatUpperArb8_3 = new TGeoArb8 ("CryostatDoubleUpperArb8_3",CryostatUpperArb8Heigt/2,CryostatUpperArb8XY_3);
260  CryostatUpperArb8_4 = new TGeoArb8 ("CryostatDoubleUpperArb8_4",CryostatUpperArb8Heigt/2,CryostatUpperArb8XY_4);
261  CryostatUpperArb8_5 = new TGeoArb8 ("CryostatDoubleUpperArb8_5",CryostatUpperArb8Heigt/2,CryostatUpperArb8XY_5);
262  CryostatUpperArb8_6 = new TGeoArb8 ("CryostatDoubleUpperArb8_6",CryostatUpperArb8Heigt/2,CryostatUpperArb8XY_6);
263  CryostatUpperArb8_7 = new TGeoArb8 ("CryostatDoubleUpperArb8_7",CryostatUpperArb8Heigt/2,CryostatUpperArb8XY_7);
264  CryostatUpperArb8_8 = new TGeoArb8 ("CryostatDoubleUpperArb8_8",CryostatUpperArb8Heigt/2,CryostatUpperArb8XY_8);
265  CryostatUpperArb8_9 = new TGeoArb8 ("CryostatDoubleUpperArb8_9",CryostatUpperArb8Heigt/2,CryostatUpperArb8XY_9);
266  CryostatUpperArb8_10 = new TGeoArb8 ("CryostatDoubleUpperArb8_10",CryostatUpperArb8Heigt/2,CryostatUpperArb8XY_10);
267 
269  CryostatUpperTranslation->RegisterYourself();
270 
271  for (Int_t i = 1; i < NumberOfCryostatEdges+1; i++)
272  {
273  char buffer[100];
274  sprintf(buffer, "CryostatDoubleUpperArb8_%d : CryostatDoubleUpperTranslation",i);
275  CompositeShapeExpression += buffer;
276 
277  if (i<NumberOfCryostatEdges)
278  {
279  CompositeShapeExpression += "+";
280  }
281  if (i==NumberOfCryostatEdges && MakeTop )
282  {
283  CompositeShapeExpression += "+";
284  }
285  }
286 
287 //the top of the cryostat
288 
289  CryostatTopArb8XY_1 = new Double_t[16];
291  CryostatTopArb8XY_2 = new Double_t[16];
293  CryostatTopArb8XY_3 = new Double_t[16];
295  CryostatTopArb8XY_4 = new Double_t[16];
297 
298  CryostatTopArb8_1 = new TGeoArb8 ("CryostatDoubleTopArb8_1",CryostatTopThickness/2,CryostatTopArb8XY_1);
299  CryostatTopArb8_2 = new TGeoArb8 ("CryostatDoubleTopArb8_2",CryostatTopThickness/2,CryostatTopArb8XY_2);
300  CryostatTopArb8_3 = new TGeoArb8 ("CryostatDoubleTopArb8_3",CryostatTopThickness/2,CryostatTopArb8XY_3);
301  CryostatTopArb8_4 = new TGeoArb8 ("CryostatDoubleTopArb8_4",CryostatTopThickness/2,CryostatTopArb8XY_4);
302 
304  CryostatTopTranslation->RegisterYourself();
305 
306 
307  if (MakeTop)
308  {
309  for (Int_t i = 1; i < NumberOfTopArb8+1; i++)
310  {
311  char buffer[100];
312  sprintf(buffer, "CryostatDoubleTopArb8_%d : CryostatDoubleTopTranslation",i);
313  CompositeShapeExpression += buffer;
314  if (i<NumberOfTopArb8) //uncomment if last part of composite shape
315  {
316  CompositeShapeExpression += "+";
317  }
318  }
319  }
320 
321  //cout << CompositeShapeExpression << endl;
322 
323 
324  //combine the cryostat
325  CryostatShape = new TGeoCompositeShape("CryostatShape",CompositeShapeExpression.data() );
326  Cryostat = new TGeoVolume("Cryostat",CryostatShape,Al);
327  Cryostat->SetLineColor(kGreen);
328  Cryostat->SetFillColor(kGreen);
329  //bring the Cryostat in the right position
330  CryostatCombiTrans = new TGeoCombiTrans("CryostatCombiTrans",0,0,0,new TGeoRotation("CryostatRotation",0,180,0));
331  CryostatCombiTrans->RegisterYourself();
332 
334 
335 };
336 
337 // --------------- Prints the nodes of a cluster -----------------
339 {
340  if (nLevels == 0)
341  {
342  cout << "Nothing to Print, use higher number to go deeper in the tree." << endl;
343  }
344  if (nLevels > 0)
345  {
346  cout << "Printing the content of the cluster assembly." << endl;
347  cout <<endl << "Number of Nodes in cluster assembly: " << ClusterAssembly->GetNdaughters() << endl;
348  ClusterAssembly->PrintNodes();
349  }
350  if (nLevels > 1)
351  {
352  cout << "Printing the content of the crystal assemblies." << endl;
353  cout <<endl << "Number of Nodes in crystal assembly 1: " << Crystal1->GetNdaughters() << endl;
354  Crystal1->PrintNodes();
355  cout <<endl << "Number of Nodes in crystal assembly 2: " << Crystal2->GetNdaughters() << endl;
356  Crystal2->PrintNodes();
357  }
358 }
TGeoTranslation * CryostatFrontTranslation
void BuildCrystals(Int_t *CrystalNumber)
TGeoRotation * Crystal2Rotation
void BuildTArb8Array(Double_t *OutputArray, Int_t Point1, Int_t Point2, Int_t Offset1, Int_t Offset2, Int_t ShiftValue, Int_t NumberOfPoints)
TGeoCombiTrans * CryostatCombiTrans
PndGeoHypGeCrystal * Crystal2
Int_t i
Definition: run_full.C:25
TGeoVolume * ClusterAssembly
TGeoCombiTrans * Crystal2Position
void BuildTArb8FrontArray(Double_t *OutputArray, Int_t Point1, Int_t Point2, Int_t Point3, Int_t Point4, Int_t NumberOfPoints)
PndGeoHypGeCrystal * Crystal1
void FillZValues(Int_t NumberofDifferentZValues)
void PlaceCrystal(TGeoVolume *top, TGeoMatrix *CrystalPlaceAndDirectionTranslation)
TGeoCompositeShape * CryostatShape
ifstream ParametersInputFile
Double_t
Double_t * ZValuesInputArray
TGeoTranslation * CryostatLowerTranslation
TGeoCombiTrans * Crystal1Position
ClassImp(PndGeoHypGeDoubleCluster) using namespace std
TGeoRotation * Crystal1Rotation
Double_t * CoordinatesInputArray
TGeoTranslation * CryostatTopTranslation
TGeoTranslation * CryostatMiddleTranslation
void BuildTArb8TopArray(Double_t *OutputArray, Int_t Point1, Int_t Point2, Int_t Point3, Int_t Point4, Int_t Offset, Int_t NumberOfPoints)
void FillInputArray(Int_t NumberOfPoints, Int_t NumberOfXYInput)
TGeoTranslation * CryostatUpperTranslation