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