Corrected volumes names in St2V2, Slat and Trigger geometry
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerGeometryBuilder.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // $Id$
17
18 //-----------------------------------------------------------------------------
19 /// Class AliMUONTriggerGeometryBuilder
20 // -----------------------------------
21 // MUON Trigger stations geometry 
22 // construction class.
23 // Author: Philippe Crochet (LPCCFd)
24 // Support for trigger chambers added April 07 by Enrico Scomparin (INFN To)
25 //-----------------------------------------------------------------------------
26
27 #include <TVirtualMC.h>
28 #include <TGeoMatrix.h>
29
30 #include "AliLog.h"
31 #include "AliRun.h"
32
33 #include "AliMUONTriggerGeometryBuilder.h"
34 #include "AliMUON.h"
35 #include "AliMUONConstants.h"
36 #include "AliMUONGeometryModule.h"
37 #include "AliMUONGeometryEnvelopeStore.h"
38
39 /// \cond CLASSIMP
40 ClassImp(AliMUONTriggerGeometryBuilder)
41 /// \endcond
42
43 //______________________________________________________________________________
44 AliMUONTriggerGeometryBuilder::AliMUONTriggerGeometryBuilder(AliMUON* muon)
45  : AliMUONVGeometryBuilder(16, 4),
46    fMUON(muon)
47 {
48 /// Standard constructor
49
50 }
51
52 //______________________________________________________________________________
53 AliMUONTriggerGeometryBuilder::AliMUONTriggerGeometryBuilder()
54  : AliMUONVGeometryBuilder(),
55    fMUON(0)
56 {
57 /// Default constructor
58 }
59
60 //______________________________________________________________________________
61 AliMUONTriggerGeometryBuilder::~AliMUONTriggerGeometryBuilder() 
62 {
63 /// Destructor
64 }
65
66 //
67 // public methods
68 //
69
70 //______________________________________________________________________________
71 void AliMUONTriggerGeometryBuilder::CreateGeometry()
72 {
73 /// From AliMUONv1::CreateGeometry()
74
75     /* 
76        zpos1 and zpos2 are the middle of the first and second
77        planes of station 1 (+1m for second station):
78        zpos1=(zpos1m+zpos1p)/2=(15999+16071)/2=16035 mm, thick/2=40 mm
79        zpos2=(zpos2m+zpos2p)/2=(16169+16241)/2=16205 mm, thick/2=40 mm
80        zposxm and zposxp= middles of gaz gaps within a detection plane
81        rem: the total thickness accounts for 1 mm of al on both
82        side of the RPCs (see zpos1 and zpos2)
83     */
84     
85     Int_t *idtmed = fMUON->GetIdtmed()->GetArray()-1099;
86     Int_t idAir= idtmed[1100]; // medium 1
87     Int_t idAlu1=idtmed[1103]; // medium 4
88     Int_t idInox = idtmed[1128];       // medium 29 Stainless Steel (18%Cr,9%Ni,Fe) 
89     
90     Int_t detElemId=0;          // Detection Element Number    
91     Float_t tpar[3];
92     Double_t dpar[3];    
93     Double_t spar[3];    
94     Double_t ppar[3];    
95    
96 // vertical gap between right and left chambers (kDXZERO*2=4cm)
97     const Float_t kDXZERO=2.; 
98 // main distances for chamber definition in first plane/first station
99     const Float_t kXMIN=34.;       
100     const Float_t kXMED=51.;                                
101     const Float_t kXMAX=255.; 
102 // 090704 kXMAX changed from 272 to 255.
103 // (see fig.2-4 & 2-5 of Local Trigger Board PRR)
104 // segmentation updated accordingly
105     const Float_t kYMIN=34.;                              
106     const Float_t kYMAX=51.;                              
107 // inner/outer radius of flange between beam shield. and chambers (1/station)
108 //    const Float_t kRMIN[2]={50.,50.};
109 //    const Float_t kRMAX[2]={64.,68.};
110 // z position of the middle of the gas gap in mother vol 
111     const Float_t kZm=-3.6;
112     const Float_t kZp=+3.6;
113     
114 // y positions of vertical supports
115     const Float_t kYVSup[4]={61.45,122.45,192.95,236.95}; 
116 // dimensions of vertical supports 
117     const Float_t kSizeVSupExt[3]={1.5,1.5,306.+5.}; 
118     const Float_t kSizeVSupInt[3]={1.2,1.2,306.+5.};  
119 // transverse dimensions of angular supports 
120     const Float_t kSizeSupport1V[3]={0.,1.5,0.1}; 
121     const Float_t kSizeSupport1H[3]={0.,0.1,1.15}; // z should be 1.4 in the installed set-up 
122     const Float_t kSizeSupport2V[3]={0.,3.0,0.1}; 
123     const Float_t kSizeSupport2H[3]={0.,0.1,1.9}; 
124     const Float_t kSizeSupportXV[3]={0.,1.25,0.25}; 
125     const Float_t kSizeSupportXH[3]={0.,0.25,1.5}; 
126 // transverse dimensions of horizontal cable supports
127     const Float_t kSizeSupportCable[3]={0.,2.,3.}; 
128 // dimensions of gas pipes (inner and outer radius)
129     const Float_t kSizeGasPipe[3]={0.2,0.4,0.}; 
130 // Position of gas pipe with respect to angular support
131     const Float_t kOffsetGasPipe=0.75; 
132 // Small cut on some volumes to avoid extrusion from SC1x
133     const Float_t kAvoidExtrusion=2.9;    
134    
135     Float_t zpos1= AliMUONConstants::DefaultChamberZ(10); 
136     Double_t dstation =  ( ( - AliMUONConstants::DefaultChamberZ(11)) - 
137                            ( - AliMUONConstants::DefaultChamberZ(10)) ) /2.1;
138     Float_t par[3];
139     par[2] = dstation;
140
141 // ratio of zpos1m/zpos1p and inverse for first plane
142     Float_t zmp=(zpos1-3.6)/(zpos1+3.6);
143     Float_t zpm=1./zmp;
144     
145     Int_t icount=0;  // chamber counter (0 1 2 3)
146     
147     for (Int_t istation=0; istation<2; istation++) { // loop on stations
148         for (Int_t iplane=0; iplane<2; iplane++) { // loop on detection planes
149             
150             Int_t iVolNum=1; // counter Volume Number
151             icount = Int_t(iplane<<0)+Int_t(istation<<1);
152             
153             par[0] = AliMUONConstants::Rmin(5+istation); 
154             par[1] = AliMUONConstants::Rmax(5+istation);
155             Char_t volName[6];
156             sprintf(volName,"%s%d", "SC",11+icount);
157             gMC->Gsvolu(volName,"TUBE", idAir, par, 3);
158             //SetVolume(10+icount, volName);
159 //          Float_t zpos =  AliMUONConstants::DefaultChamberZ(10+icount);
160
161 /* removed 03/18/05
162 // Flange between beam shielding and RPC 
163             tpar[0]= kRMIN[istation];
164             tpar[1]= kRMAX[istation];
165             tpar[2]= 4.0;           
166             char volFlange[5];
167             sprintf(volFlange,"SF%dA",icount+1);         
168             gMC->Gsvolu(volFlange,"TUBE",idAlu1,tpar,3);     // Al
169             // changed by ivana
170             //gMC->Gspos(volFlange,1,"ALIC",0.,0.,zpos,0,"MANY");
171             iChamber->GetGeometry()->GetEnvelopeStore()
172               ->AddEnvelope(volFlange, 0, false, "MANY");
173 */
174             
175 // scaling factor
176 //          Float_t zRatio = zpos / zpos1;
177             Float_t zRatio = AliMUONConstants::DefaultRatioTriggerChamber(icount);                  
178
179
180
181     
182 // envelopes (same size except line 5, all virtual)
183             char volEnv[18][5];
184             tpar[1] = kYMIN * zRatio; 
185             tpar[2] = 0.4;
186             Int_t i=0;    // counter
187             for (Int_t icolumn=0; icolumn<2; icolumn++) {
188                 for (Int_t iline=1; iline<10; iline++){
189                     tpar[0] = (kXMAX/2.) * zRatio;
190                     if (iline==5) tpar[0] = ((kXMAX-kXMED)/2.)*zRatio;
191                     if (icolumn==0) 
192                         sprintf(volEnv[i],"S%dR%d",icount,iline);
193                     else
194                         sprintf(volEnv[i],"S%dL%d",icount,iline);
195                     // gMC->Gsvolu(volEnv[i],"BOX",idAir,tpar,0); 
196                     i++;
197                 }
198             }
199
200 // chamber prototype
201             tpar[0]= 0.;
202             tpar[1]= 0.;
203             tpar[2]= 0.;            char volAlu[5];     // Alu 
204             char volBak[5];     // Bakelite
205             char volGaz[5];     // Gas streamer     
206             sprintf(volAlu,"SC%dA",icount+1);
207             sprintf(volBak,"SB%dA",icount+1);
208             sprintf(volGaz,"S%dG",icount+11);
209             gMC->Gsvolu(volAlu,"BOX",idAlu1,tpar,0);         // Al
210             gMC->Gsvolu(volBak,"BOX",idtmed[1107],tpar,0);   // Bakelite
211             gMC->Gsvolu(volGaz,"BOX",idtmed[1106],tpar,0);   // Gas streamer
212             tpar[0] = -1.;
213             tpar[1] = -1.;
214             tpar[2] = 0.1;    
215             gMC->Gsposp(volGaz,1,volBak,0.,0.,0.,0,"ONLY",tpar,3);
216             tpar[2] = 0.3;
217             gMC->Gsposp(volBak,1,volAlu,0.,0.,0.,0,"ONLY",tpar,3);
218
219 // RPC supports (vertical)
220
221             char volAluSupport[5],volAirSupport[5];
222             sprintf(volAluSupport,"SAL%d",icount+1);
223             sprintf(volAirSupport,"SAI%d",icount+1);
224             char volEnvSupport[12][7];
225             for(Int_t ii=0;ii<8;ii++){
226               sprintf(volEnvSupport[ii],"SEA%dV%d",icount+1,ii);
227             }
228             tpar[0]= 0.;
229             tpar[1]= 0.;
230             tpar[2]= 0.;            
231             gMC->Gsvolu(volAluSupport,"BOX",idAlu1,tpar,0);
232             gMC->Gsvolu(volAirSupport,"BOX",idAir,tpar,0);
233             tpar[0]=kSizeVSupInt[0];
234             tpar[1]=kSizeVSupInt[1];
235             tpar[2]=-1.;
236             gMC->Gsposp(volAirSupport,1,volAluSupport,0.,0.,0.,0,"ONLY",tpar,3);
237             
238             TGeoRotation rsupportv;
239             rsupportv.SetAngles(0.,90.,0.);
240             dpar[0]=kSizeVSupExt[0];
241             dpar[1]=kSizeVSupExt[1];
242             dpar[2]=kSizeVSupExt[2]*zRatio;
243             for(Int_t ii=0;ii<4;ii++){
244               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupport[ii], 0, true,
245               TGeoTranslation(-kYVSup[ii]*zRatio,0.,0.),rsupportv);
246               GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluSupport,volEnvSupport[ii],iVolNum++,3, dpar);
247             }       
248             for(Int_t ii=4;ii<8;ii++){
249               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupport[ii], 0, true,
250               TGeoTranslation(kYVSup[ii-4]*zRatio,0.,0.),rsupportv);
251               GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluSupport,volEnvSupport[ii],iVolNum++,3, dpar);
252             }   
253                 
254 // RPC supports (horizontal)
255
256 // supports for cables
257             char volAluSupportH[6],volAirSupportH[6];
258             sprintf(volAluSupportH,"SALH%d",icount+1);
259             sprintf(volAirSupportH,"SAIH%d",icount+1);
260             char volEnvSupportHA[6][8],volEnvSupportHBC[12][8],volEnvSupportHD[12][8],volEnvSupportHE[12][8],volEnvSupportHF[12][8];
261             for(Int_t jj=0;jj<2;jj++){
262               for(Int_t ii=0;ii<6;ii++){
263                 if(ii<3)sprintf(volEnvSupportHA[3*jj+ii],"SA%dHA%d",icount+1,3*jj+ii);
264                 sprintf(volEnvSupportHBC[6*jj+ii],"SA%dHB%d",icount+1,6*jj+ii);
265                 sprintf(volEnvSupportHD[6*jj+ii],"SA%dHD%d",icount+1,6*jj+ii);
266                 sprintf(volEnvSupportHE[6*jj+ii],"SA%dHE%d",icount+1,6*jj+ii);
267                 sprintf(volEnvSupportHF[6*jj+ii],"SA%dHF%d",icount+1,6*jj+ii);
268               }
269             }
270             tpar[0]= 0.;
271             tpar[1]= 0.;
272             tpar[2]= 0.;            
273             gMC->Gsvolu(volAluSupportH,"BOX",idAlu1,tpar,0);
274             gMC->Gsvolu(volAirSupportH,"BOX",idAir,tpar,0);
275             tpar[0]=-1.;
276             tpar[1]=1.9;
277             tpar[2]=2.8;
278             gMC->Gsposp(volAirSupportH,1,volAluSupportH,0.,0.,0.,0,"ONLY",tpar,3);
279             
280 // Angular supports for chambers
281             char volAluAngSupport1V[6],volAluAngSupport1H[6];
282             sprintf(volAluAngSupport1H,"SA1H%d",icount+1);
283             sprintf(volAluAngSupport1V,"SA1V%d",icount+1);
284             char volAluAngSupport2V[6],volAluAngSupport2H[6];
285             sprintf(volAluAngSupport2H,"SA2H%d",icount+1);
286             sprintf(volAluAngSupport2V,"SA2V%d",icount+1);
287             char volAluAngSupport3V[6],volAluAngSupport3H[6];
288             sprintf(volAluAngSupport3H,"SA3H%d",icount+1);
289             sprintf(volAluAngSupport3V,"SA3V%d",icount+1);
290             char volAluAngSupport4V[6],volAluAngSupport4H[6];
291             sprintf(volAluAngSupport4H,"SA4H%d",icount+1);
292             sprintf(volAluAngSupport4V,"SA4V%d",icount+1);
293             char volAluAngSupportXV[6],volAluAngSupportXH[6];
294             sprintf(volAluAngSupportXH,"SAXH%d",icount+1);
295             sprintf(volAluAngSupportXV,"SAXV%d",icount+1);
296             char volEnvSuppAng1HA[2][7],volEnvSuppAng1HBC[4][7],volEnvSuppAng1HD[4][7],volEnvSuppAng1HE[4][7],volEnvSuppAng1HF[4][7];
297             char volEnvSuppAng1VA[2][7],volEnvSuppAng1VBC[4][7],volEnvSuppAng1VD[4][7],volEnvSuppAng1VE[4][7],volEnvSuppAng1VF[4][7];
298             char volEnvSuppAng2HA[2][7],volEnvSuppAng2HBC[4][7],volEnvSuppAng2HD[4][7],volEnvSuppAng2HE[4][7],volEnvSuppAng2HF[4][7];
299             char volEnvSuppAng2VA[2][7],volEnvSuppAng2VBC[4][7],volEnvSuppAng2VD[4][7],volEnvSuppAng2VE[4][7],volEnvSuppAng2VF[4][7];
300             char volEnvSuppAng3HA[2][7],volEnvSuppAng3HBC[4][7],volEnvSuppAng3HD[4][7],volEnvSuppAng3HE[4][7],volEnvSuppAng3HF[4][7];
301             char volEnvSuppAng3VA[2][7],volEnvSuppAng3VBC[4][7],volEnvSuppAng3VD[4][7],volEnvSuppAng3VE[4][7],volEnvSuppAng3VF[4][7];
302             char volEnvSuppAng4HA[2][7],volEnvSuppAng4HBC[4][7],volEnvSuppAng4HD[4][7],volEnvSuppAng4HE[4][7],volEnvSuppAng4HF[4][7];
303             char volEnvSuppAng4VA[2][7],volEnvSuppAng4VBC[4][7],volEnvSuppAng4VD[4][7],volEnvSuppAng4VE[4][7],volEnvSuppAng4VF[4][7];
304             char volEnvSuppAngXHA[2][7],volEnvSuppAngXHBC[4][7],volEnvSuppAngXHD[4][7],volEnvSuppAngXHE[4][7],volEnvSuppAngXHF[4][7];
305             char volEnvSuppAngXVA[2][7],volEnvSuppAngXVBC[4][7],volEnvSuppAngXVD[4][7],volEnvSuppAngXVE[4][7],volEnvSuppAngXVF[4][7];
306             for(Int_t ii=0;ii<4;ii++){
307               if(ii<2)sprintf(volEnvSuppAng1HA[ii],"SH1%dA%d",icount+1,ii);
308               sprintf(volEnvSuppAng1HBC[ii],"SH1%dB%d",icount+1,ii);
309               sprintf(volEnvSuppAng1HD[ii],"SH1%dD%d",icount+1,ii);
310               sprintf(volEnvSuppAng1HE[ii],"SH1%dE%d",icount+1,ii);
311               sprintf(volEnvSuppAng1HF[ii],"SH1%dF%d",icount+1,ii);
312               if(ii<2)sprintf(volEnvSuppAng1VA[ii],"SV1%dA%d",icount+1,ii);
313               sprintf(volEnvSuppAng1VBC[ii],"SV1%dB%d",icount+1,ii);
314               sprintf(volEnvSuppAng1VD[ii],"SV1%dD%d",icount+1,ii);
315               sprintf(volEnvSuppAng1VE[ii],"SV1%dE%d",icount+1,ii);
316               sprintf(volEnvSuppAng1VF[ii],"SV1%dF%d",icount+1,ii);
317               if(ii<2)sprintf(volEnvSuppAng2HA[ii],"SH2%dA%d",icount+1,ii);
318               sprintf(volEnvSuppAng2HBC[ii],"SH2%dB%d",icount+1,ii);
319               sprintf(volEnvSuppAng2HD[ii],"SH2%dD%d",icount+1,ii);
320               sprintf(volEnvSuppAng2HE[ii],"SH2%dE%d",icount+1,ii);
321               sprintf(volEnvSuppAng2HF[ii],"SH2%dF%d",icount+1,ii);
322               if(ii<2)sprintf(volEnvSuppAng2VA[ii],"SV2%dA%d",icount+1,ii);
323               sprintf(volEnvSuppAng2VBC[ii],"SV2%dB%d",icount+1,ii);
324               sprintf(volEnvSuppAng2VD[ii],"SV2%dD%d",icount+1,ii);
325               sprintf(volEnvSuppAng2VE[ii],"SV2%dE%d",icount+1,ii);
326               sprintf(volEnvSuppAng2VF[ii],"SV2%dF%d",icount+1,ii);
327               if(ii<2)sprintf(volEnvSuppAng3HA[ii],"SH3%dA%d",icount+1,ii);
328               sprintf(volEnvSuppAng3HBC[ii],"SH3%dB%d",icount+1,ii);
329               sprintf(volEnvSuppAng3HD[ii],"SH3%dD%d",icount+1,ii);
330               sprintf(volEnvSuppAng3HE[ii],"SH3%dE%d",icount+1,ii);
331               sprintf(volEnvSuppAng3HF[ii],"SH3%dF%d",icount+1,ii);
332               if(ii<2)sprintf(volEnvSuppAng3VA[ii],"SV3%dA%d",icount+1,ii);
333               sprintf(volEnvSuppAng3VBC[ii],"SV3%dB%d",icount+1,ii);
334               sprintf(volEnvSuppAng3VD[ii],"SV3%dD%d",icount+1,ii);
335               sprintf(volEnvSuppAng3VE[ii],"SV3%dE%d",icount+1,ii);
336               sprintf(volEnvSuppAng3VF[ii],"SV3%dF%d",icount+1,ii);
337               if(ii<2)sprintf(volEnvSuppAng4HA[ii],"SH4%dA%d",icount+1,ii);
338               sprintf(volEnvSuppAng4HBC[ii],"SH4%dB%d",icount+1,ii);
339               sprintf(volEnvSuppAng4HD[ii],"SH4%dD%d",icount+1,ii);
340               sprintf(volEnvSuppAng4HE[ii],"SH4%dE%d",icount+1,ii);
341               sprintf(volEnvSuppAng4HF[ii],"SH4%dF%d",icount+1,ii);
342               if(ii<2)sprintf(volEnvSuppAng4VA[ii],"SV4%dA%d",icount+1,ii);
343               sprintf(volEnvSuppAng4VBC[ii],"SV4%dB%d",icount+1,ii);
344               sprintf(volEnvSuppAng4VD[ii],"SV4%dD%d",icount+1,ii);
345               sprintf(volEnvSuppAng4VE[ii],"SV4%dE%d",icount+1,ii);
346               sprintf(volEnvSuppAng4VF[ii],"SV4%dF%d",icount+1,ii);
347               if(ii<2)sprintf(volEnvSuppAngXHA[ii],"SHX%dA%d",icount+1,ii);
348               sprintf(volEnvSuppAngXHBC[ii],"SHX%dB%d",icount+1,ii);
349               sprintf(volEnvSuppAngXHD[ii],"SHX%dD%d",icount+1,ii);
350               sprintf(volEnvSuppAngXHE[ii],"SHX%dE%d",icount+1,ii);
351               sprintf(volEnvSuppAngXHF[ii],"SHX%dF%d",icount+1,ii);
352               if(ii<2)sprintf(volEnvSuppAngXVA[ii],"SVX%dA%d",icount+1,ii);
353               sprintf(volEnvSuppAngXVBC[ii],"SVX%dB%d",icount+1,ii);
354               sprintf(volEnvSuppAngXVD[ii],"SVX%dD%d",icount+1,ii);
355               sprintf(volEnvSuppAngXVE[ii],"SVX%dE%d",icount+1,ii);
356               sprintf(volEnvSuppAngXVF[ii],"SVX%dF%d",icount+1,ii);
357             }
358             tpar[0]= 0.;
359             tpar[1]= 0.;
360             tpar[2]= 0.;            
361             gMC->Gsvolu(volAluAngSupport1V,"BOX",idAlu1,tpar,0);
362             gMC->Gsvolu(volAluAngSupport1H,"BOX",idAlu1,tpar,0);
363             gMC->Gsvolu(volAluAngSupport2V,"BOX",idAlu1,tpar,0);
364             gMC->Gsvolu(volAluAngSupport2H,"BOX",idAlu1,tpar,0);
365             gMC->Gsvolu(volAluAngSupport3V,"BOX",idAlu1,tpar,0);
366             gMC->Gsvolu(volAluAngSupport3H,"BOX",idAlu1,tpar,0);
367             gMC->Gsvolu(volAluAngSupport4V,"BOX",idAlu1,tpar,0);
368             gMC->Gsvolu(volAluAngSupport4H,"BOX",idAlu1,tpar,0);
369             gMC->Gsvolu(volAluAngSupportXV,"BOX",idAlu1,tpar,0);
370             gMC->Gsvolu(volAluAngSupportXH,"BOX",idAlu1,tpar,0);
371             
372 // gas pipes
373             char volInoxGasPipe[7];
374             sprintf(volInoxGasPipe,"SPINO%d",icount+1);
375             char volEnvInoxGasPipe1A[2][7],volEnvInoxGasPipe1BC[4][8],volEnvInoxGasPipe1D[4][7],volEnvInoxGasPipe1E[4][7],volEnvInoxGasPipe1F[4][7];
376             char volEnvInoxGasPipe2A[2][7],volEnvInoxGasPipe2BC[4][8],volEnvInoxGasPipe2D[4][7],volEnvInoxGasPipe2E[4][7],volEnvInoxGasPipe2F[4][7];
377             for(Int_t ii=0;ii<4;ii++){
378               if(ii<2)sprintf(volEnvInoxGasPipe1A[ii],"SP1%dA%d",icount+1,ii);
379               sprintf(volEnvInoxGasPipe1BC[ii],"SP1%dBC%d",icount+1,ii);
380               sprintf(volEnvInoxGasPipe1D[ii],"SP1%dD%d",icount+1,ii);
381               sprintf(volEnvInoxGasPipe1E[ii],"SP1%dE%d",icount+1,ii);
382               sprintf(volEnvInoxGasPipe1F[ii],"SP1%dF%d",icount+1,ii);
383             }
384             for(Int_t ii=0;ii<4;ii++){
385               if(ii<2)sprintf(volEnvInoxGasPipe2A[ii],"SP2%dA%d",icount+1,ii);
386               sprintf(volEnvInoxGasPipe2BC[ii],"SP2%dBC%d",icount+1,ii);
387               sprintf(volEnvInoxGasPipe2D[ii],"SP2%dD%d",icount+1,ii);
388               sprintf(volEnvInoxGasPipe2E[ii],"SP2%dE%d",icount+1,ii);
389               sprintf(volEnvInoxGasPipe2F[ii],"SP2%dF%d",icount+1,ii);
390             }
391             tpar[0]= 0.;
392             tpar[1]= 0.;
393             tpar[2]= 0.;            
394             gMC->Gsvolu(volInoxGasPipe,"TUBE",idInox,tpar,0);
395             TGeoRotation rsupportpipe;
396             rsupportpipe.SetAngles(90.,90.,0.);
397            
398
399 // chamber type A
400             Float_t xEnv = (kDXZERO+kXMED+(kXMAX-kXMED)/2.)*zRatio;
401             Float_t yEnvM = 0.;  // y low position of envelope in chamber
402             Float_t yEnvP = 0.;  // y up position of envelope in chamber
403             Float_t yEnvPsave = 0.; // tmp data
404             Float_t yEnvMsave = 0.; // tmp data
405             Float_t xpos = 0.; // x position of RPC in envelope     
406             Float_t ypos = 0.; // y position of RPC in envelope
407             dpar[2] = 0.4;          
408             dpar[0] = ((kXMAX-kXMED)/2.)*zRatio;
409             dpar[1] = kYMIN * zRatio;
410
411             detElemId = (10+icount+1)*100;
412             GetEnvelopes(16+icount)->AddEnvelope(volEnv[4], detElemId, true, TGeoTranslation(xEnv,yEnvP,kZp));
413             detElemId = (10+icount+1)*100+9;
414             GetEnvelopes(16+icount)->AddEnvelope(volEnv[13], detElemId, true, TGeoTranslation(-xEnv,yEnvM,kZm),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
415
416             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[4],iVolNum++,3, dpar);
417             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[13],iVolNum++,3, dpar);      
418
419 // horizontal cable support chamber type A
420
421             spar[0]=((kXMAX/2)-kYVSup[0]/2.)*zRatio;
422             spar[1]=kSizeSupportCable[1];
423             spar[2]=kSizeSupportCable[2];
424             Float_t offsetSuppA = ((kXMAX-kXMED)/2.)*zRatio-(((kXMAX/2)-kYVSup[0]/2.)*zRatio);
425             for(Int_t in=0;in<3;in++){
426               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHA[in], 0, true,
427               TGeoTranslation(xEnv+offsetSuppA/2.,yEnvP+dpar[1]/2.*(in-1),-(kSizeVSupExt[0]+spar[2])));
428               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHA[in+3], 0, true,
429               TGeoTranslation(-(xEnv+offsetSuppA/2.),yEnvM+dpar[1]/2.*(in-1),kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
430             }
431             for(Int_t ii=0;ii<6;ii++) 
432             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluSupportH,volEnvSupportHA[ii],iVolNum++,3, spar);
433             
434 // angular supports chamber type A
435 // 1 vertical      
436  
437             spar[0]=dpar[0];
438             spar[1]=kSizeSupport1V[1];
439             spar[2]=kSizeSupport1V[2];
440             Float_t sparysave=spar[1];
441             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VA[0], 0, true,
442             TGeoTranslation(xEnv,yEnvP-dpar[1],kZp+dpar[2]+spar[2]));
443             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VA[1], 0, true,
444             TGeoTranslation(-xEnv,yEnvM-dpar[1],kZm-dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
445
446             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1V,volEnvSuppAng1VA[0],iVolNum++,3, spar);
447             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1V,volEnvSuppAng1VA[1],iVolNum++,3, spar);         
448
449 // 1 horizontal    
450  
451             spar[0]=dpar[0];
452             spar[1]=kSizeSupport1H[1];
453             spar[2]=kSizeSupport1H[2];
454             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HA[0], 0, true,
455             TGeoTranslation(xEnv,yEnvP-dpar[1]-sparysave,kZp+dpar[2]-spar[2]));
456             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HA[1], 0, true,
457             TGeoTranslation(-xEnv,yEnvM-dpar[1]-sparysave,kZm-(dpar[2]-spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
458
459             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1H,volEnvSuppAng1HA[0],iVolNum++,3, spar);
460             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1H,volEnvSuppAng1HA[1],iVolNum++,3, spar);         
461
462 // gas pipe (low)
463             ppar[0]=kSizeGasPipe[0];
464             ppar[1]=kSizeGasPipe[1];
465             ppar[2]=dpar[0];
466             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1A[0], 0, true,
467             TGeoTranslation(xEnv,yEnvP-dpar[1]-sparysave-kOffsetGasPipe,kZp),rsupportpipe);
468             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1A[1], 0, true,
469             TGeoTranslation(-xEnv,yEnvM-dpar[1]-sparysave-kOffsetGasPipe,kZm),rsupportpipe);
470             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe1A[0],iVolNum++,3, ppar);
471             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe1A[1],iVolNum++,3, ppar);
472
473 // 2 vertical      
474  
475             spar[0]=dpar[0];
476             spar[1]=kSizeSupport2V[1];
477             spar[2]=kSizeSupport2V[2];
478             sparysave=spar[1]+kSizeSupport2H[1];
479             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VA[0], 0, true,
480             TGeoTranslation(xEnv,yEnvP-dpar[1],kSizeVSupExt[0]+spar[2]));
481             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VA[1], 0, true,
482             TGeoTranslation(-xEnv,yEnvM-dpar[1],-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
483
484             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2V,volEnvSuppAng2VA[0],iVolNum++,3, spar);
485             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2V,volEnvSuppAng2VA[1],iVolNum++,3, spar);         
486
487 // 2 horizontal    
488  
489             spar[0]=dpar[0];
490             spar[1]=kSizeSupport2H[1];
491             spar[2]=kSizeSupport2H[2]; 
492             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HA[0], 0, true,
493             TGeoTranslation(xEnv,yEnvP-dpar[1]-sparysave,kSizeVSupExt[0]+spar[2]));
494             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HA[1], 0, true,
495             TGeoTranslation(-xEnv,yEnvM-dpar[1]-sparysave,-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
496
497             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2H,volEnvSuppAng2HA[0],iVolNum++,3, spar);
498             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2H,volEnvSuppAng2HA[1],iVolNum++,3, spar);         
499
500 // 3 vertical      
501  
502             spar[0]=dpar[0];
503             spar[1]=kSizeSupport1V[1];
504             spar[2]=kSizeSupport1V[2];
505             sparysave=spar[1];
506             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VA[0], 0, true,
507             TGeoTranslation(xEnv,yEnvP+dpar[1],kZp+dpar[2]+spar[2]));
508             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VA[1], 0, true,
509             TGeoTranslation(-xEnv,yEnvM+dpar[1],kZm-dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
510
511             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3V,volEnvSuppAng3VA[0],iVolNum++,3, spar);
512             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3V,volEnvSuppAng3VA[1],iVolNum++,3, spar);         
513
514 // 3 horizontal    
515  
516             spar[0]=dpar[0];
517             spar[1]=kSizeSupport1H[1];
518             spar[2]=kSizeSupport1H[2];
519             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HA[0], 0, true,
520             TGeoTranslation(xEnv,yEnvP+dpar[1]+sparysave,kZp+dpar[2]-spar[2]));
521             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HA[1], 0, true,
522             TGeoTranslation(-xEnv,yEnvM+dpar[1]+sparysave,kZm-(dpar[2]-spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
523
524             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3H,volEnvSuppAng3HA[0],iVolNum++,3, spar);
525             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3H,volEnvSuppAng3HA[1],iVolNum++,3, spar);     
526                 
527 // gas pipe (high)
528             ppar[0]=kSizeGasPipe[0];
529             ppar[1]=kSizeGasPipe[1];
530             ppar[2]=dpar[0];
531             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2A[0], 0, true,
532             TGeoTranslation(xEnv,yEnvP+dpar[1]+sparysave+kOffsetGasPipe,kZp),rsupportpipe);
533             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2A[1], 0, true,
534             TGeoTranslation(-xEnv,yEnvM+dpar[1]+sparysave+kOffsetGasPipe,kZm),rsupportpipe);
535             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe2A[0],iVolNum++,3, ppar);
536             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe2A[1],iVolNum++,3, ppar);
537
538 // 4 vertical      
539  
540             spar[0]=dpar[0];
541             spar[1]=kSizeSupport2V[1];
542             spar[2]=kSizeSupport2V[2];
543             sparysave=spar[1]+kSizeSupport2H[1];
544             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VA[0], 0, true,
545             TGeoTranslation(xEnv,yEnvP+dpar[1],kSizeVSupExt[0]+spar[2]));
546             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VA[1], 0, true,
547             TGeoTranslation(-xEnv,yEnvM+dpar[1],-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
548
549             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4V,volEnvSuppAng4VA[0],iVolNum++,3, spar);
550             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4V,volEnvSuppAng4VA[1],iVolNum++,3, spar);         
551
552 // 4 horizontal    
553  
554             spar[0]=dpar[0];
555             spar[1]=kSizeSupport2H[1];
556             spar[2]=kSizeSupport2H[2];
557             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HA[0], 0, true,
558             TGeoTranslation(xEnv,yEnvP+dpar[1]+sparysave,kSizeVSupExt[0]+spar[2]));
559             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HA[1], 0, true,
560             TGeoTranslation(-xEnv,yEnvM+dpar[1]+sparysave,-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
561
562             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4H,volEnvSuppAng4HA[0],iVolNum++,3, spar);
563             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4H,volEnvSuppAng4HA[1],iVolNum++,3, spar);         
564
565 // X horizontal    
566             spar[0]=(kYVSup[3]-kYVSup[0])/2.*zRatio;
567             spar[1]=kSizeSupportXH[1];
568             spar[2]=kSizeSupportXH[2];
569             Float_t sparysavex=spar[1];
570             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHA[0], 0, true,
571             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,yEnvP+dpar[1]+sparysave+1.0,kSizeVSupExt[0]+spar[2]));
572             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHA[1], 0, true,
573             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),yEnvM+dpar[1]+sparysave+1.0,-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
574
575             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXH,volEnvSuppAngXHA[0],iVolNum++,3, spar);         
576             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXH,volEnvSuppAngXHA[1],iVolNum++,3, spar);         
577
578 // X vertical      
579             spar[0]=(kYVSup[3]-kYVSup[0])/2.*zRatio;
580             spar[1]=kSizeSupportXV[1];
581             spar[2]=kSizeSupportXV[2];
582             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVA[0], 0, true,
583             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,yEnvP+dpar[1]+sparysave+1.0+sparysavex+spar[1],kSizeVSupExt[0]+spar[2]));
584             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVA[1], 0, true,
585             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),yEnvM+dpar[1]+sparysave+1.0+sparysavex+spar[1],-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
586
587             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXV,volEnvSuppAngXVA[0],iVolNum++,3, spar);         
588             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXV,volEnvSuppAngXVA[1],iVolNum++,3, spar);         
589
590 // chamber type B (plus envelope chambers B & C)   
591             xEnv = (kDXZERO+kXMAX/2.)*zRatio;
592             yEnvPsave = yEnvP;
593             yEnvMsave = yEnvM;
594             yEnvP = (yEnvMsave + kYMIN * zRatio ) * zpm + kYMIN * zRatio;
595             yEnvM = (yEnvPsave + kYMIN * zRatio ) * zmp + kYMIN * zRatio;
596             dpar[0] = ((kXMAX-kXMIN)/2.) * zRatio;
597             dpar[1] = ((kYMAX-kYMIN)/2.) * zRatio;
598             Float_t dysave = dpar[1];
599             Float_t dxsave = dpar[0];
600             xpos = kXMIN/2. * zRatio;
601             ypos = (kYMIN - kYMIN/4.) * zRatio;
602             Float_t xpossave = xpos;
603
604             detElemId = (10+icount+1)*100+17;
605             GetEnvelopes(16+icount)->AddEnvelope(volEnv[3], detElemId, true, TGeoTranslation( xEnv,-yEnvM,kZm));            
606             detElemId = (10+icount+1)*100+1;
607             GetEnvelopes(16+icount)->AddEnvelope(volEnv[5], detElemId, true, TGeoTranslation( xEnv, yEnvM,kZm));
608             detElemId = (10+icount+1)*100+10;
609             GetEnvelopes(16+icount)->AddEnvelope(volEnv[12], detElemId, true, TGeoTranslation(-xEnv,-yEnvP,kZp),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
610             detElemId = (10+icount+1)*100+8;
611             GetEnvelopes(16+icount)->AddEnvelope(volEnv[14], detElemId, true, TGeoTranslation(-xEnv, yEnvP,kZp),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
612
613             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[3],iVolNum++,TGeoTranslation(xpos, ypos,0.),3,dpar);
614             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[5],iVolNum++,TGeoTranslation(xpos,-ypos,0.),3,dpar);
615             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[12],iVolNum++,TGeoTranslation(xpos, ypos,0.),3,dpar);
616             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[14],iVolNum++,TGeoTranslation(xpos,-ypos,0.),3,dpar);
617
618                     
619 // chamber type C (note: same Z than type B)
620             dpar[0] = (kXMAX/2)*zRatio;
621             dpar[1] = (kYMAX/2)*zRatio;
622             xpos = 0.;      
623             ypos = ((kYMAX - kYMIN)/2.) * zRatio;
624
625             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[3],iVolNum++,TGeoTranslation(xpos,-ypos,0.),3,dpar);
626             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[5],iVolNum++,TGeoTranslation(xpos, ypos,0.),3,dpar);
627             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[12],iVolNum++,TGeoTranslation(xpos,-ypos,0.),3,dpar);
628             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[14],iVolNum++,TGeoTranslation(xpos, ypos,0.),3,dpar);
629
630 // horizontal cable support chamber type B+C
631
632             spar[0]=dpar[0]-kYVSup[0]/2.;
633             spar[1]=kSizeSupportCable[1];
634             spar[2]=kSizeSupportCable[2];
635             for(Int_t in=0;in<3;in++){
636               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHBC[in], 0, true, TGeoTranslation(xEnv+kYVSup[0]/2.*zRatio,-(yEnvM+(kYMAX-kYMIN/2.*zRatio)/2.*(in-1)),kSizeVSupExt[0]+spar[2]));
637               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHBC[in+3], 0, true, TGeoTranslation(xEnv+kYVSup[0]/2.*zRatio, yEnvM+(kYMAX-kYMIN/2.*zRatio)/2.*(in-1),kSizeVSupExt[0]+spar[2]));
638               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHBC[in+6], 0, true, TGeoTranslation(-(xEnv+kYVSup[0]/2.*zRatio),-(yEnvP+(kYMAX-kYMIN/2.*zRatio)/2.*(in-1)),-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
639               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHBC[in+9], 0, true, TGeoTranslation(-(xEnv+kYVSup[0]/2.*zRatio), yEnvP+(kYMAX-kYMIN/2.*zRatio)/2.*(in-1),-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
640             }
641             for(Int_t ii=0;ii<12;ii++) 
642             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluSupportH,volEnvSupportHBC[ii],iVolNum++,3, spar);
643
644 // angular supports chamber type B and C
645 // C       
646 // 1 vertical
647             spar[0]=dpar[0];
648             spar[1]=kSizeSupport1V[1];
649             spar[2]=kSizeSupport1V[2];
650             sparysave=spar[1];
651
652             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VBC[0], 0, true,
653             TGeoTranslation(xEnv,-yEnvM-dpar[1]-dysave,kZm-dpar[2]-spar[2]));
654             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VBC[2], 0, true,
655             TGeoTranslation(-xEnv,-yEnvP-dpar[1]-dysave,kZp+dpar[2]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
656             
657             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1V,volEnvSuppAng1VBC[0],iVolNum++,3, spar);
658             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1V,volEnvSuppAng1VBC[2],iVolNum++,3, spar);
659
660 // 1 horizontal
661             spar[0]=dpar[0];
662             spar[1]=kSizeSupport1H[1];
663             spar[2]=kSizeSupport1H[2];
664             
665             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HBC[0], 0, true,
666             TGeoTranslation(xEnv,-yEnvM-dpar[1]-dysave-sparysave,kZm-(dpar[2]-spar[2])));
667             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HBC[2], 0, true,
668             TGeoTranslation(-xEnv,-yEnvP-dpar[1]-dysave-sparysave,kZp+dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
669
670             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1H,volEnvSuppAng1HBC[0],iVolNum++,3, spar);
671             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1H,volEnvSuppAng1HBC[2],iVolNum++,3, spar);        
672
673 // gas pipe (low)
674             ppar[0]=kSizeGasPipe[0];
675             ppar[1]=kSizeGasPipe[1];
676             ppar[2]=dpar[0];
677             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1BC[0], 0, true,
678             TGeoTranslation(xEnv,-yEnvM-dpar[1]-dysave-sparysave-kOffsetGasPipe,kZm),rsupportpipe);
679             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1BC[2], 0, true,
680             TGeoTranslation(-xEnv,-yEnvP-dpar[1]-dysave-sparysave-kOffsetGasPipe,kZp),rsupportpipe);
681             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe1BC[0],iVolNum++,3, ppar);
682             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe1BC[2],iVolNum++,3, ppar);
683
684 // 2 vertical      
685             spar[0]=dpar[0];
686             spar[1]=kSizeSupport2V[1];
687             spar[2]=kSizeSupport2V[2];
688             sparysave=spar[1]+kSizeSupport2H[1];
689             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VBC[0], 0, true,
690             TGeoTranslation(xEnv,-yEnvM-dpar[1]-dysave,-(kSizeVSupExt[0]+spar[2])));
691             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VBC[2], 0, true,
692             TGeoTranslation(-xEnv,-yEnvP-dpar[1]-dysave,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
693             
694             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2V,volEnvSuppAng2VBC[0],iVolNum++,3, spar);        
695             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2V,volEnvSuppAng2VBC[2],iVolNum++,3, spar);        
696
697 // 2 horizontal    
698             spar[0]=dpar[0];
699             spar[1]=kSizeSupport2H[1];
700             spar[2]=kSizeSupport2H[2];
701             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HBC[0], 0, true,
702             TGeoTranslation(xEnv,-yEnvM-dpar[1]-dysave-sparysave,-(kSizeVSupExt[0]+spar[2])));
703             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HBC[2], 0, true,
704             TGeoTranslation(-xEnv,-yEnvP-dpar[1]-dysave-sparysave,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
705
706             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2H,volEnvSuppAng2HBC[0],iVolNum++,3, spar);        
707             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2H,volEnvSuppAng2HBC[2],iVolNum++,3, spar);        
708
709 // 3 vertical
710             spar[0]=dxsave-kAvoidExtrusion;
711             spar[1]=kSizeSupport1V[1];
712             spar[2]=kSizeSupport1V[2];
713             sparysave=spar[1];
714             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VBC[0], 0, true,
715             TGeoTranslation(xEnv+xpossave,-yEnvM+dpar[1]+dysave,kZm-dpar[2]-spar[2]));
716             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VBC[2], 0, true,
717             TGeoTranslation(-xEnv-xpossave,-yEnvP+dpar[1]+dysave,kZp+dpar[2]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
718             
719             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3V,volEnvSuppAng3VBC[0],iVolNum++,3, spar);
720             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3V,volEnvSuppAng3VBC[2],iVolNum++,3, spar);
721
722 // 3 horizontal
723             spar[0]=dxsave-kAvoidExtrusion;
724             spar[1]=kSizeSupport1H[1];
725             spar[2]=kSizeSupport1H[2];
726             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HBC[0], 0, true,
727             TGeoTranslation(xEnv+xpossave,-yEnvM+dpar[1]+dysave+sparysave,kZm-(dpar[2]-spar[2])));
728             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HBC[2], 0, true,
729             TGeoTranslation(-xEnv-xpossave,-yEnvP+dpar[1]+dysave+sparysave,kZp+dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
730
731             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3H,volEnvSuppAng3HBC[0],iVolNum++,3, spar);
732             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3H,volEnvSuppAng3HBC[2],iVolNum++,3, spar);        
733                 
734 // gas pipe (high)
735             ppar[0]=kSizeGasPipe[0];
736             ppar[1]=kSizeGasPipe[1];
737             ppar[2]=dxsave-kAvoidExtrusion;
738             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2BC[0], 0, true,
739             TGeoTranslation(xEnv+xpossave,-yEnvM+dpar[1]+dysave+sparysave+kOffsetGasPipe,kZm),rsupportpipe);
740             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2BC[2], 0, true,
741             TGeoTranslation(-xEnv-xpossave,-yEnvP+dpar[1]+dysave+sparysave+kOffsetGasPipe,kZp),rsupportpipe);
742             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe2BC[0],iVolNum++,3, ppar);
743             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe2BC[2],iVolNum++,3, ppar);
744
745 // 4 vertical      
746             spar[0]=dxsave-kAvoidExtrusion;
747             spar[1]=kSizeSupport2V[1];
748             spar[2]=kSizeSupport2V[2];
749             sparysave=spar[1]+kSizeSupport2H[1];
750             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VBC[0], 0, true,
751             TGeoTranslation(xEnv+xpossave,-yEnvM+dpar[1]+dysave,-(kSizeVSupExt[0]+spar[2])));
752             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VBC[2], 0, true,
753             TGeoTranslation(-xEnv-xpossave,-yEnvP+dpar[1]+dysave,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
754             
755             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4V,volEnvSuppAng4VBC[0],iVolNum++,3, spar);        
756             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4V,volEnvSuppAng4VBC[2],iVolNum++,3, spar);        
757
758 // 4 horizontal    
759             spar[0]=dxsave-kAvoidExtrusion;
760             spar[1]=kSizeSupport2H[1];
761             spar[2]=kSizeSupport2H[2];
762             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HBC[0], 0, true,
763             TGeoTranslation(xEnv+xpossave,-yEnvM+dpar[1]+dysave+sparysave,-(kSizeVSupExt[0]+spar[2])));
764             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HBC[2], 0, true,
765             TGeoTranslation(-xEnv-xpossave,-yEnvP+dpar[1]+dysave+sparysave,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
766
767             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4H,volEnvSuppAng4HBC[0],iVolNum++,3, spar);        
768             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4H,volEnvSuppAng4HBC[2],iVolNum++,3, spar);        
769
770 // X horizontal    
771             spar[0]=(kYVSup[3]-kYVSup[0])/2.*zRatio;
772             spar[1]=kSizeSupportXH[1];
773             spar[2]=kSizeSupportXH[2];
774             sparysavex=spar[1];
775             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHBC[0], 0, true,
776             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,-yEnvM+dpar[1]+dysave+sparysave+1.0,-(kSizeVSupExt[0]+spar[2])));
777             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHBC[2], 0, true,
778             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),-yEnvP+dpar[1]+dysave+sparysave+1.0,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
779
780             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXH,volEnvSuppAngXHBC[0],iVolNum++,3, spar);        
781             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXH,volEnvSuppAngXHBC[2],iVolNum++,3, spar);        
782
783 // X vertical      
784             spar[0]=(kYVSup[3]-kYVSup[0])/2.*zRatio;
785             spar[1]=kSizeSupportXV[1];
786             spar[2]=kSizeSupportXV[2];
787             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVBC[0], 0, true,
788             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,-yEnvM+dpar[1]+dysave+sparysave+1.0+sparysavex+spar[1],-(kSizeVSupExt[0]+spar[2])));
789             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVBC[2], 0, true,
790             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),-yEnvP+dpar[1]+dysave+sparysave+1.0+sparysavex+spar[1],kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
791
792             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXV,volEnvSuppAngXVBC[0],iVolNum++,3, spar);        
793             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXV,volEnvSuppAngXVBC[2],iVolNum++,3, spar);        
794
795 // B
796 // 1 vertical
797             spar[0]=dxsave-kAvoidExtrusion;
798             spar[1]=kSizeSupport1V[1];
799             spar[2]=kSizeSupport1V[2];
800             sparysave=spar[1];
801             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VBC[1], 0, true,
802             TGeoTranslation(xEnv+xpossave,yEnvM-dpar[1]-dysave,kZm-dpar[2]-spar[2]));
803             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VBC[3], 0, true,
804             TGeoTranslation(-xEnv-xpossave,yEnvP-dpar[1]-dysave,kZp+dpar[2]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
805             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1V,volEnvSuppAng1VBC[1],iVolNum++,3, spar);
806             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1V,volEnvSuppAng1VBC[3],iVolNum++,3, spar);
807
808
809 // 1 horizontal
810             spar[0]=dxsave-kAvoidExtrusion;
811             spar[1]=kSizeSupport1H[1];
812             spar[2]=kSizeSupport1H[2];
813             
814             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HBC[1], 0, true,
815             TGeoTranslation(xEnv+xpossave,yEnvM-dpar[1]-dysave-sparysave,kZm-(dpar[2]-spar[2])));
816             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HBC[3], 0, true,
817             TGeoTranslation(-xEnv-xpossave,yEnvP-dpar[1]-dysave-sparysave,kZp+dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
818
819             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1H,volEnvSuppAng1HBC[1],iVolNum++,3, spar);
820             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1H,volEnvSuppAng1HBC[3],iVolNum++,3, spar);        
821
822 // gas pipe (low)
823             ppar[0]=kSizeGasPipe[0];
824             ppar[1]=kSizeGasPipe[1];
825             ppar[2]=dxsave-kAvoidExtrusion;
826             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1BC[1], 0, true,
827             TGeoTranslation(xEnv+xpossave,yEnvM-dpar[1]-dysave-sparysave-kOffsetGasPipe,kZm),rsupportpipe);
828             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1BC[3], 0, true,
829             TGeoTranslation(-xEnv-xpossave,yEnvP-dpar[1]-dysave-sparysave-kOffsetGasPipe,kZp),rsupportpipe);
830             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe1BC[1],iVolNum++,3, ppar);
831             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe1BC[3],iVolNum++,3, ppar);
832
833 // 2 vertical      
834             spar[0]=dxsave-kAvoidExtrusion;
835             spar[1]=kSizeSupport2V[1];
836             spar[2]=kSizeSupport2V[2];
837             sparysave=spar[1]+kSizeSupport2H[1];
838             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VBC[1], 0, true,
839             TGeoTranslation(xEnv+xpossave,yEnvM-dpar[1]-dysave,-(kSizeVSupExt[0]+spar[2])));
840             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VBC[3], 0, true,
841             TGeoTranslation(-xEnv-xpossave,yEnvP-dpar[1]-dysave,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
842             
843             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2V,volEnvSuppAng2VBC[1],iVolNum++,3, spar);        
844             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2V,volEnvSuppAng2VBC[3],iVolNum++,3, spar);        
845
846 // 2 horizontal    
847             spar[0]=dxsave-kAvoidExtrusion;
848             spar[1]=kSizeSupport2H[1];
849             spar[2]=kSizeSupport2H[2];
850             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HBC[1], 0, true,
851             TGeoTranslation(xEnv+xpossave,yEnvM-dpar[1]-dysave-sparysave,-(kSizeVSupExt[0]+spar[2])));
852             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HBC[3], 0, true,
853             TGeoTranslation(-xEnv-xpossave,yEnvP-dpar[1]-dysave-sparysave,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
854
855             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2H,volEnvSuppAng2HBC[1],iVolNum++,3, spar);        
856             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2H,volEnvSuppAng2HBC[3],iVolNum++,3, spar);        
857
858 // 3 vertical
859             spar[0]=dpar[0];
860             spar[1]=kSizeSupport1V[1];
861             spar[2]=kSizeSupport1V[2];
862             sparysave=spar[1];
863             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VBC[1], 0, true,
864             TGeoTranslation(xEnv,yEnvM+dpar[1]+dysave,kZm-dpar[2]-spar[2]));
865             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VBC[3], 0, true,
866             TGeoTranslation(-xEnv,yEnvP+dpar[1]+dysave,kZp+dpar[2]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
867
868             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3V,volEnvSuppAng3VBC[1],iVolNum++,3, spar);
869             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3V,volEnvSuppAng3VBC[3],iVolNum++,3, spar);
870
871 // 3 horizontal
872             spar[1]=kSizeSupport1H[1];
873             spar[2]=kSizeSupport1H[2];
874             
875             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HBC[1], 0, true,
876             TGeoTranslation(xEnv,yEnvM+dpar[1]+dysave+sparysave,kZm-(dpar[2]-spar[2])));
877             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HBC[3], 0, true,
878             TGeoTranslation(-xEnv,yEnvP+dpar[1]+dysave+sparysave,kZp+dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
879
880             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3H,volEnvSuppAng3HBC[1],iVolNum++,3, spar);
881             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3H,volEnvSuppAng3HBC[3],iVolNum++,3, spar);        
882
883 // gas pipe (high)
884             ppar[0]=kSizeGasPipe[0];
885             ppar[1]=kSizeGasPipe[1];
886             ppar[2]=dpar[0];
887             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2BC[1], 0, true,
888             TGeoTranslation(xEnv,yEnvM+dpar[1]+dysave+sparysave+kOffsetGasPipe,kZm),rsupportpipe);
889             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2BC[3], 0, true,
890             TGeoTranslation(-xEnv,yEnvP+dpar[1]+dysave+sparysave+kOffsetGasPipe,kZp),rsupportpipe);
891             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe2BC[1],iVolNum++,3, ppar);
892             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe2BC[3],iVolNum++,3, ppar);
893
894 // 4 vertical      
895             spar[0]=dpar[0];
896             spar[1]=kSizeSupport2V[1];
897             spar[2]=kSizeSupport2V[2];
898             sparysave=spar[1]+kSizeSupport2H[1];
899             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VBC[1], 0, true,
900             TGeoTranslation(xEnv,yEnvM+dpar[1]+dysave,-(kSizeVSupExt[0]+spar[2])));
901             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VBC[3], 0, true,
902             TGeoTranslation(-xEnv,yEnvP+dpar[1]+dysave,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
903             
904             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4V,volEnvSuppAng4VBC[1],iVolNum++,3, spar);        
905             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4V,volEnvSuppAng4VBC[3],iVolNum++,3, spar);        
906
907 // 4 horizontal    
908             spar[1]=kSizeSupport2H[1];
909             spar[2]=kSizeSupport2H[2];
910             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HBC[1], 0, true,
911             TGeoTranslation(xEnv,yEnvM+dpar[1]+dysave+sparysave,-(kSizeVSupExt[0]+spar[2])));
912             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HBC[3], 0, true,
913             TGeoTranslation(-xEnv,yEnvP+dpar[1]+dysave+sparysave,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
914
915             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4H,volEnvSuppAng4HBC[1],iVolNum++,3, spar);        
916             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4H,volEnvSuppAng4HBC[3],iVolNum++,3, spar);        
917
918 // X horizontal    
919             spar[0]=(kYVSup[3]-kYVSup[0])/2.*zRatio;
920             spar[1]=kSizeSupportXH[1];
921             spar[2]=kSizeSupportXH[2];
922             sparysavex=spar[1];
923             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHBC[1], 0, true,
924             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,yEnvM+dpar[1]+dysave+sparysave+1.0,-(kSizeVSupExt[0]+spar[2])));
925             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHBC[3], 0, true,
926             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),yEnvP+dpar[1]+dysave+sparysave+1.0,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
927
928             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXH,volEnvSuppAngXHBC[1],iVolNum++,3, spar);        
929             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXH,volEnvSuppAngXHBC[3],iVolNum++,3, spar);        
930
931 // X vertical      
932             spar[0]=(kYVSup[3]-kYVSup[0])/2.*zRatio;
933             spar[1]=kSizeSupportXV[1];
934             spar[2]=kSizeSupportXV[2];
935             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVBC[1], 0, true,
936             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,yEnvM+dpar[1]+dysave+sparysave+1.0+sparysavex+spar[1],-(kSizeVSupExt[0]+spar[2])));
937             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVBC[3], 0, true,
938             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),yEnvP+dpar[1]+dysave+sparysave+1.0+sparysavex+spar[1],kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
939
940             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXV,volEnvSuppAngXVBC[1],iVolNum++,3, spar);        
941             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXV,volEnvSuppAngXVBC[3],iVolNum++,3, spar);        
942
943
944 // chamber type D, E and F (same size)
945 // D        
946             yEnvPsave = yEnvP;
947             yEnvMsave = yEnvM;
948             yEnvP = (yEnvMsave + kYMIN * zRatio ) * zpm + kYMIN * zRatio;
949             yEnvM = (yEnvPsave + kYMIN * zRatio ) * zmp + kYMIN * zRatio;
950             dpar[0] = (kXMAX/2.)*zRatio;
951             dpar[1] =  kYMIN*zRatio;
952
953             detElemId = (10+icount+1)*100+16;
954             GetEnvelopes(16+icount)->AddEnvelope(volEnv[2], detElemId, true, TGeoTranslation(xEnv,-yEnvP,kZp));
955             detElemId = (10+icount+1)*100+2;
956             GetEnvelopes(16+icount)->AddEnvelope(volEnv[6], detElemId, true, TGeoTranslation(xEnv, yEnvP,kZp));
957             detElemId = (10+icount+1)*100+11;
958             GetEnvelopes(16+icount)->AddEnvelope(volEnv[11], detElemId, true, TGeoTranslation(-xEnv,-yEnvM,kZm),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
959             detElemId = (10+icount+1)*100+7;
960             GetEnvelopes(16+icount)->AddEnvelope(volEnv[15], detElemId, true, TGeoTranslation(-xEnv, yEnvM,kZm),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
961
962             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[2],iVolNum++,3, dpar);
963             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[6],iVolNum++,3, dpar);
964             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[11],iVolNum++,3, dpar);
965             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[15],iVolNum++,3, dpar);
966
967 // horizontal cable support chamber type D
968
969             spar[0]=dpar[0]-(kYVSup[0]/2.)*zRatio;
970             spar[1]=kSizeSupportCable[1];
971             spar[2]=kSizeSupportCable[2];
972             for(Int_t in=0;in<3;in++){
973               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHD[in], 0, true, TGeoTranslation(xEnv+kYVSup[0]/2.*zRatio,-(yEnvP+dpar[1]/2.*(in-1)),-(kSizeVSupExt[0]+spar[2])));
974               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHD[in+3], 0, true, TGeoTranslation(xEnv+kYVSup[0]/2.*zRatio, yEnvP+dpar[1]/2.*(in-1),-(kSizeVSupExt[0]+spar[2])));
975               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHD[in+6], 0, true, TGeoTranslation(-(xEnv+kYVSup[0]/2.*zRatio),-(yEnvM+dpar[1]/2.*(in-1)),kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
976               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHD[in+9], 0, true, TGeoTranslation(-(xEnv+kYVSup[0]/2.*zRatio),yEnvM+dpar[1]/2.*(in-1),kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
977             }
978             for(Int_t ii=0;ii<12;ii++) 
979             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluSupportH,volEnvSupportHD[ii],iVolNum++,3, spar);
980             
981 // angular supports chamber type D
982 // 1 vertical      
983  
984             spar[0]=dpar[0];
985             spar[1]=kSizeSupport1V[1];
986             spar[2]=kSizeSupport1V[2];
987             sparysave=spar[1];
988             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VD[0], 0, true,
989             TGeoTranslation(xEnv,-yEnvP-dpar[1],kZp+dpar[2]+spar[2]));
990             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VD[1], 0, true,
991             TGeoTranslation(xEnv,yEnvP-dpar[1],kZp+dpar[2]+spar[2]));
992             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VD[2], 0, true,
993             TGeoTranslation(-xEnv,-yEnvM-dpar[1],kZm-dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
994             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VD[3], 0, true,
995             TGeoTranslation(-xEnv,yEnvM-dpar[1],kZm-dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
996
997             for(i=0;i<4;i++)
998             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1V,volEnvSuppAng1VD[i],iVolNum++,3, spar);
999
1000
1001 // 1 horizontal    
1002  
1003             spar[0]=dpar[0];
1004             spar[1]=kSizeSupport1H[1];
1005             spar[2]=kSizeSupport1H[2];
1006             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HD[0], 0, true,
1007             TGeoTranslation(xEnv,-yEnvP-dpar[1]-sparysave,kZp+dpar[2]-spar[2]));
1008             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HD[1], 0, true,
1009             TGeoTranslation(xEnv,yEnvP-dpar[1]-sparysave,kZp+dpar[2]-spar[2]));
1010             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HD[2], 0, true,
1011             TGeoTranslation(-xEnv,-yEnvM-dpar[1]-sparysave,kZm-(dpar[2]-spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1012             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HD[3], 0, true,
1013             TGeoTranslation(-xEnv,yEnvM-dpar[1]-sparysave,kZm-(dpar[2]-spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1014
1015             for(i=0;i<4;i++)
1016             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1H,volEnvSuppAng1HD[i],iVolNum++,3, spar);
1017
1018 // gas pipe (low)
1019             ppar[0]=kSizeGasPipe[0];
1020             ppar[1]=kSizeGasPipe[1];
1021             ppar[2]=dpar[0];
1022             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1D[0], 0, true,
1023             TGeoTranslation(xEnv,-yEnvP-dpar[1]-sparysave-kOffsetGasPipe,kZp),rsupportpipe);
1024             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1D[1], 0, true,
1025             TGeoTranslation(xEnv,yEnvP-dpar[1]-sparysave-kOffsetGasPipe,kZp),rsupportpipe);
1026             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1D[2], 0, true,
1027             TGeoTranslation(-xEnv,-yEnvM-dpar[1]-sparysave-kOffsetGasPipe,kZm),rsupportpipe);
1028             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1D[3], 0, true,
1029             TGeoTranslation(-xEnv,yEnvM-dpar[1]-sparysave-kOffsetGasPipe,kZm),rsupportpipe);
1030
1031             for(i=0;i<4;i++)
1032             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe1D[i],iVolNum++,3, ppar);
1033
1034 // 2 vertical      
1035  
1036             spar[0]=dpar[0];
1037             spar[1]=kSizeSupport2V[1];
1038             spar[2]=kSizeSupport2V[2];
1039             sparysave=spar[1]+kSizeSupport2H[1];
1040             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VD[0], 0, true,
1041             TGeoTranslation(xEnv,-yEnvP-dpar[1],kSizeVSupExt[0]+spar[2]));
1042             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VD[1], 0, true,
1043             TGeoTranslation(xEnv,yEnvP-dpar[1],kSizeVSupExt[0]+spar[2]));
1044             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VD[2], 0, true,
1045             TGeoTranslation(-xEnv,-yEnvM-dpar[1],-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1046             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VD[3], 0, true,
1047             TGeoTranslation(-xEnv,yEnvM-dpar[1],-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1048             
1049             for(i=0;i<4;i++)
1050             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2V,volEnvSuppAng2VD[i],iVolNum++,3, spar);         
1051
1052 // 2 horizontal    
1053  
1054             spar[0]=dpar[0];
1055             spar[1]=kSizeSupport2H[1];
1056             spar[2]=kSizeSupport2H[2];
1057             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HD[0], 0, true,
1058             TGeoTranslation(xEnv,-yEnvP-dpar[1]-sparysave,kSizeVSupExt[0]+spar[2]));
1059             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HD[1], 0, true,
1060             TGeoTranslation(xEnv,yEnvP-dpar[1]-sparysave,kSizeVSupExt[0]+spar[2]));
1061             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HD[2], 0, true,
1062             TGeoTranslation(-xEnv,-yEnvM-dpar[1]-sparysave,-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1063             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HD[3], 0, true,
1064             TGeoTranslation(-xEnv,yEnvM-dpar[1]-sparysave,-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1065
1066             for(i=0;i<4;i++)
1067             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2H,volEnvSuppAng2HD[i],iVolNum++,3, spar);         
1068
1069 // 3 vertical      
1070  
1071             spar[0]=dpar[0];
1072             spar[1]=kSizeSupport1V[1];
1073             spar[2]=kSizeSupport1V[2];
1074             sparysave=spar[1];
1075             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VD[0], 0, true,
1076             TGeoTranslation(xEnv,-yEnvP+dpar[1],kZp+dpar[2]+spar[2]));
1077             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VD[1], 0, true,
1078             TGeoTranslation(xEnv,yEnvP+dpar[1],kZp+dpar[2]+spar[2]));
1079             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VD[2], 0, true,
1080             TGeoTranslation(-xEnv,-yEnvM+dpar[1],kZm-dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1081             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VD[3], 0, true,
1082             TGeoTranslation(-xEnv,yEnvM+dpar[1],kZm-dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1083
1084             for(i=0;i<4;i++)
1085             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3V,volEnvSuppAng3VD[i],iVolNum++,3, spar);
1086
1087
1088 // 3 horizontal    
1089  
1090             spar[0]=dpar[0];
1091             spar[1]=kSizeSupport1H[1];
1092             spar[2]=kSizeSupport1H[2];
1093             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HD[0], 0, true,
1094             TGeoTranslation(xEnv,-yEnvP+dpar[1]+sparysave,kZp+dpar[2]-spar[2]));
1095             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HD[1], 0, true,
1096             TGeoTranslation(xEnv,yEnvP+dpar[1]+sparysave,kZp+dpar[2]-spar[2]));
1097             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HD[2], 0, true,
1098             TGeoTranslation(-xEnv,-yEnvM+dpar[1]+sparysave,kZm-(dpar[2]-spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1099             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HD[3], 0, true,
1100             TGeoTranslation(-xEnv,yEnvM+dpar[1]+sparysave,kZm-(dpar[2]-spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1101
1102             for(i=0;i<4;i++)
1103             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3H,volEnvSuppAng3HD[i],iVolNum++,3, spar);
1104                 
1105 // gas pipe (high)
1106             ppar[0]=kSizeGasPipe[0];
1107             ppar[1]=kSizeGasPipe[1];
1108             ppar[2]=dpar[0];
1109             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2D[0], 0, true,
1110             TGeoTranslation(xEnv,-yEnvP+dpar[1]+sparysave+kOffsetGasPipe,kZp),rsupportpipe);
1111             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2D[1], 0, true,
1112             TGeoTranslation(xEnv,yEnvP+dpar[1]+sparysave+kOffsetGasPipe,kZp),rsupportpipe);
1113             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2D[2], 0, true,
1114             TGeoTranslation(-xEnv,-yEnvM+dpar[1]+sparysave+kOffsetGasPipe,kZm),rsupportpipe);
1115             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2D[3], 0, true,
1116             TGeoTranslation(-xEnv,yEnvM+dpar[1]+sparysave+kOffsetGasPipe,kZm),rsupportpipe);
1117
1118             for(i=0;i<4;i++)
1119             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe2D[i],iVolNum++,3, ppar);
1120
1121 // 4 vertical      
1122  
1123             spar[0]=dpar[0];
1124             spar[1]=kSizeSupport2V[1];
1125             spar[2]=kSizeSupport2V[2];
1126             sparysave=spar[1]+kSizeSupport2H[1];
1127             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VD[0], 0, true,
1128             TGeoTranslation(xEnv,-yEnvP+dpar[1],kSizeVSupExt[0]+spar[2]));
1129             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VD[1], 0, true,
1130             TGeoTranslation(xEnv,yEnvP+dpar[1],kSizeVSupExt[0]+spar[2]));
1131             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VD[2], 0, true,
1132             TGeoTranslation(-xEnv,-yEnvM+dpar[1],-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1133             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VD[3], 0, true,
1134             TGeoTranslation(-xEnv,yEnvM+dpar[1],-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1135             
1136             for(i=0;i<4;i++)
1137             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4V,volEnvSuppAng4VD[i],iVolNum++,3, spar);         
1138
1139 // 4 horizontal    
1140  
1141             spar[0]=dpar[0];
1142             spar[1]=kSizeSupport2H[1];
1143             spar[2]=kSizeSupport2H[2];
1144             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HD[0], 0, true,
1145             TGeoTranslation(xEnv,-yEnvP+dpar[1]+sparysave,kSizeVSupExt[0]+spar[2]));
1146             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HD[1], 0, true,
1147             TGeoTranslation(xEnv,yEnvP+dpar[1]+sparysave,kSizeVSupExt[0]+spar[2]));
1148             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HD[2], 0, true,
1149             TGeoTranslation(-xEnv,-yEnvM+dpar[1]+sparysave,-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1150             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HD[3], 0, true,
1151             TGeoTranslation(-xEnv,yEnvM+dpar[1]+sparysave,-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1152
1153             for(i=0;i<4;i++)
1154             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4H,volEnvSuppAng4HD[i],iVolNum++,3, spar);         
1155
1156 // X horizontal    
1157             spar[0]=(kYVSup[3]-kYVSup[0])/2.*zRatio;
1158             spar[1]=kSizeSupportXH[1];
1159             spar[2]=kSizeSupportXH[2];
1160             sparysavex=spar[1];
1161             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHD[0], 0, true,
1162             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,-yEnvP+dpar[1]+sparysave+1.0,kSizeVSupExt[0]+spar[2]));
1163             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHD[1], 0, true,
1164             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,yEnvP+dpar[1]+sparysave+1.0,kSizeVSupExt[0]+spar[2]));
1165             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHD[2], 0, true,
1166             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),yEnvM+dpar[1]+sparysave+1.0,-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1167             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHD[3], 0, true,
1168             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),-yEnvM+dpar[1]+sparysave+1.0,-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1169
1170             for(i=0;i<4;i++)
1171             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXH,volEnvSuppAngXHD[i],iVolNum++,3, spar);         
1172
1173 // X vertical      
1174             spar[0]=(kYVSup[3]-kYVSup[0])/2.*zRatio;
1175             spar[1]=kSizeSupportXV[1];
1176             spar[2]=kSizeSupportXV[2];
1177             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVD[0], 0, true,
1178             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,-yEnvP+dpar[1]+sparysave+1.0+sparysavex+spar[1],kSizeVSupExt[0]+spar[2]));
1179             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVD[1], 0, true,
1180             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,yEnvP+dpar[1]+sparysave+1.0+sparysavex+spar[1],kSizeVSupExt[0]+spar[2]));
1181             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVD[2], 0, true,
1182             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),yEnvM+dpar[1]+sparysave+1.0+sparysavex+spar[1],-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1183             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVD[3], 0, true,
1184             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),-yEnvM+dpar[1]+sparysave+1.0+sparysavex+spar[1],-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1185
1186             for(i=0;i<4;i++)
1187             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXV,volEnvSuppAngXVD[i],iVolNum++,3, spar);         
1188
1189 // E
1190             yEnvPsave = yEnvP;
1191             yEnvMsave = yEnvM;
1192             yEnvP = (yEnvMsave + kYMIN * zRatio ) * zpm + kYMIN * zRatio;
1193             yEnvM = (yEnvPsave + kYMIN * zRatio ) * zmp + kYMIN * zRatio;
1194
1195             detElemId = (10+icount+1)*100+15;
1196             GetEnvelopes(16+icount)->AddEnvelope(volEnv[1], detElemId, true, TGeoTranslation(xEnv,-yEnvM,kZm));
1197             detElemId = (10+icount+1)*100+3;
1198             GetEnvelopes(16+icount)->AddEnvelope(volEnv[7], detElemId, true, TGeoTranslation(xEnv, yEnvM,kZm));
1199             detElemId = (10+icount+1)*100+12;
1200             GetEnvelopes(16+icount)->AddEnvelope(volEnv[10], detElemId, true, TGeoTranslation(-xEnv,-yEnvP,kZp),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1201             detElemId = (10+icount+1)*100+6;
1202             GetEnvelopes(16+icount)->AddEnvelope(volEnv[16], detElemId, true, TGeoTranslation(-xEnv, yEnvP,kZp),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1203
1204             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[1],iVolNum++,3,dpar);
1205             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[7],iVolNum++,3,dpar);
1206             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[10],iVolNum++,3,dpar);
1207             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[16],iVolNum++,3,dpar);
1208
1209 // horizontal cable support chamber type E
1210
1211             spar[0]=dpar[0]-(kYVSup[0]/2.)*zRatio;
1212             spar[1]=kSizeSupportCable[1];
1213             spar[2]=kSizeSupportCable[2];
1214             for(Int_t in=0;in<3;in++){
1215               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHE[in], 0, true, TGeoTranslation(xEnv+kYVSup[0]/2.*zRatio,-(yEnvM+dpar[1]/2.*(in-1)),kSizeVSupExt[0]+spar[2]));
1216               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHE[in+3], 0, true, TGeoTranslation(xEnv+kYVSup[0]/2.*zRatio, yEnvM+dpar[1]/2.*(in-1),kSizeVSupExt[0]+spar[2]));
1217               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHE[in+6], 0, true, TGeoTranslation(-(xEnv+kYVSup[0]/2.*zRatio),-(yEnvP+dpar[1]/2.*(in-1)),-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1218               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHE[in+9], 0, true, TGeoTranslation(-(xEnv+kYVSup[0]/2.*zRatio), yEnvP+dpar[1]/2.*(in-1),-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1219             }
1220             for(Int_t ii=0;ii<12;ii++) 
1221             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluSupportH,volEnvSupportHE[ii],iVolNum++,3, spar);
1222             
1223 // angular supports chamber type E
1224 // 1 vertical      
1225  
1226             spar[0]=dpar[0];
1227             spar[1]=kSizeSupport1V[1];
1228             spar[2]=kSizeSupport1V[2];
1229             sparysave=spar[1];
1230             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VE[0], 0, true,
1231             TGeoTranslation(xEnv,-yEnvM-dpar[1],kZm-dpar[2]-spar[2]));
1232             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VE[1], 0, true,
1233             TGeoTranslation(xEnv,yEnvM-dpar[1],kZm-dpar[2]-spar[2]));
1234             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VE[2], 0, true,
1235             TGeoTranslation(-xEnv,-yEnvP-dpar[1],kZp+dpar[2]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1236             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VE[3], 0, true,
1237             TGeoTranslation(-xEnv,yEnvP-dpar[1],kZp+dpar[2]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1238  
1239             for(i=0;i<4;i++)
1240             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1V,volEnvSuppAng1VE[i],iVolNum++,3, spar);
1241
1242
1243 // 1 horizontal    
1244  
1245             spar[0]=dpar[0];
1246             spar[1]=kSizeSupport1H[1];
1247             spar[2]=kSizeSupport1H[2];
1248             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HE[0], 0, true,
1249             TGeoTranslation(xEnv,-yEnvM-dpar[1]-sparysave,kZm-(dpar[2]-spar[2])));
1250             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HE[1], 0, true,
1251             TGeoTranslation(xEnv,yEnvM-dpar[1]-sparysave,kZm-(dpar[2]-spar[2])));
1252             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HE[2], 0, true,
1253             TGeoTranslation(-xEnv,-yEnvP-dpar[1]-sparysave,kZp+dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1254             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HE[3], 0, true,
1255             TGeoTranslation(-xEnv,yEnvP-dpar[1]-sparysave,kZp+dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1256
1257             for(i=0;i<4;i++)
1258             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1H,volEnvSuppAng1HE[i],iVolNum++,3, spar);
1259
1260 // gas pipe (low)
1261             ppar[0]=kSizeGasPipe[0];
1262             ppar[1]=kSizeGasPipe[1];
1263             ppar[2]=dpar[0];
1264             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1E[0], 0, true,
1265             TGeoTranslation(xEnv,-yEnvM-dpar[1]-sparysave-kOffsetGasPipe,kZm),rsupportpipe);
1266             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1E[1], 0, true,
1267             TGeoTranslation(xEnv,yEnvM-dpar[1]-sparysave-kOffsetGasPipe,kZm),rsupportpipe);
1268             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1E[2], 0, true,
1269             TGeoTranslation(-xEnv,-yEnvP-dpar[1]-sparysave-kOffsetGasPipe,kZp),rsupportpipe);
1270             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1E[3], 0, true,
1271             TGeoTranslation(-xEnv,yEnvP-dpar[1]-sparysave-kOffsetGasPipe,kZp),rsupportpipe);
1272
1273             for(i=0;i<4;i++)
1274             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe1E[i],iVolNum++,3, ppar);
1275
1276 // 2 vertical      
1277  
1278             spar[0]=dpar[0];
1279             spar[1]=kSizeSupport2V[1];
1280             spar[2]=kSizeSupport2V[2];
1281             sparysave=spar[1]+kSizeSupport2H[1];
1282             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VE[0], 0, true,
1283             TGeoTranslation(xEnv,-yEnvM-dpar[1],-(kSizeVSupExt[0]+spar[2])));
1284             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VE[1], 0, true,
1285             TGeoTranslation(xEnv,yEnvM-dpar[1],-(kSizeVSupExt[0]+spar[2])));
1286             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VE[2], 0, true,
1287             TGeoTranslation(-xEnv,-yEnvP-dpar[1],kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1288             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VE[3], 0, true,
1289             TGeoTranslation(-xEnv,yEnvP-dpar[1],kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1290             
1291             for(i=0;i<4;i++)
1292             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2V,volEnvSuppAng2VE[i],iVolNum++,3, spar);         
1293
1294 // 2 horizontal    
1295  
1296             spar[0]=dpar[0];
1297             spar[1]=kSizeSupport2H[1];
1298             spar[2]=kSizeSupport2H[2];
1299             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HE[0], 0, true,
1300             TGeoTranslation(xEnv,-yEnvM-dpar[1]-sparysave,-(kSizeVSupExt[0]+spar[2])));
1301             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HE[1], 0, true,
1302             TGeoTranslation(xEnv,yEnvM-dpar[1]-sparysave,-(kSizeVSupExt[0]+spar[2])));
1303             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HE[2], 0, true,
1304             TGeoTranslation(-xEnv,-yEnvP-dpar[1]-sparysave,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1305             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HE[3], 0, true,
1306             TGeoTranslation(-xEnv,yEnvP-dpar[1]-sparysave,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1307
1308             for(i=0;i<4;i++)
1309             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2H,volEnvSuppAng2HE[i],iVolNum++,3, spar);         
1310
1311 // 3 vertical      
1312  
1313             spar[0]=dpar[0];
1314             spar[1]=kSizeSupport1V[1];
1315             spar[2]=kSizeSupport1V[2];
1316             sparysave=spar[1];
1317             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VE[0], 0, true,
1318             TGeoTranslation(xEnv,-yEnvM+dpar[1],kZm-dpar[2]-spar[2]));
1319             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VE[1], 0, true,
1320             TGeoTranslation(xEnv,yEnvM+dpar[1],kZm-dpar[2]-spar[2]));
1321             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VE[2], 0, true,
1322             TGeoTranslation(-xEnv,-yEnvP+dpar[1],kZp+dpar[2]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1323             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VE[3], 0, true,
1324             TGeoTranslation(-xEnv,yEnvP+dpar[1],kZp+dpar[2]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1325  
1326             for(i=0;i<4;i++)
1327             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3V,volEnvSuppAng3VE[i],iVolNum++,3, spar);
1328
1329
1330 // 3 horizontal    
1331  
1332             spar[0]=dpar[0];
1333             spar[1]=kSizeSupport1H[1];
1334             spar[2]=kSizeSupport1H[2];
1335             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HE[0], 0, true,
1336             TGeoTranslation(xEnv,-yEnvM+dpar[1]+sparysave,kZm-(dpar[2]-spar[2])));
1337             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HE[1], 0, true,
1338             TGeoTranslation(xEnv,yEnvM+dpar[1]+sparysave,kZm-(dpar[2]-spar[2])));
1339             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HE[2], 0, true,
1340             TGeoTranslation(-xEnv,-yEnvP+dpar[1]+sparysave,kZp+dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1341             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HE[3], 0, true,
1342             TGeoTranslation(-xEnv,yEnvP+dpar[1]+sparysave,kZp+dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1343
1344             for(i=0;i<4;i++)
1345             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3H,volEnvSuppAng3HE[i],iVolNum++,3, spar);
1346
1347 // gas pipe (high)
1348             ppar[0]=kSizeGasPipe[0];
1349             ppar[1]=kSizeGasPipe[1];
1350             ppar[2]=dpar[0];
1351             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2E[0], 0, true,
1352             TGeoTranslation(xEnv,-yEnvM+dpar[1]+sparysave+kOffsetGasPipe,kZm),rsupportpipe);
1353             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2E[1], 0, true,
1354             TGeoTranslation(xEnv,yEnvM+dpar[1]+sparysave+kOffsetGasPipe,kZm),rsupportpipe);
1355             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2E[2], 0, true,
1356             TGeoTranslation(-xEnv,-yEnvP+dpar[1]+sparysave+kOffsetGasPipe,kZp),rsupportpipe);
1357             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2E[3], 0, true,
1358             TGeoTranslation(-xEnv,yEnvP+dpar[1]+sparysave+kOffsetGasPipe,kZp),rsupportpipe);
1359
1360             for(i=0;i<4;i++)
1361             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe2E[i],iVolNum++,3, ppar);
1362
1363 // 4 vertical      
1364  
1365             spar[0]=dpar[0];
1366             spar[1]=kSizeSupport2V[1];
1367             spar[2]=kSizeSupport2V[2];
1368             sparysave=spar[1]+kSizeSupport2H[1];
1369             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VE[0], 0, true,
1370             TGeoTranslation(xEnv,-yEnvM+dpar[1],-(kSizeVSupExt[0]+spar[2])));
1371             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VE[1], 0, true,
1372             TGeoTranslation(xEnv,yEnvM+dpar[1],-(kSizeVSupExt[0]+spar[2])));
1373             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VE[2], 0, true,
1374             TGeoTranslation(-xEnv,-yEnvP+dpar[1],kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1375             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VE[3], 0, true,
1376             TGeoTranslation(-xEnv,yEnvP+dpar[1],kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1377             
1378             for(i=0;i<4;i++)
1379             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4V,volEnvSuppAng4VE[i],iVolNum++,3, spar);         
1380
1381 // 4 horizontal    
1382  
1383             spar[0]=dpar[0];
1384             spar[1]=kSizeSupport2H[1];
1385             spar[2]=kSizeSupport2H[2];
1386             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HE[0], 0, true,
1387             TGeoTranslation(xEnv,-yEnvM+dpar[1]+sparysave,-(kSizeVSupExt[0]+spar[2])));
1388             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HE[1], 0, true,
1389             TGeoTranslation(xEnv,yEnvM+dpar[1]+sparysave,-(kSizeVSupExt[0]+spar[2])));
1390             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HE[2], 0, true,
1391             TGeoTranslation(-xEnv,-yEnvP+dpar[1]+sparysave,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1392             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HE[3], 0, true,
1393             TGeoTranslation(-xEnv,yEnvP+dpar[1]+sparysave,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1394
1395             for(i=0;i<4;i++)
1396             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4H,volEnvSuppAng4HE[i],iVolNum++,3, spar);         
1397
1398 // X horizontal    
1399             spar[0]=(kYVSup[3]-kYVSup[0])/2.*zRatio;
1400             spar[1]=kSizeSupportXH[1];
1401             spar[2]=kSizeSupportXH[2];
1402             sparysavex=spar[1];
1403             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHE[0], 0, true,
1404             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,-yEnvM+dpar[1]+sparysave+1.0,-(kSizeVSupExt[0]+spar[2])));
1405             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHE[1], 0, true,
1406             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,yEnvM+dpar[1]+sparysave+1.0,-(kSizeVSupExt[0]+spar[2])));
1407             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHE[2], 0, true,
1408             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),-yEnvP+dpar[1]+sparysave+1.0,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1409             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHE[3], 0, true,
1410             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),yEnvP+dpar[1]+sparysave+1.0,kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1411
1412             for(i=0;i<4;i++)
1413             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXH,volEnvSuppAngXHE[i],iVolNum++,3, spar);         
1414
1415 // X vertical      
1416             spar[0]=(kYVSup[3]-kYVSup[0])/2.*zRatio;
1417             spar[1]=kSizeSupportXV[1];
1418             spar[2]=kSizeSupportXV[2];
1419             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVE[0], 0, true,
1420             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,-yEnvM+dpar[1]+sparysave+1.0+sparysavex+spar[1],-(kSizeVSupExt[0]+spar[2])));
1421             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVE[1], 0, true,
1422             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,yEnvM+dpar[1]+sparysave+1.0+sparysavex+spar[1],-(kSizeVSupExt[0]+spar[2])));
1423             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVE[2], 0, true,
1424             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),-yEnvP+dpar[1]+sparysave+1.0+sparysavex+spar[1],kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1425             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVE[3], 0, true,
1426             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),yEnvP+dpar[1]+sparysave+1.0+sparysavex+spar[1],kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1427
1428             for(i=0;i<4;i++)
1429             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXV,volEnvSuppAngXVE[i],iVolNum++,3, spar);         
1430
1431 // F
1432             yEnvPsave = yEnvP;
1433             yEnvMsave = yEnvM;
1434             yEnvP = (yEnvMsave + kYMIN * zRatio ) * zpm + kYMIN * zRatio;
1435             yEnvM = (yEnvPsave + kYMIN * zRatio ) * zmp + kYMIN * zRatio;
1436
1437             detElemId = (10+icount+1)*100+14;
1438             GetEnvelopes(16+icount)->AddEnvelope(volEnv[0], detElemId, true, TGeoTranslation(xEnv,-yEnvP,kZp));
1439             detElemId = (10+icount+1)*100+4;
1440             GetEnvelopes(16+icount)->AddEnvelope(volEnv[8], detElemId, true, TGeoTranslation(xEnv, yEnvP,kZp));
1441             detElemId = (10+icount+1)*100+13;
1442             GetEnvelopes(16+icount)->AddEnvelope(volEnv[9], detElemId, true, TGeoTranslation(-xEnv,-yEnvM,kZm),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1443             detElemId = (10+icount+1)*100+5;
1444             GetEnvelopes(16+icount)->AddEnvelope(volEnv[17], detElemId, true, TGeoTranslation(-xEnv, yEnvM,kZm),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1445             
1446             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[0],iVolNum++,3,dpar);
1447             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[8],iVolNum++,3,dpar);
1448             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[9],iVolNum++,3,dpar);
1449             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[17],iVolNum++,3,dpar);
1450
1451 // horizontal cable support chamber type F
1452
1453             spar[0]=dpar[0]-(kYVSup[0]/2.)*zRatio;
1454             spar[1]=kSizeSupportCable[1];
1455             spar[2]=kSizeSupportCable[2];
1456             for(Int_t in=0;in<3;in++){
1457               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHF[in], 0, true, TGeoTranslation(xEnv+kYVSup[0]/2.*zRatio,-(yEnvP+dpar[1]/2.*(in-1)),-(kSizeVSupExt[0]+spar[2])));
1458               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHF[in+3], 0, true, TGeoTranslation(xEnv+kYVSup[0]/2.*zRatio,yEnvP+dpar[1]/2.*(in-1),-(kSizeVSupExt[0]+spar[2])));
1459               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHF[in+6], 0, true, TGeoTranslation(-(xEnv+kYVSup[0]/2.*zRatio),-(yEnvM+dpar[1]/2.*(in-1)),kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1460               GetEnvelopes(16+icount)->AddEnvelope(volEnvSupportHF[in+9], 0, true, TGeoTranslation(-(xEnv+kYVSup[0]/2.*zRatio), yEnvM+dpar[1]/2.*(in-1),kSizeVSupExt[0]+spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1461             }
1462             for(Int_t ii=0;ii<12;ii++) 
1463             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluSupportH,volEnvSupportHF[ii],iVolNum++,3, spar);
1464
1465 // angular supports chamber type F
1466 // 1 vertical      
1467  
1468             spar[0]=dpar[0];
1469             spar[1]=kSizeSupport1V[1];
1470             spar[2]=kSizeSupport1V[2];
1471             sparysave=spar[1];
1472             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VF[0], 0, true,
1473             TGeoTranslation(xEnv,-yEnvP-dpar[1],kZp+dpar[2]+spar[2]));
1474             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VF[1], 0, true,
1475             TGeoTranslation(xEnv,yEnvP-dpar[1],kZp+dpar[2]+spar[2]));
1476             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VF[2], 0, true,
1477             TGeoTranslation(-xEnv,-yEnvM-dpar[1],kZm-dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1478             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1VF[3], 0, true,
1479             TGeoTranslation(-xEnv,yEnvM-dpar[1],kZm-dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1480  
1481             for(i=0;i<4;i++)
1482             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1V,volEnvSuppAng1VF[i],iVolNum++,3, spar);
1483
1484 // 1 horizontal    
1485  
1486             spar[0]=dpar[0];
1487             spar[1]=kSizeSupport1H[1];
1488             spar[2]=kSizeSupport1H[2];
1489             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HF[0], 0, true,
1490             TGeoTranslation(xEnv,-yEnvP-dpar[1]-sparysave,kZp+dpar[2]-spar[2]));
1491             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HF[1], 0, true,
1492             TGeoTranslation(xEnv,yEnvP-dpar[1]-sparysave,kZp+dpar[2]-spar[2]));
1493             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HF[2], 0, true,
1494             TGeoTranslation(-xEnv,-yEnvM-dpar[1]-sparysave,kZm-(dpar[2]-spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1495             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng1HF[3], 0, true,
1496             TGeoTranslation(-xEnv,yEnvM-dpar[1]-sparysave,kZm-(dpar[2]-spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1497
1498             for(i=0;i<4;i++)
1499             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport1H,volEnvSuppAng1HF[i],iVolNum++,3, spar);
1500
1501 // gas pipe (low)
1502             ppar[0]=kSizeGasPipe[0];
1503             ppar[1]=kSizeGasPipe[1];
1504             ppar[2]=dpar[0];
1505             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1F[0], 0, true,
1506             TGeoTranslation(xEnv,-yEnvP-dpar[1]-sparysave-kOffsetGasPipe,kZp),rsupportpipe);
1507             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1F[1], 0, true,
1508             TGeoTranslation(xEnv,yEnvP-dpar[1]-sparysave-kOffsetGasPipe,kZp),rsupportpipe);
1509             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1F[2], 0, true,
1510             TGeoTranslation(-xEnv,-yEnvM-dpar[1]-sparysave-kOffsetGasPipe,kZm),rsupportpipe);
1511             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe1F[3], 0, true,
1512             TGeoTranslation(-xEnv,yEnvM-dpar[1]-sparysave-kOffsetGasPipe,kZm),rsupportpipe);
1513
1514             for(i=0;i<4;i++)
1515             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe1F[i],iVolNum++,3, ppar);
1516
1517 // 2 vertical      
1518  
1519             spar[0]=dpar[0];
1520             spar[1]=kSizeSupport2V[1];
1521             spar[2]=kSizeSupport2V[2];
1522             sparysave=spar[1]+kSizeSupport2H[1];
1523             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VF[0], 0, true,
1524             TGeoTranslation(xEnv,-yEnvP-dpar[1],kSizeVSupExt[0]+spar[2]));
1525             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VF[1], 0, true,
1526             TGeoTranslation(xEnv,yEnvP-dpar[1],kSizeVSupExt[0]+spar[2]));
1527             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VF[2], 0, true,
1528             TGeoTranslation(-xEnv,-yEnvM-dpar[1],-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1529             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2VF[3], 0, true,
1530             TGeoTranslation(-xEnv,yEnvM-dpar[1],-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1531             
1532             for(i=0;i<4;i++)
1533             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2V,volEnvSuppAng2VF[i],iVolNum++,3, spar);         
1534
1535 // 2 horizontal    
1536  
1537             spar[0]=dpar[0];
1538             spar[1]=kSizeSupport2H[1];
1539             spar[2]=kSizeSupport2H[2];
1540             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HF[0], 0, true,
1541             TGeoTranslation(xEnv,-yEnvP-dpar[1]-sparysave,kSizeVSupExt[0]+spar[2]));
1542             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HF[1], 0, true,
1543             TGeoTranslation(xEnv,yEnvP-dpar[1]-sparysave,kSizeVSupExt[0]+spar[2]));
1544             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HF[2], 0, true,
1545             TGeoTranslation(-xEnv,-yEnvM-dpar[1]-sparysave,-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1546             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng2HF[3], 0, true,
1547             TGeoTranslation(-xEnv,yEnvM-dpar[1]-sparysave,-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1548
1549             for(i=0;i<4;i++)
1550             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport2H,volEnvSuppAng2HF[i],iVolNum++,3, spar);         
1551
1552 // 3 vertical      
1553  
1554             spar[0]=dpar[0];
1555             spar[1]=kSizeSupport1V[1];
1556             spar[2]=kSizeSupport1V[2];
1557             sparysave=spar[1];
1558             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VF[0], 0, true,
1559             TGeoTranslation(xEnv,-yEnvP+dpar[1],kZp+dpar[2]+spar[2]));
1560             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VF[1], 0, true,
1561             TGeoTranslation(xEnv,yEnvP+dpar[1],kZp+dpar[2]+spar[2]));
1562             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VF[2], 0, true,
1563             TGeoTranslation(-xEnv,-yEnvM+dpar[1],kZm-dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1564             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3VF[3], 0, true,
1565             TGeoTranslation(-xEnv,yEnvM+dpar[1],kZm-dpar[2]-spar[2]),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1566  
1567             for(i=0;i<4;i++)
1568             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3V,volEnvSuppAng3VF[i],iVolNum++,3, spar);
1569
1570 // 3 horizontal    
1571  
1572             spar[0]=dpar[0];
1573             spar[1]=kSizeSupport1H[1];
1574             spar[2]=kSizeSupport1H[2];
1575             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HF[0], 0, true,
1576             TGeoTranslation(xEnv,-yEnvP+dpar[1]+sparysave,kZp+dpar[2]-spar[2]));
1577             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HF[1], 0, true,
1578             TGeoTranslation(xEnv,yEnvP+dpar[1]+sparysave,kZp+dpar[2]-spar[2]));
1579             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HF[2], 0, true,
1580             TGeoTranslation(-xEnv,-yEnvM+dpar[1]+sparysave,kZm-(dpar[2]-spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1581             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng3HF[3], 0, true,
1582             TGeoTranslation(-xEnv,yEnvM+dpar[1]+sparysave,kZm-(dpar[2]-spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1583
1584             for(i=0;i<4;i++)
1585             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport3H,volEnvSuppAng3HF[i],iVolNum++,3, spar);
1586             
1587 // gas pipe (high)
1588             ppar[0]=kSizeGasPipe[0];
1589             ppar[1]=kSizeGasPipe[1];
1590             ppar[2]=dpar[0];
1591             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2F[0], 0, true,
1592             TGeoTranslation(xEnv,-yEnvP+dpar[1]+sparysave+kOffsetGasPipe,kZp),rsupportpipe);
1593             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2F[1], 0, true,
1594             TGeoTranslation(xEnv,yEnvP+dpar[1]+sparysave+kOffsetGasPipe,kZp),rsupportpipe);
1595             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2F[2], 0, true,
1596             TGeoTranslation(-xEnv,-yEnvM+dpar[1]+sparysave+kOffsetGasPipe,kZm),rsupportpipe);
1597             GetEnvelopes(16+icount)->AddEnvelope(volEnvInoxGasPipe2F[3], 0, true,
1598             TGeoTranslation(-xEnv,yEnvM+dpar[1]+sparysave+kOffsetGasPipe,kZm),rsupportpipe);
1599
1600             for(i=0;i<4;i++)
1601             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volInoxGasPipe,volEnvInoxGasPipe2F[i],iVolNum++,3, ppar);
1602
1603 // 4 vertical      
1604  
1605             spar[0]=dpar[0];
1606             spar[1]=kSizeSupport2V[1];
1607             spar[2]=kSizeSupport2V[2];
1608             sparysave=spar[1]+kSizeSupport2H[1];
1609             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VF[0], 0, true,
1610             TGeoTranslation(xEnv,-yEnvP+dpar[1],kSizeVSupExt[0]+spar[2]));
1611             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VF[1], 0, true,
1612             TGeoTranslation(xEnv,yEnvP+dpar[1],kSizeVSupExt[0]+spar[2]));
1613             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VF[2], 0, true,
1614             TGeoTranslation(-xEnv,-yEnvM+dpar[1],-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1615             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4VF[3], 0, true,
1616             TGeoTranslation(-xEnv,yEnvM+dpar[1],-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1617             
1618             for(i=0;i<4;i++)
1619             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4V,volEnvSuppAng4VF[i],iVolNum++,3, spar);         
1620
1621 // 4 horizontal    
1622  
1623             spar[0]=dpar[0];
1624             spar[1]=kSizeSupport2H[1];
1625             spar[2]=kSizeSupport2H[2];
1626             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HF[0], 0, true,
1627             TGeoTranslation(xEnv,-yEnvP+dpar[1]+sparysave,kSizeVSupExt[0]+spar[2]));
1628             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HF[1], 0, true,
1629             TGeoTranslation(xEnv,yEnvP+dpar[1]+sparysave,kSizeVSupExt[0]+spar[2]));
1630             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HF[2], 0, true,
1631             TGeoTranslation(-xEnv,-yEnvM+dpar[1]+sparysave,-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1632             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAng4HF[3], 0, true,
1633             TGeoTranslation(-xEnv,yEnvM+dpar[1]+sparysave,-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1634
1635             for(i=0;i<4;i++)
1636             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupport4H,volEnvSuppAng4HF[i],iVolNum++,3, spar);         
1637
1638
1639 // X horizontal    
1640             spar[0]=(kYVSup[3]-kYVSup[0])/2.*zRatio;
1641             spar[1]=kSizeSupportXH[1];
1642             spar[2]=kSizeSupportXH[2];
1643             sparysavex=spar[1];
1644             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHF[0], 0, true,
1645             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,-yEnvP+dpar[1]+sparysave+1.0,kSizeVSupExt[0]+spar[2]));
1646             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHF[1], 0, true,
1647             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,yEnvP+dpar[1]+sparysave+1.0,kSizeVSupExt[0]+spar[2]));
1648             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHF[2], 0, true,
1649             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),-yEnvM+dpar[1]+sparysave+1.0,-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1650             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXHF[3], 0, true,
1651             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),yEnvM+dpar[1]+sparysave+1.0,-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1652
1653             for(i=0;i<4;i++)
1654             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXH,volEnvSuppAngXHF[i],iVolNum++,3, spar);         
1655
1656 // X vertical      
1657             spar[0]=(kYVSup[3]-kYVSup[0])/2.*zRatio;
1658             spar[1]=kSizeSupportXV[1];
1659             spar[2]=kSizeSupportXV[2];
1660             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVF[0], 0, true,
1661             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,-yEnvP+dpar[1]+sparysave+1.0+sparysavex+spar[1],kSizeVSupExt[0]+spar[2]));
1662             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVF[1], 0, true,
1663             TGeoTranslation(spar[0]+kYVSup[0]*zRatio,yEnvP+dpar[1]+sparysave+1.0+sparysavex+spar[1],kSizeVSupExt[0]+spar[2]));
1664             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVF[2], 0, true,
1665             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),-yEnvM+dpar[1]+sparysave+1.0+sparysavex+spar[1],-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1666             GetEnvelopes(16+icount)->AddEnvelope(volEnvSuppAngXVF[3], 0, true,
1667             TGeoTranslation(-(spar[0]+kYVSup[0]*zRatio),yEnvM+dpar[1]+sparysave+1.0+sparysavex+spar[1],-(kSizeVSupExt[0]+spar[2])),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
1668
1669             for(i=0;i<4;i++)
1670             GetEnvelopes(16+icount)->AddEnvelopeConstituentParam(volAluAngSupportXV,volEnvSuppAngXVF[i],iVolNum++,3, spar);
1671                     
1672         } // end loop on detection planes
1673     } // end loop on stations    
1674 }
1675
1676 //______________________________________________________________________________
1677 void AliMUONTriggerGeometryBuilder::SetVolumes() 
1678 {
1679 /// Defines the volumes for the trigger chambers.
1680
1681     if (gAlice->GetModule("SHIL")) {
1682       SetMotherVolume(16, "YOUT2");
1683       SetMotherVolume(17, "YOUT2");
1684       SetMotherVolume(18, "YOUT2");
1685       SetMotherVolume(19, "YOUT2");
1686     }  
1687
1688     SetVolume(16, "SC11");
1689     SetVolume(17, "SC12");
1690     SetVolume(18, "SC13");
1691     SetVolume(19, "SC14");
1692 }
1693
1694 //______________________________________________________________________________
1695 void AliMUONTriggerGeometryBuilder::SetTransformations() 
1696 {
1697 /// Defines the transformations for the trigger chambers.
1698
1699     Double_t zpos1= AliMUONConstants::DefaultChamberZ(10); 
1700     SetTranslation(16, TGeoTranslation(0., 0., zpos1));
1701     
1702     zpos1= AliMUONConstants::DefaultChamberZ(11); 
1703     SetTranslation(17, TGeoTranslation(0., 0., zpos1));
1704
1705     zpos1= AliMUONConstants::DefaultChamberZ(12); 
1706     SetTranslation(18, TGeoTranslation(0., 0., zpos1));
1707
1708     zpos1= AliMUONConstants::DefaultChamberZ(13); 
1709     SetTranslation(19, TGeoTranslation(0., 0., zpos1));
1710 }
1711
1712 //______________________________________________________________________________
1713 void AliMUONTriggerGeometryBuilder::SetSensitiveVolumes()
1714 {
1715 /// Defines the sensitive volumes for trigger station chambers.
1716
1717   GetGeometry(16)->SetSensitiveVolume("S11G");
1718   GetGeometry(17)->SetSensitiveVolume("S12G");
1719   GetGeometry(18)->SetSensitiveVolume("S13G");
1720   GetGeometry(19)->SetSensitiveVolume("S14G");
1721 }
1722