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