38a4d0bedd8912476c7939d9a393c5de04dc1ca2
[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. It includes the last survey of 2009.             //
25 //  It include geometry and hits (position and momentum)                     //
26 //                                                                           //
27 //   Author: Mario Rodriguez Cahuantzi, FCFM-BUAP, Puebla, Pue. Mexico       //
28 //                                                                           //
29 //                  Send comments to:                                        //
30 //                                                                           //
31 //      Arturo Fernandez Tellez         <afernand@fcfm.buap.mx>              //
32 //      Eleazar Cuautle Flores          <ecuautle@nucleares.unam.mx>         //
33 //      Mario Rodriguez Cahuantzi       <mrodrigu@mail.cern.ch>              // 
34 //                                                                           //
35 //                      Puebla, Pue. Mexico December 2007                    //
36 //                                                                           //
37 //      Last Update: Nov. 17th 2009                                          //
38 //      Mario Rodriguez Cahuantzi                                            //
39 ///////////////////////////////////////////////////////////////////////////////
40
41
42 #include <Riostream.h>
43 #include <TGeoMatrix.h>
44 #include <TMath.h>
45 #include <TString.h>
46 #include <TSystem.h>
47 #include <TTree.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 "TGeoPgon.h"
56 #include "TGeoTrd1.h"
57 #include "TGeoCompositeShape.h"
58 #include "TGeoPara.h"
59
60 #include "AliACORDEv1.h"
61 #include <TClonesArray.h>
62 #include <TLorentzVector.h>
63 #include <TVirtualMC.h>
64 #include <TPDGCode.h>
65
66 #include "AliRun.h"
67 #include "AliConst.h"
68 #include "AliACORDEhit.h"
69 #include "AliACORDEConstants.h"
70 #include "AliMC.h"
71 #include "AliLog.h"
72
73 ClassImp(AliACORDEv1)
74  
75 //_____________________________________________________________________________
76 AliACORDEv1::AliACORDEv1()
77   : AliACORDE()
78 {
79   //
80   // Default constructor
81   fIshunt = 0;
82   fHits = 0;
83   //
84
85 //_____________________________________________________________________________
86 AliACORDEv1::AliACORDEv1(const char *name, const char *title)
87   : AliACORDE(name, title)
88 {
89   //
90   // Standard constructor
91   //
92   fIshunt = 1; // All hits are associated with primary particles 
93   fHits =  new TClonesArray("AliACORDEhit",400);
94   gAlice->GetMCApp()->AddHitList(fHits);
95 }
96 //_____________________________________________________________________________
97 AliACORDEv1::~AliACORDEv1()
98 {
99   //
100   // Default destructor
101   //
102 }
103 //_____________________________________________________________________________
104 void AliACORDEv1::CreateGeometry()
105 {
106   CreateAcorde();
107 }
108 void AliACORDEv1::CreateAcorde()
109 {  
110
111         // Call the global constants for the Modules
112         
113         AliACORDEConstants* constants = AliACORDEConstants::Instance();
114
115         // Get the Alice Volume
116
117         TGeoVolume *alice = gGeoManager->GetVolume("ALIC");
118
119         // Define some materials & medium
120
121         //*** Aluminium ***
122
123         TGeoMedium* aluminium = gGeoManager->GetMedium("ACORDE_ALU_C0");
124
125         //*** Scintillator ***
126
127         TGeoMedium* scintillator = gGeoManager->GetMedium("ACORDE_CPV scint.1");
128         
129         //Define the mother volume for the ACORDE detector
130
131         TGeoVolume *acorde = new TGeoVolumeAssembly("ACORDE");
132
133
134         // Define 2 main-daughter volumes for ACORDE
135         
136         TGeoVolume *supportBars = new TGeoVolumeAssembly("ACORDE_SUPPORTS_BARS");
137         TGeoVolume *acordeModules = new TGeoVolumeAssembly("ALL_ACORDE_MODULES");
138
139   
140         // Define rotation Matrix for Side's faces in Alice
141         
142         TGeoRotation *idrotm231 = new TGeoRotation("idrotm231",90, 45, 90, 135, 0, 0);
143         TGeoRotation *idrotm232 = new TGeoRotation("idrotm232",90, 315, 90, 45, 0, 0);
144
145         // Begin the Geometry for ACORDE
146
147         // *** Definition of ACORDE's Modules ***
148
149         // Define Measures of ACORDE's Modules
150
151         Float_t acoFrameBox1[3],acoFrameBox2[3];
152
153         acoFrameBox1[0] = constants->ModuleLength()/2;
154         acoFrameBox1[1] = constants->ModuleHeight()/2;
155         acoFrameBox1[2] = 2.50;
156
157         acoFrameBox2[0] = 20.0;
158         acoFrameBox2[1] = constants->ModuleHeight()/2;
159         acoFrameBox2[2] = 10.0;
160
161         // Define Measures of Scintillators
162         
163         Float_t acoScinBox[3];  
164         acoScinBox[0] = constants->PlasticLength()/2;
165         acoScinBox[1] = constants->PlasticHeight()/2;
166         acoScinBox[2] = constants->PlasticWidth()/2;
167
168
169         // Create the Modules of ACORDE, 1 aluminium frame and two scintillator plastics
170
171         //*** Aluminium frame ***
172
173         TGeoBBox *acordeModFrameBoxL = new TGeoBBox("acordeModFrameBoxL",acoFrameBox1[0],acoFrameBox1[1],acoFrameBox1[2]);
174         TGeoBBox *acordeModFrameBoxH = new TGeoBBox("acordeModFrameBoxH",acoFrameBox2[0],acoFrameBox2[1],acoFrameBox2[2]);
175         TGeoVolume *acordeModFrameVolumeL = new TGeoVolume("ACORDEMODFRAMEVOLUMEL",acordeModFrameBoxL,aluminium);
176         TGeoVolume *acordeModFrameVolumeH = new TGeoVolume("ACORDEMODFRAMEVOLUMEH",acordeModFrameBoxH,aluminium);
177
178
179         //*** Scintillators ***
180
181         TGeoBBox *acordeScintillatorBox = new TGeoBBox("acordeScintillatorBox",acoScinBox[0],acoScinBox[1],acoScinBox[2]);
182         TGeoVolume *acordeScintillatorVolume = new TGeoVolume("ACORDESCINTILLATORMODULE",acordeScintillatorBox,scintillator);
183
184
185         // Here I create a single ACORDE module and then we make 60 copies of it
186
187         TGeoVolume *acordeSingleModule = new TGeoVolumeAssembly("ACORDE_MODULE");
188         acordeSingleModule->AddNode(acordeModFrameVolumeL,1,new TGeoTranslation("acordeFrame_01",0,0,12.5));
189         acordeSingleModule->AddNode(acordeModFrameVolumeL,2,new TGeoTranslation("acordeFrame_02",0,0,-12.5));
190         acordeSingleModule->AddNode(acordeModFrameVolumeH,3,new TGeoTranslation("acordeFrame_03",130,0,0));
191         acordeSingleModule->AddNode(acordeModFrameVolumeH,4,new TGeoTranslation("acordeFrame_04",-130,0,0));
192         acordeSingleModule->AddNode(acordeScintillatorVolume,5, new TGeoTranslation("acordeScintillator_01",0,1,0));
193         acordeSingleModule->AddNode(acordeScintillatorVolume,6, new TGeoTranslation("acordeScintillator_01",0,-1,0));
194
195         // Put the Modules of In-Face
196         
197         for(Int_t iAcordeModule=1;iAcordeModule<9;iAcordeModule++)
198         {
199
200                 Float_t posx = constants->CenterModulePositionX(iAcordeModule);
201                 Float_t posy = constants->CenterModulePositionY(iAcordeModule);
202                 Float_t posz = constants->CenterModulePositionZ(iAcordeModule); 
203                 
204                 acordeModules->AddNode(acordeSingleModule,iAcordeModule,
205                         new TGeoCombiTrans("aco01",posx,posy,posz,idrotm232));
206         }
207
208         for(Int_t iAcordeModule=10;iAcordeModule<20;iAcordeModule++)
209         {
210                 Float_t posx = constants->CenterModulePositionX(iAcordeModule);
211                 Float_t posy = constants->CenterModulePositionY(iAcordeModule);
212                 Float_t posz = constants->CenterModulePositionZ(iAcordeModule);
213
214                 acordeModules->AddNode(acordeSingleModule,iAcordeModule,
215                         new TGeoCombiTrans("aco01",posx,posy,posz,idrotm232));
216         }
217
218         // Put he Modules of Up-Face
219
220         for(Int_t iAcordeModule=20;iAcordeModule<40;iAcordeModule++)
221         {
222                 Float_t posx = constants->CenterModulePositionX(iAcordeModule);
223                 Float_t posy = constants->CenterModulePositionY(iAcordeModule);
224                 Float_t posz = constants->CenterModulePositionZ(iAcordeModule); 
225
226                 acordeModules->AddNode(acordeSingleModule,iAcordeModule,new TGeoTranslation("aco01",posx,posy,posz));
227         }
228
229         // Put the Modules of Out-Face
230
231         for(Int_t iAcordeModule=40;iAcordeModule<50;iAcordeModule++)
232         {
233                 Float_t posx = constants->CenterModulePositionX(iAcordeModule);
234                 Float_t posy = constants->CenterModulePositionY(iAcordeModule);
235                 Float_t posz = constants->CenterModulePositionZ(iAcordeModule); 
236
237                 acordeModules->AddNode(acordeSingleModule,iAcordeModule,
238                         new TGeoCombiTrans("aco01",posx,posy,posz,idrotm231));
239         }
240
241         // Put the Modules of Out-Face
242
243         for(Int_t iAcordeModule=51;iAcordeModule<59;iAcordeModule++)
244         {
245                 Float_t posx = constants->CenterModulePositionX(iAcordeModule);
246                 Float_t posy = constants->CenterModulePositionY(iAcordeModule);
247                 Float_t posz = constants->CenterModulePositionZ(iAcordeModule); 
248                 acordeModules->AddNode(acordeSingleModule,iAcordeModule,
249                                         new TGeoCombiTrans("aco01",posx,posy,posz,idrotm231));
250         }
251
252         // Put the 4-central modules (Old-ITS modules)
253         if (Get4CentralModulesGeometry()) 
254         { 
255                 acordeModules->AddNode(acordeSingleModule,0,
256                         new TGeoTranslation("Mod0_0",constants->CenterModulePositionX(0),constants->CenterModulePositionY(0),constants->CenterModulePositionZ(0)));
257                 acordeModules->AddNode(acordeSingleModule,9,
258                         new TGeoTranslation("Mod0_9",constants->CenterModulePositionX(9),constants->CenterModulePositionY(9),constants->CenterModulePositionZ(9)));
259                 acordeModules->AddNode(acordeSingleModule,50,
260                         new TGeoTranslation("Mod0_50",constants->CenterModulePositionX(50),constants->CenterModulePositionY(50),constants->CenterModulePositionZ(50)));
261                 acordeModules->AddNode(acordeSingleModule,59,
262                         new TGeoTranslation("Mod0_59",constants->CenterModulePositionX(59),constants->CenterModulePositionY(59),constants->CenterModulePositionZ(59)));
263         }
264
265         // Create a dummy support & bars of Aluminium (it doesn't exist a survey of this structure)
266
267         Float_t boxLongSupport[3],boxThinSupport[3];
268
269         boxLongSupport[0]=10.0;
270         boxLongSupport[1]=0.5;
271         boxLongSupport[2]=500.0;
272
273         boxThinSupport[0]=1.0;
274         boxThinSupport[1]=5.0;
275         boxThinSupport[2]=500.0;
276
277         TGeoBBox *acordeLongSupport = new TGeoBBox("ACORDELONGSUPPORT",boxLongSupport[0],boxLongSupport[1],boxLongSupport[2]);
278         TGeoBBox *acordeThinSupport = new TGeoBBox("ACORDETHINSUPPORT",boxThinSupport[0],boxThinSupport[1],boxThinSupport[2]);
279
280         TGeoVolume *acordeLSupport = new TGeoVolume("ACORDELS",acordeLongSupport,aluminium);
281         TGeoVolume *acordeTSupport = new TGeoVolume("ACORDETS",acordeThinSupport,aluminium);
282         TGeoVolume *acordeMainSupport = new TGeoVolumeAssembly("ACORDE_SUPPORT"); 
283         acordeMainSupport->AddNode(acordeLSupport,1,new TGeoTranslation("ACOLSA",0,5.5,0));
284         acordeMainSupport->AddNode(acordeLSupport,2,new TGeoTranslation("ACOLSB",0,-7.5,0));
285         acordeMainSupport->AddNode(acordeTSupport,3);
286
287         // Set the values for the bars support
288         
289         Float_t boxSingleBar[3];
290         boxSingleBar[0]=10;
291         boxSingleBar[1]=37;//36.722; // Correction to avoid overlaps with the L3 magnet
292         boxSingleBar[2]=10;
293
294         Float_t boxUnionUp[3];
295         boxUnionUp[0]=10;
296         boxUnionUp[1]=0.5;
297         boxUnionUp[2]=15;
298
299         Float_t boxUnionDown[3];
300         boxUnionDown[0]=20;
301         boxUnionDown[1]=1;
302         boxUnionDown[2]=20;
303         
304         // Volume and Box for the bar
305         
306         TGeoBBox *acordeSingleBarSupport = new TGeoBBox("ACORDESBARS",boxSingleBar[0],boxSingleBar[1],boxSingleBar[2]);
307         TGeoVolume *acordeBarSupport = new TGeoVolume("ACORDEBARSUPPORT",acordeSingleBarSupport,aluminium);
308
309         // Volume and Box for the bar union with the long support (Up-with supports and Down with L3 magnet)
310         
311         TGeoBBox *acordeSingleBoxUnionUp = new TGeoBBox("ACORDEBUP",boxUnionUp[0],boxUnionUp[1],boxUnionUp[2]);
312         TGeoVolume *acordeBoxUnionUp = new TGeoVolume("ACORDEBOXUNIONUP",acordeSingleBoxUnionUp,aluminium);
313         
314         TGeoBBox *acordeSingleBoxUnionDown = new TGeoBBox("ACORDEBDOWN",boxUnionDown[0],boxUnionDown[1],boxUnionDown[2]);
315         TGeoVolume *acordeBoxUnionDown = new TGeoVolume("ACORDEBOXUNIONDOWN",acordeSingleBoxUnionDown,aluminium);
316
317         TGeoVolume *acordeMainBar = new TGeoVolumeAssembly("ACORDE_BAR");
318         acordeMainBar->AddNode(acordeBoxUnionUp,1,new TGeoTranslation("ACOBAR01",0,boxSingleBar[1]+boxUnionUp[1],0));
319         acordeMainBar->AddNode(acordeBarSupport,2);
320         acordeMainBar->AddNode(acordeBoxUnionDown,3,new TGeoTranslation("ACOBAR01",0,-boxSingleBar[1]-boxUnionDown[1],0));
321
322         // Volume for the Full support (supports and bars) UP face of L3 Magnet
323         Float_t supportPosXIn = constants->CenterModulePositionX(20);
324         Float_t supportPosY = 859.044-7.5-5.5; // Minimum module position Y less the heigh of the support
325         Float_t supportPosZ = 0;
326         Float_t supportPosXOut = constants->CenterModulePositionX(30);
327         Float_t deltaXA = 120.;
328         Float_t deltaXB = 60.;
329
330         TGeoVolume *acordeFullSupportUpFace = new TGeoVolumeAssembly("ACORDE_FULL_SUPPORT_UPFACE");
331         acordeFullSupportUpFace->AddNode(acordeMainSupport,1,new TGeoTranslation("ACOFSB01",supportPosXIn+deltaXA,supportPosY,supportPosZ));
332         acordeFullSupportUpFace->AddNode(acordeMainSupport,2,new TGeoTranslation("ACOFSB02",supportPosXIn+deltaXB,supportPosY,supportPosZ));
333         acordeFullSupportUpFace->AddNode(acordeMainSupport,3,new TGeoTranslation("ACOFSB03",supportPosXIn-deltaXA,supportPosY,supportPosZ));
334         acordeFullSupportUpFace->AddNode(acordeMainSupport,4,new TGeoTranslation("ACOFSB04",supportPosXIn-deltaXB,supportPosY,supportPosZ));
335         acordeFullSupportUpFace->AddNode(acordeMainSupport,5,new TGeoTranslation("ACOFSB05",supportPosXOut+deltaXA,supportPosY,supportPosZ));
336         acordeFullSupportUpFace->AddNode(acordeMainSupport,6,new TGeoTranslation("ACOFSB06",supportPosXOut+deltaXB,supportPosY,supportPosZ));
337         acordeFullSupportUpFace->AddNode(acordeMainSupport,7,new TGeoTranslation("ACOFSB07",supportPosXOut-deltaXA,supportPosY,supportPosZ));
338         acordeFullSupportUpFace->AddNode(acordeMainSupport,8,new TGeoTranslation("ACOFSB08",supportPosXOut-deltaXB,supportPosY,supportPosZ));
339         
340         // Put the bars in the main volume acordeFullSupportUpFace
341
342         Float_t barPosXIn = constants->CenterModulePositionX(20);
343         Float_t barPosY = supportPosY-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
344         Float_t barPosZ = 0;
345         Int_t barIndex = 9;
346         for(Int_t iBarModule = 20; iBarModule<30; iBarModule+=2)
347         {
348                 barPosZ = constants->CenterModulePositionZ(iBarModule);
349                 acordeFullSupportUpFace->AddNode(acordeMainBar,barIndex,new TGeoTranslation("ACOFSB09",barPosXIn+deltaXA,barPosY,barPosZ));     
350                 acordeFullSupportUpFace->AddNode(acordeMainBar,barIndex+1,new TGeoTranslation("ACOFSB09",barPosXIn+deltaXB,barPosY,barPosZ));   
351                 acordeFullSupportUpFace->AddNode(acordeMainBar,barIndex+2,new TGeoTranslation("ACOFSB09",barPosXIn-deltaXA,barPosY,barPosZ));
352                 acordeFullSupportUpFace->AddNode(acordeMainBar,barIndex+3,new TGeoTranslation("ACOFSB09",barPosXIn-deltaXB,barPosY,barPosZ));
353
354                 barIndex+=4;
355         }
356
357         Float_t barPosXOut = constants->CenterModulePositionX(30);
358         for(Int_t iBarModule = 30; iBarModule<40; iBarModule+=2)
359         {
360                 barPosZ = constants->CenterModulePositionZ(iBarModule);
361                 acordeFullSupportUpFace->AddNode(acordeMainBar,barIndex,new TGeoTranslation("ACOFSB09",barPosXOut+deltaXA,barPosY,barPosZ));
362                 acordeFullSupportUpFace->AddNode(acordeMainBar,barIndex+1,new TGeoTranslation("ACOFSB09",barPosXOut+deltaXB,barPosY,barPosZ));
363                 acordeFullSupportUpFace->AddNode(acordeMainBar,barIndex+2,new TGeoTranslation("ACOFSB09",barPosXOut-deltaXA,barPosY,barPosZ));
364                 acordeFullSupportUpFace->AddNode(acordeMainBar,barIndex+3,new TGeoTranslation("ACOFSB09",barPosXOut-deltaXB,barPosY,barPosZ));
365
366                 barIndex+=4;
367         }
368
369         // Supports and bars for the InSide of L3 Magnet
370
371         TGeoVolume *acordeFullSupportInFace = new TGeoVolumeAssembly("ACORDE_FULL_SUPPORT_INFACE");
372         Float_t supportPosXInA = constants->CenterModulePositionX(1)+deltaXA;
373         Float_t supportPosYInA = 592.017-7.5-5.5;
374         Float_t x0 = constants->CenterModulePositionX(1);
375         Float_t y0 = constants->CenterModulePositionY(1);
376         Float_t theta = -1*TMath::Pi()/4;
377         Float_t supportPosXInPA = x0+(supportPosXInA-x0)*TMath::Cos(theta)-(supportPosYInA-y0)*TMath::Sin(theta);
378         Float_t supportPosYInPA = y0+(supportPosYInA-y0)*TMath::Cos(theta)+(supportPosXInA-x0)*TMath::Sin(theta);
379         Float_t supportPosZInIn = 0;
380
381         Float_t supportPosXInB = constants->CenterModulePositionX(1)+deltaXB;
382         Float_t supportPosXInPB = x0+(supportPosXInB-x0)*TMath::Cos(theta)-(supportPosYInA-y0)*TMath::Sin(theta);
383         Float_t supportPosYInPB = y0+(supportPosYInA-y0)*TMath::Cos(theta)+(supportPosXInB-x0)*TMath::Sin(theta);
384
385         Float_t supportPosXInC = constants->CenterModulePositionX(1)-deltaXA;
386         Float_t supportPosXInPC = x0+(supportPosXInC-x0)*TMath::Cos(theta)-(supportPosYInA-y0)*TMath::Sin(theta);
387         Float_t supportPosYInPC = y0+(supportPosYInA-y0)*TMath::Cos(theta)+(supportPosXInC-x0)*TMath::Sin(theta);
388
389         Float_t supportPosXInD = constants->CenterModulePositionX(1)-deltaXB;
390         Float_t supportPosXInPD = x0+(supportPosXInD-x0)*TMath::Cos(theta)-(supportPosYInA-y0)*TMath::Sin(theta);
391         Float_t supportPosYInPD = y0+(supportPosYInA-y0)*TMath::Cos(theta)+(supportPosXInD-x0)*TMath::Sin(theta);
392
393
394         acordeFullSupportInFace->AddNode(acordeMainSupport,1,new TGeoCombiTrans("ACOFSBIN01",supportPosXInPA,supportPosYInPA,supportPosZInIn,idrotm232));
395         acordeFullSupportInFace->AddNode(acordeMainSupport,2,new TGeoCombiTrans("ACOFSBIN02",supportPosXInPB,supportPosYInPB,supportPosZInIn,idrotm232));
396         acordeFullSupportInFace->AddNode(acordeMainSupport,3,new TGeoCombiTrans("ACOFSBIN03",supportPosXInPC,supportPosYInPC,supportPosZInIn,idrotm232));
397         acordeFullSupportInFace->AddNode(acordeMainSupport,4,new TGeoCombiTrans("ACOFSBIN04",supportPosXInPD,supportPosYInPD,supportPosZInIn,idrotm232));
398
399         Float_t supportPosXInE = constants->CenterModulePositionX(10)+deltaXA;
400         Float_t supportPosYInE = 806.312-7.5-5.5;
401         Float_t x00 = constants->CenterModulePositionX(10);
402         Float_t y00 = constants->CenterModulePositionY(10);
403         Float_t supportPosXInPE = x00+(supportPosXInE-x00)*TMath::Cos(theta)-(supportPosYInE-y00)*TMath::Sin(theta);
404         Float_t supportPosYInPE = y00+(supportPosYInE-y00)*TMath::Cos(theta)+(supportPosXInE-x00)*TMath::Sin(theta);
405
406         Float_t supportPosXInF = constants->CenterModulePositionX(10)+deltaXB;
407         Float_t supportPosXInPF = x00+(supportPosXInF-x00)*TMath::Cos(theta)-(supportPosYInE-y00)*TMath::Sin(theta);
408         Float_t supportPosYInPF = y00+(supportPosYInE-y00)*TMath::Cos(theta)+(supportPosXInF-x00)*TMath::Sin(theta);
409
410         Float_t supportPosXInG = constants->CenterModulePositionX(10)-deltaXA+100;
411         Float_t supportPosXInPG = x00+(supportPosXInG-x00)*TMath::Cos(theta)-(supportPosYInE-y00)*TMath::Sin(theta);
412         Float_t supportPosYInPG = y00+(supportPosYInE-y00)*TMath::Cos(theta)+(supportPosXInG-x00)*TMath::Sin(theta);
413
414         acordeFullSupportInFace->AddNode(acordeMainSupport,5,new TGeoCombiTrans("ACOFSBIN05",supportPosXInPE,supportPosYInPE,supportPosZInIn,idrotm232));
415         acordeFullSupportInFace->AddNode(acordeMainSupport,6,new TGeoCombiTrans("ACOFSBIN06",supportPosXInPF,supportPosYInPF,supportPosZInIn,idrotm232));
416         acordeFullSupportInFace->AddNode(acordeMainSupport,7,new TGeoCombiTrans("ACOFSBIN07",supportPosXInPG,supportPosYInPG,supportPosZInIn,idrotm232));
417
418         // Put the bars in the main volume acordeFullSupportInFace
419
420         Int_t barIndexIn = 8;
421
422         for (Int_t iBarModule=1; iBarModule<9; iBarModule+=2)
423         {
424                 Float_t barPosXInIn = constants->CenterModulePositionX(iBarModule)+deltaXA;
425                 Float_t barPosYInIn = supportPosYInA-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
426                 Float_t barPosZInIn = constants->CenterModulePositionZ(iBarModule);
427                 Float_t barPosXInP = x0+(barPosXInIn-x0)*TMath::Cos(theta)-(barPosYInIn-y0)*TMath::Sin(theta);
428                 Float_t barPosYInP = y0+(barPosYInIn-y0)*TMath::Cos(theta)+(barPosXInIn-x0)*TMath::Sin(theta);
429
430                 Float_t barPosXInInA = constants->CenterModulePositionX(iBarModule)+deltaXB;
431                 Float_t barPosYInInA = supportPosYInA-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
432                 Float_t barPosZInInA = constants->CenterModulePositionZ(iBarModule);
433                 Float_t barPosXInPA = x0+(barPosXInInA-x0)*TMath::Cos(theta)-(barPosYInInA-y0)*TMath::Sin(theta);
434                 Float_t barPosYInPA = y0+(barPosYInInA-y0)*TMath::Cos(theta)+(barPosXInInA-x0)*TMath::Sin(theta);
435
436                 Float_t barPosXInInB = constants->CenterModulePositionX(iBarModule)-deltaXA;
437                 Float_t barPosYInInB = supportPosYInA-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
438                 Float_t barPosZInInB = constants->CenterModulePositionZ(iBarModule);
439                 Float_t barPosXInPB = x0+(barPosXInInB-x0)*TMath::Cos(theta)-(barPosYInInB-y0)*TMath::Sin(theta);
440                 Float_t barPosYInPB = y0+(barPosYInInB-y0)*TMath::Cos(theta)+(barPosXInInB-x0)*TMath::Sin(theta);
441
442                 Float_t barPosXInInC = constants->CenterModulePositionX(iBarModule)-deltaXB;
443                 Float_t barPosYInInC = supportPosYInA-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
444                 Float_t barPosZInInC = constants->CenterModulePositionZ(iBarModule);
445                 Float_t barPosXInPC = x0+(barPosXInInC-x0)*TMath::Cos(theta)-(barPosYInInC-y0)*TMath::Sin(theta);
446                 Float_t barPosYInPC = y0+(barPosYInInC-y0)*TMath::Cos(theta)+(barPosXInInC-x0)*TMath::Sin(theta);
447
448                 acordeFullSupportInFace->AddNode(acordeMainBar,barIndexIn,new TGeoCombiTrans("ACOFSBIN08",barPosXInP,barPosYInP,barPosZInIn,idrotm232));
449                 acordeFullSupportInFace->AddNode(acordeMainBar,barIndexIn+1,new TGeoCombiTrans("ACOFSBIN09",barPosXInPA,barPosYInPA,barPosZInInA,idrotm232));
450                 acordeFullSupportInFace->AddNode(acordeMainBar,barIndexIn+2,new TGeoCombiTrans("ACOFSBIN10",barPosXInPB,barPosYInPB,barPosZInInB,idrotm232));
451                 acordeFullSupportInFace->AddNode(acordeMainBar,barIndexIn+3,new TGeoCombiTrans("ACOFSBIN11",barPosXInPC,barPosYInPC,barPosZInInC,idrotm232));
452
453                 barIndexIn+=4;
454         }
455
456         for (Int_t iBarModule=10; iBarModule<20; iBarModule+=2)
457         {
458                 Float_t barPosXInIn = constants->CenterModulePositionX(iBarModule)+deltaXA;
459                 Float_t barPosYInIn = supportPosYInE-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
460                 Float_t barPosZInIn = constants->CenterModulePositionZ(iBarModule);
461                 Float_t barPosXInP = x00+(barPosXInIn-x00)*TMath::Cos(theta)-(barPosYInIn-y00)*TMath::Sin(theta);
462                 Float_t barPosYInP = y00+(barPosYInIn-y00)*TMath::Cos(theta)+(barPosXInIn-x00)*TMath::Sin(theta);
463
464                 Float_t barPosXInInA = constants->CenterModulePositionX(iBarModule)+deltaXB;
465                 Float_t barPosYInInA = supportPosYInE-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
466                 Float_t barPosZInInA = constants->CenterModulePositionZ(iBarModule);
467                 Float_t barPosXInPA = x00+(barPosXInInA-x00)*TMath::Cos(theta)-(barPosYInInA-y00)*TMath::Sin(theta);
468                 Float_t barPosYInPA = y00+(barPosYInInA-y00)*TMath::Cos(theta)+(barPosXInInA-x00)*TMath::Sin(theta);
469
470                 Float_t barPosXInInB = constants->CenterModulePositionX(iBarModule)-deltaXA+100;
471                 Float_t barPosYInInB = supportPosYInE-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
472                 Float_t barPosZInInB = constants->CenterModulePositionZ(iBarModule);
473                 Float_t barPosXInPB = x00+(barPosXInInB-x00)*TMath::Cos(theta)-(barPosYInInB-y00)*TMath::Sin(theta);
474                 Float_t barPosYInPB = y00+(barPosYInInB-y00)*TMath::Cos(theta)+(barPosXInInB-x00)*TMath::Sin(theta);
475
476                 acordeFullSupportInFace->AddNode(acordeMainBar,barIndexIn,new TGeoCombiTrans("ACOFSBIN08",barPosXInP,barPosYInP,barPosZInIn,idrotm232));
477                 acordeFullSupportInFace->AddNode(acordeMainBar,barIndexIn+1,new TGeoCombiTrans("ACOFSBIN09",barPosXInPA,barPosYInPA,barPosZInInA,idrotm232));
478                 acordeFullSupportInFace->AddNode(acordeMainBar,barIndexIn+2,new TGeoCombiTrans("ACOFSBIN10",barPosXInPB,barPosYInPB,barPosZInInB,idrotm232));
479
480                 barIndexIn+=4;
481         }
482
483
484         // Construction of the support and bars for the OutSide
485
486
487         TGeoVolume *acordeFullSupportOutFace = new TGeoVolumeAssembly("ACORDE_FULL_SUPPORT_OUTFACE");
488         Float_t supportPosXOutA = constants->CenterModulePositionX(45)+deltaXA-90;
489         Float_t supportPosYOutA = 807.2915-7.5-5.5;
490         Float_t x000 = constants->CenterModulePositionX(45);
491         Float_t y000 = constants->CenterModulePositionY(45);
492         Float_t theta1 = 1*TMath::Pi()/4;
493
494         Float_t supportPosXOutPA = x000+(supportPosXOutA-x000)*TMath::Cos(theta1)-(supportPosYOutA-y000)*TMath::Sin(theta1);
495         Float_t supportPosYOutPA = y000+(supportPosYOutA-y000)*TMath::Cos(theta1)+(supportPosXOutA-x000)*TMath::Sin(theta1);
496         Float_t supportPosZOutIn = 0;
497
498
499         Float_t supportPosXOutC = constants->CenterModulePositionX(45)-deltaXA;
500         Float_t supportPosXOutPC = x000+(supportPosXOutC-x000)*TMath::Cos(theta1)-(supportPosYOutA-1-y000)*TMath::Sin(theta1);
501         Float_t supportPosYOutPC = y000+(supportPosYOutA-1-y000)*TMath::Cos(theta1)+(supportPosXOutC-x000)*TMath::Sin(theta1);
502
503         Float_t supportPosXOutD = constants->CenterModulePositionX(45)-deltaXB;
504         Float_t supportPosXOutPD = x000+(supportPosXOutD-x000)*TMath::Cos(theta1)-(supportPosYOutA-1-y000)*TMath::Sin(theta1);
505         Float_t supportPosYOutPD = y000+(supportPosYOutA-1-y000)*TMath::Cos(theta1)+(supportPosXOutD-x000)*TMath::Sin(theta1);
506
507
508         acordeFullSupportOutFace->AddNode(acordeMainSupport,1,new TGeoCombiTrans("ACOFSBOUT01",supportPosXOutPA,supportPosYOutPA,supportPosZOutIn,idrotm231));
509         acordeFullSupportOutFace->AddNode(acordeMainSupport,2,new TGeoCombiTrans("ACOFSBOUT02",supportPosXOutPC,supportPosYOutPC,supportPosZOutIn,idrotm231));
510         acordeFullSupportOutFace->AddNode(acordeMainSupport,3,new TGeoCombiTrans("ACOFSBOUT03",supportPosXOutPD,supportPosYOutPD,supportPosZOutIn,idrotm231));
511         
512
513         Float_t supportPosXOutE = constants->CenterModulePositionX(52)+deltaXA;
514         Float_t supportPosYOutE = 585.616-7.5-5.5-0.1;
515         Float_t x0000 = constants->CenterModulePositionX(52);
516         Float_t y0000 = constants->CenterModulePositionY(52);
517
518         Float_t supportPosXOutEP = x0000+(supportPosXOutE-x0000)*TMath::Cos(theta1)-(supportPosYOutE-y0000)*TMath::Sin(theta1);
519         Float_t supportPosYOutEP = y0000+(supportPosYOutE-y0000)*TMath::Cos(theta1)+(supportPosXOutE-x0000)*TMath::Sin(theta1);
520         
521         Float_t supportPosXOutF = constants->CenterModulePositionX(52)+deltaXB;
522
523         Float_t supportPosXOutFP = x0000+(supportPosXOutF-x0000)*TMath::Cos(theta1)-(supportPosYOutE-y0000)*TMath::Sin(theta1);
524         Float_t supportPosYOutFP = y0000+(supportPosYOutE-y0000)*TMath::Cos(theta1)+(supportPosXOutF-x0000)*TMath::Sin(theta1);
525
526         Float_t supportPosXOutG = constants->CenterModulePositionX(52)-deltaXA;
527         Float_t supportPosXOutGP = x0000+(supportPosXOutG-x0000)*TMath::Cos(theta1)-(supportPosYOutE-y0000)*TMath::Sin(theta1);
528         Float_t supportPosYOutGP = y0000+(supportPosYOutE-y0000)*TMath::Cos(theta1)+(supportPosXOutG-x0000)*TMath::Sin(theta1);
529
530         Float_t supportPosXOutH = constants->CenterModulePositionX(52)-deltaXB;
531         Float_t supportPosXOutHP = x0000+(supportPosXOutH-x0000)*TMath::Cos(theta1)-(supportPosYOutE-0.4-y0000)*TMath::Sin(theta1);
532         Float_t supportPosYOutHP = y0000+(supportPosYOutE-0.4-y0000)*TMath::Cos(theta1)+(supportPosXOutH-x0000)*TMath::Sin(theta1);
533
534
535         acordeFullSupportOutFace->AddNode(acordeMainSupport,4,new TGeoCombiTrans("ACOFSBOUT04",supportPosXOutEP,supportPosYOutEP,supportPosZOutIn,idrotm231));
536         acordeFullSupportOutFace->AddNode(acordeMainSupport,5,new TGeoCombiTrans("ACOFSBOUT05",supportPosXOutFP,supportPosYOutFP,supportPosZOutIn,idrotm231));
537         acordeFullSupportOutFace->AddNode(acordeMainSupport,6,new TGeoCombiTrans("ACOFSBOUT06",supportPosXOutGP,supportPosYOutGP,supportPosZOutIn,idrotm231));
538         acordeFullSupportOutFace->AddNode(acordeMainSupport,7,new TGeoCombiTrans("ACOFSBOUT07",supportPosXOutHP,supportPosYOutHP,supportPosZOutIn,idrotm231));
539
540         // Put the bars of the PutFace Side 2 L3-Magnet
541
542
543         Int_t indexBar0=8;
544         for(Int_t iAcoBar = 40;iAcoBar < 50 ; iAcoBar+=2)
545         {
546                 Float_t barPosXOutIn = constants->CenterModulePositionX(iAcoBar)+deltaXA-90;
547                 Float_t barPosYOutIn = supportPosYOutA-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
548                 Float_t barPosZOutIn = constants->CenterModulePositionZ(iAcoBar);
549                 Float_t barPosXOutP = x000+(barPosXOutIn-x000)*TMath::Cos(theta1)-(barPosYOutIn-y000)*TMath::Sin(theta1);
550                 Float_t barPosYOutP = y000+(barPosYOutIn-y000)*TMath::Cos(theta1)+(barPosXOutIn-x000)*TMath::Sin(theta1);
551
552                 Float_t barPosXOutInA = constants->CenterModulePositionX(iAcoBar)-deltaXA;
553                 Float_t barPosYOutInA = supportPosYOutA-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5-1.;
554                 Float_t barPosZOutInA = constants->CenterModulePositionZ(iAcoBar);
555                 Float_t barPosXOutPA = x000+(barPosXOutInA-x000)*TMath::Cos(theta1)-(barPosYOutInA-y000)*TMath::Sin(theta1);
556                 Float_t barPosYOutPA = y000+(barPosYOutInA-y000)*TMath::Cos(theta1)+(barPosXOutInA-x000)*TMath::Sin(theta1);
557
558
559                 Float_t barPosXOutInB = constants->CenterModulePositionX(iAcoBar)-deltaXB;
560                 Float_t barPosYOutInB = supportPosYOutA-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5-1.;
561                 Float_t barPosZOutInB = constants->CenterModulePositionZ(iAcoBar);
562                 Float_t barPosXOutPB = x000+(barPosXOutInB-x000)*TMath::Cos(theta1)-(barPosYOutInB-y000)*TMath::Sin(theta1);
563                 Float_t barPosYOutPB = y000+(barPosYOutInB-y000)*TMath::Cos(theta1)+(barPosXOutInB-x000)*TMath::Sin(theta1);
564         
565                 acordeFullSupportOutFace->AddNode(acordeMainBar,indexBar0,new TGeoCombiTrans("ACOFSBOUT08",barPosXOutP,barPosYOutP,barPosZOutIn,idrotm231));
566                 acordeFullSupportOutFace->AddNode(acordeMainBar,indexBar0+1,new TGeoCombiTrans("ACOFSBOUT08",barPosXOutPA,barPosYOutPA,barPosZOutInA,idrotm231));
567                 acordeFullSupportOutFace->AddNode(acordeMainBar,indexBar0+2,new TGeoCombiTrans("ACOFSBOUT08",barPosXOutPB,barPosYOutPB,barPosZOutInB,idrotm231));
568
569                 indexBar0+=4;
570         }
571         for(Int_t iAcoBar = 51;iAcoBar < 54 ; iAcoBar+=2)
572         {
573
574                 Float_t barPosXOutInC = constants->CenterModulePositionX(iAcoBar)+deltaXA;
575                 Float_t barPosYOutInC = supportPosYOutE-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
576                 Float_t barPosZOutInC = constants->CenterModulePositionZ(iAcoBar);
577                 Float_t barPosXOutPC = x0000+(barPosXOutInC-x0000)*TMath::Cos(theta1)-(barPosYOutInC-y0000)*TMath::Sin(theta1);
578                 Float_t barPosYOutPC = y0000+(barPosYOutInC-y0000)*TMath::Cos(theta1)+(barPosXOutInC-x0000)*TMath::Sin(theta1);
579
580
581                 Float_t barPosXOutInD = constants->CenterModulePositionX(iAcoBar)+deltaXB;
582                 Float_t barPosYOutInD = supportPosYOutE-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
583                 Float_t barPosZOutInD = constants->CenterModulePositionZ(iAcoBar);
584                 Float_t barPosXOutPD = x0000+(barPosXOutInD-x0000)*TMath::Cos(theta1)-(barPosYOutInD-y0000)*TMath::Sin(theta1);
585                 Float_t barPosYOutPD = y0000+(barPosYOutInD-y0000)*TMath::Cos(theta1)+(barPosXOutInD-x0000)*TMath::Sin(theta1);
586
587
588                 Float_t barPosXOutInE = constants->CenterModulePositionX(iAcoBar)-deltaXA;
589                 Float_t barPosYOutInE = supportPosYOutE-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
590                 Float_t barPosZOutInE = constants->CenterModulePositionZ(iAcoBar);
591                 Float_t barPosXOutPE = x0000+(barPosXOutInE-x0000)*TMath::Cos(theta1)-(barPosYOutInE-y0000)*TMath::Sin(theta1);
592                 Float_t barPosYOutPE = y0000+(barPosYOutInE-y0000)*TMath::Cos(theta1)+(barPosXOutInE-x0000)*TMath::Sin(theta1);
593                 Float_t barPosXOutInF = constants->CenterModulePositionX(iAcoBar)-deltaXB;
594                 Float_t barPosYOutInF = supportPosYOutE-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
595                 Float_t barPosZOutInF = constants->CenterModulePositionZ(iAcoBar);
596                 Float_t barPosXOutPF = x0000+(barPosXOutInF-x0000)*TMath::Cos(theta1)-(barPosYOutInF-0.4-y0000)*TMath::Sin(theta1);
597                 Float_t barPosYOutPF = y0000+(barPosYOutInF-0.4-y0000)*TMath::Cos(theta1)+(barPosXOutInF-x0000)*TMath::Sin(theta1);
598
599                 acordeFullSupportOutFace->AddNode(acordeMainBar,indexBar0,new TGeoCombiTrans("ACOFSBOUT08",barPosXOutPC,barPosYOutPC,barPosZOutInC,idrotm231));
600                 acordeFullSupportOutFace->AddNode(acordeMainBar,indexBar0+1,new TGeoCombiTrans("ACOFSBOUT08",barPosXOutPD,barPosYOutPD,barPosZOutInD,idrotm231));
601                 acordeFullSupportOutFace->AddNode(acordeMainBar,indexBar0+2,new TGeoCombiTrans("ACOFSBOUT08",barPosXOutPE,barPosYOutPE,barPosZOutInE,idrotm231));
602                 acordeFullSupportOutFace->AddNode(acordeMainBar,indexBar0+3,new TGeoCombiTrans("ACOFSBOUT08",barPosXOutPF,barPosYOutPF,barPosZOutInF,idrotm231));
603                 indexBar0+=4;
604         }
605
606
607         for(Int_t iAcoBar = 57;iAcoBar < 58 ; iAcoBar+=2)
608         {
609
610                 Float_t barPosXOutInC = constants->CenterModulePositionX(iAcoBar)+deltaXA;
611                 Float_t barPosYOutInC = supportPosYOutE-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
612                 Float_t barPosZOutInC = constants->CenterModulePositionZ(iAcoBar);
613                 Float_t barPosXOutPC = x0000+(barPosXOutInC-x0000)*TMath::Cos(theta1)-(barPosYOutInC-y0000)*TMath::Sin(theta1);
614                 Float_t barPosYOutPC = y0000+(barPosYOutInC-y0000)*TMath::Cos(theta1)+(barPosXOutInC-x0000)*TMath::Sin(theta1);
615
616
617                 Float_t barPosXOutInD = constants->CenterModulePositionX(iAcoBar)+deltaXB;
618                 Float_t barPosYOutInD = supportPosYOutE-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
619                 Float_t barPosZOutInD = constants->CenterModulePositionZ(iAcoBar);
620                 Float_t barPosXOutPD = x0000+(barPosXOutInD-x0000)*TMath::Cos(theta1)-(barPosYOutInD-y0000)*TMath::Sin(theta1);
621                 Float_t barPosYOutPD = y0000+(barPosYOutInD-y0000)*TMath::Cos(theta1)+(barPosXOutInD-x0000)*TMath::Sin(theta1);
622
623
624                 Float_t barPosXOutInE = constants->CenterModulePositionX(iAcoBar)-deltaXA;
625                 Float_t barPosYOutInE = supportPosYOutE-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
626                 Float_t barPosZOutInE = constants->CenterModulePositionZ(iAcoBar);
627                 Float_t barPosXOutPE = x0000+(barPosXOutInE-x0000)*TMath::Cos(theta1)-(barPosYOutInE-y0000)*TMath::Sin(theta1);
628                 Float_t barPosYOutPE = y0000+(barPosYOutInE-y0000)*TMath::Cos(theta1)+(barPosXOutInE-x0000)*TMath::Sin(theta1);
629                 Float_t barPosXOutInF = constants->CenterModulePositionX(iAcoBar)-deltaXB;
630                 Float_t barPosYOutInF = supportPosYOutE-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
631                 Float_t barPosZOutInF = constants->CenterModulePositionZ(iAcoBar);
632                 Float_t barPosXOutPF = x0000+(barPosXOutInF-x0000)*TMath::Cos(theta1)-(barPosYOutInF-0.4-y0000)*TMath::Sin(theta1);
633                 Float_t barPosYOutPF = y0000+(barPosYOutInF-0.4-y0000)*TMath::Cos(theta1)+(barPosXOutInF-x0000)*TMath::Sin(theta1);
634
635                 acordeFullSupportOutFace->AddNode(acordeMainBar,indexBar0,new TGeoCombiTrans("ACOFSBOUT08",barPosXOutPC,barPosYOutPC,barPosZOutInC,idrotm231));
636                 acordeFullSupportOutFace->AddNode(acordeMainBar,indexBar0+1,new TGeoCombiTrans("ACOFSBOUT08",barPosXOutPD,barPosYOutPD,barPosZOutInD,idrotm231));
637                 acordeFullSupportOutFace->AddNode(acordeMainBar,indexBar0+2,new TGeoCombiTrans("ACOFSBOUT08",barPosXOutPE,barPosYOutPE,barPosZOutInE,idrotm231));
638                 acordeFullSupportOutFace->AddNode(acordeMainBar,indexBar0+3,new TGeoCombiTrans("ACOFSBOUT08",barPosXOutPF,barPosYOutPF,barPosZOutInF,idrotm231));
639                 indexBar0+=4;
640         }
641
642
643         Float_t barPosXOutInC = constants->CenterModulePositionX(52)+deltaXA;
644         Float_t barPosYOutInC = supportPosYOutE-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
645         Float_t barPosZOutInC = constants->CenterModulePositionZ(55);
646         Float_t barPosXOutPC = x0000+(barPosXOutInC-x0000)*TMath::Cos(theta1)-(barPosYOutInC-y0000)*TMath::Sin(theta1);
647         Float_t barPosYOutPC = y0000+(barPosYOutInC-y0000)*TMath::Cos(theta1)+(barPosXOutInC-x0000)*TMath::Sin(theta1);
648
649
650         Float_t barPosXOutInD = constants->CenterModulePositionX(52)+deltaXB;
651         Float_t barPosYOutInD = supportPosYOutE-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
652         Float_t barPosXOutPD = x0000+(barPosXOutInD-x0000)*TMath::Cos(theta1)-(barPosYOutInD-y0000)*TMath::Sin(theta1);
653         Float_t barPosYOutPD = y0000+(barPosYOutInD-y0000)*TMath::Cos(theta1)+(barPosXOutInD-x0000)*TMath::Sin(theta1);
654
655
656         Float_t barPosXOutInE = constants->CenterModulePositionX(52)-deltaXA;
657         Float_t barPosYOutInE = supportPosYOutE-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
658         Float_t barPosXOutPE = x0000+(barPosXOutInE-x0000)*TMath::Cos(theta1)-(barPosYOutInE-y0000)*TMath::Sin(theta1);
659         Float_t barPosYOutPE = y0000+(barPosYOutInE-y0000)*TMath::Cos(theta1)+(barPosXOutInE-x0000)*TMath::Sin(theta1);
660         Float_t barPosXOutInF = constants->CenterModulePositionX(52)-deltaXB;
661         Float_t barPosYOutInF = supportPosYOutE-boxSingleBar[1]-boxUnionUp[1]-boxUnionDown[1]-7.5;
662         Float_t barPosXOutPF = x0000+(barPosXOutInF-x0000)*TMath::Cos(theta1)-(barPosYOutInF-0.4-y0000)*TMath::Sin(theta1);
663         Float_t barPosYOutPF = y0000+(barPosYOutInF-0.4-y0000)*TMath::Cos(theta1)+(barPosXOutInF-x0000)*TMath::Sin(theta1);
664
665         acordeFullSupportOutFace->AddNode(acordeMainBar,indexBar0,new TGeoCombiTrans("ACOFSBOUT08",barPosXOutPC,barPosYOutPC,barPosZOutInC,idrotm231));
666         acordeFullSupportOutFace->AddNode(acordeMainBar,indexBar0+1,new TGeoCombiTrans("ACOFSBOUT08",barPosXOutPD,barPosYOutPD,barPosZOutInC,idrotm231));
667         acordeFullSupportOutFace->AddNode(acordeMainBar,indexBar0+2,new TGeoCombiTrans("ACOFSBOUT08",barPosXOutPE,barPosYOutPE,barPosZOutInC,idrotm231));
668         acordeFullSupportOutFace->AddNode(acordeMainBar,indexBar0+3,new TGeoCombiTrans("ACOFSBOUT08",barPosXOutPF,barPosYOutPF,barPosZOutInC,idrotm231));
669         
670
671
672
673
674         supportBars->AddNode(acordeFullSupportUpFace,1);
675         supportBars->AddNode(acordeFullSupportInFace,2);
676         supportBars->AddNode(acordeFullSupportOutFace,3);
677         acorde->AddNode(acordeModules,1);
678         acorde->AddNode(supportBars,2);
679         alice->AddNode(acorde,1);//---> put volume of ACORDE over ALICE's volume
680
681
682
683 }
684 //__________________________________________________________________________
685
686 void AliACORDEv1::Init()
687 {
688   // Initialise L3 magnet after it has been built
689   Int_t i;
690   if(AliLog::GetGlobalDebugLevel()>0) {
691     printf("\n%s: ",ClassName());
692     for(i=0;i<35;i++) printf("*");
693     printf(" ACORDEv1_INIT ");
694     for(i=0;i<35;i++) printf("*");
695     printf("\n%s: ",ClassName());
696     // Here the ACORDEv initialisation code (if any!)
697     for(i=0;i<80;i++) printf("*");
698     printf("\n");
699   }
700  // AliACORDE::Init();  
701 }
702 //____________________________________________________________________________
703 void AliACORDEv1::StepManager()
704 {
705
706   //
707   // Called for every step in the Cosmic Ray Trigger
708   //
709
710
711   // volume: 
712   //  [0] = module number 1-60 (1==>(0-0), 60 (5-9)
713   //  [1] = Plastic number: 0 (down) to 1 (up)
714   static Int_t   vol[2]; 
715   //
716   // hit
717   // [0] = PID
718   // [1-3] = x, y, z 
719   // [4] = time 
720   // [5-7] = px, py, pz
721   // [8] = energy 
722   // [9] = energy loss
723   // [10] = length of track through plastic
724   static Float_t hits[11];
725
726   // local static variables
727   static Float_t eloss;
728   static Float_t step;
729   // scintillator volume
730  static Int_t idScint = gMC->VolId("ACORDESCINTILLATORMODULE");
731   // local variables
732   Int_t copy;
733   TLorentzVector pos;
734   TLorentzVector mom;
735
736   // only charged tracks
737   if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return;
738
739   // only in sensitive material
740   if (gMC->CurrentVolID(copy) == idScint) {
741
742     step  += gMC->TrackStep();
743     eloss += gMC->Edep();
744     // set all hit variables except eloss which is resetted
745     // set volume variables
746     if (gMC->IsTrackEntering()) {
747       eloss = 0.0;
748       step = 0.0;
749       gMC->TrackPosition(pos);
750       gMC->TrackMomentum(mom);
751       // hit
752       // [0] = PID
753       // [1-3] = x, y, z 
754       // [4] = time 
755       // [5-7] = px, py, pz
756       // [8] = energy 
757       // [9] = energy loss
758       hits[0]  = (Float_t ) gMC->TrackPid(); 
759
760
761       hits[1] = pos[0]; 
762       hits[2] = pos[1]; 
763       hits[3] = pos[2]; 
764       hits[4] = gMC->TrackTime();
765       hits[5] = mom[0];
766       hits[6] = mom[1];
767       hits[7] = mom[2];
768       hits[8] = gMC->Etot();
769       // volume: 
770       //  [0] = module number 1-60 (1==>(0-0), 60 (5-9)
771       //  [1] = Plastic number: 0 (down) to 1 (up)
772       Int_t copyPlastic; // plastic: down=1, up=2
773       Int_t copyModule; // module: 1-60
774       gMC->CurrentVolID(copyPlastic);
775       gMC->CurrentVolOffID(1, copyModule);
776       // module
777       vol[0] = copyModule;
778       // plastic: 0 = down, 1 = up
779       vol[1] = copyPlastic - 4 ; // !!!!!!!
780     // vol[1] = copyPlastic;
781     } // end if gMC->IsTrackEntering()
782
783     // set hit[9] = total energy loss and book hit
784     if( gMC->IsTrackExiting() || 
785         gMC->IsTrackStop() || 
786         gMC->IsTrackDisappeared()){
787       hits[9] = eloss;
788       hits[10] = step;
789       eloss = 0.0;
790       step = 0.0;
791       AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits);
792      }
793   } 
794
795
796
797 }
798
799 //_____________________________________________________________________________
800 void AliACORDEv1::AddHit(Int_t track, Int_t *vol, Float_t *hits)
801 {
802   //
803   // Add an ACORDE hit
804   //
805   TClonesArray &lhits = *fHits;
806   new(lhits[fNhits++]) AliACORDEhit(fIshunt,track,vol,hits);
807 }
808
809 //_____________________________________________________________________________
810 void AliACORDEv1::AddDigits(Int_t* track, Int_t module, Float_t time)
811 {
812   
813   // Adds Digit
814   
815   TClonesArray &ldigits = *fDigits;
816   new(ldigits[fNdigits++]) AliACORDEdigit(track,module,time);
817 }
818 //_____________________________________________________________________________
819
820 void AliACORDEv1::MakeBranch(Option_t *option)
821 {
822 // Creates new branches in the current Root Tree
823     
824   char branchname[10];
825   snprintf(branchname,9,"%s",GetName());
826   AliDebug(2,Form("fBufferSize = %d",fBufferSize));
827   const char *cH = strstr(option,"H");
828   if (fHits   && fLoader->TreeH() && cH) {
829     fLoader->TreeH()->Branch(branchname,&fHits, fBufferSize);
830     AliDebug(2,Form("Making Branch %s for hits",branchname));
831   }     
832   const char *cD = strstr(option,"D");
833   if (fDigits   && fLoader->TreeD() && cD) {
834     fLoader->TreeD()->Branch(branchname,&fDigits, fBufferSize);
835     AliDebug(2,Form("Making Branch %s for digits",branchname));
836   }  
837 }
838
839 //_____________________________________________________________________________
840 void AliACORDEv1::AddAlignableVolumes() const
841 {
842   //
843   // Create entries for alignable volumes associating the symbolic volume
844   // name with the corresponding volume path. Needs to be syncronized with
845   // eventual changes in the geometry.
846   // 
847
848         // The alignable volumes are only the "ACORDE_MODULE_%d"
849         //
850         //      Structure of ACORDE's Geometry
851         //
852         //      ALIC_1
853         //          |---> ACORDE_1      
854         //                      |----> ALL_ACORDE_MODULES_1/ACORDE_MODULE_%d (d:0->to->59)
855         //                      |----> ACORDE_SUPPORT_BARS_2    |--> BARS&SUPPORTS
856         //
857         //     Send comments to: Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch>
858
859         TString vpstr1 = "ALIC_1/ACORDE_1/ALL_ACORDE_MODULES_1/ACORDE_MODULE_";
860         TString snstr1 = "ACORDE/Array";
861         TString volpath, symname;
862         for(Int_t dy=0; dy<60 ; dy++)
863         {
864                 volpath = vpstr1;
865                 volpath += dy;
866                 symname = snstr1;
867                 symname += dy;
868                 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
869                 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
870         }
871 }