1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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
21 // This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx
22 //*-- Author: Yves Schutz (SUBATECH)
23 //*-- and : Sahal Yacoob (LBL / UCT)
24 // : Aleksei Pavlinov (WSU) SHASHLYK
26 // --- ROOT system ---
35 #include <TGeometry.h>
36 #include <TGeoPhysicalNode.h>
37 #include <TGeoManager.h>
38 #include <TGeoMatrix.h>
39 #include <TVirtualMC.h>
46 #include "AliEMCALShishKebabModule.h"
47 #include "AliEMCALShishKebabTrd1Module.h"
49 // --- Standard library ---
53 // --- AliRoot header files ---
55 #include "AliEMCALv0.h"
56 #include "AliEMCALGeometry.h"
59 #include "AliGeomManager.h"
73 //______________________________________________________________________
74 AliEMCALv0::AliEMCALv0()
76 fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
77 fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0)
82 //______________________________________________________________________
83 AliEMCALv0::AliEMCALv0(const char *name, const char *title)
84 : AliEMCAL(name,title),
85 fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
86 fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0)
88 // ctor : title is used to identify the layout
90 // Nov 22, 2006 - case of 1X1
91 TString ntmp(GetTitle());
93 if(ntmp == "TRD1") { // TRD1 is alias for SHISH_77_TRD1_2X2_FINAL_110DEG NL=69
94 ntmp = "SHISH_77_TRD1_2X2_FINAL_110DEG NL=69";
95 SetTitle(ntmp.Data());
98 AliEMCALGeometry *geom = GetGeometry() ;
99 //geom->CreateListOfTrd1Modules();
100 fShishKebabModules = geom->GetShishKebabTrd1Modules();
103 //______________________________________________________________________
104 void AliEMCALv0::BuildGeometry()
106 // Display Geometry for display.C
108 const Int_t kColorArm1 = kBlue ;
110 AliEMCALGeometry * geom = GetGeometry();
112 TString gn(geom->GetName());
115 // Define the shape of the Calorimeter
116 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
117 TNode * envelopNode = 0;
118 char *envn = "Envelop1";
119 if(!gn.Contains("SHISH")){
120 new TTUBS(envn, "Tubs that contains arm 1", "void",
121 geom->GetEnvelop(0) -10, // rmin
122 geom->GetEnvelop(1) +40 ,// rmax
123 geom->GetEnvelop(2)/2.0, // half length in Z
124 geom->GetArm1PhiMin(), // minimum phi angle
125 geom->GetArm1PhiMax() // maximum phi angle
128 envelopNode = new TNode(envn, "Arm1 Envelop", "Envelop1", 0., 0., 0., "") ;
130 if(gn.Contains("WSUC")) {
131 envelopNode = BuildGeometryOfWSUC();
132 } else { // Shish-kebab now for compact and TRD1 cases (ALIC)
134 TPGON *pgon = new TPGON(envn, "PGON that contains arm 1", "void",
135 geom->GetArm1PhiMin(),geom->GetArm1PhiMax()-geom->GetArm1PhiMin(),geom->GetNPhiSuperModule(), 2);
137 if (fEnvelop1.GetSize()<8) {
139 fEnvelop1[0] = geom->GetArm1PhiMin(); // minimum phi angle
140 fEnvelop1[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
141 fEnvelop1[2] = geom->GetNPhi(); // number of sections in phi
142 fEnvelop1[3] = 2; // 2 z coordinates
143 fEnvelop1[4] = -350.;
144 fEnvelop1[5] = geom->GetEnvelop(0) ; // rmin at z1
145 fEnvelop1[6] = geom->GetEnvelop(1) ; // rmax at z1
147 fEnvelop1[8] = fEnvelop1[5] ; // radii are the same.
148 fEnvelop1[9] = fEnvelop1[6] ; // radii are the same.
150 if(gn.Contains("SHISH"))
151 fEnvelop1[2] = geom->GetNPhiSuperModule();
153 pgon->DefineSection(0, fEnvelop1[4], fEnvelop1[5], fEnvelop1[6]);
154 pgon->DefineSection(1, fEnvelop1[7], fEnvelop1[5], fEnvelop1[6]);
156 envelopNode = new TNode(envn, "Arm1 Envelop2", envn, 0., 0., 0., "") ;
160 envelopNode->SetLineColor(kColorArm1) ;
161 fNodes->Add(envelopNode);
164 //______________________________________________________________________
165 TNode *AliEMCALv0::BuildGeometryOfWSUC()
167 // June 8, 2005; see directory geant3/TGeant3/G3toRoot.cxx
168 // enum EColor { kWhite, kBlack, kRed, kGreen, kBlue, kYellow, kMagenta, kCyan } - see $ROOTSYS/include/Gtypes.h
169 AliEMCALGeometry * g = GetGeometry();
170 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
173 TNode *envelopNode = 0;
177 new TBRIK(name, "WSUC(XEN1 in Geant)","void",fEnvelop1[0],fEnvelop1[1],fEnvelop1[2]);
178 envelopNode = new TNode(name, "envelope for WSUC", name, 0., 0., 0., "");
179 envelopNode->SetVisibility(0);
182 TNode *emod=0, *scmx=0;
183 name = "SMOD"; // super module
184 new TBRIK(name, "SMOD(SMOD in Geant)","void", fSmodPar0,fSmodPar1,fSmodPar2);
185 if(envelopNode) envelopNode->cd();
186 TNode *smod = new TNode(name, "SMOD", name, 0., 0., 0., "");
187 smod->SetLineColor(kBlue) ;
188 if(envelopNode==0) envelopNode = smod;
190 name = "EMOD"; // see CreateEMOD
191 TTRD1 *emodTrd1 = new TTRD1(name, "EMOD(EMOD in Geant)","void", float(fParEMOD[0]),
192 float(fParEMOD[1]),float(fParEMOD[2]),float(fParEMOD[3]));
194 // SCMX = EMOD/4 for simplicity of drawing
196 Float_t dz=0.,theta=0.,phi=0.,h1=0.,bl1=0.,tl1=0.,alpha1=0.,h2=0.,bl2=0.,tl2=0.,alpha2=0.;
197 h1 = emodTrd1->GetDy()/2.;
198 bl1 = emodTrd1->GetDx()/2.;
201 h2 = emodTrd1->GetDy()/2.;
202 bl2 = emodTrd1->GetDx2()/2.;
206 dz = emodTrd1->GetDz();
207 double dr = TMath::Sqrt((h2-h1)*(h2-h1)+(bl2-bl1)*(bl2-bl1));
208 theta = TMath::ATan2(dr,2.*dz) * TMath::RadToDeg();
211 TTRAP *scmxTrap = new TTRAP(name, "SCMX(SCMX as in Geant)","void",
212 dz,theta,phi, h1,bl1,tl1,alpha1, h2,bl2,tl2,alpha2);
214 Float_t xShiftSCMX = (emodTrd1->GetDx() + emodTrd1->GetDx2())/4.;
215 Float_t yShiftSCMX = emodTrd1->GetDy()/2.;
216 printf(" xShiftSCMX %7.4f yShiftSCMX %7.4f \n",xShiftSCMX,yShiftSCMX);
218 name = "EMOD"; // see CreateEMOD
221 AliEMCALShishKebabTrd1Module *mod=0;
222 Double_t angle=90., xpos=0.,ypos=0.,zpos=0., xposSCMX=0.,yposSCMX=0.,zposSCMX=0.;
223 char rtmn[100], rtmt[100];
224 TRotMatrix *rtm=0, *rtmSCMX=0;
226 for(int iz=0; iz<g->GetNZ(); iz++) {
227 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
228 zpos = mod->GetPosZ() - fSmodPar2;
229 ypos = mod->GetPosXfromR() - fSmodPar1;
231 angle = mod->GetThetaInDegree();
232 sprintf(rtmn,"rmEmod%5.1f",angle);
233 sprintf(rtmt,"rotation matrix for EMOD, iz=%i, angle = %6.3f",iz, angle);
234 if(iz==0) rtm = new TRotMatrix(rtmn, rtmt,0.,0., 90.,0., 90.,90.); // z'(x); y'(y); x'(z)
235 else rtm = new TRotMatrix(rtmn, rtmt,90.-angle,270., 90.0,0.0, angle,90.);
237 TGeometry *tg = gAlice->GetGeometry();
238 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
239 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
240 sprintf(rtmt,"EMOD, iz %i, ix %i, angle %6.3f",iz,ix, angle);
241 TString namNode=name;
242 namNode += numEmod++;
244 emod = new TNode(namNode.Data(), rtmt, (TShape*)emodTrd1, xpos,ypos,zpos,rtm);
245 // emod->SetLineColor(kGreen) ;
246 emod->SetVisibility(0); // SCMX will bi visible
247 if(scmxTrap) { // 4(2x2) sensetive volume inside EMOD
250 for(int jy=0; jy<2; jy++){ // division on y
251 yposSCMX = yShiftSCMX *(2*jy - 1);
252 for(int jx=0; jx<2; jx++){ // division on x
253 Double_t theta1=90.,phi1=0., theta2=90.,phi2=90., theta3=0.,phi3=0 ;
254 xposSCMX = xShiftSCMX *(2*jx - 1);
258 sprintf(rtmn,"rm%s",namNode.Data());
259 sprintf(rtmt,"rotation matrix for %s inside EMOD",namNode.Data());
260 rtmSCMX = tg->GetRotMatrix(rtmn);
262 phi1 = 180.; // x' = -x
263 phi2 = 270.; // y' = -y
265 if(rtmSCMX == 0) rtmSCMX = new TRotMatrix(rtmn,rtmt, theta1,phi1, theta2,phi2, theta3,phi3);
266 sprintf(rtmt,"%s inside %s", namNode.Data(), emod->GetName());
267 scmx = new TNode(namNode.Data(), rtmt, (TShape*)scmxTrap, xposSCMX,yposSCMX,zposSCMX,rtmSCMX);
268 scmx->SetLineColor(kMagenta);
274 // emod->Draw(); // for testing
279 //______________________________________________________________________
280 void AliEMCALv0::CreateGeometry()
282 // Create the EMCAL geometry for Geant
283 // Geometry of a tower
284 //|-----------------------------------------------------| XEN1
286 //| | Al thickness = GetAlFrontThickness() | |
290 //| ------------------------------------------------- |
291 //| | Air Gap = GetGap2Active() | |
293 //| ------------------------------------------------- |
294 //| | XU1 : XPST (ECAL e = GetECScintThick() ) | |
295 //| ------------------------------------------------- |
296 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
297 //| ------------------------------------------------- |
298 //| | XU1 : XPST (ECAL e = GetECScintThick() | |
299 //| ------------------------------------------------- |
300 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
301 //| ------------------------------------------------- |
302 //| etc ..... GetNECLayers() - 1 times |
303 //| ------------------------------------------------- |
304 //| | XUNLayer : XPST (ECAL e = GetECScintThick() | |
305 //| ------------------------------------------------- |
307 AliEMCALGeometry * geom = GetGeometry() ;
308 TString gn(geom->GetName());
311 if(!(geom->IsInitialized())){
312 Error("CreateGeometry","EMCAL Geometry class has not been set up.");
315 // Get pointer to the array containing media indices
316 fIdTmedArr = fIdtmed->GetArray() - 1599 ;
319 // gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule
320 AliMatrix(fIdRotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
322 // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1
324 Float_t envelopA[10];
325 if(gn.Contains("TRD1") && gn.Contains("WSUC") ) { // TRD1 for WSUC facility
326 // 17-may-05 - just BOX
330 gMC->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ;
332 for(int i=0; i<3; i++) fEnvelop1[i] = envelopA[i]; // 23-may-05
333 // Position the EMCAL Mother Volume (XEN1) in WSUC
334 gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
336 envelopA[0] = geom->GetArm1PhiMin(); // minimum phi angle
337 envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
338 envelopA[2] = geom->GetNPhi(); // number of sections in phi
339 envelopA[3] = 2; // 2 z coordinates
340 // envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1),
341 //geom->GetArm1EtaMin()); // z coordinate 1
342 envelopA[4] = -350.; // AM 30/5/2006
344 //add some padding for mother volume
345 envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1
346 envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1
347 // envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1),
348 // geom->GetArm1EtaMax()); // z coordinate 2
349 envelopA[7] = 350.; // AM 30/5/2006
351 envelopA[8] = envelopA[5] ; // radii are the same.
352 envelopA[9] = envelopA[6] ; // radii are the same.
354 if(gn.Contains("SHISH")) envelopA[2] = geom->GetNPhiSuperModule();
356 gMC->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ; // Polygone filled with air
357 fEnvelop1.Set(10, envelopA);
359 printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]);
360 printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]);
362 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
363 gMC->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
366 if(gn.Contains("SHISH")){
368 AliDebug(2,Form("Shish-Kebab geometry : %s", GetTitle()));
369 CreateShishKebabGeometry();
373 //______________________________________________________________________
374 void AliEMCALv0::Init(void)
376 // Just prints an information message
378 if(AliLog::GetGlobalDebugLevel()>0) {
379 TString message("\n") ;
380 message += "*****************************************\n" ;
382 // Here the EMCAL initialisation code (if any!)
384 AliEMCALGeometry * geom = GetGeometry() ;
387 message += "AliEMCAL " ;
388 message += Version() ;
389 message += "EMCAL geometry initialized for " ;
390 message += geom->GetName() ;
393 message += "AliEMCAL " ;
394 message += Version() ;
395 message += "EMCAL geometry initialization failed !" ;
397 message += "\n*****************************************" ;
398 printf(message.Data() ) ;
403 //______________________________________________________________________
404 void AliEMCALv0::CreateShishKebabGeometry()
407 AliEMCALGeometry * g = GetGeometry();
408 TString gn(g->GetName()); gn.ToUpper();
409 // see AliModule::fFIdTmedArr
410 // fIdTmedArr = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials()
411 // int kIdAIR=1599, kIdPB = 1600, kIdSC = 1601, kIdSTEEL = 1603;
413 Double_t par[10], xpos=0., ypos=0., zpos=0.;
415 CreateSmod(g->GetNameOfEMCALEnvelope());
417 CreateEmod("SMOD","EMOD"); // 18-may-05
419 if(g->GetKey110DEG()) CreateEmod("SM10","EMOD"); // Nov 1,2006
421 // Sensitive SC (2x2 tiles)
422 double parSCM0[5]={0,0,0,0}, *dummy = 0, parTRAP[11];
423 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad();
424 if(!gn.Contains("TRD")) { // standard module
425 par[0] = (g->GetECPbRadThick()+g->GetECScintThick())*g->GetNECLayers()/2.;
426 par[1] = par[2] = g->GetPhiTileSize(); // Symetric case
427 gMC->Gsvolu("SCM0", "BOX", fIdTmedArr[kIdSC], par, 3); // 2x2 tiles
428 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
429 // Division to tile size
430 gMC->Gsdvn("SCM1","SCM0", g->GetNPHIdiv(), 2); // y-axis
431 gMC->Gsdvn("SCM2","SCM1", g->GetNETAdiv(), 3); // z-axis
432 // put LED to the SCM2
433 par[0] = g->GetECPbRadThick()/2.;
434 par[1] = par[2] = g->GetPhiTileSize()/2.; // Symetric case
435 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], par, 3);
437 printf(" Pb tiles \n");
440 xpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
441 for(int ix=0; ix<g->GetNECLayers(); ix++){
442 gMC->Gspos("PBTI", ++nr, "SCM2", xpos, ypos, zpos, 0, "ONLY") ;
443 // printf(" %i xpos %f \n", ix+1, xpos);
444 xpos += fSampleWidth;
446 printf(" Number of Pb tiles in SCM2 %i \n", nr);
447 } else if(gn.Contains("TRD1")) { // TRD1 - 30-sep-04
448 // double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); // Need check
449 double wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() - g->GetPhiTileSize();
450 for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
451 parSCM0[3] = fParEMOD[3];
452 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
453 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
455 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
456 // Division to tile size - 1-oct-04
457 AliDebug(2,Form(" Divide SCM0 on y-axis %i\n", g->GetNETAdiv()));
458 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
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
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
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
473 AliDebug(2,Form(" ** TRAP ** \n"));
474 for(int i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
476 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
477 xpos = +(parSCM0[1]+parSCM0[0])/4.;
478 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
480 // Using rotation because SCMX should be the same due to Pb tiles
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");
484 // put LED to the SCM0
485 AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0);
486 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
488 par[1] = parSCM0[2]/2; // y
489 par[2] = g->GetECPbRadThick()/2.; // z
493 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
494 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.;
495 if(!gn.Contains("NOPB")) { // for testing - 11-jul-05
496 AliDebug(2,Form(" Pb tiles \n"));
497 for(int iz=0; iz<g->GetNECLayers(); iz++){
498 par[0] = (parSCM0[0] + mod->GetTanBetta()*fSampleWidth*iz)/2.;
499 xpos = par[0] - xCenterSCMX;
500 gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
501 AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]));
502 zpos += fSampleWidth;
504 AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr));
506 } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) {
507 printf(" before AliEMCALv0::Trd1Tower3X3() : parSCM0");
508 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
510 Trd1Tower3X3(parSCM0);
511 } else if(g->GetNPHIdiv()==1 && g->GetNETAdiv()==1) {
512 // no division in SCM0
513 Trd1Tower1X1(parSCM0);
514 } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) {
520 //______________________________________________________________________
521 void AliEMCALv0::CreateSmod(const char* mother)
523 // 18-may-05; mother="XEN1";
524 // child="SMOD" from first to 10th, "SM10" (11th and 12th) (TRD1 case)
525 AliEMCALGeometry * g = GetGeometry();
526 TString gn(g->GetName()); gn.ToUpper();
528 Double_t par[3], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.;
530 // ===== define Super Module from air - 14x30 module ==== ;
531 fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
532 AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data()));
533 par[0] = g->GetShellThickness()/2.;
534 par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
535 par[2] = g->GetEtaModuleSize()*15.;
537 int nphism = g->GetNumberOfSuperModules()/2; // 20-may-05
539 dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/nphism;
540 // if(g->GetKey110DEG()) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1);
541 rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.;
542 AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi));
545 if(gn.Contains("WSUC")) {
546 par[0] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
547 par[1] = g->GetShellThickness()/2.;
548 par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5;
550 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
552 AliDebug(2,Form("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
553 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
557 nphism = g->GetNumberOfSuperModules();
559 if(gn.Contains("TRD")) {
560 par[2] = 350./2.; // 11-oct-04 - for 26 division
561 if(gn.Contains("TRD1")) {
562 AliDebug(2,Form(" par[0] %7.2f (old) \n", par[0]));
563 Float_t *parSM = g->GetSuperModulesPars();
564 for(int i=0; i<3; i++) par[i] = parSM[i];
567 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
568 AliDebug(2,Form("tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
569 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
572 if(g->GetKey110DEG()) { // 12-oct-05
575 gMC->Gsvolu("SM10", "BOX", fIdTmedArr[kIdAIR], par, 3);
576 AliDebug(2,Form(" Super module with name \"SM10\" was created too par[1] = %f\n", par[1]));
580 if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
581 par[0] = g->GetSteelFrontThickness()/2.;
582 gMC->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3);
583 printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", fIdTmedArr[kIdSTEEL], par[0],par[1],par[2]);
584 xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.;
585 gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
589 int nr=0, nrsmod=0, i0=0;
591 // Turn whole super module
592 for(int i=i0; i<nphism; i++) {
593 if(gn.Contains("WSUC")) {
594 xpos = ypos = zpos = 0.0;
596 gMC->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
597 printf(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
598 fIdRotm, phi, phiRad, xpos, ypos, zpos);
601 TString smName("SMOD"); // 12-oct-05
602 if(i==5 && g->GetKey110DEG()) {
607 phi = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170
608 phiRad = phi*TMath::Pi()/180.;
610 AliMatrix(fIdRotm, 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
612 xpos = rpos * TMath::Cos(phiRad);
613 ypos = rpos * TMath::Sin(phiRad);
614 zpos = fSmodPar2; // 21-sep-04
615 if(i==5 && g->GetKey110DEG()) {
616 xpos += (par1C/2. * TMath::Sin(phiRad));
617 ypos -= (par1C/2. * TMath::Cos(phiRad));
620 // 1th module in z-direction;
621 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
622 AliDebug(3, Form(" %s : %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n",
623 smName.Data(), nr, fIdRotm, phi, phiRad, xpos, ypos, zpos, i));
624 // 2th module in z-direction;
625 if(gn.Contains("TRD")) {
626 // turn arround X axis; 0<phi<360
627 double phiy = 90. + phi + 180.;
628 if(phiy>=360.) phiy -= 360.;
630 AliMatrix(fIdRotm, 90.0, phi, 90.0, phiy, 180.0, 0.0);
631 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
632 AliDebug(3, Form(" %s : %2i fIdRotm %3i phiy %6.1f xpos %7.2f ypos %7.2f zpos %7.2f \n",
633 smName.Data(), nr, fIdRotm, phiy, xpos, ypos, -zpos));
635 gMC->Gspos("SMOD", ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
639 AliDebug(2,Form(" Number of Super Modules %i \n", nr+nrsmod));
642 //______________________________________________________________________
643 void AliEMCALv0::CreateEmod(const char* mother, const char* child)
645 // 17-may-05; mother="SMOD"; child="EMOD"
646 AliEMCALGeometry * g = GetGeometry();
647 TString gn(g->GetName()); gn.ToUpper();
649 Double_t par[10], xpos=0., ypos=0., zpos=0.;
650 Double_t parSCPA[5], zposSCPA=0.; // passive SC - 13-MAY-05, TRD1 case
651 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
654 if(!gn.Contains("TRD")) { // standard module
655 par[0] = (fSampleWidth*g->GetNECLayers())/2.;
656 par[1] = par[2] = g->GetPhiModuleSize()/2.;
657 gMC->Gsvolu(child, "BOX", fIdTmedArr[kIdSTEEL], par, 3);
659 } else if (gn.Contains("TRD1")){ // TRD1 system coordinate iz differnet
660 if(strcmp(mother,"SMOD")==0) {
661 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
662 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
663 fParEMOD[2] = g->GetPhiModuleSize()/2.;; // dy
664 fParEMOD[3] = g->GetLongModuleSize()/2.; // dz
665 gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4);
666 // if(gn.Contains("WSUC") || gn.Contains("MAY05")){
667 if(0){ // Jul 12 - should be checked
668 parSCPA[0] = g->GetEtaModuleSize()/2. + tanTrd1*g->GetFrontSteelStrip(); // dx1
669 parSCPA[1] = parSCPA[0] + tanTrd1*g->GetPassiveScintThick(); // dx2
670 parSCPA[2] = g->GetPhiModuleSize()/2.; // dy
671 parSCPA[3] = g->GetPassiveScintThick()/2.; // dz
672 gMC->Gsvolu("SCPA", "TRD1", fIdTmedArr[kIdSC], parSCPA, 4);
673 zposSCPA = -fParEMOD[3] + g->GetFrontSteelStrip() + g->GetPassiveScintThick()/2.;
674 gMC->Gspos ("SCPA", ++nr, child, 0.0, 0.0, zposSCPA, 0, "ONLY");
680 if(gn.Contains("TRD")) { // 30-sep-04; 27-jan-05 - as for TRD1
681 // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0)
682 AliEMCALShishKebabTrd1Module *mod=0; // current module
684 for(int iz=0; iz<g->GetNZ(); iz++) {
685 Double_t angle=90., phiOK=0;
686 if(gn.Contains("TRD1")) {
687 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
688 angle = mod->GetThetaInDegree();
689 if(!gn.Contains("WSUC")) { // ALICE
690 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,90., 90.,0.); // z'(x); y'(y); x'(z)
691 else AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.);
692 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
693 // printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
694 //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
695 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
696 zpos = mod->GetPosZ() - fSmodPar2;
698 int iyMax = g->GetNPhi();
699 if(strcmp(mother,"SMOD") && g->GetKey110DEG()) {
702 for(int iy=0; iy<iyMax; iy++) { // flat in phi
703 ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
704 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
705 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm);
706 AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
710 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y)
711 else AliMatrix(fIdRotm, 90-angle,270., 90.0,0.0, angle,90.);
712 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
713 printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
714 iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
715 zpos = mod->GetPosZ() - fSmodPar2;
716 ypos = mod->GetPosXfromR() - fSmodPar1;
717 printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm);
718 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
719 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
720 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
721 printf(" %7.2f ", xpos);
728 xpos = g->GetSteelFrontThickness()/2.;
729 for(int iz=0; iz<g->GetNZ(); iz++) {
730 zpos = -fSmodPar2 + g->GetEtaModuleSize()*(2*iz+1)/2.;
731 for(int iy=0; iy<g->GetNPhi(); iy++) {
732 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
733 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, 0, "ONLY") ;
734 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f \n", nr, xpos, ypos, zpos);
738 AliDebug(2,Form(" Number of modules in Super Module(%s) %i \n", mother, nr));
741 //______________________________________________________________________
742 void AliEMCALv0::Trd1Tower3X3(const double *parSCM0)
744 // Started Dec 8,2004 by PAI
746 printf(" AliEMCALv0::Trd1Tower3X3() : parSCM0");
747 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
749 // Nov 10, 2006 - different name of SCMX
750 double parTRAP[11], *dummy=0;
751 AliEMCALGeometry * g = GetGeometry();
752 TString gn(g->GetName()), scmx;
754 // Division to tile size
755 AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv()));
756 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
757 double dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3];
758 double ndiv=3., xpos=0.0;
759 // should be defined once
760 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
761 for(int ix=1; ix<=3; ix++) { // 3X3
762 scmx = "SCX"; // Nov 10,2006
765 double xCentBot = 2.*dx1/3.;
766 double xCentTop = 2.*(dx2/4. + dx1/12.);
767 parTRAP[1] = TMath::ATan2((xCentTop-xCentBot),2.*dz)*TMath::RadToDeg(); // theta
768 parTRAP[2] = 0.; // phi
770 parTRAP[3] = dy/ndiv; // H1
771 parTRAP[4] = dx1/ndiv; // BL1
772 parTRAP[5] = parTRAP[4]; // TL1
773 parTRAP[6] = 0.0; // ALP1
775 parTRAP[7] = dy/ndiv; // H2
776 parTRAP[8] = dx2/2 - dx1/6.;// BL2
777 parTRAP[9] = parTRAP[8]; // TL2
778 parTRAP[10]= 0.0; // ALP2
779 xpos = (xCentBot+xCentTop)/2.;
782 parTRAP[1] = -parTRAP[1];
784 } else if(ix==2) { // central part is box but we treat as trapesoid due to numbering
786 parTRAP[8] = dx1/ndiv; // BL2
787 parTRAP[9] = parTRAP[8]; // TL2
790 AliDebug(2,Form(" ** TRAP ** xpos %9.3f\n", xpos));
791 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
794 gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
795 gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
797 PbInTrap(parTRAP, scmx);
799 AliDebug(2,Form("Trd1Tower3X3()", "Ver. 1.0 : was tested."));
803 //______________________________________________________________________
804 void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
806 // see for example CreateShishKebabGeometry(); just for case TRD1
808 AliDebug(2,Form(" Pb tiles : nrstart %i\n", nr));
809 AliEMCALGeometry * g = GetGeometry();
812 // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
813 double xpos = 0.0, ypos = 0.0;
814 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
816 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
817 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // ??
818 // double tan = TMath::Tan(parTRAP[1]*TMath::DegToRad());
820 par[1] = parTRAP[3]; // y
821 par[2] = g->GetECPbRadThick()/2.; // z
822 for(int iz=0; iz<g->GetNECLayers(); iz++){
823 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
824 xpos = par[0] - xCenterSCMX;
825 if(parTRAP[1] < 0.) xpos = -xpos;
826 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
827 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
828 zpos += fSampleWidth;
829 if(iz%2>0) printf("\n");
831 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
832 AliDebug(2,Form(" par[1] %9.3f par[2] %9.3f ypos %9.3f \n", par[1], par[2], ypos));
833 AliDebug(2,Form(" PbInTrap Ver. 1.0 : was tested."));
837 //______________________________________________________________________
838 void AliEMCALv0::Trd1Tower4X4()
843 //______________________________________________________________________
844 void AliEMCALv0::Trd1Tower1X1(double *parSCM0)
846 // Started Nov 22,2006 by PAI
847 AliDebug(1," AliEMCALv0::Trd1Tower1X1() : parSCM0");
848 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
851 // No division - keeping the same volume logic
852 // and as consequence the same abs is scheme
853 AliDebug(2,"Trd1Tower1X1() : Create SCMX(SCMY) as SCM0");
855 gMC->Gsvolu("SCMY", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
856 gMC->Gspos("SCMY", 1, "SCM0", 0.0, 0.0, 0.0, 0, "ONLY");
857 gMC->Gsvolu("SCMX", "TRD1", fIdTmedArr[kIdSC], parSCM0, 4);
858 gMC->Gspos("SCMX", 1, "SCMY", 0.0, 0.0, 0.0, 0, "ONLY");
860 // should be defined once
862 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
864 PbInTrd1(parSCM0, "SCMX");
866 AliDebug(1,"Trd1Tower1X1() : Ver. 0.1 : was tested.");
869 //______________________________________________________________________
870 void AliEMCALv0::PbInTrd1(double *parTrd1, TString n)
872 // see PbInTrap(const double parTrd1[11], TString n)
873 static int nr=0, ndeb=2;
874 AliDebug(ndeb,Form(" Pb tiles : nrstart %i\n", nr));
875 AliEMCALGeometry * g = GetGeometry();
878 // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
879 double xpos = 0.0, ypos = 0.0;
880 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
881 double coef = (parTrd1[1] - parTrd1[0]) / (2.*parTrd1[3]);
883 par[1] = parTrd1[2]; // y
884 par[2] = g->GetECPbRadThick()/2.; // z
886 for(int iz=0; iz<g->GetNECLayers(); iz++){
887 par[0] = parTrd1[0] + coef*fSampleWidth*iz;
888 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
889 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
890 zpos += fSampleWidth;
891 if(iz%2>0) printf("\n");
893 AliDebug(ndeb,Form(" Number of Pb tiles in SCMX %i coef %9.7f ", nr, coef));
894 AliDebug(ndeb,Form(" PbInTrd1 Ver. 0.1 : was tested."));
898 //______________________________________________________________________
899 void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parSCM0[5])
901 // Passive material inside the detector
902 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); //Need check
903 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
904 for(int i=0; i<4; i++) { // on pictures sometimes I can not see 0 -> be carefull!!
905 parSCM0[i] = emodPar[i] - wallThickness;
906 AliDebug(2,Form(" %i parSCMO %7.3f emodPar %7.3f : dif %7.3f \n",
907 i, parSCM0[i],emodPar[i], parSCM0[i]-emodPar[i]));
909 parSCM0[4] = emodPar[4];
910 gMC->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC
911 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
913 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
914 Division2X2InScm0(g, parSCM0);
916 Info("Scm0InTrd2"," no division SCM0 in this geometry |%s|\n", g->GetName());
921 //______________________________________________________________________
922 void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t parSCM0[5])
925 Double_t parTRAP[11], xpos=0.,ypos=0., dx1=0.0,dx2=0.,dy1=0.0,dy2=0.,dz=0.
929 Info("Division2X2InScm0","Divide SCM0 on y-axis %i\n", g->GetNETAdiv());
930 TString n("SCMX"), overLapFlagSCMY("ONLY"), overLapFlagSCMX("ONLY");
931 n = "SCM0"; // for testing - 14-mar-05
933 PbInTrapForTrd2(parSCM0, n);
934 // overLapFlagSCMY=overLapFlagSCMX="MANY"; // do not work
938 dy1 = parSCM0[2] , dy2 = parSCM0[3], dz = parSCM0[4];
940 parTRAP[0] = parSCM0[4]; // dz
941 parTRAP[1] = TMath::ATan2((dy2-dy1)/2.,2.*dz)*TMath::RadToDeg();
942 parTRAP[2] = 90.; // phi
944 parTRAP[3] = parSCM0[2]/2.; // H1
945 parTRAP[4] = parSCM0[0]; // BL1
946 parTRAP[5] = parTRAP[4]; // TL1
947 parTRAP[6] = 0.0; // ALP1
949 parTRAP[7] = parSCM0[3]/2.; // H2
950 parTRAP[8] = parSCM0[1]; // BL2
951 parTRAP[9] = parTRAP[8]; // TL2
952 parTRAP[10]= 0.0; // ALP2
953 AliDebug(2,Form(" ** SCMY ** \n"));
954 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
957 gMC->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC
958 ypos = +(parTRAP[3]+parTRAP[7])/2.; //
959 AliDebug(2,Form(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data()));
960 gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm, overLapFlagSCMY.Data()) ;
961 // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z
962 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
963 // We may have problem with numeration due to rotation - 4-feb-05
964 gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm, overLapFlagSCMY.Data());
966 Info("Division2X2InScm0","Divide SCMY on x-axis %i\n", g->GetNPHIdiv());
969 dr1=TMath::Sqrt(dx1*dx1+dy1*dy1);
970 dr2=TMath::Sqrt(dx2*dx2+dy2*dy2);
972 parTRAP[0] = parSCM0[4]; // dz
973 parTRAP[1] = TMath::ATan2((dr2-dr1)/2.,2.*dz)*TMath::RadToDeg(); //
974 parTRAP[2] = 45.; // phi
976 parTRAP[3] = parSCM0[2]/2.; // H1
977 parTRAP[4] = parSCM0[0]/2.; // BL1
978 parTRAP[5] = parTRAP[4]; // TL1
979 parTRAP[6] = 0.0; // ALP1
981 parTRAP[7] = parSCM0[3]/2.; // H2
982 parTRAP[8] = parSCM0[1]/2; // BL2
983 parTRAP[9] = parTRAP[8]; // TL2
984 parTRAP[10]= 0.0; // ALP2
985 AliDebug(2,Form(" ** SCMX ** \n"));
986 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
989 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
990 xpos = (parTRAP[4]+parTRAP[8])/2.;
991 AliDebug(2,Form(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data()));
992 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
993 // AliMatrix(fIdRotm, 90.0,270., 90.0, 0.0, 0.0,0.0); // x'=-y; y'=x; z'=z
994 AliMatrix(fIdRotm, 90.0,90., 90.0, -180.0, 0.0,0.0); // x'=y; y'=-x; z'=z
995 gMC->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
997 if(n=="SCMX" && overLapFlagSCMY == "ONLY") {
998 PbInTrapForTrd2(parTRAP, n);
1003 //______________________________________________________________________
1004 void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
1008 TString pbShape("BOX"), pbtiChonly("ONLY");
1011 // pbtiChonly = "MANY";
1013 gMC->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0);
1016 Info("PbInTrapForTrd2"," Pb tiles inside %s: shape %s :pbtiChonly %s\n nrstart %i\n",
1017 name.Data(), pbShape.Data(), pbtiChonly.Data(), nr);
1018 AliEMCALGeometry * g = GetGeometry();
1020 double par[5], parPB[5], parSC[5];
1021 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1022 double xpos = 0.0, ypos = 0.0;
1023 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1024 if(name == "SCMX") { // common trapezoid - 11 parameters
1025 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
1026 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // the same for y
1027 AliDebug(2,Form(" xCenterSCMX %8.5f : coef %8.7f \n", xCenterSCMX, coef));
1029 par[2] = g->GetECPbRadThick()/2.; // z
1030 for(int iz=0; iz<g->GetNECLayers(); iz++){
1031 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
1033 xpos = ypos = par[0] - xCenterSCMX;
1034 //if(parTRAP[1] < 0.) xpos = -xpos;
1035 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
1036 AliDebug(2,Form(" %2.2i xpos %8.5f zpos %6.3f par[0,1] %6.3f |", iz+1, xpos, zpos, par[0]));
1037 if(iz%2>0) AliDebug(2,Form("\n"));
1038 zpos += fSampleWidth;
1040 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
1041 AliDebug(2,Form(" par[1] %9.5f par[2] %9.5f ypos %9.5f \n", par[1], par[2], ypos));
1042 } else if(name == "SCM0") { // 1-mar-05 ; TRD2 - 5 parameters
1043 AliDebug(2,Form(" SCM0 par = "));
1044 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parTRAP[i]));
1045 AliDebug(2,Form("\n zpos %f \n",zpos));
1047 double tanx = (parTRAP[1] - parTRAP[0]) / (2.*parTRAP[4]); // tanx = tany now
1048 double tany = (parTRAP[3] - parTRAP[2]) / (2.*parTRAP[4]), ztmp=0.;
1049 parPB[4] = g->GetECPbRadThick()/2.;
1050 parSC[2] = g->GetECScintThick()/2.;
1051 for(int iz=0; iz<g->GetNECLayers(); iz++){
1052 ztmp = fSampleWidth*double(iz);
1053 parPB[0] = parTRAP[0] + tanx*ztmp;
1054 parPB[1] = parPB[0] + tanx*g->GetECPbRadThick();
1055 parPB[2] = parTRAP[2] + tany*ztmp;
1056 parPB[3] = parPB[2] + tany*g->GetECPbRadThick();
1057 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ;
1058 AliDebug(2,Form("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos));
1060 for(int i=0; i<5; i++) printf(" %9.5f ", parPB[i]);
1061 // individual SC tile
1062 parSC[0] = parPB[0];
1063 parSC[1] = parPB[1];
1064 gMC->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(),
1065 0, pbtiChonly.Data(), parSC, 3) ;
1066 printf("\n SCTI zpos %6.3f | par = ", zpos+g->GetECScintThick());
1067 for(int i=0; i<3; i++) printf(" %9.5f ", parPB[i]);
1069 zpos += fSampleWidth;
1071 AliDebug(2,Form("\n"));
1073 Info("PbInTrapForTrd2", "Ver. 0.03 : was tested.");
1077 //______________________________________________________________________
1078 void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parPBMO[5])
1081 Info("PbmoInTrd2"," started : geometry %s ", g->GetName());
1082 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize();
1083 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
1084 for(int i=0; i<4; i++) {
1085 parPBMO[i] = emodPar[i] - wallThickness;
1086 AliDebug(2,Form(" %i parPBMO %7.3f emodPar %7.3f : dif %7.3f \n",
1087 i, parPBMO[i],emodPar[i], parPBMO[i]-emodPar[i]));
1089 parPBMO[4] = emodPar[4];
1090 gMC->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5);
1091 gMC->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
1093 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
1094 Division2X2InPbmo(g, parPBMO);
1095 AliDebug(2,Form(" PBMO, division 2X2 | geometry |%s|\n", g->GetName()));
1097 AliDebug(2,Form(" no division PBMO in this geometry |%s|\n", g->GetName()));
1102 //______________________________________________________________________
1103 void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t parPBMO[5])
1106 Info("Division2X2InPbmo"," started : geometry %s ", g->GetName());
1107 //Double_t *dummy=0;
1108 // gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0);
1111 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1112 double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;;
1113 double tanx = (parPBMO[1] - parPBMO[0]) / (2.*parPBMO[4]); // tanx = tany now
1114 double tany = (parPBMO[3] - parPBMO[2]) / (2.*parPBMO[4]);
1115 char name[10], named[10], named2[10];
1117 AliDebug(2,Form(" PBMO par = "));
1118 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parPBMO[i]));
1119 AliDebug(2,Form("\n"));
1121 parSC[2] = g->GetECScintThick()/2.;
1122 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick() + g->GetECScintThick()/2.;
1123 AliDebug(2,Form(" parSC[2] %9.5f \n", parSC[2]));
1124 for(int iz=0; iz<g->GetNECLayers(); iz++){
1125 ztmp = g->GetECPbRadThick() + fSampleWidth*double(iz); // Z for previous PB
1126 parSC[0] = parPBMO[0] + tanx*ztmp;
1127 parSC[1] = parPBMO[2] + tany*ztmp;
1129 sprintf(name,"SC%2.2i", iz+1);
1130 gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3);
1131 gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
1132 AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ",
1133 name, zpos, parSC[0], parSC[1]));
1135 sprintf(named,"SY%2.2i", iz+1);
1136 printf(" %s -> ", named);
1137 gMC->Gsdvn(named,name, 2, 2);
1139 sprintf(named2,"SX%2.2i", iz+1);
1140 printf(" %s \n", named2);
1141 gMC->Gsdvn(named2,named, 2, 1);
1143 zpos += fSampleWidth;
1147 //______________________________________________________________________
1148 AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta)
1151 AliEMCALShishKebabTrd1Module* trd1=0;
1152 if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) {
1153 trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta);
1158 //_____________________________________________________________________________
1159 void AliEMCALv0::AddAlignableVolumes() const
1161 TString ntmp(GetTitle()); // name of EMCAL geometry
1163 if(ntmp.Contains("WSUC")) {
1164 AddAlignableVolumesInWSUC(); // WSUC case
1166 AddAlignableVolumesInALICE(); // ALICE case
1170 //______________________________________________________________________
1171 void AliEMCALv0::AddAlignableVolumesInALICE() const
1174 // Create entries for alignable volumes associating the symbolic volume
1175 // name with the corresponding volume path. Needs to be synchronized with
1176 // eventual changes in the geometry.
1179 Float_t * pars = GetGeometry()->GetSuperModulesPars();
1180 double rpos = (GetGeometry()->GetEnvelop(0) + GetGeometry()->GetEnvelop(1))/2.;
1181 double phi, phiRad, xpos, ypos, zpos;
1183 AliGeomManager::ELayerID idEMCAL = AliGeomManager::kEMCAL;
1184 Int_t modUID, modnum = 0;
1185 TString volpath, symname;
1187 Int_t nSMod = GetGeometry()->GetNumberOfSuperModules();
1188 for (Int_t smodnum=0; smodnum < nSMod; smodnum++) {
1189 modUID = AliGeomManager::LayerToVolUID(idEMCAL,modnum++);
1190 volpath = "ALIC_1/XEN1_1/SMOD_";
1191 volpath += (smodnum+1);
1192 symname = "EMCAL/FullSupermodule";
1193 symname += (smodnum+1);
1195 if(GetGeometry()->GetKey110DEG() && smodnum>=10) {
1196 volpath = "ALIC_1/XEN1_1/SM10_";
1197 volpath += (smodnum-10+1);
1198 symname = "EMCAL/HalfSupermodule";
1199 symname += (smodnum-10+1);
1202 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
1203 AliFatal("AliEMCALv0::Unable to set alignable entry!!");
1205 // Creates the Tracking to Local transformation matrix for EMCAL
1207 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID) ;
1209 phiRad = GetGeometry()->GetPhiCenterOfSM(smodnum); //comes in radians, not degrees
1210 phi = phiRad*180./TMath::Pi(); //need degrees for rot. matrix
1211 xpos = rpos * TMath::Cos(phiRad);
1212 ypos = rpos * TMath::Sin(phiRad);
1214 if(GetGeometry()->GetKey110DEG() && smodnum >= 10) {
1215 xpos += (pars[1]/2. * TMath::Sin(phiRad));
1216 ypos -= (pars[1]/2. * TMath::Cos(phiRad));
1219 TGeoHMatrix *matTtoL;
1220 TGeoHMatrix *globMatrix = alignableEntry->GetGlobalOrig();
1222 if(smodnum%2 == 0) {
1224 TGeoTranslation geoTran0(xpos,ypos, zpos);
1225 TGeoRotation geoRot0("geoRot0", 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
1226 TGeoCombiTrans mat0(geoTran0, geoRot0);
1227 matTtoL = new TGeoHMatrix(mat0);
1229 matTtoL->MultiplyLeft(&(globMatrix->Inverse()));
1230 alignableEntry->SetMatrix(matTtoL);
1234 double phiy = 90. + phi + 180.;
1235 if(phiy>=360.) phiy -= 360.;
1236 TGeoTranslation geoTran1(xpos,ypos,-zpos);
1237 TGeoRotation geoRot1("geoRot1", 90.0, phi, 90.0, phiy, 180.0, 0.0);
1238 TGeoCombiTrans mat1(geoTran1, geoRot1);
1239 matTtoL = new TGeoHMatrix(mat1);
1241 matTtoL->MultiplyLeft(&(globMatrix->Inverse()));
1242 alignableEntry->SetMatrix(matTtoL);
1250 //______________________________________________________________________
1251 void AliEMCALv0::AddAlignableVolumesInWSUC() const
1254 // Create entries for alignable volumes associating the symbolic volume
1255 // name with the corresponding volume path. Needs to be synchronized with
1256 // eventual changes in the geometry.
1259 TString vpstr1 = "WSUC_1/XEN1_1/SMOD_";
1260 TString snstr1 = "EMCAL/CosmicTestSupermodule";
1261 TString volpath, symname;
1264 for (Int_t smodnum=0; smodnum < 1; smodnum++) {
1266 symname += (smodnum+1);
1268 volpath += (smodnum+1);
1269 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1270 AliFatal("Unable to set alignable entry!!");