]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTriggerGeometryBuilder.cxx
Updated to use the new CTP framework (Christian)
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerGeometryBuilder.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // $Id$
17
18 // -----------------------------------
19 // Class AliMUONTriggerGeometryBuilder
20 // -----------------------------------
21 // MUON Trigger stations geometry 
22 // construction class.
23 // Author: Philippe Crochet (LPCCFd)
24
25 #include <TVirtualMC.h>
26 #include <TGeoMatrix.h>
27
28 #include "AliLog.h"
29 #include "AliRun.h"
30
31 #include "AliMUONTriggerGeometryBuilder.h"
32 #include "AliMUON.h"
33 #include "AliMUONConstants.h"
34 #include "AliMUONGeometryModule.h"
35 #include "AliMUONGeometryEnvelopeStore.h"
36
37 ClassImp(AliMUONTriggerGeometryBuilder)
38
39 //______________________________________________________________________________
40 AliMUONTriggerGeometryBuilder::AliMUONTriggerGeometryBuilder(AliMUON* muon)
41  : AliMUONVGeometryBuilder(10, 11, 12, 13),
42    fMUON(muon)
43 {
44 // Standard constructor
45
46 }
47
48 //______________________________________________________________________________
49 AliMUONTriggerGeometryBuilder::AliMUONTriggerGeometryBuilder()
50  : AliMUONVGeometryBuilder(),
51    fMUON(0)
52 {
53 // Default constructor
54 }
55
56
57 //______________________________________________________________________________
58 AliMUONTriggerGeometryBuilder::AliMUONTriggerGeometryBuilder(const AliMUONTriggerGeometryBuilder& rhs)
59   : AliMUONVGeometryBuilder(rhs)
60 {
61 // Protected copy constructor
62
63   AliFatal("Copy constructor is not implemented.");
64 }
65
66 //______________________________________________________________________________
67 AliMUONTriggerGeometryBuilder::~AliMUONTriggerGeometryBuilder() {
68 //
69 }
70
71 //______________________________________________________________________________
72 AliMUONTriggerGeometryBuilder& 
73 AliMUONTriggerGeometryBuilder::operator = (const AliMUONTriggerGeometryBuilder& rhs) 
74 {
75 // Protected assignement operator
76
77   // check assignement to self
78   if (this == &rhs) return *this;
79
80   AliFatal("Assignment operator is not implemented.");
81     
82   return *this;  
83 }
84
85 //
86 // public methods
87 //
88
89 //______________________________________________________________________________
90 void AliMUONTriggerGeometryBuilder::CreateGeometry()
91 {
92 // From AliMUONv1::CreateGeometry()
93
94     /* 
95        zpos1 and zpos2 are the middle of the first and second
96        planes of station 1 (+1m for second station):
97        zpos1=(zpos1m+zpos1p)/2=(15999+16071)/2=16035 mm, thick/2=40 mm
98        zpos2=(zpos2m+zpos2p)/2=(16169+16241)/2=16205 mm, thick/2=40 mm
99        zposxm and zposxp= middles of gaz gaps within a detection plane
100        rem: the total thickness accounts for 1 mm of al on both
101        side of the RPCs (see zpos1 and zpos2)
102     */
103     
104     Int_t *idtmed = fMUON->GetIdtmed()->GetArray()-1099;
105     Int_t idAir= idtmed[1100]; // medium 1
106     Int_t idAlu1=idtmed[1103]; // medium 4
107     Int_t detElemId=0;          // Detection Element Number    
108     Float_t tpar[3];
109     Double_t dpar[3];    
110     
111 // vertical gap between right and left chambers (kDXZERO*2=4cm)
112     const Float_t kDXZERO=2.; 
113 // main distances for chamber definition in first plane/first station
114     const Float_t kXMIN=34.;       
115     const Float_t kXMED=51.;                                
116     const Float_t kXMAX=255.; 
117 // 090704 kXMAX changed from 272 to 255.
118 // (see fig.2-4 & 2-5 of Local Trigger Board PRR)
119 // segmentation updated accordingly
120     const Float_t kYMIN=34.;                              
121     const Float_t kYMAX=51.;                              
122 // inner/outer radius of flange between beam shield. and chambers (1/station)
123 //    const Float_t kRMIN[2]={50.,50.};
124 //    const Float_t kRMAX[2]={64.,68.};
125 // z position of the middle of the gas gap in mother vol 
126     const Float_t kZm=-3.6;
127     const Float_t kZp=+3.6;
128     
129     Float_t zpos1= AliMUONConstants::DefaultChamberZ(10); 
130     Double_t dstation =  ( ( - AliMUONConstants::DefaultChamberZ(11)) - 
131                            ( - AliMUONConstants::DefaultChamberZ(10)) ) /2.1;
132     Float_t par[3];
133     par[2] = dstation;
134
135 // ratio of zpos1m/zpos1p and inverse for first plane
136     Float_t zmp=(zpos1-3.6)/(zpos1+3.6);
137     Float_t zpm=1./zmp;
138     
139     Int_t icount=0;  // chamber counter (0 1 2 3)
140     
141     for (Int_t istation=0; istation<2; istation++) { // loop on stations
142         for (Int_t iplane=0; iplane<2; iplane++) { // loop on detection planes
143             
144             Int_t iVolNum=1; // counter Volume Number
145             icount = Int_t(iplane<<0)+Int_t(istation<<1);
146             
147             par[0] = AliMUONConstants::Rmin(5+istation); 
148             par[1] = AliMUONConstants::Rmax(5+istation);
149             Char_t volName[6];
150             sprintf(volName,"%s%d", "SC",11+icount);
151             gMC->Gsvolu(volName,"TUBE", idAir, par, 3);
152             //SetVolume(10+icount, volName);
153 //          Float_t zpos =  AliMUONConstants::DefaultChamberZ(10+icount);
154
155 /* removed 03/18/05
156 // Flange between beam shielding and RPC 
157             tpar[0]= kRMIN[istation];
158             tpar[1]= kRMAX[istation];
159             tpar[2]= 4.0;           
160             char volFlange[5];
161             sprintf(volFlange,"SF%dA",icount+1);         
162             gMC->Gsvolu(volFlange,"TUBE",idAlu1,tpar,3);     // Al
163             // changed by ivana
164             //gMC->Gspos(volFlange,1,"ALIC",0.,0.,zpos,0,"MANY");
165             iChamber->GetGeometry()->GetEnvelopeStore()
166               ->AddEnvelope(volFlange, 0, false, "MANY");
167 */
168             
169 // scaling factor
170 //          Float_t zRatio = zpos / zpos1;
171             Float_t zRatio = AliMUONConstants::DefaultRatioTriggerChamber(icount);                  
172
173
174
175     
176 // envelopes (same size except line 5, all virtual)
177             char volEnv[18][5];
178             tpar[1] = kYMIN * zRatio; 
179             tpar[2] = 0.4;
180             Int_t i=0;    // counter
181             for (Int_t icolumn=0; icolumn<2; icolumn++) {
182                 for (Int_t iline=1; iline<10; iline++){
183                     tpar[0] = (kXMAX/2.) * zRatio;
184                     if (iline==5) tpar[0] = ((kXMAX-kXMED)/2.)*zRatio;
185                     if (icolumn==0) 
186                         sprintf(volEnv[i],"S%dR%d",icount,iline);
187                     else
188                         sprintf(volEnv[i],"S%dL%d",icount,iline);
189                     // gMC->Gsvolu(volEnv[i],"BOX",idAir,tpar,0); 
190                     i++;
191                 }
192             }
193
194 // chamber prototype
195             tpar[0]= 0.;
196             tpar[1]= 0.;
197             tpar[2]= 0.;            char volAlu[5];     // Alu 
198             char volBak[5];     // Bakelite
199             char volGaz[5];     // Gas streamer     
200             sprintf(volAlu,"SC%dA",icount+1);
201             sprintf(volBak,"SB%dA",icount+1);
202             sprintf(volGaz,"S%dG",icount+11);
203             gMC->Gsvolu(volAlu,"BOX",idAlu1,tpar,0);         // Al
204             gMC->Gsvolu(volBak,"BOX",idtmed[1107],tpar,0);   // Bakelite
205             gMC->Gsvolu(volGaz,"BOX",idtmed[1106],tpar,0);   // Gas streamer
206             tpar[0] = -1.;
207             tpar[1] = -1.;
208             tpar[2] = 0.1;    
209             gMC->Gsposp(volGaz,1,volBak,0.,0.,0.,0,"ONLY",tpar,3);
210             tpar[2] = 0.3;
211             gMC->Gsposp(volBak,1,volAlu,0.,0.,0.,0,"ONLY",tpar,3);
212
213 // chamber type A
214             Float_t xEnv = (kDXZERO+kXMED+(kXMAX-kXMED)/2.)*zRatio;
215             Float_t yEnvM = 0.;  // y low position of envelope in chamber
216             Float_t yEnvP = 0.;  // y up position of envelope in chamber
217             Float_t yEnvPsave = 0.; // tmp data
218             Float_t yEnvMsave = 0.; // tmp data
219             Float_t xpos = 0.; // x position of RPC in envelope     
220             Float_t ypos = 0.; // y position of RPC in envelope
221             dpar[2] = 0.4;          
222             dpar[0] = ((kXMAX-kXMED)/2.)*zRatio;
223             dpar[1] = kYMIN * zRatio;
224
225             detElemId = (10+icount+1)*100;
226             GetEnvelopes(10+icount)->AddEnvelope(volEnv[4], detElemId, true, TGeoTranslation(xEnv,yEnvP,kZp));
227             detElemId = (10+icount+1)*100+9;
228             GetEnvelopes(10+icount)->AddEnvelope(volEnv[13], detElemId, true, TGeoTranslation(-xEnv,yEnvM,kZm),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
229
230             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[4],iVolNum++,3, dpar);
231             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[13],iVolNum++,3, dpar);      
232
233 // chamber type B (plus envelope chambers B & C)   
234             xEnv = (kDXZERO+kXMAX/2.)*zRatio;
235             yEnvPsave = yEnvP;
236             yEnvMsave = yEnvM;
237             yEnvP = (yEnvMsave + kYMIN * zRatio ) * zpm + kYMIN * zRatio;
238             yEnvM = (yEnvPsave + kYMIN * zRatio ) * zmp + kYMIN * zRatio;
239             dpar[0] = ((kXMAX-kXMIN)/2.) * zRatio;
240             dpar[1] = ((kYMAX-kYMIN)/2.) * zRatio;
241             xpos = kXMIN/2. * zRatio;
242             ypos = (kYMIN - kYMIN/4.) * zRatio;
243
244             detElemId = (10+icount+1)*100+17;
245             GetEnvelopes(10+icount)->AddEnvelope(volEnv[3], detElemId, true, TGeoTranslation( xEnv,-yEnvM,kZm));            
246             detElemId = (10+icount+1)*100+1;
247             GetEnvelopes(10+icount)->AddEnvelope(volEnv[5], detElemId, true, TGeoTranslation( xEnv, yEnvM,kZm));
248             detElemId = (10+icount+1)*100+10;
249             GetEnvelopes(10+icount)->AddEnvelope(volEnv[12], detElemId, true, TGeoTranslation(-xEnv,-yEnvP,kZp),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
250             detElemId = (10+icount+1)*100+8;
251             GetEnvelopes(10+icount)->AddEnvelope(volEnv[14], detElemId, true, TGeoTranslation(-xEnv, yEnvP,kZp),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
252
253             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[3],iVolNum++,TGeoTranslation(xpos, ypos,0.),3,dpar);
254             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[5],iVolNum++,TGeoTranslation(xpos,-ypos,0.),3,dpar);
255             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[12],iVolNum++,TGeoTranslation(xpos, ypos,0.),3,dpar);
256             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[14],iVolNum++,TGeoTranslation(xpos,-ypos,0.),3,dpar);
257
258 // chamber type C (note: same Z than type B)
259             dpar[0] = (kXMAX/2)*zRatio;
260             dpar[1] = (kYMAX/2)*zRatio;
261             xpos = 0.;      
262             ypos = ((kYMAX - kYMIN)/2.) * zRatio;
263
264             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[3],iVolNum++,TGeoTranslation(xpos,-ypos,0.),3,dpar);
265             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[5],iVolNum++,TGeoTranslation(xpos, ypos,0.),3,dpar);
266             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[12],iVolNum++,TGeoTranslation(xpos,-ypos,0.),3,dpar);
267             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[14],iVolNum++,TGeoTranslation(xpos, ypos,0.),3,dpar);
268
269 // chamber type D, E and F (same size)
270 // D        
271             yEnvPsave = yEnvP;
272             yEnvMsave = yEnvM;
273             yEnvP = (yEnvMsave + kYMIN * zRatio ) * zpm + kYMIN * zRatio;
274             yEnvM = (yEnvPsave + kYMIN * zRatio ) * zmp + kYMIN * zRatio;
275             dpar[0] = (kXMAX/2.)*zRatio;
276             dpar[1] =  kYMIN*zRatio;
277
278             detElemId = (10+icount+1)*100+16;
279             GetEnvelopes(10+icount)->AddEnvelope(volEnv[2], detElemId, true, TGeoTranslation(xEnv,-yEnvP,kZp));
280             detElemId = (10+icount+1)*100+2;
281             GetEnvelopes(10+icount)->AddEnvelope(volEnv[6], detElemId, true, TGeoTranslation(xEnv, yEnvP,kZp));
282             detElemId = (10+icount+1)*100+11;
283             GetEnvelopes(10+icount)->AddEnvelope(volEnv[11], detElemId, true, TGeoTranslation(-xEnv,-yEnvM,kZm),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
284             detElemId = (10+icount+1)*100+7;
285             GetEnvelopes(10+icount)->AddEnvelope(volEnv[15], detElemId, true, TGeoTranslation(-xEnv, yEnvM,kZm),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
286
287             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[2],iVolNum++,3, dpar);
288             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[6],iVolNum++,3, dpar);
289             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[11],iVolNum++,3, dpar);
290             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[15],iVolNum++,3, dpar);
291
292 // E
293             yEnvPsave = yEnvP;
294             yEnvMsave = yEnvM;
295             yEnvP = (yEnvMsave + kYMIN * zRatio ) * zpm + kYMIN * zRatio;
296             yEnvM = (yEnvPsave + kYMIN * zRatio ) * zmp + kYMIN * zRatio;
297
298             detElemId = (10+icount+1)*100+15;
299             GetEnvelopes(10+icount)->AddEnvelope(volEnv[1], detElemId, true, TGeoTranslation(xEnv,-yEnvM,kZm));
300             detElemId = (10+icount+1)*100+3;
301             GetEnvelopes(10+icount)->AddEnvelope(volEnv[7], detElemId, true, TGeoTranslation(xEnv, yEnvM,kZm));
302             detElemId = (10+icount+1)*100+12;
303             GetEnvelopes(10+icount)->AddEnvelope(volEnv[10], detElemId, true, TGeoTranslation(-xEnv,-yEnvP,kZp),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
304             detElemId = (10+icount+1)*100+6;
305             GetEnvelopes(10+icount)->AddEnvelope(volEnv[16], detElemId, true, TGeoTranslation(-xEnv, yEnvP,kZp),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
306
307             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[1],iVolNum++,3,dpar);
308             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[7],iVolNum++,3,dpar);
309             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[10],iVolNum++,3,dpar);
310             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[16],iVolNum++,3,dpar);
311
312
313 // F
314             yEnvPsave = yEnvP;
315             yEnvMsave = yEnvM;
316             yEnvP = (yEnvMsave + kYMIN * zRatio ) * zpm + kYMIN * zRatio;
317             yEnvM = (yEnvPsave + kYMIN * zRatio ) * zmp + kYMIN * zRatio;
318
319             detElemId = (10+icount+1)*100+14;
320             GetEnvelopes(10+icount)->AddEnvelope(volEnv[0], detElemId, true, TGeoTranslation(xEnv,-yEnvP,kZp));
321             detElemId = (10+icount+1)*100+4;
322             GetEnvelopes(10+icount)->AddEnvelope(volEnv[8], detElemId, true, TGeoTranslation(xEnv, yEnvP,kZp));
323             detElemId = (10+icount+1)*100+13;
324             GetEnvelopes(10+icount)->AddEnvelope(volEnv[9], detElemId, true, TGeoTranslation(-xEnv,-yEnvM,kZm),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
325             detElemId = (10+icount+1)*100+5;
326             GetEnvelopes(10+icount)->AddEnvelope(volEnv[17], detElemId, true, TGeoTranslation(-xEnv, yEnvM,kZm),TGeoRotation("rot1",90.,180.,90.,90.,180.,0.));
327             
328             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[0],iVolNum++,3,dpar);
329             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[8],iVolNum++,3,dpar);
330             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[9],iVolNum++,3,dpar);
331             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[17],iVolNum++,3,dpar);
332
333         } // end loop on detection planes
334     } // end loop on stations    
335 }
336
337 //______________________________________________________________________________
338 void AliMUONTriggerGeometryBuilder::SetTransformations() 
339 {
340 // Defines the transformations for the trigger chambers.
341 // ---
342
343     if (gAlice->GetModule("SHIL")) {
344       SetMotherVolume(10, "YOUT2");
345       SetMotherVolume(11, "YOUT2");
346       SetMotherVolume(12, "YOUT2");
347       SetMotherVolume(13, "YOUT2");
348     }  
349
350     SetVolume(10, "SC11");
351     SetVolume(11, "SC12");
352     SetVolume(12, "SC13");
353     SetVolume(13, "SC14");
354
355     Double_t zpos1= AliMUONConstants::DefaultChamberZ(10); 
356     SetTranslation(10, TGeoTranslation(0., 0., zpos1));
357     
358     zpos1= AliMUONConstants::DefaultChamberZ(11); 
359     SetTranslation(11, TGeoTranslation(0., 0., zpos1));
360
361     zpos1= AliMUONConstants::DefaultChamberZ(12); 
362     SetTranslation(12, TGeoTranslation(0., 0., zpos1));
363
364     zpos1= AliMUONConstants::DefaultChamberZ(13); 
365     SetTranslation(13, TGeoTranslation(0., 0., zpos1));
366 }
367
368 //______________________________________________________________________________
369 void AliMUONTriggerGeometryBuilder::SetSensitiveVolumes()
370 {
371 // Defines the sensitive volumes for trigger station chambers.
372 // ---
373
374   GetGeometry(10)->SetSensitiveVolume("S11G");
375   GetGeometry(11)->SetSensitiveVolume("S12G");
376   GetGeometry(12)->SetSensitiveVolume("S13G");
377   GetGeometry(13)->SetSensitiveVolume("S14G");
378 }
379