]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ACORDE/AliACORDEv1.cxx
Fixing the decoding of regional header bits.
[u/mrichter/AliRoot.git] / ACORDE / AliACORDEv1.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: AliACORDEv1.cxx,v 1.2 2007/12/03 08:40:00 hristov Exp $ */
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 (position and momentum)  //
25 //                                                                           //
26 //                  Send comments to:                                        //
27 //                                                                           //
28 //      Arturo Fernandez Tellez         <afernand@fcfm.buap.mx>              //
29 //      Eleazar Cuautle Flores          <ecuautle@nucleares.unam.mx>         //
30 //      Mario Rodriguez Cahuantzi       <mrodrigu@mail.cern.ch>              // 
31 //                                                                           //
32 //                      Puebla, Pue. Mexico December 2007                    //
33 //                                                                           //
34 //      Last Update: June 28th 2008                                          //
35 ///////////////////////////////////////////////////////////////////////////////
36
37
38 //
39 #include <Riostream.h>
40 #include <TGeoMatrix.h>
41 #include <TGeometry.h>
42 #include <TMath.h>
43 //#include <TNode.h>
44 #include <TTUBE.h>
45 //#include <TVirtualMC.h>
46 #include <TString.h>
47 #include <TSystem.h>
48
49 #include "AliConst.h"
50 #include "AliRun.h"
51
52 #include "TGeoManager.h"
53 #include "TGeoVolume.h"
54 #include "TGeoPcon.h"
55 //#include "TGeoTube.h"
56 #include "TGeoPgon.h"
57 #include "TGeoTrd1.h"
58 #include "TGeoCompositeShape.h"
59 #include "TGeoPara.h"
60 //
61
62 #include "AliACORDEv1.h"
63 #include <TClonesArray.h>
64 #include <TLorentzVector.h>
65 #include <TVirtualMC.h>
66 #include <TPDGCode.h>
67 //#include <TGeometry.h>
68 #include <TBRIK.h>
69 #include <TNode.h>
70  
71
72 #include "AliRun.h"
73 #include "AliConst.h"
74 #include "AliACORDEhit.h"
75 #include "AliACORDEConstants.h"
76 #include "AliMC.h"
77 #include "AliLog.h"
78
79 ClassImp(AliACORDEv1)
80  
81 //_____________________________________________________________________________
82 AliACORDEv1::AliACORDEv1()
83   : AliACORDE()
84 {
85   //
86   // Default constructor
87   fIshunt = 0;
88   fHits = 0;
89   //
90
91 //_____________________________________________________________________________
92 AliACORDEv1::AliACORDEv1(const char *name, const char *title)
93   : AliACORDE(name, title)
94 {
95   //
96   // Standard constructor
97   //
98   fIshunt = 1; // All hits are associated with primary particles 
99   fHits =  new TClonesArray("AliACORDEhit",400);
100   gAlice->GetMCApp()->AddHitList(fHits);
101 }
102 //_____________________________________________________________________________
103 AliACORDEv1::~AliACORDEv1()
104 {
105   //
106   // Default destructor
107   //
108 }
109 //_____________________________________________________________________________
110 void AliACORDEv1::BuildGeometry()
111 {
112
113   // not needed anymore
114
115 }
116
117 //_____________________________________________________________________________
118 void AliACORDEv1::CreateGeometry()
119 {
120   CreateAcorde();
121   if (GetCreateCavern()) CreateCavern();
122 }
123
124
125 void AliACORDEv1::CreateCavern()
126 {
127
128         // Create the mother volume, the one which contain all the material
129         //above the hall
130
131         TGeoManager *acorde = new TGeoManager("ACORDE", "Geometry of ACORDE");  
132
133         //---> define some materials
134
135         TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0);
136
137         //---> define some media
138
139         TGeoMedium *vacuum = new TGeoMedium("Vacuum",1, matVacuum);
140
141         //---> define the measures
142
143         Double_t dx1 = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
144         Double_t dy1 = AliACORDEConstants::Instance()->Depth();
145         Double_t dz1 = dx1;
146
147         //---> define the box for the mother volume
148
149         TGeoVolume *aCORDE = acorde->MakeBox("ACORDE", vacuum, dx1, dy1, dz1);
150         acorde->SetTopVolume(aCORDE);
151
152         //---> create shafts&molasse
153
154         CreateShafts();
155         CreateMolasse();
156 }
157
158
159 void AliACORDEv1::CreateShafts()
160 {
161
162         //---> This shaft is composes by an open tube down in the hall
163         //---> and a cilinder above the level of the celling
164         //---> Every structure relative to the shaft will be put into this volume
165
166
167         TGeoManager *acorde = new TGeoManager("ACORDE2007", "Geometry of ACORDE");      
168
169         //---> define some materials
170
171         TGeoMaterial *matVacuum = new TGeoMaterial("Al", 0,0,0);
172
173         //---> define some media
174
175         TGeoMedium *vacuum = new TGeoMedium("Vacuum",1, matVacuum);
176         TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7);
177         TGeoMedium *al = new TGeoMedium("Root Material",2, matAl);
178         
179         
180         //---> Access to shafts
181         //---> define the Matrix Rotation&other variables
182
183         TGeoRotation *rot1 = new TGeoRotation("rot1", 0.0, 0.0, 90.0, 0.0, 90.0, 90.0);
184         
185         Float_t ptube[5];
186         ptube[0]=0;
187         ptube[1]=1250;
188         ptube[2]=5150/2;
189         ptube[3]=360;
190         ptube[4]=360;
191         
192         Float_t ptubs[5];
193
194         //---> The open section of the PX24
195         ptubs[0] = 1150; //---> Inner radius
196         ptubs[1] = 1250; //---> Outer radius
197         ptubs[2] = 1300; //---> Half length
198         ptubs[3] = 180 + kRaddeg*TMath::ASin(1070/ptubs[0]); //---> starting angle
199         ptubs[4] = 180 -  kRaddeg*TMath::ASin(1070/ptubs[0]);
200                 
201         //---> Set position for the tubes 
202
203         TGeoTranslation *tr2 = new TGeoTranslation(0,0,-ptube[2]+ptubs[2]);
204
205         //---> define the cilinders to hold the main structure in the shaft
206
207         TGeoVolume *o = acorde->MakeBox("O", vacuum, 25., 25., 5.);
208         TGeoVolume *cSF1 = acorde->MakeTubs("CSF1",al,ptube[0],ptube[1],ptube[2],ptube[3],ptube[4]);
209         TGeoVolume *cSF2 = acorde->MakeTubs("CSF2",al,ptubs[0],ptubs[1],ptubs[2],ptubs[3],ptubs[4]);
210         o->AddNode(cSF1, 1);
211         cSF1->AddNode(cSF2,1,tr2);
212
213         //---> definition of the other part of the shaft
214
215         ptube[0] = ptubs[0]; // Inner radius
216         ptube[1] = ptubs[1]; // Outer radius
217         ptube[2] = 5150/2 - ptubs[2]; // Half lenght
218         TGeoVolume *cSF3 = acorde->MakeTubs("CSF3",al,ptubs[0],ptubs[1],ptubs[2],ptubs[3],ptubs[4]);
219         TGeoTranslation *tr3 = new TGeoTranslation(0,0,5150/2-ptube[2]);
220         cSF1->AddNode(cSF3,1,tr3);
221
222         //---> define concrete walls along the shaft (next to the elevator)
223         
224         Float_t pbox[3];
225         pbox[0]=480/2;
226         pbox[1]=120/2;
227         pbox[2]=5150/2;
228         TGeoVolume *cSW1 = acorde->MakeBox("CSW1",vacuum,pbox[0],pbox[1],pbox[2]);
229         TGeoTranslation *br1 = new TGeoTranslation(820+pbox[0],150+pbox[1],0);
230         TGeoTranslation *br1a = new TGeoTranslation(820+pbox[0],-300-pbox[1],0);
231         cSF1->AddNode(cSW1,1,br1);
232         cSF1->AddNode(cSW1,1,br1a);
233
234         pbox[0] = 120/2;  // Half length in X
235         pbox[1] = 750/2;  // Half length in Y
236         pbox[2] = 5150/2; // Half length in Z
237         TGeoVolume *cSW2 = acorde->MakeBox("CSW2",vacuum,pbox[0],pbox[1],pbox[2]);
238         TGeoTranslation *br2 = new TGeoTranslation(820-60,150+pbox[1],0);
239         cSF1->AddNode(cSW2,1,br2);
240
241
242         pbox[0] = 120/2;  // Half length in X
243         pbox[1] = 600/2;  // Half lenght in Y
244         pbox[2] = 5150/2; // Half length in Z
245         TGeoVolume *cSW3 = acorde->MakeBox("CSW3",vacuum,pbox[0],pbox[1],pbox[2]);
246         TGeoTranslation *br3 = new TGeoTranslation(820-60,-300-pbox[1],0);
247         cSF1->AddNode(cSW3,1,br3);
248
249         pbox[0] = 400/2;  // Half length in X
250         pbox[1] = 2300/2;  // Half lenght in Y
251         pbox[2] = 300/2; // Half length in Z
252         TGeoVolume *cSW4 = acorde->MakeBox("CSW4",vacuum,pbox[0],pbox[1],pbox[2]);
253         TGeoTranslation *br4 = new TGeoTranslation(pbox[1]-pbox[0],0,3000-5150/2-pbox[2]);
254         cSF1->AddNode(cSW4,1,br4);
255
256
257         pbox[0] = 1400/2;  // Half length in X
258         pbox[1] = 2300/2;  // Half lenght in Y
259         pbox[2] = 170/2; // Half length in Z
260         TGeoVolume *cSW5 = acorde->MakeBox("CSW5",vacuum,pbox[0],pbox[1],pbox[2]);
261         TGeoTranslation *br5 = new TGeoTranslation(0,0,3000-5150/2-130);
262         cSF1->AddNode(cSW5,1,br5);
263
264
265         pbox[0] = 170/2;  // Half length in X
266         pbox[1] = 2300/2;  // Half lenght in Y
267         pbox[2] = 300/2; // Half length in Z
268         TGeoVolume *cSW6 = acorde->MakeBox("CSW6",vacuum,pbox[0],pbox[1],pbox[2]);
269         TGeoTranslation *br6 = new TGeoTranslation(-1400/2-pbox[0],0,3000-5150/2-pbox[2]);
270         cSF1->AddNode(cSW6,1,br6);
271
272
273         pbox[0] = 100/2;  // Half length in X
274         pbox[1] = 2300/2;  // Half lenght in Y
275         pbox[2] = 450/2; // Half length in Z
276         TGeoVolume *cSW7 = acorde->MakeBox("CSW7",vacuum,pbox[0],pbox[1],pbox[2]);
277         TGeoTranslation *br7 = new TGeoTranslation(-1400/2-170-pbox[0],0,3000-5150/2+pbox[2]);
278         cSF1->AddNode(cSW7,1,br7);
279
280
281         pbox[0] = 300/2;  // Half length in X
282         pbox[1] = 2300/2;  // Half lenght in Y
283         pbox[2] = 170/2; // Half length in Z
284         TGeoVolume *cSW8 = acorde->MakeBox("CSW8",vacuum,pbox[0],pbox[1],pbox[2]);
285         TGeoTranslation *br8 = new TGeoTranslation(-2300/2+pbox[0],0,2500-5150/2);
286         cSF1->AddNode(cSW8,1,br8);
287
288         //---> put the shaft into the mother volume
289
290         TGeoCombiTrans *br = new TGeoCombiTrans(0,AliACORDEConstants::Instance()->Depth()-5150/2,2300,rot1);
291         cSF1->AddNode(cSF1,1,br);
292
293
294         //---> PM25 Access Shafts
295
296         ptube[0]=910/2;
297         ptube[1]=ptube[0]+100;
298         ptube[2]=(5150-1166)/2;
299         TGeoVolume *cSF4 = acorde->MakeTubs("CSF4",vacuum,pbox[0],pbox[1],pbox[2],360,360);
300         TGeoCombiTrans *tr4 = new TGeoCombiTrans(2100,AliACORDEConstants::Instance()->Depth()-ptube[2],0,rot1);
301         cSF4->AddNode(cSF4,1,tr4);
302
303
304         //---> PGC2 Access shaft
305
306         ptube[0]=1100/2;
307         ptube[1]=ptube[0]+100;
308         ptube[2]=(5150-690)/2;
309         TGeoVolume *cSF5 = acorde->MakeTubs("CSF5",vacuum,pbox[0],pbox[1],pbox[2],360,360);
310         TGeoCombiTrans *tr5 = new TGeoCombiTrans(-375,AliACORDEConstants::Instance()->Depth()-ptube[2],-1900-2987.7,rot1);
311         cSF5->AddNode(cSF5,1,tr5);
312
313 }
314
315
316 void AliACORDEv1::CreateMolasse()
317
318 {
319         // create a big molasse for ACORDE detector
320         TGeoManager *acorde = new TGeoManager("ACORDE2007", "Geometry of ACORDE");      
321
322         //---> define some media
323         
324
325         TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7);
326         TGeoMedium *vacuum = new TGeoMedium("Root Material",2, matAl);
327
328         Float_t px24radius = 2300/2;
329         Float_t px24X = 0;
330         Float_t px24Z = 2300;
331         Float_t pm25radius = 910/2;
332         Float_t pm25X = 2100;
333         Float_t pm25Z = 0;
334         Float_t pgc2radius = 1100/2;
335         Float_t pgc2X = -375;
336         Float_t pgc2Z = -(1900 + 2987.7);
337         Float_t concreteWidth = 100; //---> Standard width of the hall walls.
338
339
340         //---> Create a local mother volume.
341         Float_t pbox[3];
342         pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
343         pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
344         pbox[2] = pbox[0];
345         TGeoVolume *cM01 = acorde->MakeBox("CM01", vacuum, pbox[0],pbox[1],pbox[2]);
346
347         //---> Now put the molasse exactly above the hall. OK
348         //---> Above the ceiling
349         
350         Float_t ptubs[5];
351         ptubs[0] = 1170;
352         ptubs[1] = 2100 - pm25radius;
353         ptubs[2] = 1900/2 + px24radius;
354         ptubs[3] = 0;
355         ptubs[4] = 180;
356         TGeoVolume *cM02 = acorde->MakeTubs("CM02",vacuum,ptubs[0],ptubs[1],ptubs[2],ptubs[3],ptubs[4]);
357         TGeoTranslation *tr2 = new TGeoTranslation(0,500-AliACORDEConstants::Instance()->Depth()/2,ptubs[2]-1900);
358         cM01->AddNode(cM02,1,tr2);
359
360
361         //---> Molasse around the RB24/26 Wall. OK
362
363         ptubs[0] = 220 + 1600;
364         ptubs[1] = AliACORDEConstants::Instance()->Depth() - ptubs[0];
365         ptubs[2] = 2987.7/2 - 1100/4 - concreteWidth/2;
366         ptubs[3] = 0;
367         ptubs[4] = 180;
368         TGeoVolume *cM03 = acorde->MakeTubs("CM03",vacuum,ptubs[0],ptubs[1],ptubs[2],ptubs[3],ptubs[4]);
369         TGeoTranslation *tr3 = new TGeoTranslation(70,40-AliACORDEConstants::Instance()->Depth()/2,-ptubs[2]-1900);
370         cM01->AddNode(cM03,1,tr3);
371
372
373         //---> A big block above the RB24/26 wall. OK
374
375         pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
376         pbox[1] = (AliACORDEConstants::Instance()->Depth() - 220 - 1600)/2;
377         pbox[2] = 2987.7/2 - 1100/4 - concreteWidth/2;
378         TGeoVolume *cM04 = acorde->MakeBox("CM04", vacuum, pbox[0],pbox[1],pbox[2]);
379         TGeoTranslation *tr4 = new TGeoTranslation(0,AliACORDEConstants::Instance()->Depth()/2-pbox[1],-1900-pbox[2]);
380         cM01->AddNode(cM04,1,tr4);
381
382
383
384
385         //---> Small blocks below the volume CMO4 on both sides of the wall RB24/26. OK
386
387         pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad)-ptubs[0])/2;
388         pbox[1] = AliACORDEConstants::Instance()->Depth()/2 - pbox[1];
389         TGeoVolume *cM17 = acorde->MakeBox("CM17", vacuum, pbox[0],pbox[1],pbox[2]);
390         TGeoTranslation *tr17 = new TGeoTranslation(AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - pbox[0],-AliACORDEConstants::Instance()->Depth()/2 + pbox[1],-1900 - pbox[2]);
391         TGeoTranslation *tr17a = new TGeoTranslation(-AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad)+ pbox[0],-AliACORDEConstants::Instance()->Depth()/2 + pbox[1], -1900 - pbox[2]);
392         cM01->AddNode(cM17,1,tr17);
393         cM01->AddNode(cM17,2,tr17a);
394
395
396         //---> And a big block of molasse above the hall up to the surface. OK
397
398         pbox[0] = pm25X - pm25radius;
399         pbox[1] = (AliACORDEConstants::Instance()->Depth()-500-1170)/2;
400         pbox[2] = (1900 + 1150)/2;
401         TGeoVolume *cM05 = acorde->MakeBox("CM05", vacuum, pbox[0],pbox[1],pbox[2]);
402         TGeoTranslation *tr5 = new TGeoTranslation(0,AliACORDEConstants::Instance()->Depth()/2-pbox[1], pbox[2]-1900);
403         cM01->AddNode(cM05,1,tr5);
404
405
406         //---> Small blocks of molasse betwen the blocks CMO2, CMO5 and PM25. Ok
407
408         pbox[0] = (pm25X - pm25radius - 1170)/2;
409         pbox[1] = 1000;
410         TGeoVolume *cM16 = acorde->MakeBox("CM16", vacuum, pbox[0],pbox[1],pbox[2]);
411         TGeoTranslation *tr16 = new TGeoTranslation(1170 + pbox[0], -AliACORDEConstants::Instance()->Depth()/2+pbox[1], pbox[2] - 1900);
412         cM01->AddNode(cM16,1,tr16);
413
414
415         //---> Molasse around the shafts.
416
417         TGeoRotation *rot2 = new TGeoRotation("rot1",0, 0, 90, 0, 90, 90 );
418
419         //---> Around the PX24, the open section. OK
420
421         ptubs[0] = px24radius + concreteWidth;
422         ptubs[1] = ptubs[0] + 1000;
423         ptubs[2] = (2300 - (5150 - AliACORDEConstants::Instance()->Depth()))/2;
424         ptubs[3] = 180 + kRaddeg*TMath::ASin(1070/ptubs[0]);
425         ptubs[4] = 180 -  kRaddeg*TMath::ASin(1070/ptubs[0]);
426         TGeoVolume *cM06 = acorde->MakeTubs("CM06", vacuum,ptubs[0],ptubs[1],ptubs[2],ptubs[3],ptubs[4]);
427         TGeoTranslation *tr6 = new TGeoTranslation(px24X, ptubs[2] - AliACORDEConstants::Instance()->Depth()/2, px24Z);
428         cM01->AddNode(cM06,1,tr6);
429
430
431         //---> Around the PX24, the closed section. OK
432
433         Float_t ptube[3];
434         ptube[0] = px24radius + concreteWidth;
435         ptube[1] = ptube[0] + 1000;
436         ptube[2] = (5150 - 2300)/2;
437         TGeoVolume *cM07 = acorde->MakeTubs("CM07", vacuum,ptube[0],ptube[1],ptubs[2],ptube[3],ptube[4]);
438         TGeoTranslation *tr7 = new TGeoTranslation(px24X, AliACORDEConstants::Instance()->Depth()/2-ptube[2], px24Z);
439         cM01->AddNode(cM07,1,tr7);
440
441
442         //---> Around PM25. OK
443
444         ptube[0] = pm25radius + concreteWidth;
445         ptube[1] = ptube[0] + 400;
446         ptube[2] = AliACORDEConstants::Instance()->Depth()/2;
447         TGeoVolume *cM08 = acorde->MakeTubs("CM08", vacuum,ptube[0],ptube[1],ptube[2],ptube[3],ptube[4]);
448         TGeoCombiTrans *tr8 = new TGeoCombiTrans(pm25X, 0, pm25Z,rot2);
449         cM01->AddNode(cM08,1,tr8);
450
451
452         //---> On both sides of the PM25 along the HALL.
453
454         pbox[0] = (2100 + pm25radius - 1170)/2;
455         pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
456         pbox[2] = (3*px24radius - pm25radius)/2;
457         TGeoVolume *cM18 = acorde->MakeBox("CM18",vacuum,pbox[0],pbox[1],pbox[2]);
458         TGeoTranslation *tr18 = new TGeoTranslation(2100, 0, pbox[2] + pm25radius);
459         cM01->AddNode(cM18,1,tr18);
460   
461         pbox[2] = (1900 - pm25radius)/2;
462         TGeoVolume *cM19 = acorde->MakeBox("CM19",vacuum,pbox[0],pbox[1],pbox[2]);
463         TGeoTranslation *tr19 = new TGeoTranslation(2100, 0, -pbox[2] - pm25radius);
464         cM01->AddNode(cM19,1,tr19);
465
466
467         //---> Around the PGC2. OK
468
469         ptube[0] = pgc2radius + concreteWidth;
470         ptube[1] = 2987.7 - 740;
471         ptube[2] = AliACORDEConstants::Instance()->Depth()/2;
472         TGeoVolume *cM09 = acorde->MakeTubs("CM09",vacuum,ptube[0],ptube[1],ptube[2],ptube[3],ptube[4]);
473         TGeoCombiTrans *tr09 = new TGeoCombiTrans(pgc2X, 0, pgc2Z,rot2);
474         cM01->AddNode(cM09,1,tr09);
475
476         //---> On both sides of the PGC2.OK
477
478         pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad)-1100 - 375)/2;
479         pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
480         pbox[2] = pgc2radius + concreteWidth;
481         TGeoVolume *cM10 = acorde->MakeBox("CM10",vacuum,pbox[0],pbox[1],pbox[2]);
482         TGeoTranslation *tr10 = new TGeoTranslation(AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - pbox[0], 0, pgc2Z);
483         TGeoTranslation *tr10a = new TGeoTranslation(-AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) + pbox[0], 0, pgc2Z);
484         cM01->AddNode(cM10,1,tr10);
485         cM01->AddNode(cM10,2,tr10a);
486
487
488         //---> big block of molasse behind the PX24. OK
489
490         pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
491         pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
492         pbox[2] = (pbox[0] - (2300 + 1150 + 100))/2;
493         TGeoVolume *cM12 = acorde->MakeBox("CM12",vacuum,pbox[0],pbox[1],pbox[2]);
494         TGeoTranslation *tr12 = new TGeoTranslation(px24X, 0, px24Z + px24radius + concreteWidth + pbox[2]);    
495         cM01->AddNode(cM12,1,tr12);
496
497
498         //---> big block of molasse in the opposite side of the PM25. OK
499
500         pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad)-1150)/2;
501         pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
502         pbox[2] = (1900 + 2300 + 1150)/2;
503         TGeoVolume *cM13 = acorde->MakeBox("CM13",vacuum,pbox[0],pbox[1],pbox[2]);
504         TGeoTranslation *tr13 = new TGeoTranslation(-1150 - pbox[0], 0, pbox[2] - 1900);        
505         cM01->AddNode(cM13,1,tr13);
506  
507
508         //---> big block of molasse behind the PM25. OK
509
510         pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad)-(2100 + 910/2 + 100))/2;
511         pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
512         pbox[2] = (1900 + 2300 + 1150)/2;
513         TGeoVolume *cM14 = acorde->MakeBox("CM14",vacuum,pbox[0],pbox[1],pbox[2]);
514         TGeoTranslation *tr14 = new TGeoTranslation(pm25X + pm25radius + concreteWidth + pbox[0], 0, pbox[2] - 1900);
515         cM01->AddNode(cM14,1,tr14);
516
517
518         //---> big block of molasse behind the PGC2. OK
519
520         pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
521         pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
522         pbox[2] = (pbox[0] - (2987.7 + 1900 + 1100/2 + 100))/2;
523         TGeoVolume *cM15 = acorde->MakeBox("CM15",vacuum,pbox[0],pbox[1],pbox[2]);
524         TGeoTranslation *tr15 = new TGeoTranslation(0, 0, -pbox[0] + pbox[2]);
525         TGeoTranslation *tr15a = new TGeoTranslation(0,AliACORDEConstants::Instance()->Depth()/2,0);
526         cM01->AddNode(cM15,1,tr15);
527         cM01->AddNode(cM01,1,tr15a);
528
529 }
530
531 void AliACORDEv1::CreateAcorde()
532 {  
533
534
535   //  _______________________________________________________________________________
536   // |                                                                               |  
537   // |                                                                               |  
538   // |  **** Acorde's Geometry using the TGeo Class....January 2008 ****             |
539   // |                                                                               |  
540   // |          ACORDE--> Volume for ACORDE in Alice's Magnet                        |
541   // |          ACORDE1_a--> Volume for frame of Acorde's Module                     |
542   // |          ACORDE10--> Volume for frame of Acorde's Module                      |
543   // |          ACORDE2--> Volume for scintillators in Acorde's Module               |
544   // |          ACORDE7--> Volume for bars                                           |
545   // |          ACORDE7_1--> Volume for side's bars                                  |  
546   // |          ACORDE8--> Volume for supports                                       |  
547   // |          ACORDE9--> Volume for supports                                       |          
548   // |          ACORDE_SUPPORT--> Volume that contains a full Acorde's support       |
549   // |          ALL_ACORDE_MODULES--> Volume that contains ALL Acorde's module       |  
550   // |          ACORDE_MODULE--> Volume that represents ONE Acorde-Module            |
551   // |          ACORDE_1--> Volume that contains the bars&supports in-face           |
552   // |          ACORDE_2--> Volume that contains the bars&supports up-face           |  
553   // |          ACORDE_3--> Volume that contains the bars&supports out-face          |
554   // |                                                                               |  
555   // |_______________________________________________________________________________|
556
557
558         // Call the global constants for the Modules
559         
560         AliACORDEConstants* constants = AliACORDEConstants::Instance();
561
562         // Get the Alice Volume
563
564         TGeoVolume *alice = gGeoManager->GetVolume("ALIC");
565
566         // Define some materials & medium
567
568         //*** Support & Bars***
569
570         TGeoMedium* al    = gGeoManager->GetMedium("ACORDE_ALU_C0");
571         TGeoMedium* med6  = gGeoManager->GetMedium("ACORDE_CPV scint.1");
572         
573         //Define a FULL-ACORDE-VOLUME
574
575         TGeoVolume *aCORDE = new TGeoVolumeAssembly("ACORDE");
576
577
578         // Define 6 master volumes for ACORDE
579         
580         TGeoVolume *inFace = new TGeoVolumeAssembly("ACORDE_1");
581         TGeoVolume *upFace = new TGeoVolumeAssembly("ACORDE_2");
582         TGeoVolume *outFace = new TGeoVolumeAssembly("ACORDE_3");
583         TGeoVolume *modules = new TGeoVolumeAssembly("ALL_ACORDE_MODULES");
584
585         // Define global variables
586
587         Float_t box[3];
588         Int_t count;
589         Float_t dy=10;//-->displacement of the support and bars of ACORDE
590         Float_t dy2=66.5;//-->displacement of the support and bars of ACORDE
591         Float_t placedAt;
592         Float_t small=0.05;
593
594         // Define the position of support and bars for the sides faces
595
596         Float_t des = 22*0.7071;
597   
598         // Define rotation Matrix for Side's faces in Alice
599         
600         TGeoRotation *idrotm231 = new TGeoRotation("idrotm231",90, 45, 90, 135, 0, 0);
601         TGeoRotation *idrotm232 = new TGeoRotation("idrotm232",90, 315, 90, 45, 0, 0);
602
603         // Begin the Geometry of the structure for ACORDE
604
605         // *** Definition of ACORDE's Modules ***
606
607         // Define Measures of ACORDE's Modules
608
609         box[0] = constants->ModuleLength()/2;
610         box[1] = constants->ModuleHeight()/2;
611         box[2] = constants->ModuleWidth()/2;
612
613         // Define Measures of Scintillators
614         
615         Float_t pbox[3];        
616         pbox[0] = constants->PlasticLength()/2;
617         pbox[1] = constants->PlasticHeight()/2;
618         pbox[2] = constants->PlasticWidth()/2;
619
620
621         // Create the Modules, Scintillators & Metallic Frame
622
623         //*** Aluminium frame ***
624
625         TGeoBBox *acorde1 = new TGeoBBox("acorde1",box[0],box[1],26/20+2);
626         TGeoBBox *acorde10 = new TGeoBBox("acorde10",26/20,box[1],box[2]+3);
627         TGeoVolume *aCORDE1qa = new TGeoVolume("ACORDE1_a",acorde1,al);
628         TGeoVolume *aCORDE10 = new TGeoVolume("ACORDE10",acorde10,al);
629
630         //*** Scintillators ***
631
632         TGeoBBox *acorde2 = new TGeoBBox("acorde2",pbox[0],pbox[1],pbox[2]);
633         TGeoVolume *aCORDE2 = new TGeoVolume("ACORDE2",acorde2,med6);
634
635
636         // Here I define & construct a Master Volume ("ACORDE_MODULE") for one Module in ACORDE
637
638         TGeoVolume *acomodule = new TGeoVolumeAssembly("ACORDE_MODULE");
639         acomodule->AddNode(aCORDE1qa,1,new TGeoTranslation("aco1",0,0,13));
640         acomodule->AddNode(aCORDE1qa,2,new TGeoTranslation("aco10",0,0,-13));
641         acomodule->AddNode(aCORDE10,3,new TGeoTranslation("aco10",293/2+5,0,0));
642         acomodule->AddNode(aCORDE10,4,new TGeoTranslation("aco10",-293/2-5,0,0));
643         placedAt = pbox[1]+constants->ProfileThickness()-constants->ModuleHeight()/2+small;
644         acomodule->AddNode(aCORDE2,5,new TGeoTranslation("aco2",placedAt,0,0));
645         placedAt = placedAt + 2.0*pbox[1]+small;
646         acomodule->AddNode(aCORDE2,6,new TGeoTranslation("aco2",placedAt,-1,0));
647         Float_t w1 = 8;
648
649         
650
651
652         // Put the Modules of In-Face
653         
654         count=1;
655         for(Int_t i=1;i<9;i++){
656
657                 Float_t posx = constants->ModulePositionX(i);
658                 Float_t posy = constants->ModulePositionY(i);
659                 Float_t posz = constants->ModulePositionZ(i);   
660                 Int_t moduleElectronicID = constants->ModuleElectronicChannel(i); 
661                 
662                 modules->AddNode(acomodule,moduleElectronicID,
663                         new TGeoCombiTrans("aco01",posx,posy-w1,posz,idrotm232));
664                 count++;
665
666         }
667
668         count=9;
669         for(Int_t i=10;i<20;i++){
670                 Float_t posx = constants->ModulePositionX(i);
671                 Float_t posy = constants->ModulePositionY(i);
672                 Float_t posz = constants->ModulePositionZ(i);
673                 Int_t moduleElectronicID = constants->ModuleElectronicChannel(i);       
674
675                 modules->AddNode(acomodule,moduleElectronicID,
676                         new TGeoCombiTrans("aco01",posx,posy-w1,posz,idrotm232));
677         }
678
679         // Put he Modules of Up-Face
680
681         count=1;
682         for(Int_t i=20;i<40;i++){
683                 Float_t posx = constants->ModulePositionX(i);
684                 Float_t posy = constants->ModulePositionY(i);
685                 Float_t posz = constants->ModulePositionZ(i);   
686                 Int_t moduleElectronicID = constants->ModuleElectronicChannel(i); 
687
688                 modules->AddNode(acomodule,moduleElectronicID,new TGeoTranslation("aco01",posx,posy,posz));
689                 count++;
690         }
691
692         // Put the Modules of Out-Face
693
694         count=1;
695         for(Int_t i=40;i<50;i++){
696                 Float_t posx = constants->ModulePositionX(i);
697                 Float_t posy = constants->ModulePositionY(i);
698                 Float_t posz = constants->ModulePositionZ(i);   
699                 Int_t moduleElectronicID = constants->ModuleElectronicChannel(i); 
700
701                 modules->AddNode(acomodule,moduleElectronicID,
702                         new TGeoCombiTrans("aco01",posx,posy-w1,posz,idrotm231));
703                 count++;
704         }
705
706         // Put the Modules of Out-Face
707
708         count=11;
709         for(Int_t i=51;i<59;i++){
710                 Float_t posx = constants->ModulePositionX(i);
711                 Float_t posy = constants->ModulePositionY(i);
712                 Float_t posz = constants->ModulePositionZ(i);   
713                 Int_t moduleElectronicID = constants->ModuleElectronicChannel(i); 
714
715         if ((i==57) || (i==56))
716                  modules->AddNode(acomodule,moduleElectronicID,
717                                         new TGeoCombiTrans("aco01",posx,posy-w1,posz-w1,idrotm231));
718         else
719                 modules->AddNode(acomodule,moduleElectronicID,
720                         new TGeoCombiTrans("aco01",posx,posy-w1,posz,idrotm231));
721                 count++;
722         }
723
724
725         // Put th Modules ITS-ACORDE
726
727         if (GetITSGeometry()) {
728
729                 modules->AddNode(acomodule,constants->ModuleElectronicChannel(50),new TGeoTranslation("ITS-3",
730                                 constants->ExtraModulePositionX(),
731                                 constants->ExtraModulePositionY(),
732                                 constants->ExtraModulePositionZ(0)));
733
734                 modules->AddNode(acomodule,constants->ModuleElectronicChannel(59),new TGeoTranslation("ITS-4",
735                                 constants->ExtraModulePositionX(),
736                                 constants->ExtraModulePositionY(),
737                                 constants->ExtraModulePositionZ(1)));
738
739                 modules->AddNode(acomodule,constants->ModuleElectronicChannel(0),new TGeoTranslation("ITS-1",
740                                 constants->ExtraModulePositionX(),
741                                 constants->ExtraModulePositionY(),
742                                 constants->ExtraModulePositionZ(2)));
743
744                 modules->AddNode(acomodule,constants->ModuleElectronicChannel(9),new TGeoTranslation("ITS-2",
745                                 constants->ExtraModulePositionX(),
746                                 constants->ExtraModulePositionY(),
747                                 constants->ExtraModulePositionZ(3)));
748
749
750                 } 
751         else {
752
753
754                 modules->AddNode(acomodule,61,new TGeoTranslation("its1",
755                                 constants->ModulePositionX(0),
756                                 constants->ModulePositionY(0),
757                                 constants->ModulePositionZ(0)));
758
759                 modules->AddNode(acomodule,62,new TGeoTranslation("its2",
760                                 constants->ModulePositionX(9),
761                                 constants->ModulePositionY(9),
762                                 constants->ModulePositionZ(9)));
763
764                 modules->AddNode(acomodule,63,new TGeoTranslation("its3",
765                                 constants->ModulePositionX(50),
766                                 constants->ModulePositionY(50),
767                                 constants->ModulePositionZ(50)));
768
769                 modules->AddNode(acomodule,64,new TGeoTranslation("its4",
770                                 constants->ModulePositionX(59),
771                                 constants->ModulePositionY(59),
772                                 constants->ModulePositionZ(59)));
773
774                 } // end if (fITSGeometry)
775
776
777
778         //*** Begin the structure of support & bars for ACORDE ***
779
780         // Define a volume for the bars (up-face)
781
782         box[0]=5;
783 //      box[1]=40;
784         box[1]=33;
785         box[2]=5;
786         Float_t z1 = 21 ;
787         TGeoBBox *acorde00 = new TGeoBBox("acorde00",box[0],box[1],box[2]);
788
789         TGeoVolume *aCORDE00 = new TGeoVolume("ACORDE00",acorde00,al);
790
791         count=25;
792         for (Int_t ma=20;ma<=24;ma++)
793         {
794                 TGeoTranslation *aco00=new TGeoTranslation("aco00",
795                                         constants->ModulePositionX(ma)-0.5*293+dy2,
796                                         constants->ModulePositionY(ma)-box[1]-z1,
797                                         constants->ModulePositionZ(ma));
798
799                 upFace->AddNode(aCORDE00,count,aco00);
800
801                 TGeoTranslation *aco00q1=new TGeoTranslation("aco00q1",
802                                         -(constants->ModulePositionX(ma)-0.5*293+dy2),
803                                         constants->ModulePositionY(ma)-box[1]-z1,
804                                         constants->ModulePositionZ(ma));
805                 upFace->AddNode(aCORDE00,count+1,aco00q1);
806
807                 TGeoTranslation *aco00q2=new TGeoTranslation("aco00q2",
808                                         constants->ModulePositionX(ma)+0.5*293-dy2,
809                                         constants->ModulePositionY(ma)-box[1]-z1,
810                                         constants->ModulePositionZ(ma));
811                 upFace->AddNode(aCORDE00,count+2,aco00q2);
812
813                 TGeoTranslation *aco00q3=new TGeoTranslation("aco00q3",
814                                         -(constants->ModulePositionX(ma)+0.5*293-dy2),
815                                         constants->ModulePositionY(ma)-box[1]-z1,
816                                         constants->ModulePositionZ(ma));
817                 upFace->AddNode(aCORDE00,count+3,aco00q3);
818                 count=count+4;
819
820                 ma++;
821         }
822
823         count=41;
824         for(Int_t ma=25;ma<=29;ma++)
825         {
826                 TGeoTranslation *aco00=new TGeoTranslation("aco00",
827                                         constants->ModulePositionX(ma)-0.5*293+dy2,
828                                         constants->ModulePositionY(ma)-box[1]-z1,
829                                         constants->ModulePositionZ(ma));
830                 upFace->AddNode(aCORDE00,count,aco00);
831
832                 TGeoTranslation *aco00q1=new TGeoTranslation("aco00q1",
833                                         -(constants->ModulePositionX(ma)-0.5*293+dy2),
834                                         constants->ModulePositionY(ma)-box[1]-z1,
835                                         constants->ModulePositionZ(ma));
836                 upFace->AddNode(aCORDE00,count+1,aco00q1);
837
838                 TGeoTranslation *aco00q2=new TGeoTranslation("aco00q2",
839                                         constants->ModulePositionX(ma)+0.5*293-dy2,
840                                         constants->ModulePositionY(ma)-box[1]-z1,
841                                         constants->ModulePositionZ(ma));
842                 upFace->AddNode(aCORDE00,count+2,aco00q2);
843
844                 TGeoTranslation *aco00q3=new TGeoTranslation("aco00q3",
845                                         -(constants->ModulePositionX(ma)+0.5*293-dy2),
846                                         constants->ModulePositionY(ma)-box[1]-z1,
847                                         constants->ModulePositionZ(ma));
848                 upFace->AddNode(aCORDE00,count+3,aco00q3);
849                 count=count+4;
850                 ma++;
851         }
852
853         TGeoTranslation *c1 = new TGeoTranslation ("c1",
854                                 constants->ModulePositionX(20)-0.5*293,
855                                 constants->ModulePositionY(20)-box[1]-z1,
856                                 constants->ModulePositionZ(20)-40);
857         TGeoTranslation *c2 = new TGeoTranslation ("c2",
858                                 constants->ModulePositionX(23)-0.5*293,
859                                 constants->ModulePositionY(23)-box[1]-z1,
860                                 constants->ModulePositionZ(23)-40);
861         TGeoTranslation *c3 = new TGeoTranslation ("c3",
862                                 constants->ModulePositionX(24)-0.5*293,
863                                 constants->ModulePositionY(24)-box[1]-z1,
864                                 constants->ModulePositionZ(25)-40);
865         TGeoTranslation *c4 = new TGeoTranslation ("c4",
866                                 constants->ModulePositionX(27)-0.5*293,
867                                 constants->ModulePositionY(27)-box[1]-z1,
868                                 constants->ModulePositionZ(28)-40);
869         upFace->AddNode(aCORDE00,57,c1);
870         upFace->AddNode(aCORDE00,58,c2);
871         upFace->AddNode(aCORDE00,59,c3);
872         upFace->AddNode(aCORDE00,60,c4);
873
874
875         // Construct Bars for lateral supports (up-face)
876
877         TGeoTranslation *aco00=new TGeoTranslation("aco00",
878                                 constants->ModulePositionX(20)+0.5*293-dy,
879                                 constants->ModulePositionY(20)-box[1]-z1,
880                                 constants->ModulePositionZ(20)-40);
881         upFace->AddNode(aCORDE00,61,aco00);
882
883         TGeoTranslation *aco00q1=new TGeoTranslation("aco00q1",
884                                 constants->ModulePositionX(23)+0.5*293-dy,
885                                 constants->ModulePositionY(23)-box[1]-z1,
886                                 constants->ModulePositionZ(23)-40);
887         upFace->AddNode(aCORDE00,62,aco00q1);
888
889         TGeoTranslation *aco00q2=new TGeoTranslation("aco00q2",
890                                 constants->ModulePositionX(24)+0.5*293-dy,
891                                 constants->ModulePositionY(24)-box[1]-z1,
892                                 constants->ModulePositionZ(25)-40);
893         upFace->AddNode(aCORDE00,63,aco00q2);
894
895         TGeoTranslation *aco00q3=new TGeoTranslation("aco00q3",
896                                 constants->ModulePositionX(27)+0.5*293-dy,
897                                 constants->ModulePositionY(27)-box[1]-z1,
898                                 constants->ModulePositionZ(28)-40);
899         upFace->AddNode(aCORDE00,64,aco00q3);
900
901
902         TGeoTranslation *aco01=new TGeoTranslation("aco01",
903                                 constants->ModulePositionX(30)-0.5*293+dy,
904                                 constants->ModulePositionY(30)-box[1]-z1,
905                                 constants->ModulePositionZ(30)-40);
906         upFace->AddNode(aCORDE00,65,aco01);
907
908         TGeoTranslation *aco01q1=new TGeoTranslation("aco01q1",
909                                 constants->ModulePositionX(33)-0.5*293+dy,
910                                 constants->ModulePositionY(33)-box[1]-z1,
911                                 constants->ModulePositionZ(33)-40);
912         upFace->AddNode(aCORDE00,66,aco01q1);
913
914         TGeoTranslation *aco01q2=new TGeoTranslation("aco01q2",
915                                 constants->ModulePositionX(34)-0.5*293+dy,
916                                 constants->ModulePositionY(34)-box[1]-z1,
917                                 constants->ModulePositionZ(35)-40);
918         upFace->AddNode(aCORDE00,67,aco01q2);
919
920         TGeoTranslation *aco01q3=new TGeoTranslation("aco01q3",
921                                 constants->ModulePositionX(37)-0.5*293+dy,
922                                 constants->ModulePositionY(37)-box[1]-z1,
923                                 constants->ModulePositionZ(38)-40);
924         upFace->AddNode(aCORDE00,68,aco01q3);
925
926
927
928         // Acorde's support bars (side's faces)
929
930         //*** In Face ***
931
932 //      box[0]=39;
933         box[0]=27;
934         box[1]=5;
935         box[2]=5;
936         Float_t kro=3;
937         Float_t q1=0;
938         Float_t posx=constants->ModulePositionX(0)+0.5*293*0.7071-56*0.7071-18;
939         Float_t posy=constants->ModulePositionY(0)-0.5*293*0.7071-56*0.7071+3-q1+kro;
940         Float_t posz=constants->ModulePositionZ(0);
941
942         TGeoBBox *acorde7 = new TGeoBBox("acorde7",box[0],box[1],box[2]);
943
944         TGeoVolume *aCORDE7 = new TGeoVolume("ACORDE7",acorde7,al);
945
946         TGeoCombiTrans *aco7 = new TGeoCombiTrans("aco7",posx,posy,posz-4*dy,idrotm231);
947         TGeoCombiTrans *aco7q1 = new TGeoCombiTrans("aco7q1",posx,posy,
948                                         constants->ModulePositionZ(3)-4*dy,idrotm231);
949         TGeoCombiTrans *aco7q2 = new TGeoCombiTrans("aco7q2",posx,posy,
950                                         constants->ModulePositionZ(5)-4*dy,idrotm231);
951         TGeoCombiTrans *aco7q3 = new TGeoCombiTrans("aco7q3",posx,posy,
952                                         constants->ModulePositionZ(8)-4*dy,idrotm231);
953
954         inFace->AddNode(aCORDE7,20,aco7);
955         inFace->AddNode(aCORDE7,21,aco7q1);
956         inFace->AddNode(aCORDE7,22,aco7q2);
957         inFace->AddNode(aCORDE7,23,aco7q3);
958
959
960         count=24;
961         for(Int_t dyA=0;dyA<=4;dyA++)
962         {
963
964                 Float_t posx1=constants->ModulePositionX(dyA)+0.1*293*0.7071-56*0.7071-18+des;
965                 Float_t posy1=constants->ModulePositionY(dyA)-0.1*293*0.7071-56*0.7071+3-des-q1+kro;
966                 Float_t posza=constants->ModulePositionZ(dyA);
967                 Float_t posx2=constants->ModulePositionX(dyA)-0.27*293*0.7071-56*0.7071-18+des;
968                 Float_t posy2=constants->ModulePositionY(dyA)+0.27*293*0.7071-56*0.7071+3-des-q1+kro;
969                 TGeoCombiTrans *aco7q4 = new TGeoCombiTrans("aco7q4",posx1,posy1,posza,idrotm231);
970                 TGeoCombiTrans *aco7q5 = new TGeoCombiTrans("aco7q5",posx2,posy2,posza,idrotm231);
971                 inFace->AddNode(aCORDE7,count,aco7q4);
972                 inFace->AddNode(aCORDE7,count+1,aco7q5);
973                 count=count+2;
974                 dyA++;
975         }       
976
977
978         count=34;
979         for(Int_t dyb=5;dyb<=9;dyb++)
980         {
981
982                 Float_t posx1=constants->ModulePositionX(dyb)+0.1*293*0.7071-56*0.7071-18+des;
983                 Float_t posy1=constants->ModulePositionY(dyb)-0.1*293*0.7071-56*0.7071+3-des-q1+kro;
984                 Float_t poszb=constants->ModulePositionZ(dyb+10);
985                 Float_t posx2=constants->ModulePositionX(dyb)-0.27*293*0.7071-56*0.7071-18+des;
986                 Float_t posy2=constants->ModulePositionY(dyb)+0.27*293*0.7071-56*0.7071+3-des-q1+kro;
987                 TGeoCombiTrans *aco7q6 = new TGeoCombiTrans("aco7q6",posx1,posy1,poszb,idrotm231);
988                 TGeoCombiTrans *aco7q7 = new TGeoCombiTrans("aco7q7",posx2,posy2,poszb,idrotm231);
989                 inFace->AddNode(aCORDE7,count,aco7q6);
990                 inFace->AddNode(aCORDE7,count+1,aco7q7);
991                 count=count+2;
992                 dyb++;
993         }       
994
995
996
997         Float_t posxq1=constants->ModulePositionX(10)+0.5*293*0.7071-56*0.7071-18;
998         Float_t posyq1=constants->ModulePositionY(10)-0.5*293*0.7071-56*0.7071+3-q1+kro;
999         Float_t poszq1=constants->ModulePositionZ(10);
1000         TGeoCombiTrans *aco7q8 = new TGeoCombiTrans("aco7q8",posxq1,posyq1,poszq1-4*dy,idrotm231);
1001         TGeoCombiTrans *aco7q9 = new TGeoCombiTrans("aco7q9",posxq1,posyq1,
1002                                         constants->ModulePositionZ(13)-4*dy,idrotm231);
1003         TGeoCombiTrans *aco7q10 = new TGeoCombiTrans("aco7q10",posxq1,posyq1,
1004                                         constants->ModulePositionZ(15)-4*dy,idrotm231);
1005         TGeoCombiTrans *aco7q11 = new TGeoCombiTrans("aco7q11",posxq1,posyq1,
1006                                         constants->ModulePositionZ(18)-4*dy,idrotm231);
1007         inFace->AddNode(aCORDE7,44,aco7q8);
1008         inFace->AddNode(aCORDE7,45,aco7q9);
1009         inFace->AddNode(aCORDE7,46,aco7q10);
1010         inFace->AddNode(aCORDE7,47,aco7q11);
1011
1012
1013         count=48;
1014         for(Int_t dyc=10;dyc<=14;dyc++)
1015
1016         {
1017
1018                 Float_t posx1=constants->ModulePositionX(dyc)+0.1*293*0.7071-56*0.7071-18+des;
1019                 Float_t posy1=constants->ModulePositionY(dyc)-0.1*293*0.7071-56*0.7071+3-des-0.8+kro;
1020                 Float_t poszc=constants->ModulePositionZ(dyc);
1021                 Float_t posx2=constants->ModulePositionX(dyc)-0.27*293*0.7071-56*0.7071-18+des;
1022                 Float_t posy2=constants->ModulePositionY(dyc)+0.27*293*0.7071-56*0.7071+3-des-1.5-0.8+kro;
1023                 TGeoRotation *rot1 = new TGeoRotation();
1024                 rot1->RotateZ(70);
1025                 TGeoCombiTrans *aco7q12 = new TGeoCombiTrans("aco7q12",posx1,posy1,poszc,idrotm231);
1026                 TGeoCombiTrans *aco7q13 = new TGeoCombiTrans("aco7q13",posx2+15,posy2-10,poszc,rot1);
1027                 inFace->AddNode(aCORDE7,count,aco7q12);
1028                 inFace->AddNode(aCORDE7,count+1,aco7q13);// bars 25 grades
1029                 count=count+2;
1030                 dyc++;
1031         }
1032
1033
1034         count=57;
1035         for(Int_t dyd=15;dyd<=19;dyd++)
1036
1037         {
1038
1039                 Float_t posx1=constants->ModulePositionX(dyd)+0.1*293*0.7071-56*0.7071-18+des;
1040                 Float_t posy1=constants->ModulePositionY(dyd)-0.1*293*0.7071-56*0.7071+3-des-q1-0.8+kro;
1041                 Float_t poszd=constants->ModulePositionZ(dyd);
1042                 Float_t posx2=constants->ModulePositionX(dyd)-0.27*293*0.7071-56*0.7071-18+des;
1043                 Float_t posy2=constants->ModulePositionY(dyd)+0.27*293*0.7071-56*0.7071+3-des-1.5-q1-0.8+kro;
1044                 TGeoRotation *rot1 = new TGeoRotation();
1045                 rot1->RotateZ(70);
1046                 TGeoCombiTrans *aco7q14 = new TGeoCombiTrans("aco7q14",posx1,posy1,poszd,idrotm231);
1047                 TGeoCombiTrans *aco7q15 = new TGeoCombiTrans("aco7q15",posx2+15,posy2-10,poszd,rot1);
1048                 inFace->AddNode(aCORDE7,count,aco7q14);
1049                 inFace->AddNode(aCORDE7,count+1,aco7q15);// bars 25 grades
1050                 count=count+2;
1051                 dyd++;
1052         }
1053
1054
1055         //*** Out Face ***
1056
1057 //      box[0]=39;
1058         box[0]=27;
1059         box[1]=5;
1060         box[2]=5;
1061         Float_t s1=2.5;
1062         Float_t posxqa=constants->ModulePositionX(50)-0.5*293*0.7071+56*0.7071+18;
1063         Float_t posyqa=constants->ModulePositionY(50)-0.5*293*0.7071-56*0.7071+3-s1+kro;
1064         Float_t poszqa=constants->ModulePositionZ(50);
1065         TGeoCombiTrans *aco7q16 = new TGeoCombiTrans("aco7q16",
1066                                         posxqa,posyqa,poszqa-4*dy,idrotm232);
1067         TGeoCombiTrans *aco7q17 = new TGeoCombiTrans("aco7q17",
1068                                         posxqa,posyqa,
1069                                         constants->ModulePositionZ(43)-4*dy,idrotm232);
1070         TGeoCombiTrans *aco7q18 = new TGeoCombiTrans("aco7q18",posxqa,posyqa,
1071                                         constants->ModulePositionZ(55)-4*dy,idrotm232);
1072         TGeoCombiTrans *aco7q19 = new TGeoCombiTrans("aco7q19",posxqa,posyqa,
1073                                         constants->ModulePositionZ(58)-4*dy,idrotm232);
1074         TGeoCombiTrans *aco7q20 = new TGeoCombiTrans("aco7q20",
1075                                         constants->ModulePositionX(50)-0.1*293*0.7071
1076                                         +56*0.7071+18-des,
1077                                         constants->ModulePositionY
1078                                         (50)-0.1*293*0.7071-56*0.7071+3-des-s1,
1079                                         constants->ModulePositionZ(45),idrotm232);
1080         TGeoCombiTrans *aco7q21 = new TGeoCombiTrans("aco7q21",
1081                                         constants->ModulePositionX(50)+0.27*293*0.7071
1082                                         +56*0.7071+18-des,
1083                                         constants->ModulePositionY(50)
1084                                         +0.27*293*0.7071-56*0.7071+3-des-s1,
1085                                         constants->ModulePositionZ(45),idrotm232);
1086         outFace->AddNode(aCORDE7,19,aco7q16);
1087         outFace->AddNode(aCORDE7,20,aco7q17);
1088         outFace->AddNode(aCORDE7,21,aco7q18);
1089         outFace->AddNode(aCORDE7,22,aco7q19);
1090         outFace->AddNode(aCORDE7,23,aco7q20);
1091         outFace->AddNode(aCORDE7,24,aco7q21);
1092
1093
1094         count=25;
1095         for(Int_t dye=50;dye<=54;dye++)
1096         {
1097
1098                 Float_t posx1=constants->ModulePositionX(dye)-0.1*293*0.7071+56*0.7071+18-des;
1099                 Float_t posy1=constants->ModulePositionY(dye)-0.1*293*0.7071-56*0.7071+3-des-s1+kro;
1100                 Float_t posze=constants->ModulePositionZ(dye);
1101                 Float_t posx2=constants->ModulePositionX(dye)+0.27*293*0.7071+56*0.7071+18-des;
1102                 Float_t posy2=constants->ModulePositionY(dye)+0.27*293*0.7071-56*0.7071+3-des-s1+kro;
1103                 TGeoCombiTrans *aco7q22 = new TGeoCombiTrans("aco7q22",posx1,posy1,posze,idrotm232);
1104                 TGeoCombiTrans *aco7q23 = new TGeoCombiTrans("aco7q23",posx2,posy2,posze,idrotm232);
1105                 outFace->AddNode(aCORDE7,count,aco7q22);
1106                 outFace->AddNode(aCORDE7,count+1,aco7q23);
1107                 count=count+2;
1108                 dye++;
1109         }
1110
1111
1112         count=35;
1113         for(Int_t dyf=57;dyf<=59;dyf++)
1114         {
1115
1116                 Float_t posx1=constants->ModulePositionX(dyf)-0.1*293*0.7071+56*0.7071+18-des;
1117                 Float_t posy1=constants->ModulePositionY(dyf)-0.1*293*0.7071-56*0.7071+3-des-s1+kro;
1118                 Float_t poszf=constants->ModulePositionZ(dyf-10);
1119                 Float_t posx2=constants->ModulePositionX(dyf)+0.27*293*0.7071+56*0.7071+18-des;
1120                 Float_t posy2=constants->ModulePositionY(dyf)+0.27*293*0.7071-56*0.7071+3-des-s1+kro;
1121                 TGeoCombiTrans *aco7q24 = new TGeoCombiTrans("aco7q24",posx1,posy1,poszf,idrotm232);
1122                 TGeoCombiTrans *aco7q25 = new TGeoCombiTrans("aco7q25",posx2,posy2,poszf,idrotm232);
1123                 outFace->AddNode(aCORDE7,count,aco7q24);
1124                 outFace->AddNode(aCORDE7,count+1,aco7q25);
1125                 count=count+2;
1126                 dyf++;
1127         }
1128
1129
1130         Float_t posxqb=constants->ModulePositionX(40)-0.5*293*0.7071+56*0.7071+18;
1131         Float_t posyqb=constants->ModulePositionY(40)-0.5*293*0.7071-56*0.7071+3-s1+kro;
1132         Float_t poszqb=constants->ModulePositionZ(40);
1133         TGeoCombiTrans *aco7q26 = new TGeoCombiTrans("aco7q26",
1134                                         posxqb,posyqb,poszqb-4*dy,idrotm232);
1135         TGeoCombiTrans *aco7q27 = new TGeoCombiTrans("aco7q27",
1136                                         posxqb,posyqb,
1137                                         constants->ModulePositionZ(43)-4*dy,idrotm232);
1138         TGeoCombiTrans *aco7q28 = new TGeoCombiTrans("aco7q28",
1139                                         posxqb,posyqb,
1140                                         constants->ModulePositionZ(45)-4*dy,idrotm232);
1141         TGeoCombiTrans *aco7q29 = new TGeoCombiTrans("aco7q29",posxqb,posyqb,
1142                                         constants->ModulePositionZ(48)-4*dy,idrotm232);
1143         outFace->AddNode(aCORDE7,41,aco7q26);
1144         outFace->AddNode(aCORDE7,42,aco7q27);
1145         outFace->AddNode(aCORDE7,43,aco7q28);
1146         outFace->AddNode(aCORDE7,44,aco7q29);
1147
1148         count=45;
1149         for(Int_t dyg=40;dyg<=44;dyg++)
1150         {
1151
1152                 Float_t posx1=constants->ModulePositionX(dyg)-0.1*293*0.7071+56*0.7071+18-des;
1153                 Float_t posy1=constants->ModulePositionY(dyg)-0.1*293*0.7071-56*0.7071+3-des-s1+kro;
1154                 Float_t poszg=constants->ModulePositionZ(dyg);
1155                 Float_t posx2=constants->ModulePositionX(dyg)+0.27*293*0.7071+56*0.7071+18-des;
1156                 Float_t posy2=constants->ModulePositionY(dyg)+0.27*293*0.7071-56*0.7071+3-des-s1+kro;
1157                 TGeoRotation *rot1 = new TGeoRotation();
1158                 rot1->RotateZ(105);
1159                 TGeoCombiTrans *aco7q30 = new TGeoCombiTrans("aco7q30",posx1,posy1,poszg,idrotm232);
1160                 TGeoCombiTrans *aco7q31 = new TGeoCombiTrans("aco7q31",posx2-15,posy2-10,poszg,rot1);
1161                 outFace->AddNode(aCORDE7,count,aco7q30);
1162                 outFace->AddNode(aCORDE7,count+1,aco7q31);// bars 25 grades
1163                 count=count+2;
1164                 dyg++;
1165         }
1166
1167
1168         count=55;
1169         for(Int_t dyh=45;dyh<=49;dyh++)
1170         {
1171
1172                 Float_t posx1=constants->ModulePositionX(dyh)-0.1*293*0.7071+56*0.7071+18-des;
1173                 Float_t posy1=constants->ModulePositionY(dyh)-0.1*293*0.7071-56*0.7071+3-des-s1+kro;
1174                 Float_t poszh=constants->ModulePositionZ(dyh);
1175                 Float_t posx2=constants->ModulePositionX(dyh)+0.27*293*0.7071+56*0.7071+18-des;
1176                 Float_t posy2=constants->ModulePositionY(dyh)+0.27*293*0.7071-56*0.7071+3-des-s1+kro;
1177                 TGeoRotation *rot1 = new TGeoRotation();
1178                 rot1->RotateZ(105);
1179                 TGeoCombiTrans *aco7q32 = new TGeoCombiTrans("aco7q32",posx1,posy1,poszh,idrotm232);
1180                 TGeoCombiTrans *aco7q33 = new TGeoCombiTrans("aco7q33",posx2-15,posy2-10,poszh,rot1);
1181                 outFace->AddNode(aCORDE7,count,aco7q32);
1182                 outFace->AddNode(aCORDE7,count+1,aco7q33);// bars 25 grades
1183                 count=count+2;
1184                 dyh++;
1185         }
1186
1187
1188
1189         // Set the bars non perpendicular at side faces
1190
1191         //*** In-Face ***
1192
1193         box[0]=5;
1194 //      box[1]=55.15;
1195         box[1]=40;
1196         box[2]=5;
1197         Float_t sm=2;
1198         Float_t re=1;
1199         Float_t posx1=constants->ModulePositionX(0)+0.5*293*0.7071-4*box[0]-8+re;
1200         Float_t posy1=constants->ModulePositionY(0)-0.5*293*0.7071-box[1]-18-2+sm;
1201         Float_t posz1=constants->ModulePositionZ(0);
1202
1203         TGeoBBox *acorde7q1 = new TGeoBBox("acorde7q1",box[0],box[1],box[2]);
1204
1205         TGeoVolume *aCORDE7q1 = new TGeoVolume("ACORDE7_1",acorde7q1,al);
1206         TGeoTranslation *aco71 = new TGeoTranslation("aco71",posx1,posy1,posz1-4*dy);
1207         TGeoTranslation *aco72 = new TGeoTranslation("aco72",posx1,posy1,
1208                                         constants->ModulePositionZ(3)-4*dy);
1209         TGeoTranslation *aco73 = new TGeoTranslation("aco73",posx1,posy1,
1210                                         constants->ModulePositionZ(5)-4*dy);
1211         TGeoTranslation *aco74 = new TGeoTranslation("aco74",posx1,posy1,
1212                                         constants->ModulePositionZ(8)-4*dy);
1213         inFace->AddNode(aCORDE7q1,67,aco71);
1214         inFace->AddNode(aCORDE7q1,68,aco72);
1215         inFace->AddNode(aCORDE7q1,69,aco73);
1216         inFace->AddNode(aCORDE7q1,70,aco74);
1217
1218
1219         count=71;
1220         for(Int_t dyi=0;dyi<=4;dyi++)
1221         {
1222
1223                 Float_t posx1a=constants->ModulePositionX(dyi)+0.1*293*0.7071-4*box[0]-8+des+re;
1224                 Float_t posy1a=constants->ModulePositionY(dyi)-0.1*293*0.7071-box[1]-18-2-des+sm;
1225                 Float_t posz1a=constants->ModulePositionZ(dyi);
1226                 Float_t dyx2=constants->ModulePositionX(dyi)-0.27*293*0.7071-4*box[0]-8+des+re;
1227                 Float_t dyy2=constants->ModulePositionY(dyi)+0.27*293*0.7071-box[1]-18-2-des+sm;
1228                 TGeoTranslation *aco75=new TGeoTranslation("aco75",posx1a,posy1a,posz1a);
1229                 TGeoTranslation *aco76=new TGeoTranslation("aco76",dyx2,dyy2,posz1a);
1230                 inFace->AddNode(aCORDE7q1,count,aco75);
1231                 inFace->AddNode(aCORDE7q1,count+1,aco76);
1232                 count=count+2;
1233                 dyi++;
1234         }
1235
1236
1237         count=81;
1238         for(Int_t dyj=5;dyj<=9;dyj++)
1239         {
1240
1241                 Float_t posx1b=constants->ModulePositionX(dyj)+0.1*293*0.7071-4*box[0]-8+des+re;
1242                 Float_t posy1b=constants->ModulePositionY(dyj)-0.1*293*0.7071-box[1]-18-2-des+sm;
1243                 Float_t posz1b=constants->ModulePositionZ(dyj+10);
1244                 Float_t dyx2=constants->ModulePositionX(dyj)-0.27*293*0.7071-4*box[0]-8+des+re;
1245                 Float_t dyy2=constants->ModulePositionY(dyj)+0.27*293*0.7071-box[1]-18-2-des+sm;
1246                 TGeoTranslation *aco75=new TGeoTranslation("aco75",posx1b,posy1b,posz1b);
1247                 TGeoTranslation *aco76=new TGeoTranslation("aco76",dyx2,dyy2,posz1b);
1248                 inFace->AddNode(aCORDE7q1,count,aco75);
1249                 inFace->AddNode(aCORDE7q1,count+1,aco76);
1250                 count=count+2;
1251                 dyj++;
1252         }
1253
1254
1255         Float_t posx1q1=constants->ModulePositionX(10)+0.5*293*0.7071-4*box[0]-8+re;
1256         Float_t posy1q1=constants->ModulePositionY(10)-0.5*293*0.7071-box[1]-18-2+sm;
1257         Float_t posz1q1=constants->ModulePositionZ(10);
1258         TGeoTranslation *aco77=new TGeoTranslation("aco77",posx1q1,posy1q1,posz1q1-4*dy);
1259         TGeoTranslation *aco78=new TGeoTranslation("aco78",posx1q1,posy1q1,
1260                                         constants->ModulePositionZ(13)-4*dy);
1261
1262         TGeoTranslation *aco79=new TGeoTranslation("aco79",posx1q1,posy1q1,
1263                                         constants->ModulePositionZ(15)-4*dy);
1264         TGeoTranslation *aco710=new TGeoTranslation("aco710",posx1q1,posy1q1,
1265                                         constants->ModulePositionZ(18)-4*dy);
1266         inFace->AddNode(aCORDE7q1,91,aco77);
1267         inFace->AddNode(aCORDE7q1,92,aco78);
1268         inFace->AddNode(aCORDE7q1,93,aco79);
1269         inFace->AddNode(aCORDE7q1,94,aco710);
1270
1271         count=95;
1272         for(Int_t dyk=10;dyk<=14;dyk++)
1273         {
1274
1275                 Float_t posx1c=constants->ModulePositionX(dyk)+0.1*293*0.7071-4*box[0]-8+des+re+.83;
1276                 Float_t posy1c=constants->ModulePositionY(dyk)-0.1*293*0.7071-box[1]-18-2-des+sm;
1277                 Float_t posz1c=constants->ModulePositionZ(dyk);
1278                 Float_t dyx2=constants->ModulePositionX(dyk)-0.27*293*0.7071-4*box[0]-4+des+re+0.83;
1279                 Float_t dyy2=constants->ModulePositionY(dyk)+0.27*293*0.7071-box[1]-18-5-des+sm;
1280                 TGeoTranslation *aco711=new TGeoTranslation("aco711",posx1c,posy1c,posz1c);
1281                 TGeoTranslation *aco712=new TGeoTranslation("aco712",dyx2,dyy2,posz1c);
1282                 inFace->AddNode(aCORDE7q1,count,aco711);
1283                 inFace->AddNode(aCORDE7q1,count+1,aco712);
1284                 count=count+2;
1285                 dyk++;
1286         }
1287
1288
1289
1290         count=105;
1291         for(Int_t dyl=15;dyl<=19;dyl++)
1292         {
1293
1294                 Float_t posx1d=constants->ModulePositionX(dyl)+0.1*293*0.7071-4*box[0]-8+des+re+0.83;
1295                 Float_t posy1d=constants->ModulePositionY(dyl)-0.1*293*0.7071-box[1]-18-2-des+sm;
1296                 Float_t posz1d=constants->ModulePositionZ(dyl);
1297                 Float_t dyx2=constants->ModulePositionX(dyl)-0.27*293*0.7071-4*box[0]-4+des+re+0.83;
1298                 Float_t dyy2=constants->ModulePositionY(dyl)+0.27*293*0.7071-box[1]-18-5-des;
1299                 TGeoTranslation *aco713=new TGeoTranslation("aco713",posx1d,posy1d,posz1d);
1300                 TGeoTranslation *aco714=new TGeoTranslation("aco714",dyx2,dyy2,posz1d);
1301                 inFace->AddNode(aCORDE7q1,count,aco713);
1302                 inFace->AddNode(aCORDE7q1,count+1,aco714);
1303                 count=count+2;
1304                 dyl++;
1305         }
1306
1307                 //*** Out-Face ***
1308
1309         Float_t posx1qa=constants->ModulePositionX(50)-0.5*293*0.7071+4*box[0]+8-re-1;
1310         Float_t posy1qa=constants->ModulePositionY(50)-0.5*293*0.7071-box[1]-18-2+sm-2.5;
1311         Float_t posz1qa=constants->ModulePositionZ(50);
1312         TGeoTranslation *aco715=new TGeoTranslation("aco715",posx1qa,posy1qa,posz1qa-4*dy);
1313         TGeoTranslation *aco716=new TGeoTranslation("aco716",posx1qa,posy1qa,
1314                                 constants->ModulePositionZ(43)-4*dy);
1315         TGeoTranslation *aco717=new TGeoTranslation("aco717",posx1qa,posy1qa,
1316                                 constants->ModulePositionZ(55)-4*dy);
1317         TGeoTranslation *aco718=new TGeoTranslation("aco718",posx1qa,posy1qa,
1318                                 constants->ModulePositionZ(58)-4*dy);
1319         TGeoTranslation *aco719=new TGeoTranslation("aco719",
1320                                 constants->ModulePositionX(50)-0.1*293*0.7071+4*box[0]+8-des-re-1,              
1321                                 constants->ModulePositionY(50)-0.1*293*0.7071-box[1]-18-2-des+sm-2.5,
1322                                 constants->ModulePositionZ(45));
1323         TGeoTranslation *aco720=new TGeoTranslation("aco720",
1324                                 constants->ModulePositionX(50)+0.27*293*0.7071+4*box[0]+8-des-re-1,
1325                                 constants->ModulePositionY(50)+0.27*293*0.7071-box[1]-18-2-des+sm-2.5,
1326                                 constants->ModulePositionZ(45));
1327
1328
1329         outFace->AddNode(aCORDE7q1,115,aco715);
1330         outFace->AddNode(aCORDE7q1,116,aco716);
1331         outFace->AddNode(aCORDE7q1,117,aco717);
1332         outFace->AddNode(aCORDE7q1,118,aco718);
1333         outFace->AddNode(aCORDE7q1,119,aco719);
1334         outFace->AddNode(aCORDE7q1,120,aco720);
1335
1336
1337
1338
1339         count=65;
1340         for(Int_t dym=50;dym<=54;dym++)
1341         {
1342
1343                 Float_t posx1e=constants->ModulePositionX(dym)-0.1*293*0.7071+4*box[0]+8-des-re-1;
1344                 Float_t posy1e=constants->ModulePositionY(dym)-0.1*293*0.7071-box[1]-18-2-des+sm-2.5;
1345                 Float_t posz1e=constants->ModulePositionZ(dym);
1346                 Float_t dyx2=constants->ModulePositionX(dym)+0.27*293*0.7071+4*box[0]+8-des-re-1;
1347                 Float_t dyy2=constants->ModulePositionY(dym)+0.27*293*0.7071-box[1]-18-2-des+sm-2.5;
1348                 TGeoTranslation *aco721=new TGeoTranslation("aco721",posx1e,posy1e,posz1e);
1349                 TGeoTranslation *aco722=new TGeoTranslation("aco722",dyx2,dyy2,posz1e);
1350                 outFace->AddNode(aCORDE7q1,count,aco721);
1351                 outFace->AddNode(aCORDE7q1,count+1,aco722);
1352                 count=count+2;
1353                 dym++;
1354         }
1355
1356
1357
1358         count=75;
1359         for(Int_t dyn=57;dyn<=59;dyn++)
1360         {
1361
1362                 Float_t posx1f=constants->ModulePositionX(dyn)-0.1*293*0.7071+4*box[0]+8-des-re-1;
1363                 Float_t posy1f=constants->ModulePositionY(dyn)-0.1*293*0.7071-box[1]-18-2-des+sm-2.5;
1364                 Float_t posz1f=constants->ModulePositionZ(dyn-10);
1365                 Float_t dyx2=constants->ModulePositionX(dyn)+0.27*293*0.7071+4*box[0]+8-des-re-1;
1366                 Float_t dyy2=constants->ModulePositionY(dyn)+0.27*293*0.7071-box[1]-18-2-des+sm-2.5;
1367                 TGeoTranslation *aco723=new TGeoTranslation("aco723",posx1f,posy1f,posz1f);
1368                 TGeoTranslation *aco724=new TGeoTranslation("aco724",dyx2,dyy2,posz1f);
1369                 outFace->AddNode(aCORDE7q1,count,aco723);
1370                 outFace->AddNode(aCORDE7q1,count+1,aco724);
1371                 count=count+2;
1372                 dyn++;
1373         }
1374
1375
1376         Float_t posx1qb=constants->ModulePositionX(40)-0.5*293*0.7071+4*box[0]+5;
1377         Float_t posy1qb=constants->ModulePositionY(40)-0.5*293*0.7071-box[1]-18-2;
1378         Float_t posz1qb=constants->ModulePositionZ(40);
1379         TGeoTranslation *aco725=new TGeoTranslation("aco725",posx1qb,posy1qb,posz1qb-4*dy);
1380         TGeoTranslation *aco726=new TGeoTranslation("aco726",posx1qb,posy1qb,
1381                                 constants->ModulePositionZ(43)-4*dy);
1382         TGeoTranslation *aco727=new TGeoTranslation("aco727",posx1qb,posy1qb,
1383                                 constants->ModulePositionZ(45)-4*dy);
1384         TGeoTranslation *aco728=new TGeoTranslation("aco728",posx1qb,posy1qb,
1385                                 constants->ModulePositionZ(48)-4*dy);
1386         outFace->AddNode(aCORDE7q1,85,aco725);
1387         outFace->AddNode(aCORDE7q1,86,aco726);
1388         outFace->AddNode(aCORDE7q1,87,aco727);
1389         outFace->AddNode(aCORDE7q1,88,aco728);
1390
1391
1392
1393         count=89;
1394         for(Int_t dyo=40;dyo<=44;dyo++)
1395         {
1396
1397                 Float_t posx1g=constants->ModulePositionX(dyo)-0.1*293*0.7071+4*box[0]+8-des-re-1;
1398                 Float_t posy1g=constants->ModulePositionY(dyo)-0.1*293*0.7071-box[1]-18-2-des+sm-2.5;
1399                 Float_t posz1g=constants->ModulePositionZ(dyo);
1400                 Float_t dyx2=constants->ModulePositionX(dyo)+0.27*293*0.7071+4*box[0]+4-des-re-1+2.8;
1401                 Float_t dyy2=constants->ModulePositionY(dyo)+0.27*293*0.7071-box[1]-18-5-des+sm-2.5+3;
1402                 TGeoTranslation *aco729=new TGeoTranslation("aco729",posx1g,posy1g,posz1g);
1403                 TGeoTranslation *aco730=new TGeoTranslation("aco730",dyx2,dyy2,posz1g);
1404                 outFace->AddNode(aCORDE7q1,count,aco729);
1405                 outFace->AddNode(aCORDE7q1,count+1,aco730);
1406                 count=count+2;
1407                 dyo++;
1408         }
1409
1410
1411
1412         count=99;
1413         for(Int_t dyp=45;dyp<=49;dyp++)
1414         {
1415
1416                 Float_t posx1h=constants->ModulePositionX(dyp)-0.1*293*0.7071+4*box[0]+8-des-re-1;
1417                 Float_t posy1h=constants->ModulePositionY(dyp)-0.1*293*0.7071-box[1]-18-2-des+sm-2.5;
1418                 Float_t posz1h=constants->ModulePositionZ(dyp);
1419                 Float_t dyx2=constants->ModulePositionX(dyp)+0.27*293*0.7071+4*box[0]+4-des-re-1+2.8;
1420                 Float_t dyy2=constants->ModulePositionY(dyp)+0.27*293*0.7071-box[1]-18-5-des+sm-2.5+3;
1421                 TGeoTranslation *aco729=new TGeoTranslation("aco729",posx1h,posy1h,posz1h);
1422                 TGeoTranslation *aco730=new TGeoTranslation("aco730",dyx2,dyy2,posz1h);
1423                 outFace->AddNode(aCORDE7q1,count,aco729);
1424                 outFace->AddNode(aCORDE7q1,count+1,aco730);
1425                 count=count+2;
1426                 dyp++;
1427         }
1428
1429
1430         // Here I define a master volume "ACORDE_SUPPORT" for Acorde's support
1431
1432         //---> Set the support of ACORDE alice MODULES
1433
1434
1435         Float_t dy1=20;
1436         box[0]=10;
1437         box[1]=0.5;
1438         box[2]=500;
1439
1440         Float_t sx=constants->ModulePositionX(24)-0.5*293;
1441         Float_t sy=constants->ModulePositionY(24)-box[1];
1442         Float_t sz=0;
1443         Float_t sx2=constants->ModulePositionX(24)+0.5*293-dy;
1444         Float_t sy2=constants->ModulePositionY(24)-box[1];
1445         Float_t sx4=constants->ModulePositionX(24)-0.5*293+dy2;
1446         Float_t sy4=constants->ModulePositionY(24)-box[1];
1447         Float_t sx5=constants->ModulePositionX(24)+0.5*293-dy2;
1448         Float_t sy5=constants->ModulePositionY(24)-box[1];
1449
1450         Float_t dyx=constants->ModulePositionX(4)+0.5*293*0.7071-box[0];
1451         Float_t dyy=constants->ModulePositionY(4)-0.5*293*0.7071-box[1];
1452         Float_t dyz=0;
1453         Float_t dyx1=constants->ModulePositionX(4)+0.1*293*0.7071-box[0];
1454         Float_t dyy1=constants->ModulePositionY(4)-0.1*293*0.7071-box[1];
1455         Float_t dyx2=constants->ModulePositionX(4)-0.27*293*0.7071-box[0];
1456         Float_t dyy2=constants->ModulePositionY(4)+0.27*293*0.7071-box[1];
1457
1458
1459         Float_t dx1=constants->ModulePositionX(14)+0.5*293*0.7071-box[0];
1460         Float_t dy11=constants->ModulePositionY(14)-0.5*293*0.7071-box[1];
1461         Float_t dyx11=constants->ModulePositionX(14)+0.1*293*0.7071-box[0];
1462         Float_t dyy11=constants->ModulePositionY(14)-0.1*293*0.7071-box[1];
1463         Float_t dyx21=constants->ModulePositionX(14)-0.27*293*0.7071-box[0];
1464         Float_t dyy21=constants->ModulePositionY(14)+0.27*293*0.7071-box[1];
1465
1466
1467         Float_t tbox[3];
1468         tbox[0]=1;
1469         tbox[1]=7;
1470         tbox[2]=500;
1471
1472         TGeoVolume *support = new TGeoVolumeAssembly("ACORDE_SUPPORT");
1473
1474         TGeoBBox *acorde8 = new TGeoBBox("acorde8",box[0],box[1],box[2]);
1475         TGeoVolume *aCORDE8 = new TGeoVolume("ACORDE8",acorde8,al);
1476
1477         TGeoBBox *acorde9 = new TGeoBBox("acorde9",tbox[0],tbox[1],tbox[2]);
1478         TGeoVolume *aCORDE9 = new TGeoVolume("ACORDE9",acorde9,al);
1479
1480         support->AddNode(aCORDE8,1,new TGeoTranslation(0,-5,0));
1481         support->AddNode(aCORDE8,2,new TGeoTranslation(0,-dy1,0));
1482         support->AddNode(aCORDE9,3,new TGeoTranslation(0,-tbox[1]-5.5,0));
1483
1484
1485         // Put "support" on Up-Face
1486
1487         upFace->AddNode(support,69,new TGeoTranslation("aco8",sx,sy,sz));
1488         upFace->AddNode(support,70,new TGeoTranslation("aco8_2",sx2,sy2,sz));
1489         upFace->AddNode(support,71,new TGeoTranslation("aco8_4",sx4,sy4,sz));
1490         upFace->AddNode(support,72,new TGeoTranslation("aco8_6",sx5,sy5,sz));
1491         upFace->AddNode(support,73,new TGeoTranslation("aco8_2",-sx2,sy2,sz));
1492         upFace->AddNode(support,74,new TGeoTranslation("aco8_4",-sx4,sy4,sz));
1493         upFace->AddNode(support,75,new TGeoTranslation("aco8_6",-sx5,sy5,sz));
1494
1495         // Put "support" on In-Face
1496         Float_t ms = 1.3;
1497         inFace->AddNode(support,121,new TGeoCombiTrans("aco8_81",dyx,dyy+ms,dyz,idrotm232));
1498         inFace->AddNode(support,122,new TGeoCombiTrans("aco8_121",dyx1+des,ms+dyy1-des,dyz,idrotm232));
1499         inFace->AddNode(support,123,new TGeoCombiTrans("aco8_161",dyx2+des,ms+dyy2-des,dyz,idrotm232));
1500         inFace->AddNode(support,124,new TGeoCombiTrans("aco8_82",dx1,ms+dy11,dyz,idrotm232));
1501         inFace->AddNode(support,125,new TGeoCombiTrans("aco8_122",dyx11+des,ms+dyy11-des,dyz,idrotm232));
1502         inFace->AddNode(support,126,new TGeoCombiTrans("aco8_162",dyx21+des,ms+dyy21-des,dyz,idrotm232));
1503
1504         // Put "support" on Out-Face
1505
1506         outFace->AddNode(support,121,new TGeoCombiTrans("aco8_81",-dyx,dyy+ms,dyz,idrotm231));
1507         outFace->AddNode(support,122,new TGeoCombiTrans("aco8_121",-dyx1-des,ms+dyy1-des,dyz,idrotm231));
1508         outFace->AddNode(support,123,new TGeoCombiTrans("aco8_161",-dyx2-des,ms+dyy2-des,dyz,idrotm231));
1509         outFace->AddNode(support,124,new TGeoCombiTrans("aco8_82",-dx1,dy11+ms,dyz,idrotm231));
1510         outFace->AddNode(support,125,new TGeoCombiTrans("aco8_122",-dyx11-des,ms+dyy11-des,dyz,idrotm231));
1511         outFace->AddNode(support,126,new TGeoCombiTrans("aco8_162",-dyx21-des,ms+dyy21-des,dyz,idrotm231));
1512         
1513         aCORDE->AddNode(inFace,1);//---> volume of supports & bars in-face
1514         aCORDE->AddNode(upFace,2);//---> volume of supports & bars up-face
1515         aCORDE->AddNode(outFace,3);//---> volume of supports & bars out-face
1516 //      aCORDE->AddNode(inFacem,4);//---> volume of modules in-face
1517 //      aCORDE->AddNode(upFacem,5);//---> volume of modules up-face
1518 //      aCORDE->AddNode(outFacem,6);//---> volume of modules out-face
1519         aCORDE->AddNode(modules,4);//---> volume of ALL ACORDE's Modules
1520         alice->AddNode(aCORDE,1);//---> put volume of ACORDE over ALICE's volume
1521
1522
1523
1524 }
1525
1526
1527 //_____________________________________________________________________________
1528 void AliACORDEv1::DrawDetector() const
1529 {
1530
1531   // not needed anymore
1532
1533 }
1534
1535 //____________________________________________________________________________
1536
1537 void AliACORDEv1::Init()
1538 {
1539   // Initialise L3 magnet after it has been built
1540   Int_t i;
1541   if(AliLog::GetGlobalDebugLevel()>0) {
1542     printf("\n%s: ",ClassName());
1543     for(i=0;i<35;i++) printf("*");
1544     printf(" ACORDEv1_INIT ");
1545     for(i=0;i<35;i++) printf("*");
1546     printf("\n%s: ",ClassName());
1547     // Here the ACORDEv initialisation code (if any!)
1548     for(i=0;i<80;i++) printf("*");
1549     printf("\n");
1550   }
1551  // AliACORDE::Init();  
1552 }
1553 //____________________________________________________________________________
1554 void AliACORDEv1::StepManager()
1555 {
1556
1557   //
1558   // Called for every step in the Cosmic Ray Trigger
1559   //
1560
1561
1562   // volume: 
1563   //  [0] = module number 1-60 (1==>(0-0), 60 (5-9)
1564   //  [1] = Plastic number: 0 (down) to 1 (up)
1565   static Int_t   vol[2]; 
1566   //
1567   // hit
1568   // [0] = PID
1569   // [1-3] = x, y, z 
1570   // [4] = time 
1571   // [5-7] = px, py, pz
1572   // [8] = energy 
1573   // [9] = energy loss
1574   // [10] = length of track through plastic
1575   static Float_t hits[11];
1576
1577   // local static variables
1578   static Float_t eloss;
1579   static Float_t step;
1580   // scintillator volume
1581  static Int_t idScint = gMC->VolId("ACORDE2");
1582   // local variables
1583   Int_t copy;
1584   TLorentzVector pos;
1585   TLorentzVector mom;
1586
1587   // only charged tracks
1588   if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return;
1589
1590   // only in sensitive material
1591   if (gMC->CurrentVolID(copy) == idScint) {
1592
1593     step  += gMC->TrackStep();
1594     eloss += gMC->Edep();
1595     // set all hit variables except eloss which is resetted
1596     // set volume variables
1597     if (gMC->IsTrackEntering()) {
1598       eloss = 0.0;
1599       step = 0.0;
1600       gMC->TrackPosition(pos);
1601       gMC->TrackMomentum(mom);
1602       // hit
1603       // [0] = PID
1604       // [1-3] = x, y, z 
1605       // [4] = time 
1606       // [5-7] = px, py, pz
1607       // [8] = energy 
1608       // [9] = energy loss
1609       hits[0]  = (Float_t ) gMC->TrackPid(); 
1610
1611
1612       hits[1] = pos[0]; 
1613       hits[2] = pos[1]; 
1614       hits[3] = pos[2]; 
1615       hits[4] = gMC->TrackTime();
1616       hits[5] = mom[0];
1617       hits[6] = mom[1];
1618       hits[7] = mom[2];
1619       hits[8] = gMC->Etot();
1620       // volume: 
1621       //  [0] = module number 1-60 (1==>(0-0), 60 (5-9)
1622       //  [1] = Plastic number: 0 (down) to 1 (up)
1623       Int_t copyPlastic; // plastic: down=1, up=2
1624       Int_t copyModule; // module: 1-60
1625       gMC->CurrentVolID(copyPlastic);
1626       gMC->CurrentVolOffID(1, copyModule);
1627       // module
1628       vol[0] = copyModule;
1629       // plastic: 0 = down, 1 = up
1630       vol[1] = copyPlastic - 4 ; // !!!!!!!
1631     // vol[1] = copyPlastic;
1632     } // end if gMC->IsTrackEntering()
1633
1634     // set hit[9] = total energy loss and book hit
1635     if( gMC->IsTrackExiting() || 
1636         gMC->IsTrackStop() || 
1637         gMC->IsTrackDisappeared()){
1638       hits[9] = eloss;
1639       hits[10] = step;
1640       eloss = 0.0;
1641       step = 0.0;
1642       AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits);
1643      }
1644   } 
1645
1646
1647
1648 }
1649
1650 //_____________________________________________________________________________
1651 void AliACORDEv1::AddHit(Int_t track, Int_t *vol, Float_t *hits)
1652 {
1653   //
1654   // Add an ACORDE hit
1655   //
1656   TClonesArray &lhits = *fHits;
1657   new(lhits[fNhits++]) AliACORDEhit(fIshunt,track,vol,hits);
1658 }
1659
1660 //_____________________________________________________________________________
1661 void AliACORDEv1::AddDigits(Int_t* track, Int_t module, Float_t time)
1662 {
1663   
1664   // Adds Digit
1665   
1666   TClonesArray &ldigits = *fDigits;
1667   new(ldigits[fNdigits++]) AliACORDEdigit(track,module,time);
1668 }
1669 //_____________________________________________________________________________
1670
1671
1672
1673 //_____________________________________________________________________________
1674 void AliACORDEv1::MakeBranch(Option_t *option)
1675 {
1676 // Creates new branches in the current Root Tree
1677     
1678   char branchname[10];
1679   sprintf(branchname,"%s",GetName());
1680   AliDebug(2,Form("fBufferSize = %d",fBufferSize));
1681   const char *cH = strstr(option,"H");
1682   if (fHits   && TreeH() && cH) {
1683     TreeH()->Branch(branchname,&fHits, fBufferSize);
1684     AliDebug(2,Form("Making Branch %s for hits",branchname));
1685   }     
1686   const char *cD = strstr(option,"D");
1687   if (fDigits   && fLoader->TreeD() && cD) {
1688     fLoader->TreeD()->Branch(branchname,&fDigits, fBufferSize);
1689     AliDebug(2,Form("Making Branch %s for digits",branchname));
1690   }  
1691 }
1692
1693 //_____________________________________________________________________________
1694 void AliACORDEv1::AddAlignableVolumes() const
1695 {
1696   //
1697   // Create entries for alignable volumes associating the symbolic volume
1698   // name with the corresponding volume path. Needs to be syncronized with
1699   // eventual changes in the geometry.
1700   // 
1701
1702         // The alignable volumes are only the "ACORDE_MODULE_%d"
1703         //
1704         //      Structure of ACORDE's Geometry
1705         //
1706         //      ALIC_1
1707         //          |---> ACORDE_1      
1708         //                      |----> ACORDE_1_1 (in_face) ---
1709         //                      |----> ACORDE_2_2 (up_face)    |--> BARS&SUPPORTS
1710         //                      |----> ACORDE_3_3 (out_face)---
1711         //                      |----> ACORDE_MODULES_4        |--> ACORDE'S MODULES
1712         //              
1713         //
1714         //     Send comments to: Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch>
1715
1716         TString vpstr1 = "ALIC_1/ACORDE_1/ALL_ACORDE_MODULES_4/ACORDE_MODULE_";
1717         TString snstr1 = "ACORDE/Array";
1718         TString volpath, symname;
1719         for(Int_t dy=1; dy<61 ; dy++)
1720         {
1721                 volpath = vpstr1;
1722                 volpath += dy;
1723                 symname = snstr1;
1724                 symname += dy;
1725                 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1726                 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
1727         }
1728 }