17     const Int_t     NofDisks = 1;   
 
   19     const Double_t  DiskVolInnerRadius[NofDisks]    = { 4.50 };   
 
   20     const Double_t  DiskVolOuterRadius[NofDisks]    = { 45.06  };  
 
   21     const Double_t  DiskZPosition  [NofDisks]    = { 119.40 };   
 
   24     const Int_t     DiskNFoils     [NofDisks]    = {  2    };   
 
   25     const Double_t  MiddleROBarHfTh[NofDisks]    = {  2.35 }; 
 
   26     const Double_t  HalfStationThickness = 8.003;
 
   28     const Double_t  carbonRingInnerRadius[NofDisks]    = { 39.97 };
 
   29     const Double_t  carbonRingOuterRadius[NofDisks]    = { 40.17 };
 
   30     const Double_t  carbonRingHalfThickness = 1.50; 
 
   32     const Double_t  copperRingInnerRadius[NofDisks]    = { 39.47 };
 
   33     const Double_t  copperRingOuterRadius[NofDisks]    = { 39.67 };
 
   34     const Double_t  copperRingHalfThickness = 3.75;
 
   36     const Double_t  AlRingInnerRadius[NofDisks]    = { 39.70 };
 
   37     const Double_t  AlRingOuterRadius[NofDisks]    = { 44.70 };
 
   38     const Double_t  AlRingHalfThickness = 3.75;
 
   40     const Double_t  SegmentHalfThickness = 0.25; 
 
   41     const Int_t     NofSegments = 24;
 
   43     const Double_t  FirstSegmentAngle = 7.5;
 
   44     const TString   newsegment [NofSegments] = { 
"seg1" ,
"seg2" ,
"seg3" ,
"seg4" ,
"seg5" ,
"seg6" ,
"seg7" ,
"seg8" ,
 
   45                                                  "seg9" ,
"seg10",
"seg11",
"seg12",
"seg13",
"seg14",
"seg15",
"seg16",
 
   46                                                  "seg17",
"seg18",
"seg19",
"seg20",
"seg21",
"seg22",
"seg23",
"seg24"  };
 
   48     const Double_t moduleRingInnerRadius[NofDisks]    = { 39.70 };
 
   49     const Double_t moduleRingOuterRadius[NofDisks]    = { 44.65 };
 
   50     const Double_t moduleRingHalfThickness = 3.75;
 
   52     const Double_t  moduleSegmentHalfThickness = 1.30; 
 
   53     const Int_t     NofmoduleSegments = 24;
 
   55     const Double_t  FirstmoduleSegmentAngle = 0.0 ;
 
   56     const TString   newmodulesegment [NofmoduleSegments] = { 
"moduleseg1" ,
"moduleseg2" ,
"moduleseg3" ,
"moduleseg4" ,
"moduleseg5" ,
"moduleseg6" ,
"moduleseg7" ,
"moduleseg8" ,
 
   57                                                              "moduleseg9" ,
"moduleseg10",
"moduleseg11",
"moduleseg12",
"moduleseg13",
"moduleseg14",
"moduleseg15",
"moduleseg16",
 
   58                                                              "moduleseg17",
"moduleseg18",
"moduleseg19",
"moduleseg20",
"moduleseg21",
"moduleseg22",
"moduleseg23",
"moduleseg24"  };
 
   60     const Double_t AlumiRingInnerRadius[NofDisks]    = { 44.7 };
 
   61     const Double_t AlumiRingOuterRadius[NofDisks]    = { 45.0 };
 
   62     const Double_t AlumiRingHalfThickness = 3.75;
 
   64     const Double_t coverRingInnerRadius[NofDisks]    = { 39.70 };
 
   65     const Double_t coverRingOuterRadius[NofDisks]    = { 45.00 };
 
   66     const Double_t coverRingHalfThickness = 0.2;
 
   70     const Double_t rcopperbarHalfThickness = 8.40;
 
   74     const Double_t lcopperbarHalfThickness = 13.80;
 
   77     const Int_t     NofLayers = 49+48; 
 
   79   const TString   LayerName [NofLayers] = {
"space",                                           
 
   80                                            "gap_air",  
"window1_foil_out_aluminium",  
"gap_air",  
"WindowF_kapton",  
"gap_air",  
"window2_foil_out_aluminium", 
"gap_air",             
 
   82                                            "gap_air",  
"WindowF_aluminium",  
"gap_air",  
"CathodeF_kapton",  
"gap_air",  
"CathodeF_aluminium",  
"gap_air", 
 
   87                                            "gap_air",  
"Gem1F_copper",  
"gap_air",  
"Gem1_kapton",  
"gap_air",  
"Gem1B_copper",  
"gap_air",             
 
   89                                            "gap_air",  
"Gem2F_copper",  
"gap_air",  
"Gem2_kapton",  
"gap_air",  
"Gem2B_copper",  
"gap_air",                                   
 
   91                                            "gap_air",  
"Gem3F_copper",  
"gap_air",  
"Gem3_kapton",  
"gap_air",  
"Gem3B_copper",  
"gap_air",                                   
 
   95                                            "gap_air",  
"PadF_copper",  
"gap_air",  
"Pad_kapton",  
"gap_air",  
"PadB_copper",  
"gap_air",
 
   99                                            "gap_air",  
"Gem4F_copper",  
"gap_air",  
"Gem4_kapton",  
"gap_air",  
"Gem4B_copper",  
"gap_air",             
 
  101                                            "gap_air",  
"Gem5F_copper",  
"gap_air",  
"Gem5_kapton",  
"gap_air",  
"Gem5B_copper",  
"gap_air",                                  
 
  103                                            "gap_air",  
"Gem6F_copper",  
"gap_air",  
"Gem6_kapton",  
"gap_air",  
"Gem6B_copper",  
"gap_air", 
 
  108                                            "gap_air",  
"CathodeB_aluminium",  
"gap_air",  
"CathodeB_kapton",  
"gap_air",   
"WindowB_aluminium",  
"gap_air",                          
 
  110                                            "gap_air",  
"window1_foil_in_aluminium",  
"gap_air",  
"WindowB_kapton",  
"gap_air",  
"window2_foil_in_aluminium",  
"gap_air",
 
  114     const Double_t LayerThick[NofLayers] = {    1.0,                       
 
  115                                                 0.00001,  0.0001,    0.00001,     0.0007,    0.00001,    0.0001,     0.00001,  
 
  117                                                 0.00001,  0.0001,    0.00001,     0.0007,    0.00001,    0.0001,     0.00001,  
 
  122                                                 0.00001,  0.0005,    0.00001,     0.0050,    0.00001,    0.0005,     0.00001,  
 
  124                                                 0.00001,  0.0005,    0.00001,     0.0050,    0.00001,    0.0005,     0.00001,  
 
  126                                                 0.00001,  0.0005,    0.00001,     0.0050,    0.00001,    0.0005,     0.00001,  
 
  130                                                 0.00001,  0.001,     0.00001,     0.001,     0.00001,    0.001,      0.00001,  
 
  134                                                 0.00001,  0.0005,    0.00001,     0.0050,    0.00001,    0.0005,     0.00001,  
 
  136                                                 0.00001,  0.0005,    0.00001,     0.0050,    0.00001,    0.0005,     0.00001,  
 
  138                                                 0.00001,  0.0005,    0.00001,     0.0050,    0.00001,    0.0005,     0.00001,  
 
  143                                                 0.00001,  0.0001,    0.00001,     0.0007,    0.00001,    0.0001,     0.00001,  
 
  145                                                 0.00001,  0.0001,    0.00001,     0.0007,    0.00001,    0.0001,     0.00001,  
 
  150  const Double_t DiskOuterRadius[NofLayers][NofDisks] = { 39.90, 
 
  151                                                          38.95,       38.95,       39.40,       39.40,       38.95,      38.95,      38.95, 
 
  153                                                          38.45,       38.45,       39.40,       39.40,       38.45,      38.45,      38.45, 
 
  158                                                          38.10,       38.10,       39.05,       39.05,       38.10,      38.10,      38.10,  
 
  160                                                          38.10,       38.10,       39.05,       39.05,       38.10,      38.10,      38.10, 
 
  162                                                          38.10,       38.10,       39.05,       39.05,       38.10,      38.10,      38.10, 
 
  166                                                          44.90,       44.90,       44.90,       44.90,       44.90,      44.90,      39.05, 
 
  170                                                          38.10,       38.10,       39.05,       39.05,       38.10,      38.10,      38.10, 
 
  172                                                          38.10,       38.10,       39.05,       39.05,       38.10,      38.10,      38.10, 
 
  174                                                          38.10,       38.10,       39.05,       39.05,       38.10,      38.10,      38.10, 
 
  179                                                          38.45,       38.45,       39.40,       39.40,       38.45,      38.45,      38.45, 
 
  181                                                          39.40,       39.40,       38.95,       38.95,       39.40,      39.40,      39.40, 
 
  185    const Double_t DiskInnerRadius[NofLayers][NofDisks] = { 4.50,   
 
  186                                                            4.50,         4.50,           4.50,         4.50,         4.50,         4.50,         4.50,  
 
  188                                                            4.50,         4.50,           4.50,         4.50,         4.50,         4.50,         4.50,   
 
  193                                                            4.50,         4.50,           4.50,         4.50,         4.50,         4.50,         4.50,    
 
  195                                                            4.50,         4.50,           4.50,         4.50,         4.50,         4.50,         4.50,          
 
  197                                                            4.50,         4.50,           4.50,         4.50,         4.50,         4.50,         4.50,   
 
  201                                                            4.50,         4.50,           4.50,         4.50,         4.50,         4.50,         4.50,   
 
  205                                                            4.50,         4.50,           4.50,         4.50,         4.50,         4.50,         4.50,   
 
  207                                                            4.50,         4.50,           4.50,         4.50,         4.50,         4.50,         4.50,   
 
  209                                                            4.50,         4.50,           4.50,         4.50,         4.50,         4.50,         4.50,   
 
  214                                                            4.50,         4.50,           4.50,        4.50,          4.50,        4.50,         4.50,  
 
  216                                                            4.50,         4.50,           4.50,        4.50,          4.50,        4.50,         4.50,  
 
  225   const Int_t    NofSensLayers = 2;
 
  227   const Double_t  sMiddleROBarHfTh[NofDisks]  = { 2.35 }; 
 
  229   const TString  SensLayerName[NofSensLayers] = {  
"Gem1_Sensor_GEMmixture",      
 
  230                                                    "Gem6_Sensor_GEMmixture"  };
 
  232   const Double_t SensLayerThick[NofSensLayers] =  {   0.85,
 
  235   const Double_t SensZPosition[NofSensLayers][NofDisks] = {   -0.69412,  
 
  238   const Double_t SensOuterRadius[NofSensLayers][NofDisks] = {   38.15,  
 
  241   const Double_t SensInnerRadius[NofSensLayers][NofDisks] = {   5.00, 
 
  249     const Int_t     NofHLayers = 16;
 
  251     const TString   HLayersName [NofHLayers] = {  
"windowF1_ring_carbon",
 
  253                                                   "windowF2_ring_carbon",
 
  255                                                   "cathodeF_ring_GlassFiber",
 
  257                                                   "gem_ring1_GlassFiber",
 
  259                                                   "gem_ring2_GlassFiber",
 
  261                                                   "gem_ring3_GlassFiber",
 
  263                                                   "gem_ring4_GlassFiber",                                                 
 
  264                                                   "padplaneF_support_GlassFiber",
 
  266                                                   "padplaneB_support_GlassFiber",
 
  267                                                   "gem_ring5_GlassFiber",
 
  269                                                   "gem_ring6_GlassFiber",
 
  271                                                   "gem_ring7_GlassFiber",
 
  273                                                   "gem_ring8_GlassFiber",
 
  275                                                   "cathodeB_ring_GlassFiber",
 
  277                                                   "windowB1_ring_carbon",
 
  279                                                   "windowB2_ring_carbon"      };
 
  281     const Double_t HLayersThick[NofHLayers] =  {    1.00,                                                   
 
  299     const Double_t  HZPosition[NofHLayers][NofDisks] = { -2.62100,                                                                
 
  317    const Double_t HOuterRadius[NofHLayers][NofDisks] = {   39.90,                                                               
 
  334    const Double_t HInnerRadius[NofHLayers][NofDisks] = {   38.50,                                                             
 
  357    const Double_t  HTY[NofHLayers][NofDisks] = {  25.0,  
 
  376   const Int_t    SensorStripType [2]    = {  3  ,  2   };  
 
  378   const Double_t SensorStripAngle[2][2] = {  0.  ,  0.  ,  0.  ,  0.  };
 
  379   const Double_t SensorStripPitch[2][2] = {  0.04,  0.04,  0.04,  0.04}; 
 
  383   for ( Int_t ilayer = 0 ; ilayer < NofLayers ; ilayer++ ) {
 
  384     cout << LayerName[ilayer].Data() << 
" -> " << LayerThick[ilayer] << endl;
 
  385     firstLayerOffset += LayerThick[ilayer];
 
  388   cout << 
"total thickness is " << firstLayerOffset << endl;
 
  389   firstLayerOffset = firstLayerOffset/2.;
 
  390   firstLayerOffset = -0.001*(TMath::Floor(1000.*firstLayerOffset));
 
  391   cout << 
"first layer offset is " << firstLayerOffset << endl;
 
  394   TString vmcWorkdir = getenv(
"VMCWORKDIR");
 
  396   TString outfile= 
"../../geometry/gem_1Station_first_realistic_v2.root"; 
 
  399   TFile* 
fi = 
new TFile(outfile,
"RECREATE");  
 
  401   cout << 
"created output file" << endl;
 
  402   FairGeoLoader* 
geoLoad = 
new FairGeoLoader(
"TGeo",
"FairGeoLoader");
 
  403   FairGeoInterface *
geoFace = geoLoad->getGeoInterface();
 
  404   cout << 
"geoface setmediafile" << endl;
 
  405   geoFace->setMediaFile(
"../../geometry/media_pnd.geo");
 
  406   cout << 
"geoface readmedia" << endl;
 
  407   geoFace->readMedia();
 
  408   cout << 
"geoface print" << endl;
 
  410   cout << 
"geoface done" << endl;
 
  412   FairGeoMedia *
Media =  geoFace->getMedia();
 
  413   FairGeoBuilder *
geobuild=geoLoad->getGeoBuilder();
 
  419   FairGeoMedium *CbmMediumCopper    = Media->getMedium(
"copper");
 
  420   FairGeoMedium *CbmMediumKapton    = Media->getMedium(
"kapton");
 
  421   FairGeoMedium *CbmMediumArCO2     = Media->getMedium(
"GEMmixture"); 
 
  422   FairGeoMedium *CbmMediumUranium   = Media->getMedium(
"uranium");
 
  423   FairGeoMedium *CbmMediumGlassFiber= Media->getMedium(
"GlassFiber");
 
  425   Int_t 
nmed=geobuild->createMedium(CbmMediumAir);
 
  426   nmed=geobuild->createMedium(CbmMediumPWO);
 
  427   nmed=geobuild->createMedium(CbmMediumCarbon);
 
  428   nmed=geobuild->createMedium(CbmMediumAluminium);
 
  429   nmed=geobuild->createMedium(CbmMediumCopper);
 
  430   nmed=geobuild->createMedium(CbmMediumKapton);
 
  431   nmed=geobuild->createMedium(CbmMediumArCO2);
 
  432   nmed=geobuild->createMedium(CbmMediumUranium);
 
  433   nmed=geobuild->createMedium(CbmMediumGlassFiber);
 
  436   TGeoManager* 
gGeoMan = (TGeoManager*)gROOT->FindObject(
"FAIRGeom");
 
  438   TGeoVolume *
top = 
new TGeoVolumeAssembly(
"Gem");
 
  440   gGeoMan->SetTopVolume(top);
 
  442   cout << 
"-------------------------------------------------------------------" << endl;
 
  443   TList* mediaList = (TList*)gGeoMan->GetListOfMedia();
 
  445   cout << 
"media known: " << mediaList->GetEntries() << 
"." << endl;
 
  446   for ( Int_t itemp = 0 ; itemp < mediaList->GetEntries() ; itemp++ ) {
 
  447     TGeoMedium* 
medium = (TGeoMedium*)mediaList->At(itemp);
 
  448     cout << 
"medium " << itemp << 
" name is " << medium->GetName() << endl;
 
  450   cout << 
"-------------------------------------------------------------------" << endl;
 
  452   TGeoRotation* 
dummyrot = 
new TGeoRotation();
 
  454   TGeoVolumeAssembly* 
SubunitVol = 
new TGeoVolumeAssembly(
"Gem_Disks");
 
  457    TGeoShape          *DiskShape[NofDisks];
 
  458    TGeoVolume         *DiskVol  [NofDisks];
 
  459    TGeoRotation       *DiskRotat[NofDisks];
 
  460    TGeoTranslation    *DiskTrans[NofDisks];   
 
  461    TGeoCombiTrans     *DiskCombi[NofDisks];   
 
  463    TGeoShape          *carbonRingShape[NofDisks];
 
  464    TGeoVolume         *carbonRingVol  [NofDisks];  
 
  465    TGeoTranslation    *carbonRingTrans[NofDisks];
 
  466    TGeoCombiTrans     *carbonRingCombi[NofDisks];
 
  468    TGeoShape          *copperRingShape[NofDisks];
 
  469    TGeoVolume         *copperRingVol  [NofDisks];  
 
  470    TGeoTranslation    *copperRingTrans[NofDisks];
 
  471    TGeoCombiTrans     *copperRingCombi[NofDisks];
 
  473    TGeoShape          *coverRingShape[NofDisks];
 
  474    TGeoVolume         *coverRingVol  [NofDisks];  
 
  475    TGeoTranslation    *coverRingTrans[NofDisks];
 
  476    TGeoCombiTrans     *coverRingCombi[NofDisks];
 
  478    TGeoShape          *tAcopperbarShape;
 
  479    TGeoVolume         *tAcopperbarVol  ;  
 
  480    TGeoTranslation    *tAcopperbarTrans;
 
  481    TGeoRotation       *tAcopperbarRot;
 
  482    TGeoCombiTrans     *tAcopperbarCombi;
 
  484    TGeoShape          *tBcopperbarShape;
 
  485    TGeoVolume         *tBcopperbarVol  ;  
 
  486    TGeoTranslation    *tBcopperbarTrans;
 
  487    TGeoRotation       *tBcopperbarRot;
 
  488    TGeoCombiTrans     *tBcopperbarCombi;
 
  490    TGeoShape          *dAcopperbarShape;
 
  491    TGeoVolume         *dAcopperbarVol  ;  
 
  492    TGeoTranslation    *dAcopperbarTrans;
 
  493    TGeoRotation       *dAcopperbarRot;
 
  494    TGeoCombiTrans     *dAcopperbarCombi;
 
  496    TGeoShape          *dBcopperbarShape;
 
  497    TGeoVolume         *dBcopperbarVol  ;  
 
  498    TGeoTranslation    *dBcopperbarTrans;
 
  499    TGeoRotation       *dBcopperbarRot;
 
  500    TGeoCombiTrans     *dBcopperbarCombi;
 
  502    TGeoShape          *AlRingShape[NofDisks][NofSegments];
 
  503    TGeoVolume         *AlRingVol  [NofDisks][NofSegments];  
 
  504    TGeoTranslation    *AlRingTrans[NofDisks][NofSegments];
 
  505    TGeoCombiTrans     *AlRingCombi[NofDisks][NofSegments];
 
  507    TGeoShape          *moduleRingShape[NofDisks][NofmoduleSegments];
 
  508    TGeoVolume         *moduleRingVol  [NofDisks][NofmoduleSegments];  
 
  509    TGeoTranslation    *moduleRingTrans[NofDisks][NofmoduleSegments];
 
  510    TGeoCombiTrans     *moduleRingCombi[NofDisks][NofmoduleSegments];
 
  512    TGeoShape          *AlumiRingShape[NofDisks];
 
  513    TGeoVolume         *AlumiRingVol  [NofDisks];  
 
  514    TGeoTranslation    *AlumiRingTrans[NofDisks];
 
  515    TGeoCombiTrans     *AlumiRingCombi[NofDisks];
 
  517    TGeoShape          *DiskLayersShapeA     [NofLayers][NofDisks][4]; 
 
  518    TGeoShape          *DiskLayersShapeB     [NofLayers][NofDisks][4];
 
  519    TGeoSubtraction    *DiskLayersSubtr      [NofLayers][NofDisks][4];
 
  520    TGeoShape          *DiskLayersShapeC     [NofLayers][NofDisks][4]; 
 
  521    TGeoShape          *DiskLayersShapeHole  [NofLayers][NofDisks][4];
 
  522    TGeoCompositeShape *DiskLayersShapecompos[NofLayers][NofDisks][4];
 
  523    TGeoVolume         *DiskLayersVol        [NofLayers][NofDisks][4];
 
  524    TGeoTranslation    *DiskLayersTranshA    [NofLayers][NofDisks][4];
 
  525    TGeoTranslation    *DiskLayersTranshB    [NofLayers][NofDisks][4];
 
  526    TGeoTranslation    *DiskLayersTrans      [NofLayers][NofDisks][4];
 
  527    TGeoCombiTrans     *DiskLayersCombi      [NofLayers][NofDisks][4];
 
  529    TGeoShape          *SensDiskLayersShapeA     [NofSensLayers][NofDisks][4]; 
 
  530    TGeoShape          *SensDiskLayersShapeB     [NofSensLayers][NofDisks][4];
 
  531    TGeoSubtraction    *SensDiskLayersSubtr      [NofSensLayers][NofDisks][4];
 
  532    TGeoShape          *SensDiskLayersShapeC     [NofSensLayers][NofDisks][4]; 
 
  533    TGeoShape          *SensDiskLayersShapeHole  [NofSensLayers][NofDisks][4];
 
  534    TGeoCompositeShape *SensDiskLayersShapecompos[NofSensLayers][NofDisks][4];
 
  535    TGeoVolume         *SensDiskLayersVol        [NofSensLayers][NofDisks][4];
 
  536    TGeoTranslation    *SensDiskLayersTranshA    [NofSensLayers][NofDisks][4];
 
  537    TGeoTranslation    *SensDiskLayersTranshB    [NofSensLayers][NofDisks][4];
 
  538    TGeoTranslation    *SensDiskLayersTrans      [NofSensLayers][NofDisks][4];
 
  539    TGeoCombiTrans     *SensDiskLayersCombi      [NofSensLayers][NofDisks][4];
 
  541    TGeoShape          *HLayersShapeTube  [NofHLayers][NofDisks];
 
  542    TGeoShape          *HLayersShapeBox   [NofHLayers][NofDisks];
 
  543    TGeoShape          *HLayersShapePlate [NofHLayers][NofDisks];  
 
  544    TGeoShape          *HLayersShapeHT    [NofHLayers][NofDisks];  
 
  545    TGeoShape          *HLayersShapeHTM   [NofHLayers][NofDisks];  
 
  546    TGeoShape          *HLayersShapeHTD   [NofHLayers][NofDisks]; 
 
  547    TGeoCompositeShape *HLayersShapecompos[NofHLayers][NofDisks]; 
 
  548    TGeoVolume         *HLayersVolcomp    [NofHLayers][NofDisks];
 
  549    TGeoTranslation    *HLayersTranstA    [NofHLayers][NofDisks];
 
  550    TGeoTranslation    *HLayersTranstB    [NofHLayers][NofDisks];  
 
  551    TGeoTranslation    *HLayersTranstC    [NofHLayers][NofDisks];  
 
  552    TGeoTranslation    *HLayersTranstD    [NofHLayers][NofDisks];  
 
  553    TGeoTranslation    *HLayersTranstE    [NofHLayers][NofDisks];  
 
  554    TGeoTranslation    *HLayersTranstF    [NofHLayers][NofDisks];  
 
  555    TGeoRotation       *HLayersRotrA      [NofHLayers][NofDisks];
 
  556    TGeoShape          *HLayersShape      [NofHLayers][NofDisks];
 
  557    TGeoVolume         *HLayersVol        [NofHLayers][NofDisks];
 
  558    TGeoTranslation    *HLayersTrans      [NofHLayers][NofDisks];
 
  559    TGeoCombiTrans     *HLayersCombi      [NofHLayers][NofDisks];
 
  561    TGeoShape          *RiddleShapeTubeA ; 
 
  562    TGeoShape          *RiddleShapeTubeB ; 
 
  563    TGeoShape          *RiddleShapeCone  ; 
 
  564    TGeoShape          *RiddleShapeTubeC ; 
 
  565    TGeoShape          *RiddleShapeTubeD ; 
 
  566    TGeoShape          *RiddleShapeTubeE ; 
 
  567    TGeoShape          *RiddleShapeTubeF ; 
 
  568    TGeoSubtraction    *RiddleSubtr      ;
 
  569    TGeoCompositeShape *RiddleShapecompos;
 
  570    TGeoVolume         *RiddleVolcomp    ;
 
  571    TGeoTranslation    *RiddleTrans      ;
 
  572    TGeoTranslation    *RiddleTransTubeA ;
 
  573    TGeoTranslation    *RiddleTransCone  ;
 
  574    TGeoTranslation    *RiddleTransTubeC ;
 
  575    TGeoTranslation    *RiddleTransTubeD ;
 
  576    TGeoTranslation    *RiddleTransTubeE ;
 
  577    TGeoCombiTrans     *RiddleCombi      ;
 
  578    TGeoTranslation    *RiddleTransTubeF[4][100] ;
 
  579    TGeoCombiTrans     *RiddleCombiTranshole[4][100] ;
 
  580    TGeoRotation       *RiddleRothole[4][100] ;
 
  582    TString outParFileName = Form(
"%s/macro/params/gem_1Station_first_realistic_v2.digi.par",vmcWorkdir.Data()); 
 
  585   cout << 
"parameter file = \"" << outParFileName.Data() << 
"\"" << endl;
 
  587   ofstream pout(outParFileName.Data());
 
  588   pout.setf(ios::fixed);
 
  590   pout << 
"#################################################################" << endl;
 
  591   pout << 
"# Digitization parameters for GEM                                " << endl;
 
  592   pout << 
"# with 1 Station                                                " << endl;
 
  593   pout << 
"# Format:                                                        " << endl;
 
  594   pout << 
"# Description of parameters:                                     " << endl;
 
  595   pout << 
"# [PndGemDetectors]                                              " << endl;
 
  596   pout << 
"# parameters:d station_number, ZPos, rotation_angle, number_of_sensors, \\" << endl;
 
  597   pout << 
"#              sensor_number, sensor_type, pos_x, pos_y, pos_z, rotAngle, inn_rad, out_rad, thick, str_ang_0, str_ang_1, barWidth, pitch_0, pitch_1, \\" << endl;
 
  598   pout << 
"#              sensor_number, ...." << endl;
 
  599   pout << 
"#              station_number, ..." << endl;
 
  600   pout << 
"#################################################################" << endl;
 
  601   pout << 
"[PndGemDetectors]" << setprecision(4) << endl;
 
  603   pout << 
"parameters:Double_t \\" << endl;
 
  605        for ( Int_t istat = 0 ; istat < NofDisks ; istat++ ) {
 
  607          pout << 
"                   " << istat+1 << 
",  " 
  608          << setw(9) << DiskZPosition[istat]
 
  609          << 
",  0.0, " << 2 << 
", \\" << endl;
 
  612     DiskShape[istat] = 
new TGeoTube  (Form(
"disk%dshape",istat+1),DiskVolInnerRadius[istat],DiskVolOuterRadius[istat],HalfStationThickness);
 
  613     DiskVol  [istat] = 
new TGeoVolume(Form(
"Gem_Disk%d_Volume",istat+1),DiskShape[istat],gGeoMan->GetMedium(
"GEMmixture"));
 
  614     DiskTrans[istat] = 
new TGeoTranslation(0.,0.,DiskZPosition[istat]);
 
  615     cout << 
"station " << DiskVolInnerRadius[istat] << 
" " << DiskVolOuterRadius[istat] << 
" at " << DiskZPosition[istat] << endl;              
 
  617     DiskCombi[istat] = 
new TGeoCombiTrans(*DiskTrans[istat],*dummyrot);
 
  620     DiskRotat[istat] = 
new TGeoRotation(Form(
"disk%drotat"), 0.0, 180.0, 0.0); 
 
  621     DiskCombi[istat] = 
new TGeoCombiTrans(*DiskTrans[istat],*DiskRotat[istat]);
 
  624     DiskCombi[istat]->SetName(Form(
"Gem_Disk%d_Volume",istat+1));
 
  625     DiskCombi[istat]->RegisterYourself();
 
  626     DiskVol[istat]->SetLineColor(kYellow);
 
  629     carbonRingShape[istat] = 
new TGeoTube  (Form(
"carbonRing%dshape",istat+1),carbonRingInnerRadius[istat],carbonRingOuterRadius[istat],carbonRingHalfThickness);
 
  630     carbonRingVol  [istat] = 
new TGeoVolume(Form(
"Gem_carbonRing%d_Volume",istat+1),carbonRingShape[istat],gGeoMan->GetMedium(
"carbon"));
 
  631     carbonRingTrans[istat] = 
new TGeoTranslation(0.,0.,-1.61);
 
  632     cout << 
"carbonRing " << carbonRingInnerRadius[istat] << 
" " << carbonRingOuterRadius[istat] << endl;
 
  633     carbonRingCombi[istat] = 
new TGeoCombiTrans(*carbonRingTrans[istat],*dummyrot); 
 
  634     carbonRingCombi[istat]->SetName(Form(
"Gem_carbonRing%d_Volume",istat+1));
 
  635     carbonRingCombi[istat]->RegisterYourself();
 
  636     carbonRingVol[istat]->SetLineColor(kMagenta);
 
  638     DiskVol[istat]->AddNode(carbonRingVol[istat],0,carbonRingCombi[istat]);
 
  641     copperRingShape[istat] = 
new TGeoTube  (Form(
"copperRing%dshape",istat+1),copperRingInnerRadius[istat],copperRingOuterRadius[istat],copperRingHalfThickness);
 
  642     copperRingVol  [istat] = 
new TGeoVolume(Form(
"Gem_copperRing%d_Volume",istat+1),copperRingShape[istat],gGeoMan->GetMedium(
"copper"));
 
  643     copperRingTrans[istat] = 
new TGeoTranslation(0.,0.,3.853);
 
  644     cout << 
"copperRing " << copperRingInnerRadius[istat] << 
" " << copperRingOuterRadius[istat] << endl;
 
  645     copperRingCombi[istat] = 
new TGeoCombiTrans(*copperRingTrans[istat],*dummyrot); 
 
  646     copperRingCombi[istat]->SetName(Form(
"Gem_copperRing%d_Volume",istat+1));
 
  647     copperRingCombi[istat]->RegisterYourself();
 
  648     copperRingVol[istat]->SetLineColor(kYellow-5);
 
  650     DiskVol[istat]->AddNode(copperRingVol[istat],0,copperRingCombi[istat]);
 
  653       Double_t segmentAngularSize = SegmentHalfThickness/AlRingInnerRadius[istat]*360.;
 
  654            for ( Int_t isegm = 0 ; isegm < NofSegments ; isegm++ ) {
 
  655                  cout << 
" Segment " << isegm << 
" with name " << newsegment[isegm] << 
" will be put at " << FirstSegmentAngle+isegm*SegmentDeltaAngle << 
" (in fact from " << FirstSegmentAngle+isegm*SegmentDeltaAngle-segmentAngularSize/2. << 
" to " << FirstSegmentAngle+isegm*SegmentDeltaAngle+segmentAngularSize/2. << 
")" << endl;
 
  656            AlRingShape[istat][isegm] = 
new TGeoTubeSeg (Form(
"AlRing%dshape",istat+1,isegm+1),AlRingInnerRadius[istat],AlRingOuterRadius[istat],AlRingHalfThickness,FirstSegmentAngle+isegm*SegmentDeltaAngle-segmentAngularSize/2.,FirstSegmentAngle+isegm*SegmentDeltaAngle+segmentAngularSize/2. );
 
  657            AlRingVol[istat][isegm]   = 
new TGeoVolume (Form(
"Gem_AlRing%d_Volume",istat+1,isegm+1),AlRingShape[istat][isegm],gGeoMan->GetMedium(
"aluminium")); 
 
  658            AlRingTrans[istat][isegm] = 
new TGeoTranslation (0.,0.,3.853);
 
  659             cout << 
"AlRing " << AlRingInnerRadius[istat] << 
" " << AlRingOuterRadius[istat] << endl;
 
  660            AlRingCombi[istat][isegm] = 
new TGeoCombiTrans (*AlRingTrans[istat][isegm],*dummyrot);
 
  661            AlRingCombi[istat][isegm]->SetName(Form(
"Gem_AlRing%d_Volume",istat+1,isegm+1));
 
  662            AlRingCombi[istat][isegm]->RegisterYourself(); 
 
  663            AlRingVol[istat][isegm]->SetLineColor(kCyan-9);
 
  665            DiskVol[istat]->AddNode(AlRingVol[istat][isegm],0,AlRingCombi[istat][isegm]);
 
  670       Double_t modulesegmentAngularSize = moduleSegmentHalfThickness/moduleRingInnerRadius[istat]*360.;
 
  671            for ( Int_t imodulesegm = 0 ; imodulesegm < NofmoduleSegments ; imodulesegm++ ) {
 
  672                  cout << 
" moduleSegment " << imodulesegm << 
" with name " << newmodulesegment[imodulesegm] << 
" will be put at " << FirstmoduleSegmentAngle+imodulesegm*moduleSegmentDeltaAngle << 
" (in fact from " << FirstmoduleSegmentAngle+imodulesegm*moduleSegmentDeltaAngle-modulesegmentAngularSize/2. << 
" to " << FirstmoduleSegmentAngle+imodulesegm*moduleSegmentDeltaAngle+modulesegmentAngularSize/2. << 
")" << endl;
 
  673           moduleRingShape[istat][imodulesegm] = 
new TGeoTubeSeg (Form(
"moduleRing%dshape",istat+1,imodulesegm+1),moduleRingInnerRadius[istat],moduleRingOuterRadius[istat],moduleRingHalfThickness,FirstmoduleSegmentAngle+imodulesegm*moduleSegmentDeltaAngle-modulesegmentAngularSize/2.,FirstmoduleSegmentAngle+imodulesegm*moduleSegmentDeltaAngle+modulesegmentAngularSize/2. );
 
  674           moduleRingVol[istat][imodulesegm]   = 
new TGeoVolume (Form(
"Gem_moduleRing%d_Volume",istat+1,imodulesegm+1),moduleRingShape[istat][imodulesegm],gGeoMan->GetMedium(
"copper")); 
 
  675           moduleRingTrans[istat][imodulesegm] = 
new TGeoTranslation (0.,0.,3.853);
 
  676             cout << 
"moduleRing " << moduleRingInnerRadius[istat] << 
" " << moduleRingOuterRadius[istat] << endl;
 
  677           moduleRingCombi[istat][imodulesegm] = 
new TGeoCombiTrans (*moduleRingTrans[istat][imodulesegm],*dummyrot);
 
  678           moduleRingCombi[istat][imodulesegm]->SetName(Form(
"Gem_moduleRing%d_Volume",istat+1,imodulesegm+1));
 
  679           moduleRingCombi[istat][imodulesegm]->RegisterYourself(); 
 
  680           moduleRingVol[istat][imodulesegm]->SetLineColor(kGreen);
 
  682    DiskVol[istat]->AddNode(moduleRingVol[istat][imodulesegm],0,moduleRingCombi[istat][imodulesegm]);
 
  686      AlumiRingShape[istat] = 
new TGeoTube  (Form(
"AlumiRing%dshape",istat+1),AlumiRingInnerRadius[istat],AlumiRingOuterRadius[istat],AlumiRingHalfThickness);
 
  687      AlumiRingVol  [istat] = 
new TGeoVolume(Form(
"Gem_AlumiRing%d_Volume",istat+1),AlumiRingShape[istat],gGeoMan->GetMedium(
"aluminium"));
 
  688      AlumiRingTrans[istat] = 
new TGeoTranslation(0.,0.,3.853);
 
  689      cout << 
"AlumiRing " << AlumiRingInnerRadius[istat] << 
" " << AlumiRingOuterRadius[istat] << endl;
 
  690      AlumiRingCombi[istat] = 
new TGeoCombiTrans(*AlumiRingTrans[istat],*dummyrot); 
 
  691      AlumiRingCombi[istat]->SetName(Form(
"Gem_AlumiRing%d_Volume",istat+1));
 
  692      AlumiRingCombi[istat]->RegisterYourself();
 
  693      AlumiRingVol[istat]->SetLineColor(kCyan-9);
 
  695    DiskVol[istat]->AddNode(AlumiRingVol[istat],0,AlumiRingCombi[istat]);
 
  698     coverRingShape[istat] = 
new TGeoTube  (Form(
"coverRing%dshape",istat+1),coverRingInnerRadius[istat],coverRingOuterRadius[istat],coverRingHalfThickness);
 
  699     coverRingVol  [istat] = 
new TGeoVolume(Form(
"Gem_coverRing%d_Volume",istat+1),coverRingShape[istat],gGeoMan->GetMedium(
"GlassFiber"));
 
  700     coverRingTrans[istat] = 
new TGeoTranslation(0.,0.,7.803);
 
  701     cout << 
"coverRing " << coverRingInnerRadius[istat] << 
" " << coverRingOuterRadius[istat] << endl;
 
  702     coverRingCombi[istat] = 
new TGeoCombiTrans(*coverRingTrans[istat],*dummyrot); 
 
  703     coverRingCombi[istat]->SetName(Form(
"Gem_coverRing%d_Volume",istat+1));
 
  704     coverRingCombi[istat]->RegisterYourself();
 
  705     coverRingVol[istat]->SetLineColor(kGreen+3);
 
  707     DiskVol[istat]->AddNode(coverRingVol[istat],0,coverRingCombi[istat]);
 
  724     for ( Int_t jlay = 0 ; jlay < NofHLayers ; jlay++ ) {
 
  726     cout << 
"doing Hlayers " << jlay << endl;            
 
  738     cout << 
"  got Hlayer " << HLayersName[jlay].Data() << endl;
 
  740     HLayersShapeTube[jlay][istat] = 
new TGeoTube  (Form(
"T%dT%s",istat+1,HLayersName[jlay].Data()),HInnerRadius[jlay][istat],HOuterRadius[jlay][istat],HLayersThick[jlay]/2.);
 
  741     HLayersShapeHT[jlay][istat]   = 
new TGeoTube  (Form(
"H%dH%s",istat+1,HLayersName[jlay].Data()),0.0,5.00,HLayersThick[jlay]/2.);
 
  742     HLayersShapeHTM[jlay][istat]  = 
new TGeoTube  (Form(
"HTM%dHTM%s",istat+1,HLayersName[jlay].Data()),0.0,4.50,HLayersThick[jlay]/2.+0.0002);
 
  743     HLayersShapeHTD[jlay][istat]  = 
new TGeoTube  (Form(
"HTD%dHTD%s",istat+1,HLayersName[jlay].Data()),0.0,1.90,HLayersThick[jlay]/2.+0.0001);
 
  744                cout << 
"Tube name is " << HLayersShapeTube[jlay][istat]->GetName() << endl;
 
  746     HLayersShapeBox[jlay][istat]   = 
new TGeoBBox(Form(
"B%dB%s",istat+1,HLayersName[jlay].Data()),HXBoxWidth,HOuterRadius[jlay][istat],HLayersThick[jlay]/2.);
 
  747     HLayersShapePlate[jlay][istat] = 
new TGeoBBox(Form(
"P%dP%s",istat+1,HLayersName[jlay].Data()),HXPlateWidth,HYPlateWidth,HLayersThick[jlay]/2.+0.0001);
 
  749     HLayersTranstA[jlay][istat] = 
new TGeoTranslation(
"tA",HTX,HTY[jlay][istat],HTZ);
 
  750      HLayersTranstA[jlay][istat] ->RegisterYourself();
 
  751     HLayersTranstB[jlay][istat] = 
new TGeoTranslation(
"tB",HTX,-HTY[jlay][istat],HTZ);
 
  752      HLayersTranstB[jlay][istat] ->RegisterYourself();
 
  753     HLayersTranstC[jlay][istat] = 
new TGeoTranslation(
"tC",HTX,HTY[jlay][istat]+9.0,HTZ);
 
  754      HLayersTranstC[jlay][istat] ->RegisterYourself();
 
  755     HLayersTranstD[jlay][istat] = 
new TGeoTranslation(
"tD",HTX,HTY[jlay][istat]-9.0,HTZ);
 
  756      HLayersTranstD[jlay][istat] ->RegisterYourself();
 
  757     HLayersTranstE[jlay][istat] = 
new TGeoTranslation(
"tE",HTX,-HTY[jlay][istat]+9.0,HTZ);
 
  758      HLayersTranstE[jlay][istat] ->RegisterYourself();
 
  759     HLayersTranstF[jlay][istat] = 
new TGeoTranslation(
"tF",HTX,-HTY[jlay][istat]-9.0,HTZ);
 
  760      HLayersTranstF[jlay][istat] ->RegisterYourself();
 
  762     HLayersShapecompos[jlay][istat] = 
new TGeoCompositeShape(Form(
"compos%dcompos%s",istat+1,HLayersName[jlay].Data()),
 
  763                                                              Form(
"T%dT%s+B%dB%s+H%dH%s-HTM%dHTM%s-(P%dP%s:tA)-(HTD%dHTD%s:tC)-(HTD%dHTD%s:tD)-(P%dP%s:tB)-(HTD%dHTD%s:tE)-(HTD%dHTD%s:tF)",
 
  764                                                                   istat+1,HLayersName[jlay].Data(),istat+1,HLayersName[jlay].Data(),istat+1,HLayersName[jlay].Data(),istat+1,HLayersName[jlay].Data(),
 
  765                                                                   istat+1,HLayersName[jlay].Data(),istat+1,HLayersName[jlay].Data(),istat+1,HLayersName[jlay].Data(),istat+1,HLayersName[jlay].Data(),
 
  766                                                                   istat+1,HLayersName[jlay].Data(),istat+1,HLayersName[jlay].Data()));
 
  768       cout << 
"composite name is " <<  HLayersShapecompos[jlay][istat] -> GetName() << endl;
 
  770         TString HlayersMaterial = HLayersName[jlay].Data();
 
  771         HlayersMaterial.Remove(0,HlayersMaterial.Last(
'_')+1);
 
  772                 cout << 
"THE HMATERIAL IS \"" << HlayersMaterial.Data() << 
"\"" << endl;
 
  773                 HLayersVolcomp[jlay][istat] = 
new TGeoVolume(Form(
"GEMHLayersCOMP%dGEMHLayersCOMP%s",istat+1,HLayersName[jlay].Data()),HLayersShapecompos[jlay][istat],gGeoMan->GetMedium(HlayersMaterial.Data()));
 
  774                 cout << 
"COMP name is " <<  HLayersVolcomp[jlay][istat]  -> GetName() << endl;
 
  775         cout << 
"Hlayersmaterial = " << HlayersMaterial.Data() << endl;
 
  777           if ( HlayersMaterial.Contains(
"carbon" ) )
 
  779                 if ( HlayersMaterial.Contains(
"GlassFiber" ) )
 
  782                 cout << 
"STATION " << istat << 
" LAYER " << jlay << 
" POSITION " << HZPosition[jlay][istat] << endl;
 
  784                 HLayersTrans[jlay][istat] = 
new TGeoTranslation(0.0,0.0,HZPosition[jlay][istat]);
 
  785           HLayersCombi[jlay][istat] = 
new TGeoCombiTrans(*HLayersTrans[jlay][istat],*dummyrot); 
 
  786           HLayersCombi[jlay][istat]->SetName(Form(
"GEMHLayersCOMP%dGEMHLayersCOMP%s",istat+1,HLayersName[jlay].Data()));
 
  787           HLayersCombi[jlay][istat]->RegisterYourself();
 
  788           DiskVol[istat]->AddNode( HLayersVolcomp[jlay][istat],0,HLayersCombi[jlay][istat] );
 
  793     Int_t sensorNumber = 0;
 
  795     for ( Int_t slay = 0 ; slay < NofSensLayers ; slay++ ) {
 
  796       cout << 
"doing Senslayer " << slay << endl;
 
  798         if ( SensLayerName[slay].Contains(
"space") && SensLayerThick[slay] > 0.0 ) {
 
  799           cout << 
"***** THE THICK SPACE SensLAYER IS AT " << SensZPosition[slay][istat] << endl;
 
  801       if ( SensLayerName[slay].Contains(
"space") && SensLayerName[slay].Length() == 5 ) {
 
  806                  cout << 
"  got layer : " << SensLayerName[slay].Data() << endl;
 
  811     cout << 
"will do loop over segments" << endl;
 
  813     for ( Int_t iseg = 0 ; iseg < 1 ; iseg++ ) {
 
  814     cout << 
"segment " << iseg << endl;
 
  815         SensDiskLayersShapeA[slay][istat][iseg] = 
new TGeoTube(Form(
"sdisk%dseg%d%sshape",istat+1,iseg+1,SensLayerName[slay].Data()),
 
  816                                                            SensInnerRadius[slay][istat],SensOuterRadius[slay][istat],
 
  817                                                            SensLayerThick[slay]/2.);
 
  818         SensDiskLayersShapeB[slay][istat][iseg] = 
new TGeoBBox(Form(
"srobo%dseg%d%sshape",istat+1,iseg+1,SensLayerName[slay].Data()),
 
  819                                                               sMiddleROBarHfTh[istat],
 
  820                                                               SensOuterRadius[slay][istat],
 
  821                                                               SensLayerThick[slay]);
 
  822         SensDiskLayersSubtr[slay][istat][iseg] = 
new TGeoSubtraction(SensDiskLayersShapeA[slay][istat][iseg],
 
  823                                                                   SensDiskLayersShapeB[slay][istat][iseg]);       
 
  825         SensDiskLayersShapeC[slay][istat][iseg] = 
new TGeoCompositeShape(Form(
"scomp%dseg%d%sshape",istat+1,iseg+1,SensLayerName[slay].Data()),
 
  826                                                                      SensDiskLayersSubtr[slay][istat][iseg]);
 
  827         segBegin += segPhiSpan;
 
  828         cout << 
" segBegin " << segBegin << endl;
 
  830         SensDiskLayersShapeHole[slay][istat][iseg] = 
new TGeoTube(Form(
"sHole%dseg%d%sshape",istat+1,iseg+1,SensLayerName[slay].Data()),0.0,3.80,SensLayerThick[slay]+0.01);
 
  832          SensDiskLayersTranshA[slay][istat][iseg] = 
new TGeoTranslation(
"shA",sHoleTX,sHoleTY,sHoleTZ);
 
  833            SensDiskLayersTranshA[slay][istat][iseg] ->RegisterYourself();
 
  834          SensDiskLayersTranshB[slay][istat][iseg] = 
new TGeoTranslation(
"shB",sHoleTX,-sHoleTY,sHoleTZ);
 
  835            SensDiskLayersTranshB[slay][istat][iseg] ->RegisterYourself();
 
  837         SensDiskLayersShapecompos[slay][istat][iseg] = 
new TGeoCompositeShape(Form(
"scompos%dseg%d%sshape",istat+1,iseg+1,SensLayerName[slay].Data()),
 
  838                                                                           Form(
"scomp%dseg%d%sshape-(sHole%dseg%d%sshape:shA)-(sHole%dseg%d%sshape:shB)",
 
  839                                                                        istat+1,iseg+1,SensLayerName[slay].Data(),istat+1,iseg+1,SensLayerName[slay].Data(),istat+1,iseg+1,SensLayerName[slay].Data()));
 
  840         TString SenslayerMaterial = SensLayerName[slay].Data();
 
  841         SenslayerMaterial.Remove(0,SenslayerMaterial.Last(
'_')+1);
 
  842                 cout << 
"THE MATERIAL IS \"" << SenslayerMaterial.Data() << 
"\"" << endl;
 
  843         SensDiskLayersVol[slay][istat][iseg] = 
new TGeoVolume(Form(
"GemSen_Disk%d_Seg%d_%s",istat+1,iseg+1,SensLayerName[slay].Data()),
 
  844                                                             SensDiskLayersShapecompos[slay][istat][iseg],
 
  845                                                             gGeoMan->GetMedium(SenslayerMaterial.Data()));
 
  847         cout << 
"Senslayer material = " << SenslayerMaterial.Data() << endl;
 
  848         if ( SenslayerMaterial.Contains(
"GEMmixture" ) )
 
  849           SensDiskLayersVol[slay][istat][iseg]->
SetLineColor(kYellow);        
 
  851         SensDiskLayersTrans[slay][istat][iseg] = 
new TGeoTranslation(0.,0.,SensZPosition[slay][istat]);
 
  852         SensDiskLayersCombi[slay][istat][iseg] = 
new TGeoCombiTrans(*SensDiskLayersTrans[slay][istat][iseg],*dummyrot);
 
  853         SensDiskLayersCombi[slay][istat][iseg]->SetName(Form(
"GemSen_Disk%d_Seg%d_%s",istat+1,iseg+1,SensLayerName[slay].Data()));
 
  854         SensDiskLayersCombi[slay][istat][iseg]->RegisterYourself();
 
  855         DiskVol[istat]->AddNode(SensDiskLayersVol[slay][istat][iseg],0,SensDiskLayersCombi[slay][istat][iseg]);
 
  858        cout << 
"Svolume " << SensLayerName[slay] << 
" from "  
  859            << setprecision(10) << DiskZPosition[istat]+SensZPosition[slay][istat]-SensLayerThick[slay]/2. << 
" to " 
  860            << setprecision(10) << DiskZPosition[istat]+SensZPosition[slay][istat]+SensLayerThick[slay]/2. << endl;
 
  862            if ( SensLayerName[slay].Contains(
"Gem") && SensLayerName[slay].Contains(
"Sensor") ) {
 
  863          Double_t newRadius = SensInnerRadius[slay][istat];
 
  866          cout << 
"srad = " << SensInnerRadius[slay][istat] << 
" pitch = " << SensorStripPitch[sensorNumber][0] << 
" for sensor " << sensorNumber << endl;
 
  867          if (  SensorStripType[sensorNumber] != 2 ) {
 
  868            nofStrips = TMath::Ceil(2.*
TMath::Pi()*SensInnerRadius[slay][istat]/SensorStripPitch[sensorNumber][0]);
 
  869            newRadius = nofStrips*SensorStripPitch[sensorNumber][0]/2./
TMath::Pi();
 
  871          cout << 
"!!!! " << istat << 
" " << slay << 
" > there shall be " << nofStrips << 
" strips here so the radius should be " << newRadius << endl;
 
  872          pout << 
"                        " << sensorNumber+1 << 
",  " << SensorStripType[sensorNumber] << 
",  "  
  873               << setw(9) << 0. << 
",  " 
  874               << setw(9) << 0. << 
",  "  
  875               << setw(9) << DiskZPosition[istat]+SensZPosition[slay][istat] << 
",  " 
  876               << setw(9) << 0. << 
",  " 
  877               << setw(9) << newRadius << 
",  " 
  878               << setw(9) << SensOuterRadius[slay][istat] << 
",  " 
  879               << setw(9) << SensLayerThick[slay] << 
",  " 
  880               << setw(9) << SensorStripAngle[sensorNumber][0] << 
",  " 
  882               << setw(9) << sMiddleROBarHfTh[istat] << 
",  " 
  883               << setw(9) << SensorStripPitch[sensorNumber][0] << 
",  " 
  884               << setw(9) << SensorStripPitch[sensorNumber][1] << ((istat==NofDisks-1 && sensorNumber==1)?
"":
", \\") 
 
  889            SensZPosition[slay][istat] ++ ;
 
  894     Double_t layerPosition = firstLayerOffset;
 
  896     Int_t msensorNumber = 0;
 
  898     for ( Int_t ilay = 0 ; ilay < NofLayers ; ilay++ ) {
 
  899       cout << 
"doing layer " << ilay << endl;
 
  900       layerPosition += LayerThick[ilay]/2.;
 
  901         if ( LayerName[ilay].Contains(
"space") && LayerThick[ilay] > 0.0 ) {
 
  902           cout << 
"***** THE THICK SPACE LAYER IS AT " << layerPosition << endl;
 
  904       if ( LayerName[ilay].Contains(
"space") && LayerName[ilay].Length() == 5 ) {
 
  905         layerPosition += LayerThick[ilay]/2.;
 
  909                  cout << 
"  got layer : " << LayerName[ilay].Data() << endl;
 
  913       cout << 
"will do loop over segments" << endl;
 
  914       for ( Int_t miseg = 0 ; miseg < 1 ; miseg++ ) {
 
  915         cout << 
"segment " << miseg << endl;
 
  916         DiskLayersShapeA[ilay][istat][miseg] = 
new TGeoTube(Form(
"disk%dseg%d%sshape",istat+1,miseg+1,LayerName[ilay].Data()),
 
  917                                                            DiskInnerRadius[ilay][istat],DiskOuterRadius[ilay][istat],
 
  918                                                            LayerThick[ilay]/2.);
 
  919         DiskLayersShapeB[ilay][istat][miseg] = 
new TGeoBBox   (Form(
"robo%dseg%d%sshape",istat+1,miseg+1,LayerName[ilay].Data()),
 
  920                                                               MiddleROBarHfTh[istat],
 
  921                                                               DiskOuterRadius[ilay][istat],
 
  923         DiskLayersSubtr[ilay][istat][miseg] = 
new TGeoSubtraction(DiskLayersShapeA[ilay][istat][miseg],
 
  924                                                                   DiskLayersShapeB[ilay][istat][miseg]);       
 
  926         DiskLayersShapeC[ilay][istat][miseg] = 
new TGeoCompositeShape(Form(
"comp%dseg%d%sshape",istat+1,miseg+1,LayerName[ilay].Data()),
 
  927                                                                      DiskLayersSubtr[ilay][istat][miseg]);
 
  928         msegBegin += msegPhiSpan;
 
  929         cout << 
" msegBegin " << msegBegin << endl;
 
  931         DiskLayersShapeHole[ilay][istat][miseg] = 
new TGeoTube(Form(
"Hole%dseg%d%sshape",istat+1,miseg+1,LayerName[ilay].Data()),0.0,3.80,LayerThick[ilay]+0.01);
 
  933          DiskLayersTranshA[ilay][istat][miseg] = 
new TGeoTranslation(
"hA",HoleTX,HoleTY,HoleTZ);
 
  934            DiskLayersTranshA[ilay][istat][miseg] ->RegisterYourself();
 
  935          DiskLayersTranshB[ilay][istat][miseg] = 
new TGeoTranslation(
"hB",HoleTX,-HoleTY,HoleTZ);
 
  936            DiskLayersTranshB[ilay][istat][miseg] ->RegisterYourself();
 
  938         DiskLayersShapecompos[ilay][istat][miseg] = 
new TGeoCompositeShape(Form(
"compos%dseg%d%sshape",istat+1,miseg+1,LayerName[ilay].Data()),
 
  939                                                                           Form(
"comp%dseg%d%sshape-(Hole%dseg%d%sshape:hA)-(Hole%dseg%d%sshape:hB)",
 
  940                                                                                istat+1,miseg+1,LayerName[ilay].Data(),istat+1,miseg+1,LayerName[ilay].Data(),istat+1,miseg+1,LayerName[ilay].Data()));
 
  943         TString layerMaterial = LayerName[ilay].Data();
 
  944         layerMaterial.Remove(0,layerMaterial.Last(
'_')+1);
 
  945                 cout << 
"THE MATERIAL IS \"" << layerMaterial.Data() << 
"\"" << endl;
 
  946         DiskLayersVol[ilay][istat][miseg] = 
new TGeoVolume(Form(
"Gem_Disk%d_Seg%d_%s",istat+1,miseg+1,LayerName[ilay].Data()),
 
  947                                                             DiskLayersShapecompos[ilay][istat][miseg],
 
  948                                                             gGeoMan->GetMedium(layerMaterial.Data()));
 
  950         cout << 
"layer material = " << layerMaterial.Data() << endl;
 
  951         if ( layerMaterial.Contains(
"air" ) )
 
  952           DiskLayersVol[ilay][istat][miseg]->
SetLineColor(kWhite);kGray+1);
 
  953         if ( layerMaterial.Contains(
"copper" ) )
 
  954           DiskLayersVol[ilay][istat][miseg]->
SetLineColor(kOrange+1);
 
  955         if ( layerMaterial.Contains(
"kapton" ) )
 
  956           DiskLayersVol[ilay][istat][miseg]->
SetLineColor(kOrange+2);
 
  957         if ( layerMaterial.Contains(
"aluminium" ) )
 
  958           DiskLayersVol[ilay][istat][miseg]->
SetLineColor(kCyan-9);
 
  959         if ( layerMaterial.Contains(
"GEMmixture" ) )
 
  960           DiskLayersVol[ilay][istat][miseg]->
SetLineColor(kYellow);
 
  961         if ( layerMaterial.Contains(
"carbon" ) )
 
  963         if ( layerMaterial.Contains(
"GlassFiber" ) )
 
  964           DiskLayersVol[ilay][istat][miseg]->
SetLineColor(kGreen+3);
 
  966         DiskLayersTrans[ilay][istat][miseg] = 
new TGeoTranslation(0.,0.,layerPosition);
 
  967         DiskLayersCombi[ilay][istat][miseg] = 
new TGeoCombiTrans(*DiskLayersTrans[ilay][istat][miseg],*dummyrot);
 
  968         DiskLayersCombi[ilay][istat][miseg]->SetName(Form(
"Gem_Disk%d_Seg%d_%s",istat+1,miseg+1,LayerName[ilay].Data()));
 
  969         DiskLayersCombi[ilay][istat][miseg]->RegisterYourself();
 
  970         DiskVol[istat]->AddNode(DiskLayersVol[ilay][istat][miseg],0,DiskLayersCombi[ilay][istat][miseg]);       
 
  974        cout << 
"mvolume " << LayerName[ilay] << 
" from "  
  975            << setprecision(10) << DiskZPosition[istat]+layerPosition-LayerThick[ilay]/2. << 
" to " 
  976            << setprecision(10) << DiskZPosition[istat]+layerPosition+LayerThick[ilay]/2. << endl;
 
  978        if ( LayerName[ilay].Contains(
"Gem") && LayerName[ilay].Contains(
"Sensor") ) {
 
  979         Double_t mnewRadius = DiskInnerRadius[ilay][istat];
 
  982         cout << 
"mrad = " << DiskInnerRadius[ilay][istat] << 
" pitch = " << SensorStripPitch[msensorNumber][0] << 
" for sensor " << msensorNumber << endl;
 
  983         if (  SensorStripType[msensorNumber] != 2 ) {
 
  984           mnofStrips = TMath::Ceil(2.*
TMath::Pi()*DiskInnerRadius[ilay][istat]/SensorStripPitch[msensorNumber][0]);
 
  985           mnewRadius = mnofStrips*SensorStripPitch[msensorNumber][0]/2./
TMath::Pi();
 
  987         cout << 
"!!!! " << istat << 
" " << ilay << 
" > there shall be " << mnofStrips << 
" strips here so the radius should be " << mnewRadius << endl;
 
  988         pout << 
"                        " << msensorNumber+1 << 
",  " << SensorStripType[msensorNumber] << 
",  "  
  989              << setw(9) << 0. << 
",  "    
  990              << setw(9) << 0. << 
",  "  
  991              << setw(9) << DiskZPosition[istat]+layerPosition << 
",  " 
  992              << setw(9) << 0. << 
",  " 
  993              << setw(9) << mnewRadius << 
",  " 
  994              << setw(9) << DiskOuterRadius[ilay][istat] << 
",  " 
  995              << setw(9) << LayerThick[ilay] << 
",  " 
  996              << setw(9) << SensorStripAngle[msensorNumber][0] << 
",  " 
  998              << setw(9) << MiddleROBarHfTh[istat] << 
",  " 
  999              << setw(9) << SensorStripPitch[msensorNumber][0] << 
",  " 
 1000              << setw(9) << SensorStripPitch[msensorNumber][1] << ((istat==NofDisks-1&&msensorNumber==1)?
"":
", \\") 
 
 1005         layerPosition += LayerThick[ilay]/2.;
 
 1008        SubunitVol->AddNode(DiskVol[istat],0,DiskCombi[istat]);
 
 1012   pout << 
"TrackFinderOnHits_ParThetaA: Double_t  59.4" << endl
 
 1013        << 
"TrackFinderOnHits_ParThetaB: Double_t -0.02" << endl
 
 1014        << 
"TrackFinderOnHits_ParTheta0: Double_t  56.1372" << endl
 
 1015        << 
"TrackFinderOnHits_ParTheta1: Double_t -0.000564362" << endl
 
 1016        << 
"TrackFinderOnHits_ParTheta2: Double_t -0.181828" << endl
 
 1017        << 
"TrackFinderOnHits_ParTheta3: Double_t  0.284289" << endl
 
 1018        << 
"TrackFinderOnHits_ParRadPhi0:Double_t  0.9944432" << endl
 
 1019        << 
"TrackFinderOnHits_ParRadPhi2:Double_t -0.000590706" << endl
 
 1020        << 
"TrackFinderOnHits_ParMat0:   Double_t \\" << endl
 
 1022        << 
"                                   -2.35034328e-6,    0.0006810756,    0.10335768" << endl     
 
 1023        << 
"TrackFinderOnHits_ParMat1:   Double_t \\" << endl
 
 1025        << 
"                                   -7.58793504e-10,   -6.7763136e-7,    0.000748458752" << endl  
 
 1026        << 
"##########################################################################################" << flush;
 
 1028   top->AddNode(SubunitVol,0,
new TGeoCombiTrans());
 
 1043   gGeoMan->CloseGeometry();
 
FairGeoMedium * CbmMediumCarbon
FairGeoMedium * CbmMediumAluminium
FairGeoBuilder * geobuild
FairGeoMedium * CbmMediumAir
FairGeoMedium * CbmMediumPWO
FairGeoInterface * geoFace
vDisk SetLineColor(colYellow)