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