]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALv0.cxx
Taking into account the masked local boards in regional input (Christian)
[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
3dd39418 315 // envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1),
316//geom->GetArm1EtaMin()); // z coordinate 1
317 envelopA[4] = -350.; // AM 30/5/2006
318
fdebddeb 319 //add some padding for mother volume
1963b290 320 envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1
321 envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1
3dd39418 322// envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1),
323// geom->GetArm1EtaMax()); // z coordinate 2
324 envelopA[7] = 350.; // AM 30/5/2006
325
1963b290 326 envelopA[8] = envelopA[5] ; // radii are the same.
327 envelopA[9] = envelopA[6] ; // radii are the same.
c13b5a7c 328
1963b290 329 if(gn.Contains("SHISH")) envelopA[2] = geom->GetNPhiSuperModule();
09641ef5 330
cde6a23d 331 gMC->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ; // Polygone filled with air
332 fEnvelop1.Set(10, envelopA);
1963b290 333 if (gDebug==2) {
334 printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]);
335 printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]);
336 }
c13b5a7c 337 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
cde6a23d 338 gMC->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
1963b290 339 }
340
341 if(gn.Contains("SHISH")){
c63c3c5d 342 // COMPACT, TWIST, TRD2 or TRD1
e5a93224 343 AliInfo(Form("Shish-Kebab geometry : %s", GetTitle()));
1963b290 344 CreateShishKebabGeometry();
fdebddeb 345 }
2012850d 346}
a1469a24 347
b13bbe81 348//______________________________________________________________________
05a92d59 349void AliEMCALv0::Init(void)
350{
b13bbe81 351 // Just prints an information message
9859bfc0 352
4951e003 353 if(AliLog::GetGlobalDebugLevel()>0) {
9859bfc0 354 TString message("\n") ;
c27ad3fb 355 message += "*****************************************\n" ;
05a92d59 356
b13bbe81 357 // Here the EMCAL initialisation code (if any!)
9859bfc0 358
05a92d59 359 AliEMCALGeometry * geom = GetGeometry() ;
9859bfc0 360
361 if (geom!=0) {
362 message += "AliEMCAL " ;
363 message += Version() ;
c27ad3fb 364 message += "EMCAL geometry initialized for " ;
9859bfc0 365 message += geom->GetName() ;
366 }
367 else {
368 message += "AliEMCAL " ;
369 message += Version() ;
370 message += "EMCAL geometry initialization failed !" ;
05a92d59 371 }
c27ad3fb 372 message += "\n*****************************************" ;
fdebddeb 373 printf(message.Data() ) ;
9859bfc0 374 }
2012850d 375}
1963b290 376
377// 24-aug-04 by PAI
378void AliEMCALv0::CreateShishKebabGeometry()
cde6a23d 379{
380 // TWIST, TRD1 and TRD2
1963b290 381 AliEMCALGeometry * g = GetGeometry();
382 TString gn(g->GetName()); gn.ToUpper();
cde6a23d 383 // see AliModule::fFIdTmedArr
384 // fIdTmedArr = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials()
385 // int kIdAIR=1599, kIdPB = 1600, kIdSC = 1601, kIdSTEEL = 1603;
1963b290 386 // idAL = 1602;
387 Double_t par[10], xpos=0., ypos=0., zpos=0.;
388
e52475ed 389 CreateSmod(g->GetNameOfEMCALEnvelope());
1963b290 390
d87bd045 391 CreateEmod("SMOD","EMOD"); // 18-may-05
392
393 if(gn.Contains("110DEG")) CreateEmod("SM10","EMOD"); // 12-oct-05
1963b290 394
395 // Sensitive SC (2x2 tiles)
396 double parSCM0[5], *dummy = 0, parTRAP[11];
397 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTmp = TMath::Tan(trd1Angle/2.);
398 if(!gn.Contains("TRD")) { // standard module
399 par[0] = (g->GetECPbRadThick()+g->GetECScintThick())*g->GetNECLayers()/2.;
400 par[1] = par[2] = g->GetPhiTileSize(); // Symetric case
cde6a23d 401 gMC->Gsvolu("SCM0", "BOX", fIdTmedArr[kIdSC], par, 3); // 2x2 tiles
1963b290 402 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
403 // Division to tile size
404 gMC->Gsdvn("SCM1","SCM0", g->GetNPHIdiv(), 2); // y-axis
405 gMC->Gsdvn("SCM2","SCM1", g->GetNETAdiv(), 3); // z-axis
406 // put LED to the SCM2
407 par[0] = g->GetECPbRadThick()/2.;
408 par[1] = par[2] = g->GetPhiTileSize()/2.; // Symetric case
cde6a23d 409 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], par, 3);
1963b290 410
411 printf(" Pb tiles \n");
412 int nr=0;
413 ypos = zpos = 0.0;
cde6a23d 414 xpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1963b290 415 for(int ix=0; ix<g->GetNECLayers(); ix++){
416 gMC->Gspos("PBTI", ++nr, "SCM2", xpos, ypos, zpos, 0, "ONLY") ;
417 // printf(" %i xpos %f \n", ix+1, xpos);
cde6a23d 418 xpos += fSampleWidth;
1963b290 419 }
420 printf(" Number of Pb tiles in SCM2 %i \n", nr);
421 } else if(gn.Contains("TRD1")) { // TRD1 - 30-sep-04
422 if(gn.Contains("MAY05")){
423 Double_t dzTmp = g->GetFrontSteelStrip()+g->GetPassiveScintThick();
cde6a23d 424 parSCM0[0] = fParEMOD[0] + tanTmp*dzTmp; // dx1
425 parSCM0[1] = fParEMOD[1]; // dx2
426 parSCM0[2] = fParEMOD[2]; // dy
1963b290 427 for(int i=0; i<3; i++) parSCM0[i] -= g->GetLateralSteelStrip();
cde6a23d 428 parSCM0[3] = fParEMOD[3] - dzTmp/2.; // dz
1963b290 429
cde6a23d 430 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
1963b290 431 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., dzTmp/2., 0, "ONLY") ;
432 } else { // before MAY 2005
433 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); // Need check
cde6a23d 434 for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
435 parSCM0[3] = fParEMOD[3];
436 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
1963b290 437 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
438 }
439
440 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
441 // Division to tile size - 1-oct-04
e5a93224 442 AliDebug(2,Form(" Divide SCM0 on y-axis %i\n", g->GetNETAdiv()));
1963b290 443 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
444 // Trapesoid 2x2
445 parTRAP[0] = parSCM0[3]; // dz
446 parTRAP[1] = TMath::ATan2((parSCM0[1]-parSCM0[0])/2.,2.*parSCM0[3])*180./TMath::Pi(); // theta
447 parTRAP[2] = 0.; // phi
448 // bottom
449 parTRAP[3] = parSCM0[2]/2.; // H1
450 parTRAP[4] = parSCM0[0]/2.; // BL1
451 parTRAP[5] = parTRAP[4]; // TL1
452 parTRAP[6] = 0.0; // ALP1
453 // top
454 parTRAP[7] = parSCM0[2]/2.; // H2
455 parTRAP[8] = parSCM0[1]/2.; // BL2
456 parTRAP[9] = parTRAP[8]; // TL2
457 parTRAP[10]= 0.0; // ALP2
e5a93224 458 AliDebug(2,Form(" ** TRAP ** \n"));
d434833b 459 for(int i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1963b290 460
cde6a23d 461 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
1963b290 462 xpos = +(parSCM0[1]+parSCM0[0])/4.;
463 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
464
465 // Using rotation because SCMX should be the same due to Pb tiles
466 xpos = -xpos;
cde6a23d 467 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
468 gMC->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, fIdRotm, "ONLY");
1963b290 469 // put LED to the SCM0
470 AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0);
cde6a23d 471 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
1963b290 472
473 par[1] = parSCM0[2]/2; // y
474 par[2] = g->GetECPbRadThick()/2.; // z
475
476 int nr=0;
d434833b 477 ypos = 0.0;
cde6a23d 478 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1963b290 479 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.;
480 if(!gn.Contains("NOPB")) { // for testing - 11-jul-05
e5a93224 481 AliDebug(2,Form(" Pb tiles \n"));
1963b290 482 for(int iz=0; iz<g->GetNECLayers(); iz++){
cde6a23d 483 par[0] = (parSCM0[0] + mod->GetTanBetta()*fSampleWidth*iz)/2.;
1963b290 484 xpos = par[0] - xCenterSCMX;
485 gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
d434833b 486 AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]));
cde6a23d 487 zpos += fSampleWidth;
1963b290 488 }
e5a93224 489 AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr));
1963b290 490 }
491 } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) {
492 Trd1Tower3X3(parSCM0);
493 } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) {
494 Trd1Tower4X4();
495 }
496 } else if(gn.Contains("TRD2")) { // TRD2 - 14-jan-05
cde6a23d 497 // Scm0InTrd2(g, fParEMOD, parSCM0); // First dessin
498 PbmoInTrd2(g, fParEMOD, parSCM0); // Second dessin
1963b290 499 }
500}
501
502void AliEMCALv0::CreateSmod(const char* mother)
cde6a23d 503{
504 // 18-may-05; mother="XEN1";
d87bd045 505 // child="SMOD" from first to 10th, "SM10" (11th and 12th) (TRD1 case)
506 // child="SMON" and "SMOP"("TRD2" case)
1963b290 507 AliEMCALGeometry * g = GetGeometry();
508 TString gn(g->GetName()); gn.ToUpper();
509
f5760193 510 Double_t par[3], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.;
d87bd045 511 Double_t par1C = 0.;
1963b290 512 // ===== define Super Module from air - 14x30 module ==== ;
cde6a23d 513 fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
e5a93224 514 AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data()));
1963b290 515 par[0] = g->GetShellThickness()/2.;
516 par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
517 par[2] = g->GetEtaModuleSize()*15.;
cde6a23d 518 fIdRotm=0;
1963b290 519 int nphism = g->GetNumberOfSuperModules()/2; // 20-may-05
520 if(nphism>0) {
521 dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/nphism;
d87bd045 522 // if(gn.Contains("110DEG")) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1);
1963b290 523 rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.;
e5a93224 524 AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi));
1963b290 525 }
526
527 if (gn.Contains("TRD2")) { // tubs - 27-jan-05
528 parTubs[0] = g->GetTubsR(); // rmin
529 parTubs[1] = parTubs[0] + g->GetShellThickness(); // rmax ??
530 parTubs[2] = 380./2.; // DZ half length in z; 11-oct-04 - for 26 division
531 parTubs[3] = -dphi/2.; // PHI1 starting angle of the segment;
532 parTubs[4] = +dphi/2.; // PHI2 ending angle of the segment;
533
cde6a23d 534 gMC->Gsvolu("SMOP", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // pozitive Z
535 gMC->Gsvolu("SMON", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // negative Z
1963b290 536
e5a93224 537 AliDebug(2,Form(" SMOP,N ** TUBS **\n"));
538 AliDebug(2,Form("tmed %i | Rmin %7.2f Rmax %7.2f dz %7.2f phi1,2 (%7.2f,%7.2f)\n",
539 fIdTmedArr[kIdAIR], parTubs[0],parTubs[1],parTubs[2], parTubs[3],parTubs[4]));
1963b290 540 // have to add 1 cm plastic before EMOD - time solution
541 } else if(gn.Contains("WSUC")) {
542 par[0] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
543 par[1] = g->GetShellThickness()/2.;
544 par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5;
545
cde6a23d 546 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
1963b290 547
e5a93224 548 AliDebug(2,Form("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
549 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
cde6a23d 550 fSmodPar0 = par[0];
551 fSmodPar1 = par[1];
552 fSmodPar2 = par[2];
1963b290 553 nphism = g->GetNumberOfSuperModules();
554 } else {
555 if (gn.Contains("TWIST")) {
556 par[2] += 0.4; // for 27 division
557 } else if(gn.Contains("TRD")) {
558 par[2] = 350./2.; // 11-oct-04 - for 26 division
e52475ed 559 if(gn.Contains("TRD1")) {
e5a93224 560 AliDebug(2,Form(" par[0] %7.2f (old) \n", par[0]));
e52475ed 561 Float_t *parSM = g->GetSuperModulesPars();
562 for(int i=0; i<3; i++) par[i] = parSM[i];
563 }
1963b290 564 }
cde6a23d 565 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
e5a93224 566 AliDebug(2,Form("tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
567 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
cde6a23d 568 fSmodPar0 = par[0];
569 fSmodPar2 = par[2];
d87bd045 570 if(gn.Contains("110DEG")) { // 12-oct-05
571 par1C = par[1];
572 par[1] /= 2.;
cde6a23d 573 gMC->Gsvolu("SM10", "BOX", fIdTmedArr[kIdAIR], par, 3);
e5a93224 574 AliDebug(2,Form(" Super module with name \"SM10\" was created too par[1] = %f\n", par[1]));
d87bd045 575 par[1] = par1C;
576 }
1963b290 577 // Steel plate
578 if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
579 par[0] = g->GetSteelFrontThickness()/2.;
cde6a23d 580 gMC->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3);
581 printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", fIdTmedArr[kIdSTEEL], par[0],par[1],par[2]);
1963b290 582 xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.;
583 gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
584 }
585 }
586
d87bd045 587 int nr=0, nrsmod=0, i0=0;
1963b290 588 if(gn.Contains("TEST")) {nphism = 1;} // just only 2 super modules;
589
590 // Turn whole super module
cde6a23d 591 int turnSupMod = 1; // should be ONE; for testing = 0
1963b290 592 for(int i=i0; i<nphism; i++) {
593 if (gn.Contains("TRD2")) { // tubs - 27-jan-05
594 if(i==i0) {
595 printf("** TRD2 ** ");
cde6a23d 596 if(turnSupMod==1) printf(" No 3 degree rotation !!! ");
1963b290 597 printf("\n");
598 }
599 Double_t phic=0., phicRad=0.; // phi angle of arc center
600 phic = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; //
601 phicRad = phic*TMath::DegToRad();
602 phi = phic - g->GetTubsTurnAngle();
603 phiRad = phi*TMath::DegToRad();
cde6a23d 604 if(turnSupMod==1) {
1963b290 605 TVector2 vc; // position of super module center
606 vc.SetMagPhi(parTubs[0], phicRad);
607 TVector2 vcTurn; // position of super module center with turn
608 vcTurn.SetMagPhi(parTubs[0], phiRad);
609 TVector2 vcShift = vc - vcTurn;
610 phic = phi;
611
612 xpos = vcShift.X();
613 ypos = vcShift.Y();
614 } else { // 1-mar-05 ; just for testing - no turn od SMOD; looks good
615 xpos = ypos = 0.0;
616 }
617 zpos = parTubs[2];
cde6a23d 618 AliMatrix(fIdRotm, 90.0, phic, 90.0, 90.0+phic, 0.0, 0.0);
1963b290 619
cde6a23d 620 gMC->Gspos("SMOP", ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
621 printf("SMOP %2i | %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
622 i, nr, fIdRotm, phic, phicRad, xpos, ypos, zpos);
1963b290 623 printf(" phiy(90+phic) %6.1f \n", 90. + phic);
624
625 if(!gn.Contains("TEST1") && g->GetNumberOfSuperModules() > 1){
626 // double phiy = 90. + phic + 180.;
627 // if(phiy>=360.) phiy -= 360.;
628 // printf(" phiy %6.1f \n", phiy);
cde6a23d 629 // AliMatrix(fIdRotm, 90.0, phic, 90.0, phiy, 180.0, 0.0);
630 gMC->Gspos("SMON", nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY") ;
631 printf("SMON %2i | %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
632 i, nr, fIdRotm, phic, phicRad, xpos, ypos, -zpos);
1963b290 633 }
d87bd045 634 } else if(gn.Contains("WSUC")) {
635 xpos = ypos = zpos = 0.0;
cde6a23d 636 fIdRotm = 0;
637 gMC->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
638 printf(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
639 fIdRotm, phi, phiRad, xpos, ypos, zpos);
d87bd045 640 nr++;
c63c3c5d 641 } else { // TRD1
d87bd045 642 TString smName("SMOD"); // 12-oct-05
643 if(i==5 && gn.Contains("110DEG")) {
644 smName = "SM10";
645 nrsmod = nr;
646 nr = 0;
647 }
1963b290 648 phi = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170
649 phiRad = phi*TMath::Pi()/180.;
650
cde6a23d 651 AliMatrix(fIdRotm, 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
1963b290 652
653 xpos = rpos * TMath::Cos(phiRad);
654 ypos = rpos * TMath::Sin(phiRad);
cde6a23d 655 zpos = fSmodPar2; // 21-sep-04
d87bd045 656 if(i==5 && gn.Contains("110DEG")) {
657 xpos += (par1C/2. * TMath::Sin(phiRad));
658 ypos -= (par1C/2. * TMath::Cos(phiRad));
659 }
660
1963b290 661 // 1th module in z-direction;
cde6a23d 662 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
663 AliDebug(3, Form(" %s : %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n",
664 smName.Data(), nr, fIdRotm, phi, phiRad, xpos, ypos, zpos, i));
1963b290 665 // 2th module in z-direction;
666 if(gn.Contains("TWIST") || gn.Contains("TRD")) {
667 // turn arround X axis; 0<phi<360
668 double phiy = 90. + phi + 180.;
669 if(phiy>=360.) phiy -= 360.;
670
cde6a23d 671 AliMatrix(fIdRotm, 90.0, phi, 90.0, phiy, 180.0, 0.0);
672 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
673 AliDebug(3, Form(" %s : %2i fIdRotm %3i phiy %6.1f xpos %7.2f ypos %7.2f zpos %7.2f \n",
674 smName.Data(), nr, fIdRotm, phiy, xpos, ypos, -zpos));
1963b290 675 } else {
cde6a23d 676 gMC->Gspos("SMOD", ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
1963b290 677 }
678 }
679 }
e5a93224 680 AliDebug(2,Form(" Number of Super Modules %i \n", nr+nrsmod));
1963b290 681}
682
683void AliEMCALv0::CreateEmod(const char* mother, const char* child)
cde6a23d 684{
685 // 17-may-05; mother="SMOD"; child="EMOD"
1963b290 686 AliEMCALGeometry * g = GetGeometry();
687 TString gn(g->GetName()); gn.ToUpper();
688 // Module definition
689 Double_t par[10], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0.;
690 Double_t parSCPA[5], zposSCPA=0.; // passive SC - 13-MAY-05, TRD1 case
691 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
692 Double_t tanTrd2y = TMath::Tan(g->GetTrd2AngleY()*TMath::DegToRad()/2.);
693 int nr=0;
cde6a23d 694 fIdRotm=0;
1963b290 695 if(!gn.Contains("TRD")) { // standard module
cde6a23d 696 par[0] = (fSampleWidth*g->GetNECLayers())/2.;
1963b290 697 par[1] = par[2] = g->GetPhiModuleSize()/2.;
cde6a23d 698 gMC->Gsvolu(child, "BOX", fIdTmedArr[kIdSTEEL], par, 3);
1963b290 699
700 } else if (gn.Contains("TRD1")){ // TRD1 system coordinate iz differnet
d87bd045 701 if(strcmp(mother,"SMOD")==0) {
cde6a23d 702 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
703 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
704 fParEMOD[2] = g->GetPhiModuleSize()/2.;; // dy
705 fParEMOD[3] = g->GetLongModuleSize()/2.; // dz
706 gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4);
d87bd045 707 if(gn.Contains("WSUC") || gn.Contains("MAY05")){
708 parSCPA[0] = g->GetEtaModuleSize()/2. + tanTrd1*g->GetFrontSteelStrip(); // dx1
709 parSCPA[1] = parSCPA[0] + tanTrd1*g->GetPassiveScintThick(); // dx2
710 parSCPA[2] = g->GetPhiModuleSize()/2.; // dy
711 parSCPA[3] = g->GetPassiveScintThick()/2.; // dz
cde6a23d 712 gMC->Gsvolu("SCPA", "TRD1", fIdTmedArr[kIdSC], parSCPA, 4);
713 zposSCPA = -fParEMOD[3] + g->GetFrontSteelStrip() + g->GetPassiveScintThick()/2.;
d87bd045 714 gMC->Gspos ("SCPA", ++nr, child, 0.0, 0.0, zposSCPA, 0, "ONLY");
715 }
1963b290 716 }
717 } else if (gn.Contains("TRD2")){ // TRD2 as for TRD1 - 27-jan-05
cde6a23d 718 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
719 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
720 fParEMOD[2] = g->GetPhiModuleSize()/2.; // dy1
721 fParEMOD[3] = fParEMOD[2] + tanTrd2y*g->GetLongModuleSize();// dy2
722 fParEMOD[4] = g->GetLongModuleSize()/2.; // dz
723 gMC->Gsvolu(child, "TRD2", fIdTmedArr[kIdSTEEL], fParEMOD, 5);
1963b290 724 }
725
726 nr = 0;
727 if(gn.Contains("TWIST")) { // 13-sep-04
728 fShishKebabModules = new TList;
729 AliEMCALShishKebabModule *mod=0, *mTmp; // current module
730 for(int iz=0; iz<g->GetNZ(); iz++) {
731 //for(int iz=0; iz<4; iz++) {
732 if(iz==0) {
733 mod = new AliEMCALShishKebabModule();
cde6a23d 734 fIdRotm = 0;
1963b290 735 } else {
736 mTmp = new AliEMCALShishKebabModule(*mod);
737 mod = mTmp;
738 Double_t angle = mod->GetThetaInDegree();
cde6a23d 739 AliMatrix(fIdRotm, angle,0., 90.0,90.0, 90.-angle, 180.);
1963b290 740 }
741 fShishKebabModules->Add(mod);
742
cde6a23d 743 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
744 zpos = mod->GetPosZ() - fSmodPar2;
1963b290 745 for(int iy=0; iy<g->GetNPhi(); iy++) {
746 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
cde6a23d 747 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
c01485dd 748 // printf(" %3i(%2i,2i) xpos %7.2f ypos %7.2f zpos %7.2f \n", nr,iy,iz, xpos, ypos, zpos);
1963b290 749 }
750 }
751 } else if(gn.Contains("TRD")) { // 30-sep-04; 27-jan-05 - as for TRD1 as for TRD2
752 // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0)
1963b290 753 AliEMCALShishKebabTrd1Module *mod=0, *mTmp; // current module
e52475ed 754
1963b290 755 for(int iz=0; iz<g->GetNZ(); iz++) {
756 Double_t angle=90., phiOK=0;
d87bd045 757 if(gn.Contains("TRD1")) {
1963b290 758 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
759 angle = mod->GetThetaInDegree();
760 if(!gn.Contains("WSUC")) { // ALICE
cde6a23d 761 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,90., 90.,0.); // z'(x); y'(y); x'(z)
762 else AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.);
1963b290 763 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
c01485dd 764 // printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
765 //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
cde6a23d 766 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
767 zpos = mod->GetPosZ() - fSmodPar2;
d87bd045 768
769 int iyMax = g->GetNPhi();
770 if(strcmp(mother,"SMOD") && gn.Contains("110DEG")) {
771 iyMax /= 2;
772 }
773 for(int iy=0; iy<iyMax; iy++) { // flat in phi
774 ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
cde6a23d 775 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
776 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm);
d434833b 777 AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
1963b290 778 }
813d27b5 779 //PH printf("\n");
1963b290 780 } else {
cde6a23d 781 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y)
782 else AliMatrix(fIdRotm, 90-angle,270., 90.0,0.0, angle,90.);
1963b290 783 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
784 printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
785 iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
cde6a23d 786 zpos = mod->GetPosZ() - fSmodPar2;
787 ypos = mod->GetPosXfromR() - fSmodPar1;
788 printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm);
1963b290 789 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
790 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
cde6a23d 791 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
1963b290 792 printf(" %7.2f ", xpos);
793 }
794 printf("\n");
795 }
796 } else if(gn.Contains("TRD2")){ // 1-feb-05 - TRD2; curve in phi
797 double angEtaRow = 0.;
798 double theta1=0.,phi1=0., theta2=0.,phi2=0., theta3=0.,phi3=0.;
799 angle=90.;
800 if(iz==0) {
801 mod = new AliEMCALShishKebabTrd1Module();
802 } else {
803 mTmp = new AliEMCALShishKebabTrd1Module(*mod);
804 mod = mTmp;
805 angle = mod->GetThetaInDegree();
806 }
807
808 fShishKebabModules->Add(mod);
809 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
e5a93224 810 AliDebug(2,Form(" %i | theta | %6.3f - %6.3f = %6.3f\n", iz+1, angle, phiOK, angle-phiOK));
1963b290 811
812 zpos = mod->GetPosZ() - parTubs[2];
813 rpos = parTubs[0] + mod->GetPosXfromR();
814
815 angle = mod->GetThetaInDegree();
816 Double_t stepAngle = (parTubs[4] - parTubs[3])/g->GetNPhi(); // 11-mar-04
817 for(int iy=0; iy<g->GetNPhi(); iy++) {
818 angEtaRow = parTubs[3] + stepAngle*(0.5+double(iy));
819 // angEtaRow = 0;
820 theta1 = 90. + angle; phi1 = angEtaRow; // x' ~-z;
821 theta2 = 90.; phi2 = 90. + angEtaRow;// y' ~ y;
822 theta3 = angle; phi3 = angEtaRow; // z' ~ x;
823 if(phi3 < 0.0) phi3 += 360.;
cde6a23d 824 AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
1963b290 825
826 xpos = rpos * TMath::Cos(angEtaRow*TMath::DegToRad());
827 ypos = rpos * TMath::Sin(angEtaRow*TMath::DegToRad());
cde6a23d 828 gMC->Gspos(child, ++nr, "SMOP", xpos, ypos, zpos, fIdRotm, "ONLY") ;
1963b290 829 // SMON;
830 phi1 = 180 + angEtaRow;
831 theta3 = 180.-theta3; phi3 = angEtaRow;
cde6a23d 832 AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
833 gMC->Gspos(child, nr, "SMON", xpos, ypos, -zpos, fIdRotm, "ONLY") ;
e5a93224 834 if(AliDebugLevel()>=2) {
1963b290 835 printf(" angEtaRow(phi) %7.2f | angle(eta) %7.2f \n", angEtaRow, angle);
cde6a23d 836 printf("iy=%2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", iy, xpos, ypos, zpos, fIdRotm);
1963b290 837 }
838 } // for(int iy=0; iy<g->GetNPhi(); iy++)
839 }
840 }
841 } else {
842 xpos = g->GetSteelFrontThickness()/2.;
843 for(int iz=0; iz<g->GetNZ(); iz++) {
cde6a23d 844 zpos = -fSmodPar2 + g->GetEtaModuleSize()*(2*iz+1)/2.;
1963b290 845 for(int iy=0; iy<g->GetNPhi(); iy++) {
846 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
847 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, 0, "ONLY") ;
848 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f \n", nr, xpos, ypos, zpos);
849 }
850 }
851 }
e5a93224 852 AliDebug(2,Form(" Number of modules in Super Module %i \n", nr));
1963b290 853}
854
855// 8-dec-04 by PAI
856void AliEMCALv0::Trd1Tower3X3(const double parSCM0[4])
cde6a23d 857{
858 // PB should be for whole SCM0 - ?
1963b290 859 double parTRAP[11], *dummy=0;
860 AliEMCALGeometry * g = GetGeometry();
861 TString gn(g->GetName()), scmx;
862 gn.ToUpper();
863 // Division to tile size
e5a93224 864 AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv()));
1963b290 865 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
866 double dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3];
867 double ndiv=3., xpos=0.0;
868 // should be defined once
cde6a23d 869 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
1963b290 870 if(gn.Contains("TEST")==0) { // one name for all trapesoid
871 scmx = "SCMX";
cde6a23d 872 gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], dummy, 0);
1963b290 873 }
874
875
876 for(int ix=1; ix<=3; ix++) { // 3X3
877 // ix=1
878 parTRAP[0] = dz;
879 parTRAP[1] = TMath::ATan2((dx2-dx1)/2.,2.*dz)*TMath::RadToDeg(); // theta
880 parTRAP[2] = 0.; // phi
881 // bottom
882 parTRAP[3] = dy/ndiv; // H1
883 parTRAP[4] = dx1/ndiv; // BL1
884 parTRAP[5] = parTRAP[4]; // TL1
885 parTRAP[6] = 0.0; // ALP1
886 // top
887 parTRAP[7] = dy/ndiv; // H2
888 parTRAP[8] = dx2/ndiv; // BL2
889 parTRAP[9] = parTRAP[8]; // TL2
890 parTRAP[10]= 0.0; // ALP2
891 xpos = +(dx1+dx2)/3.; // 6 or 3
892
893 if (ix==3) {
894 parTRAP[1] = -parTRAP[1];
895 xpos = -xpos;
896 } else if(ix==2) { // central part is box but we treat as trapesoid due to numbering
897 parTRAP[1] = 0.;
898 parTRAP[8] = dx1/ndiv; // BL2
899 parTRAP[9] = parTRAP[8]; // TL2
900 xpos = 0.0;
901 }
e5a93224 902 AliDebug(2,Form(" ** TRAP ** xpos %9.3f\n", xpos));
903 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1963b290 904 if(gn.Contains("TEST")){
905 scmx = "SCX"; scmx += ix;
cde6a23d 906 gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
1963b290 907 gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
908 } else {
909 gMC->Gsposp(scmx.Data(), ix, "SCMY", xpos, 0.0, 0.0, 0, "ONLY", parTRAP, 11) ;
910 }
911 PbInTrap(parTRAP, scmx);
912 }
e5a93224 913 AliDebug(2,Form("Trd1Tower3X3()", "Ver. 1.0 : was tested."));
1963b290 914}
915
916// 8-dec-04 by PAI
917void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
cde6a23d 918{
919 // see for example CreateShishKebabGeometry(); just for case TRD1
1963b290 920 static int nr=0;
e5a93224 921 AliDebug(2,Form(" Pb tiles : nrstart %i\n", nr));
1963b290 922 AliEMCALGeometry * g = GetGeometry();
923
924 double par[3];
cde6a23d 925 // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1963b290 926 double xpos = 0.0, ypos = 0.0;
cde6a23d 927 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1963b290 928
929 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
930 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // ??
931 // double tan = TMath::Tan(parTRAP[1]*TMath::DegToRad());
932
933 par[1] = parTRAP[3]; // y
934 par[2] = g->GetECPbRadThick()/2.; // z
935 for(int iz=0; iz<g->GetNECLayers(); iz++){
cde6a23d 936 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
1963b290 937 xpos = par[0] - xCenterSCMX;
938 if(parTRAP[1] < 0.) xpos = -xpos;
939 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
e5a93224 940 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
cde6a23d 941 zpos += fSampleWidth;
1963b290 942 if(iz%2>0) printf("\n");
943 }
e5a93224 944 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
945 AliDebug(2,Form(" par[1] %9.3f par[2] %9.3f ypos %9.3f \n", par[1], par[2], ypos));
946 AliDebug(2,Form(" PbInTrap Ver. 1.0 : was tested."));
1963b290 947}
948
949// 8-dec-04 by PAI
950void AliEMCALv0::Trd1Tower4X4()
cde6a23d 951{
952 // Not ready yet
1963b290 953}
954// 3-feb-05
cde6a23d 955void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parSCM0[5])
1963b290 956{
957 // Passive material inside the detector
958 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); //Need check
e5a93224 959 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
1963b290 960 for(int i=0; i<4; i++) { // on pictures sometimes I can not see 0 -> be carefull!!
cde6a23d 961 parSCM0[i] = emodPar[i] - wallThickness;
e5a93224 962 AliDebug(2,Form(" %i parSCMO %7.3f emodPar %7.3f : dif %7.3f \n",
963 i, parSCM0[i],emodPar[i], parSCM0[i]-emodPar[i]));
1963b290 964 }
cde6a23d 965 parSCM0[4] = emodPar[4];
966 gMC->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC
1963b290 967 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
968 // Division
969 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
970 Division2X2InScm0(g, parSCM0);
971 } else {
972 Info("Scm0InTrd2"," no division SCM0 in this geometry |%s|\n", g->GetName());
973 assert(0);
974 }
975}
976
977void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t parSCM0[5])
978{
cde6a23d 979 // Division 2X2
1963b290 980 Double_t parTRAP[11], xpos=0.,ypos=0., dx1=0.0,dx2=0.,dy1=0.0,dy2=0.,dz=0.
981 ,dr1=0.0,dr2=0.;
cde6a23d 982 fIdRotm=0;
1963b290 983
984 Info("Division2X2InScm0","Divide SCM0 on y-axis %i\n", g->GetNETAdiv());
985 TString n("SCMX"), overLapFlagSCMY("ONLY"), overLapFlagSCMX("ONLY");
986 n = "SCM0"; // for testing - 14-mar-05
987 if(n=="SCM0"){
988 PbInTrapForTrd2(parSCM0, n);
989 // overLapFlagSCMY=overLapFlagSCMX="MANY"; // do not work
990 return;
991 }
992
993 dy1 = parSCM0[2] , dy2 = parSCM0[3], dz = parSCM0[4];
994
995 parTRAP[0] = parSCM0[4]; // dz
996 parTRAP[1] = TMath::ATan2((dy2-dy1)/2.,2.*dz)*TMath::RadToDeg();
997 parTRAP[2] = 90.; // phi
998 // bottom
999 parTRAP[3] = parSCM0[2]/2.; // H1
1000 parTRAP[4] = parSCM0[0]; // BL1
1001 parTRAP[5] = parTRAP[4]; // TL1
1002 parTRAP[6] = 0.0; // ALP1
1003 // top
1004 parTRAP[7] = parSCM0[3]/2.; // H2
1005 parTRAP[8] = parSCM0[1]; // BL2
1006 parTRAP[9] = parTRAP[8]; // TL2
1007 parTRAP[10]= 0.0; // ALP2
e5a93224 1008 AliDebug(2,Form(" ** SCMY ** \n"));
1009 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1963b290 1010
cde6a23d 1011 fIdRotm=0;
1012 gMC->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC
1963b290 1013 ypos = +(parTRAP[3]+parTRAP[7])/2.; //
e5a93224 1014 AliDebug(2,Form(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data()));
cde6a23d 1015 gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm, overLapFlagSCMY.Data()) ;
1963b290 1016 // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z
cde6a23d 1017 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
1963b290 1018 // We may have problem with numeration due to rotation - 4-feb-05
cde6a23d 1019 gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm, overLapFlagSCMY.Data());
1963b290 1020
1021 Info("Division2X2InScm0","Divide SCMY on x-axis %i\n", g->GetNPHIdiv());
1022 dx1 = parSCM0[0];
1023 dx2 = parSCM0[1];
1024 dr1=TMath::Sqrt(dx1*dx1+dy1*dy1);
1025 dr2=TMath::Sqrt(dx2*dx2+dy2*dy2);
1026
1027 parTRAP[0] = parSCM0[4]; // dz
1028 parTRAP[1] = TMath::ATan2((dr2-dr1)/2.,2.*dz)*TMath::RadToDeg(); //
1029 parTRAP[2] = 45.; // phi
1030 // bottom
1031 parTRAP[3] = parSCM0[2]/2.; // H1
1032 parTRAP[4] = parSCM0[0]/2.; // BL1
1033 parTRAP[5] = parTRAP[4]; // TL1
1034 parTRAP[6] = 0.0; // ALP1
1035 // top
1036 parTRAP[7] = parSCM0[3]/2.; // H2
1037 parTRAP[8] = parSCM0[1]/2; // BL2
1038 parTRAP[9] = parTRAP[8]; // TL2
1039 parTRAP[10]= 0.0; // ALP2
e5a93224 1040 AliDebug(2,Form(" ** SCMX ** \n"));
1041 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1963b290 1042
cde6a23d 1043 fIdRotm=0;
1044 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
1963b290 1045 xpos = (parTRAP[4]+parTRAP[8])/2.;
e5a93224 1046 AliDebug(2,Form(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data()));
cde6a23d 1047 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
1048 // AliMatrix(fIdRotm, 90.0,270., 90.0, 0.0, 0.0,0.0); // x'=-y; y'=x; z'=z
1049 AliMatrix(fIdRotm, 90.0,90., 90.0, -180.0, 0.0,0.0); // x'=y; y'=-x; z'=z
1050 gMC->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
1963b290 1051 // PB:
1052 if(n=="SCMX" && overLapFlagSCMY == "ONLY") {
1053 PbInTrapForTrd2(parTRAP, n);
1054 }
1055}
1056
1057// 4-feb-05 by PAI
1058void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
cde6a23d 1059{
1060 // TRD2 cases
1963b290 1061 Double_t *dummy=0;
1062 TString pbShape("BOX"), pbtiChonly("ONLY");
1063 if(name=="SCM0") {
1064 pbShape = "TRD2";
1065 // pbtiChonly = "MANY";
1066 }
cde6a23d 1067 gMC->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0);
1963b290 1068
1069 int nr=0;
1070 Info("PbInTrapForTrd2"," Pb tiles inside %s: shape %s :pbtiChonly %s\n nrstart %i\n",
1071 name.Data(), pbShape.Data(), pbtiChonly.Data(), nr);
1072 AliEMCALGeometry * g = GetGeometry();
1073
1074 double par[5], parPB[5], parSC[5];
cde6a23d 1075 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1963b290 1076 double xpos = 0.0, ypos = 0.0;
cde6a23d 1077 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1963b290 1078 if(name == "SCMX") { // common trapezoid - 11 parameters
1079 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
1080 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // the same for y
e5a93224 1081 AliDebug(2,Form(" xCenterSCMX %8.5f : coef %8.7f \n", xCenterSCMX, coef));
1963b290 1082
1083 par[2] = g->GetECPbRadThick()/2.; // z
1084 for(int iz=0; iz<g->GetNECLayers(); iz++){
cde6a23d 1085 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
1963b290 1086 par[1] = par[0];
1087 xpos = ypos = par[0] - xCenterSCMX;
1088 //if(parTRAP[1] < 0.) xpos = -xpos;
1089 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
e5a93224 1090 AliDebug(2,Form(" %2.2i xpos %8.5f zpos %6.3f par[0,1] %6.3f |", iz+1, xpos, zpos, par[0]));
1091 if(iz%2>0) AliDebug(2,Form("\n"));
cde6a23d 1092 zpos += fSampleWidth;
1963b290 1093 }
e5a93224 1094 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
1095 AliDebug(2,Form(" par[1] %9.5f par[2] %9.5f ypos %9.5f \n", par[1], par[2], ypos));
1963b290 1096 } else if(name == "SCM0") { // 1-mar-05 ; TRD2 - 5 parameters
e5a93224 1097 AliDebug(2,Form(" SCM0 par = "));
1098 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parTRAP[i]));
1099 AliDebug(2,Form("\n zpos %f \n",zpos));
1963b290 1100
1101 double tanx = (parTRAP[1] - parTRAP[0]) / (2.*parTRAP[4]); // tanx = tany now
1102 double tany = (parTRAP[3] - parTRAP[2]) / (2.*parTRAP[4]), ztmp=0.;
1103 parPB[4] = g->GetECPbRadThick()/2.;
1104 parSC[2] = g->GetECScintThick()/2.;
1105 for(int iz=0; iz<g->GetNECLayers(); iz++){
cde6a23d 1106 ztmp = fSampleWidth*double(iz);
1963b290 1107 parPB[0] = parTRAP[0] + tanx*ztmp;
1108 parPB[1] = parPB[0] + tanx*g->GetECPbRadThick();
1109 parPB[2] = parTRAP[2] + tany*ztmp;
1110 parPB[3] = parPB[2] + tany*g->GetECPbRadThick();
1111 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ;
e5a93224 1112 AliDebug(2,Form("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos));
1963b290 1113 /*
1114 for(int i=0; i<5; i++) printf(" %9.5f ", parPB[i]);
1115 // individual SC tile
1116 parSC[0] = parPB[0];
1117 parSC[1] = parPB[1];
1118 gMC->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(),
1119 0, pbtiChonly.Data(), parSC, 3) ;
1120 printf("\n SCTI zpos %6.3f | par = ", zpos+g->GetECScintThick());
1121 for(int i=0; i<3; i++) printf(" %9.5f ", parPB[i]);
1122 */
cde6a23d 1123 zpos += fSampleWidth;
1963b290 1124 }
e5a93224 1125 AliDebug(2,Form("\n"));
1963b290 1126 }
1127 Info("PbInTrapForTrd2", "Ver. 0.03 : was tested.");
1128}
1129
1130// 15-mar-05
cde6a23d 1131void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parPBMO[5])
1963b290 1132{
cde6a23d 1133 // Pb inside Trd2
1963b290 1134 Info("PbmoInTrd2"," started : geometry %s ", g->GetName());
1135 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize();
e5a93224 1136 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
1963b290 1137 for(int i=0; i<4; i++) {
cde6a23d 1138 parPBMO[i] = emodPar[i] - wallThickness;
e5a93224 1139 AliDebug(2,Form(" %i parPBMO %7.3f emodPar %7.3f : dif %7.3f \n",
1140 i, parPBMO[i],emodPar[i], parPBMO[i]-emodPar[i]));
1963b290 1141 }
cde6a23d 1142 parPBMO[4] = emodPar[4];
1143 gMC->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5);
1963b290 1144 gMC->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
1145 // Division
1146 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
1147 Division2X2InPbmo(g, parPBMO);
e5a93224 1148 AliDebug(2,Form(" PBMO, division 2X2 | geometry |%s|\n", g->GetName()));
1963b290 1149 } else {
e5a93224 1150 AliDebug(2,Form(" no division PBMO in this geometry |%s|\n", g->GetName()));
1963b290 1151 assert(0);
1152 }
1153}
1154
cde6a23d 1155void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t parPBMO[5])
1963b290 1156{
cde6a23d 1157 // Division 2X2
1963b290 1158 Info("Division2X2InPbmo"," started : geometry %s ", g->GetName());
1159 //Double_t *dummy=0;
cde6a23d 1160 // gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0);
1963b290 1161
1162 double parSC[3];
cde6a23d 1163 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1963b290 1164 double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;;
1165 double tanx = (parPBMO[1] - parPBMO[0]) / (2.*parPBMO[4]); // tanx = tany now
1166 double tany = (parPBMO[3] - parPBMO[2]) / (2.*parPBMO[4]);
1167 char name[10], named[10], named2[10];
1168
e5a93224 1169 AliDebug(2,Form(" PBMO par = "));
1170 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parPBMO[i]));
1171 AliDebug(2,Form("\n"));
1963b290 1172
1173 parSC[2] = g->GetECScintThick()/2.;
cde6a23d 1174 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick() + g->GetECScintThick()/2.;
e5a93224 1175 AliDebug(2,Form(" parSC[2] %9.5f \n", parSC[2]));
1963b290 1176 for(int iz=0; iz<g->GetNECLayers(); iz++){
cde6a23d 1177 ztmp = g->GetECPbRadThick() + fSampleWidth*double(iz); // Z for previous PB
1963b290 1178 parSC[0] = parPBMO[0] + tanx*ztmp;
1179 parSC[1] = parPBMO[2] + tany*ztmp;
1180
1181 sprintf(name,"SC%2.2i", iz+1);
cde6a23d 1182 gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3);
1963b290 1183 gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
e5a93224 1184 AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ",
1185 name, zpos, parSC[0], parSC[1]));
1963b290 1186
1187 sprintf(named,"SY%2.2i", iz+1);
1188 printf(" %s -> ", named);
1189 gMC->Gsdvn(named,name, 2, 2);
1190
1191 sprintf(named2,"SX%2.2i", iz+1);
1192 printf(" %s \n", named2);
1193 gMC->Gsdvn(named2,named, 2, 1);
1194
cde6a23d 1195 zpos += fSampleWidth;
1963b290 1196 }
1197}
c01485dd 1198
21cf2b24 1199AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta)
cde6a23d 1200{
1201 // 28-oct-05
c01485dd 1202 AliEMCALShishKebabTrd1Module* trd1=0;
1203 if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) {
1204 trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta);
1205 }
1206 return trd1;
1207}