AliRoot Core  da88d91 (da88d91)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMFTHeatExchanger.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 // $Id$
17 
18 //-----------------------------------------------------------------------------
23 // Primary Author: P. Demongodin
24 // Contact Author Raphael Tieulent <raphael.tieulent@cern.ch>
25 //-----------------------------------------------------------------------------
26 
27 
28 #include "TMath.h"
29 #include "TGeoManager.h"
30 #include "TGeoCompositeShape.h"
31 #include "TGeoTube.h"
32 #include "TGeoBoolNode.h"
33 #include "AliLog.h"
34 #include "AliMFTHeatExchanger.h"
35 #include "TGeoBBox.h"
36 #include "TGeoVolume.h"
37 #include "AliMFTGeometry.h"
38 
42 
43 //====================================================================================================================================================
44 
46  fRWater = 0.1/2.;
47  fDRPipe = 0.005;
48  //fHeatExchangerThickness = 1.618; // to get a 13.4 mm thickness for the rohacell... don't implement this value yet! overlapping issue!
49  fHeatExchangerThickness = 1.4; // initial value
50  fCarbonThickness = (0.0290)/2.; // total thickness of the carbon plate
52 }
53 
54 //====================================================================================================================================================
55 
57  Double_t dRPipe,
58  Double_t heatExchangerThickness,
59  Double_t carbonThickness) : TNamed() {
60  fRWater = rWater;
61  fDRPipe = dRPipe;
62  fHeatExchangerThickness = heatExchangerThickness;
63  fCarbonThickness = carbonThickness;
65 
66 }
67 
68 //====================================================================================================================================================
69 
70 TGeoVolumeAssembly* AliMFTHeatExchanger::Create(Int_t half, Int_t disk) {
71 
72  AliInfo(Form("Creating HeatExchanger_%d_%d", disk, half));
73 
74  fHalfDisk = new TGeoVolumeAssembly(Form("HeatExchanger_%d_%d", disk, half));
75  switch (disk) {
76  case 0: CreateHalfDisk0(half);
77  break;
78  case 1: CreateHalfDisk1(half);
79  break;
80  case 2: CreateHalfDisk2(half);
81  break;
82  case 3: CreateHalfDisk3(half);
83  break;
84  case 4: CreateHalfDisk4(half);
85  break;
86  }
87 
88 
89  return fHalfDisk;
90 
91 }
92 
93 //====================================================================================================================================================
94 
96 
97  Int_t disk = 0;
98 
99  if (half == kTop) printf("Creating MFT heat exchanger for disk0 top\n");
100  else if (half == kBottom) printf("Creating MFT heat exchanger for disk0 bottom\n");
101  else printf("No valid option for MFT heat exchanger on disk0\n");
102 
103  //TGeoMedium *carbon = gGeoManager->GetMedium("MFT_Carbon$");
104  TGeoMedium *carbon = gGeoManager->GetMedium("MFT_CarbonFiber$");
105 
106  TGeoMedium *water = gGeoManager->GetMedium("MFT_Water$");
107  TGeoMedium *rohacell = gGeoManager->GetMedium("MFT_Rohacell");
108  TGeoMedium *pipe = gGeoManager->GetMedium("MFT_Polyimide");
109 
110  TGeoVolumeAssembly *cooling = new TGeoVolumeAssembly(Form("cooling_D0_H%d",half));
111 
112  Float_t lMiddle = fSupportXDimensions[disk][0] - 2.*fLWater; // length of central part
113 
114  TGeoTranslation *translation = 0;
115  TGeoRotation *rotation = 0;
116  TGeoCombiTrans *transformation = 0;
117 
118  TGeoCombiTrans *transformation1 = 0;
119  TGeoCombiTrans *transformation2 = 0;
120 
121 
122  // **************************************** Water part ****************************************
123 
124  // ------------------- Tube shape -------------------
125 
126  TGeoVolume *waterTube1 = gGeoManager->MakeTube(Form("waterTube1_D0_H%d",half), water, 0., fRWater, fLWater/2.);
127  waterTube1->SetLineColor(kBlue);
128 
129  for (Int_t itube=0; itube<3; itube++) {
130  translation = new TGeoTranslation(fXPosition0[itube], 0., fLWater/2. + lMiddle/2.);
131  cooling->AddNode (waterTube1, itube, translation);
132  translation = new TGeoTranslation(fXPosition0[itube], 0., -fLWater/2. - lMiddle/2.);
133  cooling->AddNode (waterTube1, itube+3, translation);
134  }
135 
136  Double_t angle0rad = fangle0*(TMath::DegToRad());
137 
138  TGeoVolume *waterTube2 = gGeoManager->MakeTube(Form("waterTube2_D0_H%d",half), water, 0., fRWater, fLpartial0/2.);
139  waterTube2->SetLineColor(kBlue);
140 
141  for (Int_t itube=0; itube<3; itube++) {
142  rotation = new TGeoRotation ("rotation", -90., -fangle0, 0.);
143  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) +
144  (fLpartial0/2.)*(TMath::Sin(angle0rad)), 0., - lMiddle/2. +
145  fradius0*(TMath::Sin(angle0rad)) + (fLpartial0/2.)*TMath::Cos(angle0rad), rotation);
146  cooling->AddNode (waterTube2, itube, transformation);
147  rotation = new TGeoRotation ("rotation", -90., fangle0, 0.);
148  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) +
149  (fLpartial0/2.)*(TMath::Sin(angle0rad)), 0., lMiddle/2. -
150  fradius0*(TMath::Sin(angle0rad)) - (fLpartial0/2.)*TMath::Cos(angle0rad), rotation);
151  cooling->AddNode (waterTube2, itube+3, transformation);
152  }
153 
154  // ------------------- Torus shape -------------------
155 
156  // Sides torus
157 
158  TGeoVolume *waterTorus1 = gGeoManager->MakeTorus(Form("waterTorus1_D0_H%d",half), water, fradius0, 0., fRWater, 0., fangle0);
159  waterTorus1->SetLineColor(kBlue);
160  Double_t radius0mid = (lMiddle - 2.*(fradius0*(TMath::Sin(angle0rad)) + fLpartial0*(TMath::Cos(angle0rad))))/(2*(TMath::Sin(angle0rad)));
161 
162  for (Int_t itube=0; itube<3; itube++) {
163  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
164  transformation = new TGeoCombiTrans(fradius0 + fXPosition0[itube], 0., - lMiddle/2., rotation);
165  cooling->AddNode (waterTorus1, itube, transformation);
166  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
167  transformation = new TGeoCombiTrans(fradius0 + fXPosition0[itube], 0., lMiddle/2., rotation);
168  cooling->AddNode (waterTorus1, itube+3, transformation);
169  }
170 
171  // Central Torus
172 
173  TGeoVolume *waterTorus2 = gGeoManager->MakeTorus(Form("waterTorus2_D0_H%d",half), water, radius0mid, 0., fRWater, - fangle0 , 2.*fangle0);
174  waterTorus2->SetLineColor(kBlue);
175 
176  for(Int_t itube=0; itube<3; itube++) {
177  rotation = new TGeoRotation ("rotation", 0., 90., 0.);
178  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) + fLpartial0*TMath::Sin(angle0rad) - radius0mid*TMath::Cos(angle0rad), 0., 0., rotation);
179  cooling->AddNode (waterTorus2, itube, transformation);
180  }
181 
182  // **************************************** Pipe part ****************************************
183 
184  // ------------------- Tube shape -------------------
185 
186  TGeoVolume *pipeTube1 = gGeoManager->MakeTube(Form("pipeTube1_D0_H%d",half), pipe, fRWater, fRWater + fDRPipe, fLWater/2.);
187  pipeTube1->SetLineColor(10);
188 
189  for (Int_t itube=0; itube<3; itube++){
190  translation = new TGeoTranslation(fXPosition0[itube], 0., fLWater/2. + lMiddle/2.);
191  cooling->AddNode (pipeTube1, itube, translation);
192  translation = new TGeoTranslation(fXPosition0[itube], 0., -fLWater/2. - lMiddle/2.);
193  cooling->AddNode (pipeTube1, itube+3, translation);
194  }
195 
196  TGeoVolume *pipeTube2 = gGeoManager->MakeTube(Form("pipeTube2_D0_H%d",half), pipe, fRWater, fRWater + fDRPipe, fLpartial0/2.);
197  waterTube2->SetLineColor(10);
198 
199  for(Int_t itube=0; itube<3; itube++) {
200  rotation = new TGeoRotation ("rotation", -90., -fangle0, 0.);
201  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) +
202  (fLpartial0/2.)*(TMath::Sin(angle0rad)), 0., - lMiddle/2. +
203  fradius0*(TMath::Sin(angle0rad)) + (fLpartial0/2.)*TMath::Cos(angle0rad), rotation);
204  cooling->AddNode (pipeTube2, itube, transformation);
205 
206  rotation = new TGeoRotation ("rotation", -90., fangle0, 0.);
207  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) +
208  (fLpartial0/2.)*(TMath::Sin(angle0rad)), 0., lMiddle/2. -
209  fradius0*(TMath::Sin(angle0rad)) - (fLpartial0/2.)*TMath::Cos(angle0rad), rotation);
210  cooling->AddNode (pipeTube2, itube+3, transformation);
211  }
212 
213  // ------------------- Torus shape -------------------
214 
215  // Sides Torus
216  TGeoVolume *pipeTorus1 = gGeoManager->MakeTorus(Form("pipeTorus1_D0_H%d",half), pipe, fradius0, fRWater, fRWater + fDRPipe, 0., fangle0);
217  pipeTorus1->SetLineColor(10);
218 
219  for (Int_t itube=0; itube<3; itube++) {
220  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
221  transformation = new TGeoCombiTrans(fradius0 + fXPosition0[itube], 0., - lMiddle/2., rotation);
222  cooling->AddNode (pipeTorus1, itube, transformation);
223  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
224  transformation = new TGeoCombiTrans(fradius0 + fXPosition0[itube], 0., lMiddle/2., rotation);
225  cooling->AddNode (pipeTorus1, itube+3, transformation);
226  }
227 
228  // Central Torus
229  TGeoVolume *pipeTorus2 = gGeoManager->MakeTorus(Form("pipeTorus2_D0_H%d",half), pipe, radius0mid, fRWater, fRWater + fDRPipe, - fangle0 , 2.*fangle0);
230  pipeTorus2->SetLineColor(10);
231 
232  for(Int_t itube=0; itube<3; itube++) {
233  rotation = new TGeoRotation ("rotation", 0., 90., 0.);
234  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) + fLpartial0*TMath::Sin(angle0rad) - radius0mid*TMath::Cos(angle0rad), 0., 0., rotation);
235  cooling->AddNode (pipeTorus2, itube, transformation);
236  }
237 
238  Double_t deltaz = fHeatExchangerThickness - fCarbonThickness*2; // distance between pair of carbon plates
239 
240 // if (half == kTop) {
241 // rotation = new TGeoRotation ("rotation", 90., 90., 0.);
242 // transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] + deltaz/2. - fCarbonThickness - fRWater - fDRPipe, rotation);
243 // fHalfDisk->AddNode(cooling, 1, transformation);
244 // transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] - deltaz/2. + fCarbonThickness + fRWater + fDRPipe, rotation);
245 // fHalfDisk->AddNode(cooling, 2, transformation);
246 // }
247 // else if (half == kBottom) {
248  rotation = new TGeoRotation ("rotation", -90., 90., 0.);
249  transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] + deltaz/2. - fCarbonThickness - fRWater - fDRPipe, rotation);
250  fHalfDisk->AddNode(cooling, 3, transformation);
251  transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] - deltaz/2. + fCarbonThickness + fRWater + fDRPipe, rotation);
252  fHalfDisk->AddNode(cooling, 4, transformation);
253 // }
254 
255 
256 
257 
258  // **************************************** Carbon Plates ****************************************
259 
260  TGeoVolumeAssembly *carbonPlate = new TGeoVolumeAssembly(Form("carbonPlate_D0_H%d",half));
261 
262  TGeoBBox *carbonBase0 = new TGeoBBox (Form("carbonBase0_D0_H%d",half), (fSupportXDimensions[disk][0])/2., (fSupportYDimensions[disk][0])/2., fCarbonThickness);
263  TGeoTranslation *t01= new TGeoTranslation ("t01",0., (fSupportYDimensions[disk][0])/2. + fHalfDiskGap , 0.);
264  t01-> RegisterYourself();
265 
266  TGeoTubeSeg *holeCarbon0 = new TGeoTubeSeg(Form("holeCarbon0_D0_H%d",half), 0., fRMin[disk], fCarbonThickness + 0.000001, 0, 180.);
267  TGeoTranslation *t02= new TGeoTranslation ("t02",0., - fHalfDiskGap , 0.);
268  t02-> RegisterYourself();
269 
271  TGeoSubtraction *carbonhole0 = new TGeoSubtraction(carbonBase0, holeCarbon0, t01, t02);
272  TGeoCompositeShape *ch0 = new TGeoCompositeShape(Form("Carbon0_D0_H%d",half), carbonhole0);
273  TGeoVolume *carbonBaseWithHole0 = new TGeoVolume(Form("carbonBaseWithHole_D0_H%d", half), ch0, carbon);
274 
275 
276  carbonBaseWithHole0->SetLineColor(kGray+3);
277  rotation = new TGeoRotation ("rotation", 0., 0., 0.);
278  transformation = new TGeoCombiTrans(0., 0., 0., rotation);
279  carbonPlate->AddNode(carbonBaseWithHole0, 0, new TGeoTranslation(0., 0., fZPlan[disk]));
280 
281  Double_t ty = fSupportYDimensions[disk][0];
282 
283  for (Int_t ipart=1; ipart<fnPart[disk]; ipart ++) {
284  ty += fSupportYDimensions[disk][ipart]/2.;
285  TGeoVolume *partCarbon = gGeoManager->MakeBox(Form("partCarbon_D0_H%d_%d", half,ipart), carbon, fSupportXDimensions[disk][ipart]/2., fSupportYDimensions[disk][ipart]/2., fCarbonThickness);
286  partCarbon->SetLineColor(kGray+3);
287  TGeoTranslation *t = new TGeoTranslation ("t", 0, ty + fHalfDiskGap, fZPlan[disk]);
288  carbonPlate -> AddNode(partCarbon, ipart, t);
289  ty += fSupportYDimensions[disk][ipart]/2.;
290  }
291 
292 // if (half == kTop) {
293 // rotation = new TGeoRotation ("rotation", 0., 0., 0.);
294 // transformation = new TGeoCombiTrans(0., 0., deltaz/2., rotation);
295 // fHalfDisk->AddNode(carbonPlate, 1, transformation);
296 // transformation = new TGeoCombiTrans(0., 0., -deltaz/2., rotation);
297 // fHalfDisk->AddNode(carbonPlate, 2, transformation);
298 // }
299 // else if (half == kBottom) {
300  rotation = new TGeoRotation ("rotation", 180., 0., 0.);
301  transformation = new TGeoCombiTrans(0., 0., deltaz/2., rotation);
302  fHalfDisk->AddNode(carbonPlate, 3, transformation);
303  transformation = new TGeoCombiTrans(0., 0., -deltaz/2., rotation);
304  fHalfDisk->AddNode(carbonPlate, 4, transformation);
305 // }
306 
307 
308 
309  // **************************************** Rohacell Plate ****************************************
310 
311  TGeoVolumeAssembly *rohacellPlate = new TGeoVolumeAssembly(Form("rohacellPlate_D0_H%d",half));
312 
313  TGeoBBox *rohacellBase0 = new TGeoBBox (Form("rohacellBase0_D0_H%d",half), (fSupportXDimensions[disk][0])/2., (fSupportYDimensions[disk][0])/2., fRohacellThickness);
314  // TGeoTranslation *t3 = new TGeoTranslation ("t3",0., (fSupportYDimensions[disk][0])/2. + fHalfDiskGap , 0.);
315  // t3 -> RegisterYourself();
316 
317  TGeoTubeSeg *holeRohacell0 = new TGeoTubeSeg(Form("holeRohacell0_D0_H%d",half), 0., fRMin[disk], fRohacellThickness + 0.000001, 0, 180.);
318  // TGeoTranslation *t4= new TGeoTranslation ("t4", 0., - fHalfDiskGap , 0.);
319  // t4-> RegisterYourself();
320 
322  TGeoSubtraction *rohacellhole0 = new TGeoSubtraction(rohacellBase0, holeRohacell0, t01, t02);
323  TGeoCompositeShape *rh0 = new TGeoCompositeShape(Form("rohacellBase0_D0_H%d",half), rohacellhole0);
324  TGeoVolume *rohacellBaseWithHole = new TGeoVolume(Form("rohacellBaseWithHole_D0_H%d",half), rh0, rohacell);
325 
326 
327  rohacellBaseWithHole->SetLineColor(kGray);
328  rotation = new TGeoRotation ("rotation", 0., 0., 0.);
329  transformation = new TGeoCombiTrans(0., 0., 0., rotation);
330  rohacellPlate -> AddNode(rohacellBaseWithHole, 0, new TGeoTranslation(0., 0., fZPlan[disk]));
331 
332  ty = fSupportYDimensions[disk][0];
333 
334  for (Int_t ipart=1; ipart<fnPart[disk]; ipart ++) {
335  ty += fSupportYDimensions[disk][ipart]/2.;
336  TGeoVolume *partRohacell = gGeoManager->MakeBox(Form("partRohacelli_D0_H%d_%d", half,ipart), rohacell, fSupportXDimensions[disk][ipart]/2., fSupportYDimensions[disk][ipart]/2., fRohacellThickness);
337  partRohacell->SetLineColor(kGray);
338  TGeoTranslation *t = new TGeoTranslation ("t", 0, ty + fHalfDiskGap, fZPlan[disk]);
339  rohacellPlate -> AddNode(partRohacell, ipart, t);
340  ty += fSupportYDimensions[disk][ipart]/2.;
341  }
342 
343 // if (half == kTop) {
344 // rotation = new TGeoRotation ("rotation", 0., 0., 0.);
345 // transformation = new TGeoCombiTrans(0., 0., 0., rotation);
346 // fHalfDisk->AddNode(rohacellPlate, 1, transformation);
347 // }
348 // if (half == kBottom) {
349  rotation = new TGeoRotation ("rotation", 180., 0., 0.);
350  transformation = new TGeoCombiTrans(0., 0., 0., rotation);
351  fHalfDisk->AddNode(rohacellPlate, 1, transformation);
352 // }
353 
354 
355 
356  // **************************************** Manyfolds right and left, fm ****************************************
357  /*
358  Double_t deltay = 0.2; // ecart par rapport au plan median du MFT
359  Double_t mfX = 2.2; // largeur
360  Double_t mfY = 6.8; // hauteur
361  Double_t mfZ = 1.7; // epaisseur
362 
363  TGeoMedium *kMedPeek = gGeoManager->GetMedium("MFT_PEEK$");
364 
365 
366  TGeoBBox *boxmanyfold = new TGeoBBox("boxmanyfold", mfX/2, mfY/2, mfZ/2);
367  TGeoBBox *remove = new TGeoBBox("remove", 0.45/2 + AliMFTGeometry::kEpsilon, mfY/2 + AliMFTGeometry::kEpsilon, 0.6/2 + AliMFTGeometry::kEpsilon);
368  TGeoTranslation *tL= new TGeoTranslation ("tL", mfX/2-0.45/2, 0., -mfZ/2+0.6/2);
369  TGeoSubtraction *boxManyFold = new TGeoSubtraction(boxmanyfold, remove, NULL, tL);
370  TGeoCompositeShape *BoxManyFold = new TGeoCompositeShape("BoxManyFold", boxManyFold);
371 
372  TGeoTranslation *tR= new TGeoTranslation ("tR", -mfX/2+0.45/2, 0., -mfZ/2+0.6/2);
373  TGeoSubtraction *boxManyFold1 = new TGeoSubtraction(BoxManyFold, remove, NULL, tR);
374  TGeoCompositeShape *BoxManyFold1 = new TGeoCompositeShape("BoxManyFold1", boxManyFold1);
375 
376  TGeoVolume *MF1 = new TGeoVolume("MF1", BoxManyFold1, kMedPeek);
377 
378  rotation = new TGeoRotation ("rotation", 90., 90., 90.);
379  transformation1 = new TGeoCombiTrans(fSupportXDimensions[disk][0]/2+mfZ/2, mfY/2+deltay, fZPlan[disk], rotation);
380 
381  fHalfDisk->AddNode(MF1, 1, transformation1);
382 
383  TGeoVolume *MF2 = new TGeoVolume("MF2", BoxManyFold1, kMedPeek);
384  transformation2 = new TGeoCombiTrans(fSupportXDimensions[disk][0]/2+mfZ/2, -mfY/2-deltay, fZPlan[disk], rotation);
385 
386  fHalfDisk->AddNode(MF2, 1, transformation2);
387  */
388  // ********************************************************************************************************
389 
390 }
391 
392 //====================================================================================================================================================
393 
395 
396  Int_t disk = 1;
397 
398  if (half == kTop) printf("Creating MFT heat exchanger for disk1 top\n");
399  else if (half == kBottom) printf("Creating MFT heat exchanger for disk1 bottom\n");
400  else printf("No valid option for MFT heat exchanger on disk1\n");
401 
402  //TGeoMedium *carbon = gGeoManager->GetMedium("MFT_Carbon$");
403  TGeoMedium *carbon = gGeoManager->GetMedium("MFT_CarbonFiber$");
404 
405 
406  TGeoMedium *water = gGeoManager->GetMedium("MFT_Water$");
407  TGeoMedium *rohacell = gGeoManager->GetMedium("MFT_Rohacell");
408  TGeoMedium *pipe = gGeoManager->GetMedium("MFT_Polyimide");
409 
410 
411  TGeoVolumeAssembly *cooling = new TGeoVolumeAssembly(Form("cooling_D1_H%d",half));
412 
413  Float_t lMiddle = fSupportXDimensions[disk][0] - 2.*fLWater; // length of central part
414 
415  TGeoTranslation *translation = 0;
416  TGeoRotation *rotation = 0;
417  TGeoCombiTrans *transformation = 0;
418 
419 
420  // **************************************** Water part ****************************************
421 
422  // ------------------- Tube shape -------------------
423 
424  TGeoVolume *waterTube1 = gGeoManager->MakeTube(Form("waterTube1_D1_H%d",half), water, 0., fRWater, fLWater/2.);
425  waterTube1->SetLineColor(kBlue);
426 
427  for (Int_t itube=0; itube<3; itube++) {
428  translation = new TGeoTranslation(fXPosition0[itube], 0., fLWater/2. + lMiddle/2.);
429  cooling->AddNode (waterTube1, itube, translation);
430  translation = new TGeoTranslation(fXPosition0[itube], 0., -fLWater/2. - lMiddle/2.);
431  cooling->AddNode (waterTube1, itube+3, translation);
432  }
433 
434  Double_t angle0rad = fangle0*(TMath::DegToRad());
435 
436  TGeoVolume *waterTube2 = gGeoManager->MakeTube(Form("waterTube2_D1_H%d",half), water, 0., fRWater, fLpartial0/2.);
437  waterTube2->SetLineColor(kBlue);
438 
439  for (Int_t itube=0; itube<3; itube++) {
440  rotation = new TGeoRotation ("rotation", -90., -fangle0, 0.);
441  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) +
442  (fLpartial0/2.)*(TMath::Sin(angle0rad)), 0., - lMiddle/2. +
443  fradius0*(TMath::Sin(angle0rad)) + (fLpartial0/2.)*TMath::Cos(angle0rad), rotation);
444  cooling->AddNode (waterTube2, itube, transformation);
445  rotation = new TGeoRotation ("rotation", -90., fangle0, 0.);
446  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) +
447  (fLpartial0/2.)*(TMath::Sin(angle0rad)), 0., lMiddle/2. -
448  fradius0*(TMath::Sin(angle0rad)) - (fLpartial0/2.)*TMath::Cos(angle0rad), rotation);
449  cooling->AddNode (waterTube2, itube+3, transformation);
450  }
451 
452  // ------------------- Torus shape -------------------
453 
454  // Sides torus
455 
456  TGeoVolume *waterTorus1 = gGeoManager->MakeTorus(Form("waterTorus1_D1_H%d",half), water, fradius0, 0., fRWater, 0., fangle0);
457  waterTorus1->SetLineColor(kBlue);
458  Double_t radius0mid = (lMiddle - 2.*(fradius0*(TMath::Sin(angle0rad)) + fLpartial0*(TMath::Cos(angle0rad))))/(2*(TMath::Sin(angle0rad)));
459 
460  for (Int_t itube=0; itube<3; itube++) {
461  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
462  transformation = new TGeoCombiTrans(fradius0 + fXPosition0[itube], 0., - lMiddle/2., rotation);
463  cooling->AddNode (waterTorus1, itube, transformation);
464  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
465  transformation = new TGeoCombiTrans(fradius0 + fXPosition0[itube], 0., lMiddle/2., rotation);
466  cooling->AddNode (waterTorus1, itube+3, transformation);
467  }
468 
469  // Central Torus
470 
471  TGeoVolume *waterTorus2 = gGeoManager->MakeTorus(Form("waterTorus2_D1_H%d",half), water, radius0mid, 0., fRWater, - fangle0 , 2.*fangle0);
472  waterTorus2->SetLineColor(kBlue);
473 
474  for(Int_t itube=0; itube<3; itube++) {
475  rotation = new TGeoRotation ("rotation", 0., 90., 0.);
476  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) + fLpartial0*TMath::Sin(angle0rad) - radius0mid*TMath::Cos(angle0rad), 0., 0., rotation);
477  cooling->AddNode (waterTorus2, itube, transformation);
478  }
479 
480  // **************************************** Pipe part ****************************************
481 
482  // ------------------- Tube shape -------------------
483 
484  TGeoVolume *pipeTube1 = gGeoManager->MakeTube(Form("pipeTube1_D1_H%d",half), pipe, fRWater, fRWater + fDRPipe, fLWater/2.);
485  pipeTube1->SetLineColor(10);
486 
487  for (Int_t itube=0; itube<3; itube++){
488  translation = new TGeoTranslation(fXPosition0[itube], 0., fLWater/2. + lMiddle/2.);
489  cooling->AddNode (pipeTube1, itube, translation);
490  translation = new TGeoTranslation(fXPosition0[itube], 0., -fLWater/2. - lMiddle/2.);
491  cooling->AddNode (pipeTube1, itube+3, translation);
492  }
493 
494  TGeoVolume *pipeTube2 = gGeoManager->MakeTube(Form("pipeTube2_D1_H%d",half), pipe, fRWater, fRWater + fDRPipe, fLpartial0/2.);
495  waterTube2->SetLineColor(10);
496 
497  for(Int_t itube=0; itube<3; itube++) {
498  rotation = new TGeoRotation ("rotation", -90., -fangle0, 0.);
499  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) +
500  (fLpartial0/2.)*(TMath::Sin(angle0rad)), 0., - lMiddle/2. +
501  fradius0*(TMath::Sin(angle0rad)) + (fLpartial0/2.)*TMath::Cos(angle0rad), rotation);
502  cooling->AddNode (pipeTube2, itube, transformation);
503 
504  rotation = new TGeoRotation ("rotation", -90., fangle0, 0.);
505  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) +
506  (fLpartial0/2.)*(TMath::Sin(angle0rad)), 0., lMiddle/2. -
507  fradius0*(TMath::Sin(angle0rad)) - (fLpartial0/2.)*TMath::Cos(angle0rad), rotation);
508  cooling->AddNode (pipeTube2, itube+3, transformation);
509  }
510 
511  // ------------------- Torus shape -------------------
512 
513  // Sides Torus
514  TGeoVolume *pipeTorus1 = gGeoManager->MakeTorus(Form("pipeTorus1_D1_H%d",half), pipe, fradius0, fRWater, fRWater + fDRPipe, 0., fangle0);
515  pipeTorus1->SetLineColor(10);
516 
517  for (Int_t itube=0; itube<3; itube++) {
518  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
519  transformation = new TGeoCombiTrans(fradius0 + fXPosition0[itube], 0., - lMiddle/2., rotation);
520  cooling->AddNode (pipeTorus1, itube, transformation);
521  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
522  transformation = new TGeoCombiTrans(fradius0 + fXPosition0[itube], 0., lMiddle/2., rotation);
523  cooling->AddNode (pipeTorus1, itube+3, transformation);
524  }
525 
526  // Central Torus
527  TGeoVolume *pipeTorus2 = gGeoManager->MakeTorus(Form("pipeTorus2_D1_H%d",half), pipe, radius0mid, fRWater, fRWater + fDRPipe, - fangle0 , 2.*fangle0);
528  pipeTorus2->SetLineColor(10);
529 
530  for(Int_t itube=0; itube<3; itube++) {
531  rotation = new TGeoRotation ("rotation", 0., 90., 0.);
532  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) + fLpartial0*TMath::Sin(angle0rad) - radius0mid*TMath::Cos(angle0rad), 0., 0., rotation);
533  cooling->AddNode (pipeTorus2, itube, transformation);
534  }
535 
536  Double_t deltaz = fHeatExchangerThickness - fCarbonThickness*2; // distance between pair of carbon plates
537 
538 // if (half == kTop) {
539 // rotation = new TGeoRotation ("rotation", 90., 90., 0.);
540 // transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] + deltaz/2. - fCarbonThickness - fRWater - fDRPipe, rotation);
541 // fHalfDisk->AddNode(cooling, 1, transformation);
542 // transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] - deltaz/2. + fCarbonThickness + fRWater + fDRPipe, rotation);
543 // fHalfDisk->AddNode(cooling, 2, transformation);
544 // }
545 // else if (half == kBottom) {
546  rotation = new TGeoRotation ("rotation", -90., 90., 0.);
547  transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] + deltaz/2. - fCarbonThickness - fRWater - fDRPipe, rotation);
548  fHalfDisk->AddNode(cooling, 0, transformation);
549  transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] - deltaz/2. + fCarbonThickness + fRWater + fDRPipe, rotation);
550  fHalfDisk->AddNode(cooling, 1, transformation);
551 // }
552 
553 
554  // **************************************** Carbon Plates ****************************************
555 
556 
557 
558  TGeoVolumeAssembly *carbonPlate = new TGeoVolumeAssembly(Form("carbonPlate_D1_H%d",half));
559 
560  TGeoBBox *carbonBase1 = new TGeoBBox (Form("carbonBase1_D1_H%d",half), (fSupportXDimensions[disk][0])/2., (fSupportYDimensions[disk][0])/2., fCarbonThickness);
561  TGeoTranslation *t11= new TGeoTranslation ("t11",0., (fSupportYDimensions[disk][0])/2. + fHalfDiskGap , 0.);
562  t11-> RegisterYourself();
563 
564  TGeoTubeSeg *holeCarbon1 = new TGeoTubeSeg(Form("holeCarbon1_D1_H%d",half), 0., fRMin[disk], fCarbonThickness + 0.000001, 0, 180.);
565  TGeoTranslation *t12= new TGeoTranslation ("t12",0., - fHalfDiskGap , 0.);
566  t12-> RegisterYourself();
567 
568 
570  TGeoSubtraction *carbonhole1 = new TGeoSubtraction(carbonBase1, holeCarbon1, t11, t12);
571  TGeoCompositeShape *ch1 = new TGeoCompositeShape(Form("Carbon1_D1_H%d",half), carbonhole1);
572  TGeoVolume *carbonBaseWithHole1 = new TGeoVolume(Form("carbonBaseWithHole_D1_H%d",half), ch1, carbon);
573 
574 
575  carbonBaseWithHole1->SetLineColor(kGray+3);
576  rotation = new TGeoRotation ("rotation", 0., 0., 0.);
577  transformation = new TGeoCombiTrans(0., 0., 0., rotation);
578  carbonPlate->AddNode(carbonBaseWithHole1, 0, new TGeoTranslation(0., 0., fZPlan[disk]));
579 
580  Double_t ty = fSupportYDimensions[disk][0];
581 
582  for (Int_t ipart=1; ipart<fnPart[disk]; ipart ++) {
583  ty += fSupportYDimensions[disk][ipart]/2.;
584  TGeoVolume *partCarbon = gGeoManager->MakeBox(Form("partCarbon_D1_H%d_%d", half,ipart), carbon, fSupportXDimensions[disk][ipart]/2.,
585  fSupportYDimensions[disk][ipart]/2., fCarbonThickness);
586  partCarbon->SetLineColor(kGray+3);
587  TGeoTranslation *t = new TGeoTranslation ("t", 0, ty + fHalfDiskGap, fZPlan[disk]);
588  carbonPlate -> AddNode(partCarbon, ipart, t);
589  ty += fSupportYDimensions[disk][ipart]/2.;
590  }
591 
592 // if (half == kTop) {
593 // rotation = new TGeoRotation ("rotation", 0., 0., 0.);
594 // transformation = new TGeoCombiTrans(0., 0., deltaz/2., rotation);
595 // fHalfDisk->AddNode(carbonPlate, 1, transformation);
596 // transformation = new TGeoCombiTrans(0., 0., -deltaz/2., rotation);
597 // fHalfDisk->AddNode(carbonPlate, 2, transformation);
598 // }
599 // else if (half == kBottom) {
600  rotation = new TGeoRotation ("rotation", 180., 0., 0.);
601  transformation = new TGeoCombiTrans(0., 0., deltaz/2., rotation);
602  fHalfDisk->AddNode(carbonPlate, 0, transformation);
603  transformation = new TGeoCombiTrans(0., 0., -deltaz/2., rotation);
604  fHalfDisk->AddNode(carbonPlate, 1, transformation);
605 // }
606 
607 
608  // **************************************** Rohacell Plate ****************************************
609 
610  TGeoVolumeAssembly *rohacellPlate = new TGeoVolumeAssembly(Form("rohacellPlate_D1_H%d",half));
611 
612  TGeoBBox *rohacellBase1 = new TGeoBBox ("rohacellBase1", (fSupportXDimensions[disk][0])/2., (fSupportYDimensions[disk][0])/2., fRohacellThickness);
613  // TGeoTranslation *t3 = new TGeoTranslation ("t3",0., (fSupportYDimensions[disk][0])/2. + fHalfDiskGap , 0.);
614  // t3 -> RegisterYourself();
615 
616  TGeoTubeSeg *holeRohacell1 = new TGeoTubeSeg("holeRohacell1", 0., fRMin[disk], fRohacellThickness + 0.000001, 0, 180.);
617  // TGeoTranslation *t4= new TGeoTranslation ("t4", 0., - fHalfDiskGap , 0.);
618  // t4-> RegisterYourself();
619 
621  TGeoSubtraction *rohacellhole1 = new TGeoSubtraction(rohacellBase1, holeRohacell1, t11, t12);
622  TGeoCompositeShape *rh1 = new TGeoCompositeShape(Form("rohacellBase1_D1_H%d",half), rohacellhole1);
623  TGeoVolume *rohacellBaseWithHole = new TGeoVolume(Form("rohacellBaseWithHole_D1_H%d",half), rh1, rohacell);
624 
625 
626  rohacellBaseWithHole->SetLineColor(kGray);
627  rotation = new TGeoRotation ("rotation", 0., 0., 0.);
628  transformation = new TGeoCombiTrans(0., 0., 0., rotation);
629  rohacellPlate -> AddNode(rohacellBaseWithHole, 0, new TGeoTranslation(0., 0., fZPlan[disk]));
630 
631  ty = fSupportYDimensions[disk][0];
632 
633  for (Int_t ipart=1; ipart<fnPart[disk]; ipart ++) {
634  ty += fSupportYDimensions[disk][ipart]/2.;
635  TGeoVolume *partRohacell = gGeoManager->MakeBox(Form("partRohacelli_D1_H%d_%d",half, ipart), rohacell, fSupportXDimensions[disk][ipart]/2.,
636  fSupportYDimensions[disk][ipart]/2., fRohacellThickness);
637  partRohacell->SetLineColor(kGray);
638  TGeoTranslation *t = new TGeoTranslation ("t", 0, ty + fHalfDiskGap, fZPlan[disk]);
639  rohacellPlate -> AddNode(partRohacell, ipart, t);
640  ty += fSupportYDimensions[disk][ipart]/2.;
641  }
642 
643 // if (half == kTop) {
644 // rotation = new TGeoRotation ("rotation", 0., 0., 0.);
645 // transformation = new TGeoCombiTrans(0., 0., 0., rotation);
646 // fHalfDisk->AddNode(rohacellPlate, 1, transformation);
647 // }
648 // if (half == kBottom) {
649  rotation = new TGeoRotation ("rotation", 180., 0., 0.);
650  transformation = new TGeoCombiTrans(0., 0., 0., rotation);
651  fHalfDisk->AddNode(rohacellPlate, 2, transformation);
652 // }
653 
654 
655 
656 }
657 
658 //====================================================================================================================================================
659 
661 
662  Int_t disk = 2;
663 
664  if (half == kTop) printf("Creating MFT heat exchanger for disk2 top\n");
665  else if (half == kBottom) printf("Creating MFT heat exchanger for disk2 bottom\n");
666  else printf("No valid option for MFT heat exchanger on disk2\n");
667 
668 
669  //TGeoMedium *carbon = gGeoManager->GetMedium("MFT_Carbon$");
670  TGeoMedium *carbon = gGeoManager->GetMedium("MFT_CarbonFiber$");
671 
672 
673 
674  TGeoMedium *water = gGeoManager->GetMedium("MFT_Water$");
675  TGeoMedium *rohacell = gGeoManager->GetMedium("MFT_Rohacell");
676  TGeoMedium *pipe = gGeoManager->GetMedium("MFT_Polyimide");
677 
678 
679  TGeoVolumeAssembly *cooling = new TGeoVolumeAssembly(Form("cooling_D2_H%d",half));
680 
681  Float_t lMiddle = fSupportXDimensions[disk][0] - 2.*fLWater; // length of central part
682 
683  TGeoTranslation *translation = 0;
684  TGeoRotation *rotation = 0;
685  TGeoCombiTrans *transformation = 0;
686 
687  // **************************************** Water part ****************************************
688 
689  // ------------------- Tube shape -------------------
690 
691  TGeoVolume *waterTube1 = gGeoManager->MakeTube(Form("waterTube1_D2_H%d",half), water, 0., fRWater, fLWater/2.);
692  waterTube1->SetLineColor(kBlue);
693 
694  for (Int_t itube=0; itube<3; itube++) {
695  translation = new TGeoTranslation(fXPosition0[itube], 0., fLWater/2. + lMiddle/2.);
696  cooling->AddNode (waterTube1, itube, translation);
697  translation = new TGeoTranslation(fXPosition0[itube], 0., -fLWater/2. - lMiddle/2.);
698  cooling->AddNode (waterTube1, itube+3, translation);
699  }
700 
701  Double_t angle0rad = fangle0*(TMath::DegToRad());
702 
703  TGeoVolume *waterTube2 = gGeoManager->MakeTube(Form("waterTube2_D2_H%d",half), water, 0., fRWater, fLpartial0/2.);
704  waterTube2->SetLineColor(kBlue);
705 
706  for (Int_t itube=0; itube<3; itube++) {
707  rotation = new TGeoRotation ("rotation", -90., -fangle0, 0.);
708  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) +
709  (fLpartial0/2.)*(TMath::Sin(angle0rad)), 0., - lMiddle/2. +
710  fradius0*(TMath::Sin(angle0rad)) + (fLpartial0/2.)*TMath::Cos(angle0rad), rotation);
711  cooling->AddNode (waterTube2, itube, transformation);
712  rotation = new TGeoRotation ("rotation", -90., fangle0, 0.);
713  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) +
714  (fLpartial0/2.)*(TMath::Sin(angle0rad)), 0., lMiddle/2. -
715  fradius0*(TMath::Sin(angle0rad)) - (fLpartial0/2.)*TMath::Cos(angle0rad), rotation);
716  cooling->AddNode (waterTube2, itube+3, transformation);
717  }
718 
719  // ------------------- Torus shape -------------------
720 
721  // Sides torus
722 
723  TGeoVolume *waterTorus1 = gGeoManager->MakeTorus(Form("waterTorus1_D2_H%d",half), water, fradius0, 0., fRWater, 0., fangle0);
724  waterTorus1->SetLineColor(kBlue);
725  Double_t radius0mid = (lMiddle - 2.*(fradius0*(TMath::Sin(angle0rad)) + fLpartial0*(TMath::Cos(angle0rad))))/(2*(TMath::Sin(angle0rad)));
726 
727  for (Int_t itube=0; itube<3; itube++) {
728  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
729  transformation = new TGeoCombiTrans(fradius0 + fXPosition0[itube], 0., - lMiddle/2., rotation);
730  cooling->AddNode (waterTorus1, itube, transformation);
731  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
732  transformation = new TGeoCombiTrans(fradius0 + fXPosition0[itube], 0., lMiddle/2., rotation);
733  cooling->AddNode (waterTorus1, itube+3, transformation);
734  }
735 
736  // Central Torus
737 
738  TGeoVolume *waterTorus2 = gGeoManager->MakeTorus(Form("waterTorus2_D2_H%d",half), water, radius0mid, 0., fRWater, - fangle0 , 2.*fangle0);
739  waterTorus2->SetLineColor(kBlue);
740 
741  for(Int_t itube=0; itube<3; itube++) {
742  rotation = new TGeoRotation ("rotation", 0., 90., 0.);
743  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) +
744  fLpartial0*TMath::Sin(angle0rad) - radius0mid*TMath::Cos(angle0rad), 0., 0., rotation);
745  cooling->AddNode (waterTorus2, itube, transformation);
746  }
747 
748  // **************************************** Pipe part ****************************************
749 
750  // ------------------- Tube shape -------------------
751 
752  TGeoVolume *pipeTube1 = gGeoManager->MakeTube(Form("pipeTube1_D2_H%d",half), pipe, fRWater, fRWater + fDRPipe, fLWater/2.);
753  pipeTube1->SetLineColor(10);
754 
755  for (Int_t itube=0; itube<3; itube++){
756  translation = new TGeoTranslation(fXPosition0[itube], 0., fLWater/2. + lMiddle/2.);
757  cooling->AddNode (pipeTube1, itube, translation);
758  translation = new TGeoTranslation(fXPosition0[itube], 0., -fLWater/2. - lMiddle/2.);
759  cooling->AddNode (pipeTube1, itube+3, translation);
760  }
761 
762  TGeoVolume *pipeTube2 = gGeoManager->MakeTube(Form("pipeTube2_D2_H%d",half), pipe, fRWater, fRWater + fDRPipe, fLpartial0/2.);
763  waterTube2->SetLineColor(10);
764 
765  for(Int_t itube=0; itube<3; itube++) {
766  rotation = new TGeoRotation ("rotation", -90., -fangle0, 0.);
767  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) +
768  (fLpartial0/2.)*(TMath::Sin(angle0rad)), 0., - lMiddle/2. +
769  fradius0*(TMath::Sin(angle0rad)) + (fLpartial0/2.)*TMath::Cos(angle0rad), rotation);
770  cooling->AddNode (pipeTube2, itube, transformation);
771 
772  rotation = new TGeoRotation ("rotation", -90., fangle0, 0.);
773  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) +
774  (fLpartial0/2.)*(TMath::Sin(angle0rad)), 0., lMiddle/2. -
775  fradius0*(TMath::Sin(angle0rad)) - (fLpartial0/2.)*TMath::Cos(angle0rad), rotation);
776  cooling->AddNode (pipeTube2, itube+3, transformation);
777  }
778 
779  // ------------------- Torus shape -------------------
780 
781  // Sides Torus
782  TGeoVolume *pipeTorus1 = gGeoManager->MakeTorus(Form("pipeTorus1_D2_H%d",half), pipe, fradius0, fRWater, fRWater + fDRPipe, 0., fangle0);
783  pipeTorus1->SetLineColor(10);
784 
785  for (Int_t itube=0; itube<3; itube++) {
786  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
787  transformation = new TGeoCombiTrans(fradius0 + fXPosition0[itube], 0., - lMiddle/2., rotation);
788  cooling->AddNode (pipeTorus1, itube, transformation);
789  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
790  transformation = new TGeoCombiTrans(fradius0 + fXPosition0[itube], 0., lMiddle/2., rotation);
791  cooling->AddNode (pipeTorus1, itube+3, transformation);
792  }
793 
794  // Central Torus
795  TGeoVolume *pipeTorus2 = gGeoManager->MakeTorus(Form("pipeTorus2_D2_H%d",half), pipe, radius0mid, fRWater, fRWater + fDRPipe, - fangle0 , 2.*fangle0);
796  pipeTorus2->SetLineColor(10);
797 
798  for(Int_t itube=0; itube<3; itube++) {
799  rotation = new TGeoRotation ("rotation", 0., 90., 0.);
800  transformation = new TGeoCombiTrans(fXPosition0[itube] + fradius0*(1-(TMath::Cos(angle0rad))) +
801  fLpartial0*TMath::Sin(angle0rad) - radius0mid*TMath::Cos(angle0rad), 0., 0., rotation);
802  cooling->AddNode (pipeTorus2, itube, transformation);
803  }
804 
805  Double_t deltaz = fHeatExchangerThickness - fCarbonThickness*2; // distance between pair of carbon plates
806 
807 // if (half == kTop) {
808 // rotation = new TGeoRotation ("rotation", 90., 90., 0.);
809 // transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] + deltaz/2. - fCarbonThickness - fRWater - fDRPipe, rotation);
810 // fHalfDisk->AddNode(cooling, 1, transformation);
811 // transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] - deltaz/2. + fCarbonThickness + fRWater + fDRPipe, rotation);
812 // fHalfDisk->AddNode(cooling, 2, transformation);
813 // }
814 // else if (half == kBottom) {
815  rotation = new TGeoRotation ("rotation", -90., 90., 0.);
816  transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] + deltaz/2. - fCarbonThickness - fRWater - fDRPipe, rotation);
817  fHalfDisk->AddNode(cooling, 3, transformation);
818  transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] - deltaz/2. + fCarbonThickness + fRWater + fDRPipe, rotation);
819  fHalfDisk->AddNode(cooling, 4, transformation);
820 // }
821 
822  // **************************************** Carbon Plates ****************************************
823 
824  TGeoVolumeAssembly *carbonPlate = new TGeoVolumeAssembly(Form("carbonPlate_D2_H%d",half));
825 
826  TGeoBBox *carbonBase2 = new TGeoBBox (Form("carbonBase2_D2_H%d",half), (fSupportXDimensions[disk][0])/2., (fSupportYDimensions[disk][0])/2., fCarbonThickness);
827  TGeoTranslation *t21= new TGeoTranslation ("t21",0., (fSupportYDimensions[disk][0])/2. + fHalfDiskGap , 0.);
828  t21-> RegisterYourself();
829 
830  TGeoTubeSeg *holeCarbon2 = new TGeoTubeSeg(Form("holeCarbon2_D2_H%d",half), 0., fRMin[disk], fCarbonThickness + 0.000001, 0, 180.);
831  TGeoTranslation *t22= new TGeoTranslation ("t22",0., - fHalfDiskGap , 0.);
832  t22-> RegisterYourself();
833 
834 
836  TGeoSubtraction *carbonhole2 = new TGeoSubtraction(carbonBase2, holeCarbon2, t21, t22);
837  TGeoCompositeShape *cs2 = new TGeoCompositeShape(Form("Carbon2_D2_H%d",half), carbonhole2);
838  TGeoVolume *carbonBaseWithHole2 = new TGeoVolume(Form("carbonBaseWithHole_D2_H%d", half), cs2, carbon);
839 
840  carbonBaseWithHole2->SetLineColor(kGray+3);
841  rotation = new TGeoRotation ("rotation", 0., 0., 0.);
842  transformation = new TGeoCombiTrans(0., 0., 0., rotation);
843  carbonPlate->AddNode(carbonBaseWithHole2, 0, new TGeoTranslation(0., 0., fZPlan[disk]));
844 
845  Double_t ty = fSupportYDimensions[disk][0];
846 
847  for (Int_t ipart=1; ipart<fnPart[disk]; ipart ++) {
848  ty += fSupportYDimensions[disk][ipart]/2.;
849  TGeoVolume *partCarbon = gGeoManager->MakeBox(Form("partCarbon_D2_H%d_%d", half, ipart), carbon, fSupportXDimensions[disk][ipart]/2., fSupportYDimensions[disk][ipart]/2., fCarbonThickness);
850  partCarbon->SetLineColor(kGray+3);
851  TGeoTranslation *t = new TGeoTranslation ("t", 0, ty + fHalfDiskGap, fZPlan[disk]);
852  carbonPlate -> AddNode(partCarbon, ipart, t);
853  ty += fSupportYDimensions[disk][ipart]/2.;
854  }
855 
856 // if (half == kTop) {
857 // rotation = new TGeoRotation ("rotation", 0., 0., 0.);
858 // transformation = new TGeoCombiTrans(0., 0., deltaz/2., rotation);
859 // fHalfDisk->AddNode(carbonPlate, 1, transformation);
860 // transformation = new TGeoCombiTrans(0., 0., -deltaz/2., rotation);
861 // fHalfDisk->AddNode(carbonPlate, 2, transformation);
862 // }
863 // else if (half == kBottom) {
864  rotation = new TGeoRotation ("rotation", 180., 0., 0.);
865  transformation = new TGeoCombiTrans(0., 0., deltaz/2., rotation);
866  fHalfDisk->AddNode(carbonPlate, 3, transformation);
867  transformation = new TGeoCombiTrans(0., 0., -deltaz/2., rotation);
868  fHalfDisk->AddNode(carbonPlate, 4, transformation);
869 // }
870 
871 
872  // **************************************** Rohacell Plate ****************************************
873 
874  TGeoVolumeAssembly *rohacellPlate = new TGeoVolumeAssembly(Form("rohacellPlate_D2_H%d",half));
875 
876  TGeoBBox *rohacellBase2 = new TGeoBBox (Form("rohacellBase2_D2_H%d",half), (fSupportXDimensions[disk][0])/2., (fSupportYDimensions[disk][0])/2., fRohacellThickness);
877  // TGeoTranslation *t3 = new TGeoTranslation ("t3",0., (fSupportYDimensions[disk][0])/2. + fHalfDiskGap , 0.);
878  // t3 -> RegisterYourself();
879 
880  TGeoTubeSeg *holeRohacell2 = new TGeoTubeSeg(Form("holeRohacell2_D2_H%d",half), 0., fRMin[disk], fRohacellThickness + 0.000001, 0, 180.);
881  // TGeoTranslation *t4= new TGeoTranslation ("t4", 0., - fHalfDiskGap , 0.);
882  // t4-> RegisterYourself()
883  ;
884 
886  TGeoSubtraction *rohacellhole2 = new TGeoSubtraction(rohacellBase2, holeRohacell2, t21, t22);
887  TGeoCompositeShape *rh2 = new TGeoCompositeShape(Form("rohacellBase2_D2_H%d",half), rohacellhole2);
888  TGeoVolume *rohacellBaseWithHole = new TGeoVolume(Form("rohacellBaseWithHole_D2_H%d",half), rh2, rohacell);
889 
890 
891 
892  rohacellBaseWithHole->SetLineColor(kGray);
893  rotation = new TGeoRotation ("rotation", 0., 0., 0.);
894  transformation = new TGeoCombiTrans(0., 0., 0., rotation);
895  rohacellPlate -> AddNode(rohacellBaseWithHole, 0, new TGeoTranslation(0., 0., fZPlan[disk]));
896 
897  ty = fSupportYDimensions[disk][0];
898 
899  for (Int_t ipart=1; ipart<fnPart[disk]; ipart ++) {
900  ty += fSupportYDimensions[disk][ipart]/2.;
901  TGeoVolume *partRohacell = gGeoManager->MakeBox(Form("partRohacelli_D2_H%d_%d", half,ipart), rohacell, fSupportXDimensions[disk][ipart]/2., fSupportYDimensions[disk][ipart]/2., fRohacellThickness);
902  partRohacell->SetLineColor(kGray);
903  TGeoTranslation *t = new TGeoTranslation ("t", 0, ty + fHalfDiskGap, fZPlan[disk]);
904  rohacellPlate -> AddNode(partRohacell, ipart, t);
905  ty += fSupportYDimensions[disk][ipart]/2.;
906  }
907 
908 // if (half == kTop) {
909 // rotation = new TGeoRotation ("rotation", 0., 0., 0.);
910 // transformation = new TGeoCombiTrans(0., 0., 0., rotation);
911 // fHalfDisk->AddNode(rohacellPlate, 1, transformation);
912 // }
913 // if (half == kBottom) {
914  rotation = new TGeoRotation ("rotation", 180., 0., 0.);
915  transformation = new TGeoCombiTrans(0., 0., 0., rotation);
916  fHalfDisk->AddNode(rohacellPlate, 2, transformation);
917 // }
918 
919 }
920 
921 //====================================================================================================================================================
922 
924 
925  Int_t disk = 3;
926 
927  if (half == kTop) printf("Creating MFT heat exchanger for disk3 top\n");
928  else if (half == kBottom) printf("Creating MFT heat exchanger for disk3 bottom\n");
929  else printf("No valid option for MFT heat exchanger on disk3\n");
930 
931  //TGeoMedium *carbon = gGeoManager->GetMedium("MFT_Carbon$");
932  TGeoMedium *carbon = gGeoManager->GetMedium("MFT_CarbonFiber$");
933 
934 
935  TGeoMedium *water = gGeoManager->GetMedium("MFT_Water$");
936  TGeoMedium *rohacell = gGeoManager->GetMedium("MFT_Rohacell");
937  TGeoMedium *pipe = gGeoManager->GetMedium("MFT_Polyimide");
938 
939  TGeoVolumeAssembly *cooling = new TGeoVolumeAssembly(Form("cooling_D3_H%d",half));
940 
941  Double_t deltaz= fHeatExchangerThickness - fCarbonThickness*2; //distance between pair of carbon plans
942  Double_t lMiddle3[3] = {fSupportXDimensions[3][0] - 2.*fLWater3[0], fSupportXDimensions[3][0] - 2.*fLWater3[0], 0.};//distance between tube part
943 
944  TGeoTranslation *translation = 0;
945  TGeoRotation *rotation = 0;
946  TGeoCombiTrans *transformation = 0;
947 
948  Double_t beta3rad[3] = {0., 0., 0.};
949  for (Int_t i=0; i<3; i++) {
950  beta3rad[i] = fangle3[i]*(TMath::DegToRad());
951  }
952  Double_t fangleThirdPipe3rad= fangleThirdPipe3*(TMath::DegToRad());
953 
954  Double_t radius3mid[2] = {((lMiddle3[0]) - 2.*(fradius3[0]*(TMath::Sin(beta3rad[0])) +
955  fLpartial3[0]*(TMath::Cos(beta3rad[0]))))/ (2*(TMath::Sin(beta3rad[0]))), 0.};//radius of central torus
956  radius3mid[1] = (fSupportXDimensions[3][0]/2. - fLWater3[2]*TMath::Cos(fangleThirdPipe3rad) -
957  fradius3[2]*(TMath::Sin(beta3rad[2] + fangleThirdPipe3rad) - TMath::Sin(fangleThirdPipe3rad)))/(TMath::Sin(fangleThirdPipe3rad + beta3rad[2]));
958 
959  lMiddle3[2] = fSupportXDimensions[3][0] - 2.*fLWater3[2]*(TMath::Cos(fangleThirdPipe3rad));
960 
961 
962  // **************************************** Water part ****************************************
963 
964  // ------------------- First and second pipe -------------------
965 
966  for (Int_t itube= 0; itube < 2; itube ++){
967 
968 
969  // -------- Tube shape --------
970 
971  TGeoVolume *waterTube1 = gGeoManager->MakeTube(Form("waterTubeone%d_D3_H%d", itube,half), water, 0., fRWater, fLWater3[itube]/2.);
972  waterTube1->SetLineColor(kBlue);
973  translation = new TGeoTranslation (fXPosition3[itube], 0., fLWater3[itube]/2. + lMiddle3[itube]/2.);
974  cooling->AddNode (waterTube1, 1, translation);
975 
976  TGeoVolume *waterTube2 = gGeoManager->MakeTube(Form("waterTubetwo%d_D3_H%d", itube,half), water, 0., fRWater, fLWater3[itube]/2.);
977  waterTube2->SetLineColor(kBlue);
978  translation = new TGeoTranslation (fXPosition3[itube], 0., -fLWater3[itube]/2. - lMiddle3[itube]/2.);
979  cooling->AddNode (waterTube2, 2, translation);
980 
981  TGeoVolume *waterTube3 = gGeoManager->MakeTube(Form("waterTubethree%d_D3_H%d", itube,half), water, 0., fRWater, fLpartial3[itube]/2.);
982  waterTube3->SetLineColor(kBlue);
983  rotation = new TGeoRotation ("rotation", -90., 0 - fangle3[itube], 0.);
984 
985  transformation = new TGeoCombiTrans(fXPosition3[itube] + fradius3[itube]*(1-(TMath::Cos(beta3rad[0]))) +
986  (fLpartial3[itube]/2.)*(TMath::Sin(beta3rad[0])), 0., (fradius3[itube])*(TMath::Sin(beta3rad[0])) +
987  (fLpartial3[itube]/2.)*(TMath::Cos(beta3rad[0])) - lMiddle3[itube]/2., rotation);
988  cooling->AddNode (waterTube3, 3, transformation);
989 
990  rotation = new TGeoRotation ("rotation", 90., 180 - fangle3[itube], 0.);
991  transformation = new TGeoCombiTrans( fXPosition3[itube] + fradius3[itube]*(1-(TMath::Cos(beta3rad[0]))) +
992  (fLpartial3[itube]/2.)*(TMath::Sin(beta3rad[0])), 0., lMiddle3[itube]/2. - (fradius3[itube])*(TMath::Sin(beta3rad[0])) -
993  (fLpartial3[itube]/2.)*(TMath::Cos(beta3rad[0])), rotation);
994  cooling->AddNode (waterTube3, 4, transformation);
995 
996  // -------- Torus shape --------
997 
998  //Sides torus
999  TGeoVolume *waterTorus1 = gGeoManager->MakeTorus(Form("waterTorusone%d_D3_H%d", itube,half), water, fradius3[itube], 0., fRWater, 0., fangle3[itube]);
1000  waterTorus1->SetLineColor(kBlue);
1001  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
1002  transformation = new TGeoCombiTrans(fradius3[itube] + fXPosition3[itube], 0., - lMiddle3[itube]/2., rotation);
1003  cooling->AddNode (waterTorus1, 4, transformation);
1004  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
1005  transformation = new TGeoCombiTrans(fradius3[itube] + fXPosition3[itube], 0., lMiddle3[itube]/2., rotation);
1006  cooling->AddNode (waterTorus1, 5, transformation);
1007 
1008  //Central torus
1009  TGeoVolume *waterTorus2 = gGeoManager->MakeTorus(Form("waterTorustwo%d_D3_H%d", itube,half), water, radius3mid[0], 0., fRWater, -fangle3[itube], 2.*fangle3[itube]);
1010  waterTorus2->SetLineColor(kBlue);
1011  rotation = new TGeoRotation ("rotation", 0., 90., 0.);
1012  transformation = new TGeoCombiTrans(fXPosition3[itube] + fradius3[0]*(1-(TMath::Cos(beta3rad[0])))+fLpartial3[0]*TMath::Sin(beta3rad[0]) -
1013  radius3mid[0]*TMath::Cos(beta3rad[0]) , 0., 0., rotation);
1014  cooling->AddNode (waterTorus2, 6, transformation);
1015  }
1016 
1017  // ------------------- Third pipe -------------------
1018 
1019  // -------- Tube shape --------
1020 
1021  TGeoVolume *waterTube1 = gGeoManager->MakeTube(Form("waterTubeone2_D3_H%d",half), water, 0., fRWater, fLWater3[2]/2.);
1022  waterTube1->SetLineColor(kBlue);
1023  rotation = new TGeoRotation ("rotation", 90., -fangleThirdPipe3, 90.);
1024  transformation = new TGeoCombiTrans (fXPosition3[2] + fLWater3[2]*TMath::Sin(fangleThirdPipe3rad)/2., 0.,
1025  fSupportXDimensions[3][0]/2. - fLWater3[2]*(TMath::Cos(fangleThirdPipe3rad))/2., rotation);
1026  cooling->AddNode (waterTube1, 3, transformation);
1027 
1028  rotation = new TGeoRotation ("rotation", 90., fangleThirdPipe3, 90.);
1029  transformation = new TGeoCombiTrans (fXPosition3[2] + fLWater3[2]*TMath::Sin(fangleThirdPipe3rad)/2., 0.,
1030  -fSupportXDimensions[3][0]/2. + fLWater3[2]*(TMath::Cos(fangleThirdPipe3rad))/2., rotation);
1031  cooling->AddNode (waterTube1, 4, transformation);
1032 
1033  // -------- Torus shape --------
1034 
1035  TGeoVolume *waterTorus1 = gGeoManager->MakeTorus(Form("waterTorusone2_D3_H%d",half), water, fradius3[2], 0., fRWater, fangleThirdPipe3, fangle3[2]);
1036  waterTorus1->SetLineColor(kBlue);
1037  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
1038  transformation = new TGeoCombiTrans(fXPosition3[2] + fLWater3[2]*TMath::Sin(fangleThirdPipe3rad) +
1039  fradius3[2]*(TMath::Cos(fangleThirdPipe3rad)), 0., -lMiddle3[2]/2. - fradius3[2]*(TMath::Sin(fangleThirdPipe3rad)) , rotation);
1040  cooling->AddNode (waterTorus1, 4, transformation);
1041 
1042  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
1043  transformation = new TGeoCombiTrans( fXPosition3[2] + fLWater3[2]*TMath::Sin(fangleThirdPipe3rad) +
1044  fradius3[2]*(TMath::Cos(fangleThirdPipe3rad)), 0., lMiddle3[2]/2. + fradius3[2]*(TMath::Sin(fangleThirdPipe3rad)), rotation);
1045  cooling->AddNode (waterTorus1, 5, transformation);
1046 
1047  TGeoVolume *waterTorus2 = gGeoManager->MakeTorus(Form("waterTorustwo2_D3_H%d",half), water, radius3mid[1], 0., fRWater, -(fangle3[2] + fangleThirdPipe3),
1048  2.*(fangle3[2] + fangleThirdPipe3));
1049  waterTorus2->SetLineColor(kBlue);
1050  rotation = new TGeoRotation ("rotation", 0., 90., 0.);
1051  transformation = new TGeoCombiTrans( fXPosition3[2] + fLWater3[2]*TMath::Sin(fangleThirdPipe3rad) + fradius3[2]*(TMath::Cos(fangleThirdPipe3rad)) -
1052  (fradius3[2] + radius3mid[1])*(TMath::Cos(beta3rad[2] + fangleThirdPipe3rad)), 0., 0., rotation);
1053  cooling->AddNode (waterTorus2, 6, transformation);
1054 
1055  // ------------------- Fourth pipe -------------------
1056 
1057  Double_t radius3fourth[4] = {9.6, 2.9, 2.9, 0.};
1058  Double_t alpha3fourth[4] = { 40.8, 50, 60, 0}; //size angle
1059  alpha3fourth[3] = 8 + alpha3fourth[0] - alpha3fourth[1] + alpha3fourth[2];
1060  Double_t alpha3fourthrad[4] = {};
1061  for(Int_t i=0; i<4; i++){
1062  alpha3fourthrad[i] = (TMath::Pi())*(alpha3fourth[i])/180.;
1063  }
1064  Double_t beta3fourth[3] = {8, 8 + alpha3fourth[0], -(-8 - alpha3fourth[0] + alpha3fourth[1])}; //shift angle
1065  Double_t beta3fourthrad[3] = {0., 0., 0.};
1066  for(Int_t i=0; i<3; i++){
1067  beta3fourthrad[i] = (TMath::Pi())*(beta3fourth[i])/180.;
1068  }
1069 
1070  radius3fourth[3] = ((-(-(fLWater3[0] + lMiddle3[0]/2.) -
1071  radius3fourth[0]*(TMath::Sin(beta3fourthrad[0])) +
1072  radius3fourth[0]*(TMath::Sin(beta3fourthrad[0] + alpha3fourthrad[0])) +
1073  radius3fourth[1]*(TMath::Cos(TMath::Pi()/2 - beta3fourthrad[0] - alpha3fourthrad[0])) +
1074  radius3fourth[1]*(TMath::Cos(TMath::Pi()/2. - alpha3fourthrad[1] + alpha3fourthrad[0] + beta3fourthrad[0])) +
1075  radius3fourth[2]*(TMath::Sin(alpha3fourthrad[1] - alpha3fourthrad[0] - beta3fourthrad[0])))) -
1076  radius3fourth[2]*TMath::Cos(TMath::Pi()/2 - alpha3fourthrad[3]))/(TMath::Sin(alpha3fourthrad[3]));
1077 
1078  Double_t translation3x[4] = { fXPosition3[3] + radius3fourth[0]*(TMath::Cos(beta3fourthrad[0])),
1079  fXPosition3[3] + radius3fourth[0]*((TMath::Cos(beta3fourthrad[0])) - TMath::Cos(beta3fourthrad[0] + alpha3fourthrad[0])) -
1080  radius3fourth[1]*(TMath::Cos(beta3fourthrad[0] + alpha3fourthrad[0])),
1081  fXPosition3[3] + radius3fourth[0]*((TMath::Cos(beta3fourthrad[0])) - TMath::Cos(beta3fourthrad[0] + alpha3fourthrad[0])) -
1082  radius3fourth[1]*(TMath::Cos(beta3fourthrad[0] + alpha3fourthrad[0])) +
1083  radius3fourth[1]*(TMath::Sin(TMath::Pi()/2. - alpha3fourthrad[1] + alpha3fourthrad[0] + beta3fourthrad[0])) +
1084  radius3fourth[2]*(TMath::Cos(alpha3fourthrad[1] - alpha3fourthrad[0] - beta3fourthrad[0])),
1085  fXPosition3[3] + radius3fourth[0]*((TMath::Cos(beta3fourthrad[0])) - TMath::Cos(beta3fourthrad[0] + alpha3fourthrad[0])) -
1086  radius3fourth[1]*(TMath::Cos(beta3fourthrad[0] + alpha3fourthrad[0])) +
1087  radius3fourth[1]*(TMath::Sin(TMath::Pi()/2. - alpha3fourthrad[1] + alpha3fourthrad[0] + beta3fourthrad[0])) +
1088  radius3fourth[2]*(TMath::Cos(alpha3fourthrad[1] - alpha3fourthrad[0] - beta3fourthrad[0])) -
1089  radius3fourth[2]*(TMath::Sin((TMath::Pi()/2.) - alpha3fourthrad[3])) - radius3fourth[3]*(TMath::Cos(alpha3fourthrad[3]))};
1090 
1091  Double_t translation3y[3] = {0., 0., 0.};
1092 
1093  Double_t translation3z[3] = {-(fLWater3[0] + lMiddle3[0]/2.) - radius3fourth[0]*(TMath::Sin(beta3fourthrad[0])),
1094  -(fLWater3[0] + lMiddle3[0]/2.) - radius3fourth[0]*(TMath::Sin(beta3fourthrad[0])) +
1095  radius3fourth[0]*(TMath::Sin(beta3fourthrad[0] + alpha3fourthrad[0])) + radius3fourth[1]*(TMath::Sin(beta3fourthrad[0] + alpha3fourthrad[0])),
1096  -(fLWater3[0] + lMiddle3[0]/2.) - radius3fourth[0]*(TMath::Sin(beta3fourthrad[0])) +
1097  radius3fourth[0]*(TMath::Sin(beta3fourthrad[0] + alpha3fourthrad[0])) +
1098  radius3fourth[1]*(TMath::Cos(TMath::Pi()/2 - beta3fourthrad[0] - alpha3fourthrad[0])) +
1099  radius3fourth[1]*(TMath::Cos(TMath::Pi()/2. - alpha3fourthrad[1] + alpha3fourthrad[0] +
1100  beta3fourthrad[0])) + radius3fourth[2]*(TMath::Sin(alpha3fourthrad[1] - alpha3fourthrad[0] - beta3fourthrad[0]))};
1101 
1102  Double_t rotation3x[3] = {180., 180., 180.};
1103  Double_t rotation3y[3] = {90., 90., 90.};
1104  Double_t rotation3z[3] = {0., 180 - alpha3fourth[1] , 0.};
1105 
1106  for (Int_t i= 0; i<3; i++) {
1107  waterTorus1 = gGeoManager->MakeTorus(Form("waterTorusone%d_D3_H%d", i,half), water, radius3fourth[i], 0., fRWater, beta3fourth[i], alpha3fourth[i]);
1108  waterTorus1->SetLineColor(kBlue);
1109  rotation = new TGeoRotation ("rotation", rotation3x[i], rotation3y[i], rotation3z[i]);
1110  transformation = new TGeoCombiTrans(translation3x[i], translation3y[i], translation3z[i], rotation);
1111  cooling->AddNode (waterTorus1, 7, transformation);
1112  rotation = new TGeoRotation ("rotation", rotation3x[i] , rotation3y[i] - 180, rotation3z[i]);
1113  transformation = new TGeoCombiTrans(translation3x[i], translation3y[i], - translation3z[i], rotation);
1114  cooling->AddNode (waterTorus1, 8, transformation);
1115  }
1116 
1117  waterTorus2 = gGeoManager->MakeTorus(Form("waterTorusone3_D3_H%d",half), water, radius3fourth[3], 0., fRWater, -alpha3fourth[3], 2*alpha3fourth[3]);
1118  waterTorus2->SetLineColor(kBlue);
1119  rotation = new TGeoRotation ("rotation", 180., 90., 180);
1120  transformation = new TGeoCombiTrans(translation3x[3], 0., 0., rotation);
1121  cooling->AddNode(waterTorus2, 9, transformation);
1122 
1123  // **************************************** Pipe part ****************************************
1124 
1125  // ------------------- First and second pipe -------------------
1126 
1127  for (Int_t itube= 0; itube < 2; itube ++){
1128 
1129  // -------- Tube shape --------
1130 
1131  TGeoVolume *pipeTube1 = gGeoManager->MakeTube(Form("pipeTubeone%d_D3_H%d", itube,half), pipe, fRWater, fRWater + fDRPipe, fLWater3[itube]/2.);
1132  pipeTube1->SetLineColor(10);
1133  translation = new TGeoTranslation (fXPosition3[itube], 0., fLWater3[itube]/2. + lMiddle3[itube]/2.);
1134  cooling->AddNode (pipeTube1, 1, translation);
1135 
1136  TGeoVolume *pipeTube2 = gGeoManager->MakeTube(Form("pipeTubetwo%d_D3_H%d", itube,half), pipe, fRWater, fRWater + fDRPipe, fLWater3[itube]/2.);
1137  pipeTube2->SetLineColor(10);
1138  translation = new TGeoTranslation (fXPosition3[itube], 0., -fLWater3[itube]/2. - lMiddle3[itube]/2.);
1139  cooling->AddNode (pipeTube2, 2, translation);
1140 
1141  TGeoVolume *pipeTube3 = gGeoManager->MakeTube(Form("pipeTubethree%d_D3_H%d", itube,half), pipe, fRWater, fRWater + fDRPipe, fLpartial3[itube]/2.);
1142  pipeTube3->SetLineColor(10);
1143  rotation = new TGeoRotation ("rotation", -90., 0 - fangle3[itube], 0.);
1144 
1145  transformation = new TGeoCombiTrans(fXPosition3[itube] + fradius3[itube]*(1-(TMath::Cos(beta3rad[0]))) +
1146  (fLpartial3[itube]/2.)*(TMath::Sin(beta3rad[0])), 0., (fradius3[itube])*(TMath::Sin(beta3rad[0])) +
1147  (fLpartial3[itube]/2.)*(TMath::Cos(beta3rad[0])) - lMiddle3[itube]/2., rotation);
1148  cooling->AddNode (pipeTube3, 3, transformation);
1149 
1150  rotation = new TGeoRotation ("rotation", 90., 180 - fangle3[itube], 0.);
1151  transformation = new TGeoCombiTrans( fXPosition3[itube] + fradius3[itube]*(1-(TMath::Cos(beta3rad[0]))) +
1152  (fLpartial3[itube]/2.)*(TMath::Sin(beta3rad[0])), 0., lMiddle3[itube]/2. -
1153  (fradius3[itube])*(TMath::Sin(beta3rad[0])) - (fLpartial3[itube]/2.)*(TMath::Cos(beta3rad[0])), rotation);
1154  cooling->AddNode (pipeTube3, 4, transformation);
1155 
1156  // -------- Torus shape --------
1157 
1158  //Sides torus
1159  TGeoVolume *pipeTorus1 = gGeoManager->MakeTorus(Form("pipeTorusone%d_D3_H%d", itube,half), pipe, fradius3[itube], fRWater, fRWater + fDRPipe, 0., fangle3[itube]);
1160  pipeTorus1->SetLineColor(10);
1161  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
1162  transformation = new TGeoCombiTrans(fradius3[itube] + fXPosition3[itube], 0., - lMiddle3[itube]/2., rotation);
1163  cooling->AddNode (pipeTorus1, 4, transformation);
1164  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
1165  transformation = new TGeoCombiTrans(fradius3[itube] + fXPosition3[itube], 0., lMiddle3[itube]/2., rotation);
1166  cooling->AddNode (pipeTorus1, 5, transformation);
1167 
1168 
1169  //Central torus
1170  TGeoVolume *pipeTorus2 = gGeoManager->MakeTorus(Form("pipeTorustwo%d_D3_H%d", itube,half), pipe, radius3mid[0], fRWater, fRWater + fDRPipe, -fangle3[itube], 2.*fangle3[itube]);
1171  pipeTorus2->SetLineColor(10);
1172  rotation = new TGeoRotation ("rotation", 0., 90., 0.);
1173  transformation = new TGeoCombiTrans(fXPosition3[itube] + fradius3[0]*(1-(TMath::Cos(beta3rad[0])))+fLpartial3[0]*TMath::Sin(beta3rad[0]) - radius3mid[0]*TMath::Cos(beta3rad[0]) , 0., 0., rotation);
1174  cooling->AddNode (pipeTorus2, 6, transformation);
1175  }
1176 
1177  // ------------------- Third pipe -------------------
1178 
1179  // -------- Tube shape --------
1180 
1181  TGeoVolume *pipeTube1 = gGeoManager->MakeTube(Form("pipeTubeone2_D3_H%d",half), pipe, fRWater, fRWater + fDRPipe, fLWater3[2]/2.);
1182  pipeTube1->SetLineColor(10);
1183  rotation = new TGeoRotation ("rotation", 90., -fangleThirdPipe3, 90.);
1184  transformation = new TGeoCombiTrans (fXPosition3[2] + fLWater3[2]*TMath::Sin(fangleThirdPipe3rad)/2., 0.,
1185  fSupportXDimensions[3][0]/2. - fLWater3[2]*(TMath::Cos(fangleThirdPipe3rad))/2., rotation);
1186  cooling->AddNode (pipeTube1, 3, transformation);
1187 
1188  rotation = new TGeoRotation ("rotation", 90., fangleThirdPipe3, 90.);
1189  transformation = new TGeoCombiTrans (fXPosition3[2] + fLWater3[2]*TMath::Sin(fangleThirdPipe3rad)/2., 0.,
1190  -fSupportXDimensions[3][0]/2. + fLWater3[2]*(TMath::Cos(fangleThirdPipe3rad))/2., rotation);
1191  cooling->AddNode (pipeTube1, 4, transformation);
1192 
1193  // -------- Torus shape --------
1194 
1195  TGeoVolume *pipeTorus1 = gGeoManager->MakeTorus(Form("pipeTorusone2_D3_H%d",half), pipe, fradius3[2], fRWater, fRWater + fDRPipe, fangleThirdPipe3, fangle3[2]);
1196  pipeTorus1->SetLineColor(10);
1197  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
1198  transformation = new TGeoCombiTrans(fXPosition3[2] + fLWater3[2]*TMath::Sin(fangleThirdPipe3rad) +
1199  fradius3[2]*(TMath::Cos(fangleThirdPipe3rad)), 0., -lMiddle3[2]/2. - fradius3[2]*(TMath::Sin(fangleThirdPipe3rad)), rotation);
1200  cooling->AddNode (pipeTorus1, 4, transformation);
1201  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
1202  transformation = new TGeoCombiTrans( fXPosition3[2] + fLWater3[2]*TMath::Sin(fangleThirdPipe3rad) +
1203  fradius3[2]*(TMath::Cos(fangleThirdPipe3rad)), 0., lMiddle3[2]/2. + fradius3[2]*(TMath::Sin(fangleThirdPipe3rad)), rotation);
1204  cooling->AddNode (pipeTorus1, 5, transformation);
1205 
1206  TGeoVolume *pipeTorus2 = gGeoManager->MakeTorus(Form("pipeTorustwo2_D3_H%d",half), pipe, radius3mid[1], fRWater, fRWater + fDRPipe,
1207  -(fangle3[2] + fangleThirdPipe3), 2.*(fangle3[2] + fangleThirdPipe3));
1208  pipeTorus2->SetLineColor(10);
1209  rotation = new TGeoRotation ("rotation", 0., 90., 0.);
1210  transformation = new TGeoCombiTrans( fXPosition3[2] + fLWater3[2]*TMath::Sin(fangleThirdPipe3rad) +
1211  fradius3[2]*(TMath::Cos(fangleThirdPipe3rad)) -
1212  (fradius3[2] + radius3mid[1])*(TMath::Cos(beta3rad[2] + fangleThirdPipe3rad)), 0., 0., rotation);
1213  cooling->AddNode (pipeTorus2, 6, transformation);
1214 
1215  // ------------------- Fourth pipe -------------------
1216 
1217  for(Int_t i= 0; i<3; i++){
1218  pipeTorus1 = gGeoManager->MakeTorus(Form("pipeTorusone%d_D3_H%d", i,half), pipe, radius3fourth[i], fRWater, fRWater + fDRPipe, beta3fourth[i], alpha3fourth[i]);
1219  pipeTorus1->SetLineColor(10);
1220  rotation = new TGeoRotation ("rotation", rotation3x[i], rotation3y[i], rotation3z[i]);
1221  transformation = new TGeoCombiTrans(translation3x[i], translation3y[i], translation3z[i], rotation);
1222  cooling->AddNode (pipeTorus1, 7, transformation);
1223  rotation = new TGeoRotation ("rotation", rotation3x[i] , rotation3y[i] - 180, rotation3z[i]);
1224  transformation = new TGeoCombiTrans(translation3x[i], translation3y[i], - translation3z[i], rotation);
1225  cooling->AddNode (pipeTorus1, 8, transformation);
1226  }
1227 
1228  pipeTorus2 = gGeoManager->MakeTorus(Form("pipeTorusone3_D3_H%d",half), pipe, radius3fourth[3], fRWater, fRWater + fDRPipe, -alpha3fourth[3], 2*alpha3fourth[3]);
1229  pipeTorus2->SetLineColor(10);
1230  rotation = new TGeoRotation ("rotation", 180., 90., 180);
1231  transformation = new TGeoCombiTrans(translation3x[3], 0., 0., rotation);
1232  cooling->AddNode(pipeTorus2, 9, transformation);
1233 
1234 // if (half == kTop) {
1235 // rotation = new TGeoRotation ("rotation", 90., 90., 0.);
1236 // transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] + deltaz/2. - fCarbonThickness - fRWater - fDRPipe, rotation);
1237 // fHalfDisk->AddNode(cooling, 1, transformation);
1238 // transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] - deltaz/2. + fCarbonThickness + fRWater + fDRPipe, rotation);
1239 // fHalfDisk->AddNode(cooling, 2, transformation);
1240 // }
1241 // else if (half == kBottom) {
1242  rotation = new TGeoRotation ("rotation", -90., 90., 0.);
1243  transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] + deltaz/2. - fCarbonThickness - fRWater - fDRPipe, rotation);
1244  fHalfDisk->AddNode(cooling, 3, transformation);
1245  transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] - deltaz/2. + fCarbonThickness + fRWater + fDRPipe, rotation);
1246  fHalfDisk->AddNode(cooling, 4, transformation);
1247 // }
1248 
1249  // **************************************** Carbon Plates ****************************************
1250 
1251  TGeoVolumeAssembly *carbonPlate = new TGeoVolumeAssembly(Form("carbonPlate_D3_H%d",half));
1252 
1253  TGeoBBox *carbonBase3 = new TGeoBBox (Form("carbonBase3_D3_H%d",half), (fSupportXDimensions[disk][0])/2., (fSupportYDimensions[disk][0])/2., fCarbonThickness);
1254  TGeoTranslation *t31= new TGeoTranslation ("t31",0., (fSupportYDimensions[disk][0])/2.+ fHalfDiskGap , 0.);
1255  t31-> RegisterYourself();
1256 
1257  TGeoTubeSeg *holeCarbon3 = new TGeoTubeSeg(Form("holeCarbon3_D3_H%d",half), 0., fRMin[disk], fCarbonThickness + 0.000001, 0, 180.);
1258  TGeoTranslation *t32= new TGeoTranslation ("t32",0., - fHalfDiskGap , 0.);
1259  t32-> RegisterYourself();
1260 
1261 
1263  TGeoSubtraction *carbonhole3 = new TGeoSubtraction(carbonBase3, holeCarbon3, t31, t32);
1264  TGeoCompositeShape *cs3 = new TGeoCompositeShape(Form("Carbon3_D3_H%d",half), carbonhole3);
1265  TGeoVolume *carbonBaseWithHole3 = new TGeoVolume(Form("carbonBaseWithHole_D3_H%d",half), cs3, carbon);
1266 
1267 
1268  carbonBaseWithHole3->SetLineColor(kGray+3);
1269  rotation = new TGeoRotation ("rotation", 0., 0., 0.);
1270  transformation = new TGeoCombiTrans(0., 0., 0., rotation);
1271  carbonPlate->AddNode(carbonBaseWithHole3, 0, new TGeoTranslation(0., 0., fZPlan[disk]));
1272 
1273  Double_t ty = fSupportYDimensions[disk][0];
1274 
1275  for (Int_t ipart=1; ipart<fnPart[disk]; ipart ++) {
1276  ty += fSupportYDimensions[disk][ipart]/2.;
1277  TGeoVolume *partCarbon = gGeoManager->MakeBox(Form("partCarbon_D3_H%d_%d", half,ipart), carbon, fSupportXDimensions[disk][ipart]/2.,
1278  fSupportYDimensions[disk][ipart]/2., fCarbonThickness);
1279  partCarbon->SetLineColor(kGray+3);
1280  TGeoTranslation *t = new TGeoTranslation ("t", 0, ty + fHalfDiskGap, fZPlan[disk]);
1281  carbonPlate -> AddNode(partCarbon, ipart, t);
1282  ty += fSupportYDimensions[disk][ipart]/2.;
1283  }
1284 
1285 // if (half == kTop) {
1286 // rotation = new TGeoRotation ("rotation", 0., 0., 0.);
1287 // transformation = new TGeoCombiTrans(0., 0., deltaz/2., rotation);
1288 // fHalfDisk->AddNode(carbonPlate, 1, transformation);
1289 // transformation = new TGeoCombiTrans(0., 0., -deltaz/2., rotation);
1290 // fHalfDisk->AddNode(carbonPlate, 2, transformation);
1291 // }
1292 // else if (half == kBottom) {
1293  rotation = new TGeoRotation ("rotation", 180., 0., 0.);
1294  transformation = new TGeoCombiTrans(0., 0., deltaz/2., rotation);
1295  fHalfDisk->AddNode(carbonPlate, 3, transformation);
1296  transformation = new TGeoCombiTrans(0., 0., -deltaz/2., rotation);
1297  fHalfDisk->AddNode(carbonPlate, 4, transformation);
1298 // }
1299 
1300 
1301  // **************************************** Rohacell Plate ****************************************
1302 
1303  TGeoVolumeAssembly *rohacellPlate = new TGeoVolumeAssembly(Form("rohacellPlate_D3_H%d",half));
1304 
1305  TGeoBBox *rohacellBase3 = new TGeoBBox (Form("rohacellBase3_D3_H%d",half), (fSupportXDimensions[disk][0])/2., (fSupportYDimensions[disk][0])/2., fRohacellThickness);
1306  // TGeoTranslation *t3 = new TGeoTranslation ("t3",0., (fSupportYDimensions[disk][0])/2. + fHalfDiskGap , 0.);
1307  // t3 -> RegisterYourself();
1308 
1309  TGeoTubeSeg *holeRohacell3 = new TGeoTubeSeg(Form("holeRohacell3_D3_H%d",half), 0., fRMin[disk], fRohacellThickness + 0.000001, 0, 180.);
1310  // TGeoTranslation *t4= new TGeoTranslation ("t4", 0., - fHalfDiskGap , 0.);
1311  // t4-> RegisterYourself();
1312 
1314  TGeoSubtraction *rohacellhole3 = new TGeoSubtraction(rohacellBase3, holeRohacell3, t31, t32);
1315  TGeoCompositeShape *rh3 = new TGeoCompositeShape(Form("rohacellBase3_D3_H%d",half), rohacellhole3);
1316  TGeoVolume *rohacellBaseWithHole = new TGeoVolume(Form("rohacellBaseWithHole_D3_H%d",half), rh3, rohacell);
1317 
1318 
1319  rohacellBaseWithHole->SetLineColor(kGray);
1320  rotation = new TGeoRotation ("rotation", 0., 0., 0.);
1321  transformation = new TGeoCombiTrans(0., 0., 0., rotation);
1322  rohacellPlate -> AddNode(rohacellBaseWithHole, 0, new TGeoTranslation(0., 0., fZPlan[disk]));
1323 
1324  ty = fSupportYDimensions[disk][0];
1325 
1326  for (Int_t ipart=1; ipart<fnPart[disk]; ipart ++) {
1327  ty += fSupportYDimensions[disk][ipart]/2.;
1328  TGeoVolume *partRohacell = gGeoManager->MakeBox(Form("partRohacelli_D3_H%d_%d", half, ipart), rohacell, fSupportXDimensions[disk][ipart]/2.,
1329  fSupportYDimensions[disk][ipart]/2., fRohacellThickness);
1330  partRohacell->SetLineColor(kGray);
1331  TGeoTranslation *t = new TGeoTranslation ("t", 0, ty + fHalfDiskGap, fZPlan[disk]);
1332  rohacellPlate -> AddNode(partRohacell, ipart, t);
1333  ty += fSupportYDimensions[disk][ipart]/2.;
1334  }
1335 
1336 // if (half == kTop) {
1337 // rotation = new TGeoRotation ("rotation", 0., 0., 0.);
1338 // transformation = new TGeoCombiTrans(0., 0., 0., rotation);
1339 // fHalfDisk->AddNode(rohacellPlate, 1, transformation);
1340 // }
1341 // if (half == kBottom) {
1342  rotation = new TGeoRotation ("rotation", 180., 0., 0.);
1343  transformation = new TGeoCombiTrans(0., 0., 0., rotation);
1344  fHalfDisk->AddNode(rohacellPlate, 2, transformation);
1345 // }
1346 
1347 
1348 }
1349 
1350 //====================================================================================================================================================
1351 
1353 
1354  Int_t disk = 4;
1355 
1356  if (half == kTop) printf("Creating MFT heat exchanger for disk4 top\n");
1357  else if (half == kBottom) printf("Creating MFT heat exchanger for disk4 bottom\n");
1358  else printf("No valid option for MFT heat exchanger on disk4\n");
1359 
1360 
1361  //TGeoMedium *carbon = gGeoManager->GetMedium("MFT_Carbon$");
1362  TGeoMedium *carbon = gGeoManager->GetMedium("MFT_CarbonFiber$");
1363 
1364 
1365  TGeoMedium *water = gGeoManager->GetMedium("MFT_Water$");
1366  TGeoMedium *rohacell = gGeoManager->GetMedium("MFT_Rohacell");
1367  TGeoMedium *pipe = gGeoManager->GetMedium("MFT_Polyimide");
1368 
1369 
1370  TGeoVolumeAssembly *cooling = new TGeoVolumeAssembly(Form("cooling_D4_H%d",half));
1371  Double_t deltaz= fHeatExchangerThickness - fCarbonThickness*2; //distance between pair of carbon plans
1372 
1373  TGeoTranslation *translation = 0;
1374  TGeoRotation *rotation = 0;
1375  TGeoCombiTrans *transformation = 0;
1376 
1377  Double_t lMiddle4[3] = {fSupportXDimensions[4][0] - 2*fLwater4[0], fSupportXDimensions[4][0] - 2*fLwater4[1], fSupportXDimensions[4][0] - 2*fLwater4[2]}; //distance between tube part
1378  fangle4[5] = (fangle4[3] - fangle4[4]);
1379  Double_t anglerad[6]= {0.}; //angle of the sides torus
1380  for(Int_t i=0; i<6; i++){
1381  anglerad[i] = fangle4[i]*(TMath::DegToRad());
1382  }
1383  Double_t fradius4mid[3] = { (lMiddle4[0]-2.*(fradius4[0]*(TMath::Sin(anglerad[0])) + fLpartial4[0]*(TMath::Cos(anglerad[0]))))/(2*(TMath::Sin(anglerad[0]))) ,
1384  (lMiddle4[1]-2.*(fradius4[1]*(TMath::Sin(anglerad[1])) + fLpartial4[1]*(TMath::Cos(anglerad[1]))))/(2*(TMath::Sin(anglerad[1]))), 0. }; // radius of the central torus
1385  fradius4mid[2] = (fSupportXDimensions[4][0]/2. - fradius4[3]*TMath::Sin(anglerad[3]) - fradius4[4]*(TMath::Sin(anglerad[3]) -
1386  TMath::Sin(anglerad[5])))/(TMath::Sin(anglerad[5]));
1387 
1388  // **************************************** Water part ****************************************
1389 
1390  // ------------------- First and second pipe -------------------
1391 
1392  for (Int_t i=0; i<2; i++){
1393 
1394  // -------- Tube shape --------
1395 
1396  TGeoVolume *waterTube1 = gGeoManager->MakeTube(Form("waterTubeone%d_D4_H%d", i,half), water, 0., fRWater, fLwater4[i]/2.);
1397  waterTube1->SetLineColor(kBlue);
1398  translation = new TGeoTranslation (fXposition4[i], 0., fLwater4[i]/2. + lMiddle4[i]/2.);
1399  cooling->AddNode (waterTube1, 1, translation);
1400  translation = new TGeoTranslation (fXposition4[i], 0., -fLwater4[i]/2. - lMiddle4[i]/2.);
1401  cooling->AddNode (waterTube1, 2, translation);
1402 
1403  TGeoVolume *waterTube2 = gGeoManager->MakeTube(Form("waterTubetwo%d_D4_H%d", i,half), water, 0., fRWater, fLpartial4[i]/2.);
1404  waterTube2->SetLineColor(kBlue);
1405  rotation = new TGeoRotation ("rotation", -90., - fangle4[i], 0.);
1406  transformation = new TGeoCombiTrans( fXposition4[i]+fradius4[i]*(1-(TMath::Cos(anglerad[i])))+fLpartial4[i]*TMath::Sin(anglerad[i])/2., 0.,
1407  -fSupportXDimensions[4][0]/2. + fLwater4[i] + fradius4[i]*(TMath::Sin(anglerad[i])) +
1408  fLpartial4[i]*(TMath::Cos(anglerad[i]))/2., rotation);
1409  cooling->AddNode (waterTube2, 3, transformation);
1410  rotation = new TGeoRotation ("rotation", -90., fangle4[i], 0.);
1411  transformation = new TGeoCombiTrans( fXposition4[i]+fradius4[i]*(1-(TMath::Cos(anglerad[i])))+fLpartial4[i]*TMath::Sin(anglerad[i])/2., 0.,
1412  fSupportXDimensions[4][0]/2. - fLwater4[i] - fradius4[i]*(TMath::Sin(anglerad[i])) -
1413  fLpartial4[i]*(TMath::Cos(anglerad[i]))/2. , rotation);
1414  cooling->AddNode (waterTube2, 4, transformation);
1415 
1416  // -------- Torus shape --------
1417 
1418  TGeoVolume *waterTorus1 = gGeoManager->MakeTorus(Form("waterTorusone%d_D4_H%d", i,half), water, fradius4[i], 0., fRWater, 0., fangle4[i]);
1419  waterTorus1->SetLineColor(kBlue);
1420  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
1421  transformation = new TGeoCombiTrans(fXposition4[i] + fradius4[i], 0., -fSupportXDimensions[4][0]/2. + fLwater4[i], rotation);
1422  cooling->AddNode (waterTorus1, 1, transformation);
1423  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
1424  transformation = new TGeoCombiTrans(fXposition4[i] + fradius4[i], 0., fSupportXDimensions[4][0]/2. - fLwater4[i], rotation);
1425  cooling->AddNode (waterTorus1, 2, transformation);
1426 
1427  TGeoVolume *waterTorus2 = gGeoManager->MakeTorus(Form("waterTorustwo%d_D4_H%d", i,half), water, fradius4mid[i], 0., fRWater, 180 - fangle4[i] ,2*fangle4[i]);
1428  waterTorus2->SetLineColor(kBlue);
1429  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
1430  transformation = new TGeoCombiTrans(fXposition4[i] + fradius4[i]*(1-(TMath::Cos(anglerad[i])))+fLpartial4[i]*TMath::Sin(anglerad[i]) -
1431  fradius4mid[i]*TMath::Cos(anglerad[i]), 0., 0., rotation);
1432  cooling->AddNode (waterTorus2, 3, transformation);
1433 
1434  }
1435 
1436  // ------------------- Third pipe -------------------
1437 
1438  // -------- Tube shape --------
1439 
1440  TGeoVolume *waterTube1 = gGeoManager->MakeTube(Form("waterTubeone2_D4_H%d", half), water, 0., fRWater, fLwater4[2]/2.);
1441  waterTube1->SetLineColor(kBlue);
1442  translation = new TGeoTranslation (fXposition4[2], 0., fLwater4[2]/2. + lMiddle4[2]/2.);
1443  cooling->AddNode (waterTube1, 1, translation);
1444  translation = new TGeoTranslation (fXposition4[2], 0., -fLwater4[2]/2. - lMiddle4[2]/2.);
1445  cooling->AddNode (waterTube1, 2, translation);
1446 
1447  TGeoVolume *waterTube2 = gGeoManager->MakeTube(Form("waterTubetwo2_D4_H%d", half), water, 0., fRWater, lMiddle4[2]/2. - 2.*fradius4[2]*TMath::Sin(anglerad[2]));
1448  waterTube2->SetLineColor(kBlue);
1449  translation = new TGeoTranslation (fXposition4[2] + 2.*fradius4[2]*(1-TMath::Cos(anglerad[2])), 0., 0.);
1450  cooling->AddNode (waterTube2, 3, translation);
1451 
1452  // -------- Torus shape --------
1453 
1454  TGeoVolume *waterTorus1 = gGeoManager->MakeTorus(Form("waterTorusone2_D4_H%d", half), water, fradius4[2], 0., fRWater, 0., fangle4[2]);
1455  waterTorus1->SetLineColor(kBlue);
1456  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
1457  transformation = new TGeoCombiTrans(fXposition4[2] + fradius4[2], 0., -fSupportXDimensions[4][0]/2. + fLwater4[2], rotation);
1458  cooling->AddNode (waterTorus1, 1, transformation);
1459  rotation = new TGeoRotation ("rotation", 180., -90., 180 - fangle4[2]);
1460  transformation = new TGeoCombiTrans(fXposition4[2] + fradius4[2] - 2*fradius4[2]*TMath::Cos(anglerad[2]), 0.,
1461  -fSupportXDimensions[4][0]/2. + fLwater4[2] + 2*fradius4[2]*TMath::Sin(anglerad[2]), rotation);
1462  cooling->AddNode (waterTorus1, 2, transformation);
1463  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
1464  transformation = new TGeoCombiTrans(fXposition4[2] + fradius4[2], 0., fSupportXDimensions[4][0]/2. - fLwater4[2], rotation);
1465  cooling->AddNode (waterTorus1, 3, transformation);
1466  rotation = new TGeoRotation ("rotation", 180., 90., 180 - fangle4[2]);
1467  transformation = new TGeoCombiTrans(fXposition4[2] + fradius4[2] - 2*fradius4[2]*TMath::Cos(anglerad[2]), 0.,
1468  fSupportXDimensions[4][0]/2. - fLwater4[2] - 2*fradius4[2]*TMath::Sin(anglerad[2]), rotation);
1469  cooling->AddNode (waterTorus1, 4, transformation);
1470 
1471  // ------------------- Fourth pipe -------------------
1472 
1473  waterTorus1 = gGeoManager->MakeTorus(Form("waterTorusone3_D4_H%d", half), water, fradius4[3], 0., fRWater, 0., fangle4[3]);
1474  waterTorus1->SetLineColor(kBlue);
1475  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
1476  transformation = new TGeoCombiTrans(fXposition4[3] + fradius4[3], 0., -fSupportXDimensions[4][0]/2., rotation);
1477  cooling->AddNode (waterTorus1, 1, transformation);
1478 
1479  TGeoVolume *waterTorus2 = gGeoManager->MakeTorus(Form("waterTorustwo3_D4_H%d", half), water, fradius4[4] , 0., fRWater, 0., fangle4[4]);
1480  waterTorus2->SetLineColor(kBlue);
1481  rotation = new TGeoRotation ("rotation", 180., -90., 180 - fangle4[3]);
1482  transformation = new TGeoCombiTrans( fXposition4[3] + fradius4[3] - fradius4[3]*TMath::Cos(anglerad[3]) -
1483  fradius4[4]*TMath::Cos(anglerad[3]), 0., -fSupportXDimensions[4][0]/2. +
1484  fradius4[3]*TMath::Sin(anglerad[3]) + fradius4[4]*TMath::Sin(anglerad[3]), rotation);
1485  cooling->AddNode (waterTorus2, 1, transformation);
1486  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
1487  transformation = new TGeoCombiTrans(fXposition4[3] + fradius4[3], 0., fSupportXDimensions[4][0]/2., rotation);
1488  cooling->AddNode (waterTorus1, 2, transformation);
1489  rotation = new TGeoRotation ("rotation", 180., 90., 180 - fangle4[3]);
1490  transformation = new TGeoCombiTrans( fXposition4[3] + fradius4[3] - fradius4[3]*TMath::Cos(anglerad[3]) -
1491  fradius4[4]*TMath::Cos(anglerad[3]), 0., fSupportXDimensions[4][0]/2. -
1492  fradius4[3]*TMath::Sin(anglerad[3]) - fradius4[4]*TMath::Sin(anglerad[3]), rotation);
1493  cooling->AddNode (waterTorus2, 2, transformation);
1494 
1495  TGeoVolume *waterTorus3 = gGeoManager->MakeTorus(Form("waterTorusthree3_D4_H%d", half), water, fradius4mid[2] , 0., fRWater, -fangle4[5], 2.*fangle4[5]);
1496  waterTorus3->SetLineColor(kBlue);
1497  rotation = new TGeoRotation ("rotation", 0., 90., 0.);
1498  transformation = new TGeoCombiTrans( fXposition4[3] + fradius4[3] - fradius4[3]*TMath::Cos(anglerad[3]) -
1499  fradius4[4]*TMath::Cos(anglerad[3]) - ((fradius4mid[2] - fradius4[4])*TMath::Cos(anglerad[5])), 0., 0., rotation);
1500  cooling->AddNode (waterTorus3, 1, transformation);
1501 
1502  // ------------------- Fifth pipe -------------------
1503 
1505  Double_t angle4fifthrad[4] = {0., 0., 0., 0.};
1506  for(Int_t i=0; i<4; i++){
1507  angle4fifthrad[i] = (TMath::Pi())*(fangle4fifth[i])/180.;
1508  }
1509  Double_t beta4fourth[4] = {0, fangle4fifth[0], fangle4fifth[0] - fangle4fifth[1], 180}; //shift angle
1510  Double_t beta4fourthrad[4] = {};
1511  for(Int_t i=0; i<4; i++){
1512  beta4fourthrad[i] = (TMath::Pi())*(beta4fourth[i])/180.;
1513  }
1514  Double_t translation4x[4] = { fXposition4[4] + fradius4fifth[0]*(TMath::Cos(beta4fourthrad[0])),
1515  fXposition4[4] + fradius4fifth[0]*((TMath::Cos(beta4fourthrad[0])) - TMath::Cos(beta4fourthrad[0] + angle4fifthrad[0])) -
1516  fradius4fifth[1]*(TMath::Cos(beta4fourthrad[0] + angle4fifthrad[0])),
1517 
1518  fXposition4[4] + fradius4fifth[0]*((TMath::Cos(beta4fourthrad[0])) - TMath::Cos(beta4fourthrad[0] + angle4fifthrad[0])) -
1519  fradius4fifth[1]*(TMath::Cos(beta4fourthrad[0] + angle4fifthrad[0])) +
1520  fradius4fifth[1]*(TMath::Sin(TMath::Pi()/2. - angle4fifthrad[1] + angle4fifthrad[0] + beta4fourthrad[0])) +
1521  fradius4fifth[2]*(TMath::Cos(angle4fifthrad[1] - angle4fifthrad[0] - beta4fourthrad[0])),
1522 
1523  fXposition4[4] + fradius4fifth[0]*((TMath::Cos(beta4fourthrad[0])) - TMath::Cos(beta4fourthrad[0] + angle4fifthrad[0])) -
1524  fradius4fifth[1]*(TMath::Cos(beta4fourthrad[0] + angle4fifthrad[0])) +
1525  fradius4fifth[1]*(TMath::Sin(TMath::Pi()/2. - angle4fifthrad[1] + angle4fifthrad[0] + beta4fourthrad[0])) +
1526  fradius4fifth[2]*(TMath::Cos(angle4fifthrad[1] - angle4fifthrad[0] - beta4fourthrad[0])) -
1527  fradius4fifth[2]*(TMath::Sin((TMath::Pi()/2.) - angle4fifthrad[3])) - fradius4fifth[3]*(TMath::Cos(angle4fifthrad[3]))};
1528 
1529  Double_t translation4y[4] = {0., 0., 0., 0.};
1530 
1531  Double_t translation4z[4] = {-(fLwater4[0] + lMiddle4[0]/2.) - fradius4fifth[0]*(TMath::Sin(beta4fourthrad[0])),
1532 
1533  -(fLwater4[0] + lMiddle4[0]/2.) - fradius4fifth[0]*(TMath::Sin(beta4fourthrad[0])) +
1534  fradius4fifth[0]*(TMath::Sin(beta4fourthrad[0] + angle4fifthrad[0])) +
1535  fradius4fifth[1]*(TMath::Sin(beta4fourthrad[0] + angle4fifthrad[0])),
1536 
1537  -(fLwater4[0] + lMiddle4[0]/2.) - fradius4fifth[0]*(TMath::Sin(beta4fourthrad[0])) +
1538  fradius4fifth[0]*(TMath::Sin(beta4fourthrad[0] + angle4fifthrad[0])) +
1539  fradius4fifth[1]*(TMath::Cos(TMath::Pi()/2 - beta4fourthrad[0] - angle4fifthrad[0])) +
1540  fradius4fifth[1]*(TMath::Cos(TMath::Pi()/2. - angle4fifthrad[1] + angle4fifthrad[0] + beta4fourthrad[0])) +
1541  fradius4fifth[2]*(TMath::Sin(angle4fifthrad[1] - angle4fifthrad[0] - beta4fourthrad[0])),
1542 
1543  -(fLwater4[0] + lMiddle4[0]/2.) - fradius4fifth[0]*(TMath::Sin(beta4fourthrad[0])) +
1544  fradius4fifth[0]*(TMath::Sin(beta4fourthrad[0] + angle4fifthrad[0])) +
1545  fradius4fifth[1]*(TMath::Cos(TMath::Pi()/2 - beta4fourthrad[0] - angle4fifthrad[0])) +
1546  fradius4fifth[1]*(TMath::Cos(TMath::Pi()/2. - angle4fifthrad[1] + angle4fifthrad[0] + beta4fourthrad[0])) +
1547  fradius4fifth[2]*(TMath::Sin(angle4fifthrad[1] - angle4fifthrad[0] - beta4fourthrad[0])) +
1548  (fradius4fifth[3] + fradius4fifth[2])*(TMath::Sin(angle4fifthrad[3]))
1549  };
1550 
1551  Double_t rotation4x[4] = {180., 180., 180., 180};
1552  Double_t rotation4y[4] = {90., 90., 90., 90};
1553  Double_t rotation4z[4] = {0., 180 - fangle4fifth[1] , 0., 0.};
1554 
1555  for (Int_t i= 0; i<4; i++){
1556  waterTorus1 = gGeoManager->MakeTorus(Form("waterTorusone%d_D4_H%d", i,half), water, fradius4fifth[i], 0., fRWater, beta4fourth[i], fangle4fifth[i]);
1557  waterTorus1->SetLineColor(kBlue);
1558  rotation = new TGeoRotation ("rotation", rotation4x[i], rotation4y[i], rotation4z[i]);
1559  transformation = new TGeoCombiTrans(translation4x[i], translation4y[i], translation4z[i], rotation);
1560  cooling->AddNode (waterTorus1, 7, transformation);
1561  rotation = new TGeoRotation ("rotation", rotation4x[i] , rotation4y[i] - 180, rotation4z[i]);
1562  transformation = new TGeoCombiTrans(translation4x[i], translation4y[i], - translation4z[i], rotation);
1563  cooling->AddNode (waterTorus1, 8, transformation);
1564  }
1565 
1566  TGeoVolume *waterTubeFive = gGeoManager->MakeTube(Form("waterTubeFive1_D4_H%d",half), water, 0., fRWater, -translation4z[3]);
1567  waterTubeFive->SetLineColor(kBlue);
1568  rotation = new TGeoRotation ("rotation", 0., 0., 0.);
1569  transformation = new TGeoCombiTrans(translation4x[3] + fradius4fifth[3], 0., 0., rotation);
1570  cooling->AddNode(waterTubeFive, 1, transformation);
1571 
1572 
1573  // **************************************** Pipe part ****************************************
1574 
1575  // ------------------- First and second pipe -------------------
1576 
1577  for(Int_t i=0; i<2; i++){
1578 
1579  // -------- Tube shape --------
1580 
1581  TGeoVolume *pipeTube1 = gGeoManager->MakeTube(Form("pipeTubeone%d_D4_H%d", i,half), pipe, fRWater, fRWater + fDRPipe, fLwater4[i]/2.);
1582  pipeTube1->SetLineColor(10);
1583  translation = new TGeoTranslation (fXposition4[i], 0., fLwater4[i]/2. + lMiddle4[i]/2.);
1584  cooling->AddNode (pipeTube1, 1, translation);
1585  translation = new TGeoTranslation (fXposition4[i], 0., -fLwater4[i]/2. - lMiddle4[i]/2.);
1586  cooling->AddNode (pipeTube1, 2, translation);
1587 
1588  TGeoVolume *pipeTube2 = gGeoManager->MakeTube(Form("pipeTubetwo%d_D4_H%d", i,half), pipe, fRWater, fRWater + fDRPipe, fLpartial4[i]/2.);
1589  pipeTube2->SetLineColor(10);
1590  rotation = new TGeoRotation ("rotation", -90., - fangle4[i], 0.);
1591  transformation = new TGeoCombiTrans( fXposition4[i]+fradius4[i]*(1-(TMath::Cos(anglerad[i])))+fLpartial4[i]*TMath::Sin(anglerad[i])/2., 0.,
1592  -fSupportXDimensions[4][0]/2. + fLwater4[i] + fradius4[i]*(TMath::Sin(anglerad[i])) +
1593  fLpartial4[i]*(TMath::Cos(anglerad[i]))/2., rotation);
1594  cooling->AddNode (pipeTube2, 3, transformation);
1595  rotation = new TGeoRotation ("rotation", -90., fangle4[i], 0.);
1596  transformation = new TGeoCombiTrans( fXposition4[i]+fradius4[i]*(1-(TMath::Cos(anglerad[i])))+fLpartial4[i]*TMath::Sin(anglerad[i])/2., 0.,
1597  fSupportXDimensions[4][0]/2. - fLwater4[i] - fradius4[i]*(TMath::Sin(anglerad[i])) -
1598  fLpartial4[i]*(TMath::Cos(anglerad[i]))/2. , rotation);
1599  cooling->AddNode (pipeTube2, 4, transformation);
1600 
1601  // -------- Torus shape --------
1602 
1603  TGeoVolume *pipeTorus1 = gGeoManager->MakeTorus(Form("pipeTorusone%d_D4_H%d", i,half), pipe, fradius4[i], fRWater, fRWater + fDRPipe, 0., fangle4[i]);
1604  pipeTorus1->SetLineColor(10);
1605  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
1606  transformation = new TGeoCombiTrans(fXposition4[i] + fradius4[i], 0., -fSupportXDimensions[4][0]/2. + fLwater4[i], rotation);
1607  cooling->AddNode (pipeTorus1, 1, transformation);
1608  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
1609  transformation = new TGeoCombiTrans(fXposition4[i] + fradius4[i], 0., fSupportXDimensions[4][0]/2. - fLwater4[i], rotation);
1610  cooling->AddNode (pipeTorus1, 2, transformation);
1611 
1612  TGeoVolume *pipeTorus2 = gGeoManager->MakeTorus(Form("pipeTorustwo%d_D4_H%d", i,half), pipe, fradius4mid[i], fRWater, fRWater + fDRPipe, 180 - fangle4[i] ,2*fangle4[i]);
1613  pipeTorus2->SetLineColor(10);
1614  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
1615  transformation = new TGeoCombiTrans(fXposition4[i] + fradius4[i]*(1-(TMath::Cos(anglerad[i])))+fLpartial4[i]*TMath::Sin(anglerad[i]) -
1616  fradius4mid[i]*TMath::Cos(anglerad[i]), 0., 0., rotation);
1617  cooling->AddNode (pipeTorus2, 3, transformation);
1618 
1619  }
1620 
1621  // ------------------- Third pipe -------------------
1622 
1623  // -------- Tube shape --------
1624 
1625  TGeoVolume *pipeTube1 = gGeoManager->MakeTube(Form("pipeTubeone2_D4_H%d",half), pipe, fRWater, fRWater + fDRPipe, fLwater4[2]/2.);
1626  pipeTube1->SetLineColor(10);
1627  translation = new TGeoTranslation (fXposition4[2], 0., fLwater4[2]/2. + lMiddle4[2]/2.);
1628  cooling->AddNode (pipeTube1, 1, translation);
1629  translation = new TGeoTranslation (fXposition4[2], 0., -fLwater4[2]/2. - lMiddle4[2]/2.);
1630  cooling->AddNode (pipeTube1, 2, translation);
1631 
1632  TGeoVolume *pipeTube2 = gGeoManager->MakeTube(Form("pipeTubetwo2_D4_H%d",half), pipe, fRWater, fRWater + fDRPipe, lMiddle4[2]/2. - 2.*fradius4[2]*TMath::Sin(anglerad[2]));
1633  pipeTube2->SetLineColor(10);
1634  translation = new TGeoTranslation (fXposition4[2] + 2.*fradius4[2]*(1-TMath::Cos(anglerad[2])), 0., 0.);
1635  cooling->AddNode (pipeTube2, 3, translation);
1636 
1637  // -------- Torus shape --------
1638 
1639  TGeoVolume *pipeTorus1 = gGeoManager->MakeTorus(Form("pipeTorusone2_D4_H%d",half), pipe, fradius4[2], fRWater, fRWater + fDRPipe, 0., fangle4[2]);
1640  pipeTorus1->SetLineColor(10);
1641  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
1642  transformation = new TGeoCombiTrans(fXposition4[2] + fradius4[2], 0., -fSupportXDimensions[4][0]/2. + fLwater4[2], rotation);
1643  cooling->AddNode (pipeTorus1, 1, transformation);
1644  rotation = new TGeoRotation ("rotation", 180., -90., 180 - fangle4[2]);
1645  transformation = new TGeoCombiTrans(fXposition4[2] + fradius4[2] - 2*fradius4[2]*TMath::Cos(anglerad[2]), 0.,
1646  -fSupportXDimensions[4][0]/2. + fLwater4[2] + 2*fradius4[2]*TMath::Sin(anglerad[2]), rotation);
1647  cooling->AddNode (pipeTorus1, 2, transformation);
1648  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
1649  transformation = new TGeoCombiTrans(fXposition4[2] + fradius4[2], 0., fSupportXDimensions[4][0]/2. - fLwater4[2], rotation);
1650  cooling->AddNode (pipeTorus1, 3, transformation);
1651  rotation = new TGeoRotation ("rotation", 180., 90., 180 - fangle4[2]);
1652  transformation = new TGeoCombiTrans(fXposition4[2] + fradius4[2] - 2*fradius4[2]*TMath::Cos(anglerad[2]), 0.,
1653  fSupportXDimensions[4][0]/2. - fLwater4[2] - 2*fradius4[2]*TMath::Sin(anglerad[2]), rotation);
1654  cooling->AddNode (pipeTorus1, 4, transformation);
1655 
1656  // ------------------- Fourth pipe -------------------
1657 
1658  pipeTorus1 = gGeoManager->MakeTorus(Form("pipeTorusone3_D4_H%d",half), pipe, fradius4[3], fRWater, fRWater + fDRPipe, 0., fangle4[3]);
1659  pipeTorus1->SetLineColor(10);
1660  rotation = new TGeoRotation ("rotation", 180., 90., 0.);
1661  transformation = new TGeoCombiTrans(fXposition4[3] + fradius4[3], 0., -fSupportXDimensions[4][0]/2., rotation);
1662  cooling->AddNode (pipeTorus1, 1, transformation);
1663 
1664  TGeoVolume *pipeTorus2 = gGeoManager->MakeTorus(Form("pipeTorustwo3_D4_H%d",half), pipe, fradius4[4] , fRWater, fRWater + fDRPipe, 0., fangle4[4]);
1665  pipeTorus2->SetLineColor(10);
1666  rotation = new TGeoRotation ("rotation", 180., -90., 180 - fangle4[3]);
1667  transformation = new TGeoCombiTrans( fXposition4[3] + fradius4[3] - fradius4[3]*TMath::Cos(anglerad[3]) -
1668  fradius4[4]*TMath::Cos(anglerad[3]), 0., -fSupportXDimensions[4][0]/2. +
1669  fradius4[3]*TMath::Sin(anglerad[3]) + fradius4[4]*TMath::Sin(anglerad[3]), rotation);
1670  cooling->AddNode (pipeTorus2, 1, transformation);
1671  rotation = new TGeoRotation ("rotation", 180., -90., 0.);
1672  transformation = new TGeoCombiTrans(fXposition4[3] + fradius4[3], 0., fSupportXDimensions[4][0]/2. , rotation);
1673  cooling->AddNode (pipeTorus1, 2, transformation);
1674  rotation = new TGeoRotation ("rotation", 180., 90., 180 - fangle4[3]);
1675  transformation = new TGeoCombiTrans( fXposition4[3] + fradius4[3] - fradius4[3]*TMath::Cos(anglerad[3]) -
1676  fradius4[4]*TMath::Cos(anglerad[3]), 0., fSupportXDimensions[4][0]/2. -
1677  fradius4[3]*TMath::Sin(anglerad[3]) - fradius4[4]*TMath::Sin(anglerad[3]), rotation);
1678  cooling->AddNode (pipeTorus2, 2, transformation);
1679 
1680  TGeoVolume *pipeTorus3 = gGeoManager->MakeTorus(Form("pipeTorusthree3_D4_H%d",half), pipe, fradius4mid[2] , fRWater, fRWater + fDRPipe, -fangle4[5], 2.*fangle4[5]);
1681  pipeTorus3->SetLineColor(10);
1682  rotation = new TGeoRotation ("rotation", 0., 90., 0.);
1683  transformation = new TGeoCombiTrans( fXposition4[3] + fradius4[3] - fradius4[3]*TMath::Cos(anglerad[3]) -
1684  fradius4[4]*TMath::Cos(anglerad[3]) - ((fradius4mid[2] - fradius4[4])*TMath::Cos(anglerad[5])), 0., 0., rotation);
1685  cooling->AddNode (pipeTorus3, 1, transformation);
1686 
1687  // ------------------- Fifth pipe -------------------
1688 
1689  for(Int_t i= 0; i<4; i++){
1690  pipeTorus1 = gGeoManager->MakeTorus(Form("pipeTorusone%d_D4_H%d", i,half), pipe, fradius4fifth[i], fRWater, fRWater + fDRPipe, beta4fourth[i], fangle4fifth[i]);
1691  pipeTorus1->SetLineColor(10);
1692  rotation = new TGeoRotation ("rotation", rotation4x[i], rotation4y[i], rotation4z[i]);
1693  transformation = new TGeoCombiTrans(translation4x[i], translation4y[i], translation4z[i], rotation);
1694  cooling->AddNode (pipeTorus1, 7, transformation);
1695  rotation = new TGeoRotation ("rotation", rotation4x[i] , rotation4y[i] - 180, rotation4z[i]);
1696  transformation = new TGeoCombiTrans(translation4x[i], translation4y[i], - translation4z[i], rotation);
1697  cooling->AddNode (pipeTorus1, 8, transformation);
1698  }
1699 
1700  TGeoVolume *pipeTubeFive = gGeoManager->MakeTube(Form("pipeTubeFive1_D4_H%d", half), pipe, fRWater, fRWater + fDRPipe, -translation4z[3]);
1701  pipeTubeFive->SetLineColor(10);
1702  rotation = new TGeoRotation ("rotation", 0., 0., 0.);
1703  transformation = new TGeoCombiTrans(translation4x[3] + fradius4fifth[3], 0., 0., rotation);
1704  cooling->AddNode(pipeTubeFive, 1, transformation);
1705 
1706 
1707 // if (half == kTop) {
1708 // rotation = new TGeoRotation ("rotation", 90., 90., 0.);
1709 // transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] + deltaz/2. - fCarbonThickness - fRWater - fDRPipe, rotation);
1710 // fHalfDisk->AddNode(cooling, 1, transformation);
1711 // transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] - deltaz/2. + fCarbonThickness + fRWater + fDRPipe, rotation);
1712 // fHalfDisk->AddNode(cooling, 2, transformation);
1713 // }
1714 // else if (half == kBottom) {
1715  rotation = new TGeoRotation ("rotation", -90., 90., 0.);
1716  transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] + deltaz/2. - fCarbonThickness - fRWater - fDRPipe, rotation);
1717  fHalfDisk->AddNode(cooling, 3, transformation);
1718  transformation = new TGeoCombiTrans(0., 0., fZPlan[disk] - deltaz/2. + fCarbonThickness + fRWater + fDRPipe, rotation);
1719  fHalfDisk->AddNode(cooling, 4, transformation);
1720 // }
1721 
1722  // **************************************** Carbon Plates ****************************************
1723 
1724  TGeoVolumeAssembly *carbonPlate = new TGeoVolumeAssembly(Form("carbonPlate_D4_H%d",half));
1725 
1726  TGeoBBox *carbonBase4 = new TGeoBBox (Form("carbonBase4_D4_H%d",half), (fSupportXDimensions[disk][0])/2., (fSupportYDimensions[disk][0])/2., fCarbonThickness);
1727  TGeoTranslation *t41= new TGeoTranslation ("t41",0., (fSupportYDimensions[disk][0])/2. + fHalfDiskGap, 0.);
1728  t41-> RegisterYourself();
1729 
1730  TGeoTubeSeg *holeCarbon4 = new TGeoTubeSeg(Form("holeCarbon4_D4_H%d",half), 0., fRMin[disk], fCarbonThickness + 0.000001, 0, 180.);
1731  TGeoTranslation *t42= new TGeoTranslation ("t42",0., - fHalfDiskGap , 0.);
1732  t42-> RegisterYourself();
1733 
1734 
1736  TGeoSubtraction *carbonhole4 = new TGeoSubtraction(carbonBase4, holeCarbon4, t41, t42);
1737  TGeoCompositeShape *cs4 = new TGeoCompositeShape(Form("Carbon4_D4_H%d",half), carbonhole4);
1738  TGeoVolume *carbonBaseWithHole4 = new TGeoVolume(Form("carbonBaseWithHole_D4_H%d",half), cs4, carbon);
1739 
1740  carbonBaseWithHole4->SetLineColor(kGray+3);
1741  rotation = new TGeoRotation ("rotation", 0., 0., 0.);
1742  transformation = new TGeoCombiTrans(0., 0., 0., rotation);
1743  carbonPlate->AddNode(carbonBaseWithHole4, 0, new TGeoTranslation(0., 0., fZPlan[disk]));
1744 
1745  Double_t ty = fSupportYDimensions[disk][0];
1746 
1747  for (Int_t ipart=1; ipart<fnPart[disk]; ipart ++) {
1748  ty += fSupportYDimensions[disk][ipart]/2.;
1749  TGeoVolume *partCarbon = gGeoManager->MakeBox(Form("partCarbon_D4_H%d_%d", half,ipart), carbon, fSupportXDimensions[disk][ipart]/2.,
1750  fSupportYDimensions[disk][ipart]/2., fCarbonThickness);
1751  partCarbon->SetLineColor(kGray+3);
1752  TGeoTranslation *t = new TGeoTranslation ("t", 0, ty + fHalfDiskGap, fZPlan[disk]);
1753  carbonPlate -> AddNode(partCarbon, ipart, t);
1754  ty += fSupportYDimensions[disk][ipart]/2.;
1755  }
1756 
1757 // if (half == kTop) {
1758 // rotation = new TGeoRotation ("rotation", 0., 0., 0.);
1759 // transformation = new TGeoCombiTrans(0., 0., deltaz/2., rotation);
1760 // fHalfDisk->AddNode(carbonPlate, 1, transformation);
1761 // transformation = new TGeoCombiTrans(0., 0., -deltaz/2., rotation);
1762 // fHalfDisk->AddNode(carbonPlate, 2, transformation);
1763 // }
1764 // else if (half == kBottom) {
1765  rotation = new TGeoRotation ("rotation", 180., 0., 0.);
1766  transformation = new TGeoCombiTrans(0., 0., deltaz/2., rotation);
1767  fHalfDisk->AddNode(carbonPlate, 3, transformation);
1768  transformation = new TGeoCombiTrans(0., 0., -deltaz/2., rotation);
1769  fHalfDisk->AddNode(carbonPlate, 4, transformation);
1770 // }
1771 
1772 
1773  // **************************************** Rohacell Plate ****************************************
1774 
1775  TGeoVolumeAssembly *rohacellPlate = new TGeoVolumeAssembly(Form("rohacellPlate_D4_H%d",half));
1776 
1777  TGeoBBox *rohacellBase4 = new TGeoBBox (Form("rohacellBase4_D4_H%d",half), (fSupportXDimensions[disk][0])/2., (fSupportYDimensions[disk][0])/2., fRohacellThickness);
1778  // TGeoTranslation *t3 = new TGeoTranslation ("t3",0., (fSupportYDimensions[disk][0])/2. + fHalfDiskGap , 0.);
1779  // t3 -> RegisterYourself();
1780 
1781  TGeoTubeSeg *holeRohacell4 = new TGeoTubeSeg(Form("holeRohacell4_D4_H%d",half), 0., fRMin[disk], fRohacellThickness + 0.000001, 0, 180.);
1782  // TGeoTranslation *t4= new TGeoTranslation ("t4", 0., - fHalfDiskGap , 0.);
1783  // t4-> RegisterYourself();
1784 
1786  TGeoSubtraction *rohacellhole4 = new TGeoSubtraction(rohacellBase4, holeRohacell4, t41, t42);
1787  TGeoCompositeShape *rh4 = new TGeoCompositeShape(Form("rohacellBase4_D4_H%d",half), rohacellhole4);
1788  TGeoVolume *rohacellBaseWithHole = new TGeoVolume(Form("rohacellBaseWithHole_D4_H%d",half), rh4, rohacell);
1789 
1790  rohacellBaseWithHole->SetLineColor(kGray);
1791  rotation = new TGeoRotation ("rotation", 0., 0., 0.);
1792  transformation = new TGeoCombiTrans(0., 0., 0., rotation);
1793  rohacellPlate -> AddNode(rohacellBaseWithHole, 0, new TGeoTranslation(0., 0., fZPlan[disk]));
1794 
1795  ty = fSupportYDimensions[disk][0];
1796 
1797  for (Int_t ipart=1; ipart<fnPart[disk]; ipart ++) {
1798  ty += fSupportYDimensions[disk][ipart]/2.;
1799  TGeoVolume *partRohacell = gGeoManager->MakeBox(Form("partRohacelli_D4_H%d_%d", half, ipart), rohacell, fSupportXDimensions[disk][ipart]/2.,
1800  fSupportYDimensions[disk][ipart]/2., fRohacellThickness);
1801  partRohacell->SetLineColor(kGray);
1802  TGeoTranslation *t = new TGeoTranslation ("t", 0, ty + fHalfDiskGap, fZPlan[disk]);
1803  rohacellPlate -> AddNode(partRohacell, ipart, t);
1804  ty += fSupportYDimensions[disk][ipart]/2.;
1805  }
1806 
1807 // if (half == kTop) {
1808 // rotation = new TGeoRotation ("rotation", 0., 0., 0.);
1809 // transformation = new TGeoCombiTrans(0., 0., 0., rotation);
1810 // fHalfDisk->AddNode(rohacellPlate, 1, transformation);
1811 // }
1812 // if (half == kBottom) {
1813  rotation = new TGeoRotation ("rotation", 180., 0., 0.);
1814  transformation = new TGeoCombiTrans(0., 0., 0., rotation);
1815  fHalfDisk->AddNode(rohacellPlate, 2, transformation);
1816 // }
1817 
1818 }
1819 
1820 //====================================================================================================================================================
1821 
1823 
1824  fNDisks = 5; // Should it be read from some other class?
1825 
1826 
1827  for (Int_t idisk=0; idisk<fNMaxDisks; idisk++) {
1828  for (Int_t ihalf=0; ihalf<kNHalves; ihalf++) {
1829  fHalfDiskRotation[idisk][ihalf] = new TGeoRotation(Form("rotation%d%d", idisk, ihalf), 0., 0., 0.);
1830  fHalfDiskTransformation[idisk][ihalf] = new TGeoCombiTrans(Form("transformation%d%d", idisk, ihalf), 0., 0., 0., fHalfDiskRotation[idisk][ihalf]);
1831  }
1832  }
1833 
1834  fRohacellThickness = fHeatExchangerThickness/2. - 2.*fCarbonThickness - 2*(fRWater + fDRPipe);//thickness of Rohacell plate over 2
1835  printf("Rohacell thickness %f \n",fRohacellThickness);
1836 
1837  fHalfDiskGap = 0.2;
1838 
1839  fnPart[0] = 3;
1840  fnPart[1] = 3;
1841  fnPart[2] = 3;
1842  fnPart[3] = 5;
1843  fnPart[4] = 4;
1844 
1845  fRMin[0] = 2.35;
1846  fRMin[1] = 2.35;
1847  fRMin[2] = 2.35;
1848  fRMin[3] = 3.35;
1849  fRMin[4] = 3.75;
1850 
1851  // fZPlan[0] = 46;
1852  // fZPlan[1] = 49.3;
1853  // fZPlan[2] = 53.1;
1854  // fZPlan[3] = 68.7;
1855  // fZPlan[4] = 76.8;
1856 
1857  fZPlan[0] = 0;
1858  fZPlan[1] = 0;
1859  fZPlan[2] = 0;
1860  fZPlan[3] = 0;
1861  fZPlan[4] = 0;
1862 
1863 
1864  fSupportXDimensions= new Double_t*[fNDisks];
1865  fSupportYDimensions= new Double_t*[fNDisks];
1866 
1867  for(Int_t i=0; i<fNDisks; i++) {
1868  fSupportXDimensions[i]= new double[fnPart[i]];
1869  fSupportYDimensions[i]= new double[fnPart[i]];
1870  }
1871 
1872  fSupportXDimensions[0][0]=21.; fSupportXDimensions[0][1]=14.8; fSupportXDimensions[0][2]=4.4;
1873  fSupportXDimensions[1][0]=21.; fSupportXDimensions[1][1]=14.8; fSupportXDimensions[1][2]=4.4;
1874  fSupportXDimensions[2][0]=22.6; fSupportXDimensions[2][1]=16.1; fSupportXDimensions[2][2]=9.3;
1875  fSupportXDimensions[3][0]=28.4; fSupportXDimensions[3][1]=22.9; fSupportXDimensions[3][2]=18.5 ;fSupportXDimensions[3][3]=8.3; fSupportXDimensions[3][4]=4.9;
1876  fSupportXDimensions[4][0]=28.4; fSupportXDimensions[4][1]=25.204; fSupportXDimensions[4][2]=21.9 ;fSupportXDimensions[4][3]=15.1;
1877 
1878  fSupportYDimensions[0][0]=6.2; fSupportYDimensions[0][1]=3.5; fSupportYDimensions[0][2]=1.4;
1879  fSupportYDimensions[1][0]=6.2; fSupportYDimensions[1][1]=3.5; fSupportYDimensions[1][2]=1.4;
1880  fSupportYDimensions[2][0]=6.61; fSupportYDimensions[2][1]=3.01; fSupportYDimensions[2][2]=1.83;
1881  fSupportYDimensions[3][0]=6.61; fSupportYDimensions[3][1]=3.01; fSupportYDimensions[3][2]=3.01 ;fSupportYDimensions[3][3]=1.8; fSupportYDimensions[3][4]=1.15;
1882  fSupportYDimensions[4][0]=6.61; fSupportYDimensions[4][1]=3.01; fSupportYDimensions[4][2]=3.01 ;fSupportYDimensions[4][3]=2.42;
1883 
1884  //Paramteters for disks 0, 1, 2
1885 
1886  fLWater = 6.759;
1887 
1888  fXPosition0[0] = 1.7;
1889  fXPosition0[1] = 4.61;
1890  fXPosition0[2] = 7.72;
1891 
1892  fangle0 = 44.6;
1893  fradius0 = 2.5;
1894  fLpartial0 = 1.;
1895 
1896  //Parameters for disk 3
1897 
1898  fLWater3[0] = 8.032;
1899  fLWater3[1] = 8.032;
1900  fLWater3[2] = 8.2;
1901 
1902  fXPosition3[0] = 1.7;
1903  fXPosition3[1] = 4.61;
1904  fXPosition3[2] = 5.5;
1905  fXPosition3[3] = 6.81;
1906 
1907  fangle3[0] = 41.3;
1908  fangle3[1] = 41.3;
1909  fangle3[2] = 28;
1910 
1911  fradius3[0] = 4.3;
1912  fradius3[1] = 4.3;
1913  fradius3[2] = 7.4;
1914 
1915  fangleThirdPipe3 = 15.;
1916  fLpartial3[0] = 2.3;
1917  fLpartial3[1] = 2.3;
1918 
1919  fradius3fourth[0] = 9.6;
1920  fradius3fourth[1] = 2.9;
1921  fradius3fourth[2] = 2.9;
1922  fradius3fourth[3] = 0.;
1923 
1924  fangle3fourth[0] = 40.8;
1925  fangle3fourth[1] = 50.;
1926  fangle3fourth[2] = 60.;
1928 
1929  // Parameters for disk 4
1930 
1931  fLwater4[0] = 5.911;
1932  fLwater4[1] = 3.697;
1933  fLwater4[2] = 3.038;
1934 
1935  fXposition4[0] = 1.7;
1936  fXposition4[1] = 3.492;
1937  fXposition4[2] = 4.61;
1938  fXposition4[3] = 5.5;
1939  fXposition4[4] = 6.5;
1940 
1941  fangle4[0] = 35.5;
1942  fangle4[1] = 30.;
1943  fangle4[2] = 54.;
1944  fangle4[3] = 53.;
1945  fangle4[4] = 40;
1946  fangle4[5] = (fangle4[3] - fangle4[4]);
1947 
1948  fradius4[0] = 6.6;
1949  fradius4[1] = 7.2;
1950  fradius4[2] = 4.6;
1951  fradius4[3] = 6.2;
1952  fradius4[4] = 6.;
1953 
1954  fLpartial4[0] = 2.5;
1955  fLpartial4[1] = 3.6;
1956 
1957  fangle4fifth[0] = 64.;
1958  fangle4fifth[1] = 30.;
1959  fangle4fifth[2] = 27.;
1960  fangle4fifth[3] = fangle4fifth[0] - fangle4fifth[1] + fangle4fifth[2];
1961 
1962  fradius4fifth[0] = 2.7;
1963  fradius4fifth[1] = 5.;
1964  fradius4fifth[2] = 5.1;
1965  fradius4fifth[3] = 4.3;
1966 
1967 }
1968 
1969 //====================================================================================================================================================
1970 
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
TGeoVolumeAssembly * Create(Int_t kHalf, Int_t disk)
TGeoCombiTrans * fHalfDiskTransformation[fNMaxDisks][kNHalves]
void CreateHalfDisk0(Int_t half)
TGeoVolumeAssembly * fHalfDisk
void CreateHalfDisk1(Int_t half)
Double_t ** fSupportYDimensions
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
Double_t t
Definition: AliFMDv1.cxx:90
void CreateHalfDisk2(Int_t half)
Double_t ** fSupportXDimensions
MFT Heat Exchanger builder.
void CreateHalfDisk3(Int_t half)
TGeoRotation * fHalfDiskRotation[fNMaxDisks][kNHalves]
void CreateHalfDisk4(Int_t half)
static const Int_t fNMaxDisks