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