LCOV - code coverage report
Current view: top level - TPC/TPCsim - AliTPCv0.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1011 0.1 %
Date: 2016-06-14 17:26:59 Functions: 1 7 14.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             : ///////////////////////////////////////////////////////////////////////////////
      20             : //                                                                           //
      21             : //  Time Projection Chamber version 0 -- "coarse" TPC                        //
      22             : //                                                                           //
      23             : //Begin_Html
      24             : /*
      25             : <img src="picts/AliTPCv0Class.gif">
      26             : */
      27             : //End_Html
      28             : //                                                                           //
      29             : //                                                                           //
      30             : ///////////////////////////////////////////////////////////////////////////////
      31             : 
      32             : #include <Riostream.h>
      33             : 
      34             : #include <TMath.h>
      35             : #include <TVirtualMC.h>
      36             : #include <TString.h>
      37             : #include <TSystem.h>
      38             : 
      39             : #include "AliConst.h"
      40             : #include "AliRun.h"
      41             : #include "AliTPCDigitsArray.h"
      42             : #include "AliTPCParamSR.h"
      43             : #include "AliTPCv0.h"
      44             : #include "TGeoManager.h"
      45             : #include "TGeoVolume.h"
      46             : #include "TGeoPcon.h"
      47             : #include "TGeoCone.h"
      48             : #include "TGeoTube.h"
      49             : #include "TGeoPgon.h"
      50             : #include "TGeoTrd1.h"
      51             : #include "TGeoCompositeShape.h"
      52             : #include "TGeoPara.h"
      53             : #include "TGeoPhysicalNode.h"
      54             : #include "TGeoHalfSpace.h"
      55             : #include "TTreeStream.h"
      56             : #include "TGeoArb8.h"
      57             : using std::ifstream;
      58             : using std::ios_base;
      59          12 : ClassImp(AliTPCv0)
      60             :  
      61             : //_____________________________________________________________________________
      62             : AliTPCv0::AliTPCv0(const char *name, const char *title) 
      63           0 :          :AliTPC(name, title)
      64           0 : {
      65             :   //
      66             :   // Standard creator for TPC version 0
      67             :   //
      68             : 
      69             : 
      70           0 :   if (fTPCParam)
      71           0 :      fTPCParam->Write(fTPCParam->GetTitle());
      72           0 : }
      73             : 
      74             : //_____________________________________________________________________________
      75             : 
      76             : void AliTPCv0::CreateGeometry()
      77             : {
      78             : 
      79             :   //
      80             :   // Creation of the TPC version 0, i.e. no sensitive volumes,
      81             :   // only the material distribution
      82             :   //
      83             :   //Begin_Html
      84             :   /*
      85             :     <img src="picts/AliTPC.gif">
      86             :   */
      87             :   //End_Html
      88             :   //Begin_Html
      89             :   /*
      90             :     <img src="picts/AliTPCv0Tree.gif">
      91             :   */
      92             :   //End_Html
      93             : 
      94             :  //----------------------------------------------------------
      95             :   // This geometry is written using TGeo class
      96             :   // Firstly the shapes are defined, and only then the volumes
      97             :   // What is recognized by the MC are volumes
      98             :   //----------------------------------------------------------
      99             :   //
     100             :   //  tpc - this will be the mother volume
     101             :   //
     102             : 
     103             :   //
     104             :   // here I define a volume TPC
     105             :   // retrive the medium name with "TPC_" as a leading string
     106             :   //
     107           0 :   TGeoPcon *tpc = new TGeoPcon(0.,360.,30); //30 sections
     108             :   //
     109           0 :   tpc->DefineSection(0,-289.6,77.,278.);
     110           0 :   tpc->DefineSection(1,-262.1,77.,278.);
     111             :   //
     112           0 :   tpc->DefineSection(2,-262.1,83.1,278.);
     113           0 :   tpc->DefineSection(3,-260.,83.1,278.);
     114             :   //
     115           0 :   tpc->DefineSection(4,-260.,70.,278.);    
     116           0 :   tpc->DefineSection(5,-259.6,70.,278.);
     117             :   //
     118           0 :   tpc->DefineSection(6,-259.6,68.1,278.);
     119           0 :   tpc->DefineSection(7,-253.6,68.1,278.);
     120             :   //
     121           0 :   tpc->DefineSection(8,-253.6,67.88,278.);//hs
     122           0 :   tpc->DefineSection(9,-74.0,60.68,278.);// hs
     123             :   //
     124           0 :   tpc->DefineSection(10,-74.0,60.1,278.);
     125           0 :   tpc->DefineSection(11,-73.3,60.1,278.);
     126             :   //
     127           0 :   tpc->DefineSection(12,-73.3,56.9,278.); 
     128           0 :   tpc->DefineSection(13,-68.5,56.9,278.);
     129             :   //
     130           0 :   tpc->DefineSection(14,-68.5,60.,278.);
     131           0 :   tpc->DefineSection(15,-64.7,60.,278.);
     132             :   //
     133           0 :   tpc->DefineSection(16,-64.7,56.9,278.); 
     134           0 :   tpc->DefineSection(17,73.3,56.9,278.);
     135             :   //
     136           0 :   tpc->DefineSection(18,73.3,60.1,278.);
     137           0 :   tpc->DefineSection(19,74.0,60.1,278.);
     138             :   //
     139           0 :   tpc->DefineSection(20,74.0,60.68,278.);// hs
     140           0 :   tpc->DefineSection(21,253.6,65.38,278.);// hs
     141             :   //
     142           0 :   tpc->DefineSection(22,253.6,65.6,278.);
     143           0 :   tpc->DefineSection(23,259.6,65.6,278.);
     144             :   //
     145           0 :   tpc->DefineSection(24,259.6,70.0,278.);
     146           0 :   tpc->DefineSection(25,260.,70.0,278.);
     147             :   //
     148           0 :   tpc->DefineSection(26,260.,83.1,278.);
     149           0 :   tpc->DefineSection(27,262.1,83.1,278.);
     150             :   //
     151           0 :   tpc->DefineSection(28,262.1,77.,278);
     152           0 :   tpc->DefineSection(29,289.6,77.,278.);
     153             :   //
     154           0 :   TGeoMedium *m1 = gGeoManager->GetMedium("TPC_Air");
     155           0 :   TGeoVolume *v1 = new TGeoVolume("TPC_M",tpc,m1);
     156             :   //
     157             :   // drift volume - sensitive volume, extended beyond the
     158             :   // endcaps, because of the alignment
     159             :   //
     160           0 :   TGeoPcon *dvol = new TGeoPcon(0.,360.,6);
     161           0 :   dvol->DefineSection(0,-260.,74.5,264.4);
     162           0 :   dvol->DefineSection(1,-253.6,74.5,264.4);
     163             :   //
     164           0 :   dvol->DefineSection(2,-253.6,76.6774,258.);
     165           0 :   dvol->DefineSection(3,253.6,76.6774,258.); 
     166             :   //
     167           0 :   dvol->DefineSection(4,253.6,74.5,264.4);
     168           0 :   dvol->DefineSection(5,260.,74.5,264.4);
     169             :   //
     170           0 :   TGeoMedium *m5 = gGeoManager->GetMedium("TPC_DriftGasS1");
     171           0 :   TGeoVolume *v9 = new TGeoVolume("TPC_Drift",dvol,m5);
     172             :   //
     173           0 :   v1->AddNode(v9,1);
     174             :   //
     175             :   // outer insulator
     176             :   //
     177           0 :   TGeoPcon *tpco = new TGeoPcon(0.,360.,6); //insulator
     178             :   //
     179           0 :   tpco->DefineSection(0,-256.6,264.8,278.);
     180           0 :   tpco->DefineSection(1,-253.6,264.8,278.);
     181             :   //
     182           0 :   tpco->DefineSection(2,-253.6,258.,278.);
     183           0 :   tpco->DefineSection(3,250.6,258.,278.);
     184             :   //
     185           0 :   tpco->DefineSection(4,250.6,258.,275.5);
     186           0 :   tpco->DefineSection(5,253.6,258.,275.5);
     187             :   //
     188           0 :   TGeoMedium *m2 = gGeoManager->GetMedium("TPC_CO2");
     189           0 :   TGeoVolume *v2 = new TGeoVolume("TPC_OI",tpco,m2);
     190             :   //
     191             :   // outer containment vessel
     192             :   //
     193           0 :   TGeoPcon *tocv = new TGeoPcon(0.,360.,6);  // containment vessel
     194             :   //
     195           0 :   tocv->DefineSection(0,-256.6,264.8,278.);
     196           0 :   tocv->DefineSection(1,-253.6,264.8,278.);
     197             :   //
     198           0 :   tocv->DefineSection(2,-253.6,274.8124,278.);
     199           0 :   tocv->DefineSection(3,247.6,274.8124,278.);  
     200             :   //
     201           0 :   tocv->DefineSection(4,247.6,270.4,278.);
     202           0 :   tocv->DefineSection(5,250.6,270.4,278.);
     203             :   //
     204           0 :   TGeoMedium *m3 = gGeoManager->GetMedium("TPC_Al");
     205           0 :   TGeoVolume *v3 = new TGeoVolume("TPC_OCV",tocv,m3); 
     206             :   //
     207           0 :   TGeoTube *to1 = new TGeoTube(274.8174,277.995,252.1); //epoxy
     208           0 :   TGeoTube *to2 = new TGeoTube(274.8274,277.985,252.1); //tedlar
     209           0 :   TGeoTube *to3 = new TGeoTube(274.8312,277.9812,252.1);//prepreg2
     210           0 :   TGeoTube *to4 = new TGeoTube(274.9062,277.9062,252.1);//nomex
     211             :   //
     212           0 :   TGeoMedium *sm1 = gGeoManager->GetMedium("TPC_Epoxy");
     213           0 :   TGeoMedium *sm2 = gGeoManager->GetMedium("TPC_Tedlar");
     214           0 :   TGeoMedium *sm3 = gGeoManager->GetMedium("TPC_Prepreg2");
     215           0 :   TGeoMedium *sm4 = gGeoManager->GetMedium("TPC_Nomex");
     216             :   //
     217             :   //
     218           0 :   TGeoVolume *tov1 = new TGeoVolume("TPC_OCV1",to1,sm1);
     219           0 :   TGeoVolume *tov2 = new TGeoVolume("TPC_OCV2",to2,sm2);
     220           0 :   TGeoVolume *tov3 = new TGeoVolume("TPC_OCV3",to3,sm3);
     221           0 :   TGeoVolume *tov4 = new TGeoVolume("TPC_OCV4",to4,sm4);
     222           0 :   TGeoMedium *mhs = gGeoManager->GetMedium("TPC_Steel");
     223           0 :   TGeoMedium *m12 =  gGeoManager->GetMedium("TPC_Water");
     224             :   //-------------------------------------------------------
     225             :   //  Tpc Outer Field Cage
     226             :   //  daughters - composite (sandwich)
     227             :   //-------------------------------------------------------
     228             : 
     229           0 :   TGeoPcon *tofc = new TGeoPcon(0.,360.,6);
     230             :   //
     231           0 :   tofc->DefineSection(0,-253.6,258.,269.6);
     232           0 :   tofc->DefineSection(1,-250.6,258.,269.6);
     233             :   //
     234           0 :   tofc->DefineSection(2,-250.6,258.,260.0676); 
     235           0 :   tofc->DefineSection(3,250.6,258.,260.0676);
     236             :   //
     237           0 :   tofc->DefineSection(4,250.6,258.,275.5);
     238           0 :   tofc->DefineSection(5,253.6,258.,275.5);
     239             :   //
     240           0 :   TGeoVolume *v4 = new TGeoVolume("TPC_TOFC",tofc,m3); 
     241             :   //sandwich
     242           0 :   TGeoTube *tf1 = new TGeoTube(258.0,260.0676,252.1); //tedlar
     243           0 :   TGeoTube *tf2 = new TGeoTube(258.0038,260.0638,252.1); //prepreg3
     244           0 :   TGeoTube *tf3 = new TGeoTube(258.0338,260.0338,252.1);//nomex
     245             :   //
     246           0 :   TGeoMedium *sm5 = gGeoManager->GetMedium("TPC_Prepreg3");
     247             :   //
     248           0 :   TGeoVolume *tf1v = new TGeoVolume("TPC_OFC1",tf1,sm2);
     249           0 :   TGeoVolume *tf2v = new TGeoVolume("TPC_OFC2",tf2,sm5);
     250           0 :   TGeoVolume *tf3v = new TGeoVolume("TPC_OFC3",tf3,sm4);
     251             :   //
     252             :   // outer part - positioning
     253             :   //
     254           0 :   tov1->AddNode(tov2,1); tov2->AddNode(tov3,1); tov3->AddNode(tov4,1);
     255             :   //
     256           0 :   tf1v->AddNode(tf2v,1); tf2v->AddNode(tf3v,1);
     257             :   //
     258           0 :   v3->AddNode(tov1,1,new TGeoTranslation(0.,0.,-1.5)); v4->AddNode(tf1v,1);
     259             :   //
     260           0 :   v2->AddNode(v3,1); v2->AddNode(v4,1); 
     261             :   //
     262           0 :   v1->AddNode(v2,1);
     263             :   //-----------------------------------------------------------
     264             :   //--------------------------------------------------------------------
     265             :   // Tpc Inner INsulator (CO2) 
     266             :   // the cones, the central drum and the inner f.c. sandwich with a piece
     267             :   // of the flane will be placed in the TPC
     268             :   //--------------------------------------------------------------------
     269           0 :   TGeoPcon *tpci = new TGeoPcon(0.,360.,4);
     270             :   //
     271           0 :   tpci->DefineSection(0,-253.6,68.4,76.6774);
     272           0 :   tpci->DefineSection(1,-74.0,61.2,76.6774);
     273             :   //
     274           0 :   tpci->DefineSection(2,74.0,61.2,76.6774);  
     275             :   //
     276           0 :   tpci->DefineSection(3,253.6,65.9,76.6774);
     277             :   //
     278           0 :   TGeoVolume *v5 = new TGeoVolume("TPC_INI",tpci,m2);
     279             :   //
     280             :   // now the inner field cage - only part of flanges (2 copies)
     281             :   //
     282           0 :   TGeoTube *tif1 = new TGeoTube(69.9,76.6774,1.5); 
     283           0 :   TGeoVolume *v6 = new TGeoVolume("TPC_IFC1",tif1,m3);
     284             :   //
     285             :  //---------------------------------------------------------
     286             :   // Tpc Inner Containment vessel - Muon side
     287             :   //---------------------------------------------------------
     288           0 :   TGeoPcon *tcms = new TGeoPcon(0.,360.,10);
     289             :   //
     290           0 :   tcms->DefineSection(0,-259.1,68.1,74.2);
     291           0 :   tcms->DefineSection(1,-253.6,68.1,74.2);
     292             :   //
     293           0 :   tcms->DefineSection(2,-253.6,68.1,68.4);
     294           0 :   tcms->DefineSection(3,-74.0,60.9,61.2);
     295             :   //
     296           0 :   tcms->DefineSection(4,-74.0,60.1,61.2);
     297           0 :   tcms->DefineSection(5,-73.3,60.1,61.2);
     298             :   //
     299           0 :   tcms->DefineSection(6,-73.3,56.9,61.2);
     300           0 :   tcms->DefineSection(7,-73.0,56.9,61.2);
     301             :   //
     302           0 :   tcms->DefineSection(8,-73.0,56.9,58.8);
     303           0 :   tcms->DefineSection(9,-71.3,56.9,58.8);
     304             :   //
     305           0 :   TGeoVolume *v7 = new TGeoVolume("TPC_ICVM",tcms,m3);
     306             :   //------------------------------------------------
     307             :   //  Heat screen muon side
     308             :   //------------------------------------------------
     309             :  
     310           0 :   TGeoCone *thsm = new TGeoCone(89.8,67.88,68.1,60.68,60.9);
     311           0 :   TGeoCone *thsmw = new TGeoCone(89.8,67.94,68.04,60.74,60.84);
     312           0 :   TGeoVolume *hvsm = new TGeoVolume("TPC_HSM",thsm,mhs); //steel
     313           0 :   TGeoVolume *hvsmw = new TGeoVolume("TPC_HSMW",thsmw,m12); //water 
     314             :   // assembly heat screen muon
     315           0 :   hvsm->AddNode(hvsmw,1);
     316             :   //-----------------------------------------------
     317             :   // inner containment vessel - shaft side
     318             :   //-----------------------------------------------
     319           0 :   TGeoPcon *tcss = new TGeoPcon(0.,360.,10);
     320             :   //
     321           0 :   tcss->DefineSection(0,71.3,56.9,58.8);
     322           0 :   tcss->DefineSection(1,73.0,56.9,58.8);
     323             :   //
     324           0 :   tcss->DefineSection(2,73.0,56.9,61.2);
     325           0 :   tcss->DefineSection(3,73.3,56.9,61.2);
     326             :   //  
     327           0 :   tcss->DefineSection(4,73.3,60.1,61.2);
     328           0 :   tcss->DefineSection(5,74.0,60.1,61.2);
     329             :   //
     330           0 :   tcss->DefineSection(6,74.0,60.9,61.2);
     331           0 :   tcss->DefineSection(7,253.6,65.6,65.9);
     332             :   //
     333           0 :   tcss->DefineSection(8,253.6,65.6,74.2);
     334           0 :   tcss->DefineSection(9,258.1,65.6,74.2);
     335             :   //
     336           0 :   TGeoVolume *v8 = new TGeoVolume("TPC_ICVS",tcss,m3);
     337             :   //-------------------------------------------------
     338             :   //  Heat screen shaft side
     339             :   //--------------------------------------------------
     340           0 :   TGeoCone *thss = new TGeoCone(89.8,60.68,60.9,65.38,65.6);       
     341           0 :   TGeoCone *thssw = new TGeoCone(89.8,60.74,60.84,65.44,65.54);     
     342           0 :   TGeoVolume *hvss = new TGeoVolume("TPC_HSS",thss,mhs); //steel
     343           0 :   TGeoVolume *hvssw = new TGeoVolume("TPC_HSSW",thssw,m12); //water 
     344             :   //assembly heat screen shaft
     345           0 :   hvss->AddNode(hvssw,1);
     346             :   //-----------------------------------------------
     347             :   //  Inner field cage
     348             :   //  define 4 parts and make an assembly
     349             :   //-----------------------------------------------
     350             :   // part1 - Al - 2 copies
     351           0 :   TGeoTube *t1 = new TGeoTube(76.6774,78.845,0.75);
     352           0 :   TGeoVolume *tv1 = new TGeoVolume("TPC_IFC2",t1,m3);
     353             :   // sandwich - outermost parts - 2 copies
     354           0 :   TGeoTube *t2 = new TGeoTube(76.6774,78.845,74.175); // tedlar 38 microns
     355           0 :   TGeoTube *t3 = new TGeoTube(76.6812,78.8412,74.175); // prepreg2 500 microns
     356           0 :   TGeoTube *t4 = new TGeoTube(76.7312,78.7912,74.175); // prepreg3 300 microns
     357           0 :   TGeoTube *t5 = new TGeoTube(76.7612,78.7612,74.175); // nomex 2 cm
     358             :   //
     359           0 :   TGeoVolume *tv2 = new TGeoVolume("TPC_IFC3",t2,sm2);
     360           0 :   TGeoVolume *tv3 = new TGeoVolume("TPC_IFC4",t3,sm3);
     361           0 :   TGeoVolume *tv4 = new TGeoVolume("TPC_IFC5",t4,sm5);
     362           0 :   TGeoVolume *tv5 = new TGeoVolume("TPC_IFC6",t5,sm4);
     363             :   //
     364             :   // middle parts - 2 copies
     365           0 :   TGeoTube *t6 = new TGeoTube(76.6774,78.795,5.); // tedlar 38 microns
     366           0 :   TGeoTube *t7 = new TGeoTube(76.6812,78.7912,5.); // prepreg2 250 microns
     367           0 :   TGeoTube *t8 = new TGeoTube(76.7062,78.7662,5.); // prepreg3 300 microns
     368           0 :   TGeoTube *t9 = new TGeoTube(76.7362,78.7362,5.); // nomex 2 cm
     369             :   //
     370           0 :   TGeoVolume *tv6 = new TGeoVolume("TPC_IFC7",t6,sm2);
     371           0 :   TGeoVolume *tv7 = new TGeoVolume("TPC_IFC8",t7,sm3);
     372           0 :   TGeoVolume *tv8 = new TGeoVolume("TPC_IFC9",t8,sm5);
     373           0 :   TGeoVolume *tv9 = new TGeoVolume("TPC_IFC10",t9,sm4);
     374             :   // central part - 1 copy
     375           0 :   TGeoTube *t10 = new TGeoTube(76.6774,78.745,93.75); // tedlar 38 microns 
     376           0 :   TGeoTube *t11 = new TGeoTube(76.6812,78.7412,93.75); // prepreg3 300 microns
     377           0 :   TGeoTube *t12 = new TGeoTube(76.7112,78.7112,93.75); // nomex 2 cm
     378             :   //
     379           0 :   TGeoVolume *tv10 = new TGeoVolume("TPC_IFC11",t10,sm2);
     380           0 :   TGeoVolume *tv11 = new TGeoVolume("TPC_IFC12",t11,sm5);
     381           0 :   TGeoVolume *tv12 = new TGeoVolume("TPC_IFC13",t12,sm4);
     382             :   //
     383             :   // inner part - positioning
     384             :   //
     385             :   // creating a sandwich
     386           0 :   tv2->AddNode(tv3,1); tv3->AddNode(tv4,1); tv4->AddNode(tv5,1);
     387             :   //
     388           0 :   tv6->AddNode(tv7,1); tv7->AddNode(tv8,1); tv8->AddNode(tv9,1);
     389             :   //
     390           0 :   tv10->AddNode(tv11,1); tv11->AddNode(tv12,1);
     391             :   //
     392           0 :   TGeoVolumeAssembly *tv100 = new TGeoVolumeAssembly("TPC_IFC");
     393             :   //
     394           0 :   tv100->AddNode(tv10,1);
     395           0 :   tv100->AddNode(tv6,1,new TGeoTranslation(0.,0.,-98.75));
     396           0 :   tv100->AddNode(tv6,2,new TGeoTranslation(0.,0.,98.75));
     397           0 :   tv100->AddNode(tv2,1,new TGeoTranslation(0.,0.,-177.925));
     398           0 :   tv100->AddNode(tv2,2,new TGeoTranslation(0.,0.,177.925));
     399           0 :   tv100->AddNode(tv1,1,new TGeoTranslation(0.,0.,-252.85));
     400           0 :   tv100->AddNode(tv1,2,new TGeoTranslation(0.,0.,252.85));
     401             :   //
     402           0 :   v5->AddNode(v6,1, new TGeoTranslation(0.,0.,-252.1));
     403           0 :   v5->AddNode(v6,2, new TGeoTranslation(0.,0.,252.1));
     404           0 :   v1->AddNode(v5,1); v1->AddNode(v7,1); v1->AddNode(v8,1); 
     405           0 :   v1->AddNode(hvsm,1,new TGeoTranslation(0.,0.,-163.8)); 
     406           0 :   v1->AddNode(hvss,1,new TGeoTranslation(0.,0.,163.8)); 
     407           0 :   v9->AddNode(tv100,1);
     408             :   //
     409             :   // central drum 
     410             :   //
     411             :   // flange + sandwich
     412             :   //
     413           0 :   TGeoPcon *cfl = new TGeoPcon(0.,360.,6);
     414           0 :   cfl->DefineSection(0,-71.1,59.7,61.2);
     415           0 :   cfl->DefineSection(1,-68.6,59.7,61.2);
     416             :   //
     417           0 :   cfl->DefineSection(2,-68.6,60.6324,61.2);
     418           0 :   cfl->DefineSection(3,68.6,60.6324,61.2); 
     419             :   //
     420           0 :   cfl->DefineSection(4,68.6,59.7,61.2);
     421           0 :   cfl->DefineSection(5,71.1,59.7,61.2);  
     422             :   //
     423           0 :   TGeoVolume *cflv = new TGeoVolume("TPC_CDR",cfl,m3);
     424             :   // sandwich
     425           0 :   TGeoTube *cd1 = new TGeoTube(60.6424,61.19,71.1);
     426           0 :   TGeoTube *cd2 = new TGeoTube(60.6462,61.1862,71.1);
     427           0 :   TGeoTube *cd3 = new TGeoTube(60.6662,61.1662,71.1);  
     428             :   //
     429           0 :   TGeoMedium *sm6 = gGeoManager->GetMedium("TPC_Prepreg1");
     430           0 :   TGeoVolume *cd1v = new TGeoVolume("TPC_CDR1",cd1,sm2); //tedlar
     431           0 :   TGeoVolume *cd2v = new TGeoVolume("TPC_CDR2",cd2,sm6);// prepreg1
     432           0 :   TGeoVolume *cd3v = new TGeoVolume("TPC_CDR3",cd3,sm4); //nomex
     433             :   //
     434             :   // seals for central drum 2 copies
     435             :   //
     436           0 :   TGeoTube *cs = new TGeoTube(56.9,61.2,0.1);
     437           0 :   TGeoMedium *sm7 = gGeoManager->GetMedium("TPC_Mylar");
     438           0 :   TGeoVolume *csv = new TGeoVolume("TPC_CDRS",cs,sm7);
     439           0 :   v1->AddNode(csv,1,new TGeoTranslation(0.,0.,-71.2));
     440           0 :   v1->AddNode(csv,2,new TGeoTranslation(0.,0.,71.2));
     441             :   //
     442             :   // seal collars 
     443           0 :   TGeoPcon *se = new TGeoPcon(0.,360.,6);
     444           0 :   se->DefineSection(0,-72.8,59.7,61.2);
     445           0 :   se->DefineSection(1,-72.3,59.7,61.2);
     446             :   //
     447           0 :   se->DefineSection(2,-72.3,58.85,61.2);
     448           0 :   se->DefineSection(3,-71.6,58.85,61.2); 
     449             :   //
     450           0 :   se->DefineSection(4,-71.6,59.7,61.2);
     451           0 :   se->DefineSection(5,-71.3,59.7,61.2);  
     452             :   //
     453           0 :   TGeoVolume *sev = new TGeoVolume("TPC_CDCE",se,m3);
     454             :   //
     455           0 :   TGeoTube *si = new TGeoTube(56.9,58.8,1.); 
     456           0 :   TGeoVolume *siv = new TGeoVolume("TPC_CDCI",si,m3);
     457             :   //
     458             :   // define reflection matrix 
     459             :   //
     460           0 :   TGeoRotation *ref = new TGeoRotation("ref",90.,0.,90.,90.,180.,0.);
     461             :   //
     462           0 :   cd1v->AddNode(cd2v,1); cd2v->AddNode(cd3v,1); cflv->AddNode(cd1v,1);
     463             :   //
     464           0 :   v1->AddNode(siv,1,new TGeoTranslation(0.,0.,-69.9));
     465           0 :   v1->AddNode(siv,2,new TGeoTranslation(0.,0.,69.9));
     466           0 :   v1->AddNode(sev,1); v1->AddNode(sev,2,ref); v1->AddNode(cflv,1);
     467             :   //
     468             :   // central membrane - 2 rings and a mylar membrane - assembly
     469             :   //
     470           0 :   TGeoTube *ih = new TGeoTube(81.05,84.05,0.3);
     471           0 :   TGeoTube *oh = new TGeoTube(250.,256.,.5);
     472           0 :   TGeoTube *mem = new TGeoTube(84.05,250,0.01);
     473           0 :   TGeoVolume *ihv = new TGeoVolume("TPC_IHVH",ih,m3);
     474           0 :   TGeoVolume *ohv = new TGeoVolume("TPC_OHVH",oh,m3);
     475           0 :   TGeoVolume *memv = new TGeoVolume("TPC_HV",mem,sm7);
     476             :   //
     477           0 :   TGeoVolumeAssembly *cm = new TGeoVolumeAssembly("TPC_HVMEM");
     478           0 :   cm->AddNode(ihv,1);
     479           0 :   cm->AddNode(ohv,1);
     480           0 :   cm->AddNode(memv,1);
     481           0 :   v9->AddNode(cm,1);
     482             :   //
     483             :   // end caps - they are make as an assembly of single segments
     484             :   // containing both readout chambers
     485             :   //
     486           0 :   Double_t openingAngle = 10.*TMath::DegToRad();
     487             :   Double_t thick=1.5; // rib
     488           0 :   Double_t shift = thick/TMath::Sin(openingAngle);
     489             :   //
     490             :   Double_t lowEdge = 86.3; // hole in the wheel
     491             :   Double_t upEdge = 240.4; // hole in the wheel
     492             :   //
     493           0 :   new TGeoTubeSeg("sec",74.5,264.4,3.,0.,20.);
     494             :   //
     495           0 :   TGeoPgon *hole = new TGeoPgon("hole",0.,20.,1,4);
     496             :   //
     497           0 :   hole->DefineSection(0,-3.5,lowEdge-shift,upEdge-shift);
     498           0 :   hole->DefineSection(1,-1.5,lowEdge-shift,upEdge-shift);
     499             :   //
     500           0 :   hole->DefineSection(2,-1.5,lowEdge-shift,upEdge+3.-shift);
     501           0 :   hole->DefineSection(3,3.5,lowEdge-shift,upEdge+3.-shift);
     502             :   //
     503           0 :   Double_t ys = shift*TMath::Sin(openingAngle); 
     504           0 :   Double_t xs = shift*TMath::Cos(openingAngle);
     505           0 :   TGeoTranslation *tr = new TGeoTranslation("tr",xs,ys,0.);  
     506           0 :   tr->RegisterYourself();
     507           0 :   TGeoCompositeShape *chamber = new TGeoCompositeShape("sec-hole:tr");
     508           0 :   TGeoVolume *sv = new TGeoVolume("TPC_WSEG",chamber,m3);
     509           0 :   TGeoPgon *bar = new TGeoPgon("bar",0.,20.,1,2);
     510           0 :   bar->DefineSection(0,-3.,131.5-shift,136.5-shift);
     511           0 :   bar->DefineSection(1,1.5,131.5-shift,136.5-shift);
     512           0 :   TGeoVolume *barv = new TGeoVolume("TPC_WBAR",bar,m3);
     513           0 :   TGeoVolumeAssembly *ch = new TGeoVolumeAssembly("TPC_WCH");//empty segment
     514             :   //
     515           0 :   ch->AddNode(sv,1); ch->AddNode(barv,1,tr);
     516             :   //
     517             :   // readout chambers
     518             :   //
     519             :   // IROC first
     520             :   //
     521           0 :    TGeoTrd1 *ibody = new TGeoTrd1(13.8742,21.3328,4.29,21.15);
     522           0 :    TGeoVolume *ibdv = new TGeoVolume("TPC_IROCB",ibody,m3);
     523             :   // empty space
     524           0 :    TGeoTrd1 *emp = new TGeoTrd1(12.3742,19.8328,3.99,19.65);
     525           0 :    TGeoVolume *empv = new TGeoVolume("TPC_IROCE",emp,m1);
     526           0 :    ibdv->AddNode(empv,1,new TGeoTranslation(0.,-0.3,0.));
     527             :    //bars
     528             :    Double_t tga = (19.8328-12.3742)/39.3;
     529             :    Double_t xmin,xmax;
     530             :    xmin = 9.55*tga+12.3742;
     531             :    xmax = 9.95*tga+12.3742;
     532           0 :    TGeoTrd1 *ib1 = new TGeoTrd1(xmin,xmax,3.29,0.2);
     533           0 :    TGeoVolume *ib1v = new TGeoVolume("TPC_IRB1",ib1,m3);
     534           0 :    empv->AddNode(ib1v,1,new TGeoTranslation("tt1",0.,0.7,-9.9));
     535             :    xmin=19.4*tga+12.3742;
     536             :    xmax=19.9*tga+12.3742;
     537           0 :    TGeoTrd1 *ib2 = new TGeoTrd1(xmin,xmax,3.29,0.25);
     538           0 :    TGeoVolume *ib2v = new TGeoVolume("TPC_TRB2",ib2,m3);
     539           0 :    empv->AddNode(ib2v,1,new TGeoTranslation(0.,0.7,0.));
     540             :    xmin=29.35*tga+12.3742;
     541             :    xmax=29.75*tga+12.3742;
     542           0 :    TGeoTrd1 *ib3 = new TGeoTrd1(xmin,xmax,3.29,0.2); 
     543           0 :    TGeoVolume *ib3v = new TGeoVolume("TPC_IRB3",ib3,m3);    
     544           0 :    empv->AddNode(ib3v,1,new TGeoTranslation(0.,0.7,9.9));
     545             :    //
     546             :    // holes for connectors
     547             :    //
     548           0 :    TGeoBBox *conn = new TGeoBBox(0.4,0.3,4.675); // identical for iroc and oroc
     549           0 :    TGeoVolume *connv = new TGeoVolume("TPC_RCCON",conn,m1);
     550           0 :    TString fileName(gSystem->Getenv("ALICE_ROOT"));
     551           0 :    fileName += "/TPC/conn_iroc.dat";
     552           0 :    ifstream in;
     553           0 :    in.open(fileName.Data(), ios_base::in); // asci file
     554           0 :    for(Int_t i =0;i<86;i++){
     555             :       Double_t y = 3.99;
     556           0 :       Double_t x,z,ang;
     557           0 :       in>>x>>z>>ang;
     558           0 :       z-=26.5;
     559           0 :       TGeoRotation *rrr = new TGeoRotation();
     560           0 :       rrr->RotateY(ang);
     561           0 :       TGeoCombiTrans *trans = new TGeoCombiTrans("trans",x,y,z,rrr);
     562           0 :       ibdv->AddNode(connv,i+1,trans);
     563           0 :    }
     564           0 :    in.close();
     565             :    // "cap"
     566           0 :    new TGeoTrd1("icap",14.5974,23.3521,1.19,24.825);
     567             :    // "hole"
     568           0 :    new TGeoTrd1("ihole",13.8742,21.3328,1.2,21.15);
     569           0 :    TGeoTranslation *tr1 = new TGeoTranslation("tr1",0.,0.,1.725);  
     570           0 :    tr1->RegisterYourself();
     571           0 :    TGeoCompositeShape *ic = new TGeoCompositeShape("icap-ihole:tr1");
     572           0 :    TGeoVolume *icv = new TGeoVolume("TPC_IRCAP",ic,m3);
     573             :    //
     574             :    // pad plane and wire fixations
     575             :    //
     576           0 :    TGeoTrd1 *pp = new TGeoTrd1(14.5974,23.3521,0.3,24.825); //pad+iso
     577           0 :    TGeoMedium *m4 = gGeoManager->GetMedium("TPC_G10");
     578           0 :    TGeoVolume *ppv = new TGeoVolume("TPC_IRPP",pp,m4);
     579           0 :    TGeoPara *f1 = new TGeoPara(.6,.5,24.825,0.,-10.,0.);
     580           0 :    TGeoVolume *f1v = new TGeoVolume("TPC_IRF1",f1,m4);
     581           0 :    TGeoPara *f2 = new TGeoPara(.6,.5,24.825,0.,10.,0.);
     582           0 :    TGeoVolume *f2v = new TGeoVolume("TPC_IRF2",f2,m4);
     583             :    //
     584           0 :    TGeoVolumeAssembly *iroc = new TGeoVolumeAssembly("TPC_IROC");
     585             :    //
     586           0 :    iroc->AddNode(ibdv,1);
     587           0 :    iroc->AddNode(icv,1,new TGeoTranslation(0.,3.1,-1.725));
     588           0 :    iroc->AddNode(ppv,1,new TGeoTranslation(0.,4.59,-1.725));
     589             :    tga =(23.3521-14.5974)/49.65; 
     590             :    Double_t xx = 24.825*tga+14.5974-0.6;
     591           0 :    iroc->AddNode(f1v,1,new TGeoTranslation(-xx,5.39,-1.725));
     592           0 :    iroc->AddNode(f2v,1,new TGeoTranslation(xx,5.39,-1.725));
     593             :    //
     594             :    // OROC
     595             :    //
     596           0 :    TGeoTrd1 *obody = new TGeoTrd1(22.2938,40.5084,4.19,51.65);
     597           0 :    TGeoVolume *obdv = new TGeoVolume("TPC_OROCB",obody,m3);
     598           0 :    TGeoTrd1 *oemp = new TGeoTrd1(20.2938,38.5084,3.89,49.65);
     599           0 :    TGeoVolume *oempv = new TGeoVolume("TPC_OROCE",oemp,m1);
     600           0 :    obdv->AddNode(oempv,1,new TGeoTranslation(0.,-0.3,0.));
     601             :    //horizontal bars
     602             :    tga=(38.5084-20.2938)/99.3;
     603             :    xmin=tga*10.2+20.2938;
     604             :    xmax=tga*10.6+20.2938;
     605           0 :    TGeoTrd1 *ob1 = new TGeoTrd1(xmin,xmax,2.915,0.2);
     606           0 :    TGeoVolume *ob1v = new TGeoVolume("TPC_ORB1",ob1,m3);
     607             :    //
     608             :    xmin=22.55*tga+20.2938;
     609             :    xmax=24.15*tga+20.2938;
     610           0 :    TGeoTrd1 *ob2 = new TGeoTrd1(xmin,xmax,2.915,0.8);
     611           0 :    TGeoVolume *ob2v = new TGeoVolume("TPC_ORB2",ob2,m3);
     612             :    //
     613             :    xmin=36.1*tga+20.2938;
     614             :    xmax=36.5*tga+20.2938;
     615           0 :    TGeoTrd1 *ob3 = new TGeoTrd1(xmin,xmax,2.915,0.2);
     616           0 :    TGeoVolume *ob3v = new TGeoVolume("TPC_ORB3",ob3,m3);
     617             :    //
     618             :    xmin=49.0*tga+20.2938;
     619             :    xmax=50.6*tga+20.2938;   
     620           0 :    TGeoTrd1 *ob4 = new TGeoTrd1(xmin,xmax,2.915,0.8);
     621           0 :    TGeoVolume *ob4v = new TGeoVolume("TPC_ORB4",ob4,m3);
     622             :    //
     623             :    xmin=63.6*tga+20.2938;
     624             :    xmax=64.0*tga+20.2938;
     625           0 :    TGeoTrd1 *ob5 = new TGeoTrd1(xmin,xmax,2.915,0.2);
     626           0 :    TGeoVolume *ob5v = new TGeoVolume("TPC_ORB5",ob5,m3);
     627             :    //
     628             :    xmin=75.5*tga+20.2938;
     629             :    xmax=77.15*tga+20.2938;
     630           0 :    TGeoTrd1 *ob6 = new TGeoTrd1(xmin,xmax,2.915,0.8);
     631           0 :    TGeoVolume *ob6v = new TGeoVolume("TPC_ORB6",ob6,m3);
     632             :    //
     633             :    xmin=88.7*tga+20.2938;
     634             :    xmax=89.1*tga+20.2938;
     635           0 :    TGeoTrd1 *ob7 = new TGeoTrd1(xmin,xmax,2.915,0.2);
     636           0 :    TGeoVolume *ob7v = new TGeoVolume("TPC_ORB7",ob7,m3);
     637             :    //
     638           0 :    oempv->AddNode(ob1v,1,new TGeoTranslation(0.,0.975,-39.25));
     639           0 :    oempv->AddNode(ob2v,1,new TGeoTranslation(0.,0.975,-26.3));
     640           0 :    oempv->AddNode(ob3v,1,new TGeoTranslation(0.,0.975,-13.35));
     641           0 :    oempv->AddNode(ob4v,1,new TGeoTranslation(0.,0.975,0.15));
     642           0 :    oempv->AddNode(ob5v,1,new TGeoTranslation(0.,0.975,14.15));
     643           0 :    oempv->AddNode(ob6v,1,new TGeoTranslation(0.,0.975,26.7));
     644           0 :    oempv->AddNode(ob7v,1,new TGeoTranslation(0.,0.975,39.25));
     645             :    // vertical bars
     646           0 :    TGeoBBox *ob8 = new TGeoBBox(0.8,2.915,5.1); 
     647           0 :    TGeoBBox *ob9 = new TGeoBBox(0.8,2.915,5.975);
     648           0 :    TGeoBBox *ob10 = new TGeoBBox(0.8,2.915,5.775);
     649           0 :    TGeoBBox *ob11 = new TGeoBBox(0.8,2.915,6.25);
     650           0 :    TGeoBBox *ob12 = new TGeoBBox(0.8,2.915,6.5);
     651             :    //
     652           0 :    TGeoVolume *ob8v = new TGeoVolume("TPC_ORB8",ob8,m3);
     653           0 :    TGeoVolume *ob9v = new TGeoVolume("TPC_ORB9",ob9,m3);
     654           0 :    TGeoVolume *ob10v = new TGeoVolume("TPC_ORB10",ob10,m3);
     655           0 :    TGeoVolume *ob11v = new TGeoVolume("TPC_ORB11",ob11,m3);
     656           0 :    TGeoVolume *ob12v = new TGeoVolume("TPC_ORB12",ob12,m3);
     657             :    //
     658           0 :    oempv->AddNode(ob8v,1,new TGeoTranslation(0.,0.975,-44.55));
     659           0 :    oempv->AddNode(ob8v,2,new TGeoTranslation(0.,0.975,44.55));
     660           0 :    oempv->AddNode(ob9v,1,new TGeoTranslation(0.,0.975,-33.075));
     661           0 :    oempv->AddNode(ob9v,2,new TGeoTranslation(0.,0.975,-19.525));
     662           0 :    oempv->AddNode(ob10v,1,new TGeoTranslation(0.,0.975,20.125));
     663           0 :    oempv->AddNode(ob10v,2,new TGeoTranslation(0.,0.975,33.275));
     664           0 :    oempv->AddNode(ob11v,1,new TGeoTranslation(0.,0.975,-6.9));
     665           0 :    oempv->AddNode(ob12v,1,new TGeoTranslation(0.,0.975,7.45));
     666             :    //
     667             :    // holes for connectors
     668             :    //
     669           0 :    fileName = gSystem->Getenv("ALICE_ROOT");
     670           0 :    fileName += "/TPC/conn_oroc.dat";
     671           0 :    in.open(fileName.Data(), ios_base::in); // asci file
     672           0 :    for(Int_t i =0;i<78;i++){
     673             :       Double_t y =3.89;
     674           0 :       Double_t x,z,ang;
     675             :       Double_t x1,z1,x2,z2;
     676           0 :       in>>x>>z>>ang;        
     677           0 :       Double_t xr = 4.7*TMath::Sin(ang*TMath::DegToRad());
     678           0 :       Double_t zr = 4.7*TMath::Cos(ang*TMath::DegToRad());
     679             :       //
     680           0 :       x1=xr+x; x2=-xr+x; z1=zr+z; z2 = -zr+z;      
     681             :       //
     682           0 :       TGeoRotation *rr = new TGeoRotation();
     683           0 :       rr->RotateY(ang); 
     684           0 :       z1-=54.95;
     685           0 :       z2-=54.95;
     686           0 :       TGeoCombiTrans *trans1 = new TGeoCombiTrans("trans1",x1,y,z1,rr);
     687           0 :       TGeoCombiTrans *trans2 = new TGeoCombiTrans("trans2",x2,y,z2,rr);
     688           0 :       obdv->AddNode(connv,i+1,trans1);
     689           0 :       obdv->AddNode(connv,i+79,trans2);
     690           0 :    }
     691           0 :    in.close();
     692             :    // cap
     693           0 :    new TGeoTrd1("ocap",23.3874,43.5239,1.09,57.1);
     694           0 :    new TGeoTrd1("ohole",22.2938,40.5084,1.09,51.65);
     695           0 :    TGeoTranslation *tr5 = new TGeoTranslation("tr5",0.,0.,-2.15);
     696           0 :    tr5->RegisterYourself();
     697           0 :    TGeoCompositeShape *oc = new TGeoCompositeShape("ocap-ohole:tr5");
     698           0 :    TGeoVolume *ocv = new TGeoVolume("TPC_ORCAP",oc,m3);
     699             :    //
     700             :    // pad plane and wire fixations
     701             :    //
     702           0 :    TGeoTrd1 *opp = new TGeoTrd1(23.3874,43.5239,0.3,57.1);
     703           0 :    TGeoVolume *oppv = new TGeoVolume("TPC_ORPP",opp,m4);
     704             :    //
     705             :    tga=(43.5239-23.3874)/114.2;
     706           0 :    TGeoPara *f3 = new TGeoPara(.7,.6,57.1,0.,-10.,0.);
     707           0 :    TGeoPara *f4 = new TGeoPara(.7,.6,57.1,0.,10.,0.);  
     708             :    xx = 57.1*tga+23.3874-0.7;
     709           0 :    TGeoVolume *f3v = new TGeoVolume("TPC_ORF1",f3,m4);
     710           0 :    TGeoVolume *f4v = new TGeoVolume("TPC_ORF2",f4,m4);
     711             :    //
     712           0 :    TGeoVolumeAssembly *oroc = new TGeoVolumeAssembly("TPC_OROC");
     713             :    //
     714           0 :    oroc->AddNode(obdv,1);
     715           0 :    oroc->AddNode(ocv,1,new TGeoTranslation(0.,3.1,2.15));
     716           0 :    oroc->AddNode(oppv,1,new TGeoTranslation(0.,4.49,2.15));
     717           0 :    oroc->AddNode(f3v,1,new TGeoTranslation(-xx,5.39,2.15));
     718           0 :    oroc->AddNode(f4v,1,new TGeoTranslation(xx,5.39,2.15));
     719             :    // 
     720             :    // now iroc and oroc are placed into a sector...
     721             :    //
     722           0 :    TGeoVolumeAssembly *secta = new TGeoVolumeAssembly("TPC_SECT"); // a-side
     723           0 :    TGeoVolumeAssembly *sectc = new TGeoVolumeAssembly("TPC_SECT"); // c-side
     724             :    //
     725             : 
     726           0 :    TGeoRotation rot1("rot1",90.,90.,0.);
     727           0 :    TGeoRotation rot2("rot2");
     728           0 :    rot2.RotateY(10.);
     729           0 :    TGeoRotation *rot = new TGeoRotation("rot");
     730           0 :    *rot=rot1*rot2;
     731             :    //
     732             :    Double_t x0,y0;
     733           0 :    x0=110.2*TMath::Cos(openingAngle);
     734           0 :    y0=110.2*TMath::Sin(openingAngle);
     735           0 :    TGeoCombiTrans *combi1a = new TGeoCombiTrans("combi1",x0,y0,1.09+0.195,rot); //a-side 
     736           0 :    TGeoCombiTrans *combi1c = new TGeoCombiTrans("combi1",x0,y0,1.09+0.222,rot); //c-side
     737           0 :    x0=188.45*TMath::Cos(openingAngle);
     738           0 :    y0=188.45*TMath::Sin(openingAngle);
     739           0 :    TGeoCombiTrans *combi2a = new TGeoCombiTrans("combi2",x0,y0,0.99+0.195,rot); //a-side
     740           0 :    TGeoCombiTrans *combi2c = new TGeoCombiTrans("combi2",x0,y0,0.99+0.222,rot); //c-side
     741             :    //
     742             :    // A-side
     743             :    //
     744           0 :    secta->AddNode(ch,1);
     745           0 :    secta->AddNode(iroc,1,combi1a);
     746           0 :    secta->AddNode(oroc,1,combi2a);
     747             :    //
     748             :    // C-side
     749             :    //
     750           0 :    sectc->AddNode(ch,1);
     751           0 :    sectc->AddNode(iroc,1,combi1c);
     752           0 :    sectc->AddNode(oroc,1,combi2c);
     753             :    //
     754             :    // now I try to make  wheels...
     755             :    //
     756           0 :    TGeoVolumeAssembly *wheela = new TGeoVolumeAssembly("TPC_ENDCAP");
     757           0 :    TGeoVolumeAssembly *wheelc = new TGeoVolumeAssembly("TPC_ENDCAP");
     758             :    //
     759           0 :    for(Int_t i =0;i<18;i++){
     760           0 :      Double_t phi = (20.*i);
     761           0 :      TGeoRotation *r = new TGeoRotation();
     762           0 :      r->RotateZ(phi);
     763           0 :      wheela->AddNode(secta,i+1,r);
     764           0 :      wheelc->AddNode(sectc,i+1,r);    
     765             :    }
     766             :    // wheels in the drift volume!
     767           0 :    TGeoCombiTrans *combi3 = new TGeoCombiTrans("combi3",0.,0.,256.6,ref);
     768           0 :    v9->AddNode(wheela,1,combi3);
     769           0 :    v9->AddNode(wheelc,2,new TGeoTranslation(0.,0.,-256.6));
     770             :    //_____________________________________________________________
     771             :    // service support wheel
     772             :    //_____________________________________________________________
     773           0 :   TGeoPgon *sw = new TGeoPgon(0.,20.,1,2);
     774           0 :   sw->DefineSection(0,-4.,80.5,251.75);
     775           0 :   sw->DefineSection(1,4.,80.5,251.75); 
     776           0 :   TGeoVolume *swv = new TGeoVolume("TPC_SWSEG",sw,m3); //Al
     777             :   //
     778             :   thick=1.;
     779           0 :   shift = thick/TMath::Sin(openingAngle);
     780           0 :   TGeoPgon *sh = new TGeoPgon(0.,20.,1,2);
     781           0 :   sh->DefineSection(0,-4.,81.5-shift,250.75-shift);
     782           0 :   sh->DefineSection(1,4.,81.5-shift,250.75-shift);
     783           0 :   TGeoVolume *shv = new TGeoVolume("TPC_SWS1",sh,m1); //Air
     784             :   //
     785           0 :   TGeoMedium *m9 =  gGeoManager->GetMedium("TPC_Si"); 
     786           0 :   TGeoPgon *el = new TGeoPgon(0.,20.,1,2);
     787           0 :   el->DefineSection(0,-1.872,81.5-shift,250.75-shift);
     788           0 :   el->DefineSection(1,1.872,81.5-shift,250.75-shift);
     789           0 :   TGeoVolume *elv = new TGeoVolume("TPC_ELEC",el,m9); //Si 
     790             :   //
     791           0 :   shv->AddNode(elv,1);
     792             :   //
     793             :   //
     794           0 :   ys = shift*TMath::Sin(openingAngle);
     795           0 :   xs = shift*TMath::Cos(openingAngle);
     796           0 :   swv->AddNode(shv,1,new TGeoTranslation(xs,ys,0.));
     797             :   // cover
     798           0 :   TGeoPgon *co = new TGeoPgon(0.,20.,1,2);
     799           0 :   co->DefineSection(0,-0.5,77.,255.25);
     800           0 :   co->DefineSection(1,0.5,77.,255.25);
     801           0 :   TGeoVolume *cov = new TGeoVolume("TPC_SWC1",co,m3);//Al
     802             :   // hole in a cover
     803           0 :   TGeoPgon *coh = new TGeoPgon(0.,20.,1,2);
     804           0 :   shift=4./TMath::Sin(openingAngle);
     805           0 :   coh->DefineSection(0,-0.5,85.-shift,247.25-shift);
     806           0 :   coh->DefineSection(1,0.5,85.-shift,247.25-shift);  
     807             :   //
     808           0 :   TGeoVolume *cohv = new TGeoVolume("TPC_SWC2",coh,m1);
     809             :   //
     810           0 :   ys = shift*TMath::Sin(openingAngle);
     811           0 :   xs = shift*TMath::Cos(openingAngle);  
     812           0 :   cov->AddNode(cohv,1,new TGeoTranslation(xs,ys,0.));
     813             :   //
     814             :   // Sector as an Assembly
     815             :   //
     816           0 :   TGeoVolumeAssembly *swhs = new TGeoVolumeAssembly("TPC_SSWSEC");
     817           0 :   swhs->AddNode(swv,1);
     818           0 :   swhs->AddNode(cov,1,new TGeoTranslation(0.,0.,-4.5));
     819           0 :   swhs->AddNode(cov,2,new TGeoTranslation(0.,0.,4.5));
     820             :   //
     821             :   // SSW as an Assembly of sectors
     822             :   //
     823           0 :  TGeoVolumeAssembly *swheel = new TGeoVolumeAssembly("TPC_SSWHEEL");
     824           0 :    for(Int_t i =0;i<18;i++){
     825           0 :      Double_t phi = (20.*i);
     826           0 :      TGeoRotation *r = new TGeoRotation();
     827           0 :      r->RotateZ(phi);
     828           0 :      swheel->AddNode(swhs,i+1,r);   
     829             :    }
     830           0 :    v1->AddNode(swheel,1,new TGeoTranslation(0.,0.,-284.6));
     831           0 :    v1->AddNode(swheel,2,new TGeoTranslation(0.,0.,284.6));
     832             :    //
     833             :   //----------------------------------------------------------
     834             :   // TPc Support Rods - MAKROLON
     835             :   //----------------------------------------------------------
     836           0 :   TGeoMedium *m6=gGeoManager->GetMedium("TPC_Makrolon");
     837           0 :   TGeoMedium *m7=gGeoManager->GetMedium("TPC_Cu");
     838           0 :   TGeoMedium *m10 =  gGeoManager->GetMedium("TPC_Alumina");
     839           0 :   TGeoMedium *m11 =  gGeoManager->GetMedium("TPC_Peek");
     840           0 :   TGeoMedium *m13 = gGeoManager->GetMedium("TPC_Brass");
     841           0 :   TGeoMedium *m14 = gGeoManager->GetMedium("TPC_Alumina1");
     842             :   // 
     843             :   // tpc rod is an assembly of 10 long parts and 2 short parts
     844             :   // connected with alu rings and plagged on both sides.
     845             :   //
     846             :   //
     847             : // tpc rod long
     848             : //
     849           0 :   TGeoPcon *rod = new TGeoPcon("rod",0.,360.,6);
     850           0 :  rod->DefineSection(0,-10.43,1.92,2.08);
     851           0 :  rod->DefineSection(1,-9.75,1.92,2.08);
     852             : 
     853           0 :  rod->DefineSection(2,-9.75,1.8,2.2);
     854           0 :  rod->DefineSection(3,9.75,1.8,2.2);
     855             : 
     856           0 :  rod->DefineSection(4,9.75,1.92,2.08);
     857           0 :  rod->DefineSection(5,10.43,1.92,2.08);
     858             :  //
     859           0 :  TGeoVolume *mrodl = new TGeoVolume("TPC_mrodl",rod,m6);
     860             :  //
     861             :  // tpc rod short 
     862             :  //
     863           0 :  TGeoPcon *rod1 = new TGeoPcon("rod1",0.,360.,6);
     864           0 :  rod1->DefineSection(0,-8.93,1.92,2.08);
     865           0 :  rod1->DefineSection(1,-8.25,1.92,2.08);
     866             : 
     867           0 :  rod1->DefineSection(2,-8.25,1.8,2.2);
     868           0 :  rod1->DefineSection(3,8.25,1.8,2.2);
     869             : 
     870           0 :  rod1->DefineSection(4,8.25,1.92,2.08);
     871           0 :  rod1->DefineSection(5,8.93,1.92,2.08);
     872             :  //
     873           0 :  TGeoVolume *mrods = new TGeoVolume("TPC_mrods",rod1,m6);
     874             :  //
     875             :  // below is for the resistor rod
     876             :  //
     877             :  // hole for the brass connectors
     878             :  //
     879             : 
     880           0 :  new TGeoTube("hhole",0.,0.3,0.3);
     881             :  //
     882             :  //transformations for holes - initialy they
     883             :  // are placed at x=0 and negative y
     884             :  //
     885           0 :   TGeoRotation *rhole = new TGeoRotation();
     886           0 :   rhole->RotateX(90.);
     887           0 :   TGeoCombiTrans *transf[13];
     888           0 :   Char_t name[30];
     889           0 :   for(Int_t i=0;i<13;i++){
     890             :     //sprintf(name,"transf%d",i);
     891           0 :     snprintf(name,30,"transf%d",i);
     892           0 :     transf[i]= new TGeoCombiTrans(name,0.,-2.,-9.+i*1.5,rhole);
     893           0 :     transf[i]->RegisterYourself();
     894             :   }
     895             :   // union expression for holes
     896           0 :   TString operl("hhole:transf0");
     897           0 :   for (Int_t i=1;i<13;i++){
     898             :     //sprintf(name,"+hhole:transf%d",i);
     899           0 :     snprintf(name,30,"+hhole:transf%d",i);
     900           0 :     operl.Append(name);   
     901             :   }
     902             :   //
     903           0 :  TString opers("hhole:transf1");
     904           0 :   for (Int_t i=2;i<12;i++){
     905             :     //sprintf(name,"+hhole:transf%d",i);
     906           0 :     snprintf(name,30,"+hhole:transf%d",i); 
     907           0 :     opers.Append(name);   
     908             :   }
     909             :   //union of holes
     910           0 :   new TGeoCompositeShape("hlv",operl.Data());
     911           0 :   new TGeoCompositeShape("hsv",opers.Data());
     912             :   //
     913           0 :   TGeoCompositeShape *rodl = new TGeoCompositeShape("rodl","rod-hlv");
     914           0 :   TGeoCompositeShape *rods = new TGeoCompositeShape("rods","rod1-hsv");
     915             :  //rods - volumes - makrolon rods with holes
     916           0 :   TGeoVolume *rodlv = new TGeoVolume("TPC_rodl",rodl,m6);
     917           0 :   TGeoVolume *rodsv = new TGeoVolume("TPC_rods",rods,m6);
     918             :   //brass connectors
     919             :  //connectors
     920           0 :   TGeoTube *bcon = new TGeoTube(0.,0.3,0.3);//connectors
     921           0 :   TGeoVolume *bconv = new TGeoVolume("TPC_bcon",bcon,m13);
     922             :  //
     923             :  // hooks holding strips
     924             :  //
     925           0 :  new TGeoBBox("hk1",0.625,0.015,0.75);
     926           0 :  new TGeoBBox("hk2",0.625,0.015,0.15);
     927           0 :  TGeoTranslation *tr21 = new TGeoTranslation("tr21",0.,-0.03,-0.6);
     928           0 :  TGeoTranslation *tr12 = new TGeoTranslation("tr12",0.,-0.03,0.6);
     929           0 :  tr21->RegisterYourself();
     930           0 :  tr12->RegisterYourself();
     931             :  
     932           0 :  TGeoCompositeShape *hook = new TGeoCompositeShape("hook","hk1+hk2:tr21+hk2:tr12");
     933           0 :  TGeoVolume *hookv = new TGeoVolume("TPC_hook",hook,m13);
     934             :  //
     935             :  // assembly of the short rod with connectors and hooks
     936             :  //
     937             :  //
     938             :  // short rod
     939             :  //
     940           0 :   TGeoVolumeAssembly *spart = new TGeoVolumeAssembly("TPC_spart");
     941             :   //
     942           0 :   spart->AddNode( rodsv,1);
     943           0 :   for(Int_t i=1;i<12;i++){
     944           0 :   spart->AddNode(bconv,i,transf[i]);
     945             :   }
     946           0 :   for(Int_t i =0;i<11;i++){
     947           0 :     spart->AddNode(hookv,i+1,new TGeoTranslation(0.,-2.315,-7.5+i*1.5));
     948             :   } 
     949             :  //
     950             :  // long rod
     951             :  //
     952           0 :   TGeoVolumeAssembly *lpart = new TGeoVolumeAssembly("TPC_lpart");
     953             :   //
     954           0 :   lpart->AddNode( rodlv,1);
     955           0 :   for(Int_t i=0;i<13;i++){
     956           0 :   lpart->AddNode(bconv,i+12,transf[i]);
     957             :   }
     958           0 :   for(Int_t i =0;i<13;i++){
     959           0 :     lpart->AddNode(hookv,i+12,new TGeoTranslation(0.,-2.315,-9.+i*1.5));
     960             :   }   
     961             :   //
     962             :   // alu ring
     963             :   //
     964           0 :   new TGeoTube("ring1",2.1075,2.235,0.53);
     965           0 :   new TGeoTube("ring2",1.7925,1.89,0.43);
     966           0 :   new TGeoTube("ring3",1.89,2.1075,0.05);
     967           0 :   TGeoCompositeShape *ring = new TGeoCompositeShape("ring","ring1+ring2+ring3");
     968           0 :   TGeoVolume *ringv = new TGeoVolume("TPC_ring",ring,m3);
     969             :   //
     970             :   // rod assembly
     971             :   //
     972           0 :   TGeoVolumeAssembly *tpcrrod = new TGeoVolumeAssembly("TPC_rrod");//rrod
     973           0 :   TGeoVolumeAssembly *tpcmrod = new TGeoVolumeAssembly("TPC_mrod");//makrolon rod  
     974             :   //long pieces
     975           0 :   for(Int_t i=0;i<11;i++){
     976           0 :     tpcrrod->AddNode(ringv,i+1,new TGeoTranslation(0.,0.,-105.+i*21));
     977           0 :     tpcmrod->AddNode(ringv,i+12,new TGeoTranslation(0.,0.,-105.+i*21));
     978             :   }
     979           0 :   for(Int_t i=0;i<10;i++){
     980           0 :     tpcrrod->AddNode(lpart,i+1,new TGeoTranslation(0.,0.,-94.5+i*21));//resistor rod
     981           0 :     tpcmrod->AddNode(mrodl,i+1,new TGeoTranslation(0.,0.,-94.5+i*21));//makrolon rod     
     982             :   }
     983             :   //
     984             :   // right plug - identical for all rods
     985             :   //
     986           0 :   TGeoPcon *tpcrp = new TGeoPcon(0.,360.,6);
     987             :   //
     988           0 :   tpcrp->DefineSection(0,123.05,1.89,2.1075);
     989           0 :   tpcrp->DefineSection(1,123.59,1.89,2.1075);
     990             :   //
     991           0 :   tpcrp->DefineSection(2,123.59,1.8,2.2);
     992           0 :   tpcrp->DefineSection(3,127.,1.8,2.2);
     993             :   //
     994           0 :   tpcrp->DefineSection(4,127.,0.,2.2);
     995           0 :   tpcrp->DefineSection(5,127.5,0.,2.2);
     996             :   //
     997           0 :   TGeoVolume *tpcrpv = new TGeoVolume("TPC_RP",tpcrp,m6);
     998             :   //
     999             :   // adding short pieces and right plug
    1000             :   //
    1001           0 :   tpcrrod->AddNode(spart,1,new TGeoTranslation(0.,0.,-114.));
    1002           0 :   tpcrrod->AddNode(spart,2,new TGeoTranslation(0.,0.,114.)); 
    1003           0 :   tpcrrod->AddNode(ringv,23,new TGeoTranslation(0.,0.,-123.));
    1004           0 :   tpcrrod->AddNode(ringv,24,new TGeoTranslation(0.,0.,123.));
    1005           0 :   tpcrrod->AddNode(tpcrpv,1);
    1006             :   //
    1007           0 :   tpcmrod->AddNode(mrods,1,new TGeoTranslation(0.,0.,-114.));
    1008           0 :   tpcmrod->AddNode(mrods,2,new TGeoTranslation(0.,0.,114.)); 
    1009           0 :   tpcmrod->AddNode(ringv,25,new TGeoTranslation(0.,0.,-123.));
    1010           0 :   tpcmrod->AddNode(ringv,26,new TGeoTranslation(0.,0.,123.));
    1011           0 :   tpcmrod->AddNode(tpcrpv,2);
    1012             :   //
    1013             :   // from the ringv position to the CM is 3.0 cm!
    1014             :   //----------------------------------------
    1015             :   //
    1016             :   //
    1017             :   //HV rods - makrolon + 0.58cm (diameter) Cu ->check the length
    1018           0 :   TGeoTube *hvr = new TGeoTube(0.,1.465,123.);
    1019           0 :   TGeoTube *hvc = new TGeoTube(0.,0.29,123.);
    1020             :   //
    1021           0 :   TGeoVolume *hvrv = new TGeoVolume("TPC_HV_Rod",hvr,m6);
    1022           0 :   TGeoVolume *hvcv = new TGeoVolume("TPC_HV_Cable",hvc,m7);
    1023           0 :   hvrv->AddNode(hvcv,1);
    1024             :   //
    1025             :   //resistor rod
    1026             :   //
    1027           0 :   TGeoTube *cr = new TGeoTube(0.,0.45,123.);   
    1028           0 :   TGeoTube *cw = new TGeoTube(0.,0.15,123.);  
    1029           0 :   TGeoVolume *crv = new TGeoVolume("TPC_CR",cr,m10);
    1030           0 :   TGeoVolume *cwv = new TGeoVolume("TPC_W",cw,m12);   
    1031             :   //
    1032             :   // ceramic rod with water
    1033             :   //
    1034           0 :   crv->AddNode(cwv,1);
    1035             :   //
    1036             :   //peek rod
    1037             :   //
    1038           0 :   TGeoTube *pr =new TGeoTube(0.2,0.35,123.);  
    1039           0 :   TGeoVolume *prv = new TGeoVolume("TPC_PR",pr,m11); 
    1040             :   //
    1041             :   // copper plates with connectors
    1042             :   //
    1043           0 :   new TGeoTube("tub",0.,1.7,0.025);
    1044             :   //
    1045             :   // half space - points on the plane and a normal vector
    1046             :   //
    1047           0 :   Double_t n[3],p[3];
    1048           0 :   Double_t slope = TMath::Tan(22.*TMath::DegToRad());
    1049             :   Double_t intp = 1.245;
    1050             :   //
    1051           0 :   Double_t b = slope*slope+1.;
    1052           0 :   p[0]=intp*slope/b;
    1053           0 :   p[1]=-intp/b;
    1054           0 :   p[2]=0.;
    1055             :   //
    1056           0 :   n[0]=-p[0];
    1057           0 :   n[1]=-p[1];
    1058           0 :   n[2]=0.;
    1059             :   Double_t norm;
    1060           0 :   norm=TMath::Sqrt(n[0]*n[0]+n[1]*n[1]);
    1061           0 :   n[0] /= norm;
    1062           0 :   n[1] /=norm;
    1063             :   //
    1064           0 :   new TGeoHalfSpace("sp1",p,n);
    1065             :   //
    1066           0 :   slope = -slope; 
    1067             :   //
    1068           0 :   p[0]=intp*slope/b;
    1069           0 :   p[1]=-intp/b;
    1070             :   //
    1071           0 :   n[0]=-p[0];
    1072           0 :   n[1]=-p[1];
    1073           0 :   norm=TMath::Sqrt(n[0]*n[0]+n[1]*n[1]);
    1074           0 :   n[0] /= norm;
    1075           0 :   n[1] /=norm;
    1076             :   //
    1077           0 :   new TGeoHalfSpace("sp2",p,n);
    1078             :   // holes for rods
    1079             :  //holes
    1080           0 :  new TGeoTube("h1",0.,0.5,0.025);
    1081           0 :  new TGeoTube("h2",0.,0.35,0.025);
    1082             :  //translations:
    1083           0 :  TGeoTranslation *ttr11 = new TGeoTranslation("ttr11",-0.866,0.5,0.);
    1084           0 :  TGeoTranslation *ttr22 = new TGeoTranslation("ttr22",0.866,0.5,0.);
    1085           0 :  ttr11->RegisterYourself();
    1086           0 :  ttr22->RegisterYourself();
    1087             :  // elastic connector
    1088           0 :  new TGeoBBox("elcon",0.72,0.005,0.3);
    1089           0 :  TGeoRotation *crr1 = new TGeoRotation();
    1090           0 :  crr1->RotateZ(-22.);
    1091           0 : TGeoCombiTrans *ctr1 = new TGeoCombiTrans("ctr1",-0.36011, -1.09951,-0.325,crr1);
    1092           0 : ctr1->RegisterYourself();
    1093           0 :  TGeoCompositeShape *cs1 = new TGeoCompositeShape("cs1",
    1094             : "(((((tub-h1:ttr11)-h1:ttr22)-sp1)-sp2)-h2)+elcon:ctr1");
    1095             :  //
    1096           0 :  TGeoVolume *csvv = new TGeoVolume("TPC_RR_CU",cs1,m7);
    1097             :  //
    1098             :  // resistor rod assembly 2 ceramic rods, peak rod, Cu plates
    1099             :  // and resistors
    1100             :  //
    1101           0 :  TGeoVolumeAssembly *rrod = new TGeoVolumeAssembly("TPC_RRIN");
    1102             :  // rods
    1103           0 :  rrod->AddNode(crv,1,ttr11);
    1104           0 :  rrod->AddNode(crv,2,ttr22); 
    1105           0 :  rrod->AddNode(prv,1);
    1106             :  //Cu plates
    1107           0 :  for(Int_t i=0;i<165;i++){
    1108           0 :    rrod->AddNode(csvv,i+1,new TGeoTranslation(0.,0.,-122.675+i*1.5));
    1109             :  }
    1110             :  //resistors
    1111           0 :  TGeoTube *res = new TGeoTube(0.,0.15,0.5);
    1112           0 :  TGeoVolume *resv = new TGeoVolume("TPC_RES",res,m14);
    1113           0 :  TGeoVolumeAssembly *ress = new TGeoVolumeAssembly("TPC_RES_CH");
    1114           0 :  ress->AddNode(resv,1,new TGeoTranslation(0.2,0.,0.));
    1115           0 :  ress->AddNode(resv,2,new TGeoTranslation(-0.2,0.,0.));
    1116             :  //
    1117           0 :  TGeoRotation *crr2 = new TGeoRotation();
    1118           0 :  crr2->RotateY(30.);
    1119           0 :  TGeoRotation *crr3 = new TGeoRotation();
    1120           0 :  crr3->RotateY(-30.); 
    1121             :  //
    1122           0 :  for(Int_t i=0;i<164;i+=2){
    1123           0 :    rrod->AddNode(ress,i+1, new TGeoCombiTrans(0.,1.2,-121.925+i*1.5,crr2));
    1124           0 :    rrod->AddNode(ress,i+2, new TGeoCombiTrans(0.,1.2,-121.925+(i+1)*1.5,crr3));
    1125             :  }
    1126             : 
    1127           0 :  tpcrrod->AddNode(rrod,1,new TGeoCombiTrans(0.,0.,0.5,crr1));
    1128             :  //
    1129             :  // rod left head with holders - inner
    1130             :  //
    1131             :  // first element - support for inner holder  TPC_IHS
    1132           0 :  Double_t shift1[3] = {0.0,-0.175,0.0};
    1133             : 
    1134           0 : new TGeoBBox("tpcihs1", 4.7, 0.66, 2.35);               
    1135           0 : new TGeoBBox("tpcihs2", 4.7, 0.485, 1.0, shift1);
    1136           0 : new TGeoBBox("tpcihs3", 1.5, 0.485, 2.35, shift1);
    1137           0 : new TGeoTube("tpcihs4", 0.0, 2.38, 0.1);
    1138             : //
    1139           0 : Double_t pointstrap[16];    
    1140           0 : pointstrap[0]= 0.0;
    1141           0 : pointstrap[1]= 0.0;
    1142           0 : pointstrap[2]= 0.0;
    1143           0 : pointstrap[3]= 1.08;
    1144           0 : pointstrap[4]= 2.3;
    1145           0 : pointstrap[5]= 1.08;
    1146           0 : pointstrap[6]= 3.38;
    1147           0 : pointstrap[7]= 0.0;
    1148           0 : pointstrap[8]= 0.0;
    1149           0 : pointstrap[9]= 0.0;
    1150           0 : pointstrap[10]= 0.0;
    1151           0 : pointstrap[11]= 1.08;
    1152           0 : pointstrap[12]= 2.3;
    1153           0 : pointstrap[13]= 1.08;
    1154           0 : pointstrap[14]= 3.38;
    1155           0 : pointstrap[15]= 0.0;
    1156             : //
    1157           0 : TGeoArb8 *tpcihs5 = new TGeoArb8("tpcihs5", 0.6, pointstrap);
    1158             : //
    1159             : //  half space - cutting "legs"
    1160             : // 
    1161           0 :  p[0]=0.0;
    1162           0 :  p[1]=0.105;
    1163           0 :  p[2]=0.0;
    1164             :  //       
    1165           0 : n[0] = 0.0;
    1166           0 : n[1] = 1.0;
    1167           0 : n[2] = 0.0;
    1168             : 
    1169           0 : new TGeoHalfSpace("cutil1", p, n);
    1170             : 
    1171             : //
    1172             : // transformations
    1173             : //
    1174           0 : TGeoTranslation *trans2 = new TGeoTranslation("trans2", 0.0, 2.84, 2.25);
    1175           0 : trans2->RegisterYourself();
    1176           0 : TGeoTranslation*trans3= new TGeoTranslation("trans3", 0.0, 2.84, -2.25);
    1177           0 : trans3->RegisterYourself();
    1178             : //support - composite volume
    1179             : //
    1180           0 : TGeoCompositeShape *tpcihs6 = new TGeoCompositeShape("tpcihs6", "tpcihs1-(tpcihs2+tpcihs3)-(tpcihs4:trans2)-(tpcihs4:trans3)-cutil1");
    1181             : //
    1182             : // volumes - all makrolon
    1183             : //  
    1184           0 :  TGeoVolume *tpcihss = new TGeoVolume("TPC_IHSS", tpcihs6, m6); //support
    1185           0 :  TGeoVolume *tpcihst = new TGeoVolume("TPC_IHSTR",tpcihs5 , m6); //trapesoid
    1186             :  //now assembly
    1187           0 : TGeoRotation *rot111 = new TGeoRotation(); 
    1188           0 : rot111->RotateY(180.0);
    1189             : //
    1190           0 : TGeoVolumeAssembly *tpcihs = new TGeoVolumeAssembly("TPC_IHS");    // assembly of the support
    1191           0 : tpcihs->AddNode(tpcihss, 1);
    1192           0 : tpcihs->AddNode(tpcihst, 1, new TGeoTranslation(-4.7, 0.66, 0.0));
    1193           0 : tpcihs->AddNode(tpcihst, 2, new TGeoCombiTrans(4.7, 0.66, 0.0, rot111));
    1194             : //
    1195             : // two rod holders (TPC_IRH) assembled with the support
    1196             : //
    1197           0 : new TGeoBBox("tpcirh1", 4.7, 1.33, 0.5);
    1198           0 :  shift1[0]=-3.65;
    1199           0 :  shift1[1]=0.53;
    1200           0 :  shift1[2]=0.;
    1201           0 : new TGeoBBox("tpcirh2", 1.05, 0.8, 0.5, shift1);
    1202           0 :  shift1[0]=3.65;
    1203           0 :  shift1[1]=0.53;
    1204           0 :  shift1[2]=0.;
    1205           0 : new TGeoBBox("tpcirh3", 1.05, 0.8, 0.5, shift1);
    1206           0 :  shift1[0]=0.0;
    1207           0 :  shift1[1]=1.08;
    1208           0 :  shift1[2]=0.;
    1209           0 : new TGeoBBox("tpcirh4", 1.9, 0.25, 0.5, shift1);
    1210           0 : new TGeoTube("tpcirh5", 0, 1.9, 5);
    1211             : //
    1212           0 : TGeoTranslation *trans4 = new TGeoTranslation("trans4", 0, 0.83, 0.0); 
    1213           0 : trans4->RegisterYourself();
    1214             : //
    1215           0 : TGeoCompositeShape *tpcirh6 = new TGeoCompositeShape("tpcirh6", "tpcirh1-tpcirh2-tpcirh3-(tpcirh5:trans4)-tpcirh4");
    1216             : //
    1217             : // now volume
    1218             : //
    1219           0 : TGeoVolume *tpcirh = new TGeoVolume("TPC_IRH", tpcirh6, m6);   
    1220             : //
    1221             : // and all together...
    1222             : //
    1223           0 : TGeoVolume *tpciclamp = new TGeoVolumeAssembly("TPC_ICLP");
    1224           0 : tpciclamp->AddNode(tpcihs, 1);
    1225           0 : tpciclamp->AddNode(tpcirh, 1, new TGeoTranslation(0, 1.99, 1.1));
    1226           0 : tpciclamp->AddNode(tpcirh, 2, new TGeoTranslation(0, 1.99, -1.1));
    1227             : //
    1228             : // and now left inner "head"
    1229             : //
    1230           0 : TGeoPcon *inplug = new TGeoPcon("inplug", 0.0, 360.0, 14); 
    1231             : 
    1232           0 : inplug->DefineSection(0, 0.3, 0.0, 2.2);
    1233           0 : inplug->DefineSection(1, 0.6, 0.0, 2.2);
    1234             : 
    1235           0 : inplug->DefineSection(2, 0.6, 0.0, 1.75);
    1236           0 : inplug->DefineSection(3, 0.7, 0.0, 1.75);
    1237             : 
    1238           0 : inplug->DefineSection(4, 0.7, 1.55, 1.75);
    1239           0 : inplug->DefineSection(5, 1.6, 1.55, 1.75);
    1240             : 
    1241           0 : inplug->DefineSection(6, 1.6, 1.55, 2.2);
    1242           0 : inplug->DefineSection(7, 1.875, 1.55, 2.2);
    1243             : 
    1244           0 : inplug->DefineSection(8, 1.875, 1.55, 2.2);
    1245           0 : inplug->DefineSection(9, 2.47, 1.75, 2.2);
    1246             : 
    1247           0 : inplug->DefineSection(10, 2.47, 1.75, 2.08);
    1248           0 : inplug->DefineSection(11, 2.57, 1.8, 2.08);
    1249             : 
    1250           0 : inplug->DefineSection(12, 2.57, 1.92, 2.08);
    1251           0 : inplug->DefineSection(13, 2.95, 1.92, 2.08);
    1252             : //
    1253           0 :  shift1[0]=0.0;
    1254           0 :  shift1[1]=-2.09;
    1255           0 :  shift1[2]=1.075;
    1256             :  //
    1257           0 : new TGeoBBox("pcuti", 1.5, 0.11, 1.075, shift1);
    1258             : //
    1259           0 : TGeoCompositeShape *inplleft = new TGeoCompositeShape("inplleft", "inplug-pcuti");
    1260           0 : TGeoVolume *tpcinlplug = new TGeoVolume("TPC_INPLL", inplleft, m6);   
    1261             : //
    1262             : //  holder + plugs
    1263             : //
    1264           0 :  TGeoVolume *tpcihpl = new TGeoVolumeAssembly("TPC_IHPL"); //holder+2 plugs (reflected)
    1265           0 :  tpcihpl->AddNode(tpcinlplug, 1);
    1266           0 :  tpcihpl->AddNode(tpcinlplug, 2,ref);
    1267           0 :  tpcihpl->AddNode(tpciclamp,1,new TGeoTranslation(0.0, -2.765, 0.0)); 
    1268             :  //
    1269             :  // outer holders and clamps
    1270             :  //
    1271             : 
    1272             :  // outer membrane holder (between rods)  
    1273           0 : pointstrap[0]= 0.0;
    1274           0 : pointstrap[1]= 0.0;
    1275           0 : pointstrap[2]= 0.0;
    1276           0 : pointstrap[3]= 2.8;
    1277           0 : pointstrap[4]= 3.1;
    1278           0 : pointstrap[5]= 2.8-3.1*TMath::Tan(15.*TMath::DegToRad());
    1279           0 : pointstrap[6]= 3.1;
    1280           0 : pointstrap[7]= 0.0;
    1281           0 : pointstrap[8]= 0.0;
    1282           0 : pointstrap[9]= 0.0;
    1283           0 : pointstrap[10]= 0.0;
    1284           0 : pointstrap[11]= 2.8;
    1285           0 : pointstrap[12]= 3.1;
    1286           0 : pointstrap[13]= 2.8-3.1*TMath::Tan(15.*TMath::DegToRad());
    1287           0 : pointstrap[14]= 3.1;
    1288           0 : pointstrap[15]= 0.0;
    1289             : //
    1290           0 : TGeoArb8 *tpcomh1 = new TGeoArb8("tpcomh1", 1.05, pointstrap);   
    1291           0 : TGeoBBox *tpcomh2 = new TGeoBBox("tpcomh2", 0.8, 1.4, 6);
    1292             : //
    1293           0 : TGeoVolume *tpcomh1v = new TGeoVolume("TPC_OMH1", tpcomh1, m7);    
    1294           0 : TGeoVolume *tpcomh2v = new TGeoVolume("TPC_OMH2", tpcomh2, m7);
    1295             : //
    1296           0 : TGeoVolume *tpcomh3v = new TGeoVolumeAssembly("TPC_OMH3");    // assembly1
    1297           0 : tpcomh3v->AddNode(tpcomh1v, 1, new TGeoTranslation(0.8, -1.4, 4.95));
    1298           0 :  tpcomh3v->AddNode(tpcomh1v, 2, new TGeoTranslation(0.8, -1.4, -4.95));
    1299           0 : tpcomh3v->AddNode(tpcomh2v, 1);
    1300             : //
    1301           0 : shift1[0] = 0.9;
    1302           0 : shift1[1] = -1.85;
    1303           0 : shift1[2] = 0.0;
    1304             : //
    1305           0 : new TGeoBBox("tpcomh3", 1.65, 1.15, 3.4);
    1306           0 : TGeoBBox *tpcomh4 = new TGeoBBox("tpcomh4", 0.75, 0.7, 3.4, shift1);
    1307             : //
    1308             : // halfspace 1
    1309             : //
    1310           0 : p[0] = 0.0;
    1311           0 : p[1] = -1.05;   
    1312           0 : p[2] = -3.4;
    1313             : //
    1314           0 : n[0] = 0.0;
    1315           0 : n[1] = -1.0*TMath::Tan(30.*TMath::DegToRad());
    1316           0 : n[2] = 1.0;
    1317             : //
    1318           0 : new TGeoHalfSpace("cutomh1", p, n); 
    1319             : //
    1320             : // halfspace 2
    1321             : //
    1322           0 : p[0] = 0.0;
    1323           0 : p[1] = -1.05;   
    1324           0 : p[2] = 3.4;
    1325             : //
    1326           0 : n[0] = 0.0;
    1327           0 : n[1] = -1.0*TMath::Tan(30.*TMath::DegToRad());
    1328           0 : n[2] = -1.0;
    1329             : //
    1330           0 : new TGeoHalfSpace("cutomh2", p, n);
    1331             : //
    1332             : // halfspace 3
    1333             : //
    1334           0 : p[0] = -1.65;
    1335           0 : p[1] = 0.0;     
    1336           0 : p[2] = -0.9;
    1337             : //
    1338           0 : n[0] = 1.0*TMath::Tan(75.*TMath::DegToRad());
    1339           0 : n[1] = 0.0;
    1340           0 : n[2] = 1.0;
    1341             : //
    1342           0 : new TGeoHalfSpace("cutomh3", p, n);   
    1343             : //
    1344             : // halfspace 4
    1345             : //
    1346           0 : p[0] = -1.65;
    1347           0 : p[1] = 0.0;      
    1348           0 : p[2] = 0.9;
    1349             : //
    1350           0 : n[0] = 1.0*TMath::Tan(75*TMath::DegToRad());
    1351           0 : n[1] = 0.0;
    1352           0 : n[2] = -1.0;
    1353             : //
    1354           0 : new TGeoHalfSpace("cutomh4", p, n); 
    1355             : //
    1356             : // halsfspace 5
    1357             : //
    1358           0 : p[0] = 1.65;
    1359           0 : p[1] = -1.05;      
    1360           0 : p[2] = 0.0;  
    1361             : //
    1362           0 : n[0] = -1.0;
    1363           0 : n[1] = -1.0*TMath::Tan(20.*TMath::DegToRad());
    1364           0 : n[2] = 0.0;
    1365             : //
    1366           0 : new TGeoHalfSpace("cutomh5", p, n); 
    1367             : //  
    1368           0 : TGeoCompositeShape *tpcomh5 = new TGeoCompositeShape("tpcomh5", "tpcomh3-cutomh1-cutomh2-cutomh3-cutomh4-cutomh5"); 
    1369             : //
    1370           0 :  TGeoVolume *tpcomh5v = new TGeoVolume("TPC_OMH5",tpcomh5,m6);
    1371           0 :  TGeoVolume *tpcomh4v = new TGeoVolume("TPC_OMH6",tpcomh4,m6);
    1372             :  //
    1373           0 :  TGeoVolumeAssembly *tpcomh7v = new TGeoVolumeAssembly("TPC_OMH7");
    1374           0 :  tpcomh7v->AddNode(tpcomh5v,1);
    1375           0 :  tpcomh7v->AddNode(tpcomh4v,1);
    1376             :  //
    1377             :  // full membrane holder - tpcomh3v + tpcomh7v
    1378             :  //
    1379           0 :  TGeoVolumeAssembly *tpcomh = new TGeoVolumeAssembly("TPC_OMH");
    1380           0 :  tpcomh->AddNode(tpcomh3v,1,new TGeoTranslation(1.5,0.,0.));
    1381           0 :  tpcomh->AddNode(tpcomh3v,2,new TGeoCombiTrans(-1.5,0.,0.,rot111));
    1382           0 :  tpcomh->AddNode(tpcomh7v,1,new TGeoTranslation(0.65+1.5, 2.55, 0.0));
    1383           0 :  tpcomh->AddNode(tpcomh7v,2,new TGeoCombiTrans(-0.65-1.5, 2.55, 0.0,rot111)); 
    1384             :  //
    1385             :  //  outer rod holder support
    1386             :  //
    1387           0 : new TGeoBBox("tpcohs1", 3.8, 0.675, 2.35); 
    1388             : //
    1389           0 : shift1[0] = 0.0;
    1390           0 : shift1[1] = 0.175;
    1391           0 : shift1[2] = 0.0;
    1392             : //
    1393           0 : new TGeoBBox("tpcohs2", 1.5, 0.5, 2.35, shift1);
    1394           0 : new TGeoBBox("tpcohs3", 3.8, 0.5, 0.85, shift1);
    1395             : //
    1396           0 : shift1[0] = 0.0;
    1397           0 : shift1[1] = -1.175;
    1398           0 : shift1[2] = 0.0;
    1399             : //
    1400           0 : TGeoBBox *tpcohs4 = new TGeoBBox("tpsohs4", 3.1, 0.5, 0.7, shift1);
    1401             : //
    1402           0 : TGeoVolume *tpcohs4v = new TGeoVolume("TPC_OHS4", tpcohs4, m6);
    1403             : //
    1404           0 : p[0] = 0.0;
    1405           0 : p[1] = -0.186;   
    1406           0 : p[2] = 0.0;
    1407             : //
    1408           0 : n[0] = 0.0;
    1409           0 : n[1] = -1.0;
    1410           0 : n[2] = 0.0;
    1411             : //
    1412           0 : new TGeoHalfSpace("cutohs1", p, n);
    1413             : //
    1414           0 : TGeoCompositeShape *tpcohs5 = new TGeoCompositeShape("tpcohs5", "tpcohs1-tpcohs2-tpcohs3-cutohs1"); 
    1415           0 : TGeoVolume *tpcohs5v = new TGeoVolume("TPC_OHS5", tpcohs5, m6); 
    1416             : //
    1417           0 : TGeoVolumeAssembly *tpcohs = new TGeoVolumeAssembly("TPC_OHS");    
    1418           0 : tpcohs->AddNode(tpcohs5v, 1);
    1419           0 : tpcohs->AddNode(tpcohs4v, 1); 
    1420             : //
    1421             : // outer rod holder itself
    1422             : //
    1423           0 : shift1[0] = 0.0;
    1424           0 : shift1[1] = 1.325;
    1425           0 : shift1[2] = 0.0;
    1426           0 :  new TGeoBBox("tpcorh1", 3.1, 1.825, 0.55); //from this box we cut pieces...
    1427             :  //
    1428           0 : shift1[0] = -3.1;       
    1429           0 : shift1[1] = -0.5;       
    1430           0 : shift1[2] = 0.0;
    1431             : //
    1432           0 : new TGeoBBox("tpcorh2", 0.5, 2.75, 1.1, shift1);
    1433             : //
    1434           0 : shift1[0] = 3.1;        
    1435           0 : shift1[1] = -0.5;       
    1436           0 : shift1[2] = 0.0;
    1437             : //
    1438           0 : new TGeoBBox("tpcorh3", 0.5, 2.75, 1.1, shift1);
    1439             : //
    1440           0 : shift1[0] = 0.0;
    1441           0 : shift1[1] = -0.5;       
    1442           0 : shift1[2] = -0.95;
    1443             : //
    1444           0 : new TGeoBBox("tpcorh4", 3.9, 2.75, 0.5, shift1);
    1445             : //
    1446           0 : shift1[0] = 0.0;
    1447           0 : shift1[1] = -0.5;
    1448           0 : shift1[2] = 0.0;
    1449             : //
    1450           0 : new TGeoBBox("tpcorh5", 1.95, 0.5, 1.1, shift1);
    1451             : //
    1452           0 : shift1[0] = 0.0;
    1453           0 : shift1[1] = -0.5;
    1454           0 : shift1[2] = 0.55;
    1455             : //
    1456           0 : new TGeoBBox("tpcorh6", 2.4, 0.5, 0.6, shift1);
    1457             : //
    1458           0 : new TGeoTube("tpcorh7", 0, 1.95, 0.85);
    1459           0 : new TGeoTube("tpcorh8", 0, 2.4, 0.6);
    1460             : //
    1461           0 : TGeoTranslation *trans33 = new TGeoTranslation("trans33", 0.0, 0.0, 0.55); 
    1462           0 : trans33->RegisterYourself();
    1463             : //
    1464           0 : TGeoCompositeShape *tpcorh9 = new TGeoCompositeShape("tpcorh9", "tpcorh1-tpcorh2-tpcorh3-tpcorh4-tpcorh5-tpcorh6-(tpcorh8:trans33)-tpcorh7");
    1465             : //
    1466           0 :  TGeoVolume *tpcorh9v = new TGeoVolume("TPC_ORH",tpcorh9,m6); //outer rod holder 
    1467             :  //
    1468             :  // now 2 holders together
    1469             :  //
    1470           0 :  TGeoVolumeAssembly *tpcorh = new TGeoVolumeAssembly("TPC_ORH2");
    1471             :  //
    1472           0 :  tpcorh->AddNode(tpcorh9v,1,new TGeoTranslation(0.0, 0.0, 1.25));
    1473           0 :  tpcorh->AddNode(tpcorh9v,2,new TGeoCombiTrans(0.0, 0.0, -1.25,rot111));
    1474             : //
    1475             : // outer rod plug left
    1476             : //
    1477           0 : TGeoPcon *outplug = new TGeoPcon("outplug", 0.0, 360.0, 14); 
    1478             : 
    1479           0 : outplug->DefineSection(0, 0.5, 0.0, 2.2);
    1480           0 : outplug->DefineSection(1, 0.7, 0.0, 2.2);
    1481             : 
    1482           0 : outplug->DefineSection(2, 0.7, 1.55, 2.2);
    1483           0 : outplug->DefineSection(3, 0.8, 1.55, 2.2);
    1484             : 
    1485           0 : outplug->DefineSection(4, 0.8, 1.55, 1.75);
    1486           0 : outplug->DefineSection(5, 1.2, 1.55, 1.75);
    1487             : 
    1488           0 : outplug->DefineSection(6, 1.2, 1.55, 2.2);
    1489           0 : outplug->DefineSection(7, 1.875, 1.55, 2.2);
    1490             : 
    1491           0 : outplug->DefineSection(8, 1.875, 1.55, 2.2);
    1492           0 : outplug->DefineSection(9, 2.47, 1.75, 2.2);
    1493             : 
    1494           0 : outplug->DefineSection(10, 2.47, 1.75, 2.08);
    1495           0 : outplug->DefineSection(11, 2.57, 1.8, 2.08);
    1496             : 
    1497           0 : outplug->DefineSection(12, 2.57, 1.92, 2.08);
    1498           0 : outplug->DefineSection(13, 2.95, 1.92, 2.08);
    1499             : //
    1500           0 : shift1[0] = 0.0;
    1501           0 : shift1[1] = 2.09;
    1502           0 : shift1[2] = 1.01;
    1503             : 
    1504           0 : new TGeoBBox("cutout", 2.5, 0.11, 1.01, shift1);
    1505             : //
    1506             : 
    1507           0 : TGeoCompositeShape *outplleft = new TGeoCompositeShape("outplleft", "outplug-cutout");    
    1508           0 : TGeoVolume *outplleftv = new TGeoVolume("TPC_OPLL", outplleft, m6); 
    1509             : //
    1510             : //  support + holder + plug
    1511             : //
    1512             : 
    1513             :  
    1514           0 :  TGeoVolumeAssembly *tpcohpl = new TGeoVolumeAssembly("TPC_OHPL"); 
    1515             :  //
    1516           0 :  tpcohpl->AddNode(outplleftv,1); //plug
    1517           0 :  tpcohpl->AddNode(outplleftv,2,ref); //plug reflected
    1518           0 :  tpcohpl->AddNode(tpcorh,1); //rod holder
    1519           0 :  tpcohpl->AddNode(tpcohs,1,new TGeoTranslation(0.0, 3.925, 0)); // support
    1520             :  //
    1521             : 
    1522             :  //
    1523             :  // main membrane holder
    1524             :  //           
    1525           0 : pointstrap[0]= 0.0;
    1526           0 : pointstrap[1]= 0.0;
    1527           0 : pointstrap[2]= 0.0;
    1528           0 : pointstrap[3]= 2.8;
    1529           0 : pointstrap[4]= 3.1;
    1530           0 : pointstrap[5]= 1.96;
    1531           0 : pointstrap[6]= 3.1;
    1532           0 : pointstrap[7]= 0.0;
    1533           0 : pointstrap[8]= 0.0;
    1534           0 : pointstrap[9]= 0.0;
    1535           0 : pointstrap[10]= 0.0;
    1536           0 : pointstrap[11]= 2.8;
    1537           0 : pointstrap[12]= 3.1;
    1538           0 : pointstrap[13]= 1.96;
    1539           0 : pointstrap[14]= 3.1;
    1540           0 : pointstrap[15]= 0.0; 
    1541             : //
    1542           0 : TGeoArb8 *tpcmmh1 = new TGeoArb8("tpcmmh1", 1.75, pointstrap);
    1543           0 : TGeoBBox *tpcmmh2 = new TGeoBBox("tpcmmh2", 0.8, 1.4, 12.5); 
    1544             : //
    1545           0 : TGeoVolume *tpcmmh1v = new TGeoVolume("TPC_MMH1", tpcmmh1, m6);   
    1546           0 : TGeoVolume *tpcmmh2v = new TGeoVolume("TPC_MMH2", tpcmmh2, m6);
    1547             : //
    1548           0 :  TGeoVolumeAssembly *tpcmmhs = new TGeoVolumeAssembly("TPC_MMHS");
    1549           0 :  tpcmmhs->AddNode(tpcmmh1v,1,new TGeoTranslation(0.8, -1.4, 10.75));
    1550           0 :  tpcmmhs->AddNode(tpcmmh1v,2,new TGeoTranslation(0.8, -1.4, -10.75));
    1551           0 :  tpcmmhs->AddNode(tpcmmh2v,1);
    1552             :  //
    1553             :  // main membrahe holder clamp
    1554             :  //
    1555           0 : shift1[0] = -0.75;
    1556           0 : shift1[1] = -1.15;
    1557           0 : shift1[2] = 0.0;
    1558             : //
    1559           0 : new TGeoBBox("tpcmmhc1", 1.65, 1.85, 8.9); 
    1560           0 : new TGeoBBox("tpcmmhc2", 0.9, 0.7, 8.9, shift1);
    1561             : //
    1562             : // half spaces  - cuts
    1563             : //
    1564           0 : p[0] = -1.65;
    1565           0 : p[1] = 0.0;   
    1566           0 : p[2] = -0.9;
    1567             : //
    1568           0 : n[0] = 8.0;
    1569           0 : n[1] = 0.0;
    1570           0 : n[2] = 8.0*TMath::Tan(13.*TMath::DegToRad());
    1571             : //
    1572           0 : new TGeoHalfSpace("cutmmh1", p, n);
    1573             : //
    1574           0 : p[0] = -1.65;
    1575           0 : p[1] = 0.0;   
    1576           0 : p[2] = 0.9;
    1577             : //
    1578           0 : n[0] = 8.0;
    1579           0 : n[1] = 0.0;
    1580           0 : n[2] = -8.0*TMath::Tan(13.*TMath::DegToRad());
    1581             : //
    1582           0 : new TGeoHalfSpace("cutmmh2", p, n);
    1583             : //
    1584           0 : p[0] = 0.0;
    1585           0 : p[1] = 1.85;   
    1586           0 : p[2] = -2.8;
    1587             : //
    1588           0 : n[0] = 0.0;
    1589           0 : n[1] = -6.1;
    1590           0 : n[2] = 6.1*TMath::Tan(20.*TMath::DegToRad());
    1591             : //
    1592           0 : new TGeoHalfSpace("cutmmh3", p, n);
    1593             : //
    1594           0 : p[0] = 0.0;
    1595           0 : p[1] = 1.85;      
    1596           0 : p[2] = 2.8;
    1597             : //
    1598           0 : n[0] = 0.0;
    1599           0 : n[1] = -6.1;
    1600           0 : n[2] = -6.1*TMath::Tan(20*TMath::DegToRad());
    1601             : //
    1602           0 : new TGeoHalfSpace("cutmmh4", p, n);
    1603             : //
    1604           0 : p[0] = 0.75;
    1605           0 : p[1] = 0.0; 
    1606           0 : p[2] = -8.9;
    1607             : //
    1608           0 : n[0] = 2.4*TMath::Tan(30*TMath::DegToRad());
    1609           0 : n[1] = 0.0;
    1610           0 : n[2] = 2.4;
    1611             : //
    1612           0 :  new TGeoHalfSpace("cutmmh5", p, n);
    1613             : //
    1614           0 : p[0] = 0.75;
    1615           0 : p[1] = 0.0;
    1616           0 : p[2] = 8.9;
    1617             : //
    1618           0 : n[0] = 2.4*TMath::Tan(30*TMath::DegToRad());
    1619           0 : n[1] = 0.0;
    1620           0 : n[2] = -2.4;
    1621             : //
    1622           0 : new TGeoHalfSpace("cutmmh6", p, n);
    1623             : 
    1624           0 : TGeoCompositeShape *tpcmmhc = new TGeoCompositeShape("TPC_MMHC", "tpcmmhc1-tpcmmhc2-cutmmh1-cutmmh2-cutmmh3-cutmmh4-cutmmh5-cutmmh6"); 
    1625             : 
    1626           0 :  TGeoVolume *tpcmmhcv = new TGeoVolume("TPC_MMHC",tpcmmhc,m6);
    1627             :  //
    1628           0 : TGeoVolume *tpcmmh = new TGeoVolumeAssembly("TPC_MMH");
    1629             : //
    1630           0 :  tpcmmh->AddNode(tpcmmhcv,1,new TGeoTranslation(0.65+1.5, 1.85, 0.0));
    1631           0 :  tpcmmh->AddNode(tpcmmhcv,2,new TGeoCombiTrans(-0.65-1.5, 1.85, 0.0,rot111));
    1632           0 :  tpcmmh->AddNode(tpcmmhs,1,new TGeoTranslation(1.5, 0.0, 0.0));
    1633           0 :  tpcmmh->AddNode(tpcmmhs,2,new TGeoCombiTrans(-1.5, 0.0, 0.0,rot111));
    1634             :  //
    1635             :  
    1636             :  //
    1637             : 
    1638             : //--------------------------------------------
    1639             :  //
    1640             :  // guard ring resistor chain
    1641             :  //
    1642             : 
    1643           0 :  TGeoTube *gres1 = new TGeoTube(0.,0.375,125.);// inside ifc
    1644             :  //
    1645           0 :  TGeoVolume *vgres1 = new TGeoVolume("TPC_GRES1",gres1,m14);
    1646             : 
    1647             :  //
    1648             :  Double_t xrc,yrc;
    1649             :  //
    1650           0 :  xrc=79.3*TMath::Cos(350.*TMath::DegToRad());
    1651           0 :  yrc=79.3*TMath::Sin(350.*TMath::DegToRad());
    1652             :  //
    1653           0 :  v9->AddNode(vgres1,1,new TGeoTranslation(xrc,yrc,126.9));
    1654           0 :  v9->AddNode(vgres1,2,new TGeoTranslation(xrc,yrc,-126.9));
    1655             :  //
    1656           0 :  xrc=79.3*TMath::Cos(190.*TMath::DegToRad());
    1657           0 :  yrc=79.3*TMath::Sin(190.*TMath::DegToRad()); 
    1658             :  //
    1659           0 :  v9->AddNode(vgres1,3,new TGeoTranslation(xrc,yrc,126.9));
    1660           0 :  v9->AddNode(vgres1,4,new TGeoTranslation(xrc,yrc,-126.9));
    1661             :  //------------------------------------------------------------------
    1662           0 :  TGeoRotation refl("refl",90.,0.,90.,90.,180.,0.);
    1663           0 :  TGeoRotation rotrod("rotrod");
    1664             :  //
    1665             :  TGeoRotation *rotpos[2]; 
    1666             :  //
    1667             :  TGeoRotation *rotrod1[2]; 
    1668             : 
    1669             :   
    1670             :  //v9 - drift gas
    1671             : 
    1672           0 :     TGeoRotation rot102("rot102");
    1673           0 :     rot102.RotateY(-90.);
    1674             : 
    1675           0 :   for(Int_t i=0;i<18;i++){
    1676             :     Double_t angle,x,y;
    1677             :     Double_t z,r; 
    1678           0 :     angle=TMath::DegToRad()*20.*(Double_t)i;
    1679             :     //inner rods
    1680             :     r=81.5;
    1681           0 :     x=r * TMath::Cos(angle);
    1682           0 :     y=r * TMath::Sin(angle);
    1683             :     z = 126.;
    1684           0 :     TGeoRotation *rot12 = new TGeoRotation();
    1685           0 :     rot12->RotateZ(-90.0+i*20.);
    1686           0 :     v9->AddNode(tpcihpl,i+1,new TGeoCombiTrans(x, y, 0., rot12));
    1687             :     //
    1688           0 :     if(i==11){//resistor rod inner
    1689           0 :        rotrod.RotateZ(-90.+angle);
    1690           0 :        rotrod1[0]= new TGeoRotation();
    1691           0 :        rotpos[0]= new TGeoRotation();
    1692             :        //
    1693           0 :        rotrod1[0]->RotateZ(-90.+angle);
    1694           0 :        *rotpos[0] = refl*rotrod; //rotation+reflection
    1695           0 :         v9->AddNode(tpcrrod,1,new TGeoCombiTrans(x,y, z, rotrod1[0])); //A
    1696           0 :         v9->AddNode(tpcrrod,2,new TGeoCombiTrans(x,y,-z, rotpos[0])); //C      
    1697             :     } 
    1698             :     else { 
    1699           0 :       v9->AddNode(tpcmrod,i+1,new TGeoTranslation(x,y,z));//shaft
    1700           0 :       v9->AddNode(tpcmrod,i+19,new TGeoCombiTrans(x,y,-z,ref));//muon
    1701             :     }
    1702             :     // outer rods
    1703             :     r=254.25;
    1704           0 :     x=r * TMath::Cos(angle);
    1705           0 :     y=r * TMath::Sin(angle);
    1706             :     z=126.;
    1707             :     //
    1708             :     // outer rod holder + outer left plug
    1709             :     //
    1710           0 :     TGeoRotation *rot33 = new TGeoRotation();
    1711           0 :     rot33->RotateZ(-90+i*20.);
    1712             :     //
    1713           0 :     v9->AddNode(tpcohpl,i+1,new TGeoCombiTrans(x, y, 0., rot33));
    1714             :     //
    1715           0 :     Double_t xxx = 256.297*TMath::Cos((i*20.+10.)*TMath::DegToRad());
    1716           0 :     Double_t yyy = 256.297*TMath::Sin((i*20.+10.)*TMath::DegToRad());
    1717             :     //
    1718           0 :     TGeoRotation rot101("rot101");
    1719           0 :     rot101.RotateZ(90.+i*20.+10.);
    1720           0 :     TGeoRotation *rot103 = new TGeoRotation("rot103");
    1721           0 :     *rot103 = rot101*rot102;
    1722             :     //
    1723           0 :     TGeoCombiTrans *trh100 = new TGeoCombiTrans(xxx,yyy,0.,rot103);
    1724             :     //
    1725           0 :     if(i==2) {
    1726             :       //main membrane holder
    1727           0 :       v9->AddNode(tpcmmh,1,trh100);
    1728             :     }
    1729             :     else{
    1730             :       // "normal" membrane holder
    1731           0 :       v9->AddNode(tpcomh,i+1,trh100);      
    1732             :     }
    1733             : 
    1734             :     //
    1735           0 :     if(i==3){//resistor rod outer
    1736           0 :       rotrod.RotateZ(90.+angle);
    1737           0 :       rotrod1[1]= new TGeoRotation();
    1738           0 :       rotpos[1]= new TGeoRotation();
    1739           0 :       rotrod1[1]->RotateZ(90.+angle);
    1740           0 :       *rotpos[1] = refl*rotrod;//rotation+reflection
    1741           0 :       v9->AddNode(tpcrrod,3,new TGeoCombiTrans(x,y, z, rotrod1[1])); //A 
    1742           0 :       v9->AddNode(tpcrrod,4,new TGeoCombiTrans(x,y, -z, rotpos[1])); //C
    1743             :     }
    1744             :     else {
    1745           0 :       v9->AddNode(tpcmrod,i+37,new TGeoTranslation(x,y,z));//shaft
    1746           0 :       v9->AddNode(tpcmrod,i+55,new TGeoCombiTrans(x,y,-z,ref));//muon      
    1747             :     }
    1748           0 :     if(i==15){
    1749           0 :       v9->AddNode(hvrv,1,new TGeoTranslation(x,y,z+0.7)); //hv->A-side only      
    1750             : 
    1751             : 
    1752             :     }
    1753           0 :   } //end of rods positioning
    1754             : 
    1755           0 :   TGeoVolume *alice = gGeoManager->GetVolume("ALIC");
    1756           0 :   alice->AddNode(v1,1);
    1757             :   
    1758             : 
    1759           0 : } // end of function
    1760             : 
    1761             : 
    1762             : 
    1763             : //_____________________________________________________________________________
    1764             : void AliTPCv0::CreateMaterials()
    1765             : {
    1766             :   //
    1767             :   // Define materials for the TPC
    1768             :   //
    1769           0 :   AliTPC::CreateMaterials();
    1770           0 : }
    1771             : 
    1772             : 
    1773             : //_____________________________________________________________________________
    1774             : void AliTPCv0::Init()
    1775             : {
    1776             :   //
    1777             :   // Initialise Time Projection Chamber version 0
    1778             :   //
    1779             :  
    1780           0 :   printf("%s: *** TPC version 0 initialized***\n",ClassName()); 
    1781             : 
    1782             :   //  printf("TPC version 0 initialized\n");
    1783           0 : }
    1784             : 
    1785             : //_____________________________________________________________________________
    1786             : void AliTPCv0::StepManager()
    1787             : {
    1788             :   //
    1789             :   // Procedure called at each step in the TPC
    1790             :   //
    1791           0 : }

Generated by: LCOV version 1.11