]> git.uio.no Git - u/mrichter/AliRoot.git/blob - CRT/AliCRTv0.cxx
Added new method DisIntegrate(AliMUONHit&, TList& digits) to replace the one in
[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
227   // Create the mother volume.
228   // This volume can be seen as the volume which ACORDE will ocupate
229   // above the upper face of the L3 magnet. Inside this volume the detectors
230   // aboce the magnet will be, then there will be two copies of this volume,
231   // one for each side.
232   Float_t box[3];
233   //box[0] = 2*crtConstants->MagMinRadius()*TMath::Sin(kDegrad*22.5);
234   box[0] = crtConstants->MagMinRadius()*TMath::Sin(kDegrad*22.5);
235   box[1] = crtConstants->MagMaxRadius() - crtConstants->MagMinRadius();
236   box[2] = crtConstants->MagnetLenght()/2;
237   gMC->Gsvolu("CRT1", "BOX", idtmed[1112], box, 3);
238
239   // Check if the AliCRTModule instance have been set, otherwise
240   // use the default values
241   if ( !fModule ) {
242     Info("CreateGeometry", "Using default dimensions");
243     fModule = new AliCRTModule("CRTmod", "Default module dimensions");
244   }
245
246   // The full module volume.
247   // This volume will be ocupied by all the material of the module
248   // the scintillators, the aluminium frame, etc.
249   box[0] = fModule->FrameLength()/2;
250   box[1] = fModule->FrameThickness()/2;
251   box[2] = fModule->FrameWidth()/2;
252   gMC->Gsvolu("CRT2", "BOX", idtmed[1114], box, 3);
253
254   // The scintillators
255   box[0] = crtConstants->SinglePaletteLenght()/4;
256   box[1] = crtConstants->SinglePaletteHeight();
257   box[2] = crtConstants->SinglePaletteWidth()/2;
258   gMC->Gsvolu("CRT3", "BOX", idtmed[1112], box, 3);
259   gMC->Gspos("CRT3", 1, "CRT2", 0, 2, 0, 0, "ONLY");
260
261   // The metallic frame
262   box[0] = fModule->FrameLength()/2;
263   box[1] = fModule->FrameThickness()/2;
264   box[2] = 2;
265   gMC->Gsvolu("CRT4", "BOX", idtmed[1108], box, 3);
266   gMC->Gspos("CRT4", 1, "CRT2", 0, 0,  13 - box[2], 0, "MANY");
267   gMC->Gspos("CRT4", 2, "CRT2", 0, 0, -13 + box[2], 0, "MANY");
268
269   box[0] = 2;
270   box[1] = fModule->FrameThickness()/2;
271   box[2] = fModule->FrameWidth()/2;
272   gMC->Gsvolu("CRT5", "BOX", idtmed[1108], box, 3);
273   gMC->Gspos("CRT5", 1, "CRT2",  140 - box[0], 0, 0, 0, "MANY");
274   gMC->Gspos("CRT5", 2, "CRT2", -140 + box[0], 0, 0, 0, "MANY");
275
276   // The support bars
277   box[0] = 2;
278   box[1] = fModule->FrameThickness()/2;
279   box[2] = 500;
280   gMC->Gsvolu("CRT6", "BOX", idtmed[1108], box, 3);
281
282   // Now put into the volume CR11 all the above volumes.
283   // 20 scintillation modules
284   // 4 support bars
285   Int_t copyNumber = 0;
286   for ( Int_t k = 0; k < fModule->NumberOfRows(); k++ ) {
287     Float_t zCoordinate = k*fModule->ZGap() - 450;
288     gMC->Gspos("CRT2",++copyNumber,"CRT1",-150, 15, zCoordinate, 0, "MANY");
289     gMC->Gspos("CRT2",++copyNumber,"CRT1",150, 15, zCoordinate, 0, "MANY");
290
291   }
292
293   // Put the support bars
294   gMC->Gspos("CRT6", 1, "CRT1",  -75, 5, 0, 0, "ONLY");
295   gMC->Gspos("CRT6", 2, "CRT1", -225, 5, 0, 0, "ONLY");
296   gMC->Gspos("CRT6", 3, "CRT1",   75, 5, 0, 0, "ONLY");
297   gMC->Gspos("CRT6", 4, "CRT1",  225, 5, 0, 0, "ONLY");
298
299   // Now put a copy of CR11 on the 3 upper faces of the magnet
300   // In the right side side of the magnet
301   AliMatrix(idrotm[231], 90, 45, 90, 135, 0, 0);
302   // In the left side side of the magnet
303   AliMatrix(idrotm[232], 90, 315, 90, 45, 0, 0);
304
305   Float_t x = crtConstants->MagMinRadius()+10;
306   gMC->Gspos("CRT1", 1, "ALIC", 0, x, 0, 0, "MANY");
307   gMC->Gspos("CRT1", 2, "ALIC", -x*TMath::Sin(kDegrad*45), x*TMath::Cos(kDegrad*45), 0, idrotm[231], "MANY");
308   gMC->Gspos("CRT1", 3, "ALIC",  x*TMath::Sin(kDegrad*45), x*TMath::Cos(kDegrad*45), 0, idrotm[232], "MANY");
309
310 }
311
312 //_____________________________________________________________________________
313 void AliCRTv0::DrawDetector() const
314 {
315   //
316   // Draw a shaded view of the L3 magnet
317   //
318
319   Info("DrawDetector", "Drawing the module");
320
321   gMC->Gsatt("*", "seen", -1);
322
323   gMC->Gsatt("ALIC","seen",0);
324
325   gMC->Gsatt("L3MO","seen",0); // L3 Magnet, Mother
326   gMC->Gsatt("L3CO","seen",1); // Coils
327   gMC->Gsatt("L3C1","seen",1); // Coils
328   gMC->Gsatt("L3YO","seen",1); // Yoke
329   gMC->Gsatt("L3DO","seen",0); // return Yoke (DOOR)
330   gMC->Gsatt("L3FR","seen",1); // DOOR
331   gMC->Gsatt("L3IR","seen",0); // Inner layer
332   gMC->Gsatt("L3O1","seen",1); // Door opening
333   gMC->Gsatt("L3O2","seen",1); // Door opening
334
335   gMC->Gsatt("CRT1", "seen", 0); // CRT Mother
336   gMC->Gsatt("CRT2", "seen", 0); // Module air box
337   gMC->Gsatt("CRT3", "seen", 1); // Scintillators
338   gMC->Gsatt("CRT3", "colo", 2); // Scintillators
339   gMC->Gsatt("CRT4", "seen", 1); // Aluminium frame (long bars)
340   gMC->Gsatt("CRT4", "colo", 3); //
341   gMC->Gsatt("CRT5", "seen", 1); // Aluminium frame (short bars)
342   gMC->Gsatt("CRT5", "colo", 3); //
343   gMC->Gsatt("CRT6", "seen", 1); // Module support
344   gMC->Gsatt("CRT6", "colo", 3); //
345
346   gMC->Gdopt("hide", "on");
347   gMC->Gdopt("edge","off");
348   gMC->Gdopt("shad", "on");
349   gMC->Gsatt("*", "fill", 7);
350   gMC->SetClipBox("ALIC", 0, 3000, -3000, 3000, -6000, 6000);
351   gMC->DefaultRange();
352   //gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .009, .009);
353   gMC->Gdraw("alic", 30, 40, 0, -30, -60, .09, .09);
354   gMC->Gdhead(1111, "View of CRT(ACORDE)");
355   gMC->Gdman(18, 4, "MAN");
356 }