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