FairRoot/PandaRoot
Functions
createRootGeoFileFwEndCap_2011.C File Reference
#include <string>

Go to the source code of this file.

Functions

int createRootGeoFileFwEndCap_2011 ()
 

Function Documentation

int createRootGeoFileFwEndCap_2011 ( )

Definition at line 22 of file createRootGeoFileFwEndCap_2011.C.

References b1, b2, BoxShape, BoxVol, CbmMediumAir, CbmMediumCarbon, CbmMediumPWO, col, cos(), CrystalShape, CrystalVol, Double_t, dz, fabs(), fi, geobuild, geoFace, geoLoad, gGeoMan, gGeoManager, i, jj, kAlveoleThickness, kSpaceInSub, kSpaceSubGlue, Media, medium, name, nmed, Pi, rotBox, rotCrystal, rotSub, row, sqrt(), SubunitShape, SubunitVol, top, tr, trBox, trCrystal, trSub, TString, vert, vertBox, vertSub, x0, y0, and z0.

23 {
24  TH1F *HISTOsubunitTheta = new TH1F("HISTOsubunitTheta","Subunit #theta",1250,4.5,17.);//0.01 degree resolution of the histogram
25  TH1F *HISTOoffpointToCrystalMidpointAlongBeam_calculatedForEachSubunit = new TH1F("HISTOoffpointToCrystalMidpointAlongBeam_calculatedForEachSubunit","Along-the-beam prjection of the distance between offpoint and the crystal midpoint",640,316.5,322.9);//cm
26  TH1F *HISTOoffpointToFwEndCap_calculatedForEachSubunit = new TH1F("HISTOoffpointToFwEndCap_calculatedForEachSubunit","Distance between offpoint and the midpoint of the FwEndCap",640,316.5,322.9);//0.1 mm resolution of the histogram
27  TH2F *HISTOsubunitTheta_offpointToFwEndCap = new TH2F("HISTOsubunitTheta_offpointToFwEndCap","Distance between offpoint and the midpoint of the FwEndCap vs subunit #theta ",1250,4.5,17.,640,316.5,322.9);
28 
29  Double_t kSpaceInBox = 0.06; // Space in Box (cm)
30  Double_t kSpaceInSub = 0.024; // Space in Subunit (cm)
31  Double_t kSpaceSubGlue = 0.036; // Thickness of glued alveole between Boxes in Subunit (cm)
32  Double_t kAlveoleThickness = 0.018;// Thickness of alveole between Subunits (cm)
33 
34  Double_t aa = 2.4375; // size of the crystal's front side in cm
35  Double_t bb = 2.6; // size of the crystal's back side in cm
36  Double_t tr = 2.51875; // size of the crystal's profile at its center in cm ----> (aa+bb)/2
37 
38  Double_t b1 = bb-tr/2.;
39  Double_t b2 = aa-tr/2.;
40 
41  Double_t vert[16],vertBox[16],vertSub[16],vertSub_Subtracted[16],vertHalfSub[16],vertHalfSub_Subtracted[16]; // x-y coordinates of the 8 vertices for TGeoArb8 shapes of Crystal, Box, Subunit, and half Subunit
42  Double_t dz = 10.0; //half length of crystals in cm
43 
44  // first four vertices (back-face)
45  vert[0] = -tr/2.;
46  vert[1] = -tr/2.;
47  vert[2] = -tr/2.;
48  vert[3] = +b1;
49  vert[4] = +b1;
50  vert[5] = +b1;
51  vert[6] = +b1;
52  vert[7] = -tr/2.;
53  // second four vertices (front-face)
54  vert[8] = -tr/2.;
55  vert[9] = -tr/2.;
56  vert[10] = -tr/2.;
57  vert[11] = +b2;
58  vert[12] = +b2;
59  vert[13] = +b2;
60  vert[14] = +b2;
61  vert[15] = -tr/2.;
62 
63  // creating a SIZE for the BOX (4 crystals) shape
64  for (Int_t i=0; i< 16; i++){ //setting x and y components of the box vertices (with respect to the center of the box) starting from the lower left vertex of the back-face
65  Double_t spaces = kSpaceInBox/2.;
66  if (i==0 || i==1 || i==2 || i==7)
67  vertBox[i] = (-bb - spaces);
68  else if (i==8 || i==9 || i==10 || i==15)
69  vertBox[i] = (-aa - spaces);
70  else if (i==3 || i==4 || i==5 || i==6)
71  vertBox[i] = (bb + spaces);
72  else if (i==11 || i==12 || i==13 || i==14)
73  vertBox[i] = (aa + spaces);
74  }
75 
76  // creating a SIZE for the SUBUNIT (16 crystals, 4 boxes) shape
77  Double_t spacesSub = kSpaceSubGlue/2. + kAlveoleThickness + 2*kSpaceInSub;
78  for (Int_t i=0; i< 16; i++){
79  if (i==0 || i==1 || i==2 || i==7 || i==8 || i==9 || i==10 || i==15) {
80  vertSub[i] = (vertBox[i]*2 - spacesSub);
81  vertSub_Subtracted[i] = vertSub[i] + kAlveoleThickness;
82  }
83  else {
84  vertSub[i] = (vertBox[i]*2 + spacesSub);
85  vertSub_Subtracted[i] = vertSub[i] - kAlveoleThickness;
86  }
87  }
88 
89  // creating a SIZE for the half SUBUNIT (8 crystals, 2 boxes) shape
90  for (Int_t i=0; i< 16; i++){
91  Double_t spacesHalfSub = kSpaceInBox/2. + kAlveoleThickness + kSpaceInSub;
92  if (i==0 || i==2 || i==8 || i==10) {
93  vertHalfSub[i] = (2*vertBox[i] - spacesSub);
94  vertHalfSub_Subtracted[i] = vertHalfSub[i] + kAlveoleThickness;
95  }
96  else if (i==4 || i==6 || i==12 || i==14) {
97  vertHalfSub[i] = (2*vertBox[i] + spacesSub);
98  vertHalfSub_Subtracted[i] = vertHalfSub[i] - kAlveoleThickness;
99  }
100  else if (i==1 || i==7) {
101  vertHalfSub[i] = (-bb - spacesHalfSub);
102  vertHalfSub_Subtracted[i] = vertHalfSub[i] + kAlveoleThickness;
103  }
104  else if (i==3 || i==5) {
105  vertHalfSub[i] = (bb + spacesHalfSub);
106  vertHalfSub_Subtracted[i] = vertHalfSub[i] - kAlveoleThickness;
107  }
108  else if (i==9 || i==15) {
109  vertHalfSub[i] = (-aa - spacesHalfSub);
110  vertHalfSub_Subtracted[i] = vertHalfSub[i] + kAlveoleThickness;
111  }
112  else {
113  vertHalfSub[i] = (aa + spacesHalfSub);
114  vertHalfSub_Subtracted[i] = vertHalfSub[i] - kAlveoleThickness;
115  }
116  }
117 
118  //--------------------------------------------------------------------
119  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
120 
121  // Get env variable value (VMC working directory)
122  std::string vmcWorkdir = getenv("VMCWORKDIR");
123 
124  // Open the output file, to write geometry
125  TFile* fi = new TFile( (vmcWorkdir + "/geometry/emc_module3_2011_new.root").c_str(),
126  "RECREATE");
127 
128  FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader");
129  FairGeoInterface *geoFace = geoLoad->getGeoInterface();
130  geoFace->setMediaFile( (vmcWorkdir + "/geometry/media_pnd.geo").c_str());
131  geoFace->readMedia();
132  geoFace->print();
133 
134  FairGeoMedia *Media = geoFace->getMedia();
135  FairGeoBuilder *geobuild=geoLoad->getGeoBuilder();
136 
137  FairGeoMedium *CbmMediumAir = Media->getMedium("air");
138  FairGeoMedium *CbmMediumPWO = Media->getMedium("PWO");
139  FairGeoMedium *CbmMediumCarbon = Media->getMedium("carbon");
140  //FairGeoMedium *CbmMediumAluminium = Media->getMedium("aluminium");
141  Int_t nmed=geobuild->createMedium(CbmMediumAir);
142  nmed=geobuild->createMedium(CbmMediumPWO);
143  nmed=geobuild->createMedium(CbmMediumCarbon);
144  //nmed=geobuild->createMedium(CbmMediumAluminium);
145 
146  //TGeoVolume *top = gGeoMan->MakeTube("top",gGeoMan->GetMedium("air"),0,98,22.5);
147  TGeoVolume *top = new TGeoVolumeAssembly("Emc3");
148  TGeoManager* gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
149  gGeoMan->SetTopVolume(top);
150 
151  TGeoTranslation trSub;
152  TGeoTranslation trHalfSub;
153  TGeoTranslation trBox;
154  TGeoTranslation trCrystal;
155  TGeoTranslation trMiddleColumnSubunit;
156 
157  TGeoRotation rotSub;
158  TGeoRotation rotHalfSub;
159  TGeoRotation rotBox;
160  TGeoRotation rotCrystal;
161  TGeoRotation rotMiddleColumnSubunit;
162 
164 
165  // ========== SUBUNIT (16 crystals) ============
166  name = "SubunitShape";
167  TGeoShape* SubunitShape = new TGeoArb8(name,dz,vertSub);
168 
169  medium="air";
170  name = "SubunitVolFwEndCap";
171  //SubunitVol[q] = new TGeoVolume(name,SubunitShape,gGeoMan->GetMedium(medium));
172  TGeoVolume* SubunitVol = new TGeoVolumeAssembly(name);
173 
174  // ========== half SUBUNIT (8 crystals) ============
175  name = "HalfSubunitShape";
176  TGeoShape* HalfSubunitShape = new TGeoArb8(name,dz,vertHalfSub);
177 
178  name = "HalfSubunitVolFwEndCap";
179  //HalfSubunitVol[q] = new TGeoVolume(name,HalfSubunitShape,gGeoMan->GetMedium(medium));
180  TGeoVolume* HalfSubunitVol = new TGeoVolumeAssembly(name);
181 
182  // ========== BOX (4 crystals) =============
183  name = "BoxShape";
184  TGeoShape* BoxShape = new TGeoArb8(name,dz,vertBox);
185 
186  name="BoxVol";
187  TGeoVolume* BoxVol = new TGeoVolume(name,BoxShape,gGeoMan->GetMedium(medium));
188  //BoxVol[q] = new TGeoVolumeAssembly(name);
189 
190  // ========== Alveole package =============
191  TGeoShape* Subunit_Subtracted = new TGeoArb8("Subunit_Subtracted",dz,vertSub_Subtracted);
192  TGeoShape* MiddleWall_subunit = new TGeoTrd1("MiddleWall_subunit",fabs(vertSub_Subtracted[0]),fabs(vertSub_Subtracted[8]),kSpaceSubGlue/2.,dz);
193  TGeoRotation* rotSubunitWall = new TGeoRotation("rotSubunitWall");
194  rotSubunitWall->RotateZ(90.);
195  rotSubunitWall->RegisterYourself();
196  TGeoCompositeShape* AlveoleShape_subunit = new TGeoCompositeShape("AlveoleShape_subunit","(SubunitShape - Subunit_Subtracted) + (MiddleWall_subunit) + (MiddleWall_subunit:rotSubunitWall)");
197  TGeoVolume* AlveoleVol_subunit = new TGeoVolume("AlveoleVol_subunit",AlveoleShape_subunit,gGeoMan->GetMedium("carbon"));
198  AlveoleVol_subunit->SetLineColor(6);
199 
200  TGeoShape* HalfSubunit_Subtracted = new TGeoArb8("HalfSubunit_Subtracted",dz,vertHalfSub_Subtracted);
201  TGeoShape* MiddleWall_halfsubunit = new TGeoTrd1("MiddleWall_halfsubunit",fabs(vertHalfSub_Subtracted[1]),fabs(vertHalfSub_Subtracted[9]),kSpaceSubGlue/2.,dz);
202  TGeoCompositeShape* AlveoleShape_halfsubunit = new TGeoCompositeShape("AlveoleShape_halfsubunit","(HalfSubunitShape - HalfSubunit_Subtracted) + (MiddleWall_halfsubunit:rotSubunitWall)");
203  TGeoVolume* AlveoleVol_halfsubunit = new TGeoVolume("AlveoleVol_halfsubunit",AlveoleShape_halfsubunit,gGeoMan->GetMedium("carbon"));
204  AlveoleVol_halfsubunit->SetLineColor(6);
205 
206  TGeoShape* MiddleWall_box = new TGeoTrd1("MiddleWall_box",fabs(vertBox[0])+kSpaceInSub,fabs(vertBox[8])+kSpaceInSub,kAlveoleThickness/2.,dz);
207  TGeoCompositeShape* AlveoleShape_box = new TGeoCompositeShape("AlveoleShape_box","(MiddleWall_box) + (MiddleWall_box:rotSubunitWall)");
208  TGeoVolume* AlveoleVol_box = new TGeoVolume("AlveoleVol_box",AlveoleShape_box,gGeoMan->GetMedium("carbon"));
209  AlveoleVol_box->SetLineColor(6);
210 
211 // making the subunits; translations and rotations for Boxes are with respect to the coordinate system in the center of the Subunit:
212  Double_t boxRotAngle = 0.465518;// = atan[24.375/3000] (deg.)----> atan[24.375/320]==0.436424
213  Double_t boxShiftInSubunit = (tr+kSpaceInSub+kSpaceSubGlue/2.+kSpaceInBox/2.)*cos(boxRotAngle*TMath::Pi()/180);
214  cout << " " << endl;
215  trBox = new TGeoTranslation(boxShiftInSubunit,boxShiftInSubunit, 0.);
216  rotBox = new TGeoRotation();
217  rotBox.RotateX(boxRotAngle); // rotation in "up" direction
218  rotBox.RotateY(-boxRotAngle); // rotation in "right" direction
219  TGeoCombiTrans* trrotBox= new TGeoCombiTrans(trBox,rotBox);
220  name="BoxVol";
221  name+=1;
222  trrotBox->SetName(name);
223  trrotBox->RegisterYourself();
224  SubunitVol->AddNode(BoxVol,1,trrotBox);
225 
226  trBox = new TGeoTranslation(-boxShiftInSubunit,-boxShiftInSubunit, 0.);
227  rotBox = new TGeoRotation();
228  rotBox.RotateX(-boxRotAngle); // rotation in "down" direction
229  rotBox.RotateY(boxRotAngle); // rotation in "left" direction
230  TGeoCombiTrans* trrotBox= new TGeoCombiTrans(trBox,rotBox);
231  name="BoxVol";
232  name+=2;
233  trrotBox->SetName(name);
234  trrotBox->RegisterYourself();
235  SubunitVol->AddNode(BoxVol,2,trrotBox);
236 
237  trBox = new TGeoTranslation(boxShiftInSubunit,-boxShiftInSubunit, 0.);
238  rotBox = new TGeoRotation();
239  rotBox.RotateX(-boxRotAngle); // rotation in "down" direction
240  rotBox.RotateY(-boxRotAngle); // rotation in "right" direction
241  TGeoCombiTrans* trrotBox= new TGeoCombiTrans(trBox,rotBox);
242  name="BoxVol";
243  name+=3;
244  trrotBox->SetName(name);
245  trrotBox->RegisterYourself();
246  SubunitVol->AddNode(BoxVol,3,trrotBox);
247 
248  trBox = new TGeoTranslation(-boxShiftInSubunit,boxShiftInSubunit, 0.);
249  rotBox = new TGeoRotation();
250  rotBox.RotateX(boxRotAngle); // rotation in "up" direction
251  rotBox.RotateY(boxRotAngle); // rotation in "left" direction
252  TGeoCombiTrans* trrotBox= new TGeoCombiTrans(trBox,rotBox);
253  name="BoxVol";
254  name+=4;
255  trrotBox->SetName(name);
256  trrotBox->RegisterYourself();
257  SubunitVol->AddNode(BoxVol,4,trrotBox);
258 
259  SubunitVol->AddNode(AlveoleVol_subunit,0,0);
260 
261 
262 // making the half Subunit:
263  trBox = new TGeoTranslation(boxShiftInSubunit, 0., 0.);
264  rotBox = new TGeoRotation();
265  rotBox.RotateY(-boxRotAngle); // rotation in "right" direction
266  TGeoCombiTrans* trrotBox= new TGeoCombiTrans(trBox,rotBox);
267  name="BoxVol";
268  name+=1;
269  trrotBox->SetName(name);
270  trrotBox->RegisterYourself();
271  HalfSubunitVol->AddNode(BoxVol,1,trrotBox);
272 
273  trBox = new TGeoTranslation(-boxShiftInSubunit, 0., 0.);
274  rotBox = new TGeoRotation();
275  rotBox.RotateY(boxRotAngle); // rotation in "left" direction
276  TGeoCombiTrans* trrotBox= new TGeoCombiTrans(trBox,rotBox);
277  name="BoxVol";
278  name+=2;
279  trrotBox->SetName(name);
280  trrotBox->RegisterYourself();
281  HalfSubunitVol->AddNode(BoxVol,2,trrotBox);
282 
283  //HalfSubunitVol->AddNode(AlveoleVol_halfsubunit,0,0);
284 
285  // ========== CRYSTAL (TGeoArb8 shape)=================
286  name = "CrystalShape";
287  TGeoShape* CrystalShape = new TGeoArb8(name,dz,vert);
288  medium="PWO";
289  name = "CrystalVol";
290  TGeoVolume* CrystalVol = new TGeoVolume(name,CrystalShape,gGeoMan->GetMedium(medium));
291  CrystalVol->SetLineColor(4);
292 
293 // making the Box out of 4 crystals:
294  cout << " " << endl;
295  trCrystal = new TGeoTranslation(tr/2.+kSpaceInBox/2.,tr/2.+kSpaceInBox/2.,0.);
296  rotCrystal = new TGeoRotation() ; // "right-upper" Crystal
297  TGeoCombiTrans* trrotCrystal= new TGeoCombiTrans(trCrystal,rotCrystal);
298  name = "CrystalVol";
299  name+=1;
300  trrotCrystal->SetName(name);
301  trrotCrystal->RegisterYourself();
302  BoxVol->AddNode(CrystalVol,1,trrotCrystal);
303 
304  trCrystal= new TGeoTranslation(-tr/2.-kSpaceInBox/2.,-tr/2.-kSpaceInBox/2.,0.);
305  rotCrystal = new TGeoRotation(); // "left-lower" Crystal
306  rotCrystal.RotateZ(180.);
307  TGeoCombiTrans* trrotCrystal= new TGeoCombiTrans(trCrystal,rotCrystal);
308  name = "CrystalVol";
309  name+=2;
310  trrotCrystal->SetName(name);
311  trrotCrystal->RegisterYourself();
312  BoxVol->AddNode(CrystalVol,2,trrotCrystal);
313 
314  trCrystal= new TGeoTranslation(-tr/2.-kSpaceInBox/2.,tr/2.+kSpaceInBox/2.,0.);
315  rotCrystal = new TGeoRotation(); // "left-upper" Crystal
316  rotCrystal.RotateZ(90.);
317  TGeoCombiTrans* trrotCrystal= new TGeoCombiTrans(trCrystal,rotCrystal);
318  name = "CrystalVol";
319  name+=3;
320  trrotCrystal->SetName(name);
321  trrotCrystal->RegisterYourself();
322  BoxVol->AddNode(CrystalVol,3,trrotCrystal);
323 
324  trCrystal= new TGeoTranslation(tr/2.+kSpaceInBox/2.,-tr/2.-kSpaceInBox/2.,0.);
325  rotCrystal = new TGeoRotation() ; // "right-lower" Crystal
326  rotCrystal.RotateZ(270.);
327  TGeoCombiTrans* trrotCrystal= new TGeoCombiTrans(trCrystal,rotCrystal);
328  name = "CrystalVol";
329  name+=4;
330  trrotCrystal->SetName(name);
331  trrotCrystal->RegisterYourself();
332  BoxVol->AddNode(CrystalVol,4,trrotCrystal);
333 
334  BoxVol->AddNode(AlveoleVol_box,0,0);
335 
336  //Double_t sizeOfQuar = 96.192; // size of one Quarter (back side) in X and Y directions in cm
337  // size of one Subunit (back side): 10.688*9 = 96.192 (cm) & 4*2.6+0.288=10.688, in which 0.288=0.036+2*(0.06+0.018+0.024+0.024)
338  // size of one Subunit (front side): 10.038*9 = 90.342 (cm) & 4*2.4375+0.288=10.038
339  //Double_t kSubShift=10.363; // size of 1 Subunit in its half Z-distance = (10.688+10.038)/2 cm
340  //Double_t FrontFaceToOffPoint=295; // Off_point to front face of crystals (cm)
341 
342  Double_t SubRots_x[10] = {0, 1.397, 3.259, 5.121, 6.983, 8.845, 10.707, 12.569, 14.431, 16.293}; // in degrees
343  Double_t SubRots_y[9] = {0, 1.862, 3.724, 5.586, 7.448, 9.310, 11.172, 13.034, 14.896}; // in degrees
344 
345  Double_t SubShifts_x[9][10],SubShifts_y[9][10],SubShifts_z[9][10];
346  // below: ri=(xi,yi,zi) are the positions of the center of the full subunits located at i-th column. The dimention of ri indicates the # of full subunits in the i-th column.
347  Double_t x0[7] = {0, 0, 0, 0, 0, 0, 0};// cm
348  Double_t y0[7] = {28.8265117778573, 39.3493990842636, 49.9182059980705, 60.5427138182193, 71.2329503536249, 81.9992433988977, 92.8522777922782};// cm
349  Double_t z0[7] = {20.8922266939356, 20.7643907501524, 20.647680715811, 20.542219840098, 20.4481194927622, 20.3654790465039, 20.2943857720353};// cm
350  Double_t x1[7] = {10.4561465784774, 10.457980770291, 10.4587432590363, 10.4584210182162, 10.4569949523523, 10.4544395865992, 10.4507226619133};// cm
351  Double_t y1[7] = {28.8415506036169, 39.3698737009689, 49.9440943683685, 60.5739911406306, 71.269589122811, 82.0412134694661, 92.8995464471194};// cm
352  Double_t z1[7] = {20.7353467228561, 20.608097645279, 20.4921269616535, 20.3875570856334, 20.2944985110308, 20.2130496945219, 20.1432969499363};// cm
353  Double_t x2[6] = {20.9321821237215, 20.9358595992309, 20.9373981752432, 20.9367717976619, 20.9339422773645, 20.9288586697734};// cm
354  Double_t y2[6] = {28.8575314144401, 39.3916128487797, 49.9715678752264, 60.6071778753597, 71.3084709234057, 82.0857752642087};// cm
355  Double_t z2[6] = {20.5895321756643, 20.4629244166279, 20.3477101063494, 20.2440107183219, 20.1519360485205, 20.0715840968625};// cm
356  Double_t x3[7] = {31.435, 31.4374657965934, 31.443004685364, 31.445346474863, 31.4444520826492, 31.4402642313971, 31.4327065190925};// cm
357  Double_t y3[7] = {18.37, 28.8744010011301, 39.4145444804275, 50.0005359941237, 60.642165433689, 71.3494695656328, 82.1327855036172};// cm
358  Double_t z3[7] = {20.56, 20.4549342199356, 20.3290191826595, 20.2145744178588, 20.111720383633, 20.0205663879042, 19.9412104670771};// cm
359  Double_t x4[8] = {41.9539813282223, 41.9698288739971, 41.9814693214709, 41.9888966825685, 41.9920821980654, 41.9909737596839, 41.9854950144576, 41.9755441265108};// cm
360  Double_t y4[8] = {7.89830880167419, 18.3818329576968, 28.8921116541933, 39.4386040325354, 50.0309175849214, 60.6788563819023, 71.3924716114887, 82.1821150419249};// cm
361  Double_t z4[8] = {20.6160360262256, 20.4682450405479, 20.3316930634579, 20.2065198113991, 20.0928548902714, 19.9908176835001, 19.9005172334079, 19.8220521159127};// cm
362  Double_t x5[7] = {52.5394297215891, 52.5592393983295, 52.5738238277316, 52.5831754879774, 52.587258416773, 52.5860074900363, 52.5793273040347};// cm
363  Double_t y5[7] = {7.90341507861587, 18.3936742404941, 28.9106213388012, 39.4637346600652, 50.0626411828193, 60.7171647853164, 71.437376767925};// cm
364  Double_t z5[7] = {20.5027092994528, 20.3557018043881, 20.2199378244604, 20.0955538082943, 19.9826771540363, 19.8814261134414, 19.7919096791188};// cm
365  Double_t x6[6] = {63.1830462065919, 63.2068179821323, 63.2243685753296, 63.2356889146366, 63.2407358379524, 63.239431228515};// cm
366  Double_t y6[6] = {7.90874065384292, 18.4060125259458, 28.9298938377538, 39.4898874292926, 50.0956452405859, 60.7570164991038};// cm
367  Double_t z6[6] = {20.4007777494568, 20.2546771228153, 20.1197864051635, 19.9962381996988, 19.8841573722027, 19.7836609746115};// cm
368  Double_t x7[5] = {73.8949255128963, 73.9226591547656, 73.9432021341159, 73.9565438187476, 73.9626338624611};// cm
369  Double_t y7[5] = {7.91427699482984, 18.4188282598441, 28.949898861872, 39.5170214685491, 50.1298783211089};// cm
370  Double_t z7[5] = {20.3103490711865, 20.1652779875055, 20.0313453686846, 19.9086794119197, 19.7974021224738};// cm
371  Double_t x8[4] = {84.6854762517226, 84.7171712230529, 84.7407366383712, 84.7561603031881};// cm
372  Double_t y8[4] = {7.92001718048636, 18.4321056920017, 28.9706121273752, 39.5451040760829};// cm
373  Double_t z8[4] = {20.2315188788966, 20.0875994791296, 19.9547098194095, 19.8329731459031};// cm
374 
375  for (Int_t j=3; j<=9; j++) { //range of j indicates the # of full subunits in the i-th column (in this for loop, columns 0 and 1)
376  SubShifts_x[0][j] = x0[j-3];
377  SubShifts_y[0][j] = y0[j-3];
378  SubShifts_z[0][j] = z0[j-3];
379  SubShifts_x[1][j] = x1[j-3];
380  SubShifts_y[1][j] = y1[j-3];
381  SubShifts_z[1][j] = z1[j-3];
382  }
383  for (Int_t j=3; j<=8; j++) { //(in this for loop, column 2)
384  SubShifts_x[2][j] = x2[j-3];
385  SubShifts_y[2][j] = y2[j-3];
386  SubShifts_z[2][j] = z2[j-3];
387  }
388  for (Int_t j=2; j<=8; j++) { //(in this for loop, column 3)
389  SubShifts_x[3][j] = x3[j-2];
390  SubShifts_y[3][j] = y3[j-2];
391  SubShifts_z[3][j] = z3[j-2];
392  }
393  for (Int_t j=1; j<=8; j++) { //(in this for loop, column 4)
394  SubShifts_x[4][j] = x4[j-1];
395  SubShifts_y[4][j] = y4[j-1];
396  SubShifts_z[4][j] = z4[j-1];
397  }
398  for (Int_t j=1; j<=7; j++) { //(in this for loop, column 5)
399  SubShifts_x[5][j] = x5[j-1];
400  SubShifts_y[5][j] = y5[j-1];
401  SubShifts_z[5][j] = z5[j-1];
402  }
403  for (Int_t j=1; j<=6; j++) { //(in this for loop, column 6)
404  SubShifts_x[6][j] = x6[j-1];
405  SubShifts_y[6][j] = y6[j-1];
406  SubShifts_z[6][j] = z6[j-1];
407  }
408  for (Int_t j=1; j<=5; j++) { //(in this for loop, column 7)
409  SubShifts_x[7][j] = x7[j-1];
410  SubShifts_y[7][j] = y7[j-1];
411  SubShifts_z[7][j] = z7[j-1];
412  }
413  for (Int_t j=1; j<=4; j++) { //(in this for loop, column 8)
414  SubShifts_x[8][j] = x8[j-1];
415  SubShifts_y[8][j] = y8[j-1];
416  SubShifts_z[8][j] = z8[j-1];
417  }
418 
419 
420  for(Int_t q=0; q<4; q++){ //making the Subunits of the 4 quarters (50 Subunits per quarter)
421 
422  Int_t jj=0; // counter running on the number of Subunits
423  for (Int_t row=1; row<=9; row++)
424  {
425  for (Int_t col=1; col<=8; col++)
426  {
427  Int_t flag=1; // indicating the presence of a Subunit
428 
429  if (row<3 && col<3) flag=0; // not having a Subunit
430  else if (col==3 && row<2) flag=0;
431  else if (col>7 && row>4) flag=0;
432  else if (col>6 && row>5) flag=0;
433  else if (col>5 && row>6) flag=0;
434  else if (col>4 && row>7) flag=0;
435  else if (col>1 && row>8) flag=0;
436 
437  if (flag){
438 
439  jj++;
440  cout<< "QuarterNo " << q+1<< " ....SubunitNo " << jj <<endl;
441 
442  Double_t trSub_x, trSub_y, trSub_z, rotSub_x, rotSub_y;
443  if (q==0){ // first quarter (top right)
444  trSub_x = SubShifts_x[col][row];
445  trSub_y = SubShifts_y[col][row];
446  trSub_z = SubShifts_z[col][row];
447  rotSub_x = SubRots_x[row];
448  rotSub_y = -SubRots_y[col];
449  }
450  else if (q==1){ // second quarter (bottom right)
451  trSub_x = SubShifts_x[col][row];
452  trSub_y = -SubShifts_y[col][row];
453  trSub_z = SubShifts_z[col][row];
454  rotSub_x = -SubRots_x[row];
455  rotSub_y = -SubRots_y[col];
456  }
457  else if (q==2){ // third quarter (bottom left)
458  trSub_x = -SubShifts_x[col][row];
459  trSub_y = -SubShifts_y[col][row];
460  trSub_z = SubShifts_z[col][row];
461  rotSub_x = -SubRots_x[row];
462  rotSub_y = SubRots_y[col];
463  }
464  else if (q==3){ // fourth quarter (top left)
465  trSub_x = -SubShifts_x[col][row];
466  trSub_y = SubShifts_y[col][row];
467  trSub_z = SubShifts_z[col][row];
468  rotSub_x = SubRots_x[row];
469  rotSub_y = SubRots_y[col];
470  }
471 
472  rotSub = new TGeoRotation();
473  rotSub.RotateX(rotSub_x);
474  rotSub.RotateY(rotSub_y);
475  trSub = new TGeoTranslation(trSub_x, trSub_y, trSub_z-20.);//the -20 subtraction is done in order to make the z-position of the crystals around 0 in the top assembly volume,
476  //this way shifting the top volume in the PANDA geometry (done in PndEmc.cxx) would be straightforward,
477  //assuming that the center of the top volume coincides more or less with the center of mass of the crystals.
478  TGeoCombiTrans *trrotSub= new TGeoCombiTrans(trSub,rotSub);
479  name="SubunitVolFwEndCap";
480  name+= 100*(q+1)+jj;
481  trrotSub->SetName(name);
482  trrotSub->RegisterYourself();
483 
484  top->AddNode(SubunitVol,100*(q+1)+jj,trrotSub);// copy numbering of Subunits from 101 to 150, 201 to 250, 301 to 350, and 401 to 450
485 
486  //deriving the orientation of the full subunits and draw the angle and off-point of them
487  Double_t theta1, phi1, theta2, phi2, theta3, phi3;
488  rotSub.GetAngles(theta1, phi1, theta2, phi2, theta3, phi3);
489  if (q==0) {
490  HISTOsubunitTheta->Fill(theta3);
491  HISTOoffpointToCrystalMidpointAlongBeam_calculatedForEachSubunit->Fill(sqrt((SubShifts_x[col][row]*SubShifts_x[col][row])+(SubShifts_y[col][row]*SubShifts_y[col][row]))/tan(theta3*TMath::DegToRad()));
492  HISTOoffpointToFwEndCap_calculatedForEachSubunit->Fill(sqrt((SubShifts_x[col][row]*SubShifts_x[col][row])+(SubShifts_y[col][row]*SubShifts_y[col][row]))/tan(theta3*TMath::DegToRad()) + (trSub_z-20.));
493  HISTOsubunitTheta_offpointToFwEndCap->Fill(theta3, sqrt((SubShifts_x[col][row]*SubShifts_x[col][row])+(SubShifts_y[col][row]*SubShifts_y[col][row]))/tan(theta3*TMath::DegToRad()) + (trSub_z-20.));
494  }
495  }
496  }
497  }
498  }
499 
500 //making the middle-column Subunits
501  for (Int_t index = 1; index <= 2; index++)
502  {Int_t coeff = 1;
503  if (index == 2)
504  coeff = -1;
505  for (Int_t middleSubunits = 3; middleSubunits<=9; middleSubunits++)
506  {
507  trMiddleColumnSubunit = new TGeoTranslation(SubShifts_x[0][middleSubunits], coeff*SubShifts_y[0][middleSubunits], SubShifts_z[0][middleSubunits]-20.);
508  rotMiddleColumnSubunit = new TGeoRotation();
509  rotMiddleColumnSubunit.RotateX(coeff*SubRots_x[middleSubunits]);
510  TGeoCombiTrans* trrotMiddleColumnSubunit = new TGeoCombiTrans(trMiddleColumnSubunit,rotMiddleColumnSubunit);
511 
512  name="SubunitVolFwEndCap";
513  name+= 7*(index-1)+(60 + middleSubunits-2);
514  trrotSub->SetName(name);
515  trrotSub->RegisterYourself();
516 
517  top->AddNode(SubunitVol,7*(index-1)+(60 + middleSubunits-2),trrotMiddleColumnSubunit);//copy numbering from 61 to 74
518 
519  //deriving the orientation of the full subunits and draw the angle and off-point of them
520  Double_t theta1, phi1, theta2, phi2, theta3, phi3;
521  rotMiddleColumnSubunit.GetAngles(theta1, phi1, theta2, phi2, theta3, phi3);
522  if (index == 1) {
523  HISTOsubunitTheta->Fill(theta3);
524  HISTOoffpointToCrystalMidpointAlongBeam_calculatedForEachSubunit->Fill(sqrt((SubShifts_x[0][middleSubunits]*SubShifts_x[0][middleSubunits])+(SubShifts_y[0][middleSubunits]*SubShifts_y[0][middleSubunits]))/tan(theta3*TMath::DegToRad()));
525  HISTOoffpointToFwEndCap_calculatedForEachSubunit->Fill(sqrt((SubShifts_x[0][middleSubunits]*SubShifts_x[0][middleSubunits])+(SubShifts_y[0][middleSubunits]*SubShifts_y[0][middleSubunits]))/tan(theta3*TMath::DegToRad()) +(SubShifts_z[0][middleSubunits]-20.));
526  HISTOsubunitTheta_offpointToFwEndCap->Fill(theta3, sqrt((SubShifts_x[0][middleSubunits]*SubShifts_x[0][middleSubunits])+(SubShifts_y[0][middleSubunits]*SubShifts_y[0][middleSubunits]))/tan(theta3*TMath::DegToRad()) +(SubShifts_z[0][middleSubunits]-20.));
527  }
528 
529  }
530  }
531 
532 //making the middle-region half Subunits
533  Double_t middleHalfSubRots_x[9] = {3.724, 3.724, 3.724, 3.724, 0, 0, 0, 0, 0}; // in degrees
534  Double_t middleHalfSubRots_y[9] = {0, 1.862, 3.724, 5.586, 7.448, 9.310, 11.172, 13.034, 14.896}; // in degrees
535  Double_t HalfSubShifts_x[58] = {-84.6563520970098, -73.8693906775208, -63.1611211867801, -52.521132074127, -41.9393256755252, //corresponding to copy numbers 1-5 (cm)
536  41.9393256755252, 52.521132074127, 63.1611211867801, 73.8693906775208, 84.6563520970098, //corresponding to copy numbers 6-10
537  99999, //corresponding to copy number 11 which we don't have in the geometry and that's why it's set to a big number (it's not ganna be used anyway)
538  -20.9174269458209, -10.4487681185361, 0, 10.4487681185361, 20.9174269458209, //corresponding to copy numbers 12-16
539  99999, //corresponding to copy number 17 which we don't have in the geometry and that's why it's set to a big number (it's not ganna be used anyway)
540  99999, //corresponding to copy number 18 which we don't have in the geometry and that's why it's set to a big number (it's not ganna be used anyway)
541  -20.9174269458209, -10.4487681185361, 0, 10.4487681185361, 20.9174269458209, //corresponding to copy numbers 19-23
542  99999, //corresponding to copy number 24 which we don't have in the geometry and that's why it's set to a big number (it's not ganna be used anyway)
543  -92.6747786463306, -92.7160730719282, -92.7485342040102, -81.9829059977037, -71.2396466047239, //corresponding to copy numbers 25-29
544  -63.1300146020203, -52.4697812081315, -31.355563839864, -20.8773507855441, 20.8773507855441, 31.355563839864, //corresponding to copy numbers 30-35
545  52.4697812081315, 63.1300146020203, 71.2396466047239, 81.9829059977037, 92.7485342040102, //corresponding to copy numbers 36-40
546  92.7160730719282, 92.6747786463306, 92.7160730719282, 92.7485342040102, 81.9829059977037, //corresponding to copy numbers 41-45
547  71.2396466047239, 63.1300146020203, 52.4697812081315, 31.355563839864, 20.8773507855441, -20.8773507855441, //corresponding to copy numbers 46-51
548  -31.355563839864, -52.4697812081315, -63.1300146020203, -71.2396466047239, -81.9829059977037, -92.7485342040102, -92.7160730719282};
549 
550  Double_t HalfSubShifts_y[58] = {0, 0, 0, 0, 0, //corresponding to copy numbers 1-5
551  0, 0, 0, 0, 0, //corresponding to copy numbers 6-10
552  99999, //corresponding to copy number 11 which we don't have in the geometry and that's why it's set to a big number (it's not ganna be used anyway)
553  20.8885295181039, 20.876851374154, 20.8658909883895, 20.876851374154, 20.8885295181039, //corresponding to copy numbers 12-16
554  99999, //corresponding to copy number 17 which we don't have in the geometry and that's why it's set to a big number (it's not ganna be used anyway)
555  99999, //corresponding to copy number 18 which we don't have in the geometry and that's why it's set to a big number (it's not ganna be used anyway)
556  -20.8885295181039, -20.876851374154, -20.8658909883895, -20.876851374154, -20.8885295181039, //corresponding to copy numbers 19-23
557  99999, //corresponding to copy number 24 which we don't have in the geometry and that's why it's set to a big number (it's not ganna be used anyway)
558  0, 10.4475848056181, 20.9494917954074, 50.0632009767915, 60.6888391507159, //corresponding to copy numbers 25-29
559  68.7741496062525, 79.4684133522537, 90.1738532457449, 90.1213466966609, 90.1213466966609, 90.1738532457449, //corresponding to copy numbers 30-35
560  79.4684133522537, 68.7741496062525, 60.6888391507159, 50.0632009767915, 20.9494917954074, //corresponding to copy numbers 36-40
561  10.4475848056181, 0, -10.4475848056181, -20.9494917954074, -50.0632009767915, //corresponding to copy numbers 41-45
562  -60.6888391507159, -68.7741496062525, -79.4684133522537, -90.1738532457449, -90.1213466966609, -90.1213466966609, //corresponding to copy numbers 46-51
563  -90.1738532457449, -79.4684133522537, -68.7741496062525, -60.6888391507159, -50.0632009767915, -20.9494917954074, -10.4475848056181};
564 
565  Double_t HalfSubShifts_z[58] = {20.3466200388019, 20.4263813988843, 20.517625616103, 20.6202563339138, 20.7341651712972, //corresponding to copy numbers 1-5
566  20.7341651712972, 20.6202563339138, 20.517625616103, 20.4263813988843, 20.3466200388019, //corresponding to copy numbers 6-10
567  99999, //corresponding to copy number 11 which we don't have in the geometry and that's why it's set to a big number (it's not ganna be used anyway)
568  20.8544382200522, 21.0009144090997, 21.1582196313325, 21.0009144090997, 20.8544382200522, //corresponding to copy numbers 12-16
569  99999, //corresponding to copy number 17 which we don't have in the geometry and that's why it's set to a big number (it's not ganna be used anyway)
570  99999, //corresponding to copy number 18 which we don't have in the geometry and that's why it's set to a big number (it's not ganna be used anyway)
571  20.8544382200522, 21.0009144090997, 21.1582196313325, 21.0009144090997, 20.8544382200522, //corresponding to copy numbers 19-23
572  99999, //corresponding to copy number 24 which we don't have in the geometry and that's why it's set to a big number (it's not ganna be used anyway)
573  20.9979827713258, 20.8465516574732, 20.7052688946296, 20.3581441163706, 20.2547272198587, //corresponding to copy numbers 25-29
574  20.2322699798398, 20.3302699346598, 20.570496344343, 20.701744222906, 20.701744222906, 20.570496344343, //corresponding to copy numbers 30-35
575  20.3302699346598, 20.2322699798398, 20.2547272198587, 20.3581441163706, 20.7052688946296, //corresponding to copy numbers 36-40
576  20.8465516574732, 20.9979827713258, 20.8465516574732, 20.7052688946296, 20.3581441163706, //corresponding to copy numbers 41-45
577  20.2547272198587, 20.2322699798398, 20.3302699346598, 20.570496344343, 20.701744222906, 20.701744222906, //corresponding to copy numbers 46-51
578  20.570496344343, 20.3302699346598, 20.2322699798398, 20.2547272198587, 20.3581441163706, 20.7052688946296, 20.8465516574732};
579 
580 
581  for (Int_t col=4; col<=8; col++){ //in total 10 horizontal middle-region (equator) half Subunits
582  rotHalfSub = new TGeoRotation();
583  rotHalfSub.RotateX(middleHalfSubRots_x[col]);
584  rotHalfSub.RotateY(-middleHalfSubRots_y[col]);
585  trHalfSub = new TGeoTranslation(HalfSubShifts_x[col+1], HalfSubShifts_y[col+1], HalfSubShifts_z[col+1] - 20.);//the -20 subtraction is done in order to make the z-position
586  //of the crystals around 0 in the top assembly volume,
587  TGeoCombiTrans *trrotHalfSub= new TGeoCombiTrans(trHalfSub,rotHalfSub);
588  name="HalfSubunitVolFwEndCap";
589  name+= (6+col-4);
590  trrotSub->SetName(name);
591  trrotSub->RegisterYourself();
592  top->AddNode(HalfSubunitVol,6+col-4,trrotHalfSub);// copy numbering from 6 to 10
593 
594  rotHalfSub = new TGeoRotation();
595  rotHalfSub.RotateX(middleHalfSubRots_x[12-col]);
596  rotHalfSub.RotateY(middleHalfSubRots_y[12-col]);
597  trHalfSub = new TGeoTranslation(HalfSubShifts_x[col-4], HalfSubShifts_y[col-4], HalfSubShifts_z[col-4] - 20.);
598  TGeoCombiTrans *trrotHalfSub= new TGeoCombiTrans(trHalfSub,rotHalfSub);
599  name="HalfSubunitVolFwEndCap";
600  name+= (9-col);
601  trrotSub->SetName(name);
602  trrotSub->RegisterYourself();
603  top->AddNode(HalfSubunitVol,9-col,trrotHalfSub);// copy numbering from 5 to 1
604  }
605 
606  for (Int_t col=1; col<=5; col++){ //in total 10 horizontal middle-region half Subunits
607  rotHalfSub = new TGeoRotation();
608  rotHalfSub.RotateX(middleHalfSubRots_x[0]);
609  if (col<=2) { //copy numbering from 12 to 13
610  rotHalfSub.RotateY(middleHalfSubRots_y[3-col]);
611  trHalfSub = new TGeoTranslation(HalfSubShifts_x[10+col], HalfSubShifts_y[10+col], HalfSubShifts_z[10+col] - 20.);
612  }
613  else { //copy numbering from 14 to 16
614  rotHalfSub.RotateY(-middleHalfSubRots_y[col-3]);
615  trHalfSub = new TGeoTranslation(HalfSubShifts_x[10+col], HalfSubShifts_y[10+col], HalfSubShifts_z[10+col] - 20.);
616  }
617  TGeoCombiTrans *trrotHalfSub= new TGeoCombiTrans(trHalfSub,rotHalfSub);
618  name="HalfSubunitVolFwEndCap";
619  name+= (col+11);
620  trrotSub->SetName(name);
621  trrotSub->RegisterYourself();
622  top->AddNode(HalfSubunitVol,col+11,trrotHalfSub);// copy numbering from 12 to 16
623 
624  rotHalfSub = new TGeoRotation();
625  rotHalfSub.RotateX(-middleHalfSubRots_x[0]);
626  if (col<=2) { // copy numbering from 19 to 20
627  rotHalfSub.RotateY(middleHalfSubRots_y[3-col]);
628  trHalfSub = new TGeoTranslation(HalfSubShifts_x[17+col], HalfSubShifts_y[17+col], HalfSubShifts_z[17+col] - 20.);
629  }
630  else { // copy numbering from 21 to 23
631  rotHalfSub.RotateY(-middleHalfSubRots_y[col-3]);
632  trHalfSub = new TGeoTranslation(HalfSubShifts_x[17+col], HalfSubShifts_y[17+col], HalfSubShifts_z[17+col] - 20.);
633  }
634  TGeoCombiTrans *trrotHalfSub= new TGeoCombiTrans(trHalfSub,rotHalfSub);
635  name="HalfSubunitVolFwEndCap";
636  name+= (18+col);
637  trrotSub->SetName(name);
638  trrotSub->RegisterYourself();
639  top->AddNode(HalfSubunitVol,18+col,trrotHalfSub);// copy numbering from 19 to 23
640  }
641 
642 //making the peripheral half Subunits
643  Double_t peripheralHalfSubRots_x[9] = {0, 1.862, 3.724, 8.845, 10.707, 12.103, 13.965, 15.827, 15.827}; // in degrees
644  Double_t peripheralHalfSubRots_y[9] = {16.293, 16.293, 16.293, 14.431, 12.569, 11.172, 9.310, 5.586, 3.724}; // in degrees
645  for (Int_t index=0; index<=8; index++){ //in total 18 upper peripheral half Subunits
646  rotHalfSub = new TGeoRotation();
647  if (index<=4)
648  rotHalfSub.RotateZ(90);
649  rotHalfSub.RotateX(peripheralHalfSubRots_x[index]);
650  rotHalfSub.RotateY(peripheralHalfSubRots_y[index]);
651  trHalfSub = new TGeoTranslation(HalfSubShifts_x[24+index], HalfSubShifts_y[24+index], HalfSubShifts_z[24+index] - 20.);
652  TGeoCombiTrans *trrotHalfSub= new TGeoCombiTrans(trHalfSub,rotHalfSub);
653  name="HalfSubunitVolFwEndCap";
654  name+= (25+index);
655  trrotSub->SetName(name);
656  trrotSub->RegisterYourself();
657  top->AddNode(HalfSubunitVol,25+index,trrotHalfSub);// copy numbering from 25 to 33 (top left part)
658 
659  rotHalfSub = new TGeoRotation();
660  if (index<=4)
661  rotHalfSub.RotateZ(90);
662  rotHalfSub.RotateX(peripheralHalfSubRots_x[index]);
663  rotHalfSub.RotateY(-peripheralHalfSubRots_y[index]);
664  trHalfSub = new TGeoTranslation(HalfSubShifts_x[41-index], HalfSubShifts_y[41-index], HalfSubShifts_z[41-index] - 20.);
665  TGeoCombiTrans *trrotHalfSub= new TGeoCombiTrans(trHalfSub,rotHalfSub);
666  name="HalfSubunitVolFwEndCap";
667  name+= (42-index);
668  trrotSub->SetName(name);
669  trrotSub->RegisterYourself();
670  top->AddNode(HalfSubunitVol,42-index,trrotHalfSub);// copy numbering from 42 to 34 (top right part)
671  }
672 
673  for (Int_t index=1; index<=8; index++){ //in total 16 lower peripheral half Subunits
674  rotHalfSub = new TGeoRotation();
675  if (index<=4)
676  rotHalfSub.RotateZ(90);
677  rotHalfSub.RotateX(-peripheralHalfSubRots_x[index]);
678  rotHalfSub.RotateY(-peripheralHalfSubRots_y[index]);
679  trHalfSub = new TGeoTranslation(HalfSubShifts_x[41+index], HalfSubShifts_y[41+index], HalfSubShifts_z[41+index] - 20.);
680  TGeoCombiTrans *trrotHalfSub= new TGeoCombiTrans(trHalfSub,rotHalfSub);
681  name="HalfSubunitVolFwEndCap";
682  name+= (42+index);
683  trrotSub->SetName(name);
684  trrotSub->RegisterYourself();
685  top->AddNode(HalfSubunitVol,42+index,trrotHalfSub);// copy numbering from 43 to 50 (bottom right part)
686 
687  rotHalfSub = new TGeoRotation();
688  if (index<=4)
689  rotHalfSub.RotateZ(90);
690  rotHalfSub.RotateX(-peripheralHalfSubRots_x[index]);
691  rotHalfSub.RotateY(peripheralHalfSubRots_y[index]);
692  trHalfSub = new TGeoTranslation(HalfSubShifts_x[58-index], HalfSubShifts_y[58-index], HalfSubShifts_z[58-index] - 20.);
693  TGeoCombiTrans *trrotHalfSub= new TGeoCombiTrans(trHalfSub,rotHalfSub);
694  name="HalfSubunitVolFwEndCap";
695  name+= (59-index);
696  trrotSub->SetName(name);
697  trrotSub->RegisterYourself();
698  top->AddNode(HalfSubunitVol,59-index,trrotHalfSub);// copy numbering from 58 to 51 (bottom left part)
699  }
700 
701 
702 //overlap checking:
703  TGeoNode* myNode = SubunitVol->GetNode(0);//allowed arguments for SubunitVol: 0-4, 4 being for Alveole
704  gGeoManager->CheckOverlaps(0.001);// myNode->CheckOverlaps(0.001)
705  //cout <<"Overlaps: "<<gGeoManager->PrintOverlaps()<<endl ;
706 
707 //finally:
708  gGeoMan->CloseGeometry();
709  top->Write();
710  fi->Close();
711  top->Draw();
712 
713  TCanvas* c0 = new TCanvas("c0","", 10, 20, 1200, 900);
714  gStyle->SetOptStat(0);
715  c0->SetFillColor(10);
716  c0->SetFrameFillColor(10);
717  c0->Divide(2,2);
718  c0->cd(1);
719  HISTOsubunitTheta->Draw();
720  c0->cd(3);
721  HISTOsubunitTheta_offpointToFwEndCap->Draw();
722  c0->cd(2);
723  HISTOoffpointToCrystalMidpointAlongBeam_calculatedForEachSubunit->Draw();
724  c0->cd(4);
725  HISTOoffpointToFwEndCap_calculatedForEachSubunit->Draw();
726 
727  return 0;
728 }
int row
Definition: anaLmdDigi.C:67
Double_t z0
Definition: checkhelixhit.C:62
Double_t x0
Definition: checkhelixhit.C:70
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
const Double_t kSpaceInSub
FairGeoLoader * geoLoad
Int_t i
Definition: run_full.C:25
FairGeoMedia * Media
TGeoShape * CrystalShape
TGeoTranslation trCrystal
const Double_t kSpaceSubGlue
TGeoManager * gGeoMan
FairGeoMedium * CbmMediumCarbon
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
int col
Definition: anaLmdDigi.C:67
TGeoTranslation trSub
Double_t vertBox[20]
TGeoManager * gGeoManager
TGeoVolume * top
TGeoVolume * SubunitVol
TGeoRotation rotBox
Double_t vertSub[20]
FairGeoBuilder * geobuild
TFile * fi
Double_t
TString medium
Double_t vert[20]
Double_t y0
Definition: checkhelixhit.C:71
TGeoVolume * BoxVol
TGeoShape * BoxShape
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
TString name
FairGeoMedium * CbmMediumAir
const Double_t kAlveoleThickness
TGeoVolume * CrystalVol
TGeoRotation rotCrystal
TGeoRotation rotSub
TGeoShape * SubunitShape
FairGeoMedium * CbmMediumPWO
FairGeoInterface * geoFace
TGeoTranslation trBox
Double_t Pi