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