]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTriggerGeometryBuilder.cxx
Logging of Debug, Info and Error Messages follwing AliRoot Standard http://aliweb...
[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 // Class AliMUONTriggerGeometryBuilder
19 // -----------------------------------
20 // MUON Trigger stations geometry construction class.
21 //
22 // Author: Philippe Crochette, LPC Clermont-Ferrand
23
24 #include <TVirtualMC.h>
25 #include <TGeoMatrix.h>
26
27 #include "AliMUONTriggerGeometryBuilder.h"
28 #include "AliMUON.h"
29 #include "AliMUONChamber.h"
30 #include "AliMUONChamberGeometry.h"
31 #include "AliMUONGeometryEnvelopeStore.h"
32 #include "AliLog.h"
33
34 ClassImp(AliMUONTriggerGeometryBuilder)
35
36 //______________________________________________________________________________
37 AliMUONTriggerGeometryBuilder::AliMUONTriggerGeometryBuilder(AliMUON* muon)
38  : AliMUONVGeometryBuilder("trigger.dat",
39                            &muon->Chamber(10), &muon->Chamber(11),
40                            &muon->Chamber(12),&muon->Chamber(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     AliMUONChamber *iChamber, *iChamber1;
129     iChamber1 = GetChamber(10);
130     Float_t zpos1=-iChamber1->Z(); 
131     
132 // ratio of zpos1m/zpos1p and inverse for first plane
133     Float_t zmp=(zpos1-3.6)/(zpos1+3.6);
134     Float_t zpm=1./zmp;
135     
136     Int_t icount=0;  // chamber counter (0 1 2 3)
137     
138     for (Int_t istation=0; istation<2; istation++) { // loop on stations
139         for (Int_t iplane=0; iplane<2; iplane++) { // loop on detection planes
140             
141             Int_t iVolNum=1; // counter Volume Number
142             icount = Int_t(iplane*TMath::Power(2,0))+
143                 Int_t(istation*TMath::Power(2,1));
144             
145             iChamber = GetChamber(10+icount);
146             Float_t zpos = - iChamber->Z();          
147             
148 // Flange between beam shielding and RPC 
149             tpar[0]= kRMIN[istation];
150             tpar[1]= kRMAX[istation];
151             tpar[2]= 4.0;           
152             char volFlange[5];
153             sprintf(volFlange,"SF%dA",icount+1);         
154             gMC->Gsvolu(volFlange,"TUBE",idAlu1,tpar,3);     // Al
155             // changed by ivana
156             //gMC->Gspos(volFlange,1,"ALIC",0.,0.,zpos,0,"MANY");
157             iChamber->GetGeometry()->GetEnvelopeStore()
158               ->AddEnvelope(volFlange, 0, false, "MANY");
159             
160 // scaling factor
161             Float_t zRatio = zpos / zpos1;
162             
163 // envelopes (same size except line 5, all virtual)
164             char volEnv[18][5];
165             tpar[1] = kYMIN * zRatio; 
166             tpar[2] = 0.4;
167             Int_t i=0;    // counter
168             for (Int_t icolumn=0; icolumn<2; icolumn++) {
169                 for (Int_t iline=1; iline<10; iline++){
170                     tpar[0] = (kXMAX/2.) * zRatio;
171                     if (iline==5) tpar[0] = ((kXMAX-kXMED)/2.)*zRatio;
172                     if (icolumn==0) 
173                         sprintf(volEnv[i],"S%dR%d",icount,iline);
174                     else
175                         sprintf(volEnv[i],"S%dL%d",icount,iline);
176                     gMC->Gsvolu(volEnv[i],"BOX",idAir,tpar,0); 
177                     i++;
178                 }
179             }
180
181 // chamber prototype
182             tpar[0]= 0.;
183             tpar[1]= 0.;
184             tpar[2]= 0.;            
185             char volAlu[5];     // Alu 
186             char volBak[5];     // Bakelite
187             char volGaz[5];     // Gas streamer     
188             sprintf(volAlu,"SC%dA",icount+1);
189             sprintf(volBak,"SB%dA",icount+1);
190             sprintf(volGaz,"SG%dA",icount+1);
191             gMC->Gsvolu(volAlu,"BOX",idAlu1,tpar,0);         // Al
192             gMC->Gsvolu(volBak,"BOX",idtmed[1107],tpar,0);   // Bakelite
193             gMC->Gsvolu(volGaz,"BOX",idtmed[1106],tpar,0);   // Gas streamer
194             tpar[0] = -1.;
195             tpar[1] = -1.;
196             tpar[2] = 0.1;    
197             gMC->Gsposp(volGaz,1,volBak,0.,0.,0.,0,"ONLY",tpar,3);
198             tpar[2] = 0.3;
199             gMC->Gsposp(volBak,1,volAlu,0.,0.,0.,0,"ONLY",tpar,3);
200
201 // chamber type A
202             Float_t xEnv = (kDXZERO+kXMED+(kXMAX-kXMED)/2.)*zRatio;
203             Float_t yEnvM = 0.;  // y low position of envelope in chamber
204             Float_t yEnvP = 0.;  // y up position of envelope in chamber
205             Float_t yEnvPsave = 0.; // tmp data
206             Float_t yEnvMsave = 0.; // tmp data
207             Float_t xpos = 0.; // x position of RPC in envelope     
208             Float_t ypos = 0.; // y position of RPC in envelope
209             dpar[2] = 0.4;          
210             dpar[0] = ((kXMAX-kXMED)/2.)*zRatio;
211             dpar[1] = kYMIN * zRatio;
212
213             detElemId = (10+icount+1)*100+4;
214             GetEnvelopes(10+icount)->AddEnvelope(volEnv[4], detElemId, true, TGeoTranslation(xEnv,yEnvM,kZm));
215             detElemId = (10+icount+1)*100+50+4;
216             GetEnvelopes(10+icount)->AddEnvelope(volEnv[13], detElemId, true, TGeoTranslation(-xEnv,yEnvP,kZp));
217
218             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[4],iVolNum++,3, dpar);
219             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[13],iVolNum++,3, dpar);      
220
221 // chamber type B (plus envelope chambers B & C)   
222             xEnv = (kDXZERO+kXMAX/2.)*zRatio;
223             yEnvPsave = yEnvP;
224             yEnvMsave = yEnvM;
225             yEnvP = (yEnvMsave + kYMIN * zRatio ) * zpm + kYMIN * zRatio;
226             yEnvM = (yEnvPsave + kYMIN * zRatio ) * zmp + kYMIN * zRatio;
227             dpar[0] = ((kXMAX-kXMIN)/2.) * zRatio;
228             dpar[1] = ((kYMAX-kYMIN)/2.) * zRatio;
229             xpos = kXMIN/2. * zRatio;
230             ypos = (kYMIN - kYMIN/4.) * zRatio;
231
232             detElemId = (10+icount+1)*100+3;
233             GetEnvelopes(10+icount)->AddEnvelope(volEnv[3], detElemId, true, TGeoTranslation( xEnv,-yEnvP,kZp));
234             detElemId = (10+icount+1)*100+5;
235             GetEnvelopes(10+icount)->AddEnvelope(volEnv[5], detElemId, true, TGeoTranslation( xEnv, yEnvP,kZp));
236             detElemId = (10+icount+1)*100+50+3;
237             GetEnvelopes(10+icount)->AddEnvelope(volEnv[12], detElemId, true, TGeoTranslation(-xEnv,-yEnvM,kZm));
238             detElemId = (10+icount+1)*100+50+5;
239             GetEnvelopes(10+icount)->AddEnvelope(volEnv[14], detElemId, true, TGeoTranslation(-xEnv, yEnvM,kZm));
240
241             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[3],iVolNum++,TGeoTranslation(xpos, ypos,0.),3,dpar);
242             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[5],iVolNum++,TGeoTranslation(xpos,-ypos,0.),3,dpar);
243             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[12],iVolNum++,TGeoTranslation(-xpos, ypos,0.),3,dpar);
244             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[14],iVolNum++,TGeoTranslation(-xpos,-ypos,0.),3,dpar);
245
246 // chamber type C (note: same Z than type B)
247             dpar[0] = (kXMAX/2)*zRatio;
248             dpar[1] = (kYMAX/2)*zRatio;
249             xpos = 0.;      
250             ypos = ((kYMAX - kYMIN)/2.) * zRatio;
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 D, E and F (same size)
258 // D        
259             yEnvPsave = yEnvP;
260             yEnvMsave = yEnvM;
261             yEnvP = (yEnvMsave + kYMIN * zRatio ) * zpm + kYMIN * zRatio;
262             yEnvM = (yEnvPsave + kYMIN * zRatio ) * zmp + kYMIN * zRatio;
263             dpar[0] = (kXMAX/2.)*zRatio;
264             dpar[1] =  kYMIN*zRatio;
265
266             detElemId = (10+icount+1)*100+2;
267             GetEnvelopes(10+icount)->AddEnvelope(volEnv[2], detElemId, true, TGeoTranslation(xEnv,-yEnvM,kZm));
268             detElemId = (10+icount+1)*100+6;
269             GetEnvelopes(10+icount)->AddEnvelope(volEnv[6], detElemId, true, TGeoTranslation(xEnv, yEnvM,kZm));
270             detElemId = (10+icount+1)*100+50+2;
271             GetEnvelopes(10+icount)->AddEnvelope(volEnv[11], detElemId, true, TGeoTranslation(-xEnv,-yEnvP,kZp));
272             detElemId = (10+icount+1)*100+50+6;
273             GetEnvelopes(10+icount)->AddEnvelope(volEnv[15], detElemId, true, TGeoTranslation(-xEnv, yEnvP,kZp));
274
275             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[2],iVolNum++,3, dpar);
276             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[6],iVolNum++,3, dpar);
277             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[11],iVolNum++,3, dpar);
278             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[15],iVolNum++,3, dpar);
279
280 // E
281             yEnvPsave = yEnvP;
282             yEnvMsave = yEnvM;
283             yEnvP = (yEnvMsave + kYMIN * zRatio ) * zpm + kYMIN * zRatio;
284             yEnvM = (yEnvPsave + kYMIN * zRatio ) * zmp + kYMIN * zRatio;
285
286             detElemId = (10+icount+1)*100+1;
287             GetEnvelopes(10+icount)->AddEnvelope(volEnv[1], detElemId, true, TGeoTranslation(xEnv,-yEnvP,kZp));
288             detElemId = (10+icount+1)*100+7;
289             GetEnvelopes(10+icount)->AddEnvelope(volEnv[7], detElemId, true, TGeoTranslation(xEnv, yEnvP,kZp));
290             detElemId = (10+icount+1)*100+50+1;
291             GetEnvelopes(10+icount)->AddEnvelope(volEnv[10], detElemId, true, TGeoTranslation(-xEnv,-yEnvM,kZm));
292             detElemId = (10+icount+1)*100+50+7;
293             GetEnvelopes(10+icount)->AddEnvelope(volEnv[16], detElemId, true, TGeoTranslation(-xEnv, yEnvM,kZm));
294
295             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[1],iVolNum++,3,dpar);
296             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[7],iVolNum++,3,dpar);
297             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[10],iVolNum++,3,dpar);
298             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[16],iVolNum++,3,dpar);
299
300
301 // F
302             yEnvPsave = yEnvP;
303             yEnvMsave = yEnvM;
304             yEnvP = (yEnvMsave + kYMIN * zRatio ) * zpm + kYMIN * zRatio;
305             yEnvM = (yEnvPsave + kYMIN * zRatio ) * zmp + kYMIN * zRatio;
306
307             detElemId = (10+icount+1)*100;
308             GetEnvelopes(10+icount)->AddEnvelope(volEnv[0], detElemId, true, TGeoTranslation(xEnv,-yEnvM,kZm));
309             detElemId = (10+icount+1)*100+8;
310             GetEnvelopes(10+icount)->AddEnvelope(volEnv[8], detElemId, true, TGeoTranslation(xEnv, yEnvM,kZm));
311             detElemId = (10+icount+1)*100+50;
312             GetEnvelopes(10+icount)->AddEnvelope(volEnv[9], detElemId, true, TGeoTranslation(-xEnv,-yEnvP,kZp));
313             detElemId = (10+icount+1)*100+50+8;
314             GetEnvelopes(10+icount)->AddEnvelope(volEnv[17], detElemId, true, TGeoTranslation(-xEnv, yEnvP,kZp));
315             
316             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[0],iVolNum++,3,dpar);
317             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[8],iVolNum++,3,dpar);
318             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[9],iVolNum++,3,dpar);
319             GetEnvelopes(10+icount)->AddEnvelopeConstituentParam(volAlu,volEnv[17],iVolNum++,3,dpar);
320
321         } // end loop on detection planes
322     } // end loop on stations    
323 }
324
325 //______________________________________________________________________________
326 void AliMUONTriggerGeometryBuilder::SetTransformations() 
327 {
328 // Defines the transformations for the trigger chambers.
329 // ---
330     Double_t zpos1, zpos2;    
331     AliMUONChamber *iChamber1, *iChamber2;
332
333     iChamber1 = GetChamber(10);
334     zpos1= - iChamber1->Z(); 
335     iChamber1->GetGeometry()
336         ->SetTranslation(TGeoTranslation(0., 0., zpos1));
337     
338     iChamber2 = GetChamber(11);
339     zpos2 = - iChamber2->Z(); 
340     iChamber2->GetGeometry()
341         ->SetTranslation(TGeoTranslation(0., 0., zpos2));
342
343     iChamber1 = GetChamber(12);
344     zpos1 = - iChamber1->Z(); 
345     iChamber1->GetGeometry()
346         ->SetTranslation(TGeoTranslation(0., 0., zpos1));
347     
348     iChamber2 = GetChamber(13);
349     zpos2 = - iChamber2->Z(); 
350     iChamber2->GetGeometry()
351         ->SetTranslation(TGeoTranslation(0., 0., zpos2));
352 }
353
354 //______________________________________________________________________________
355 void AliMUONTriggerGeometryBuilder::SetSensitiveVolumes()
356 {
357 // Defines the sensitive volumes for trigger station chambers.
358 // ---
359
360   GetChamber(10)->GetGeometry()->SetSensitiveVolume("SG1A");
361   GetChamber(11)->GetGeometry()->SetSensitiveVolume("SG2A");
362   GetChamber(12)->GetGeometry()->SetSensitiveVolume("SG3A");
363   GetChamber(13)->GetGeometry()->SetSensitiveVolume("SG4A");
364 }
365