+ // --- Define crystall and put it into wrapped crystall ---
+ gMC->Gsvolu("PXTL", "BOX ", idtmed[699], emcg->GetCrystalHalfSize(), 3) ;
+ gMC->Gspos("PXTL", 1, "PWRA", 0.0, 0.0, 0.0, 0, "ONLY") ;
+
+ // --- define APD/PIN preamp and put it into AirCell
+
+ gMC->Gsvolu("PPIN", "BOX ", idtmed[705], emcg->GetAPDHalfSize(), 3) ;
+ Float_t * crystal = emcg->GetCrystalHalfSize() ;
+ y = crystal[1] + emcg->GetAirGapLed() /2 - preamp[1];
+ gMC->Gspos("PPIN", 1, "PCEL", 0.0, y, 0.0, 0, "ONLY") ;
+
+ gMC->Gsvolu("PREA", "BOX ", idtmed[711], emcg->GetPreampHalfSize(), 3) ; // Here I assumed preamp
+ // as a printed Circuit
+ y = crystal[1] + emcg->GetAirGapLed() /2 + pin[1] ; // May it should be changed
+ gMC->Gspos("PREA", 1, "PCEL", 0.0, y, 0.0, 0, "ONLY") ; // to ceramics?
+
+
+ // --- Fill strip with wrapped cristalls in Air Cells
+
+ Float_t* splate = emcg->GetSupportPlateHalfSize();
+ y = -splate[1] ;
+ Float_t* acel = emcg->GetAirCellHalfSize() ;
+ Int_t icel ;
+ for(icel = 1; icel <= emcg->GetNCellsInStrip(); icel++){
+ Float_t x = (2*icel - 1 - emcg->GetNCellsInStrip())* acel[0] ;
+ gMC->Gspos("PCEL", icel, "PSTR", x, y, 0.0, 0, "ONLY") ;
+ }
+
+ // --- define the support plate, hole in it and position it in strip ----
+ gMC->Gsvolu("PSUP", "BOX ", idtmed[701], emcg->GetSupportPlateHalfSize(), 3) ;
+
+ gMC->Gsvolu("PSHO", "BOX ", idtmed[798], emcg->GetSupportPlateInHalfSize(), 3) ;
+ Float_t z = emcg->GetSupportPlateThickness()/2 ;
+ gMC->Gspos("PSHO", 1, "PSUP", 0.0, 0.0, z, 0, "ONLY") ;
+
+ y = acel[1] ;
+ gMC->Gspos("PSUP", 1, "PSTR", 0.0, y, 0.0, 0, "ONLY") ;
+
+
+ // ========== Fill module with strips and put them into inner thermoinsulation=============
+ gMC->Gsvolu("PTII", "BOX ", idtmed[706], emcg->GetInnerThermoHalfSize(), 3) ;
+
+ Float_t * inthermo = emcg->GetInnerThermoHalfSize() ;
+ Float_t * strip = emcg->GetStripHalfSize() ;
+ y = inthermo[1] - strip[1] ;
+ Int_t irow;
+ Int_t nr = 1 ;
+ Int_t icol ;
+
+ for(irow = 0; irow < emcg->GetNStripX(); irow ++){
+ Float_t x = (2*irow + 1 - emcg->GetNStripX())* strip[0] ;
+ for(icol = 0; icol < emcg->GetNStripZ(); icol ++){
+ z = (2*icol + 1 - emcg->GetNStripZ()) * strip[2] ;
+ gMC->Gspos("PSTR", nr, "PTII", x, y, z, 0, "ONLY") ;
+ nr++ ;
+ }
+ }
+
+
+ // ------- define the air gap between thermoinsulation and cooler
+ gMC->Gsvolu("PAGA", "BOX ", idtmed[798], emcg->GetAirGapHalfSize(), 3) ;
+ Float_t * agap = emcg->GetAirGapHalfSize() ;
+ y = agap[1] - inthermo[1] ;
+
+ gMC->Gspos("PTII", 1, "PAGA", 0.0, y, 0.0, 0, "ONLY") ;
+
+
+
+ // ------- define the Al passive cooler
+ gMC->Gsvolu("PCOR", "BOX ", idtmed[701], emcg->GetCoolerHalfSize(), 3) ;
+ Float_t * cooler = emcg->GetCoolerHalfSize() ;
+ y = cooler[1] - agap[1] ;
+
+ gMC->Gspos("PAGA", 1, "PCOR", 0.0, y, 0.0, 0, "ONLY") ;
+
+ // ------- define the outer thermoinsulating cover
+ gMC->Gsvolu("PTIO", "TRD1", idtmed[706], emcg->GetOuterThermoParams(), 4) ;
+ Float_t * outparams = emcg->GetOuterThermoParams() ;
+
+ Int_t idrotm[99] ;
+ AliMatrix(idrotm[1], 90.0, 0.0, 0.0, 0.0, 90.0, 270.0) ;
+ // Frame in outer thermoinsulation and so on: z out of beam, y along beam, x across beam
+
+ z = outparams[3] - cooler[1] ;
+ gMC->Gspos("PCOR", 1, "PTIO", 0., 0.0, z, idrotm[1], "ONLY") ;
+
+ // -------- Define the outer Aluminium cover -----
+ gMC->Gsvolu("PCOL", "TRD1", idtmed[701], emcg->GetAlCoverParams(), 4) ;
+ Float_t * covparams = emcg->GetAlCoverParams() ;
+ z = covparams[3] - outparams[3] ;
+ gMC->Gspos("PTIO", 1, "PCOL", 0., 0.0, z, 0, "ONLY") ;
+
+ // --------- Define front fiberglass cover -----------
+ gMC->Gsvolu("PFGC", "BOX ", idtmed[717], emcg->GetFiberGlassHalfSize(), 3) ;
+ z = - outparams[3] ;
+ gMC->Gspos("PFGC", 1, "PCOL", 0., 0.0, z, 0, "ONLY") ;
+
+ //=============This is all with cold section==============
+
+
+ //------ Warm Section --------------
+ gMC->Gsvolu("PWAR", "BOX ", idtmed[701], emcg->GetWarmAlCoverHalfSize(), 3) ;
+ Float_t * warmcov = emcg->GetWarmAlCoverHalfSize() ;
+
+ // --- Define the outer thermoinsulation ---
+ gMC->Gsvolu("PWTI", "BOX ", idtmed[706], emcg->GetWarmThermoHalfSize(), 3) ;
+ Float_t * warmthermo = emcg->GetWarmThermoHalfSize() ;
+ z = -warmcov[2] + warmthermo[2] ;
+
+ gMC->Gspos("PWTI", 1, "PWAR", 0., 0.0, z, 0, "ONLY") ;
+
+ // --- Define cables area and put in it T-supports ----
+ gMC->Gsvolu("PCA1", "BOX ", idtmed[718], emcg->GetTCables1HalfSize(), 3) ;
+ Float_t * cbox = emcg->GetTCables1HalfSize() ;
+
+ gMC->Gsvolu("PBE1", "BOX ", idtmed[701], emcg->GetTSupport1HalfSize(), 3) ;
+ Float_t * beams = emcg->GetTSupport1HalfSize() ;
+ Int_t isup ;
+ for(isup = 0; isup < emcg->GetNTSuppots(); isup++){
+ Float_t x = -cbox[0] + beams[0] + (2*beams[0]+emcg->GetTSupportDist())*isup ;
+ gMC->Gspos("PBE1", isup, "PCA1", x, 0.0, 0.0, 0, "ONLY") ;
+ }
+
+ z = -warmthermo[2] + cbox[2] ;
+ gMC->Gspos("PCA1", 1, "PWTI", 0.0, 0.0, z, 0, "ONLY") ;
+
+ gMC->Gsvolu("PCA2", "BOX ", idtmed[718], emcg->GetTCables2HalfSize(), 3) ;
+ Float_t * cbox2 = emcg->GetTCables2HalfSize() ;
+
+ gMC->Gsvolu("PBE2", "BOX ", idtmed[701], emcg->GetTSupport2HalfSize(), 3) ;
+ for(isup = 0; isup < emcg->GetNTSuppots(); isup++){
+ Float_t x = -cbox[0] + beams[0] + (2*beams[0]+emcg->GetTSupportDist())*isup ;
+ gMC->Gspos("PBE2", isup, "PCA2", x, 0.0, 0.0, 0, "ONLY") ;
+ }
+
+ z = -warmthermo[2] + 2*cbox[2] + cbox2[2];
+ gMC->Gspos("PCA2", 1, "PWTI", 0.0, 0.0, z, 0, "ONLY") ;
+
+
+ // --- Define frame ---
+ gMC->Gsvolu("PFRX", "BOX ", idtmed[716], emcg->GetFrameXHalfSize(), 3) ;
+ Float_t * posit = emcg->GetFrameXPosition() ;
+ gMC->Gspos("PFRX", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
+ gMC->Gspos("PFRX", 2, "PWTI", posit[0], -posit[1], posit[2], 0, "ONLY") ;
+
+ gMC->Gsvolu("PFRZ", "BOX ", idtmed[716], emcg->GetFrameZHalfSize(), 3) ;
+ posit = emcg->GetFrameZPosition() ;
+ gMC->Gspos("PFRZ", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
+ gMC->Gspos("PFRZ", 2, "PWTI", -posit[0], posit[1], posit[2], 0, "ONLY") ;
+
+ // --- Define Fiber Glass support ---
+ gMC->Gsvolu("PFG1", "BOX ", idtmed[717], emcg->GetFGupXHalfSize(), 3) ;
+ posit = emcg->GetFGupXPosition() ;
+ gMC->Gspos("PFG1", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
+ gMC->Gspos("PFG1", 2, "PWTI", posit[0], -posit[1], posit[2], 0, "ONLY") ;
+
+ gMC->Gsvolu("PFG2", "BOX ", idtmed[717], emcg->GetFGupZHalfSize(), 3) ;
+ posit = emcg->GetFGupZPosition() ;
+ gMC->Gspos("PFG2", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
+ gMC->Gspos("PFG2", 2, "PWTI", -posit[0], posit[1], posit[2], 0, "ONLY") ;
+
+ gMC->Gsvolu("PFG3", "BOX ", idtmed[717], emcg->GetFGlowXHalfSize(), 3) ;
+ posit = emcg->GetFGlowXPosition() ;
+ gMC->Gspos("PFG3", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
+ gMC->Gspos("PFG3", 2, "PWTI", posit[0], -posit[1], posit[2], 0, "ONLY") ;
+
+ gMC->Gsvolu("PFG4", "BOX ", idtmed[717], emcg->GetFGlowZHalfSize(), 3) ;
+ posit = emcg->GetFGlowZPosition() ;
+ gMC->Gspos("PFG4", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
+ gMC->Gspos("PFG4", 2, "PWTI", -posit[0], posit[1], posit[2], 0, "ONLY") ;
+
+ // --- Define Air Gap for FEE electronics -----
+
+ gMC->Gsvolu("PAFE", "BOX ", idtmed[798], emcg->GetFEEAirHalfSize(), 3) ;
+ posit = emcg->GetFEEAirPosition() ;
+ gMC->Gspos("PAFE", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
+
+ // Define the EMC module volume and combine Cool and Warm sections
+
+ gMC->Gsvolu("PEMC", "TRD1", idtmed[798], emcg->GetEMCParams(), 4) ;
+
+ z = - warmcov[2] ;
+ gMC->Gspos("PCOL", 1, "PEMC", 0., 0., z, 0, "ONLY") ;
+ z = covparams[3] ;
+ gMC->Gspos("PWAR", 1, "PEMC", 0., 0., z, 0, "ONLY") ;
+
+
+ // Put created EMC geometry into PHOS volume
+
+ z = geom->GetCPVBoxSize(1) / 2. ;
+ gMC->Gspos("PEMC", 1, "PHOS", 0., 0., z, 0, "ONLY") ;
+
+}
+
+//____________________________________________________________________________
+void AliPHOSv0::CreateGeometryforCPV()
+{
+ // Create the PHOS-CPV geometry for GEANT
+ // Author: Yuri Kharlov 11 September 2000
+ //BEGIN_HTML
+ /*
+ <H2>
+ Geant3 geometry of PHOS-CPV in ALICE
+ </H2>
+ <table width=700>
+
+ <tr>
+ <td>CPV perspective view</td>
+ <td>CPV front view </td>
+ </tr>
+
+ <tr>
+ <td> <img height=300 width=290 src="../images/CPVallPersp.gif"> </td>
+ <td> <img height=300 width=290 src="../images/CPVallFront.gif"> </td>
+ </tr>
+
+ <tr>
+ <td>One CPV module, perspective view </td>
+ <td>One CPV module, front view (extended in vertical direction) </td>
+ </tr>
+
+ <tr>
+ <td><img height=300 width=290 src="../images/CPVmodulePers.gif"></td>
+ <td><img height=300 width=290 src="../images/CPVmoduleSide.gif"></td>
+ </tr>
+
+ </table>
+
+ <H2>
+ Geant3 geometry tree of PHOS-CPV in ALICE
+ </H2>
+ <center>
+ <img height=300 width=290 src="../images/CPVtree.gif">
+ </center>
+ */
+ //END_HTML
+
+ Float_t par[3], x,y,z;
+
+ // Get pointer to the array containing media indexes
+ Int_t *idtmed = fIdtmed->GetArray() - 699 ;
+
+ AliPHOSGeometry * geom = GetGeometry() ;
+
+ // The box containing all CPV for one PHOS module filled with air
+ par[0] = geom->GetCPVBoxSize(0) / 2.0 ;
+ par[1] = geom->GetCPVBoxSize(1) / 2.0 ;
+ par[2] = geom->GetCPVBoxSize(2) / 2.0 ;
+ gMC->Gsvolu("PCPV", "BOX ", idtmed[798], par, 3) ;
+
+ Float_t * emcParams = geom->GetEMCAGeometry()->GetEMCParams() ;
+ z = - emcParams[3] ;
+ Int_t rotm ;
+ AliMatrix(rotm, 90.,0., 0., 0., 90., 90.) ;
+
+ gMC->Gspos("PCPV", 1, "PHOS", 0.0, 0.0, z, rotm, "ONLY") ;
+
+ // Gassiplex board
+
+ par[0] = geom->GetGassiplexChipSize(0)/2.;
+ par[1] = geom->GetGassiplexChipSize(1)/2.;
+ par[2] = geom->GetGassiplexChipSize(2)/2.;
+ gMC->Gsvolu("PCPC","BOX ",idtmed[707],par,3);
+
+ // Cu+Ni foil covers Gassiplex board
+
+ par[1] = geom->GetCPVCuNiFoilThickness()/2;
+ gMC->Gsvolu("PCPD","BOX ",idtmed[710],par,3);
+ y = -(geom->GetGassiplexChipSize(1)/2 - par[1]);
+ gMC->Gspos("PCPD",1,"PCPC",0,y,0,0,"ONLY");
+
+ // Position of the chip inside CPV
+
+ Float_t xStep = geom->GetCPVActiveSize(0) / (geom->GetNumberOfCPVChipsPhi() + 1);
+ Float_t zStep = geom->GetCPVActiveSize(1) / (geom->GetNumberOfCPVChipsZ() + 1);
+ Int_t copy = 0;
+ y = geom->GetCPVFrameSize(1)/2 - geom->GetFTPosition(0) +
+ geom->GetCPVTextoliteThickness() / 2 + geom->GetGassiplexChipSize(1) / 2 + 0.1;
+ for (Int_t ix=0; ix<geom->GetNumberOfCPVChipsPhi(); ix++) {
+ x = xStep * (ix+1) - geom->GetCPVActiveSize(0)/2;
+ for (Int_t iz=0; iz<geom->GetNumberOfCPVChipsZ(); iz++) {
+ copy++;
+ z = zStep * (iz+1) - geom->GetCPVActiveSize(1)/2;
+ gMC->Gspos("PCPC",copy,"PCPV",x,y,z,0,"ONLY");
+ }
+ }
+
+ // Foiled textolite (1 mm of textolite + 50 mkm of Cu + 6 mkm of Ni)
+
+ par[0] = geom->GetCPVActiveSize(0) / 2;
+ par[1] = geom->GetCPVTextoliteThickness() / 2;
+ par[2] = geom->GetCPVActiveSize(1) / 2;
+ gMC->Gsvolu("PCPF","BOX ",idtmed[707],par,3);
+
+ // Argon gas volume
+
+ par[1] = (geom->GetFTPosition(2) - geom->GetFTPosition(1) - geom->GetCPVTextoliteThickness()) / 2;
+ gMC->Gsvolu("PCPG","BOX ",idtmed[715],par,3);
+
+ for (Int_t i=0; i<4; i++) {
+ y = geom->GetCPVFrameSize(1) / 2 - geom->GetFTPosition(i) + geom->GetCPVTextoliteThickness()/2;
+ gMC->Gspos("PCPF",i+1,"PCPV",0,y,0,0,"ONLY");
+ if(i==1){
+ y-= (geom->GetFTPosition(2) - geom->GetFTPosition(1)) / 2;
+ gMC->Gspos("PCPG",1,"PCPV ",0,y,0,0,"ONLY");
+ }
+ }
+
+ // Dummy sensitive plane in the middle of argone gas volume
+
+ par[1]=0.001;
+ gMC->Gsvolu("PCPQ","BOX ",idtmed[715],par,3);
+ gMC->Gspos ("PCPQ",1,"PCPG",0,0,0,0,"ONLY");
+
+ // Cu+Ni foil covers textolite
+
+ par[1] = geom->GetCPVCuNiFoilThickness() / 2;
+ gMC->Gsvolu("PCP1","BOX ",idtmed[710],par,3);
+ y = geom->GetCPVTextoliteThickness()/2 - par[1];
+ gMC->Gspos ("PCP1",1,"PCPF",0,y,0,0,"ONLY");
+
+ // Aluminum frame around CPV
+
+ par[0] = geom->GetCPVFrameSize(0)/2;
+ par[1] = geom->GetCPVFrameSize(1)/2;
+ par[2] = geom->GetCPVBoxSize(2) /2;
+ gMC->Gsvolu("PCF1","BOX ",idtmed[701],par,3);
+
+ par[0] = geom->GetCPVBoxSize(0)/2 - geom->GetCPVFrameSize(0);
+ par[1] = geom->GetCPVFrameSize(1)/2;
+ par[2] = geom->GetCPVFrameSize(2)/2;
+ gMC->Gsvolu("PCF2","BOX ",idtmed[701],par,3);
+
+ for (Int_t j=0; j<=1; j++) {
+ x = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(0) - geom->GetCPVFrameSize(0)) / 2;
+ gMC->Gspos("PCF1",j+1,"PCPV", x,0,0,0,"ONLY");
+ z = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(2) - geom->GetCPVFrameSize(2)) / 2;
+ gMC->Gspos("PCF2",j+1,"PCPV",0, 0,z,0,"ONLY");
+ }
+