]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALv0.cxx
New methods in geometry, update geometry for 3x3 case
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv0.cxx
CommitLineData
2012850d 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 **************************************************************************/
2012850d 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
ffa6d63b 21// This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx
2012850d 22//*-- Author: Yves Schutz (SUBATECH)
b13bbe81 23//*-- and : Sahal Yacoob (LBL / UCT)
d87bd045 24// : Aleksei Pavlinov (WSU) SHASHLYK
2012850d 25
26// --- ROOT system ---
a1469a24 27
cde6a23d 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>
1963b290 41
42#include "AliEMCALShishKebabModule.h"
43#include "AliEMCALShishKebabTrd1Module.h"
a1469a24 44
2012850d 45// --- Standard library ---
46
d64c959b 47//#include <stdio.h>
2012850d 48
49// --- AliRoot header files ---
50
51#include "AliEMCALv0.h"
52#include "AliEMCALGeometry.h"
53#include "AliRun.h"
4951e003 54#include "AliLog.h"
2012850d 55
56ClassImp(AliEMCALv0)
57
cde6a23d 58// EMCAL material
59enum
60 {
61 kIdAIR = 1599,
62 kIdPB = 1600,
63 kIdSC = 1601,
64 kIdSTEEL = 1603
65 };
18a21c7c 66
67
68//______________________________________________________________________
69AliEMCALv0::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
b13bbe81 77//______________________________________________________________________
18a21c7c 78AliEMCALv0::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)
05a92d59 82{
83 // ctor : title is used to identify the layout
e5a93224 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
e52475ed 92 AliEMCALGeometry *geom = GetGeometry() ;
93 //geom->CreateListOfTrd1Modules();
94 fShishKebabModules = geom->GetShishKebabTrd1Modules();
2012850d 95}
a1469a24 96
b13bbe81 97//______________________________________________________________________
05a92d59 98void AliEMCALv0::BuildGeometry()
99{
b13bbe81 100 // Display Geometry for display.C
2012850d 101
b13bbe81 102 const Int_t kColorArm1 = kBlue ;
91e9918b 103
e52475ed 104 AliEMCALGeometry * geom = GetGeometry();
105
1963b290 106 TString gn(geom->GetName());
107 gn.ToUpper();
a1469a24 108
05a92d59 109 // Define the shape of the Calorimeter
1963b290 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
05a92d59 117 geom->GetEnvelop(2)/2.0, // half length in Z
fdebddeb 118 geom->GetArm1PhiMin(), // minimum phi angle
119 geom->GetArm1PhiMax() // maximum phi angle
b13bbe81 120 );
1963b290 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
cde6a23d 131 pgon->DefineSection(0, fEnvelop1[4], fEnvelop1[5], fEnvelop1[6]);
132 pgon->DefineSection(1, fEnvelop1[7], fEnvelop1[5], fEnvelop1[6]);
1963b290 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
142TNode *AliEMCALv0::BuildGeometryOfWSUC()
cde6a23d 143{
144 // June 8, 2005; see directory geant3/TGeant3/G3toRoot.cxx
1963b290 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";
cde6a23d 154 new TBRIK(name, "WSUC(XEN1 in Geant)","void",fEnvelop1[0],fEnvelop1[1],fEnvelop1[2]);
1963b290 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
cde6a23d 161 new TBRIK(name, "SMOD(SMOD in Geant)","void", fSmodPar0,fSmodPar1,fSmodPar2);
1963b290 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
cde6a23d 168 TTRD1 *emodTrd1 = new TTRD1(name, "EMOD(EMOD in Geant)","void", float(fParEMOD[0]),
169 float(fParEMOD[1]),float(fParEMOD[2]),float(fParEMOD[3]));
1963b290 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.;
cde6a23d 174 h1 = emodTrd1->GetDy()/2.;
175 bl1 = emodTrd1->GetDx()/2.;
1963b290 176 tl1 = bl1;
177 alpha1 = 0.;
cde6a23d 178 h2 = emodTrd1->GetDy()/2.;
179 bl2 = emodTrd1->GetDx2()/2.;
1963b290 180 tl2 = bl2;
181 alpha2 = 0.;
182
cde6a23d 183 dz = emodTrd1->GetDz();
1963b290 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
cde6a23d 188 TTRAP *scmxTrap = new TTRAP(name, "SCMX(SCMX as in Geant)","void",
1963b290 189 dz,theta,phi, h1,bl1,tl1,alpha1, h2,bl2,tl2,alpha2);
cde6a23d 190 // scmxTrap->Dump();
191 Float_t xShiftSCMX = (emodTrd1->GetDx() + emodTrd1->GetDx2())/4.;
192 Float_t yShiftSCMX = emodTrd1->GetDy()/2.;
1963b290 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);
cde6a23d 205 zpos = mod->GetPosZ() - fSmodPar2;
206 ypos = mod->GetPosXfromR() - fSmodPar1;
1963b290 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.);
a1469a24 213
1963b290 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();
cde6a23d 221 emod = new TNode(namNode.Data(), rtmt, (TShape*)emodTrd1, xpos,ypos,zpos,rtm);
1963b290 222 // emod->SetLineColor(kGreen) ;
223 emod->SetVisibility(0); // SCMX will bi visible
cde6a23d 224 if(scmxTrap) { // 4(2x2) sensetive volume inside EMOD
1963b290 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());
cde6a23d 244 scmx = new TNode(namNode.Data(), rtmt, (TShape*)scmxTrap, xposSCMX,yposSCMX,zposSCMX,rtmSCMX);
1963b290 245 scmx->SetLineColor(kMagenta);
246 }
247 }
248 }
249 }
250 }
251 // emod->Draw(); // for testing
252
253 return envelopNode;
2012850d 254}
a1469a24 255
b13bbe81 256//______________________________________________________________________
05a92d59 257void AliEMCALv0::CreateGeometry()
258{
f590bb15 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 //| ------------------------------------------------- |
ca148d5b 271 //| | XU1 : XPST (ECAL e = GetECScintThick() ) | |
f590bb15 272 //| ------------------------------------------------- |
ca148d5b 273 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
f590bb15 274 //| ------------------------------------------------- |
ca148d5b 275 //| | XU1 : XPST (ECAL e = GetECScintThick() | |
f590bb15 276 //| ------------------------------------------------- |
ca148d5b 277 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
f590bb15 278 //| ------------------------------------------------- |
fdebddeb 279 //| etc ..... GetNECLayers() - 1 times |
ca148d5b 280 //| ------------------------------------------------- |
fdebddeb 281 //| | XUNLayer : XPST (ECAL e = GetECScintThick() | |
ca148d5b 282 //| ------------------------------------------------- |
fdebddeb 283
05a92d59 284 AliEMCALGeometry * geom = GetGeometry() ;
1963b290 285 TString gn(geom->GetName());
286 gn.ToUpper();
a1469a24 287
05a92d59 288 if(!(geom->IsInitialized())){
a1469a24 289 Error("CreateGeometry","EMCAL Geometry class has not been set up.");
b13bbe81 290 } // end if
a1469a24 291
b13bbe81 292 // Get pointer to the array containing media indices
cde6a23d 293 fIdTmedArr = fIdtmed->GetArray() - 1599 ;
e13bd4f0 294
cde6a23d 295 fIdRotm = 1;
1963b290 296 // gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule
cde6a23d 297 AliMatrix(fIdRotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
09641ef5 298
c13b5a7c 299 // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1
300
301 Float_t envelopA[10];
1963b290 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();
cde6a23d 309 gMC->Gsvolu("XEN1", "TUBS", fIdTmedArr[kIdAIR], envelopA, 5) ; // Tubs filled with air
310 fEnvelop1.Set(5, envelopA);
1963b290 311 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
cde6a23d 312 gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
1963b290 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;
cde6a23d 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
1963b290 321 // Position the EMCAL Mother Volume (XEN1) in WSUC
cde6a23d 322 gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
1963b290 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
3dd39418 328 // envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1),
329//geom->GetArm1EtaMin()); // z coordinate 1
330 envelopA[4] = -350.; // AM 30/5/2006
331
fdebddeb 332 //add some padding for mother volume
1963b290 333 envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1
334 envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1
3dd39418 335// envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1),
336// geom->GetArm1EtaMax()); // z coordinate 2
337 envelopA[7] = 350.; // AM 30/5/2006
338
1963b290 339 envelopA[8] = envelopA[5] ; // radii are the same.
340 envelopA[9] = envelopA[6] ; // radii are the same.
c13b5a7c 341
1963b290 342 if(gn.Contains("SHISH")) envelopA[2] = geom->GetNPhiSuperModule();
09641ef5 343
cde6a23d 344 gMC->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ; // Polygone filled with air
345 fEnvelop1.Set(10, envelopA);
1963b290 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 }
c13b5a7c 350 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
cde6a23d 351 gMC->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
1963b290 352 }
353
354 if(gn.Contains("SHISH")){
c63c3c5d 355 // COMPACT, TWIST, TRD2 or TRD1
b42d4197 356 AliDebug(2,Form("Shish-Kebab geometry : %s", GetTitle()));
1963b290 357 CreateShishKebabGeometry();
fdebddeb 358 }
2012850d 359}
a1469a24 360
b13bbe81 361//______________________________________________________________________
05a92d59 362void AliEMCALv0::Init(void)
363{
b13bbe81 364 // Just prints an information message
9859bfc0 365
4951e003 366 if(AliLog::GetGlobalDebugLevel()>0) {
9859bfc0 367 TString message("\n") ;
c27ad3fb 368 message += "*****************************************\n" ;
05a92d59 369
b13bbe81 370 // Here the EMCAL initialisation code (if any!)
9859bfc0 371
05a92d59 372 AliEMCALGeometry * geom = GetGeometry() ;
9859bfc0 373
374 if (geom!=0) {
375 message += "AliEMCAL " ;
376 message += Version() ;
c27ad3fb 377 message += "EMCAL geometry initialized for " ;
9859bfc0 378 message += geom->GetName() ;
379 }
380 else {
381 message += "AliEMCAL " ;
382 message += Version() ;
383 message += "EMCAL geometry initialization failed !" ;
05a92d59 384 }
c27ad3fb 385 message += "\n*****************************************" ;
fdebddeb 386 printf(message.Data() ) ;
9859bfc0 387 }
2012850d 388}
1963b290 389
390// 24-aug-04 by PAI
391void AliEMCALv0::CreateShishKebabGeometry()
cde6a23d 392{
393 // TWIST, TRD1 and TRD2
1963b290 394 AliEMCALGeometry * g = GetGeometry();
395 TString gn(g->GetName()); gn.ToUpper();
cde6a23d 396 // see AliModule::fFIdTmedArr
397 // fIdTmedArr = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials()
398 // int kIdAIR=1599, kIdPB = 1600, kIdSC = 1601, kIdSTEEL = 1603;
1963b290 399 // idAL = 1602;
400 Double_t par[10], xpos=0., ypos=0., zpos=0.;
401
e52475ed 402 CreateSmod(g->GetNameOfEMCALEnvelope());
1963b290 403
d87bd045 404 CreateEmod("SMOD","EMOD"); // 18-may-05
405
1d46d1f6 406 if(g->GetKey110DEG()) CreateEmod("SM10","EMOD"); // Nov 1,2006
1963b290 407
408 // Sensitive SC (2x2 tiles)
1d46d1f6 409 double parSCM0[5]={0,0,0,0}, *dummy = 0, parTRAP[11];
1963b290 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
cde6a23d 414 gMC->Gsvolu("SCM0", "BOX", fIdTmedArr[kIdSC], par, 3); // 2x2 tiles
1963b290 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
cde6a23d 422 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], par, 3);
1963b290 423
424 printf(" Pb tiles \n");
425 int nr=0;
426 ypos = zpos = 0.0;
cde6a23d 427 xpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1963b290 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);
cde6a23d 431 xpos += fSampleWidth;
1963b290 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();
cde6a23d 437 parSCM0[0] = fParEMOD[0] + tanTmp*dzTmp; // dx1
438 parSCM0[1] = fParEMOD[1]; // dx2
439 parSCM0[2] = fParEMOD[2]; // dy
1963b290 440 for(int i=0; i<3; i++) parSCM0[i] -= g->GetLateralSteelStrip();
cde6a23d 441 parSCM0[3] = fParEMOD[3] - dzTmp/2.; // dz
1963b290 442
cde6a23d 443 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
1963b290 444 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., dzTmp/2., 0, "ONLY") ;
445 } else { // before MAY 2005
1d46d1f6 446 // double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); // Need check
447 double wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() - g->GetPhiTileSize();
cde6a23d 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);
1963b290 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
e5a93224 456 AliDebug(2,Form(" Divide SCM0 on y-axis %i\n", g->GetNETAdiv()));
1963b290 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
e5a93224 472 AliDebug(2,Form(" ** TRAP ** \n"));
d434833b 473 for(int i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1963b290 474
cde6a23d 475 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
1963b290 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;
cde6a23d 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");
1963b290 483 // put LED to the SCM0
484 AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0);
cde6a23d 485 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
1963b290 486
487 par[1] = parSCM0[2]/2; // y
488 par[2] = g->GetECPbRadThick()/2.; // z
489
490 int nr=0;
d434833b 491 ypos = 0.0;
cde6a23d 492 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1963b290 493 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.;
494 if(!gn.Contains("NOPB")) { // for testing - 11-jul-05
e5a93224 495 AliDebug(2,Form(" Pb tiles \n"));
1963b290 496 for(int iz=0; iz<g->GetNECLayers(); iz++){
cde6a23d 497 par[0] = (parSCM0[0] + mod->GetTanBetta()*fSampleWidth*iz)/2.;
1963b290 498 xpos = par[0] - xCenterSCMX;
499 gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
d434833b 500 AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]));
cde6a23d 501 zpos += fSampleWidth;
1963b290 502 }
e5a93224 503 AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr));
1963b290 504 }
505 } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) {
1d46d1f6 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
1963b290 510 } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) {
511 Trd1Tower4X4();
512 }
513 } else if(gn.Contains("TRD2")) { // TRD2 - 14-jan-05
cde6a23d 514 // Scm0InTrd2(g, fParEMOD, parSCM0); // First dessin
1d46d1f6 515 PbmoInTrd2(g, fParEMOD, parSCM0); // Second design
1963b290 516 }
517}
518
519void AliEMCALv0::CreateSmod(const char* mother)
cde6a23d 520{
521 // 18-may-05; mother="XEN1";
d87bd045 522 // child="SMOD" from first to 10th, "SM10" (11th and 12th) (TRD1 case)
523 // child="SMON" and "SMOP"("TRD2" case)
1963b290 524 AliEMCALGeometry * g = GetGeometry();
525 TString gn(g->GetName()); gn.ToUpper();
526
f5760193 527 Double_t par[3], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.;
d87bd045 528 Double_t par1C = 0.;
1963b290 529 // ===== define Super Module from air - 14x30 module ==== ;
cde6a23d 530 fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
e5a93224 531 AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data()));
1963b290 532 par[0] = g->GetShellThickness()/2.;
533 par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
534 par[2] = g->GetEtaModuleSize()*15.;
cde6a23d 535 fIdRotm=0;
1963b290 536 int nphism = g->GetNumberOfSuperModules()/2; // 20-may-05
537 if(nphism>0) {
538 dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/nphism;
1d46d1f6 539 // if(g->GetKey110DEG()) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1);
1963b290 540 rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.;
e5a93224 541 AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi));
1963b290 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
cde6a23d 551 gMC->Gsvolu("SMOP", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // pozitive Z
552 gMC->Gsvolu("SMON", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // negative Z
1963b290 553
e5a93224 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]));
1963b290 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
cde6a23d 563 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
1963b290 564
e5a93224 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]));
cde6a23d 567 fSmodPar0 = par[0];
568 fSmodPar1 = par[1];
569 fSmodPar2 = par[2];
1963b290 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
e52475ed 576 if(gn.Contains("TRD1")) {
e5a93224 577 AliDebug(2,Form(" par[0] %7.2f (old) \n", par[0]));
e52475ed 578 Float_t *parSM = g->GetSuperModulesPars();
579 for(int i=0; i<3; i++) par[i] = parSM[i];
580 }
1963b290 581 }
cde6a23d 582 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
e5a93224 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]));
cde6a23d 585 fSmodPar0 = par[0];
586 fSmodPar2 = par[2];
1d46d1f6 587 if(g->GetKey110DEG()) { // 12-oct-05
d87bd045 588 par1C = par[1];
589 par[1] /= 2.;
cde6a23d 590 gMC->Gsvolu("SM10", "BOX", fIdTmedArr[kIdAIR], par, 3);
e5a93224 591 AliDebug(2,Form(" Super module with name \"SM10\" was created too par[1] = %f\n", par[1]));
d87bd045 592 par[1] = par1C;
593 }
1963b290 594 // Steel plate
595 if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
596 par[0] = g->GetSteelFrontThickness()/2.;
cde6a23d 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]);
1963b290 599 xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.;
600 gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
601 }
602 }
603
d87bd045 604 int nr=0, nrsmod=0, i0=0;
1963b290 605 if(gn.Contains("TEST")) {nphism = 1;} // just only 2 super modules;
606
607 // Turn whole super module
cde6a23d 608 int turnSupMod = 1; // should be ONE; for testing = 0
1963b290 609 for(int i=i0; i<nphism; i++) {
610 if (gn.Contains("TRD2")) { // tubs - 27-jan-05
611 if(i==i0) {
612 printf("** TRD2 ** ");
cde6a23d 613 if(turnSupMod==1) printf(" No 3 degree rotation !!! ");
1963b290 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();
cde6a23d 621 if(turnSupMod==1) {
1963b290 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];
cde6a23d 635 AliMatrix(fIdRotm, 90.0, phic, 90.0, 90.0+phic, 0.0, 0.0);
1963b290 636
cde6a23d 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);
1963b290 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);
cde6a23d 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);
1963b290 650 }
d87bd045 651 } else if(gn.Contains("WSUC")) {
652 xpos = ypos = zpos = 0.0;
cde6a23d 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);
d87bd045 657 nr++;
c63c3c5d 658 } else { // TRD1
d87bd045 659 TString smName("SMOD"); // 12-oct-05
1d46d1f6 660 if(i==5 && g->GetKey110DEG()) {
d87bd045 661 smName = "SM10";
662 nrsmod = nr;
663 nr = 0;
664 }
1963b290 665 phi = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170
666 phiRad = phi*TMath::Pi()/180.;
667
cde6a23d 668 AliMatrix(fIdRotm, 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
1963b290 669
670 xpos = rpos * TMath::Cos(phiRad);
671 ypos = rpos * TMath::Sin(phiRad);
cde6a23d 672 zpos = fSmodPar2; // 21-sep-04
1d46d1f6 673 if(i==5 && g->GetKey110DEG()) {
d87bd045 674 xpos += (par1C/2. * TMath::Sin(phiRad));
675 ypos -= (par1C/2. * TMath::Cos(phiRad));
676 }
677
1963b290 678 // 1th module in z-direction;
cde6a23d 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));
1963b290 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
cde6a23d 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));
1963b290 692 } else {
cde6a23d 693 gMC->Gspos("SMOD", ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
1963b290 694 }
695 }
696 }
e5a93224 697 AliDebug(2,Form(" Number of Super Modules %i \n", nr+nrsmod));
1963b290 698}
699
700void AliEMCALv0::CreateEmod(const char* mother, const char* child)
cde6a23d 701{
702 // 17-may-05; mother="SMOD"; child="EMOD"
1963b290 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;
cde6a23d 711 fIdRotm=0;
1963b290 712 if(!gn.Contains("TRD")) { // standard module
cde6a23d 713 par[0] = (fSampleWidth*g->GetNECLayers())/2.;
1963b290 714 par[1] = par[2] = g->GetPhiModuleSize()/2.;
cde6a23d 715 gMC->Gsvolu(child, "BOX", fIdTmedArr[kIdSTEEL], par, 3);
1963b290 716
717 } else if (gn.Contains("TRD1")){ // TRD1 system coordinate iz differnet
d87bd045 718 if(strcmp(mother,"SMOD")==0) {
cde6a23d 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);
d87bd045 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
cde6a23d 729 gMC->Gsvolu("SCPA", "TRD1", fIdTmedArr[kIdSC], parSCPA, 4);
730 zposSCPA = -fParEMOD[3] + g->GetFrontSteelStrip() + g->GetPassiveScintThick()/2.;
d87bd045 731 gMC->Gspos ("SCPA", ++nr, child, 0.0, 0.0, zposSCPA, 0, "ONLY");
732 }
1963b290 733 }
734 } else if (gn.Contains("TRD2")){ // TRD2 as for TRD1 - 27-jan-05
cde6a23d 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);
1963b290 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();
cde6a23d 751 fIdRotm = 0;
1963b290 752 } else {
753 mTmp = new AliEMCALShishKebabModule(*mod);
754 mod = mTmp;
755 Double_t angle = mod->GetThetaInDegree();
cde6a23d 756 AliMatrix(fIdRotm, angle,0., 90.0,90.0, 90.-angle, 180.);
1963b290 757 }
758 fShishKebabModules->Add(mod);
759
cde6a23d 760 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
761 zpos = mod->GetPosZ() - fSmodPar2;
1963b290 762 for(int iy=0; iy<g->GetNPhi(); iy++) {
763 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
cde6a23d 764 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
c01485dd 765 // printf(" %3i(%2i,2i) xpos %7.2f ypos %7.2f zpos %7.2f \n", nr,iy,iz, xpos, ypos, zpos);
1963b290 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)
1963b290 770 AliEMCALShishKebabTrd1Module *mod=0, *mTmp; // current module
e52475ed 771
1963b290 772 for(int iz=0; iz<g->GetNZ(); iz++) {
773 Double_t angle=90., phiOK=0;
d87bd045 774 if(gn.Contains("TRD1")) {
1963b290 775 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
776 angle = mod->GetThetaInDegree();
777 if(!gn.Contains("WSUC")) { // ALICE
cde6a23d 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.);
1963b290 780 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
c01485dd 781 // printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
782 //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
cde6a23d 783 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
784 zpos = mod->GetPosZ() - fSmodPar2;
d87bd045 785
786 int iyMax = g->GetNPhi();
1d46d1f6 787 if(strcmp(mother,"SMOD") && g->GetKey110DEG()) {
d87bd045 788 iyMax /= 2;
789 }
790 for(int iy=0; iy<iyMax; iy++) { // flat in phi
791 ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
cde6a23d 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);
d434833b 794 AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
1963b290 795 }
813d27b5 796 //PH printf("\n");
1963b290 797 } else {
cde6a23d 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.);
1963b290 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());
cde6a23d 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);
1963b290 806 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
807 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
cde6a23d 808 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
1963b290 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();
e5a93224 827 AliDebug(2,Form(" %i | theta | %6.3f - %6.3f = %6.3f\n", iz+1, angle, phiOK, angle-phiOK));
1963b290 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.;
cde6a23d 841 AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
1963b290 842
843 xpos = rpos * TMath::Cos(angEtaRow*TMath::DegToRad());
844 ypos = rpos * TMath::Sin(angEtaRow*TMath::DegToRad());
cde6a23d 845 gMC->Gspos(child, ++nr, "SMOP", xpos, ypos, zpos, fIdRotm, "ONLY") ;
1963b290 846 // SMON;
847 phi1 = 180 + angEtaRow;
848 theta3 = 180.-theta3; phi3 = angEtaRow;
cde6a23d 849 AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
850 gMC->Gspos(child, nr, "SMON", xpos, ypos, -zpos, fIdRotm, "ONLY") ;
e5a93224 851 if(AliDebugLevel()>=2) {
1963b290 852 printf(" angEtaRow(phi) %7.2f | angle(eta) %7.2f \n", angEtaRow, angle);
cde6a23d 853 printf("iy=%2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", iy, xpos, ypos, zpos, fIdRotm);
1963b290 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++) {
cde6a23d 861 zpos = -fSmodPar2 + g->GetEtaModuleSize()*(2*iz+1)/2.;
1963b290 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 }
1d46d1f6 869 AliDebug(2,Form(" Number of modules in Super Module(%s) %i \n", mother, nr));
1963b290 870}
871
872// 8-dec-04 by PAI
873void AliEMCALv0::Trd1Tower3X3(const double parSCM0[4])
cde6a23d 874{
1d46d1f6 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
1963b290 880 double parTRAP[11], *dummy=0;
881 AliEMCALGeometry * g = GetGeometry();
882 TString gn(g->GetName()), scmx;
883 gn.ToUpper();
884 // Division to tile size
e5a93224 885 AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv()));
1963b290 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
cde6a23d 890 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
1963b290 891 for(int ix=1; ix<=3; ix++) { // 3X3
1d46d1f6 892 scmx = "SCX"; // Nov 10,2006
1963b290 893 // ix=1
894 parTRAP[0] = dz;
1d46d1f6 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
1963b290 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
1d46d1f6 906 parTRAP[8] = dx2/2 - dx1/6.;// BL2
1963b290 907 parTRAP[9] = parTRAP[8]; // TL2
908 parTRAP[10]= 0.0; // ALP2
1d46d1f6 909 xpos = (xCentBot+xCentTop)/2.;
1963b290 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 }
e5a93224 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]));
1d46d1f6 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
1963b290 927 PbInTrap(parTRAP, scmx);
928 }
e5a93224 929 AliDebug(2,Form("Trd1Tower3X3()", "Ver. 1.0 : was tested."));
1963b290 930}
931
932// 8-dec-04 by PAI
933void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
cde6a23d 934{
935 // see for example CreateShishKebabGeometry(); just for case TRD1
1963b290 936 static int nr=0;
e5a93224 937 AliDebug(2,Form(" Pb tiles : nrstart %i\n", nr));
1963b290 938 AliEMCALGeometry * g = GetGeometry();
939
940 double par[3];
cde6a23d 941 // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1963b290 942 double xpos = 0.0, ypos = 0.0;
cde6a23d 943 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1963b290 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++){
cde6a23d 952 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
1963b290 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) ;
e5a93224 956 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
cde6a23d 957 zpos += fSampleWidth;
1963b290 958 if(iz%2>0) printf("\n");
959 }
e5a93224 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."));
1963b290 963}
964
965// 8-dec-04 by PAI
966void AliEMCALv0::Trd1Tower4X4()
cde6a23d 967{
968 // Not ready yet
1963b290 969}
970// 3-feb-05
cde6a23d 971void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parSCM0[5])
1963b290 972{
973 // Passive material inside the detector
974 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); //Need check
e5a93224 975 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
1963b290 976 for(int i=0; i<4; i++) { // on pictures sometimes I can not see 0 -> be carefull!!
cde6a23d 977 parSCM0[i] = emodPar[i] - wallThickness;
e5a93224 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]));
1963b290 980 }
cde6a23d 981 parSCM0[4] = emodPar[4];
982 gMC->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC
1963b290 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
993void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t parSCM0[5])
994{
cde6a23d 995 // Division 2X2
1963b290 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.;
cde6a23d 998 fIdRotm=0;
1963b290 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
e5a93224 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]));
1963b290 1026
cde6a23d 1027 fIdRotm=0;
1028 gMC->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC
1963b290 1029 ypos = +(parTRAP[3]+parTRAP[7])/2.; //
e5a93224 1030 AliDebug(2,Form(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data()));
cde6a23d 1031 gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm, overLapFlagSCMY.Data()) ;
1963b290 1032 // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z
cde6a23d 1033 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
1963b290 1034 // We may have problem with numeration due to rotation - 4-feb-05
cde6a23d 1035 gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm, overLapFlagSCMY.Data());
1963b290 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
e5a93224 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]));
1963b290 1058
cde6a23d 1059 fIdRotm=0;
1060 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
1963b290 1061 xpos = (parTRAP[4]+parTRAP[8])/2.;
e5a93224 1062 AliDebug(2,Form(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data()));
cde6a23d 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()) ;
1963b290 1067 // PB:
1068 if(n=="SCMX" && overLapFlagSCMY == "ONLY") {
1069 PbInTrapForTrd2(parTRAP, n);
1070 }
1071}
1072
1073// 4-feb-05 by PAI
1074void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
cde6a23d 1075{
1076 // TRD2 cases
1963b290 1077 Double_t *dummy=0;
1078 TString pbShape("BOX"), pbtiChonly("ONLY");
1079 if(name=="SCM0") {
1080 pbShape = "TRD2";
1081 // pbtiChonly = "MANY";
1082 }
cde6a23d 1083 gMC->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0);
1963b290 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];
cde6a23d 1091 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1963b290 1092 double xpos = 0.0, ypos = 0.0;
cde6a23d 1093 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1963b290 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
e5a93224 1097 AliDebug(2,Form(" xCenterSCMX %8.5f : coef %8.7f \n", xCenterSCMX, coef));
1963b290 1098
1099 par[2] = g->GetECPbRadThick()/2.; // z
1100 for(int iz=0; iz<g->GetNECLayers(); iz++){
cde6a23d 1101 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
1963b290 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) ;
e5a93224 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"));
cde6a23d 1108 zpos += fSampleWidth;
1963b290 1109 }
e5a93224 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));
1963b290 1112 } else if(name == "SCM0") { // 1-mar-05 ; TRD2 - 5 parameters
e5a93224 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));
1963b290 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++){
cde6a23d 1122 ztmp = fSampleWidth*double(iz);
1963b290 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) ;
e5a93224 1128 AliDebug(2,Form("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos));
1963b290 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 */
cde6a23d 1139 zpos += fSampleWidth;
1963b290 1140 }
e5a93224 1141 AliDebug(2,Form("\n"));
1963b290 1142 }
1143 Info("PbInTrapForTrd2", "Ver. 0.03 : was tested.");
1144}
1145
1146// 15-mar-05
cde6a23d 1147void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parPBMO[5])
1963b290 1148{
cde6a23d 1149 // Pb inside Trd2
1963b290 1150 Info("PbmoInTrd2"," started : geometry %s ", g->GetName());
1151 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize();
e5a93224 1152 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
1963b290 1153 for(int i=0; i<4; i++) {
cde6a23d 1154 parPBMO[i] = emodPar[i] - wallThickness;
e5a93224 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]));
1963b290 1157 }
cde6a23d 1158 parPBMO[4] = emodPar[4];
1159 gMC->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5);
1963b290 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);
e5a93224 1164 AliDebug(2,Form(" PBMO, division 2X2 | geometry |%s|\n", g->GetName()));
1963b290 1165 } else {
e5a93224 1166 AliDebug(2,Form(" no division PBMO in this geometry |%s|\n", g->GetName()));
1963b290 1167 assert(0);
1168 }
1169}
1170
cde6a23d 1171void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t parPBMO[5])
1963b290 1172{
cde6a23d 1173 // Division 2X2
1963b290 1174 Info("Division2X2InPbmo"," started : geometry %s ", g->GetName());
1175 //Double_t *dummy=0;
cde6a23d 1176 // gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0);
1963b290 1177
1178 double parSC[3];
cde6a23d 1179 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1963b290 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
e5a93224 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"));
1963b290 1188
1189 parSC[2] = g->GetECScintThick()/2.;
cde6a23d 1190 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick() + g->GetECScintThick()/2.;
e5a93224 1191 AliDebug(2,Form(" parSC[2] %9.5f \n", parSC[2]));
1963b290 1192 for(int iz=0; iz<g->GetNECLayers(); iz++){
cde6a23d 1193 ztmp = g->GetECPbRadThick() + fSampleWidth*double(iz); // Z for previous PB
1963b290 1194 parSC[0] = parPBMO[0] + tanx*ztmp;
1195 parSC[1] = parPBMO[2] + tany*ztmp;
1196
1197 sprintf(name,"SC%2.2i", iz+1);
cde6a23d 1198 gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3);
1963b290 1199 gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
e5a93224 1200 AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ",
1201 name, zpos, parSC[0], parSC[1]));
1963b290 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
cde6a23d 1211 zpos += fSampleWidth;
1963b290 1212 }
1213}
c01485dd 1214
21cf2b24 1215AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta)
cde6a23d 1216{
1217 // 28-oct-05
c01485dd 1218 AliEMCALShishKebabTrd1Module* trd1=0;
1219 if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) {
1220 trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta);
1221 }
1222 return trd1;
1223}
5f66b6c6 1224
1225//_____________________________________________________________________________
1226void 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?
1082109f 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!!");
5f66b6c6 1248 }
1249
1d46d1f6 1250 if(GetGeometry()->GetKey110DEG()) {
5f66b6c6 1251 TString vpstr2 = "ALIC_1/XEN1_1/SM10_";
1252 TString snstr2 = "EMCAL/HalfSupermodule";
1082109f 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!!");
5f66b6c6 1260 }
1261 }
1262
1263}
1264