]> git.uio.no Git - u/mrichter/AliRoot.git/blob - CRT/AliCRTv0.cxx
Corrected index
[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 "AliCRTv0.h"
49
50 #include <TGeometry.h>
51 #include <TBRIK.h>
52 #include <TNode.h>
53 #include <TVirtualMC.h>
54
55 #include "AliRun.h"
56 #include "AliConst.h"
57
58 #include "AliCRTConstants.h"
59 #include "AliCRTModule.h"
60
61 ClassImp(AliCRTv0)
62  
63 //_____________________________________________________________________________
64 AliCRTv0::AliCRTv0()
65   : AliCRT()
66 {
67   //
68   // Default constructor
69   //
70 }
71  
72 //_____________________________________________________________________________
73 AliCRTv0::AliCRTv0(const char *name, const char *title)
74   : AliCRT(name, title)
75 {
76   //
77   // Standard constructor
78   //
79   //Begin_Html
80   /*
81     <img src="picts/AliCRTv0.gif">
82   */
83   //End_Html
84   SetMarkerColor(kRed);
85   SetMarkerStyle(kRed);
86   SetMarkerSize(0.4);
87 }
88
89 //_____________________________________________________________________________
90 AliCRTv0::AliCRTv0(const AliCRTv0& crt)
91   : AliCRT(crt)
92 {
93   //
94   // Copy constructor
95   //
96   crt.Copy(*this);
97 }
98
99 //_____________________________________________________________________________
100 AliCRTv0::~AliCRTv0()
101 {
102   //
103   // Default destructor
104   //
105 }
106
107 //_____________________________________________________________________________
108 AliCRTv0& AliCRTv0::operator=(const AliCRTv0& crt)
109 {
110   //
111   // Asingment operator.
112   //
113   crt.Copy(*this);
114   return *this;
115 }
116
117 //_____________________________________________________________________________
118 void AliCRTv0::BuildGeometry()
119 {
120   //
121   // Create the ROOT TNode geometry for the CRT
122   //
123
124   TNode *node, *top;
125
126   const Int_t kColorCRT = kRed;
127
128   // Find the top node alice.
129   top = gAlice->GetGeometry()->GetNode("alice");
130
131   AliCRTConstants* crtConstants = AliCRTConstants::Instance();
132
133   new TBRIK("S_CRT_A", "CRT box", "void", 
134             crtConstants->ActiveAreaLenght()/2., 
135             crtConstants->ActiveAreaHeight()/2., 
136             crtConstants->ActiveAreaWidth()/2.);
137
138   
139   new TRotMatrix("Left", "Left", 90., 315., 90., 45., 0., 337.5);
140   new TRotMatrix("Right", "Right", 90., 45., 90., 315., 180., 202.5);
141   new TRotMatrix("Up", "Up", 90., 0., 90., 90., 0., 90.);
142   top->cd();
143
144   //
145   // Put 4 modules on the top of the magnet
146   Float_t box = crtConstants->CageWidth()/2.;
147   top->cd();
148   node = new TNode("upper1", "upper1", "S_CRT_A", 0., 790.,  3.*box, "Up");
149   node->SetLineColor(kColorCRT);
150   fNodes->Add(node);
151
152   top->cd();
153   node = new TNode("upper2", "upper2", "S_CRT_A", 0., 790.,    box, "Up");
154   node->SetLineColor(kColorCRT);
155   fNodes->Add(node);
156
157   top->cd();
158   node = new TNode("upper3", "upper3", "S_CRT_A", 0., 790., -1.*box, "Up");
159   node->SetLineColor(kColorCRT);
160   fNodes->Add(node);
161
162   top->cd();
163   node = new TNode("upper4", "upper4", "S_CRT_A", 0., 790., -3.*box, "Up");
164   node->SetLineColor(kColorCRT);
165   fNodes->Add(node);
166
167
168   // Modules on the left side.
169   Float_t xtragap = 10.;
170   Float_t initXside = (790.+xtragap)*TMath::Sin(2*22.5*kDegrad); //rigth side
171   Float_t initYside = (790.+xtragap)*TMath::Cos(2*22.5*kDegrad);
172   top->cd();
173   node = new TNode("upper5", "upper5", "S_CRT_A", initXside, initYside,  3.*box, "Left");
174   node->SetLineColor(kColorCRT);
175   fNodes->Add(node);
176
177   top->cd();
178   node = new TNode("upper6", "upper6", "S_CRT_A", initXside, initYside,    box, "Left");
179   node->SetLineColor(kColorCRT);
180   fNodes->Add(node);
181
182   top->cd();
183   node = new TNode("upper7", "upper7", "S_CRT_A", initXside, initYside, -1.*box, "Left");
184   node->SetLineColor(kColorCRT);
185   fNodes->Add(node);
186
187   top->cd();
188   node = new TNode("upper8", "upper8", "S_CRT_A", initXside, initYside, -3.*box, "Left");
189   node->SetLineColor(kColorCRT);
190   fNodes->Add(node);
191
192
193   // Modules on the right side.
194   top->cd();
195   node = new TNode("upper9", "upper9", "S_CRT_A", -initXside, initYside,  3.*box, "Right");
196   node->SetLineColor(kColorCRT);
197   fNodes->Add(node);
198
199   top->cd();
200   node = new TNode("upper10", "upper10", "S_CRT_A", -initXside, initYside,    box, "Right");
201   node->SetLineColor(kColorCRT);
202   fNodes->Add(node);
203
204   top->cd();
205   node = new TNode("upper11","upper11", "S_CRT_A", -initXside, initYside, -1.*box, "Right");
206   node->SetLineColor(kColorCRT);
207   fNodes->Add(node);
208
209   top->cd();
210   node = new TNode("upper12","upper12", "S_CRT_A", -initXside, initYside, -3.*box, "Right");
211   node->SetLineColor(kColorCRT);
212   fNodes->Add(node);
213
214 }
215
216 //_____________________________________________________________________________
217 void AliCRTv0::CreateGeometry()
218 {
219   //
220   // Create geometry for the CRT array
221   //
222
223   Int_t  idrotm[2499];    // The rotation matrix.
224   Int_t* idtmed = fIdtmed->GetArray() - 1099;
225   AliCRTConstants* crtConstants = AliCRTConstants::Instance();
226   // Create the mother volume.
227   // This volume can be seen as the volume which ACORDE will ocupate
228   // above the upper face of the L3 magnet. Inside this volume the detectors
229   // aboce the magnet will be, then there will be two copies of this volume,
230   // one for each side.
231   Float_t box[3];
232   box[0] = 2*crtConstants->MagMinRadius()*TMath::Sin(kDegrad*22.5);
233   box[1] = crtConstants->MagMaxRadius() - crtConstants->MagMinRadius();
234   box[2] = crtConstants->MagnetLenght();
235   gMC->Gsvolu("CRT1", "BOX", idtmed[1112], box, 3);
236
237   // Check if the AliCRTModule instance hav been set, otherwise
238   // use the default values
239   if ( !fModule ) {
240     Info("CreateGeometry", "Using default dimensions");
241     fModule = new AliCRTModule("CRTmod", "Default module dimensions");
242   }
243
244   // The full module volume.
245   // This volume will be ocupied by all the material of the module
246   // the scintillators, the aluminium frame, etc.
247   box[0] = fModule->FrameLength()/2;
248   box[1] = fModule->FrameThickness()/2;
249   box[2] = fModule->FrameWidth()/2;
250   gMC->Gsvolu("CRT2", "BOX", idtmed[1114], box, 3);
251
252   // The scintillators
253   box[0] = crtConstants->SinglePaletteLenght()/4;
254   box[1] = crtConstants->SinglePaletteHeight();
255   box[2] = crtConstants->SinglePaletteWidth()/2;
256   gMC->Gsvolu("CRT3", "BOX", idtmed[1112], box, 3);
257   gMC->Gspos("CRT3", 1, "CRT2", 0, 2, 0, 0, "ONLY");
258
259   // The metallic frame
260   box[0] = fModule->FrameLength()/2;
261   box[1] = fModule->FrameThickness()/2;
262   box[2] = 2;
263   gMC->Gsvolu("CRT4", "BOX", idtmed[1108], box, 3);
264   gMC->Gspos("CRT4", 1, "CRT2", 0, 0,  13 - box[2], 0, "MANY");
265   gMC->Gspos("CRT4", 2, "CRT2", 0, 0, -13 + box[2], 0, "MANY");
266
267   box[0] = 2;
268   box[1] = fModule->FrameThickness()/2;
269   box[2] = fModule->FrameWidth()/2;
270   gMC->Gsvolu("CRT5", "BOX", idtmed[1108], box, 3);
271   gMC->Gspos("CRT5", 1, "CRT2",  140 - box[0], 0, 0, 0, "MANY");
272   gMC->Gspos("CRT5", 2, "CRT2", -140 + box[0], 0, 0, 0, "MANY");
273
274   // The support bars
275   box[0] = 2;
276   box[1] = fModule->FrameThickness()/2;
277   box[2] = 500;
278   gMC->Gsvolu("CRT6", "BOX", idtmed[1108], box, 3);
279
280   // Now put into the volume CR11 all the above volumes.
281   // 20 scintillation modules
282   // 4 support bars
283   Int_t copyNumber = 0;
284   for ( Int_t k = 0; k < fModule->NumberOfRows(); k++ ) {
285   //for (Int_t k = 0; k < fModule->NumberOfModules(); k++ ) {
286     //Float_t zCoordinate = (k-(fModule->NumberOfColumns()-1)/2)*fModule->ZGap();
287     //Float_t zCoordinate = k*fModule->ZGap() - (fModule->NumberOfColums()-1)*fModule->ZGap()/2;
288     Float_t zCoordinate = k*fModule->ZGap() - 450;
289     gMC->Gspos("CRT2",++copyNumber,"CRT1",-150, 15, zCoordinate, 0, "MANY");
290     gMC->Gspos("CRT2",++copyNumber,"CRT1",150, 15, zCoordinate, 0, "MANY");
291   }
292   // Put the suppor bars
293   gMC->Gspos("CRT6", 1, "CRT1",  -75, 5, 0, 0, "ONLY");
294   gMC->Gspos("CRT6", 2, "CRT1", -225, 5, 0, 0, "ONLY");
295   gMC->Gspos("CRT6", 3, "CRT1",   75, 5, 0, 0, "ONLY");
296   gMC->Gspos("CRT6", 4, "CRT1",  225, 5, 0, 0, "ONLY");
297
298   // Now put a copy of CR11 on the 3 upper faces of the magnet
299   // In the right side side of the magnet
300   AliMatrix(idrotm[231], 90, 45, 90, 135, 0, 0);
301   // In the left side side of the magnet
302   AliMatrix(idrotm[232], 90, 315, 90, 45, 0, 0);
303
304   Float_t x = crtConstants->MagMinRadius()+10;
305   gMC->Gspos("CRT1", 1, "ALIC", 0, x, 0, 0, "MANY");
306   gMC->Gspos("CRT1", 2, "ALIC", -x*TMath::Sin(kDegrad*45), x*TMath::Cos(kDegrad*45), 0, idrotm[231], "MANY");
307   gMC->Gspos("CRT1", 3, "ALIC",  x*TMath::Sin(kDegrad*45), x*TMath::Cos(kDegrad*45), 0, idrotm[232], "MANY");
308
309 }
310
311 //_____________________________________________________________________________
312 void AliCRTv0::DrawDetector() const
313 {
314   //
315   // Draw a shaded view of the L3 magnet
316   //
317
318   Info("DrawDetector", "Drawing the module");
319
320   gMC->Gsatt("*", "seen", -1);
321
322   gMC->Gsatt("ALIC","seen",0);
323
324   gMC->Gsatt("L3MO","seen",0); // L3 Magnet, Mother
325   gMC->Gsatt("L3CO","seen",1); // Coils
326   gMC->Gsatt("L3C1","seen",1); // Coils
327   gMC->Gsatt("L3YO","seen",1); // Yoke
328   gMC->Gsatt("L3DO","seen",0); // return Yoke (DOOR)
329   gMC->Gsatt("L3FR","seen",1); // DOOR
330   gMC->Gsatt("L3IR","seen",0); // Inner layer
331   gMC->Gsatt("L3O1","seen",1); // Door opening
332   gMC->Gsatt("L3O2","seen",1); // Door opening
333
334   gMC->Gsatt("CRT1", "seen", 0); // CRT Mother
335   gMC->Gsatt("CRT2", "seen", 0); // Module air box
336   gMC->Gsatt("CRT3", "seen", 1); // Scintillators
337   gMC->Gsatt("CRT3", "colo", 2); // Scintillators
338   gMC->Gsatt("CRT4", "seen", 1); // Aluminium frame (long bars)
339   gMC->Gsatt("CRT4", "colo", 3); //
340   gMC->Gsatt("CRT5", "seen", 1); // Aluminium frame (short bars)
341   gMC->Gsatt("CRT5", "colo", 3); //
342   gMC->Gsatt("CRT6", "seen", 1); // Module support
343   gMC->Gsatt("CRT6", "colo", 3); //
344
345   gMC->Gdopt("hide", "on");
346   gMC->Gdopt("edge","off");
347   gMC->Gdopt("shad", "on");
348   gMC->Gsatt("*", "fill", 7);
349   gMC->SetClipBox("ALIC", 0, 3000, -3000, 3000, -6000, 6000);
350   gMC->DefaultRange();
351   //gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .009, .009);
352   gMC->Gdraw("alic", 30, 40, 0, -30, -60, .09, .09);
353   gMC->Gdhead(1111, "View of CRT(ACORDE)");
354   gMC->Gdman(18, 4, "MAN");
355 }