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