]> git.uio.no Git - u/mrichter/AliRoot.git/blob - CRT/AliCRTv0.cxx
Add CRT and streamline loadlibs
[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 /*
17 $Log$
18 Revision 1.3.2.1  2002/07/12 12:32:50  gamez
19 Division of CRT1 corrected
20
21 Revision 1.3  2002/07/10 15:57:04  gamez
22 CreateHall() removed, and new Molasse volumes
23
24 Revision 1.2  2002/07/09 08:45:35  hristov
25 Old style include files needed on HP (aCC)
26
27 Revision 1.1  2002/06/16 17:08:19  hristov
28 First version of CRT
29
30
31 */
32
33 ///////////////////////////////////////////////////////////////////////////////
34 //                                                                           //
35 // ALICE Cosmic Ray Trigger                                                  //
36 //                                                                           //
37 //  This class contains the functions for version 0 of the ALICE Cosmic Ray  //
38 //  Trigger.                                                                 //
39 //
40 //   Authors:
41 //
42 //   Arturo Fernandez <afernand@fcfm.buap.mx>
43 //   Enrique Gamez    <egamez@fcfm.buap.mx>
44 //
45 //   Universidad Autonoma de Puebla
46 //
47 //
48 //Begin_Html
49 /*
50 <img src="picts/AliCRTv0Class.gif">
51 </pre>
52 <br clear=left>
53 <p>The responsible person for this module is
54 <a href="mailto:egamez@fcfm.buap.mx">Enrique Gamez</a>.
55 </font>
56 <pre>
57 */
58 //End_Html
59 //                                                                           //
60 ///////////////////////////////////////////////////////////////////////////////
61
62 #include <iostream.h>
63
64 #include <TMath.h>
65 #include <TGeometry.h>
66 #include <TTUBE.h>
67 #include <TNode.h>
68 #include <TLorentzVector.h>
69
70 #include "AliCRTv0.h"
71 #include "AliCRTConstants.h"
72
73 #include "AliRun.h"
74 #include "AliMC.h"
75 #include "AliMagF.h"
76 #include "AliConst.h"
77 #include "AliPDG.h"
78
79 ClassImp(AliCRTv0)
80  
81 //_____________________________________________________________________________
82 AliCRTv0::AliCRTv0() : AliCRT()
83 {
84   //
85   // Default constructor for CRT
86   //
87   fMucur = 0;
88 }
89  
90 //_____________________________________________________________________________
91 AliCRTv0::AliCRTv0(const char *name, const char *title)
92   : AliCRT(name,title)
93 {
94   //
95   // Standard constructor for CRT
96   //
97   //Begin_Html
98   /*
99     <img src="picts/AliCRTv0.gif">
100   */
101   //End_Html
102 }
103
104 //_____________________________________________________________________________
105 void AliCRTv0::BuildGeometry()
106 {
107
108 }
109
110 //_____________________________________________________________________________
111 void AliCRTv0::CreateGeometry()
112 {
113   //
114   // Create geometry for the CRT array
115   //
116
117   Int_t  idrotm[2499];    // The rotation matrix.
118
119   Int_t * idtmed = fIdtmed->GetArray() - 1099 ;
120
121   //
122   // Molasse
123   //
124
125   // Exactly above the hall
126   Float_t tspar[5];
127   tspar[0] = 1170.;
128   tspar[1] = 1170. + 375.;
129   tspar[2] = (1900.+1150.)/2.+100.;
130   tspar[3] = 0.;
131   tspar[4] = 180.;
132   gMC->Gsvolu("CMO1", "TUBS", idtmed[1123], tspar, 5);
133   gMC->Gspos("CMO1", 1, "ALIC", 0., 500., 1900.-tspar[2]+400., 0, "MANY");
134
135   Float_t tbox[3];
136   tbox[0] = 1250.;
137   tbox[1] = (4420. - 1670.)/2.;
138   tbox[2] = (1900.+1150.)/2. + 200.;
139   gMC->Gsvolu("CM12", "BOX", idtmed[1123], tbox, 3);
140   gMC->Gspos("CM12", 1, "ALIC", 0., 4420. -tbox[1], 1900.-tbox[2]+400., 0, "MANY");
141
142   AliMatrix(idrotm[2003], 0., 0., 90., 0., 90., 90.);
143   // Along the PM25
144   Float_t tube[3];
145   tube[0] = 455. + 100.;
146   tube[1] = 555. + 375.;
147   tube[2] = (5150. - 1166.)/2.;
148   gMC->Gsvolu("CMO2", "TUBE", idtmed[1123], tube, 3);
149   gMC->Gspos("CMO2", 1, "ALIC", -2100., 4420.-tube[2], 0., idrotm[2003], "MANY");
150
151
152   // Along the PGC2
153   tube[0] = 650.;
154   tube[1] = 2987.7;
155   tube[2] = (5150. - 690.)/2.;
156   gMC->Gsvolu("CMO3", "TUBE", idtmed[1123], tube, 3);
157   gMC->Gspos("CMO3", 1, "ALIC", 375., 4420.-tube[2], 1900.+2987.7, idrotm[2003], "MANY");
158   // Behind the PGC2 up to the end of the M. volume.
159   tbox[0] = 12073.;
160   tbox[1] = 2575. + 95.;
161   tbox[2] = (12073. - 1900.+2987.7+650.)/2.;
162   gMC->Gsvolu("CMO7", "BOX", idtmed[1123], tbox, 3);
163   gMC->Gspos("CMO7", 1, "ALIC", 0., 4420.-tbox[1], 1900.+2987.7+650.+tbox[2], 0, "MANY");
164
165   // Along the PX24 , upper part.
166   tube[0] = 1250.;
167   tube[1] = 2300;
168   tube[2] = 2575. - 1300. + 95.;
169   gMC->Gsvolu("CMO4", "TUBE", idtmed[1123], tube, 3);
170   gMC->Gspos("CMO4", 1, "ALIC", 0., 404.+1300.+tube[2], -2300., idrotm[2003], "MANY");
171
172   // Along the PX24 , lower part
173   tspar[0] = 1250.;
174   tspar[1] = 2300;
175   tspar[2] = 1300.;
176   tspar[3] = kRaddeg*TMath::ASin(1070./1150.);
177   tspar[4] = 360. - tspar[3];
178   gMC->Gsvolu("CMO5", "TUBS", idtmed[1123], tspar, 5);
179   gMC->Gspos("CMO5", 1, "ALIC", 0., 404., -2300., idrotm[2003], "MANY");
180   // behind the PX24
181   tbox[0] = 12073.;
182   tbox[1] = 2575. + 95.;
183   tbox[2] = 8523./2.;
184   gMC->Gsvolu("CMO6", "BOX", idtmed[1123], tbox, 3);
185   gMC->Gspos("CMO6", 1, "ALIC", 0., 4420.-tbox[1], -3550.-tbox[2], 0, "MANY");
186
187
188   // On the right side of th hall
189   tbox[0] = (12073. - 1250.)/2.;
190   tbox[1] = 2575. + 95.;
191   tbox[2] = (8437.7+650.)/2.;
192   gMC->Gsvolu("CMO8", "BOX", idtmed[1123], tbox, 3);
193   gMC->Gspos("CMO8", 1, "ALIC", 1250.+tbox[0], 4420.-tbox[1], -3550.+tbox[2], 0, "MANY");
194
195   // on the left side of the hall, behind 
196   tbox[0] = (12073. - 2755.)/2.;
197   tbox[1] = 2575. + 95.;
198   tbox[2] = (8437.7+650.)/2.;
199   gMC->Gsvolu("CMO9", "BOX", idtmed[1123], tbox, 3);
200   gMC->Gspos("CMO9", 1, "ALIC", -2755.-tbox[0], 4420.-tbox[1], -3550.+tbox[2], 0, "MANY");
201
202
203   // Molasse betwen the PX24 & PM25 on the left side.
204   tbox[0] = (2755. - 1250.)/2.;
205   tbox[1] = 2575. + 95.;
206   tbox[2] = (3550. - 555.)/2.;
207   gMC->Gsvolu("CM10", "BOX", idtmed[1123], tbox, 3);
208   gMC->Gspos("CM10", 1, "ALIC", -1250.-tbox[0], 4420.-tbox[1], -tbox[2]-555., 0, "MANY");
209
210
211   // Molasse betwen the PGC2 & PM25 on the left side.
212   tbox[0] = (2755. - 1250.)/2.;
213   tbox[1] = 2575. + 95.;
214   tbox[2] = (1900.+2987.7 - 555. + 650.)/2.;
215   gMC->Gsvolu("CM11", "BOX", idtmed[1123], tbox, 3);
216   gMC->Gspos("CM11", 1, "ALIC", -1250.-tbox[0], 4420.-tbox[1], 555.+tbox[2], 0, "MANY");
217
218   //
219   // Scintillators
220
221   Float_t box[3];
222   box[0] = AliCRTConstants::fgCageLenght/2.; // Half Length of the box along the X axis, cm.
223   box[1] = AliCRTConstants::fgCageHeight/2.; // Half Length of the box along the Y axis, cm.
224   box[2] = AliCRTConstants::fgCageWidth/2.;  // Half Length of the box along the Z axis, cm.
225
226
227   // Define the Scintillators. as a big box.
228   Float_t scint[3];
229   scint[0] = AliCRTConstants::fgActiveAreaLenght/2.;       // Half Length in X
230   scint[1] = AliCRTConstants::fgActiveAreaHeight/2.;       // Half Length in Y
231   scint[2] = AliCRTConstants::fgActiveAreaWidth/2.;        // Half Length in Z
232   gMC->Gsvolu("CRT1", "BOX ", idtmed[1112], scint, 3);  // Scintillators
233   // Divide the modules in 2 planes.
234   gMC->Gsdvn("CRT2", "CRT1", 2, 2);
235   // Now divide each plane in 8 palettes
236   gMC->Gsdvn("CRT3", "CRT2", 8, 3);
237
238
239   //
240   // Define the coordinates where the draw will begin.
241   //
242
243   //
244   // -- X axis.
245   // we'll start dawing from the center.
246   Float_t initX = 0.;
247
248   //
249   // -- Y axis
250   Float_t gapY   = 30.;        // 30 cms. above the barrel.
251   // For the height we staimate the from the center of the ceiling,
252   // if were a cilinder, must be about 280cm.
253   Float_t barrel = 790.; // Barrel radius.
254   Float_t height  = barrel + gapY - 30.;
255   Float_t initY = height;
256
257   //
258   // -- Z axis.
259   // we'll start dawing from the center.
260
261   //
262   // Put 4 modules on the top of the magnet
263   Int_t step = 4;
264   for ( Int_t i = 1 ; i <= 4 ; i++ ) {
265     gMC->Gspos("CRT1", i, "ALIC", initX, initY, (i-step)*box[2], 0, "ONLY");
266     step--;
267   }
268
269   // Modules on the barrel sides.
270   // Because the openenig angle for each face is 22.5, and if we want to
271   //    put the modules right in the middle
272   Float_t xtragap = 10.;
273   Float_t initXside = (height+xtragap)*TMath::Sin(2*22.5*kDegrad); //rigth side
274   Float_t initYside = (height+xtragap)*TMath::Cos(2*22.5*kDegrad);
275
276   // Put 4 modules on the left side of the magnet
277   // The rotation matrix parameters, for the left side.
278   AliMatrix(idrotm[232], 90., 315., 90., 45., 0., 337.5);
279   Int_t stepl = 4;
280   for ( Int_t i = 1 ; i <= 4 ; i++ ) {
281     gMC->Gspos("CRT1", i+4, "ALIC", initXside, initYside, (i-stepl)*box[2],
282                idrotm[232], "ONLY");
283     stepl--;
284   }
285
286   // Put 4 modules on the right side of the magnet
287   // The rotation matrix parameters for the right side.
288   AliMatrix(idrotm[231], 90., 45., 90., 315., 180., 202.5);
289   Int_t stepr = 4;
290   for ( Int_t i = 1 ; i <= 4 ; i++ ) {
291     gMC->Gspos("CRT1", i+8, "ALIC", -initXside, initYside, (i-stepr)*box[2],
292                idrotm[231], "ONLY");
293     stepr--;
294   }
295
296 }
297
298 //_____________________________________________________________________________
299 void AliCRTv0::CreateMaterials()
300 {
301   //
302   //--
303   //
304
305   // Use the standard materials.
306   AliCRT::CreateMaterials();
307 }
308
309
310 //_____________________________________________________________________________
311 void AliCRTv0::DrawDetector()
312 {
313
314 }
315
316 //_____________________________________________________________________________
317 void AliCRTv0::DrawModule()
318 {
319   //
320   // Draw a shaded view of the L3 magnet
321   //
322    cout << "AliCRTv0::DrawModule() : Drawing the module" << endl;
323
324    gMC->Gsatt("*", "seen", -1);
325    gMC->Gsatt("alic", "seen", 0);
326
327    gMC->Gsatt("ALIC","seen",0);
328    gMC->Gsatt("L3MO","seen",1); // L3 Magnet
329    gMC->Gsatt("CRT1","seen",1); // Scintillators
330
331    // Draw the molasse volumes
332    gMC->Gsatt("CMO1","seen",0); // Exactly above the HALL
333    gMC->Gsatt("CMO2","seen",0); // Molasse, along the PM25
334    gMC->Gsatt("CMO3","seen",0); // molasse along the PGC2
335    gMC->Gsatt("CMO4","seen",0); // Molasse, behind the PX24 upper part
336    gMC->Gsatt("CMO5","seen",0); // molasse behind px24, lower part
337    gMC->Gsatt("CMO6","seen",0); // behind the PX24
338    gMC->Gsatt("CMO7","seen",0); // behind the PGC2
339    gMC->Gsatt("CMO8","seen",0); // on the right side.
340    gMC->Gsatt("CMO9","seen",0); // on the left side.
341    gMC->Gsatt("CM10","seen",0); // betwen PX24 & PM25.
342    gMC->Gsatt("CM11","seen",0); // betwen PGC2 & PM25.
343    gMC->Gsatt("CM12","seen",0); // box above the hall.
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->Gdhead(1111, "View of CRT(ACORDE)");
353    gMC->Gdman(18, 4, "MAN");
354
355
356 }
357
358 //_____________________________________________________________________________
359 void AliCRTv0::Init()
360 {
361   //
362   // Initialise L3 magnet after it has been built
363   Int_t i;
364   //
365   if(fDebug) {
366     printf("\n%s: ",ClassName());
367     for(i=0;i<35;i++) printf("*");
368     printf(" CRTv0_INIT ");
369     for(i=0;i<35;i++) printf("*");
370     printf("\n%s: ",ClassName());
371     //
372     // Here the CRTv0 initialisation code (if any!)
373     for(i=0;i<80;i++) printf("*");
374     printf("\n");
375   }
376
377 }
378
379 //_____________________________________________________________________________
380 void AliCRTv0::StepManager()
381 {
382   //
383   // Called for every step in the CRT Detector
384   //
385   Float_t hits[12];
386   Int_t   vol[5];
387
388   // Check if this is the last step of the track in the current volume
389   Bool_t laststepvol = gMC->IsTrackEntering();
390   // Obtain the medium
391   TLorentzVector xyz;
392   gMC->TrackPosition(xyz);
393   TLorentzVector pxyz;
394   gMC->TrackMomentum(pxyz);
395
396   if ( laststepvol && (strcmp(gMC->CurrentVolName(),"CRT1") == 0) ) {
397     if (  gMC->TrackCharge() != 0 || gMC->TrackPid() == kGamma ) {
398       Float_t vert[3];
399
400       hits[0] = fMucur++;
401
402       if ( (gMC->TrackPid() != kMuonPlus) && (gMC->TrackPid() != kMuonMinus)) {
403         hits[1] = -(Float_t)gMC->TrackPid();
404       } else {
405         hits[1] = (Float_t)gMC->TrackPid();
406       }
407
408       TLorentzVector xyz;
409       gMC->TrackPosition(xyz);
410       TLorentzVector pxyz;
411       gMC->TrackMomentum(pxyz);
412
413       hits[2]  = xyz[0]; // X pit
414       hits[3]  = xyz[1]; // Y pit
415       hits[4]  = xyz[2]; // Z pit
416       hits[5]  = pxyz[0]; // pxug
417       hits[6] = pxyz[1]; // pyug
418       hits[7] = pxyz[2]; // pzug
419
420       hits[8] = gMC->GetMedium(); // layer
421       hits[9] = vert[0]; // xver
422       hits[10] = vert[1]; // yver
423       hits[11] = vert[2]; // zver
424     }
425   }
426
427   // Store the hit.
428   AddHit(gAlice->CurrentTrack(),vol, hits);
429 }