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