LCOV - code coverage report
Current view: top level - ITSMFT/MFT/MFTbase - AliMFTHeatExchanger.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1119 0.1 %
Date: 2016-06-14 17:26:59 Functions: 1 12 8.3 %

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

Generated by: LCOV version 1.11