]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALv0.cxx
New methods in geometry, update geometry for 3x3 case
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv0.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 /* $Id$ */
16
17 //_________________________________________________________________________
18 // Implementation version v0 of EMCAL Manager class 
19 // An object of this class does not produce hits nor digits
20 // It is the one to use if you do not want to produce outputs in TREEH or TREED
21 // This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx                 
22 //*-- Author: Yves Schutz (SUBATECH)
23 //*-- and   : Sahal Yacoob (LBL / UCT)
24 //          : Aleksei Pavlinov (WSU)     SHASHLYK
25
26 // --- ROOT system ---
27
28 #include <TNode.h>
29 #include <TBRIK.h>
30 #include <TTRD1.h>
31 #include <TTRD2.h>
32 #include <TTRAP.h>
33 #include <TPGON.h>
34 #include <TTUBS.h>
35 #include <TGeometry.h>
36 #include <TVirtualMC.h>
37 #include <TArrayI.h>
38 #include <TROOT.h>
39 #include <TList.h>
40 #include <TVector2.h>
41
42 #include "AliEMCALShishKebabModule.h"
43 #include "AliEMCALShishKebabTrd1Module.h"
44
45 // --- Standard library ---
46
47 //#include <stdio.h>
48
49 // --- AliRoot header files ---
50
51 #include "AliEMCALv0.h"
52 #include "AliEMCALGeometry.h"
53 #include "AliRun.h"
54 #include "AliLog.h"
55
56 ClassImp(AliEMCALv0)
57
58 // EMCAL material
59 enum
60  {
61   kIdAIR   = 1599, 
62   kIdPB    = 1600, 
63   kIdSC    = 1601, 
64   kIdSTEEL = 1603
65  };
66
67
68 //______________________________________________________________________
69 AliEMCALv0::AliEMCALv0()
70   : AliEMCAL(),
71     fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
72     fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0)
73 {
74   //default ctor
75 }
76
77 //______________________________________________________________________
78 AliEMCALv0::AliEMCALv0(const char *name, const char *title)
79   : AliEMCAL(name,title),
80     fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
81     fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0)
82 {
83   // ctor : title is used to identify the layout
84     // Apr 25, 2006
85   TString ntmp(GetTitle());
86   ntmp.ToUpper();
87   if(ntmp == "TRD1") { // TRD1 is alias for SHISH_77_TRD1_2X2_FINAL_110DEG NL=69
88     ntmp = "SHISH_77_TRD1_2X2_FINAL_110DEG NL=69";
89     SetTitle(ntmp.Data());
90   }
91
92   AliEMCALGeometry *geom = GetGeometry() ; 
93   //geom->CreateListOfTrd1Modules(); 
94   fShishKebabModules = geom->GetShishKebabTrd1Modules(); 
95 }
96
97 //______________________________________________________________________
98 void AliEMCALv0::BuildGeometry()
99 {
100     // Display Geometry for display.C
101
102     const Int_t kColorArm1   = kBlue ;
103
104     AliEMCALGeometry * geom = GetGeometry();
105
106     TString gn(geom->GetName());
107     gn.ToUpper(); 
108
109     // Define the shape of the Calorimeter 
110     TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
111     TNode * envelopNode = 0;
112     char *envn = "Envelop1";
113     if(!gn.Contains("SHISH") || gn.Contains("TRD2")){
114       new TTUBS(envn, "Tubs that contains arm 1", "void", 
115               geom->GetEnvelop(0) -10, // rmin 
116               geom->GetEnvelop(1) +40 ,// rmax
117               geom->GetEnvelop(2)/2.0, // half length in Z
118               geom->GetArm1PhiMin(),   // minimum phi angle
119               geom->GetArm1PhiMax()    // maximum phi angle
120         );
121       top->cd();
122       envelopNode = new TNode(envn, "Arm1 Envelop", "Envelop1", 0., 0., 0., "") ;
123     } else {
124       if(gn.Contains("WSUC")) {
125         envelopNode = BuildGeometryOfWSUC();
126       } else { // Shish-kebab now for compact, twist and TRD1 cases (ALIC)
127         envn="Envelop2";
128         TPGON *pgon = new TPGON(envn, "PGON that contains arm 1", "void", 
129         geom->GetArm1PhiMin(),geom->GetArm1PhiMax()-geom->GetArm1PhiMin(),geom->GetNPhiSuperModule(), 2);
130       // define section
131         pgon->DefineSection(0, fEnvelop1[4],  fEnvelop1[5], fEnvelop1[6]);
132         pgon->DefineSection(1, fEnvelop1[7],  fEnvelop1[5], fEnvelop1[6]);
133         top->cd();
134         envelopNode = new TNode(envn, "Arm1 Envelop2", envn, 0., 0., 0., "") ;
135       }
136     }
137                                 
138     envelopNode->SetLineColor(kColorArm1) ;
139     fNodes->Add(envelopNode);
140 }
141
142 TNode *AliEMCALv0::BuildGeometryOfWSUC()
143
144   // June 8, 2005; see directory geant3/TGeant3/G3toRoot.cxx
145   // enum EColor { kWhite, kBlack, kRed, kGreen, kBlue, kYellow, kMagenta, kCyan } - see $ROOTSYS/include/Gtypes.h
146    AliEMCALGeometry * g = GetGeometry(); 
147    TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
148    top->cd();
149
150    TNode *envelopNode = 0;
151    char *name = "";
152    /*
153     name = "WSUC";
154    new TBRIK(name, "WSUC(XEN1 in Geant)","void",fEnvelop1[0],fEnvelop1[1],fEnvelop1[2]);
155     envelopNode = new TNode(name, "envelope for WSUC", name, 0., 0., 0., "");
156    envelopNode->SetVisibility(0);
157    */
158
159    TNode *emod=0, *scmx=0;
160    name = "SMOD"; // super module
161    new TBRIK(name, "SMOD(SMOD in Geant)","void", fSmodPar0,fSmodPar1,fSmodPar2);
162    if(envelopNode) envelopNode->cd();
163    TNode *smod = new TNode(name, "SMOD", name, 0., 0., 0., "");   
164    smod->SetLineColor(kBlue) ;
165    if(envelopNode==0) envelopNode = smod;
166
167    name = "EMOD"; // see CreateEMOD 
168    TTRD1 *emodTrd1 = new TTRD1(name, "EMOD(EMOD in Geant)","void", float(fParEMOD[0]),
169    float(fParEMOD[1]),float(fParEMOD[2]),float(fParEMOD[3]));
170
171    // SCMX = EMOD/4 for simplicity of drawing
172    name = "SCMX";
173    Float_t dz=0.,theta=0.,phi=0.,h1=0.,bl1=0.,tl1=0.,alpha1=0.,h2=0.,bl2=0.,tl2=0.,alpha2=0.;
174    h1     = emodTrd1->GetDy()/2.;
175    bl1    = emodTrd1->GetDx()/2.;
176    tl1    = bl1;
177    alpha1 = 0.;
178    h2     = emodTrd1->GetDy()/2.;
179    bl2    = emodTrd1->GetDx2()/2.;
180    tl2    = bl2;
181    alpha2 = 0.;
182
183    dz       = emodTrd1->GetDz();
184    double dr = TMath::Sqrt((h2-h1)*(h2-h1)+(bl2-bl1)*(bl2-bl1));
185    theta    = TMath::ATan2(dr,2.*dz) * TMath::RadToDeg(); 
186    phi      = 180.;
187
188    TTRAP *scmxTrap = new TTRAP(name, "SCMX(SCMX as in Geant)","void",
189              dz,theta,phi, h1,bl1,tl1,alpha1, h2,bl2,tl2,alpha2);
190    //   scmxTrap->Dump();
191    Float_t xShiftSCMX = (emodTrd1->GetDx() + emodTrd1->GetDx2())/4.;
192    Float_t yShiftSCMX = emodTrd1->GetDy()/2.;
193    printf(" xShiftSCMX %7.4f yShiftSCMX %7.4f \n",xShiftSCMX,yShiftSCMX);
194
195    name = "EMOD"; // see CreateEMOD 
196    smod->cd();
197    
198    AliEMCALShishKebabTrd1Module *mod=0;
199    Double_t  angle=90., xpos=0.,ypos=0.,zpos=0., xposSCMX=0.,yposSCMX=0.,zposSCMX=0.;
200    char rtmn[100], rtmt[100];
201    TRotMatrix *rtm=0, *rtmSCMX=0;
202    int numEmod=0;
203    for(int iz=0; iz<g->GetNZ(); iz++) {
204      mod   = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
205      zpos = mod->GetPosZ()      - fSmodPar2;
206      ypos = mod->GetPosXfromR() - fSmodPar1;
207
208      angle = mod->GetThetaInDegree();
209      sprintf(rtmn,"rmEmod%5.1f",angle);
210      sprintf(rtmt,"rotation matrix for EMOD, iz=%i, angle = %6.3f",iz, angle);
211      if(iz==0) rtm = new TRotMatrix(rtmn, rtmt,0.,0., 90.,0., 90.,90.); // z'(x); y'(y); x'(z)
212      else      rtm = new TRotMatrix(rtmn, rtmt,90.-angle,270., 90.0,0.0, angle,90.);
213
214      TGeometry *tg = gAlice->GetGeometry();
215      for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
216        xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
217        sprintf(rtmt,"EMOD, iz %i, ix %i, angle %6.3f",iz,ix, angle);
218        TString namNode=name;
219        namNode += numEmod++;
220        smod->cd();
221        emod = new TNode(namNode.Data(), rtmt, (TShape*)emodTrd1, xpos,ypos,zpos,rtm);   
222        //       emod->SetLineColor(kGreen) ;
223        emod->SetVisibility(0); // SCMX will bi visible 
224        if(scmxTrap) { // 4(2x2) sensetive volume inside EMOD
225          emod->cd();
226          zposSCMX = 0.;
227          for(int jy=0; jy<2; jy++){ // division on y
228            yposSCMX = yShiftSCMX *(2*jy - 1); 
229            for(int jx=0; jx<2; jx++){ // division on x
230              Double_t theta1=90.,phi1=0., theta2=90.,phi2=90., theta3=0.,phi3=0 ; 
231              xposSCMX = xShiftSCMX *(2*jx - 1);              
232              namNode = "SCMX";
233              namNode += jy;
234              namNode += jx;
235              sprintf(rtmn,"rm%s",namNode.Data());
236              sprintf(rtmt,"rotation matrix for %s inside EMOD",namNode.Data());
237              rtmSCMX = tg->GetRotMatrix(rtmn);
238              if(jx == 1) {
239                phi1 = 180.; // x' = -x
240                phi2 = 270.; // y' = -y
241              }
242              if(rtmSCMX == 0) rtmSCMX = new TRotMatrix(rtmn,rtmt, theta1,phi1, theta2,phi2, theta3,phi3);
243              sprintf(rtmt,"%s inside %s", namNode.Data(), emod->GetName());
244              scmx = new TNode(namNode.Data(), rtmt, (TShape*)scmxTrap, xposSCMX,yposSCMX,zposSCMX,rtmSCMX);   
245              scmx->SetLineColor(kMagenta);
246            }
247          }
248        }
249      }
250    }
251    //   emod->Draw(); // for testing
252
253    return envelopNode;
254 }
255
256 //______________________________________________________________________
257 void AliEMCALv0::CreateGeometry()
258 {
259   // Create the EMCAL geometry for Geant
260   // Geometry of a tower
261   //|-----------------------------------------------------| XEN1
262   //| |                                                 | |
263   //| |    Al thickness = GetAlFrontThickness()         | |
264   //| |                                                 | |
265   //| |                                                 | |
266   //| |                                                 | |
267   //|  -------------------------------------------------  |
268   //| |    Air Gap = GetGap2Active()                    | |
269   //| |                                                 | |
270   //|  -------------------------------------------------  |
271   //| |    XU1 : XPST (ECAL e = GetECScintThick() )     | |
272   //|  -------------------------------------------------  |
273   //| |    XU1 : XPBX (ECAL e = GetECPbRadThick() )     | |
274   //|  -------------------------------------------------  |
275   //| |    XU1 : XPST (ECAL e = GetECScintThick()       | |
276   //|  -------------------------------------------------  |
277   //| |    XU1 : XPBX (ECAL e = GetECPbRadThick() )     | |
278   //|  -------------------------------------------------  |
279   //|    etc ..... GetNECLayers() - 1 times               |
280   //|  -------------------------------------------------  |
281   //| |    XUNLayer : XPST (ECAL e = GetECScintThick()  | |
282   //|  -------------------------------------------------  |
283
284     AliEMCALGeometry * geom = GetGeometry() ; 
285     TString gn(geom->GetName());
286     gn.ToUpper(); 
287
288     if(!(geom->IsInitialized())){
289         Error("CreateGeometry","EMCAL Geometry class has not been set up.");
290     } // end if
291
292     // Get pointer to the array containing media indices
293     fIdTmedArr = fIdtmed->GetArray() - 1599 ;
294
295     fIdRotm = 1;
296     //  gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule
297     AliMatrix(fIdRotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ; 
298
299     // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1 
300
301     Float_t envelopA[10];
302     if(gn.Contains("TRD2")) { // TUBS
303        envelopA[0] = geom->GetEnvelop(0) - 10.; // rmin 
304        envelopA[1] = geom->GetEnvelop(1) + 12.; // rmax
305        //       envelopA[2] = geom->ZFromEtaR(geom->GetEnvelop(1), geom->GetArm1EtaMin());
306        envelopA[2] = 390.; // 6-feb-05
307        envelopA[3] = geom->GetArm1PhiMin();
308        envelopA[4] = geom->GetArm1PhiMax();
309        gMC->Gsvolu("XEN1", "TUBS", fIdTmedArr[kIdAIR], envelopA, 5) ;   // Tubs filled with air 
310        fEnvelop1.Set(5, envelopA);
311     // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)  
312        gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
313     } else if(gn.Contains("TRD1") && gn.Contains("WSUC") ) { // TRD1 for WSUC facility
314       // 17-may-05 - just BOX
315       envelopA[0] = 26;
316       envelopA[1] = 15;
317       envelopA[2] = 30;
318       gMC->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ;
319       fEnvelop1.Set(3);
320       for(int i=0; i<3; i++) fEnvelop1[i] = envelopA[i]; // 23-may-05  
321       // Position the EMCAL Mother Volume (XEN1) in WSUC  
322       gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
323     } else { 
324       envelopA[0] = geom->GetArm1PhiMin();                         // minimum phi angle
325       envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
326       envelopA[2] = geom->GetNPhi();                               // number of sections in phi
327       envelopA[3] = 2;                                             // 2 z coordinates
328       // envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1),
329 //geom->GetArm1EtaMin());       // z coordinate 1
330       envelopA[4] = -350.; // AM 30/5/2006
331       
332     //add some padding for mother volume
333       envelopA[5] = geom->GetEnvelop(0) ;                          // rmin at z1
334       envelopA[6] = geom->GetEnvelop(1) ;                          // rmax at z1
335 //      envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1),
336 //                                geom->GetArm1EtaMax());        // z coordinate 2
337       envelopA[7] = 350.; // AM 30/5/2006
338       
339       envelopA[8] = envelopA[5] ;                                  // radii are the same.
340       envelopA[9] = envelopA[6] ;                                  // radii are the same.
341
342       if(gn.Contains("SHISH")) envelopA[2] = geom->GetNPhiSuperModule();
343
344       gMC->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ;   // Polygone filled with air 
345       fEnvelop1.Set(10, envelopA);
346       if (gDebug==2) {
347         printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]); 
348         printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]); 
349       }
350     // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)  
351       gMC->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
352     }
353
354     if(gn.Contains("SHISH")){
355       // COMPACT, TWIST, TRD2 or TRD1
356       AliDebug(2,Form("Shish-Kebab geometry : %s", GetTitle())); 
357       CreateShishKebabGeometry();
358     }
359 }
360
361 //______________________________________________________________________
362 void AliEMCALv0::Init(void)
363 {
364     // Just prints an information message
365   
366   if(AliLog::GetGlobalDebugLevel()>0) { 
367     TString message("\n") ; 
368     message += "*****************************************\n" ;
369     
370     // Here the EMCAL initialisation code (if any!)
371     
372     AliEMCALGeometry * geom = GetGeometry() ; 
373     
374     if (geom!=0) {   
375       message += "AliEMCAL " ; 
376       message += Version() ; 
377       message += "EMCAL geometry initialized for " ; 
378       message += geom->GetName()  ;
379     }
380     else {
381       message += "AliEMCAL " ; 
382       message += Version() ;  
383       message += "EMCAL geometry initialization failed !" ; 
384     }
385     message += "\n*****************************************" ;
386     printf(message.Data() ) ; 
387   }
388 }
389
390 // 24-aug-04 by PAI
391 void AliEMCALv0::CreateShishKebabGeometry()
392 {  
393   // TWIST, TRD1 and TRD2 
394   AliEMCALGeometry * g = GetGeometry(); 
395   TString gn(g->GetName()); gn.ToUpper(); 
396   // see AliModule::fFIdTmedArr
397   //  fIdTmedArr = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials()
398   //  int kIdAIR=1599, kIdPB = 1600, kIdSC = 1601, kIdSTEEL = 1603;
399   //  idAL = 1602;
400   Double_t par[10], xpos=0., ypos=0., zpos=0.;
401
402   CreateSmod(g->GetNameOfEMCALEnvelope());
403
404   CreateEmod("SMOD","EMOD"); // 18-may-05
405
406   if(g->GetKey110DEG()) CreateEmod("SM10","EMOD"); // Nov 1,2006 
407
408   // Sensitive SC  (2x2 tiles)
409   double parSCM0[5]={0,0,0,0}, *dummy = 0, parTRAP[11];
410   Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTmp = TMath::Tan(trd1Angle/2.);
411    if(!gn.Contains("TRD")) { // standard module
412     par[0] = (g->GetECPbRadThick()+g->GetECScintThick())*g->GetNECLayers()/2.;
413     par[1] = par[2] = g->GetPhiTileSize();   // Symetric case
414     gMC->Gsvolu("SCM0", "BOX", fIdTmedArr[kIdSC], par, 3); // 2x2 tiles
415     gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
416     // Division to tile size
417     gMC->Gsdvn("SCM1","SCM0", g->GetNPHIdiv(), 2); // y-axis
418     gMC->Gsdvn("SCM2","SCM1", g->GetNETAdiv(), 3); // z-axis
419   // put LED to the SCM2 
420     par[0] = g->GetECPbRadThick()/2.;
421     par[1] = par[2] = g->GetPhiTileSize()/2.; // Symetric case
422     gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], par, 3);
423
424     printf(" Pb tiles \n");
425     int nr=0;
426     ypos = zpos = 0.0;
427     xpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
428     for(int ix=0; ix<g->GetNECLayers(); ix++){
429       gMC->Gspos("PBTI", ++nr, "SCM2", xpos, ypos, zpos, 0, "ONLY") ;
430     //    printf(" %i xpos %f \n", ix+1, xpos);
431       xpos += fSampleWidth;
432     } 
433     printf(" Number of Pb tiles in SCM2 %i \n", nr);
434   } else if(gn.Contains("TRD1")) { // TRD1 - 30-sep-04
435     if(gn.Contains("MAY05")){
436       Double_t dzTmp = g->GetFrontSteelStrip()+g->GetPassiveScintThick();
437       parSCM0[0] = fParEMOD[0] + tanTmp*dzTmp; // dx1
438       parSCM0[1] = fParEMOD[1];                // dx2
439       parSCM0[2] = fParEMOD[2];                // dy
440       for(int i=0; i<3; i++) parSCM0[i] -= g->GetLateralSteelStrip();
441       parSCM0[3] = fParEMOD[3] - dzTmp/2.; // dz
442
443       gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
444       gMC->Gspos("SCM0", 1, "EMOD", 0., 0., dzTmp/2., 0, "ONLY") ;
445     } else { // before MAY 2005
446       //      double wallThickness = g->GetPhiModuleSize()/2. -  g->GetPhiTileSize(); // Need check
447       double wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() -  g->GetPhiTileSize();
448       for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
449       parSCM0[3] = fParEMOD[3];
450       gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
451       gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
452     }
453
454     if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
455     // Division to tile size - 1-oct-04
456       AliDebug(2,Form(" Divide SCM0 on y-axis %i\n", g->GetNETAdiv()));
457       gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
458     // Trapesoid 2x2
459       parTRAP[0] = parSCM0[3];    // dz
460       parTRAP[1] = TMath::ATan2((parSCM0[1]-parSCM0[0])/2.,2.*parSCM0[3])*180./TMath::Pi(); // theta
461       parTRAP[2] = 0.;           // phi
462       // bottom
463       parTRAP[3] = parSCM0[2]/2.; // H1
464       parTRAP[4] = parSCM0[0]/2.; // BL1
465       parTRAP[5] = parTRAP[4];    // TL1
466       parTRAP[6] = 0.0;           // ALP1
467       // top
468       parTRAP[7] = parSCM0[2]/2.; // H2
469       parTRAP[8] = parSCM0[1]/2.; // BL2
470       parTRAP[9] = parTRAP[8];    // TL2
471       parTRAP[10]= 0.0;           // ALP2
472       AliDebug(2,Form(" ** TRAP ** \n"));
473       for(int i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
474
475       gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
476       xpos = +(parSCM0[1]+parSCM0[0])/4.;
477       gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
478
479       // Using rotation because SCMX should be the same due to Pb tiles
480       xpos = -xpos; 
481       AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
482       gMC->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, fIdRotm, "ONLY");
483     // put LED to the SCM0 
484       AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0);
485       gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
486
487       par[1] = parSCM0[2]/2;            // y 
488       par[2] = g->GetECPbRadThick()/2.; // z
489
490       int nr=0;
491       ypos = 0.0; 
492       zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
493       double xCenterSCMX =  (parTRAP[4] +  parTRAP[8])/2.;
494       if(!gn.Contains("NOPB")) { // for testing - 11-jul-05
495         AliDebug(2,Form(" Pb tiles \n"));
496         for(int iz=0; iz<g->GetNECLayers(); iz++){
497           par[0] = (parSCM0[0] + mod->GetTanBetta()*fSampleWidth*iz)/2.;
498           xpos   = par[0] - xCenterSCMX;
499           gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
500           AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]));
501           zpos += fSampleWidth;
502         } 
503         AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr));
504       }
505     } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) {
506       printf(" before AliEMCALv0::Trd1Tower3X3() : parSCM0");
507       for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
508       printf("\n"); 
509       Trd1Tower3X3(parSCM0); // Stay here
510     } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) {
511       Trd1Tower4X4();
512     }
513   } else if(gn.Contains("TRD2")) {    // TRD2 - 14-jan-05
514     //    Scm0InTrd2(g, fParEMOD, parSCM0); // First dessin 
515     PbmoInTrd2(g, fParEMOD, parSCM0); // Second design 
516   }
517 }
518
519 void AliEMCALv0::CreateSmod(const char* mother)
520
521   // 18-may-05; mother="XEN1"; 
522   // child="SMOD" from first to 10th, "SM10" (11th and 12th) (TRD1 case)
523   // child="SMON" and "SMOP"("TRD2" case)
524   AliEMCALGeometry * g = GetGeometry(); 
525   TString gn(g->GetName()); gn.ToUpper();
526
527   Double_t par[3], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.;
528   Double_t par1C = 0.;
529   //  ===== define Super Module from air - 14x30 module ==== ;
530   fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
531   AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data()));
532   par[0] = g->GetShellThickness()/2.;
533   par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.; 
534   par[2] = g->GetEtaModuleSize()*15.; 
535   fIdRotm=0;
536   int nphism = g->GetNumberOfSuperModules()/2; // 20-may-05
537   if(nphism>0) {
538     dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/nphism;
539     //    if(g->GetKey110DEG()) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1);
540     rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.;
541     AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi));
542   }
543
544   if (gn.Contains("TRD2")) { // tubs - 27-jan-05
545     parTubs[0] = g->GetTubsR();                       // rmin
546     parTubs[1] = parTubs[0] + g->GetShellThickness(); // rmax ?? 
547     parTubs[2] = 380./2.;                             // DZ half length in z; 11-oct-04 - for 26 division
548     parTubs[3] = -dphi/2.;                            // PHI1 starting angle of the segment;
549     parTubs[4] = +dphi/2.;                            // PHI2 ending angle of the segment;
550
551     gMC->Gsvolu("SMOP", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // pozitive Z
552     gMC->Gsvolu("SMON", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // negative Z
553
554     AliDebug(2,Form(" SMOP,N ** TUBS **\n")); 
555     AliDebug(2,Form("tmed %i | Rmin %7.2f Rmax %7.2f dz %7.2f phi1,2 (%7.2f,%7.2f)\n", 
556                     fIdTmedArr[kIdAIR], parTubs[0],parTubs[1],parTubs[2], parTubs[3],parTubs[4]));
557     // have to add 1 cm plastic before EMOD - time solution 
558   } else if(gn.Contains("WSUC")) {
559     par[0] = g->GetPhiModuleSize()*g->GetNPhi()/2.; 
560     par[1] = g->GetShellThickness()/2.;
561     par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5; 
562
563     gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
564
565     AliDebug(2,Form("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n", 
566                     fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
567     fSmodPar0 = par[0]; 
568     fSmodPar1 = par[1];
569     fSmodPar2 = par[2];
570     nphism   =  g->GetNumberOfSuperModules();
571   } else {
572     if     (gn.Contains("TWIST")) {
573       par[2] += 0.4;      // for 27 division
574     } else if(gn.Contains("TRD")) {
575       par[2]  = 350./2.; // 11-oct-04 - for 26 division
576       if(gn.Contains("TRD1")) {
577         AliDebug(2,Form(" par[0] %7.2f (old) \n",  par[0]));
578         Float_t *parSM = g->GetSuperModulesPars(); 
579         for(int i=0; i<3; i++) par[i] = parSM[i];
580       }
581     }
582     gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
583     AliDebug(2,Form("tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n", 
584                     fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
585     fSmodPar0 = par[0]; 
586     fSmodPar2 = par[2];
587     if(g->GetKey110DEG()) { // 12-oct-05
588       par1C = par[1];
589       par[1] /= 2.;
590       gMC->Gsvolu("SM10", "BOX", fIdTmedArr[kIdAIR], par, 3);
591       AliDebug(2,Form(" Super module with name \"SM10\" was created too par[1] = %f\n", par[1]));
592       par[1] = par1C;
593     }
594   // Steel plate
595     if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
596       par[0] = g->GetSteelFrontThickness()/2.;
597       gMC->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3);
598       printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", fIdTmedArr[kIdSTEEL], par[0],par[1],par[2]);
599       xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.;
600       gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
601     }
602   }
603
604   int nr=0, nrsmod=0, i0=0;
605   if(gn.Contains("TEST")) {nphism = 1;} // just only 2 super modules;
606
607   // Turn whole super module
608   int turnSupMod = 1; // should be ONE; for testing = 0
609   for(int i=i0; i<nphism; i++) {
610     if (gn.Contains("TRD2")) {      // tubs - 27-jan-05
611       if(i==i0) {
612         printf("** TRD2 ** ");
613         if(turnSupMod==1) printf(" No 3 degree rotation !!! ");
614         printf("\n");
615       }
616       Double_t phic=0., phicRad=0.; // phi angle of arc center
617       phic    = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; //
618       phicRad = phic*TMath::DegToRad();
619       phi     = phic - g->GetTubsTurnAngle();
620       phiRad  = phi*TMath::DegToRad();
621       if(turnSupMod==1) {
622         TVector2  vc;     // position of super module center
623         vc.SetMagPhi(parTubs[0], phicRad);
624         TVector2  vcTurn; // position of super module center with turn
625         vcTurn.SetMagPhi(parTubs[0], phiRad);
626         TVector2 vcShift = vc - vcTurn;
627         phic = phi;
628
629         xpos = vcShift.X();
630         ypos = vcShift.Y();
631       } else { // 1-mar-05 ; just for testing - no turn od SMOD; looks good
632         xpos = ypos = 0.0;
633       }
634       zpos = parTubs[2];
635       AliMatrix(fIdRotm, 90.0, phic, 90.0, 90.0+phic, 0.0, 0.0);
636
637       gMC->Gspos("SMOP", ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
638       printf("SMOP %2i | %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n", 
639       i, nr, fIdRotm, phic, phicRad, xpos, ypos, zpos);
640       printf(" phiy(90+phic)  %6.1f \n", 90. + phic);
641
642       if(!gn.Contains("TEST1") && g->GetNumberOfSuperModules() > 1){
643         //        double  phiy = 90. + phic + 180.;
644         //        if(phiy>=360.) phiy -= 360.;
645         //        printf(" phiy  %6.1f \n", phiy);
646         //        AliMatrix(fIdRotm, 90.0, phic, 90.0, phiy, 180.0, 0.0);
647         gMC->Gspos("SMON", nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY") ;
648         printf("SMON %2i | %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n", 
649         i, nr, fIdRotm, phic, phicRad, xpos, ypos, -zpos);
650       }
651     } else if(gn.Contains("WSUC")) {
652       xpos = ypos = zpos = 0.0;
653       fIdRotm = 0;
654       gMC->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
655       printf(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n", 
656       fIdRotm, phi, phiRad, xpos, ypos, zpos);
657       nr++;
658     } else { // TRD1 
659       TString smName("SMOD"); // 12-oct-05
660       if(i==5 && g->GetKey110DEG()) {
661         smName = "SM10";
662         nrsmod = nr;
663         nr     = 0;
664       }
665       phi    = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170
666       phiRad = phi*TMath::Pi()/180.;
667
668       AliMatrix(fIdRotm, 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
669
670       xpos = rpos * TMath::Cos(phiRad);
671       ypos = rpos * TMath::Sin(phiRad);
672       zpos = fSmodPar2; // 21-sep-04
673       if(i==5 && g->GetKey110DEG()) {
674         xpos += (par1C/2. * TMath::Sin(phiRad)); 
675         ypos -= (par1C/2. * TMath::Cos(phiRad)); 
676       }
677       
678       // 1th module in z-direction;
679       gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
680       AliDebug(3, Form(" %s : %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n", 
681                        smName.Data(), nr, fIdRotm, phi, phiRad, xpos, ypos, zpos, i));
682       // 2th module in z-direction;
683       if(gn.Contains("TWIST") || gn.Contains("TRD")) {
684       // turn arround X axis; 0<phi<360
685         double phiy = 90. + phi + 180.;
686         if(phiy>=360.) phiy -= 360.;
687  
688         AliMatrix(fIdRotm, 90.0, phi, 90.0, phiy, 180.0, 0.0);
689         gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
690         AliDebug(3, Form(" %s : %2i fIdRotm %3i phiy %6.1f  xpos %7.2f ypos %7.2f zpos %7.2f \n", 
691                          smName.Data(), nr, fIdRotm, phiy, xpos, ypos, -zpos));
692       } else {
693         gMC->Gspos("SMOD", ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
694       }
695     }
696   }
697   AliDebug(2,Form(" Number of Super Modules %i \n", nr+nrsmod));
698 }
699
700 void AliEMCALv0::CreateEmod(const char* mother, const char* child)
701
702   // 17-may-05; mother="SMOD"; child="EMOD"
703   AliEMCALGeometry * g = GetGeometry(); 
704   TString gn(g->GetName()); gn.ToUpper(); 
705   // Module definition
706   Double_t par[10], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0.;
707   Double_t parSCPA[5], zposSCPA=0.; // passive SC - 13-MAY-05, TRD1 case
708   Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
709   Double_t tanTrd2y  = TMath::Tan(g->GetTrd2AngleY()*TMath::DegToRad()/2.);
710   int nr=0;
711   fIdRotm=0;
712   if(!gn.Contains("TRD")) { // standard module
713     par[0] = (fSampleWidth*g->GetNECLayers())/2.; 
714     par[1] = par[2] = g->GetPhiModuleSize()/2.;
715     gMC->Gsvolu(child, "BOX", fIdTmedArr[kIdSTEEL], par, 3);
716
717   } else if (gn.Contains("TRD1")){ // TRD1 system coordinate iz differnet
718     if(strcmp(mother,"SMOD")==0) {
719       fParEMOD[0] = g->GetEtaModuleSize()/2.;   // dx1
720       fParEMOD[1] = g->Get2Trd1Dx2()/2.;        // dx2
721       fParEMOD[2] = g->GetPhiModuleSize()/2.;;  // dy
722       fParEMOD[3] = g->GetLongModuleSize()/2.;  // dz
723       gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4);
724       if(gn.Contains("WSUC") || gn.Contains("MAY05")){
725         parSCPA[0] = g->GetEtaModuleSize()/2. + tanTrd1*g->GetFrontSteelStrip();   // dx1
726         parSCPA[1] = parSCPA[0]               + tanTrd1*g->GetPassiveScintThick(); // dx2
727         parSCPA[2] = g->GetPhiModuleSize()/2.;     // dy
728         parSCPA[3] = g->GetPassiveScintThick()/2.; // dz
729         gMC->Gsvolu("SCPA", "TRD1", fIdTmedArr[kIdSC], parSCPA, 4);
730         zposSCPA   = -fParEMOD[3] + g->GetFrontSteelStrip() + g->GetPassiveScintThick()/2.;
731         gMC->Gspos ("SCPA", ++nr, child, 0.0, 0.0, zposSCPA, 0, "ONLY");
732       }
733     }
734   } else if (gn.Contains("TRD2")){ // TRD2 as for TRD1 - 27-jan-05
735     fParEMOD[0] = g->GetEtaModuleSize()/2.;   // dx1
736     fParEMOD[1] = g->Get2Trd1Dx2()/2.;        // dx2
737     fParEMOD[2] = g->GetPhiModuleSize()/2.;   // dy1
738     fParEMOD[3] = fParEMOD[2] + tanTrd2y*g->GetLongModuleSize();// dy2
739     fParEMOD[4] = g->GetLongModuleSize()/2.;  // dz
740     gMC->Gsvolu(child, "TRD2", fIdTmedArr[kIdSTEEL], fParEMOD, 5);
741   }
742
743   nr   = 0;
744   if(gn.Contains("TWIST")) { // 13-sep-04
745     fShishKebabModules = new TList;
746     AliEMCALShishKebabModule *mod=0, *mTmp; // current module
747     for(int iz=0; iz<g->GetNZ(); iz++) {
748       //for(int iz=0; iz<4; iz++) {
749       if(iz==0) {
750         mod    = new AliEMCALShishKebabModule();
751         fIdRotm = 0;
752       } else {
753         mTmp = new AliEMCALShishKebabModule(*mod);
754         mod  = mTmp;
755         Double_t  angle = mod->GetThetaInDegree();
756         AliMatrix(fIdRotm, angle,0., 90.0,90.0, 90.-angle, 180.);
757       }
758       fShishKebabModules->Add(mod);
759
760       xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
761       zpos = mod->GetPosZ() - fSmodPar2;
762       for(int iy=0; iy<g->GetNPhi(); iy++) {
763         ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
764         gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
765         //        printf(" %3i(%2i,2i) xpos %7.2f ypos %7.2f zpos %7.2f \n", nr,iy,iz, xpos, ypos, zpos);
766       }
767     }    
768   } else if(gn.Contains("TRD")) { // 30-sep-04; 27-jan-05 - as for TRD1 as for TRD2
769     // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0)
770     AliEMCALShishKebabTrd1Module *mod=0, *mTmp; // current module
771
772     for(int iz=0; iz<g->GetNZ(); iz++) {
773       Double_t  angle=90., phiOK=0;
774       if(gn.Contains("TRD1")) {
775         mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
776         angle = mod->GetThetaInDegree();
777         if(!gn.Contains("WSUC")) { // ALICE 
778           if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,90., 90.,0.); // z'(x); y'(y); x'(z)
779           else      AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.);
780           phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi(); 
781           //          printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n", 
782           //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
783           xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
784           zpos = mod->GetPosZ() - fSmodPar2;
785
786           int iyMax = g->GetNPhi();
787           if(strcmp(mother,"SMOD") && g->GetKey110DEG()) {
788             iyMax /= 2;
789           }
790           for(int iy=0; iy<iyMax; iy++) { // flat in phi
791             ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
792             gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
793         //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm);
794             AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
795           }
796           //PH          printf("\n");
797         } else {
798           if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y)
799           else      AliMatrix(fIdRotm, 90-angle,270., 90.0,0.0, angle,90.);
800           phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi(); 
801           printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n", 
802           iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
803           zpos = mod->GetPosZ()      - fSmodPar2;
804           ypos = mod->GetPosXfromR() - fSmodPar1;
805           printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm);
806           for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
807             xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
808             gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
809             printf(" %7.2f ", xpos);
810           }
811           printf("\n");
812         }
813       } else if(gn.Contains("TRD2")){ // 1-feb-05 - TRD2;  curve in phi
814         double angEtaRow = 0.;
815         double theta1=0.,phi1=0., theta2=0.,phi2=0., theta3=0.,phi3=0.;
816         angle=90.;
817         if(iz==0) {
818           mod   = new AliEMCALShishKebabTrd1Module();
819         } else {
820           mTmp  = new AliEMCALShishKebabTrd1Module(*mod);
821           mod   = mTmp;
822           angle = mod->GetThetaInDegree();
823         }
824
825         fShishKebabModules->Add(mod);
826         phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi(); 
827         AliDebug(2,Form(" %i | theta | %6.3f - %6.3f = %6.3f\n", iz+1, angle, phiOK, angle-phiOK));
828
829         zpos = mod->GetPosZ() - parTubs[2];
830         rpos = parTubs[0] + mod->GetPosXfromR();
831
832         angle     = mod->GetThetaInDegree();
833         Double_t stepAngle = (parTubs[4] -  parTubs[3])/g->GetNPhi(); // 11-mar-04
834         for(int iy=0; iy<g->GetNPhi(); iy++) {
835           angEtaRow = parTubs[3] + stepAngle*(0.5+double(iy));
836           //          angEtaRow = 0;
837           theta1  = 90. +  angle; phi1 = angEtaRow;      // x' ~-z;
838           theta2  = 90.;          phi2 = 90. + angEtaRow;// y' ~ y;
839           theta3  = angle;        phi3 = angEtaRow;      // z' ~ x;
840           if(phi3 < 0.0) phi3 += 360.; 
841           AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
842
843           xpos = rpos * TMath::Cos(angEtaRow*TMath::DegToRad());
844           ypos = rpos * TMath::Sin(angEtaRow*TMath::DegToRad());
845           gMC->Gspos(child, ++nr, "SMOP", xpos, ypos, zpos, fIdRotm, "ONLY") ;
846           // SMON; 
847           phi1    = 180 + angEtaRow;
848           theta3  = 180.-theta3;  phi3 = angEtaRow;
849           AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
850           gMC->Gspos(child,  nr, "SMON", xpos, ypos, -zpos, fIdRotm, "ONLY") ;
851           if(AliDebugLevel()>=2) {
852             printf(" angEtaRow(phi) %7.2f |  angle(eta) %7.2f \n",  angEtaRow, angle);
853             printf("iy=%2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", iy, xpos, ypos, zpos, fIdRotm);
854           }
855         } // for(int iy=0; iy<g->GetNPhi(); iy++)
856       }
857     } 
858   } else {
859     xpos = g->GetSteelFrontThickness()/2.;
860     for(int iz=0; iz<g->GetNZ(); iz++) {
861       zpos = -fSmodPar2 + g->GetEtaModuleSize()*(2*iz+1)/2.;
862       for(int iy=0; iy<g->GetNPhi(); iy++) {
863         ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
864         gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, 0, "ONLY") ;
865       //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f \n", nr, xpos, ypos, zpos);
866       }
867     }
868   }
869   AliDebug(2,Form(" Number of modules in Super Module(%s) %i \n", mother, nr));
870 }
871
872 // 8-dec-04 by PAI
873 void AliEMCALv0::Trd1Tower3X3(const double parSCM0[4])
874 {
875   // Fixed Nov 13,2006
876   printf(" AliEMCALv0::Trd1Tower3X3() : parSCM0");
877   for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
878   printf("\n"); 
879   // Nov 10, 2006 - different name of SCMX
880   double parTRAP[11], *dummy=0;
881   AliEMCALGeometry * g = GetGeometry(); 
882   TString gn(g->GetName()), scmx; 
883   gn.ToUpper(); 
884  // Division to tile size 
885   AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv()));
886   gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
887   double dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3];
888   double ndiv=3., xpos=0.0;
889   // should be defined once
890   gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
891   for(int ix=1; ix<=3; ix++) { // 3X3
892     scmx = "SCX"; // Nov 10,2006 
893     // ix=1
894     parTRAP[0] = dz;
895     double xCentBot = 2.*dx1/3.;
896     double xCentTop = 2.*(dx2/4. + dx1/12.);
897     parTRAP[1] = TMath::ATan2((xCentTop-xCentBot),2.*dz)*TMath::RadToDeg(); // theta
898     parTRAP[2] = 0.;           // phi
899     // bottom
900     parTRAP[3] = dy/ndiv;      // H1
901     parTRAP[4] = dx1/ndiv;     // BL1
902     parTRAP[5] = parTRAP[4];   // TL1
903     parTRAP[6] = 0.0;          // ALP1
904     // top
905     parTRAP[7] = dy/ndiv;      // H2
906     parTRAP[8] = dx2/2 - dx1/6.;// BL2
907     parTRAP[9] = parTRAP[8];   // TL2
908     parTRAP[10]= 0.0;          // ALP2
909     xpos = (xCentBot+xCentTop)/2.;
910
911     if      (ix==3) {
912       parTRAP[1] = -parTRAP[1];
913       xpos = -xpos;
914     } else if(ix==2) { // central part is box but we treat as trapesoid due to numbering
915       parTRAP[1] = 0.;
916       parTRAP[8] = dx1/ndiv;     // BL2
917       parTRAP[9] = parTRAP[8];   // TL2
918       xpos = 0.0;
919     }
920     AliDebug(2,Form(" ** TRAP ** xpos %9.3f\n", xpos));
921     for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
922
923     scmx += ix;
924     gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
925     gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
926
927     PbInTrap(parTRAP, scmx);
928   }
929   AliDebug(2,Form("Trd1Tower3X3()", "Ver. 1.0 : was tested."));
930 }
931
932 // 8-dec-04 by PAI
933 void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
934 {
935  // see for example CreateShishKebabGeometry(); just for case TRD1
936   static int nr=0;
937   AliDebug(2,Form(" Pb tiles : nrstart %i\n", nr));
938   AliEMCALGeometry * g = GetGeometry(); 
939
940   double par[3];
941   //  double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
942   double xpos = 0.0, ypos = 0.0;
943   double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
944
945   double coef = (parTRAP[8] -  parTRAP[4]) / (2.*parTRAP[0]);
946   double xCenterSCMX =  (parTRAP[4] +  parTRAP[8])/2.; // ??
947   //  double tan = TMath::Tan(parTRAP[1]*TMath::DegToRad());
948
949   par[1] = parTRAP[3];              // y 
950   par[2] = g->GetECPbRadThick()/2.; // z
951   for(int iz=0; iz<g->GetNECLayers(); iz++){
952     par[0] = parTRAP[4] + coef*fSampleWidth*iz;
953     xpos   = par[0] - xCenterSCMX;
954     if(parTRAP[1] < 0.) xpos = -xpos;
955     gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
956     AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
957     zpos += fSampleWidth;
958     if(iz%2>0) printf("\n");
959   } 
960   AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
961   AliDebug(2,Form(" par[1] %9.3f  par[2] %9.3f ypos %9.3f \n", par[1], par[2], ypos)); 
962   AliDebug(2,Form(" PbInTrap Ver. 1.0 : was tested."));
963 }
964
965 // 8-dec-04 by PAI
966 void AliEMCALv0::Trd1Tower4X4()
967 {
968  // Not ready yet
969 }
970 // 3-feb-05
971 void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parSCM0[5])
972 {
973   // Passive material inside the detector
974   double wallThickness = g->GetPhiModuleSize()/2. -  g->GetPhiTileSize(); //Need check
975   AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
976   for(int i=0; i<4; i++) { // on pictures sometimes I can not see 0 -> be carefull!!
977     parSCM0[i] = emodPar[i] - wallThickness;
978     AliDebug(2,Form(" %i parSCMO %7.3f emodPar %7.3f : dif %7.3f \n", 
979                     i, parSCM0[i],emodPar[i], parSCM0[i]-emodPar[i]));
980   }
981   parSCM0[4] = emodPar[4];
982   gMC->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC
983   gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
984   // Division 
985   if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
986     Division2X2InScm0(g, parSCM0);
987   } else {
988     Info("Scm0InTrd2"," no division SCM0 in this geometry |%s|\n", g->GetName());
989     assert(0);
990   }
991 }
992
993 void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t parSCM0[5])
994 {
995   // Division 2X2
996   Double_t parTRAP[11], xpos=0.,ypos=0., dx1=0.0,dx2=0.,dy1=0.0,dy2=0.,dz=0.
997   ,dr1=0.0,dr2=0.;
998   fIdRotm=0;
999
1000   Info("Division2X2InScm0","Divide SCM0 on y-axis %i\n", g->GetNETAdiv());
1001   TString n("SCMX"), overLapFlagSCMY("ONLY"), overLapFlagSCMX("ONLY");
1002   n = "SCM0"; // for testing - 14-mar-05
1003   if(n=="SCM0"){
1004     PbInTrapForTrd2(parSCM0, n);
1005     // overLapFlagSCMY=overLapFlagSCMX="MANY"; // do not work
1006     return;
1007   }
1008
1009   dy1 = parSCM0[2] , dy2 = parSCM0[3], dz = parSCM0[4];
1010
1011   parTRAP[0] = parSCM0[4];    // dz
1012   parTRAP[1] = TMath::ATan2((dy2-dy1)/2.,2.*dz)*TMath::RadToDeg();
1013   parTRAP[2] = 90.;           // phi
1014   // bottom
1015   parTRAP[3] = parSCM0[2]/2.; // H1
1016   parTRAP[4] = parSCM0[0];    // BL1
1017   parTRAP[5] = parTRAP[4];    // TL1
1018   parTRAP[6] = 0.0;           // ALP1
1019   // top
1020   parTRAP[7] = parSCM0[3]/2.; // H2
1021   parTRAP[8] = parSCM0[1];    // BL2
1022   parTRAP[9] = parTRAP[8];    // TL2
1023   parTRAP[10]= 0.0;           // ALP2
1024   AliDebug(2,Form(" ** SCMY ** \n"));
1025            for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1026
1027   fIdRotm=0;
1028   gMC->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC
1029   ypos = +(parTRAP[3]+parTRAP[7])/2.; //
1030   AliDebug(2,Form(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data())); 
1031   gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm,  overLapFlagSCMY.Data()) ;
1032   // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z
1033   AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
1034   // We may have problem with numeration due to rotation - 4-feb-05
1035   gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm,  overLapFlagSCMY.Data()); 
1036
1037   Info("Division2X2InScm0","Divide SCMY on x-axis %i\n", g->GetNPHIdiv());
1038   dx1 = parSCM0[0]; 
1039   dx2 = parSCM0[1]; 
1040   dr1=TMath::Sqrt(dx1*dx1+dy1*dy1);
1041   dr2=TMath::Sqrt(dx2*dx2+dy2*dy2);
1042
1043   parTRAP[0] = parSCM0[4];    // dz
1044   parTRAP[1] = TMath::ATan2((dr2-dr1)/2.,2.*dz)*TMath::RadToDeg(); // 
1045   parTRAP[2] = 45.;           // phi
1046   // bottom
1047   parTRAP[3] = parSCM0[2]/2.; // H1
1048   parTRAP[4] = parSCM0[0]/2.; // BL1
1049   parTRAP[5] = parTRAP[4];    // TL1
1050   parTRAP[6] = 0.0;           // ALP1
1051   // top
1052   parTRAP[7] = parSCM0[3]/2.; // H2
1053   parTRAP[8] = parSCM0[1]/2;  // BL2
1054   parTRAP[9] = parTRAP[8];    // TL2
1055   parTRAP[10]= 0.0;           // ALP2
1056   AliDebug(2,Form(" ** SCMX ** \n"));
1057   for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1058
1059   fIdRotm=0;
1060   gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
1061   xpos = (parTRAP[4]+parTRAP[8])/2.;
1062   AliDebug(2,Form(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data())); 
1063   gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, fIdRotm,  overLapFlagSCMX.Data()) ;
1064   //  AliMatrix(fIdRotm, 90.0,270., 90.0, 0.0, 0.0,0.0); // x'=-y; y'=x; z'=z
1065   AliMatrix(fIdRotm, 90.0,90., 90.0, -180.0, 0.0,0.0);     // x'=y;  y'=-x; z'=z
1066   gMC->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, fIdRotm,  overLapFlagSCMX.Data()) ;
1067   // PB:
1068   if(n=="SCMX" && overLapFlagSCMY == "ONLY") {
1069     PbInTrapForTrd2(parTRAP, n);
1070   }
1071
1072
1073 // 4-feb-05 by PAI
1074 void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
1075 {
1076  // TRD2 cases
1077   Double_t *dummy=0;
1078   TString pbShape("BOX"), pbtiChonly("ONLY");
1079   if(name=="SCM0") {
1080     pbShape    = "TRD2";
1081     //    pbtiChonly = "MANY";
1082   }
1083   gMC->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0);
1084
1085   int nr=0;
1086   Info("PbInTrapForTrd2"," Pb tiles inside %s: shape %s :pbtiChonly %s\n nrstart %i\n", 
1087   name.Data(), pbShape.Data(), pbtiChonly.Data(), nr);
1088   AliEMCALGeometry * g = GetGeometry(); 
1089
1090   double par[5], parPB[5], parSC[5];
1091   //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1092   double xpos = 0.0, ypos = 0.0;
1093   double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1094   if(name == "SCMX") { // common trapezoid - 11 parameters
1095     double coef = (parTRAP[8] -  parTRAP[4]) / (2.*parTRAP[0]);
1096     double xCenterSCMX =  (parTRAP[4] +  parTRAP[8])/2.; // the same for y
1097     AliDebug(2,Form(" xCenterSCMX %8.5f : coef %8.7f \n", xCenterSCMX, coef));
1098
1099     par[2] = g->GetECPbRadThick()/2.; // z
1100     for(int iz=0; iz<g->GetNECLayers(); iz++){
1101       par[0] = parTRAP[4] + coef*fSampleWidth*iz;
1102       par[1] = par[0];
1103       xpos   = ypos = par[0] - xCenterSCMX;
1104     //if(parTRAP[1] < 0.) xpos = -xpos;
1105       gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
1106       AliDebug(2,Form(" %2.2i xpos %8.5f zpos %6.3f par[0,1] %6.3f |", iz+1, xpos, zpos, par[0]));
1107       if(iz%2>0) AliDebug(2,Form("\n"));
1108       zpos += fSampleWidth;
1109     } 
1110     AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
1111     AliDebug(2,Form(" par[1] %9.5f  par[2] %9.5f ypos %9.5f \n", par[1], par[2], ypos)); 
1112   } else if(name == "SCM0") { // 1-mar-05 ; TRD2 - 5 parameters
1113     AliDebug(2,Form(" SCM0 par = "));
1114     for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parTRAP[i]));
1115     AliDebug(2,Form("\n zpos %f \n",zpos));
1116
1117     double tanx = (parTRAP[1] -  parTRAP[0]) / (2.*parTRAP[4]); //  tanx =  tany now
1118     double tany = (parTRAP[3] -  parTRAP[2]) / (2.*parTRAP[4]), ztmp=0.;
1119     parPB[4] = g->GetECPbRadThick()/2.;
1120     parSC[2] = g->GetECScintThick()/2.;
1121     for(int iz=0; iz<g->GetNECLayers(); iz++){
1122       ztmp     = fSampleWidth*double(iz);
1123       parPB[0] = parTRAP[0] + tanx*ztmp;
1124       parPB[1] = parPB[0]   + tanx*g->GetECPbRadThick();
1125       parPB[2] = parTRAP[2] + tany*ztmp;
1126       parPB[3] = parPB[2]   + tany*g->GetECPbRadThick();
1127       gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ;
1128       AliDebug(2,Form("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos));
1129       /*
1130       for(int i=0; i<5; i++) printf(" %9.5f ", parPB[i]);
1131       // individual SC tile
1132       parSC[0] = parPB[0];
1133       parSC[1] = parPB[1];
1134       gMC->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(), 
1135       0, pbtiChonly.Data(), parSC, 3) ;
1136       printf("\n SCTI     zpos %6.3f | par = ", zpos+g->GetECScintThick());
1137       for(int i=0; i<3; i++) printf(" %9.5f ", parPB[i]);
1138       */
1139       zpos  += fSampleWidth;
1140     }
1141     AliDebug(2,Form("\n"));
1142   }
1143   Info("PbInTrapForTrd2", "Ver. 0.03 : was tested.");
1144 }
1145
1146 // 15-mar-05
1147 void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parPBMO[5])
1148 {
1149   // Pb inside Trd2
1150   Info("PbmoInTrd2"," started : geometry %s ", g->GetName());
1151   double wallThickness = g->GetPhiModuleSize()/2. -  g->GetPhiTileSize();
1152   AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
1153   for(int i=0; i<4; i++) {
1154     parPBMO[i] = emodPar[i] - wallThickness;
1155     AliDebug(2,Form(" %i parPBMO %7.3f emodPar %7.3f : dif %7.3f \n", 
1156                     i, parPBMO[i],emodPar[i], parPBMO[i]-emodPar[i]));
1157   }
1158   parPBMO[4] = emodPar[4];
1159   gMC->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5);
1160   gMC->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
1161   // Division 
1162   if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
1163     Division2X2InPbmo(g, parPBMO);
1164     AliDebug(2,Form(" PBMO, division 2X2 | geometry |%s|\n", g->GetName()));
1165   } else {
1166     AliDebug(2,Form(" no division PBMO in this geometry |%s|\n", g->GetName()));
1167     assert(0);
1168   }
1169 }
1170
1171 void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t parPBMO[5]) 
1172 {
1173   // Division 2X2
1174   Info("Division2X2InPbmo"," started : geometry %s ", g->GetName());
1175   //Double_t *dummy=0;
1176   //  gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0);
1177
1178   double parSC[3];
1179   //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1180   double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;;
1181   double tanx = (parPBMO[1] -  parPBMO[0]) / (2.*parPBMO[4]); //  tanx =  tany now
1182   double tany = (parPBMO[3] -  parPBMO[2]) / (2.*parPBMO[4]);
1183   char name[10], named[10], named2[10];
1184
1185   AliDebug(2,Form(" PBMO par = "));
1186   for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parPBMO[i]));
1187   AliDebug(2,Form("\n"));
1188
1189   parSC[2] = g->GetECScintThick()/2.;
1190   zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick() + g->GetECScintThick()/2.;
1191   AliDebug(2,Form(" parSC[2] %9.5f \n", parSC[2]));
1192   for(int iz=0; iz<g->GetNECLayers(); iz++){
1193     ztmp     = g->GetECPbRadThick() + fSampleWidth*double(iz); // Z for previous PB
1194     parSC[0] =  parPBMO[0] + tanx*ztmp;
1195     parSC[1] =  parPBMO[2] + tany*ztmp;
1196
1197     sprintf(name,"SC%2.2i", iz+1);
1198     gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3);
1199     gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
1200     AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ", 
1201                     name, zpos, parSC[0], parSC[1]));
1202     
1203     sprintf(named,"SY%2.2i", iz+1);
1204     printf(" %s -> ", named);
1205     gMC->Gsdvn(named,name, 2, 2);
1206
1207     sprintf(named2,"SX%2.2i", iz+1);
1208     printf(" %s \n", named2);
1209     gMC->Gsdvn(named2,named, 2, 1);
1210
1211     zpos    += fSampleWidth;
1212   }
1213 }
1214
1215 AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta)
1216
1217   // 28-oct-05
1218   AliEMCALShishKebabTrd1Module* trd1=0;
1219   if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) {
1220     trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta);
1221   }
1222   return trd1;
1223 }
1224
1225 //_____________________________________________________________________________
1226 void AliEMCALv0::AddAlignableVolumes() const
1227 {
1228   //
1229   // Create entries for alignable volumes associating the symbolic volume
1230   // name with the corresponding volume path. Needs to be synchronized with
1231   // eventual changes in the geometry.
1232   //
1233
1234   TString vpstr1 = "ALIC_1/XEN1_1/SMOD_";
1235   TString snstr1 = "EMCAL/FullSupermodule";
1236   TString volpath, symname;
1237
1238   //Int_t nSMod = ((AliEMCALGeometry*)GetGeometry())->GetNumberOfSuperModules();
1239   //could use this, but what happens if it is > 10?
1240  
1241   for (Int_t smodnum=0; smodnum < 10; smodnum++) {
1242     symname = snstr1;
1243     symname += (smodnum+1);
1244     volpath = vpstr1;
1245     volpath += (smodnum+1);
1246     if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1247       AliFatal("Unable to set alignable entry!!");
1248   }
1249
1250   if(GetGeometry()->GetKey110DEG()) {
1251     TString vpstr2 = "ALIC_1/XEN1_1/SM10_";
1252     TString snstr2 = "EMCAL/HalfSupermodule";    
1253     for (Int_t smodnum=0; smodnum < 2; smodnum++) {
1254       symname = snstr2;
1255       symname += (smodnum+1);
1256       volpath = vpstr2;
1257       volpath += (smodnum+1);
1258       if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1259         AliFatal("Unable to set alignable entry!!");
1260     }
1261   }
1262
1263 }
1264