]> git.uio.no Git - u/mrichter/AliRoot.git/blob - CRT/AliCRTv0.cxx
MC-dependent part of AliRun extracted in AliMC (F.Carminati)
[u/mrichter/AliRoot.git] / CRT / AliCRTv0.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 //                                                                           //
20 // ALICE Cosmic Ray Trigger                                                  //
21 //                                                                           //
22 //  This class contains the functions for version 0 of the ALICE Cosmic Ray  //
23 //  Trigger. This version will be used to simulation comic rays in alice     //
24 //  with all the detectors.                                                  //
25 //
26 //   Authors:
27 //
28 //   Arturo Fernandez <afernand@fcfm.buap.mx>
29 //   Enrique Gamez    <egamez@fcfm.buap.mx>
30 //
31 //   Universidad Autonoma de Puebla
32 //
33 //
34 //Begin_Html
35 /*
36 <img src="picts/AliCRTv0Class.gif">
37 </pre>
38 <br clear=left>
39 <p>The responsible person for this module is
40 <a href="mailto:egamez@fcfm.buap.mx">Enrique Gamez</a>.
41 </font>
42 <pre>
43 */
44 //End_Html
45 //                                                                           //
46 ///////////////////////////////////////////////////////////////////////////////
47
48 #include <TGeometry.h>
49 #include <TBRIK.h>
50 #include <TNode.h>
51 #include <TVirtualMC.h>
52
53 #include "AliRun.h"
54 #include "AliConst.h"
55
56 #include "AliCRTv0.h"
57 #include "AliCRTConstants.h"
58
59 ClassImp(AliCRTv0)
60  
61 //_____________________________________________________________________________
62 AliCRTv0::AliCRTv0()
63   : AliCRT()
64 {
65   //
66   // Default constructor
67   //
68 }
69  
70 //_____________________________________________________________________________
71 AliCRTv0::AliCRTv0(const char *name, const char *title)
72   : AliCRT(name, title)
73 {
74   //
75   // Standard constructor
76   //
77   //Begin_Html
78   /*
79     <img src="picts/AliCRTv0.gif">
80   */
81   //End_Html
82   SetMarkerColor(kRed);
83   SetMarkerStyle(kRed);
84   SetMarkerSize(0.4);
85 }
86
87 //_____________________________________________________________________________
88 AliCRTv0::AliCRTv0(const AliCRTv0& crt)
89   : AliCRT(crt)
90 {
91   //
92   // Copy constructor
93   //
94   crt.Copy(*this);
95 }
96
97 //_____________________________________________________________________________
98 AliCRTv0::~AliCRTv0()
99 {
100   //
101   // Default destructor
102   //
103 }
104
105 //_____________________________________________________________________________
106 AliCRTv0& AliCRTv0::operator=(const AliCRTv0& crt)
107 {
108   //
109   // Asingment operator.
110   //
111   crt.Copy(*this);
112   return *this;
113 }
114
115 //_____________________________________________________________________________
116 void AliCRTv0::BuildGeometry()
117 {
118   //
119   // Create the ROOT TNode geometry for the CRT
120   //
121
122   TNode *node, *top;
123
124   const Int_t kColorCRT = kRed;
125
126   // Find the top node alice.
127   top = gAlice->GetGeometry()->GetNode("alice");
128
129   new TBRIK("S_CRT_A", "CRT box", "void", 
130             AliCRTConstants::fgActiveAreaLenght/2., 
131             AliCRTConstants::fgActiveAreaHeight/2., 
132             AliCRTConstants::fgActiveAreaWidth/2.);
133
134   
135   new TRotMatrix("Left", "Left", 90., 315., 90., 45., 0., 337.5);
136   new TRotMatrix("Right", "Right", 90., 45., 90., 315., 180., 202.5);
137   new TRotMatrix("Up", "Up", 90., 0., 90., 90., 0., 90.);
138   top->cd();
139
140   //
141   // Put 4 modules on the top of the magnet
142   Float_t box = AliCRTConstants::fgCageWidth/2.;
143   top->cd();
144   node = new TNode("upper1", "upper1", "S_CRT_A", 0., 790.,  3.*box, "Up");
145   node->SetLineColor(kColorCRT);
146   fNodes->Add(node);
147
148   top->cd();
149   node = new TNode("upper2", "upper2", "S_CRT_A", 0., 790.,    box, "Up");
150   node->SetLineColor(kColorCRT);
151   fNodes->Add(node);
152
153   top->cd();
154   node = new TNode("upper3", "upper3", "S_CRT_A", 0., 790., -1.*box, "Up");
155   node->SetLineColor(kColorCRT);
156   fNodes->Add(node);
157
158   top->cd();
159   node = new TNode("upper4", "upper4", "S_CRT_A", 0., 790., -3.*box, "Up");
160   node->SetLineColor(kColorCRT);
161   fNodes->Add(node);
162
163
164   // Modules on the left side.
165   Float_t xtragap = 10.;
166   Float_t initXside = (790.+xtragap)*TMath::Sin(2*22.5*kDegrad); //rigth side
167   Float_t initYside = (790.+xtragap)*TMath::Cos(2*22.5*kDegrad);
168   top->cd();
169   node = new TNode("upper5", "upper5", "S_CRT_A", initXside, initYside,  3.*box, "Left");
170   node->SetLineColor(kColorCRT);
171   fNodes->Add(node);
172
173   top->cd();
174   node = new TNode("upper6", "upper6", "S_CRT_A", initXside, initYside,    box, "Left");
175   node->SetLineColor(kColorCRT);
176   fNodes->Add(node);
177
178   top->cd();
179   node = new TNode("upper7", "upper7", "S_CRT_A", initXside, initYside, -1.*box, "Left");
180   node->SetLineColor(kColorCRT);
181   fNodes->Add(node);
182
183   top->cd();
184   node = new TNode("upper8", "upper8", "S_CRT_A", initXside, initYside, -3.*box, "Left");
185   node->SetLineColor(kColorCRT);
186   fNodes->Add(node);
187
188
189   // Modules on the right side.
190   top->cd();
191   node = new TNode("upper9", "upper9", "S_CRT_A", -initXside, initYside,  3.*box, "Right");
192   node->SetLineColor(kColorCRT);
193   fNodes->Add(node);
194
195   top->cd();
196   node = new TNode("upper10", "upper10", "S_CRT_A", -initXside, initYside,    box, "Right");
197   node->SetLineColor(kColorCRT);
198   fNodes->Add(node);
199
200   top->cd();
201   node = new TNode("upper11","upper11", "S_CRT_A", -initXside, initYside, -1.*box, "Right");
202   node->SetLineColor(kColorCRT);
203   fNodes->Add(node);
204
205   top->cd();
206   node = new TNode("upper12","upper12", "S_CRT_A", -initXside, initYside, -3.*box, "Right");
207   node->SetLineColor(kColorCRT);
208   fNodes->Add(node);
209
210 }
211
212 //_____________________________________________________________________________
213 void AliCRTv0::CreateGeometry()
214 {
215   //
216   // Create geometry for the CRT array
217   //
218
219   Int_t  idrotm[2499];    // The rotation matrix.
220   Int_t* idtmed = fIdtmed->GetArray() - 1099 ;
221
222   // Create a mother volume.
223   Float_t pbox[3];
224   //pbox[0] = AliCRTConstants::fgDepth*TMath::Tan(67.5*kDegrad);
225   pbox[0] = 12073.;
226   pbox[1] = AliCRTConstants::fgDepth;
227   pbox[2] = pbox[0];
228   gMC->Gsvolu("CRT", "BOX", idtmed[1114], pbox, 3);
229   gMC->Gspos("CRT", 1, "ALIC", 0, 0, 0, 0, "ONLY");
230
231   // Create a big volume with air barrel above the magnet
232   Float_t barrel[10];
233   Float_t magnetSides = 3.;
234   Float_t planesPerpendicularToZ = 2.;
235   barrel[0] = 22.5;
236   barrel[1] = 45*magnetSides;
237   barrel[2] = magnetSides;
238   barrel[3] = planesPerpendicularToZ;
239   barrel[4] = -700.;
240   barrel[5] = AliCRTConstants::fgMagMinRadius;
241   barrel[6] = AliCRTConstants::fgMagMinRadius + 2.; // 2 cm width
242   barrel[7] = -barrel[4];
243   barrel[8] = barrel[5];
244   barrel[9] = barrel[6];
245   gMC->Gsvolu("CRT4", "PGON", idtmed[1112], barrel, 10);
246   gMC->Gspos("CRT4", 1 , "CRT", 0., -30., 0., 0, "MANY");
247
248   //
249   Float_t box[3];
250   box[0] = AliCRTConstants::fgSinglePaletteLenght/4;
251   box[1] = AliCRTConstants::fgSinglePaletteHeight/2;
252   box[2] = AliCRTConstants::fgSinglePaletteWidth/2;
253   gMC->Gsvolu("CRT6", "BOX", idtmed[1112], box, 3);
254
255   // In the right side side of the magnet
256   AliMatrix(idrotm[231], 90., 45., 90., 315., 180., 202.5);
257
258   // In the left side side of the magnet
259   AliMatrix(idrotm[232], 90., 315., 90., 315., 0.0000040, 263.0707092);
260
261   // Now put them into the volume created above
262   // First above the magnet.
263   const Float_t away = (2.*barrel[5]*TMath::Sin(kDegrad*22.5))/4.;
264   const Int_t nModules = 10;
265   for (Int_t i = 0; i < nModules; i++) {
266     Float_t zCoordinate = i*100 - 450;
267     // In the lef side
268     gMC->Gspos("CRT6", i, "CRT4", -away, barrel[5]+1., zCoordinate, 0, "MANY");
269     // In the rigth side
270     gMC->Gspos("CRT6",i+10,"CRT4", away, barrel[5]+1., zCoordinate, 0, "MANY");
271
272     // The most away part (left side)
273     gMC->Gspos("CRT6", i+20, "CRT4", 3*away, barrel[5]+31 - away, zCoordinate, idrotm[232], "MANY");
274     // The inner part (left side)
275     gMC->Gspos("CRT6", i+30, "CRT4", 4*away, barrel[5]+31 - 2*away, zCoordinate, idrotm[232], "MANY");
276
277     // The most away part (rigth side)
278     gMC->Gspos("CRT6", i+40, "CRT4", -3*away, barrel[5]+31 - away, zCoordinate, idrotm[231], "MANY");
279     // The inner part (rigth side)
280     gMC->Gspos("CRT6", i+50, "CRT4", -4*away, barrel[5]+31 - 2*away, zCoordinate, idrotm[231], "MANY");
281   }
282
283   // Now the magnet doors
284   magnetSides = 8.;
285   barrel[1] = 45*magnetSides;
286   barrel[2] = magnetSides;
287   barrel[4] = 700.;
288   barrel[5] = 0;
289   barrel[6] = 790;
290   barrel[7] = barrel[4] + 2.;
291   barrel[8] = barrel[5];
292   barrel[9] = barrel[6];
293   gMC->Gsvolu("CRT5", "PGON", idtmed[1111], barrel, 10);
294   gMC->Gspos("CRT5", 1, "CRT", 0., -30., 0., 0, "ONLY");
295
296   AliMatrix(idrotm[300], 90., 0., 90., 90., 180., 0.);
297   gMC->Gspos("CRT5", 2, "CRT", 0., -30., 0., idrotm[300], "ONLY");
298
299 }
300
301 //_____________________________________________________________________________
302 void AliCRTv0::DrawDetector()
303 {
304   //
305   // Draw a shaded view of the L3 magnet
306   //
307
308   Info("DrawDetector", "Drawing the module");
309
310   gMC->Gsatt("*", "seen", -1);
311   gMC->Gsatt("alic", "seen", 0);
312
313   gMC->Gsatt("ALIC","seen",0);
314   gMC->Gsatt("L3MO","seen",1); // L3 Magnet
315   gMC->Gsatt("CRT1","seen",1); // Scintillators
316
317   // Draw the molasse volumes
318   gMC->Gsatt("CMO1","seen",0); // Exactly above the HALL
319   gMC->Gsatt("CMO2","seen",0); // Molasse, along the PM25
320   gMC->Gsatt("CMO3","seen",0); // molasse along the PGC2
321   gMC->Gsatt("CMO4","seen",0); // Molasse, behind the PX24 upper part
322   gMC->Gsatt("CMO5","seen",0); // molasse behind px24, lower part
323   gMC->Gsatt("CMO6","seen",0); // behind the PX24
324   gMC->Gsatt("CMO7","seen",0); // behind the PGC2
325   gMC->Gsatt("CMO8","seen",0); // on the right side.
326   gMC->Gsatt("CMO9","seen",0); // on the left side.
327   gMC->Gsatt("CM10","seen",0); // betwen PX24 & PM25.
328   gMC->Gsatt("CM11","seen",0); // betwen PGC2 & PM25.
329   gMC->Gsatt("CM12","seen",0); // box above the hall.
330
331   gMC->Gdopt("hide", "on");
332   gMC->Gdopt("edge","off");
333   gMC->Gdopt("shad", "on");
334   gMC->Gsatt("*", "fill", 7);
335   gMC->SetClipBox("ALIC", 0, 3000, -3000, 3000, -6000, 6000);
336   gMC->DefaultRange();
337   gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .009, .009);
338   gMC->Gdhead(1111, "View of CRT(ACORDE)");
339   gMC->Gdman(18, 4, "MAN");
340 }