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