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