]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ACORDE/AliACORDEv0.cxx
297b583b9fca329c33d5466a55bfd9d34c731298
[u/mrichter/AliRoot.git] / ACORDE / AliACORDEv0.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 with//
24 //  all the detectors. It include geometry and hits (posicion and momentum)  //
25 //                                                                           //
26 //                  Send comments to:                                        //
27 //      Arturo Fernandez <afernand@fcfm.buap.mx>                             //
28 //      Enrique Gamez    <egamez@fcfm.buap.mx>                               //
29 //      Eleazar Cuautle  <ecuautle@nucleares.unam.mx>                        //
30 ///////////////////////////////////////////////////////////////////////////////
31
32
33 #include "AliACORDEv0.h"
34 #include <TClonesArray.h>
35 #include <TLorentzVector.h>
36 #include <TVirtualMC.h>
37 #include <TPDGCode.h>
38 #include <TGeometry.h>
39 #include <TBRIK.h>
40 #include <TNode.h>
41
42
43 #include "AliRun.h"
44 #include "AliConst.h"
45 #include "AliACORDEhit.h"
46 #include "AliACORDEConstants.h"
47 #include "AliMC.h"
48 #include "AliLog.h"
49
50 ClassImp(AliACORDEv0)
51  
52 //_____________________________________________________________________________
53 AliACORDEv0::AliACORDEv0()
54   : AliACORDE()
55 {
56   //
57   // Default constructor
58   fIshunt = 0;
59   fHits = 0;
60   //
61
62 //_____________________________________________________________________________
63 AliACORDEv0::AliACORDEv0(const char *name, const char *title)
64   : AliACORDE(name, title)
65 {
66   //
67   // Standard constructor
68   //
69   fIshunt = 1; // All hits are associated with primary particles 
70   fHits =  new TClonesArray("AliACORDEhit",400);
71   gAlice->GetMCApp()->AddHitList(fHits);
72 }
73 //_____________________________________________________________________________
74 AliACORDEv0::~AliACORDEv0()
75 {
76   //
77   // Default destructor
78   //
79 }
80
81 //_____________________________________________________________________________
82 void AliACORDEv0::CreateGeometry()
83 {
84   CreateAcorde();
85   if (GetCreateCavern()) CreateCavern();
86 }
87
88 void AliACORDEv0::CreateCavern()
89 {
90   Int_t* idtmed = fIdtmed->GetArray() - 1099 ;
91     // Create the mother volume, the one which will contain all the material
92   // above the hall.
93   Float_t pbox[3];
94   pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
95   //pbox[0] = 12073;
96   pbox[1] = AliACORDEConstants::Instance()->Depth();
97   pbox[2] = pbox[0];
98   gMC->Gsvolu("ACORDE", "BOX", idtmed[1114], pbox, 3);
99   gMC->Gspos("ACORDE", 1, "ALIC", 0, 0, 0, 0, "ONLY");
100   CreateShafts();
101   CreateMolasse();
102 }
103
104 void AliACORDEv0::CreateShafts()
105
106 {
107
108   //
109   Int_t  idrotm[2499];    // The rotation matrix.
110   Int_t* idtmed = fIdtmed->GetArray() - 1099 ;
111
112   //
113   // Acces shafts
114   //
115   AliMatrix(idrotm[2001], 0, 0, 90, 0, 90, 90);
116
117
118   // Create a bing cilinder to hold the main structures in the shaft.
119   //   All the structures relative to the shaft will be put into
120   // this volume.
121   //   This shaft is composed by an open tube down in the hall, and
122   // a cilinder avobe the level of the ceiling.
123   Float_t ptube[3];
124   ptube[0] = 0;    // inner radius
125   ptube[1] = 1250; // outer radius
126   ptube[2] = 5150/2; // Half lenght in Z
127   gMC->Gsvolu("CSF1", "TUBE", idtmed[1114], ptube, 3);
128
129   Float_t ptubs[5];
130   // The open section of the PX24
131   ptubs[0] = 1150; // Inner radius
132   ptubs[1] = 1250; // Outer radius
133   ptubs[2] = 1300; // Half length
134   ptubs[3] = 180 + kRaddeg*TMath::ASin(1070/ptubs[0]); // starting angle
135   ptubs[4] = 180 -  kRaddeg*TMath::ASin(1070/ptubs[0]);
136   gMC->Gsvolu("CSF2", "TUBS", idtmed[1116], ptubs, 5);
137   gMC->Gspos("CSF2", 1, "CSF1", 0, 0, -ptube[2] + ptubs[2], 0, "MANY");
138
139   // The other part of the shaft.
140   ptube[0] = ptubs[0]; // Inner radius
141   ptube[1] = ptubs[1]; // Outer radius
142   ptube[2] = 5150/2 - ptubs[2]; // Half lenght
143   gMC->Gsvolu("CSF3", "TUBE", idtmed[1116], ptube, 3);
144   gMC->Gspos("CSF3", 1, "CSF1", 0, 0, 5150/2 - ptube[2], 0, "MANY");
145
146   Float_t pbox[3];
147   // Concrete walls along the shaft (next to the elevator.)
148   pbox[0] = 480/2;  // Half length in X
149   pbox[1] = 120/2;  // Half length in Y
150   pbox[2] = 5150/2; // Half length in Z
151   gMC->Gsvolu("CSW1", "BOX", idtmed[1116], pbox, 3);
152   gMC->Gspos("CSW1", 1, "CSF1", 820+pbox[0],  150+pbox[1], 0, 0, "MANY");
153   gMC->Gspos("CSW1", 2, "CSF1", 820+pbox[0], -300-pbox[1], 0, 0, "MANY");
154
155   //
156   pbox[0] = 120/2;  // Half length in X
157   pbox[1] = 750/2;  // Half length in Y
158   pbox[2] = 5150/2; // Half length in Z
159   gMC->Gsvolu("CSW2", "BOX", idtmed[1116], pbox, 3);
160   gMC->Gspos("CSW2", 1, "CSF1", 820-60, 150+pbox[1], 0, 0, "MANY");
161
162   //
163   pbox[0] = 120/2;  // Half length in X
164   pbox[1] = 600/2;  // Half lenght in Y
165   pbox[2] = 5150/2; // Half length in Z
166   gMC->Gsvolu("CSW3", "BOX", idtmed[1116], pbox, 3);
167   gMC->Gspos("CSW3", 1, "CSF1", 820-60, -300-pbox[1], 0, 0, "MANY");
168
169   // Material below the counting rooms.
170   pbox[0] = 400/2;
171   pbox[1] = 2300/2;
172   pbox[2] = 300/2;
173   gMC->Gsvolu("CSW4", "BOX", idtmed[1116], pbox, 3);
174   gMC->Gspos("CSW4",1,"CSF1",2300/2-pbox[0],0,3000-5150/2-pbox[2], 0, "MANY");
175
176   // Shielding plug.
177   pbox[0] = 1400/2;
178   pbox[1] = 2300/2;
179   pbox[2] = 170/2;
180   gMC->Gsvolu("CSW5", "BOX", idtmed[1116], pbox, 3);
181   gMC->Gspos("CSW5", 1, "CSF1", 0, 0, 3000-5150/2-130, 0, "MANY");
182
183   // The end of the support for the shielding plug.
184   pbox[0] = 170/2;
185   pbox[1] = 2300/2;
186   pbox[2] = 300/2;
187   gMC->Gsvolu("CSW6", "BOX", idtmed[1116], pbox, 3);
188   gMC->Gspos("CSW6",1,"CSF1",-1400/2-pbox[0],0,3000-5150/2-pbox[2],0,"MANY");
189
190   // ...
191   pbox[0] = 100/2;
192   pbox[1] = 2300/2;
193   pbox[2] = 450/2;
194   gMC->Gsvolu("CSW7", "BOX", idtmed[1116], pbox, 3);
195   gMC->Gspos("CSW7",1,"CSF1",-1400/2-170-pbox[0],0,3000-5150/2+pbox[2],0,"MANY");
196
197   // Material close to the pipe.
198   pbox[0] = 300/2;
199   pbox[1] = 2300/2;
200   pbox[2] = 170/2;
201   gMC->Gsvolu("CSW8", "BOX", idtmed[1116], pbox, 3);
202   gMC->Gspos("CSW8",1,"CSF1",-2300/2+pbox[0],0,2500-5150/2,0,"MANY");
203
204   // Now put the shaft into the mother volume.
205   gMC->Gspos("CSF1", 1, "ACORDE", 0, AliACORDEConstants::Instance()->Depth() - 5150/2, 2300, idrotm[2001], "MANY");
206
207   // PM25 Access Shaft
208   ptube[0] = 910/2;
209   ptube[1] = ptube[0] + 100;
210   ptube[2] = (5150 - 1166)/2;
211   gMC->Gsvolu("CSF4", "TUBE", idtmed[1116], ptube, 3);
212   gMC->Gspos("CSF4", 1, "ACORDE", 2100, AliACORDEConstants::Instance()->Depth()-ptube[2], 0, idrotm[2001], "MANY");
213
214   // PGC2 Access Shaft
215   ptube[0] = 1100/2;
216   ptube[1] = ptube[0] + 100;
217   ptube[2] = (5150 - 690)/2;
218   gMC->Gsvolu("CSF5", "TUBE", idtmed[1116], ptube, 3);
219   gMC->Gspos("CSF5", 1, "ACORDE", -375, AliACORDEConstants::Instance()->Depth()-ptube[2], -1900 - 2987.7, idrotm[2001], "MANY");
220
221 }
222
223
224 void AliACORDEv0::CreateMolasse()
225
226 {
227
228   //
229   Int_t  idrotm[2499];    // The rotation matrix.
230   Int_t* idtmed = fIdtmed->GetArray() - 1099 ;
231
232   Float_t px24radius = 2300/2;
233   Float_t px24X = 0;
234   //Float_t px24Y = ;
235   Float_t px24Z = 2300;
236
237   Float_t pm25radius = 910/2;
238   Float_t pm25X = 2100;
239   //Float_t pm25Y = ;
240   Float_t pm25Z = 0;
241
242   Float_t pgc2radius = 1100/2;
243   Float_t pgc2X = -375;
244   //Float_t pgc2Y = ;
245   Float_t pgc2Z = -(1900 + 2987.7);
246
247   Float_t concreteWidth = 100; // Standard width of the hall walls.
248
249
250   // Create a local mother volume.
251   Float_t pbox[3];
252   pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
253   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
254   pbox[2] = pbox[0];
255   gMC->Gsvolu("CMO1", "BOX", idtmed[1114], pbox, 3);
256
257   // Now put the molasse exactly above the hall. OK
258   // Above the ceiling
259   Float_t ptubs[5];
260   ptubs[0] = 1170;
261   ptubs[1] = 2100 - pm25radius;
262   ptubs[2] = 1900/2 + px24radius;
263   ptubs[3] = 0;
264   ptubs[4] = 180;
265   gMC->Gsvolu("CMO2", "TUBS", idtmed[1123], ptubs, 5);
266   gMC->Gspos("CMO2", 1, "CMO1", 0, 500-AliACORDEConstants::Instance()->Depth()/2, ptubs[2]-1900, 0, "MANY");
267
268   // Molasse around the RB24/26 Wall. OK
269   ptubs[0] = 220 + 1600;
270   ptubs[1] = AliACORDEConstants::Instance()->Depth() - ptubs[0];
271   ptubs[2] = 2987.7/2 - 1100/4 - concreteWidth/2;
272   ptubs[3] = 0;
273   ptubs[4] = 180;
274   gMC->Gsvolu("CMO3", "TUBS", idtmed[1123], ptubs, 5);
275   gMC->Gspos("CMO3", 1, "CMO1", 70, 40-AliACORDEConstants::Instance()->Depth()/2, -1900 - ptubs[2], 0, "MANY");
276
277   // A big block above the RB24/26 wall. OK
278   pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
279   pbox[1] = (AliACORDEConstants::Instance()->Depth() - 220 - 1600)/2;
280   pbox[2] = 2987.7/2 - 1100/4 - concreteWidth/2;
281   gMC->Gsvolu("CMO4", "BOX", idtmed[1123], pbox, 3);
282   gMC->Gspos("CMO4", 1, "CMO1", 0, AliACORDEConstants::Instance()->Depth()/2 - pbox[1], -1900 - pbox[2], 0, "MANY");
283   // Small blocks below the volume CMO4 on both sides of the wall RB24/26. OK
284   pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) -
285 ptubs[0])/2;
286   pbox[1] = AliACORDEConstants::Instance()->Depth()/2 - pbox[1];
287   gMC->Gsvolu("CM17", "BOX", idtmed[1123], pbox, 3);
288   gMC->Gspos("CM17", 1, "CMO1", AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - pbox[0], -AliACORDEConstants::Instance()->Depth()/2 + pbox[1], -1900 - pbox[2], 0, "MANY");
289   gMC->Gspos("CM17", 2, "CMO1", -AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad)+ pbox[0], -AliACORDEConstants::Instance()->Depth()/2 + pbox[1], -1900 - pbox[2], 0, "MANY");
290
291   // And a big block of molasse above the hall up to the surface. OK
292   pbox[0] = pm25X - pm25radius;
293   pbox[1] = (AliACORDEConstants::Instance()->Depth()-500-1170)/2;
294   pbox[2] = (1900 + 1150)/2;
295   gMC->Gsvolu("CMO5", "BOX", idtmed[1123], pbox, 3);
296   gMC->Gspos("CMO5", 1, "CMO1", 0,AliACORDEConstants::Instance()->Depth()/2-pbox[1], pbox[2]-1900, 0, "MANY");
297   // Small blocks of molasse betwen the blocks CMO2, CMO5 and PM25. Ok
298   pbox[0] = (pm25X - pm25radius - 1170)/2;
299   pbox[1] = 1000;
300   gMC->Gsvolu("CM16", "BOX", idtmed[1123], pbox, 3);
301   gMC->Gspos("CM16", 1, "CMO1", 1170 + pbox[0], -AliACORDEConstants::Instance()->Depth()/2+pbox[1], pbox[2] - 1900, 0, "MANY");
302
303   // Molasse around the shafts.
304   AliMatrix(idrotm[2003], 0, 0, 90, 0, 90, 90);
305   // Around the PX24, the open section. OK
306   ptubs[0] = px24radius + concreteWidth;
307   ptubs[1] = ptubs[0] + 1000;
308   ptubs[2] = (2300 - (5150 - AliACORDEConstants::Instance()->Depth()))/2;
309   ptubs[3] = 180 + kRaddeg*TMath::ASin(1070/ptubs[0]);
310   ptubs[4] = 180 -  kRaddeg*TMath::ASin(1070/ptubs[0]);
311   gMC->Gsvolu("CMO6", "TUBS", idtmed[1123], ptubs, 5);
312   gMC->Gspos("CMO6", 1, "CMO1", px24X, ptubs[2] - AliACORDEConstants::Instance()->Depth()/2, px24Z, idrotm[2003], "MANY");
313   // Around the PX24, the closed section. OK
314   Float_t ptube[3];
315   ptube[0] = px24radius + concreteWidth;
316   ptube[1] = ptube[0] + 1000;
317   ptube[2] = (5150 - 2300)/2;
318   gMC->Gsvolu("CMO7", "TUBE", idtmed[1123], ptube, 3);
319   gMC->Gspos("CMO7", 1, "CMO1", px24X, AliACORDEConstants::Instance()->Depth()/2 - ptube[2], px24Z, idrotm[2003], "MANY");
320
321   // Around PM25. OK
322   ptube[0] = pm25radius + concreteWidth;
323   ptube[1] = ptube[0] + 400;
324   ptube[2] = AliACORDEConstants::Instance()->Depth()/2;
325   gMC->Gsvolu("CMO8", "TUBE", idtmed[1123], ptube, 3);
326   gMC->Gspos("CMO8", 1, "CMO1", pm25X, 0, pm25Z, idrotm[2003], "MANY");
327   // On both sides of the PM25 along the HALL.
328   pbox[0] = (2100 + pm25radius - 1170)/2;
329   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
330   pbox[2] = (3*px24radius - pm25radius)/2;
331   gMC->Gsvolu("CM18", "BOX", idtmed[1123], pbox, 3);
332   gMC->Gspos("CM18", 1, "CMO1", 2100, 0, pbox[2] + pm25radius, 0, "MANY");
333
334   pbox[2] = (1900 - pm25radius)/2;
335   gMC->Gsvolu("CM19", "BOX", idtmed[1123], pbox, 3);
336   gMC->Gspos("CM19", 1, "CMO1", 2100, 0, -pbox[2] - pm25radius, 0, "MANY");
337
338   // Around the PGC2. OK
339   ptube[0] = pgc2radius + concreteWidth;
340   ptube[1] = 2987.7 - 740;
341   ptube[2] = AliACORDEConstants::Instance()->Depth()/2;
342   gMC->Gsvolu("CMO9", "TUBE", idtmed[1123], ptube, 3);
343   gMC->Gspos("CMO9", 1, "CMO1", pgc2X, 0, pgc2Z, idrotm[2003], "MANY");
344
345   // On both sides of the PGC2.OK
346   pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) -
347 1100 - 375)/2;
348   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
349   pbox[2] = pgc2radius + concreteWidth;
350   gMC->Gsvolu("CM10", "BOX", idtmed[1123], pbox, 3);
351   gMC->Gspos("CM10", 1, "CMO1", AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - pbox[0], 0, pgc2Z, 0, "MANY");
352   gMC->Gspos("CM10", 2, "CMO1", -AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) + pbox[0], 0, pgc2Z, 0, "MANY");
353
354   // big block of molasse behind the PX24. OK
355   pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
356   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
357   pbox[2] = (pbox[0] - (2300 + 1150 + 100))/2;
358   gMC->Gsvolu("CM12", "BOX", idtmed[1123], pbox, 3);
359   gMC->Gspos("CM12", 1, "CMO1", px24X, 0, px24Z + px24radius + concreteWidth + pbox[2], 0, "MANY");
360
361   // big block of molasse in the opposite side of the PM25. OK
362   pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) -
363 1150)/2;
364   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
365   pbox[2] = (1900 + 2300 + 1150)/2;
366   gMC->Gsvolu("CM13", "BOX", idtmed[1123], pbox, 3);
367   gMC->Gspos("CM13", 1, "CMO1", -1150 - pbox[0], 0, pbox[2] - 1900, 0, "MANY");
368
369   // big block of molasse behind the PM25. OK
370   pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) -
371 (2100 + 910/2 + 100))/2;
372   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
373   pbox[2] = (1900 + 2300 + 1150)/2;
374   gMC->Gsvolu("CM14", "BOX", idtmed[1123], pbox, 3);
375   gMC->Gspos("CM14", 1, "CMO1", pm25X + pm25radius + concreteWidth + pbox[0], 0, pbox[2] - 1900, 0, "MANY");
376
377   // big block of molasse behind the PGC2. OK
378   pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
379   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
380   pbox[2] = (pbox[0] - (2987.7 + 1900 + 1100/2 + 100))/2;
381   gMC->Gsvolu("CM15", "BOX", idtmed[1123], pbox, 3);
382   gMC->Gspos("CM15", 1, "CMO1", 0, 0, -pbox[0] + pbox[2], 0, "MANY");
383
384   gMC->Gspos("CMO1",1,"ACORDE",0,AliACORDEConstants::Instance()->Depth()/2,0,0,"MANY");
385
386 }
387
388 void AliACORDEv0::CreateAcorde()
389 {
390   //
391   // Create geometry for the ACORDE array
392   // done in two main steps
393   //  1.- definition of the modules
394   //  2.- placement of the modules
395   //
396   Int_t  idrotm[2499];    // The rotation matrix.
397   Int_t* idtmed = fIdtmed->GetArray() - 1099;
398   AliACORDEConstants* constants = AliACORDEConstants::Instance();
399   Float_t box[3];
400   Float_t placed_at;
401   Float_t placed_at2;
402   Float_t small = 0.05; // to separate slightly some volumes
403                         // by half a mm so that they do not overlap
404
405
406   // 1.- Definition of a module
407   // *  ACORDE1 => volume filled with air, representing a module
408   //               it contains all other volumes defining the module
409   //               there are 60 copies of it
410   // *  ACORDE2 => volume defining one scintillator pad
411   //               there are 2 copies of it per module
412   // *  ACORDE3-6 => volumes representing the Al walls of box
413   //               surrounding the plastic
414   //               3: long wall, 2 copies (front, back)
415   //               4: end caps, 2 copies (left, right)
416   //               5: long stripe to model the profile 
417   //                  4 copies (upper front and back, lower)
418   //               6: short stripe to model the profile
419   //                  4 copies (upper left, right; lower)
420
421   // The full module volume.
422   // This volume will be ocupied by all the material of the module
423   // the scintillators, the aluminium frame, etc.
424   box[0] = constants->ModuleLength()/2;
425   box[1] = constants->ModuleHeight()/2;
426   box[2] = constants->ModuleWidth()/2;
427   gMC->Gsvolu("ACORDE1", "BOX", idtmed[1114], box, 3);
428
429   // The scintillators
430   box[0] = constants->PlasticLength()/2;
431   box[1] = constants->PlasticHeight()/2;
432   box[2] = constants->PlasticWidth()/2;
433   gMC->Gsvolu("ACORDE2", "BOX", idtmed[1112], box, 3);
434
435   // it is important to keep this order for easy assignment of 
436   // a volume to a physical module:
437   placed_at = box[1]+constants->ProfileThickness()
438     - constants->ModuleHeight()/2+small;
439   gMC->Gspos("ACORDE2", 1, "ACORDE1", 0, placed_at, 0, 0, "MANY");
440   placed_at = placed_at + 2.0*box[1]+small;
441   gMC->Gspos("ACORDE2", 2, "ACORDE1", 0, placed_at, 0, 0, "MANY");
442
443
444   // The metallic frame: long walls of box
445   // back,front,left,right, defined looking
446   // from the + z diraction into alice; i.e.
447   // back ==> z<0, front ==> z>0
448   // left ==> x<0, right ==> x>0
449   // up ==> increasing y, down ==> decreasing y
450   box[0] = constants->ModuleLength()/2;
451   box[1] = constants->ModuleHeight()/2;
452   box[2] = constants->ProfileThickness()/2.0; 
453   gMC->Gsvolu("ACORDE3", "BOX", idtmed[1108], box, 3);
454   // front wall
455   placed_at = constants->ModuleWidth()/2-constants->ProfileThickness()/2.0;
456   gMC->Gspos("ACORDE3", 1, "ACORDE1", 0, 0, placed_at, 0, "MANY");
457   // back wall
458   gMC->Gspos("ACORDE3", 2, "ACORDE1", 0, 0, -placed_at , 0, "MANY");
459
460   // The metallic frame: end caps
461   box[0] = constants->ProfileThickness()/2.0;
462   box[1] = constants->ModuleHeight()/2;
463   box[2] = constants->ModuleWidth()/2;
464   gMC->Gsvolu("ACORDE4", "BOX", idtmed[1108], box, 3);
465   // right cap
466   placed_at = constants->ModuleLength()/2-constants->ProfileThickness()/2.0;
467   gMC->Gspos("ACORDE4", 1, "ACORDE1", placed_at, 0, 0, 0, "MANY");
468   // left cap
469   gMC->Gspos("ACORDE4", 2, "ACORDE1", -placed_at, 0, 0, 0, "MANY");
470
471   // The metallic frame: the profile, long stripes
472   box[0] = constants->ModuleLength()/2.0;
473   box[1] = constants->ProfileThickness()/2;
474   box[2] = constants->ProfileWidth()/2;
475   gMC->Gsvolu("ACORDE5", "BOX", idtmed[1108], box, 3);
476   // upper front
477   placed_at = constants->ModuleHeight()/2-box[1];
478   placed_at2 = constants->ModuleWidth()/2-
479     constants->ProfileThickness()-box[2];
480   gMC->Gspos("ACORDE5", 1, "ACORDE1",0,placed_at,placed_at2, 0, "MANY");
481   // upper back
482   gMC->Gspos("ACORDE5", 2, "ACORDE1",0,placed_at,-placed_at2, 0, "MANY");
483   // lower front
484   gMC->Gspos("ACORDE5", 3, "ACORDE1",0,-placed_at,placed_at2, 0, "MANY");
485   // lower back
486   gMC->Gspos("ACORDE5", 4, "ACORDE1",0,-placed_at,-placed_at2, 0, "MANY");
487
488   // The metallic frame: the profile, long stripes
489   box[0] = constants->ProfileWidth()/2.0;
490   box[1] = constants->ProfileThickness()/2;
491   box[2] = constants->ModuleWidth()/2-constants->ProfileWidth();
492   gMC->Gsvolu("ACORDE6", "BOX", idtmed[1108], box, 3);
493   // upper right
494   placed_at = constants->ModuleHeight()/2-box[1];
495   placed_at2 = constants->ModuleLength()/2-
496     constants->ProfileThickness()-box[0];
497   gMC->Gspos("ACORDE6", 1, "ACORDE1",placed_at2,placed_at,0, 0, "MANY");
498   // upper left
499   gMC->Gspos("ACORDE6", 2, "ACORDE1",-placed_at2,placed_at,0, 0, "MANY");
500   // lower right
501   gMC->Gspos("ACORDE6", 3, "ACORDE1",placed_at2,-placed_at,0, 0, "MANY");
502   // lower left
503   gMC->Gspos("ACORDE6", 4, "ACORDE1",-placed_at2,-placed_at,0, 0, "MANY");
504
505   // End of MODULE definition
506
507   ////////////////////////////////////////////////////////////////////
508   ////////////////////////////////////////////////////////////////////
509
510   // 2.- placement of the module
511   // Now put all of them in the right position in 
512   // master volume ALIC
513
514   // rotation matrices (see Geant manual for conventions)
515   // for columns 4 and 5
516   AliMatrix(idrotm[231], 90, 45, 90, 135, 0, 0);
517   // for columns 0 and 1
518   AliMatrix(idrotm[232], 90, 315, 90, 45, 0, 0);
519
520   // place each one of the 6 columns in turn
521   // for the first and the last column the position
522   // of the two last modules depends on the value 
523   // of the fITSGeometry variable
524
525   // it is important to keep this order because
526   // the copy number defines the module!
527
528   // first column, except first and last  modules
529   for (Int_t copy = 2; copy < 10; copy++)
530     gMC->Gspos("ACORDE1",copy,"ALIC",
531                constants->ModulePositionX(copy-1),
532                constants->ModulePositionY(copy-1),
533                constants->ModulePositionZ(copy-1),
534                idrotm[232], "MANY");
535   // second column
536   for (Int_t copy = 11; copy < 21; copy++)
537     gMC->Gspos("ACORDE1",copy,"ALIC",
538                constants->ModulePositionX(copy-1),
539                constants->ModulePositionY(copy-1),
540                constants->ModulePositionZ(copy-1),
541                idrotm[232], "MANY");
542   // third and fourth columns
543   for (Int_t copy = 21; copy < 41; copy++)
544     gMC->Gspos("ACORDE1",copy,"ALIC",
545                constants->ModulePositionX(copy-1),
546                constants->ModulePositionY(copy-1),
547                constants->ModulePositionZ(copy-1),
548                0, "MANY");
549   // fifth column
550   for (Int_t copy = 41; copy < 51; copy++)
551     gMC->Gspos("ACORDE1",copy,"ALIC",
552                constants->ModulePositionX(copy-1),
553                constants->ModulePositionY(copy-1),
554                constants->ModulePositionZ(copy-1),
555                idrotm[231], "MANY");
556   // last column, except first and last  modules
557   for (Int_t copy = 52; copy < 60; copy++)
558     gMC->Gspos("ACORDE1",copy,"ALIC",
559                constants->ModulePositionX(copy-1),
560                constants->ModulePositionY(copy-1),
561                constants->ModulePositionZ(copy-1),
562                idrotm[231], "MANY");
563   // the last four modules
564   if (GetITSGeometry()) {
565     gMC->Gspos("ACORDE1",1,"ALIC",
566                constants->ExtraModulePositionX(),
567                constants->ExtraModulePositionY(),
568                constants->ExtraModulePositionZ(0),
569                0, "MANY");  
570     gMC->Gspos("ACORDE1",10,"ALIC",
571                constants->ExtraModulePositionX(),
572                constants->ExtraModulePositionY(),
573                constants->ExtraModulePositionZ(1),
574                0, "MANY");  
575     gMC->Gspos("ACORDE1",51,"ALIC",
576                constants->ExtraModulePositionX(),
577                constants->ExtraModulePositionY(),
578                constants->ExtraModulePositionZ(2),
579                0, "MANY");  
580     gMC->Gspos("ACORDE1",60,"ALIC",
581                constants->ExtraModulePositionX(),
582                constants->ExtraModulePositionY(),
583                constants->ExtraModulePositionZ(3),
584                0, "MANY");  
585   } else {
586     gMC->Gspos("ACORDE1",1,"ALIC",
587                constants->ModulePositionX(0),
588                constants->ModulePositionY(0),
589                constants->ModulePositionZ(0),
590                idrotm[232], "MANY");
591     gMC->Gspos("ACORDE1",10,"ALIC",
592                constants->ModulePositionX(9),
593                constants->ModulePositionY(9),
594                constants->ModulePositionZ(9),
595                idrotm[232], "MANY");
596     gMC->Gspos("ACORDE1",51,"ALIC",
597                constants->ModulePositionX(50),
598                constants->ModulePositionY(50),
599                constants->ModulePositionZ(50),
600                idrotm[231], "MANY");
601     gMC->Gspos("ACORDE1",60,"ALIC",
602                constants->ModulePositionX(59),
603                constants->ModulePositionY(59),
604                constants->ModulePositionZ(59),
605                idrotm[231], "MANY");
606   } // end if (fITSGeometry)
607
608 }
609 //_____________________________________________________________________________
610 void AliACORDEv0::DrawDetector() const
611 {
612
613   // not needed anymore
614
615 }
616
617 //____________________________________________________________________________
618
619 void AliACORDEv0::Init()
620 {
621   // Initialise L3 magnet after it has been built
622   Int_t i;
623   if(AliLog::GetGlobalDebugLevel()>0) {
624     printf("\n%s: ",ClassName());
625     for(i=0;i<35;i++) printf("*");
626     printf(" ACORDEv0_INIT ");
627     for(i=0;i<35;i++) printf("*");
628     printf("\n%s: ",ClassName());
629     // Here the ACORDEv initialisation code (if any!)
630     for(i=0;i<80;i++) printf("*");
631     printf("\n");
632   }
633  // AliACORDE::Init();  
634 }
635 //____________________________________________________________________________
636 void AliACORDEv0::StepManager()
637 {
638   //
639   // Called for every step in the Cosmic Ray Trigger
640   //
641
642
643   // volume: 
644   //  [0] = module number 1-60 (1==>(0-0), 60 (5-9)
645   //  [1] = Plastic number: 0 (down) to 1 (up)
646   static Int_t   vol[2]; 
647   //
648   // hit
649   // [0] = PID
650   // [1-3] = x, y, z 
651   // [4] = time 
652   // [5-7] = px, py, pz
653   // [8] = energy 
654   // [9] = energy loss
655   // [10] = length of track through plastic
656   static Float_t hits[11];
657
658   // local static variables
659   static Float_t eloss;
660   static Float_t step;
661   // scintillator volume
662   static Int_t idScint = gMC->VolId("ACORDE2");
663
664   // local variables
665   Int_t copy;
666   TLorentzVector pos;
667   TLorentzVector mom;
668
669   // only charged tracks
670   if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return;
671
672   // only in sensitive material
673   if (gMC->CurrentVolID(copy) == idScint) {
674     step  += gMC->TrackStep();
675     eloss += gMC->Edep();
676     // set all hit variables except eloss which is resetted
677     // set volume variables
678     if (gMC->IsTrackEntering()) {
679       eloss = 0.0;
680       step = 0.0;
681       gMC->TrackPosition(pos);
682       gMC->TrackMomentum(mom);
683       // hit
684       // [0] = PID
685       // [1-3] = x, y, z 
686       // [4] = time 
687       // [5-7] = px, py, pz
688       // [8] = energy 
689       // [9] = energy loss
690       hits[0]  = (Float_t ) gMC->TrackPid(); 
691       hits[1] = pos[0]; 
692       hits[2] = pos[1]; 
693       hits[3] = pos[2]; 
694       hits[4] = gMC->TrackTime();
695       hits[5] = mom[0]; 
696       hits[6] = mom[1]; 
697       hits[7] = mom[2]; 
698       hits[8] = gMC->Etot();
699       // volume: 
700       //  [0] = module number 1-60 (1==>(0-0), 60 (5-9)
701       //  [1] = Plastic number: 0 (down) to 1 (up)
702       Int_t copyPlastic; // plastic: down=1, up=2
703       Int_t copyModule; // module: 1-60
704       gMC->CurrentVolID(copyPlastic);
705       gMC->CurrentVolOffID(1, copyModule);
706       // module
707       vol[0] = copyModule;
708       // plastic: 0 = down, 1 = up
709       vol[1] = copyPlastic;
710     } // end if gMC->IsTrackEntering()
711
712     // set hit[9] = total energy loss and book hit
713     if( gMC->IsTrackExiting() || 
714         gMC->IsTrackStop() || 
715         gMC->IsTrackDisappeared()){
716       hits[9] = eloss;
717       hits[10] = step;
718       eloss = 0.0;
719       step = 0.0;
720       AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits);
721     }
722   } // end if in scintillator
723
724 }
725
726 //_____________________________________________________________________________
727 void AliACORDEv0::AddHit(Int_t track, Int_t *vol, Float_t *hits)
728 {
729   //
730   // Add a ACORDE hit
731   //
732   TClonesArray &lhits = *fHits;
733   new(lhits[fNhits++]) AliACORDEhit(fIshunt,track,vol,hits);
734 }
735