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());
94 AliEMCALGeometry *geom = GetGeometry() ;
95 fShishKebabModules = geom->GetShishKebabTrd1Modules();
98 //______________________________________________________________________
99 void AliEMCALv0::BuildGeometry()
101 // Display Geometry for display.C
103 const Int_t kColorArm1 = kBlue ;
105 AliEMCALGeometry * geom = GetGeometry();
107 TString gn(geom->GetName());
110 // Define the shape of the Calorimeter
111 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
112 TNode * envelopNode = 0;
113 char *envn = "Envelop1";
114 if(gn.Contains("WSUC")) {
115 envelopNode = BuildGeometryOfWSUC();
116 } else { // Shish-kebab now for compact and TRD1 cases (ALIC)
118 TPGON *pgon = new TPGON(envn, "PGON that contains arm 1", "void",
119 geom->GetArm1PhiMin(),geom->GetArm1PhiMax()-geom->GetArm1PhiMin(),geom->GetNPhiSuperModule(), 2);
121 if (fEnvelop1.GetSize()<8) {
123 fEnvelop1[0] = geom->GetArm1PhiMin(); // minimum phi angle
124 fEnvelop1[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
125 fEnvelop1[2] = geom->GetNPhiSuperModule();
126 fEnvelop1[3] = 2; // 2 z coordinates
127 fEnvelop1[4] = -350.;
128 fEnvelop1[5] = geom->GetEnvelop(0) ; // rmin at z1
129 fEnvelop1[6] = geom->GetEnvelop(1) ; // rmax at z1
131 fEnvelop1[8] = fEnvelop1[5] ; // radii are the same.
132 fEnvelop1[9] = fEnvelop1[6] ; // radii are the same.
134 pgon->DefineSection(0, fEnvelop1[4], fEnvelop1[5], fEnvelop1[6]);
135 pgon->DefineSection(1, fEnvelop1[7], fEnvelop1[5], fEnvelop1[6]);
137 envelopNode = new TNode(envn, "Arm1 Envelop2", envn, 0., 0., 0., "") ;
140 envelopNode->SetLineColor(kColorArm1) ;
141 fNodes->Add(envelopNode);
144 //______________________________________________________________________
145 TNode *AliEMCALv0::BuildGeometryOfWSUC()
147 // June 8, 2005; see directory geant3/TGeant3/G3toRoot.cxx
148 // enum EColor { kWhite, kBlack, kRed, kGreen, kBlue, kYellow, kMagenta, kCyan } - see $ROOTSYS/include/Gtypes.h
149 AliEMCALGeometry * g = GetGeometry();
150 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
153 TNode *envelopNode = 0;
157 new TBRIK(name, "WSUC(XEN1 in Geant)","void",fEnvelop1[0],fEnvelop1[1],fEnvelop1[2]);
158 envelopNode = new TNode(name, "envelope for WSUC", name, 0., 0., 0., "");
159 envelopNode->SetVisibility(0);
162 TNode *emod=0, *scmx=0;
163 name = "SMOD"; // super module
164 new TBRIK(name, "SMOD(SMOD in Geant)","void", fSmodPar0,fSmodPar1,fSmodPar2);
165 if(envelopNode) envelopNode->cd();
166 TNode *smod = new TNode(name, "SMOD", name, 0., 0., 0., "");
167 smod->SetLineColor(kBlue) ;
168 if(envelopNode==0) envelopNode = smod;
170 name = "EMOD"; // see CreateEMOD
171 TTRD1 *emodTrd1 = new TTRD1(name, "EMOD(EMOD in Geant)","void", float(fParEMOD[0]),
172 float(fParEMOD[1]),float(fParEMOD[2]),float(fParEMOD[3]));
174 // SCMX = EMOD/4 for simplicity of drawing
176 Float_t dz=0.,theta=0.,phi=0.,h1=0.,bl1=0.,tl1=0.,alpha1=0.,h2=0.,bl2=0.,tl2=0.,alpha2=0.;
177 h1 = emodTrd1->GetDy()/2.;
178 bl1 = emodTrd1->GetDx()/2.;
181 h2 = emodTrd1->GetDy()/2.;
182 bl2 = emodTrd1->GetDx2()/2.;
186 dz = emodTrd1->GetDz();
187 double dr = TMath::Sqrt((h2-h1)*(h2-h1)+(bl2-bl1)*(bl2-bl1));
188 theta = TMath::ATan2(dr,2.*dz) * TMath::RadToDeg();
191 TTRAP *scmxTrap = new TTRAP(name, "SCMX(SCMX as in Geant)","void",
192 dz,theta,phi, h1,bl1,tl1,alpha1, h2,bl2,tl2,alpha2);
194 Float_t xShiftSCMX = (emodTrd1->GetDx() + emodTrd1->GetDx2())/4.;
195 Float_t yShiftSCMX = emodTrd1->GetDy()/2.;
196 printf(" xShiftSCMX %7.4f yShiftSCMX %7.4f \n",xShiftSCMX,yShiftSCMX);
198 name = "EMOD"; // see CreateEMOD
201 AliEMCALShishKebabTrd1Module *mod=0;
202 Double_t angle=90., xpos=0.,ypos=0.,zpos=0., xposSCMX=0.,yposSCMX=0.,zposSCMX=0.;
203 char rtmn[100], rtmt[100];
204 TRotMatrix *rtm=0, *rtmSCMX=0;
206 for(int iz=0; iz<g->GetNZ(); iz++) {
207 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
208 zpos = mod->GetPosZ() - fSmodPar2;
209 ypos = mod->GetPosXfromR() - fSmodPar1;
211 angle = mod->GetThetaInDegree();
212 sprintf(rtmn,"rmEmod%5.1f",angle);
213 sprintf(rtmt,"rotation matrix for EMOD, iz=%i, angle = %6.3f",iz, angle);
214 if(iz==0) rtm = new TRotMatrix(rtmn, rtmt,0.,0., 90.,0., 90.,90.); // z'(x); y'(y); x'(z)
215 else rtm = new TRotMatrix(rtmn, rtmt,90.-angle,270., 90.0,0.0, angle,90.);
217 TGeometry *tg = gAlice->GetGeometry();
218 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
219 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
220 sprintf(rtmt,"EMOD, iz %i, ix %i, angle %6.3f",iz,ix, angle);
221 TString namNode=name;
222 namNode += numEmod++;
224 emod = new TNode(namNode.Data(), rtmt, (TShape*)emodTrd1, xpos,ypos,zpos,rtm);
225 // emod->SetLineColor(kGreen) ;
226 emod->SetVisibility(0); // SCMX will bi visible
227 if(scmxTrap) { // 4(2x2) sensetive volume inside EMOD
230 for(int jy=0; jy<2; jy++){ // division on y
231 yposSCMX = yShiftSCMX *(2*jy - 1);
232 for(int jx=0; jx<2; jx++){ // division on x
233 Double_t theta1=90.,phi1=0., theta2=90.,phi2=90., theta3=0.,phi3=0 ;
234 xposSCMX = xShiftSCMX *(2*jx - 1);
238 sprintf(rtmn,"rm%s",namNode.Data());
239 sprintf(rtmt,"rotation matrix for %s inside EMOD",namNode.Data());
240 rtmSCMX = tg->GetRotMatrix(rtmn);
242 phi1 = 180.; // x' = -x
243 phi2 = 270.; // y' = -y
245 if(rtmSCMX == 0) rtmSCMX = new TRotMatrix(rtmn,rtmt, theta1,phi1, theta2,phi2, theta3,phi3);
246 sprintf(rtmt,"%s inside %s", namNode.Data(), emod->GetName());
247 scmx = new TNode(namNode.Data(), rtmt, (TShape*)scmxTrap, xposSCMX,yposSCMX,zposSCMX,rtmSCMX);
248 scmx->SetLineColor(kMagenta);
254 // emod->Draw(); // for testing
259 //______________________________________________________________________
260 void AliEMCALv0::CreateGeometry()
262 // Create the EMCAL geometry for Geant
263 // Geometry of a tower
265 AliEMCALGeometry * geom = GetGeometry() ;
266 TString gn(geom->GetName());
269 if(!(geom->IsInitialized())){
270 Error("CreateGeometry","EMCAL Geometry class has not been set up.");
273 // Get pointer to the array containing media indices
274 fIdTmedArr = fIdtmed->GetArray() - 1599 ;
277 // gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule
278 AliMatrix(fIdRotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
280 // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1
282 Float_t envelopA[10];
283 if(gn.Contains("WSUC") ) { // TRD1 for WSUC facility
284 // 17-may-05 - just BOX
288 gMC->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ;
290 for(int i=0; i<3; i++) fEnvelop1[i] = envelopA[i]; // 23-may-05
291 // Position the EMCAL Mother Volume (XEN1) in WSUC
292 gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
294 envelopA[0] = geom->GetArm1PhiMin(); // minimum phi angle
295 envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
296 envelopA[2] = geom->GetNPhiSuperModule(); // number of sections in phi
297 envelopA[3] = 2; // 2 z coordinates
298 // envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1),
299 //geom->GetArm1EtaMin()); // z coordinate 1
300 envelopA[4] = -350.; // AM 30/5/2006
302 //add some padding for mother volume
303 envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1
304 envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1
305 // envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1),
306 // geom->GetArm1EtaMax()); // z coordinate 2
307 envelopA[7] = 350.; // AM 30/5/2006
309 envelopA[8] = envelopA[5] ; // radii are the same.
310 envelopA[9] = envelopA[6] ; // radii are the same.
312 gMC->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ; // Polygone filled with air
313 fEnvelop1.Set(10, envelopA);
315 printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]);
316 printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]);
318 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
319 gMC->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
323 AliDebug(2,Form("Shish-Kebab geometry : %s", GetTitle()));
324 CreateShishKebabGeometry();
328 //______________________________________________________________________
329 void AliEMCALv0::Init(void)
331 // Just prints an information message
333 if(AliLog::GetGlobalDebugLevel()>0) {
334 TString message("\n") ;
335 message += "*****************************************\n" ;
337 // Here the EMCAL initialisation code (if any!)
339 AliEMCALGeometry * geom = GetGeometry() ;
342 message += "AliEMCAL " ;
343 message += Version() ;
344 message += "EMCAL geometry initialized for " ;
345 message += geom->GetName() ;
348 message += "AliEMCAL " ;
349 message += Version() ;
350 message += "EMCAL geometry initialization failed !" ;
352 message += "\n*****************************************" ;
353 printf(message.Data() ) ;
358 //______________________________________________________________________
359 void AliEMCALv0::CreateShishKebabGeometry()
362 AliEMCALGeometry * g = GetGeometry();
363 TString gn(g->GetName()); gn.ToUpper();
364 // see AliModule::fFIdTmedArr
365 // fIdTmedArr = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials()
366 // int kIdAIR=1599, kIdPB = 1600, kIdSC = 1601, kIdSTEEL = 1603;
368 Double_t par[10], xpos=0., ypos=0., zpos=0.;
370 CreateSmod(g->GetNameOfEMCALEnvelope());
372 CreateEmod("SMOD","EMOD"); // 18-may-05
374 if(g->GetKey110DEG()) CreateEmod("SM10","EMOD"); // Nov 1,2006
376 // Sensitive SC (2x2 tiles)
377 double parSCM0[5]={0,0,0,0}, *dummy = 0, parTRAP[11];
379 // double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); // Need check
380 double wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() - g->GetPhiTileSize();
381 for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
382 parSCM0[3] = fParEMOD[3];
383 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
384 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
386 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
387 // Division to tile size - 1-oct-04
388 AliDebug(2,Form(" Divide SCM0 on y-axis %i\n", g->GetNETAdiv()));
389 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
391 parTRAP[0] = parSCM0[3]; // dz
392 parTRAP[1] = TMath::ATan2((parSCM0[1]-parSCM0[0])/2.,2.*parSCM0[3])*180./TMath::Pi(); // theta
393 parTRAP[2] = 0.; // phi
395 parTRAP[3] = parSCM0[2]/2.; // H1
396 parTRAP[4] = parSCM0[0]/2.; // BL1
397 parTRAP[5] = parTRAP[4]; // TL1
398 parTRAP[6] = 0.0; // ALP1
400 parTRAP[7] = parSCM0[2]/2.; // H2
401 parTRAP[8] = parSCM0[1]/2.; // BL2
402 parTRAP[9] = parTRAP[8]; // TL2
403 parTRAP[10]= 0.0; // ALP2
404 AliDebug(2,Form(" ** TRAP ** \n"));
405 for(int i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
407 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
408 xpos = +(parSCM0[1]+parSCM0[0])/4.;
409 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
411 // Using rotation because SCMX should be the same due to Pb tiles
413 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
414 gMC->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, fIdRotm, "ONLY");
415 // put LED to the SCM0
416 AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0);
417 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
419 par[1] = parSCM0[2]/2; // y
420 par[2] = g->GetECPbRadThick()/2.; // z
424 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
425 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.;
426 AliDebug(2,Form(" Pb tiles \n"));
427 for(int iz=0; iz<g->GetNECLayers(); iz++){
428 par[0] = (parSCM0[0] + mod->GetTanBetta()*fSampleWidth*iz)/2.;
429 xpos = par[0] - xCenterSCMX;
430 gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
431 AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]));
432 zpos += fSampleWidth;
434 AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr));
436 } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) {
437 printf(" before AliEMCALv0::Trd1Tower3X3() : parSCM0");
438 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
440 Trd1Tower3X3(parSCM0);
441 } else if(g->GetNPHIdiv()==1 && g->GetNETAdiv()==1) {
442 // no division in SCM0
443 Trd1Tower1X1(parSCM0);
444 } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) {
450 //______________________________________________________________________
451 void AliEMCALv0::CreateSmod(const char* mother)
453 // 18-may-05; mother="XEN1";
454 // child="SMOD" from first to 10th, "SM10" (11th and 12th) (TRD1 case)
455 AliEMCALGeometry * g = GetGeometry();
456 TString gn(g->GetName()); gn.ToUpper();
458 Double_t par[3], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.;
460 // ===== define Super Module from air - 14x30 module ==== ;
461 fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
462 AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data()));
463 par[0] = g->GetShellThickness()/2.;
464 par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
465 par[2] = g->GetEtaModuleSize()*15.;
467 int nphism = g->GetNumberOfSuperModules()/2; // 20-may-05
469 dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/nphism;
470 // if(g->GetKey110DEG()) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1);
471 rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.;
472 AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi));
475 if(gn.Contains("WSUC")) {
476 par[0] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
477 par[1] = g->GetShellThickness()/2.;
478 par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5;
480 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
482 AliDebug(2,Form("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
483 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
487 nphism = g->GetNumberOfSuperModules();
489 par[2] = 350./2.; // 11-oct-04 - for 26 division
490 AliDebug(2,Form(" par[0] %7.2f (old) \n", par[0]));
491 Float_t *parSM = g->GetSuperModulesPars();
492 for(int i=0; i<3; i++) par[i] = parSM[i];
494 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
495 AliDebug(2,Form("tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
496 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
499 if(g->GetKey110DEG()) { // 12-oct-05
502 gMC->Gsvolu("SM10", "BOX", fIdTmedArr[kIdAIR], par, 3);
503 AliDebug(2,Form(" Super module with name \"SM10\" was created too par[1] = %f\n", par[1]));
507 if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
508 par[0] = g->GetSteelFrontThickness()/2.;
509 gMC->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3);
510 printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", fIdTmedArr[kIdSTEEL], par[0],par[1],par[2]);
511 xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.;
512 gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
515 int nr=0, nrsmod=0, i0=0;
517 // Turn whole super module
518 for(int i=i0; i<nphism; i++) {
519 if(gn.Contains("WSUC")) {
520 xpos = ypos = zpos = 0.0;
522 gMC->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
523 printf(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
524 fIdRotm, phi, phiRad, xpos, ypos, zpos);
527 TString smName("SMOD"); // 12-oct-05
528 if(i==5 && g->GetKey110DEG()) {
533 phi = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170
534 phiRad = phi*TMath::Pi()/180.;
536 AliMatrix(fIdRotm, 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
538 xpos = rpos * TMath::Cos(phiRad);
539 ypos = rpos * TMath::Sin(phiRad);
540 zpos = fSmodPar2; // 21-sep-04
541 if(i==5 && g->GetKey110DEG()) {
542 xpos += (par1C/2. * TMath::Sin(phiRad));
543 ypos -= (par1C/2. * TMath::Cos(phiRad));
546 // 1th module in z-direction;
547 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
548 AliDebug(3, Form(" %s : %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n",
549 smName.Data(), nr, fIdRotm, phi, phiRad, xpos, ypos, zpos, i));
550 // 2th module in z-direction;
551 // turn arround X axis; 0<phi<360
552 double phiy = 90. + phi + 180.;
553 if(phiy>=360.) phiy -= 360.;
555 AliMatrix(fIdRotm, 90.0, phi, 90.0, phiy, 180.0, 0.0);
556 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
557 AliDebug(3, Form(" %s : %2i fIdRotm %3i phiy %6.1f xpos %7.2f ypos %7.2f zpos %7.2f \n",
558 smName.Data(), nr, fIdRotm, phiy, xpos, ypos, -zpos));
561 AliDebug(2,Form(" Number of Super Modules %i \n", nr+nrsmod));
564 //______________________________________________________________________
565 void AliEMCALv0::CreateEmod(const char* mother, const char* child)
567 // 17-may-05; mother="SMOD"; child="EMOD"
568 AliEMCALGeometry * g = GetGeometry();
569 TString gn(g->GetName()); gn.ToUpper();
571 Double_t xpos=0., ypos=0., zpos=0.;
572 Double_t parSCPA[5], zposSCPA=0.; // passive SC - 13-MAY-05, TRD1 case
573 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
576 if(strcmp(mother,"SMOD")==0) {
577 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
578 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
579 fParEMOD[2] = g->GetPhiModuleSize()/2.;; // dy
580 fParEMOD[3] = g->GetLongModuleSize()/2.; // dz
581 gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4);
582 // if(gn.Contains("WSUC") || gn.Contains("MAY05")){
583 if(0){ // Jul 12 - should be checked
584 parSCPA[0] = g->GetEtaModuleSize()/2. + tanTrd1*g->GetFrontSteelStrip(); // dx1
585 parSCPA[1] = parSCPA[0] + tanTrd1*g->GetPassiveScintThick(); // dx2
586 parSCPA[2] = g->GetPhiModuleSize()/2.; // dy
587 parSCPA[3] = g->GetPassiveScintThick()/2.; // dz
588 gMC->Gsvolu("SCPA", "TRD1", fIdTmedArr[kIdSC], parSCPA, 4);
589 zposSCPA = -fParEMOD[3] + g->GetFrontSteelStrip() + g->GetPassiveScintThick()/2.;
590 gMC->Gspos ("SCPA", ++nr, child, 0.0, 0.0, zposSCPA, 0, "ONLY");
595 // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0)
596 AliEMCALShishKebabTrd1Module *mod=0; // current module
598 for(int iz=0; iz<g->GetNZ(); iz++) {
599 Double_t angle=90., phiOK=0;
600 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
601 angle = mod->GetThetaInDegree();
602 if(!gn.Contains("WSUC")) { // ALICE
603 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,90., 90.,0.); // z'(x); y'(y); x'(z)
604 else AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.);
605 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
606 // printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
607 //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
608 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
609 zpos = mod->GetPosZ() - fSmodPar2;
611 int iyMax = g->GetNPhi();
612 if(strcmp(mother,"SMOD") && g->GetKey110DEG()) {
615 for(int iy=0; iy<iyMax; iy++) { // flat in phi
616 ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
617 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
618 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm);
619 AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
623 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y)
624 else AliMatrix(fIdRotm, 90-angle,270., 90.0,0.0, angle,90.);
625 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
626 printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
627 iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
628 zpos = mod->GetPosZ() - fSmodPar2;
629 ypos = mod->GetPosXfromR() - fSmodPar1;
630 printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm);
631 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
632 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
633 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
634 printf(" %7.2f ", xpos);
639 AliDebug(2,Form(" Number of modules in Super Module(%s) %i \n", mother, nr));
642 //______________________________________________________________________
643 void AliEMCALv0::Trd1Tower3X3(const double *parSCM0)
645 // Started Dec 8,2004 by PAI
647 printf(" AliEMCALv0::Trd1Tower3X3() : parSCM0");
648 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
650 // Nov 10, 2006 - different name of SCMX
651 double parTRAP[11], *dummy=0;
652 AliEMCALGeometry * g = GetGeometry();
653 TString gn(g->GetName()), scmx;
655 // Division to tile size
656 AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv()));
657 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
658 double dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3];
659 double ndiv=3., xpos=0.0;
660 // should be defined once
661 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
662 for(int ix=1; ix<=3; ix++) { // 3X3
663 scmx = "SCX"; // Nov 10,2006
666 double xCentBot = 2.*dx1/3.;
667 double xCentTop = 2.*(dx2/4. + dx1/12.);
668 parTRAP[1] = TMath::ATan2((xCentTop-xCentBot),2.*dz)*TMath::RadToDeg(); // theta
669 parTRAP[2] = 0.; // phi
671 parTRAP[3] = dy/ndiv; // H1
672 parTRAP[4] = dx1/ndiv; // BL1
673 parTRAP[5] = parTRAP[4]; // TL1
674 parTRAP[6] = 0.0; // ALP1
676 parTRAP[7] = dy/ndiv; // H2
677 parTRAP[8] = dx2/2 - dx1/6.;// BL2
678 parTRAP[9] = parTRAP[8]; // TL2
679 parTRAP[10]= 0.0; // ALP2
680 xpos = (xCentBot+xCentTop)/2.;
683 parTRAP[1] = -parTRAP[1];
685 } else if(ix==2) { // central part is box but we treat as trapesoid due to numbering
687 parTRAP[8] = dx1/ndiv; // BL2
688 parTRAP[9] = parTRAP[8]; // TL2
691 AliDebug(2,Form(" ** TRAP ** xpos %9.3f\n", xpos));
692 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
695 gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
696 gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
698 PbInTrap(parTRAP, scmx);
700 AliDebug(2,Form("Trd1Tower3X3()", "Ver. 1.0 : was tested."));
704 //______________________________________________________________________
705 void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
707 // see for example CreateShishKebabGeometry(); just for case TRD1
709 AliDebug(2,Form(" Pb tiles : nrstart %i\n", nr));
710 AliEMCALGeometry * g = GetGeometry();
713 // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
714 double xpos = 0.0, ypos = 0.0;
715 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
717 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
718 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // ??
719 // double tan = TMath::Tan(parTRAP[1]*TMath::DegToRad());
721 par[1] = parTRAP[3]; // y
722 par[2] = g->GetECPbRadThick()/2.; // z
723 for(int iz=0; iz<g->GetNECLayers(); iz++){
724 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
725 xpos = par[0] - xCenterSCMX;
726 if(parTRAP[1] < 0.) xpos = -xpos;
727 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
728 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
729 zpos += fSampleWidth;
730 if(iz%2>0) printf("\n");
732 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
733 AliDebug(2,Form(" par[1] %9.3f par[2] %9.3f ypos %9.3f \n", par[1], par[2], ypos));
734 AliDebug(2,Form(" PbInTrap Ver. 1.0 : was tested."));
738 //______________________________________________________________________
739 void AliEMCALv0::Trd1Tower4X4()
744 //______________________________________________________________________
745 void AliEMCALv0::Trd1Tower1X1(double *parSCM0)
747 // Started Nov 22,2006 by PAI
748 AliDebug(1," AliEMCALv0::Trd1Tower1X1() : parSCM0");
749 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
752 // No division - keeping the same volume logic
753 // and as consequence the same abs is scheme
754 AliDebug(2,"Trd1Tower1X1() : Create SCMX(SCMY) as SCM0");
756 gMC->Gsvolu("SCMY", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
757 gMC->Gspos("SCMY", 1, "SCM0", 0.0, 0.0, 0.0, 0, "ONLY");
758 gMC->Gsvolu("SCMX", "TRD1", fIdTmedArr[kIdSC], parSCM0, 4);
759 gMC->Gspos("SCMX", 1, "SCMY", 0.0, 0.0, 0.0, 0, "ONLY");
761 // should be defined once
763 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
765 PbInTrd1(parSCM0, "SCMX");
767 AliDebug(1,"Trd1Tower1X1() : Ver. 0.1 : was tested.");
770 //______________________________________________________________________
771 void AliEMCALv0::PbInTrd1(double *parTrd1, TString n)
773 // see PbInTrap(const double parTrd1[11], TString n)
774 static int nr=0, ndeb=2;
775 AliDebug(ndeb,Form(" Pb tiles : nrstart %i\n", nr));
776 AliEMCALGeometry * g = GetGeometry();
779 // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
780 double xpos = 0.0, ypos = 0.0;
781 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
782 double coef = (parTrd1[1] - parTrd1[0]) / (2.*parTrd1[3]);
784 par[1] = parTrd1[2]; // y
785 par[2] = g->GetECPbRadThick()/2.; // z
787 for(int iz=0; iz<g->GetNECLayers(); iz++){
788 par[0] = parTrd1[0] + coef*fSampleWidth*iz;
789 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
790 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
791 zpos += fSampleWidth;
792 if(iz%2>0) printf("\n");
794 AliDebug(ndeb,Form(" Number of Pb tiles in SCMX %i coef %9.7f ", nr, coef));
795 AliDebug(ndeb,Form(" PbInTrd1 Ver. 0.1 : was tested."));
799 //______________________________________________________________________
800 void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parSCM0[5])
802 // Passive material inside the detector
803 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); //Need check
804 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
805 for(int i=0; i<4; i++) { // on pictures sometimes I can not see 0 -> be carefull!!
806 parSCM0[i] = emodPar[i] - wallThickness;
807 AliDebug(2,Form(" %i parSCMO %7.3f emodPar %7.3f : dif %7.3f \n",
808 i, parSCM0[i],emodPar[i], parSCM0[i]-emodPar[i]));
810 parSCM0[4] = emodPar[4];
811 gMC->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC
812 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
814 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
815 Division2X2InScm0(g, parSCM0);
817 Info("Scm0InTrd2"," no division SCM0 in this geometry |%s|\n", g->GetName());
822 //______________________________________________________________________
823 void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t parSCM0[5])
826 Double_t parTRAP[11], xpos=0.,ypos=0., dx1=0.0,dx2=0.,dy1=0.0,dy2=0.,dz=0.
830 Info("Division2X2InScm0","Divide SCM0 on y-axis %i\n", g->GetNETAdiv());
831 TString n("SCMX"), overLapFlagSCMY("ONLY"), overLapFlagSCMX("ONLY");
832 n = "SCM0"; // for testing - 14-mar-05
834 PbInTrapForTrd2(parSCM0, n);
835 // overLapFlagSCMY=overLapFlagSCMX="MANY"; // do not work
839 dy1 = parSCM0[2] , dy2 = parSCM0[3], dz = parSCM0[4];
841 parTRAP[0] = parSCM0[4]; // dz
842 parTRAP[1] = TMath::ATan2((dy2-dy1)/2.,2.*dz)*TMath::RadToDeg();
843 parTRAP[2] = 90.; // phi
845 parTRAP[3] = parSCM0[2]/2.; // H1
846 parTRAP[4] = parSCM0[0]; // BL1
847 parTRAP[5] = parTRAP[4]; // TL1
848 parTRAP[6] = 0.0; // ALP1
850 parTRAP[7] = parSCM0[3]/2.; // H2
851 parTRAP[8] = parSCM0[1]; // BL2
852 parTRAP[9] = parTRAP[8]; // TL2
853 parTRAP[10]= 0.0; // ALP2
854 AliDebug(2,Form(" ** SCMY ** \n"));
855 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
858 gMC->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC
859 ypos = +(parTRAP[3]+parTRAP[7])/2.; //
860 AliDebug(2,Form(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data()));
861 gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm, overLapFlagSCMY.Data()) ;
862 // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z
863 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
864 // We may have problem with numeration due to rotation - 4-feb-05
865 gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm, overLapFlagSCMY.Data());
867 Info("Division2X2InScm0","Divide SCMY on x-axis %i\n", g->GetNPHIdiv());
870 dr1=TMath::Sqrt(dx1*dx1+dy1*dy1);
871 dr2=TMath::Sqrt(dx2*dx2+dy2*dy2);
873 parTRAP[0] = parSCM0[4]; // dz
874 parTRAP[1] = TMath::ATan2((dr2-dr1)/2.,2.*dz)*TMath::RadToDeg(); //
875 parTRAP[2] = 45.; // phi
877 parTRAP[3] = parSCM0[2]/2.; // H1
878 parTRAP[4] = parSCM0[0]/2.; // BL1
879 parTRAP[5] = parTRAP[4]; // TL1
880 parTRAP[6] = 0.0; // ALP1
882 parTRAP[7] = parSCM0[3]/2.; // H2
883 parTRAP[8] = parSCM0[1]/2; // BL2
884 parTRAP[9] = parTRAP[8]; // TL2
885 parTRAP[10]= 0.0; // ALP2
886 AliDebug(2,Form(" ** SCMX ** \n"));
887 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
890 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
891 xpos = (parTRAP[4]+parTRAP[8])/2.;
892 AliDebug(2,Form(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data()));
893 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
894 // AliMatrix(fIdRotm, 90.0,270., 90.0, 0.0, 0.0,0.0); // x'=-y; y'=x; z'=z
895 AliMatrix(fIdRotm, 90.0,90., 90.0, -180.0, 0.0,0.0); // x'=y; y'=-x; z'=z
896 gMC->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
898 if(n=="SCMX" && overLapFlagSCMY == "ONLY") {
899 PbInTrapForTrd2(parTRAP, n);
904 //______________________________________________________________________
905 void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
909 TString pbShape("BOX"), pbtiChonly("ONLY");
912 // pbtiChonly = "MANY";
914 gMC->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0);
917 Info("PbInTrapForTrd2"," Pb tiles inside %s: shape %s :pbtiChonly %s\n nrstart %i\n",
918 name.Data(), pbShape.Data(), pbtiChonly.Data(), nr);
919 AliEMCALGeometry * g = GetGeometry();
921 double par[5], parPB[5], parSC[5];
922 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
923 double xpos = 0.0, ypos = 0.0;
924 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
925 if(name == "SCMX") { // common trapezoid - 11 parameters
926 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
927 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // the same for y
928 AliDebug(2,Form(" xCenterSCMX %8.5f : coef %8.7f \n", xCenterSCMX, coef));
930 par[2] = g->GetECPbRadThick()/2.; // z
931 for(int iz=0; iz<g->GetNECLayers(); iz++){
932 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
934 xpos = ypos = par[0] - xCenterSCMX;
935 //if(parTRAP[1] < 0.) xpos = -xpos;
936 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
937 AliDebug(2,Form(" %2.2i xpos %8.5f zpos %6.3f par[0,1] %6.3f |", iz+1, xpos, zpos, par[0]));
938 if(iz%2>0) AliDebug(2,Form("\n"));
939 zpos += fSampleWidth;
941 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
942 AliDebug(2,Form(" par[1] %9.5f par[2] %9.5f ypos %9.5f \n", par[1], par[2], ypos));
943 } else if(name == "SCM0") { // 1-mar-05 ; TRD2 - 5 parameters
944 AliDebug(2,Form(" SCM0 par = "));
945 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parTRAP[i]));
946 AliDebug(2,Form("\n zpos %f \n",zpos));
948 double tanx = (parTRAP[1] - parTRAP[0]) / (2.*parTRAP[4]); // tanx = tany now
949 double tany = (parTRAP[3] - parTRAP[2]) / (2.*parTRAP[4]), ztmp=0.;
950 parPB[4] = g->GetECPbRadThick()/2.;
951 parSC[2] = g->GetECScintThick()/2.;
952 for(int iz=0; iz<g->GetNECLayers(); iz++){
953 ztmp = fSampleWidth*double(iz);
954 parPB[0] = parTRAP[0] + tanx*ztmp;
955 parPB[1] = parPB[0] + tanx*g->GetECPbRadThick();
956 parPB[2] = parTRAP[2] + tany*ztmp;
957 parPB[3] = parPB[2] + tany*g->GetECPbRadThick();
958 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ;
959 AliDebug(2,Form("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos));
961 for(int i=0; i<5; i++) printf(" %9.5f ", parPB[i]);
962 // individual SC tile
965 gMC->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(),
966 0, pbtiChonly.Data(), parSC, 3) ;
967 printf("\n SCTI zpos %6.3f | par = ", zpos+g->GetECScintThick());
968 for(int i=0; i<3; i++) printf(" %9.5f ", parPB[i]);
970 zpos += fSampleWidth;
972 AliDebug(2,Form("\n"));
974 Info("PbInTrapForTrd2", "Ver. 0.03 : was tested.");
978 //______________________________________________________________________
979 void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parPBMO[5])
982 Info("PbmoInTrd2"," started : geometry %s ", g->GetName());
983 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize();
984 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
985 for(int i=0; i<4; i++) {
986 parPBMO[i] = emodPar[i] - wallThickness;
987 AliDebug(2,Form(" %i parPBMO %7.3f emodPar %7.3f : dif %7.3f \n",
988 i, parPBMO[i],emodPar[i], parPBMO[i]-emodPar[i]));
990 parPBMO[4] = emodPar[4];
991 gMC->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5);
992 gMC->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
994 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
995 Division2X2InPbmo(g, parPBMO);
996 AliDebug(2,Form(" PBMO, division 2X2 | geometry |%s|\n", g->GetName()));
998 AliDebug(2,Form(" no division PBMO in this geometry |%s|\n", g->GetName()));
1003 //______________________________________________________________________
1004 void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t parPBMO[5])
1007 Info("Division2X2InPbmo"," started : geometry %s ", g->GetName());
1008 //Double_t *dummy=0;
1009 // gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0);
1012 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1013 double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;;
1014 double tanx = (parPBMO[1] - parPBMO[0]) / (2.*parPBMO[4]); // tanx = tany now
1015 double tany = (parPBMO[3] - parPBMO[2]) / (2.*parPBMO[4]);
1016 char name[10], named[10], named2[10];
1018 AliDebug(2,Form(" PBMO par = "));
1019 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parPBMO[i]));
1020 AliDebug(2,Form("\n"));
1022 parSC[2] = g->GetECScintThick()/2.;
1023 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick() + g->GetECScintThick()/2.;
1024 AliDebug(2,Form(" parSC[2] %9.5f \n", parSC[2]));
1025 for(int iz=0; iz<g->GetNECLayers(); iz++){
1026 ztmp = g->GetECPbRadThick() + fSampleWidth*double(iz); // Z for previous PB
1027 parSC[0] = parPBMO[0] + tanx*ztmp;
1028 parSC[1] = parPBMO[2] + tany*ztmp;
1030 sprintf(name,"SC%2.2i", iz+1);
1031 gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3);
1032 gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
1033 AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ",
1034 name, zpos, parSC[0], parSC[1]));
1036 sprintf(named,"SY%2.2i", iz+1);
1037 printf(" %s -> ", named);
1038 gMC->Gsdvn(named,name, 2, 2);
1040 sprintf(named2,"SX%2.2i", iz+1);
1041 printf(" %s \n", named2);
1042 gMC->Gsdvn(named2,named, 2, 1);
1044 zpos += fSampleWidth;
1048 //______________________________________________________________________
1049 AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta)
1052 AliEMCALShishKebabTrd1Module* trd1=0;
1053 if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) {
1054 trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta);
1059 //_____________________________________________________________________________
1060 void AliEMCALv0::AddAlignableVolumes() const
1062 TString ntmp(GetTitle()); // name of EMCAL geometry
1064 if(ntmp.Contains("WSUC")) {
1065 AddAlignableVolumesInWSUC(); // WSUC case
1067 AddAlignableVolumesInALICE(); // ALICE case
1071 //______________________________________________________________________
1072 void AliEMCALv0::AddAlignableVolumesInALICE() const
1075 // Create entries for alignable volumes associating the symbolic volume
1076 // name with the corresponding volume path. Needs to be synchronized with
1077 // eventual changes in the geometry.
1080 Float_t * pars = GetGeometry()->GetSuperModulesPars();
1081 double rpos = (GetGeometry()->GetEnvelop(0) + GetGeometry()->GetEnvelop(1))/2.;
1082 double phi, phiRad, xpos, ypos, zpos;
1084 AliGeomManager::ELayerID idEMCAL = AliGeomManager::kEMCAL;
1085 Int_t modUID, modnum = 0;
1086 TString volpath, symname;
1088 Int_t nSMod = GetGeometry()->GetNumberOfSuperModules();
1089 for (Int_t smodnum=0; smodnum < nSMod; smodnum++) {
1090 modUID = AliGeomManager::LayerToVolUID(idEMCAL,modnum++);
1091 volpath = "ALIC_1/XEN1_1/SMOD_";
1092 volpath += (smodnum+1);
1093 symname = "EMCAL/FullSupermodule";
1094 symname += (smodnum+1);
1096 if(GetGeometry()->GetKey110DEG() && smodnum>=10) {
1097 volpath = "ALIC_1/XEN1_1/SM10_";
1098 volpath += (smodnum-10+1);
1099 symname = "EMCAL/HalfSupermodule";
1100 symname += (smodnum-10+1);
1103 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
1104 AliFatal("AliEMCALv0::Unable to set alignable entry!!");
1106 // Creates the Tracking to Local transformation matrix for EMCAL
1108 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID) ;
1110 phiRad = GetGeometry()->GetPhiCenterOfSM(smodnum); //comes in radians, not degrees
1111 phi = phiRad*180./TMath::Pi(); //need degrees for rot. matrix
1112 xpos = rpos * TMath::Cos(phiRad);
1113 ypos = rpos * TMath::Sin(phiRad);
1115 if(GetGeometry()->GetKey110DEG() && smodnum >= 10) {
1116 xpos += (pars[1]/2. * TMath::Sin(phiRad));
1117 ypos -= (pars[1]/2. * TMath::Cos(phiRad));
1120 TGeoHMatrix *matTtoL;
1121 TGeoHMatrix *globMatrix = alignableEntry->GetGlobalOrig();
1123 if(smodnum%2 == 0) {
1125 TGeoTranslation geoTran0(xpos,ypos, zpos);
1126 TGeoRotation geoRot0("geoRot0", 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
1127 TGeoCombiTrans mat0(geoTran0, geoRot0);
1128 matTtoL = new TGeoHMatrix(mat0);
1130 matTtoL->MultiplyLeft(&(globMatrix->Inverse()));
1131 alignableEntry->SetMatrix(matTtoL);
1135 double phiy = 90. + phi + 180.;
1136 if(phiy>=360.) phiy -= 360.;
1137 TGeoTranslation geoTran1(xpos,ypos,-zpos);
1138 TGeoRotation geoRot1("geoRot1", 90.0, phi, 90.0, phiy, 180.0, 0.0);
1139 TGeoCombiTrans mat1(geoTran1, geoRot1);
1140 matTtoL = new TGeoHMatrix(mat1);
1142 matTtoL->MultiplyLeft(&(globMatrix->Inverse()));
1143 alignableEntry->SetMatrix(matTtoL);
1151 //______________________________________________________________________
1152 void AliEMCALv0::AddAlignableVolumesInWSUC() const
1155 // Create entries for alignable volumes associating the symbolic volume
1156 // name with the corresponding volume path. Needs to be synchronized with
1157 // eventual changes in the geometry.
1160 TString vpstr1 = "WSUC_1/XEN1_1/SMOD_";
1161 TString snstr1 = "EMCAL/CosmicTestSupermodule";
1162 TString volpath, symname;
1165 for (Int_t smodnum=0; smodnum < 1; smodnum++) {
1167 symname += (smodnum+1);
1169 volpath += (smodnum+1);
1170 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1171 AliFatal("Unable to set alignable entry!!");