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 // : Alexei Pavlinov (WSU) SHASHLYK
26 // --- ROOT system ---
29 #include <TGeometry.h>
30 #include <TGeoPhysicalNode.h>
31 #include <TGeoManager.h>
32 #include <TGeoMatrix.h>
33 #include <TVirtualMC.h>
40 // --- Standard library ---
44 // --- AliRoot header files ---
47 #include "AliGeomManager.h"
50 #include "AliEMCALShishKebabTrd1Module.h"
51 #include "AliEMCALv0.h"
52 #include "AliEMCALGeometry.h"
53 #include "AliEMCALSpaceFrame.h"
59 // EMCAL material: look to the AliEMCAL.cxx
71 //______________________________________________________________________
72 AliEMCALv0::AliEMCALv0()
74 fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
75 fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0),fCalFrame(0)
78 for(Int_t i = 0; i < 5 ; i++) fParEMOD[i]=0.0;
81 //______________________________________________________________________
82 AliEMCALv0::AliEMCALv0(const char *name, const char *title,
83 const Bool_t checkGeoAndRun)
84 : AliEMCAL(name,title,checkGeoAndRun),
85 fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
86 fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0),fCalFrame(0)
88 // ctor : title is used to identify the layout
90 // Nov 22, 2006 - case of 1X1
92 for(Int_t i = 0; i < 5 ; i++) fParEMOD[i]=0.0;
93 TString ntmp(GetTitle());
96 AliEMCALGeometry *g = GetGeometry() ;
97 TString gn(g->GetName()); gn.ToUpper();
98 fShishKebabModules = g->GetShishKebabTrd1Modules();
100 fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
101 if(gn.Contains("V1")) fSampleWidth += 2.*g->GetTrd1BondPaperThick();
102 AliDebug(2,Form("fGeometry %p : gMC %p : fSampleWidth %5.4f\n",
103 fGeometry, gMC, fSampleWidth));
104 //Set geometry name again, in case it was changed during the initialization of the geometry.
105 SetTitle(fGeometry->GetEMCGeometry()->GetName());
109 //______________________________________________________________________
110 void AliEMCALv0::CreateGeometry()
112 // Create the EMCAL geometry for Geant
113 // Geometry of a tower
115 AliEMCALGeometry * geom = GetGeometry() ;
116 TString gn(geom->GetName());
119 if(!(geom->IsInitialized())){
120 Error("CreateGeometry","EMCAL Geometry class has not been set up.");
123 // Get pointer to the array containing media indices
124 fIdTmedArr = fIdtmed->GetArray() - 1599 ;
127 // gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule
128 AliMatrix(fIdRotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
130 // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1
132 Float_t envelopA[10];
133 if(gn.Contains("WSUC") ) { // TRD1 for WSUC facility
138 gMC->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ;
140 for(int i=0; i<3; i++) fEnvelop1[i] = envelopA[i]; // 23-may-05
141 // Position the EMCAL Mother Volume (XEN1) in WSUC.
142 // Look to AliEMCALWsuCosmicRaySetUp.
143 gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, + 265., fIdRotm, "ONLY") ;
145 envelopA[0] = geom->GetArm1PhiMin(); // minimum phi angle
146 envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
147 envelopA[2] = geom->GetNPhiSuperModule(); // number of sections in phi
148 envelopA[3] = 2; // 2 z coordinates
149 envelopA[4] = -geom->GetEnvelop(2)/2.; // zmin - includes padding
150 envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1 - includes padding
151 envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1 - includes padding
152 envelopA[7] = geom->GetEnvelop(2)/2.; // zmax includes padding
154 envelopA[8] = envelopA[5] ; // radii are the same.
155 envelopA[9] = envelopA[6] ; // radii are the same.
157 gMC->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ; // Polygone filled with air
158 fEnvelop1.Set(10, envelopA);
160 printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]);
161 printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]);
163 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
164 gMC->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
168 AliDebug(2,Form("Shish-Kebab geometry : %s", GetTitle()));
169 CreateShishKebabGeometry();
171 if(gn.Contains("WSUC")==0) { // Nov 24,2010 for TB
173 AliDebug(2,"Creating EMCAL Space Frame");
174 fCalFrame = new AliEMCALSpaceFrame();
175 fCalFrame->CreateGeometry();
179 //______________________________________________________________________
180 void AliEMCALv0::Init(void)
182 // Just prints an information message
184 if(AliLog::GetGlobalDebugLevel()>0) {
185 TString message("\n") ;
186 message += "*****************************************\n" ;
188 // Here the EMCAL initialisation code (if any!)
190 AliEMCALGeometry * geom = GetGeometry() ;
193 message += "AliEMCAL " ;
194 message += Version() ;
195 message += "EMCAL geometry initialized for " ;
196 message += geom->GetName() ;
199 message += "AliEMCAL " ;
200 message += Version() ;
201 message += "EMCAL geometry initialization failed !" ;
203 message += "\n*****************************************" ;
204 printf("%s",message.Data() ) ;
209 //______________________________________________________________________
210 void AliEMCALv0::CreateShishKebabGeometry()
214 AliEMCALGeometry * g = GetGeometry();
215 TString gn(g->GetName()); gn.ToUpper();
216 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
217 // see AliModule::fFIdTmedArr
218 // fIdTmedArr = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials()
219 // int kIdAIR=1599, kIdPB = 1600, kIdSC = 1601, kIdSTEEL = 1603;
221 Double_t par[10], xpos=0., ypos=0., zpos=0.;
223 CreateSmod(g->GetNameOfEMCALEnvelope());
225 CreateEmod("SMOD","EMOD"); // 18-may-05
227 if(g->GetKey110DEG() && !gn.Contains("12SMV1")) { CreateEmod("SM10","EMOD");} // Nov 1,2006 1/2 SM
228 if(g->GetKey110DEG() && gn.Contains("12SMV1")) { CreateEmod("SM3rd","EMOD"); } // Feb 1,2012 1/3 SM
230 // Sensitive SC (2x2 tiles)
231 double parSCM0[5]={0,0,0,0}, *dummy = 0, parTRAP[11];
233 if(!gn.Contains("V1")) {
234 double wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() - g->GetPhiTileSize();
235 for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
236 parSCM0[3] = fParEMOD[3];
237 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
238 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
240 double wTh = g->GetLateralSteelStrip();
241 parSCM0[0] = fParEMOD[0] - wTh + tanTrd1*g->GetTrd1AlFrontThick();
242 parSCM0[1] = fParEMOD[1] - wTh;
243 parSCM0[2] = fParEMOD[2] - wTh;
244 parSCM0[3] = fParEMOD[3] - g->GetTrd1AlFrontThick()/2.;
245 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
246 double zshift = g->GetTrd1AlFrontThick()/2.;
247 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., zshift, 0, "ONLY");
249 CreateAlFrontPlate("EMOD","ALFP");
252 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
253 // Division to tile size - 1-oct-04
254 AliDebug(2,Form(" Divide SCM0 on y-axis %i\n", g->GetNETAdiv()));
255 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
257 parTRAP[0] = parSCM0[3]; // dz
258 parTRAP[1] = TMath::ATan2((parSCM0[1]-parSCM0[0])/2.,2.*parSCM0[3])*180./TMath::Pi(); // theta
259 parTRAP[2] = 0.; // phi
261 parTRAP[3] = parSCM0[2]/2.; // H1
262 parTRAP[4] = parSCM0[0]/2.; // BL1
263 parTRAP[5] = parTRAP[4]; // TL1
264 parTRAP[6] = 0.0; // ALP1
266 parTRAP[7] = parSCM0[2]/2.; // H2
267 parTRAP[8] = parSCM0[1]/2.; // BL2
268 parTRAP[9] = parTRAP[8]; // TL2
269 parTRAP[10]= 0.0; // ALP2
270 AliDebug(2,Form(" ** TRAP ** \n"));
271 for(int i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
273 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
274 xpos = +(parSCM0[1]+parSCM0[0])/4.;
275 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
277 // Using rotation because SCMX should be the same due to Pb tiles
279 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
280 gMC->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, fIdRotm, "ONLY");
281 // put LED to the SCM0
282 AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0);
283 Double_t tanBetta = mod->GetTanBetta();
287 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.;
288 if(!gn.Contains("V1")) {
289 par[1] = parSCM0[2]/2; // y
290 par[2] = g->GetECPbRadThick()/2.; // z
291 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
292 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
293 AliDebug(2,Form(" Pb tiles \n"));
294 for(int iz=0; iz<g->GetNECLayers(); iz++){
295 par[0] = (parSCM0[0] + tanBetta*fSampleWidth*iz)/2.;
296 xpos = par[0] - xCenterSCMX;
297 gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
298 AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]));
299 zpos += fSampleWidth;
301 AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr));
304 // First sheet of paper
305 par[1] = parSCM0[2]/2.; // y
306 par[2] = g->GetTrd1BondPaperThick()/2.; // z
307 par[0] = parSCM0[0]/2.; // x
308 gMC->Gsvolu("PAP1", "BOX", fIdTmedArr[kIdPAPER], par, 3);
309 xpos = par[0] - xCenterSCMX;
310 zpos = -parSCM0[3] + g->GetTrd1BondPaperThick()/2.;
311 gMC->Gspos("PAP1", 1, "SCMX", xpos, ypos, zpos, 0, "ONLY");
312 for(int iz=0; iz<g->GetNECLayers()-1; iz++){
314 Double_t dz = g->GetECScintThick() + g->GetTrd1BondPaperThick() + fSampleWidth*iz;
315 // PB + 2 paper sheets
316 par[2] = g->GetECPbRadThick()/2. + g->GetTrd1BondPaperThick(); // z
317 par[0] = (parSCM0[0] + tanBetta*dz)/2.;
318 TString pa(Form("PA%2.2i",nr));
319 gMC->Gsvolu(pa.Data(), "BOX", fIdTmedArr[kIdPAPER], par, 3);
320 xpos = par[0] - xCenterSCMX;
321 zpos = -parSCM0[3] + dz + par[2];
322 gMC->Gspos(pa.Data(), 1, "SCMX", xpos, ypos, zpos, 0, "ONLY") ;
324 TString pb(Form("PB%2.2i",nr));
325 par[2] = g->GetECPbRadThick()/2.; // z
326 gMC->Gsvolu(pb.Data(), "BOX", fIdTmedArr[kIdPB], par, 3);
327 gMC->Gspos(pb.Data(), 1, pa.Data(), 0.0, 0.0, 0.0, 0, "ONLY") ;
331 } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) {
332 printf(" before AliEMCALv0::Trd1Tower3X3() : parSCM0");
333 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
335 Trd1Tower3X3(parSCM0);
336 } else if(g->GetNPHIdiv()==1 && g->GetNETAdiv()==1) {
337 // no division in SCM0
338 Trd1Tower1X1(parSCM0);
339 } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) {
345 //______________________________________________________________________
346 void AliEMCALv0::CreateSmod(const char* mother)
348 // 18-may-05; mother="XEN1";
349 // child="SMOD" from first to 10th, "SM10" (11th and 12th) (TRD1 case)
350 AliEMCALGeometry * g = GetGeometry();
351 TString gn(g->GetName()); gn.ToUpper();
353 Double_t par[3], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.;
355 // ===== define Super Module from air - 14x30 module ==== ;
356 AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data()));
357 par[0] = g->GetShellThickness()/2.;
358 par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
359 par[2] = g->GetEtaModuleSize()*15.;
361 int nphism = g->GetNumberOfSuperModules()/2; // 20-may-05
363 dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/nphism;
364 // if(g->GetKey110DEG()) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1);
365 rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.;
366 AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi));
369 if(gn.Contains("WSUC")) {
370 par[0] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
371 par[1] = g->GetShellThickness()/2.;
372 par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5;
374 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
376 AliDebug(2,Form("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
377 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
381 nphism = g->GetNumberOfSuperModules();
383 par[2] = 350./2.; // 11-oct-04 - for 26 division
384 AliDebug(2,Form(" par[0] %7.2f (old) \n", par[0]));
385 Float_t parSM[] = {g->GetSuperModulesPar(0),g->GetSuperModulesPar(1),g->GetSuperModulesPar(2)};
386 for(int i=0; i<3; i++) par[i] = parSM[i];
388 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
389 AliDebug(2,Form("tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
390 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
393 if(g->GetKey110DEG() && !gn.Contains("12SMV1") ) { // 12-oct-05
396 gMC->Gsvolu("SM10", "BOX", fIdTmedArr[kIdAIR], par, 3);
397 AliDebug(2,Form(" Super module with name \"SM10\" was created too par[1] = %f\n", par[1]));
400 if(g->GetKey110DEG() && gn.Contains("12SMV1")) { // 1-feb-12, one third (installed in 2012) case
403 gMC->Gsvolu("SM3rd", "BOX", fIdTmedArr[kIdAIR], par, 3);
404 AliDebug(2,Form(" Super module with name \"SM3rd\" was created too par[1] = %f\n", par[1]));
409 if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
410 par[0] = g->GetSteelFrontThickness()/2.;
411 gMC->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3);
412 printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", fIdTmedArr[kIdSTEEL], par[0],par[1],par[2]);
413 xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.;
414 gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
417 int nr=0, nrsmod=0, i0=0;
419 // Turn whole super module
420 for(int i=i0; i<nphism; i++) {
421 if(gn.Contains("WSUC")) {
422 xpos = ypos = zpos = 0.0;
424 gMC->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
425 printf(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
426 fIdRotm, phi, phiRad, xpos, ypos, zpos);
429 TString smName("SMOD"); // 12-oct-05
430 if(i==5 && g->GetKey110DEG() && !gn.Contains("12SMV1")) {
435 if(i==5 && g->GetKey110DEG() && gn.Contains("12SMV1")) {
440 phi = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170
441 phiRad = phi*TMath::Pi()/180.;
443 AliMatrix(fIdRotm, 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
445 xpos = rpos * TMath::Cos(phiRad);
446 ypos = rpos * TMath::Sin(phiRad);
447 zpos = fSmodPar2; // 21-sep-04
448 if(i==5 && g->GetKey110DEG() && !gn.Contains("12SMV1") ) {
449 xpos += (par1C/2. * TMath::Sin(phiRad));
450 ypos -= (par1C/2. * TMath::Cos(phiRad));
452 if(i==5 && g->GetKey110DEG() && gn.Contains("12SMV1") ) {
453 xpos += (2.*par1C/3. * TMath::Sin(phiRad));
454 ypos -= (2.*par1C/3. * TMath::Cos(phiRad));
457 // 1th module in z-direction;
458 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
459 AliDebug(3, Form(" %s : %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n",
460 smName.Data(), nr, fIdRotm, phi, phiRad, xpos, ypos, zpos, i));
461 // 2th module in z-direction;
462 // turn arround X axis; 0<phi<360
463 double phiy = 90. + phi + 180.;
464 if(phiy>=360.) phiy -= 360.;
466 AliMatrix(fIdRotm, 90.0, phi, 90.0, phiy, 180.0, 0.0);
467 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
468 AliDebug(3, Form(" %s : %2i fIdRotm %3i phiy %6.1f xpos %7.2f ypos %7.2f zpos %7.2f \n",
469 smName.Data(), nr, fIdRotm, phiy, xpos, ypos, -zpos));
472 AliDebug(2,Form(" Number of Super Modules %i \n", nr+nrsmod));
475 //______________________________________________________________________
476 void AliEMCALv0::CreateEmod(const char* mother, const char* child)
478 // 17-may-05; mother="SMOD"; child="EMOD"
480 AliEMCALGeometry * g = GetGeometry();
481 TString gn(g->GetName()); gn.ToUpper();
483 Double_t xpos=0., ypos=0., zpos=0.;
484 //Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad();tanTrd1 = TMath::Tan(trd1Angle/2.);
486 if(strcmp(mother,"SMOD")==0) {
487 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
488 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
489 fParEMOD[2] = g->GetPhiModuleSize()/2.;; // dy
490 fParEMOD[3] = g->GetLongModuleSize()/2.; // dz
491 gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4);
496 // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0)
497 AliEMCALShishKebabTrd1Module *mod=0; // current module
499 for(int iz=0; iz<g->GetNZ(); iz++) {
500 Double_t angle=90., phiOK=0;
501 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
502 angle = mod->GetThetaInDegree();
503 if(!gn.Contains("WSUC")) { // ALICE
504 AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.);
505 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
506 // printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
507 //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
508 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
509 zpos = mod->GetPosZ() - fSmodPar2;
511 int iyMax = g->GetNPhi();
512 if(strcmp(mother,"SMOD") && g->GetKey110DEG() && !gn.Contains("12SMV1") ) {
515 if(strcmp(mother,"SMOD") && g->GetKey110DEG() && gn.Contains("12SMV1") ) {
518 for(int iy=0; iy<iyMax; iy++) { // flat in phi
519 ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
520 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
522 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm);
523 AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
527 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y)
528 else AliMatrix(fIdRotm, 90-angle,270., 90.0,0.0, angle,90.);
529 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
530 //printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
531 //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
532 zpos = mod->GetPosZ() - fSmodPar2;
533 ypos = mod->GetPosXfromR() - fSmodPar1;
534 //printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm);
535 for(int ix=0; ix<g->GetNPhi(); ix++)
537 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
538 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
539 printf(" %7.2f ", xpos);
544 AliDebug(2,Form(" Number of modules in Super Module(%s) %i \n", mother, nr));
547 void AliEMCALv0::CreateAlFrontPlate(const char* mother, const char* child)
549 // Oct 26,2010 : Al front plate : ALFP
550 AliEMCALGeometry * g = GetGeometry();
551 TString gn(g->GetName()); gn.ToUpper();
552 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
553 Double_t parALFP[5], zposALFP=0.;
555 parALFP[0] = g->GetEtaModuleSize()/2. - g->GetLateralSteelStrip(); // dx1
556 parALFP[1] = parALFP[0] + tanTrd1*g->GetTrd1AlFrontThick(); // dx2
557 parALFP[2] = g->GetPhiModuleSize()/2. - g->GetLateralSteelStrip(); // dy
558 parALFP[3] = g->GetTrd1AlFrontThick()/2.; // dz
559 gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdAL], parALFP, 4);
560 zposALFP = -fParEMOD[3] + g->GetTrd1AlFrontThick()/2.;
561 gMC->Gspos (child, 1, mother, 0.0, 0.0, zposALFP, 0, "ONLY");
564 //______________________________________________________________________
565 void AliEMCALv0::Trd1Tower3X3(const double *parSCM0)
567 // Started Dec 8,2004 by PAI
569 printf(" AliEMCALv0::Trd1Tower3X3() : parSCM0");
570 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
572 // Nov 10, 2006 - different name of SCMX
573 double parTRAP[11], *dummy=0;
574 AliEMCALGeometry * g = GetGeometry();
575 TString gn(g->GetName()), scmx;
577 // Division to tile size
578 AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv()));
579 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
580 double dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3];
581 double ndiv=3., xpos=0.0;
582 // should be defined once
583 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
584 for(int ix=1; ix<=3; ix++) { // 3X3
585 scmx = "SCX"; // Nov 10,2006
588 double xCentBot = 2.*dx1/3.;
589 double xCentTop = 2.*(dx2/4. + dx1/12.);
590 parTRAP[1] = TMath::ATan2((xCentTop-xCentBot),2.*dz)*TMath::RadToDeg(); // theta
591 parTRAP[2] = 0.; // phi
593 parTRAP[3] = dy/ndiv; // H1
594 parTRAP[4] = dx1/ndiv; // BL1
595 parTRAP[5] = parTRAP[4]; // TL1
596 parTRAP[6] = 0.0; // ALP1
598 parTRAP[7] = dy/ndiv; // H2
599 parTRAP[8] = dx2/2 - dx1/6.;// BL2
600 parTRAP[9] = parTRAP[8]; // TL2
601 parTRAP[10]= 0.0; // ALP2
602 xpos = (xCentBot+xCentTop)/2.;
605 parTRAP[1] = -parTRAP[1];
607 } else if(ix==2) { // central part is box but we treat as trapesoid due to numbering
609 parTRAP[8] = dx1/ndiv; // BL2
610 parTRAP[9] = parTRAP[8]; // TL2
613 AliDebug(2,Form(" ** TRAP ** xpos %9.3f\n", xpos));
614 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
617 gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
618 gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
620 PbInTrap(parTRAP, scmx);
622 AliDebug(2,"Trd1Tower3X3 - Ver. 1.0 : was tested.");
626 //______________________________________________________________________
627 void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
629 // see for example CreateShishKebabGeometry(); just for case TRD1
631 AliDebug(2,Form(" Pb tiles : nrstart %i\n", nr));
632 AliEMCALGeometry * g = GetGeometry();
635 double xpos = 0.0, ypos = 0.0;
636 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
638 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
639 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // ??
640 // double tan = TMath::Tan(parTRAP[1]*TMath::DegToRad());
642 par[1] = parTRAP[3]; // y
643 par[2] = g->GetECPbRadThick()/2.; // z
644 for(int iz=0; iz<g->GetNECLayers(); iz++){
645 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
646 xpos = par[0] - xCenterSCMX;
647 if(parTRAP[1] < 0.) xpos = -xpos;
648 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
649 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
650 zpos += fSampleWidth;
651 if(iz%2>0) printf("\n");
653 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
654 AliDebug(2,Form(" par[1] %9.3f par[2] %9.3f ypos %9.3f \n", par[1], par[2], ypos));
655 AliDebug(2,Form(" PbInTrap Ver. 1.0 : was tested."));
659 //______________________________________________________________________
660 void AliEMCALv0::Trd1Tower4X4() const
665 //______________________________________________________________________
666 void AliEMCALv0::Trd1Tower1X1(double *parSCM0)
668 // Started Nov 22,2006 by PAI
669 AliDebug(1," AliEMCALv0::Trd1Tower1X1() : parSCM0");
670 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
673 // No division - keeping the same volume logic
674 // and as consequence the same abs is scheme
675 AliDebug(2,"Trd1Tower1X1() : Create SCMX(SCMY) as SCM0");
677 gMC->Gsvolu("SCMY", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
678 gMC->Gspos("SCMY", 1, "SCM0", 0.0, 0.0, 0.0, 0, "ONLY");
679 gMC->Gsvolu("SCMX", "TRD1", fIdTmedArr[kIdSC], parSCM0, 4);
680 gMC->Gspos("SCMX", 1, "SCMY", 0.0, 0.0, 0.0, 0, "ONLY");
682 // should be defined once
684 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
686 PbInTrd1(parSCM0, "SCMX");
688 AliDebug(1,"Trd1Tower1X1() : Ver. 0.1 : was tested.");
691 //______________________________________________________________________
692 void AliEMCALv0::PbInTrd1(const double *parTrd1, TString n)
694 // see PbInTrap(const double parTrd1[11], TString n)
695 static int nr=0, ndeb=2;
696 AliDebug(ndeb,Form(" Pb tiles : nrstart %i\n", nr));
697 AliEMCALGeometry * g = GetGeometry();
700 double xpos = 0.0, ypos = 0.0;
701 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
702 double coef = (parTrd1[1] - parTrd1[0]) / (2.*parTrd1[3]);
704 par[1] = parTrd1[2]; // y
705 par[2] = g->GetECPbRadThick()/2.; // z
707 for(int iz=0; iz<g->GetNECLayers(); iz++){
708 par[0] = parTrd1[0] + coef*fSampleWidth*iz;
709 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
710 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
711 zpos += fSampleWidth;
712 if(iz%2>0) printf("\n");
714 AliDebug(ndeb,Form(" Number of Pb tiles in SCMX %i coef %9.7f ", nr, coef));
715 AliDebug(ndeb,Form(" PbInTrd1 Ver. 0.1 : was tested."));
719 //______________________________________________________________________
720 void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parSCM0[5])
722 // Passive material inside the detector
723 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); //Need check
724 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
725 for(int i=0; i<4; i++) { // on pictures sometimes I can not see 0 -> be carefull!!
726 parSCM0[i] = emodPar[i] - wallThickness;
727 AliDebug(2,Form(" %i parSCMO %7.3f emodPar %7.3f : dif %7.3f \n",
728 i, parSCM0[i],emodPar[i], parSCM0[i]-emodPar[i]));
730 parSCM0[4] = emodPar[4];
731 gMC->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC
732 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
734 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
735 Division2X2InScm0(g, parSCM0);
737 Info("Scm0InTrd2"," no division SCM0 in this geometry |%s|\n", g->GetName());
742 //______________________________________________________________________
743 void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t parSCM0[5])
746 Double_t parTRAP[11], xpos=0.,ypos=0., dx1=0.0,dx2=0.,dy1=0.0,dy2=0.,dz=0.
750 Info("Division2X2InScm0","Divide SCM0 on y-axis %i\n", g->GetNETAdiv());
751 TString n("SCMX"), overLapFlagSCMY("ONLY"), overLapFlagSCMX("ONLY");
752 n = "SCM0"; // for testing - 14-mar-05
754 PbInTrapForTrd2(parSCM0, n);
755 // overLapFlagSCMY=overLapFlagSCMX="MANY"; // do not work
759 dy1 = parSCM0[2] , dy2 = parSCM0[3], dz = parSCM0[4];
761 parTRAP[0] = parSCM0[4]; // dz
762 parTRAP[1] = TMath::ATan2((dy2-dy1)/2.,2.*dz)*TMath::RadToDeg();
763 parTRAP[2] = 90.; // phi
765 parTRAP[3] = parSCM0[2]/2.; // H1
766 parTRAP[4] = parSCM0[0]; // BL1
767 parTRAP[5] = parTRAP[4]; // TL1
768 parTRAP[6] = 0.0; // ALP1
770 parTRAP[7] = parSCM0[3]/2.; // H2
771 parTRAP[8] = parSCM0[1]; // BL2
772 parTRAP[9] = parTRAP[8]; // TL2
773 parTRAP[10]= 0.0; // ALP2
774 AliDebug(2,Form(" ** SCMY ** \n"));
775 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
778 gMC->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC
779 ypos = +(parTRAP[3]+parTRAP[7])/2.; //
780 AliDebug(2,Form(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data()));
781 gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm, overLapFlagSCMY.Data()) ;
782 // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z
783 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
784 // We may have problem with numeration due to rotation - 4-feb-05
785 gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm, overLapFlagSCMY.Data());
787 Info("Division2X2InScm0","Divide SCMY on x-axis %i\n", g->GetNPHIdiv());
790 dr1=TMath::Sqrt(dx1*dx1+dy1*dy1);
791 dr2=TMath::Sqrt(dx2*dx2+dy2*dy2);
793 parTRAP[0] = parSCM0[4]; // dz
794 parTRAP[1] = TMath::ATan2((dr2-dr1)/2.,2.*dz)*TMath::RadToDeg(); //
795 parTRAP[2] = 45.; // phi
797 parTRAP[3] = parSCM0[2]/2.; // H1
798 parTRAP[4] = parSCM0[0]/2.; // BL1
799 parTRAP[5] = parTRAP[4]; // TL1
800 parTRAP[6] = 0.0; // ALP1
802 parTRAP[7] = parSCM0[3]/2.; // H2
803 parTRAP[8] = parSCM0[1]/2; // BL2
804 parTRAP[9] = parTRAP[8]; // TL2
805 parTRAP[10]= 0.0; // ALP2
806 AliDebug(2,Form(" ** SCMX ** \n"));
807 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
810 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
811 xpos = (parTRAP[4]+parTRAP[8])/2.;
812 AliDebug(2,Form(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data()));
813 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
814 // AliMatrix(fIdRotm, 90.0,270., 90.0, 0.0, 0.0,0.0); // x'=-y; y'=x; z'=z
815 AliMatrix(fIdRotm, 90.0,90., 90.0, -180.0, 0.0,0.0); // x'=y; y'=-x; z'=z
816 gMC->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
818 if(n=="SCMX" && overLapFlagSCMY == "ONLY") {
819 PbInTrapForTrd2(parTRAP, n);
824 //______________________________________________________________________
825 void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
829 TString pbShape("BOX"), pbtiChonly("ONLY");
832 // pbtiChonly = "MANY";
834 gMC->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0);
837 Info("PbInTrapForTrd2"," Pb tiles inside %s: shape %s :pbtiChonly %s\n nrstart %i\n",
838 name.Data(), pbShape.Data(), pbtiChonly.Data(), nr);
839 AliEMCALGeometry * g = GetGeometry();
841 double par[5], parPB[5], parSC[5];
842 double xpos = 0.0, ypos = 0.0;
843 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
844 if(name == "SCMX") { // common trapezoid - 11 parameters
845 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
846 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // the same for y
847 AliDebug(2,Form(" xCenterSCMX %8.5f : coef %8.7f \n", xCenterSCMX, coef));
849 par[2] = g->GetECPbRadThick()/2.; // z
850 for(int iz=0; iz<g->GetNECLayers(); iz++){
851 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
853 xpos = ypos = par[0] - xCenterSCMX;
854 //if(parTRAP[1] < 0.) xpos = -xpos;
855 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
856 AliDebug(2,Form(" %2.2i xpos %8.5f zpos %6.3f par[0,1] %6.3f |", iz+1, xpos, zpos, par[0]));
857 if(iz%2>0) AliDebug(2,Form("\n"));
858 zpos += fSampleWidth;
860 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
861 AliDebug(2,Form(" par[1] %9.5f par[2] %9.5f ypos %9.5f \n", par[1], par[2], ypos));
862 } else if(name == "SCM0") { // 1-mar-05 ; TRD2 - 5 parameters
863 AliDebug(2,Form(" SCM0 par = "));
864 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parTRAP[i]));
865 AliDebug(2,Form("\n zpos %f \n",zpos));
867 double tanx = (parTRAP[1] - parTRAP[0]) / (2.*parTRAP[4]); // tanx = tany now
868 double tany = (parTRAP[3] - parTRAP[2]) / (2.*parTRAP[4]), ztmp=0.;
869 parPB[4] = g->GetECPbRadThick()/2.;
870 parSC[2] = g->GetECScintThick()/2.;
871 for(int iz=0; iz<g->GetNECLayers(); iz++){
872 ztmp = fSampleWidth*double(iz);
873 parPB[0] = parTRAP[0] + tanx*ztmp;
874 parPB[1] = parPB[0] + tanx*g->GetECPbRadThick();
875 parPB[2] = parTRAP[2] + tany*ztmp;
876 parPB[3] = parPB[2] + tany*g->GetECPbRadThick();
877 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ;
878 AliDebug(2,Form("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos));
880 for(int i=0; i<5; i++) printf(" %9.5f ", parPB[i]);
881 // individual SC tile
884 gMC->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(),
885 0, pbtiChonly.Data(), parSC, 3) ;
886 printf("\n SCTI zpos %6.3f | par = ", zpos+g->GetECScintThick());
887 for(int i=0; i<3; i++) printf(" %9.5f ", parPB[i]);
889 zpos += fSampleWidth;
891 AliDebug(2,Form("\n"));
893 Info("PbInTrapForTrd2", "Ver. 0.03 : was tested.");
897 //______________________________________________________________________
898 void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parPBMO[5])
901 Info("PbmoInTrd2"," started : geometry %s ", g->GetName());
902 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize();
903 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
904 for(int i=0; i<4; i++) {
905 parPBMO[i] = emodPar[i] - wallThickness;
906 AliDebug(2,Form(" %i parPBMO %7.3f emodPar %7.3f : dif %7.3f \n",
907 i, parPBMO[i],emodPar[i], parPBMO[i]-emodPar[i]));
909 parPBMO[4] = emodPar[4];
910 gMC->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5);
911 gMC->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
913 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
914 Division2X2InPbmo(g, parPBMO);
915 AliDebug(2,Form(" PBMO, division 2X2 | geometry |%s|\n", g->GetName()));
917 AliDebug(2,Form(" no division PBMO in this geometry |%s|\n", g->GetName()));
922 //______________________________________________________________________
923 void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t parPBMO[5])
926 Info("Division2X2InPbmo"," started : geometry %s ", g->GetName());
928 // gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0);
931 double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;;
932 double tanx = (parPBMO[1] - parPBMO[0]) / (2.*parPBMO[4]); // tanx = tany now
933 double tany = (parPBMO[3] - parPBMO[2]) / (2.*parPBMO[4]);
934 const Int_t buffersize = 10;
935 char name[buffersize], named[buffersize], named2[buffersize];
937 AliDebug(2,Form(" PBMO par = "));
938 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parPBMO[i]));
939 AliDebug(2,Form("\n"));
941 parSC[2] = g->GetECScintThick()/2.;
942 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick() + g->GetECScintThick()/2.;
943 AliDebug(2,Form(" parSC[2] %9.5f \n", parSC[2]));
944 for(int iz=0; iz<g->GetNECLayers(); iz++){
945 ztmp = g->GetECPbRadThick() + fSampleWidth*double(iz); // Z for previous PB
946 parSC[0] = parPBMO[0] + tanx*ztmp;
947 parSC[1] = parPBMO[2] + tany*ztmp;
949 snprintf(name,buffersize,"SC%2.2i", iz+1);
950 gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3);
951 gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
952 AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ",
953 name, zpos, parSC[0], parSC[1]));
955 snprintf(named,buffersize,"SY%2.2i", iz+1);
956 printf(" %s -> ", named);
957 gMC->Gsdvn(named,name, 2, 2);
959 snprintf(named2,buffersize,"SX%2.2i", iz+1);
960 printf(" %s \n", named2);
961 gMC->Gsdvn(named2,named, 2, 1);
963 zpos += fSampleWidth;
967 //______________________________________________________________________
968 AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta)
971 AliEMCALShishKebabTrd1Module* trd1=0;
972 if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) {
973 trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta);
978 //_____________________________________________________________________________
979 void AliEMCALv0::AddAlignableVolumes() const
981 //Add volumes which are alignable (?)
982 TString ntmp(GetTitle()); // name of EMCAL geometry
984 if(ntmp.Contains("WSUC")) {
985 AddAlignableVolumesInWSUC(); // WSUC case
987 AddAlignableVolumesInALICE(); // ALICE case
991 //______________________________________________________________________
992 void AliEMCALv0::AddAlignableVolumesInALICE() const
995 // Create entries for alignable volumes associating the symbolic volume
996 // name with the corresponding volume path. Needs to be synchronized with
997 // eventual changes in the geometry.
1000 Float_t pars[] = {GetGeometry()->GetSuperModulesPar(0),GetGeometry()->GetSuperModulesPar(1),GetGeometry()->GetSuperModulesPar(2)};
1001 double rpos = (GetGeometry()->GetEnvelop(0) + GetGeometry()->GetEnvelop(1))/2.;
1002 double phi, phiRad, xpos, ypos, zpos;
1004 AliGeomManager::ELayerID idEMCAL = AliGeomManager::kEMCAL;
1005 Int_t modUID, modnum = 0;
1006 TString volpath, symname;
1008 Int_t nSMod = GetGeometry()->GetNumberOfSuperModules();
1009 for (Int_t smodnum=0; smodnum < nSMod; smodnum++) {
1010 modUID = AliGeomManager::LayerToVolUID(idEMCAL,modnum++);
1011 volpath = "ALIC_1/XEN1_1/SMOD_";
1012 volpath += (smodnum+1);
1013 symname = "EMCAL/FullSupermodule";
1014 symname += (smodnum+1);
1016 if(GetGeometry()->GetKey110DEG() && smodnum>=10 && !( ( GetGeometry()->GetEMCGeometry()->GetGeoName()).Contains("12SMV1")) )
1018 volpath = "ALIC_1/XEN1_1/SM10_";
1019 volpath += (smodnum-10+1);
1020 symname = "EMCAL/HalfSupermodule";
1021 symname += (smodnum-10+1);
1024 if(GetGeometry()->GetKey110DEG() && smodnum>=10 && ( ( GetGeometry()->GetEMCGeometry()->GetGeoName()).Contains("12SMV1")) )
1026 volpath = "ALIC_1/XEN1_1/SM3rd_";
1027 volpath += (smodnum-10+1);
1028 symname = "EMCAL/OneThrdSupermodule";
1029 symname += (smodnum-10+1);
1032 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
1033 AliFatal("AliEMCALv0::Unable to set alignable entry!!");
1035 // Creates the Tracking to Local transformation matrix for EMCAL
1037 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID) ;
1039 phiRad = GetGeometry()->GetPhiCenterOfSM(smodnum); //comes in radians, not degrees
1040 phi = phiRad*180./TMath::Pi(); //need degrees for rot. matrix
1041 xpos = rpos * TMath::Cos(phiRad);
1042 ypos = rpos * TMath::Sin(phiRad);
1044 if(GetGeometry()->GetKey110DEG() && smodnum >= 10 && !( ( GetGeometry()->GetEMCGeometry()->GetGeoName()).Contains("12SMV1")))
1046 AliDebug(3, Form(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : smodnum %i \n",
1047 fIdRotm, phi, phiRad, xpos, ypos, zpos, smodnum));
1048 xpos += (pars[1]/2. * TMath::Sin(phiRad)); // half SM!
1049 ypos -= (pars[1]/2. * TMath::Cos(phiRad));
1052 if(GetGeometry()->GetKey110DEG() && smodnum >= 10 && ( ( GetGeometry()->GetEMCGeometry()->GetGeoName()).Contains("12SMV1")))
1054 AliDebug(3, Form(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : smodnum %i \n",
1055 fIdRotm, phi, phiRad, xpos, ypos, zpos, smodnum));
1056 xpos += (pars[1]/3. * TMath::Sin(phiRad)); // one_third SM !
1057 ypos -= (pars[1]/3. * TMath::Cos(phiRad));
1060 TGeoHMatrix *matTtoL;
1061 TGeoHMatrix *globMatrix = alignableEntry->GetGlobalOrig();
1063 if(smodnum%2 == 0) {
1065 TGeoTranslation geoTran0(xpos,ypos, zpos);
1066 TGeoRotation geoRot0("geoRot0", 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
1067 TGeoCombiTrans mat0(geoTran0, geoRot0);
1068 matTtoL = new TGeoHMatrix(mat0);
1070 matTtoL->MultiplyLeft(&(globMatrix->Inverse()));
1071 alignableEntry->SetMatrix(matTtoL);
1075 double phiy = 90. + phi + 180.;
1076 if(phiy>=360.) phiy -= 360.;
1077 TGeoTranslation geoTran1(xpos,ypos,-zpos);
1078 TGeoRotation geoRot1("geoRot1", 90.0, phi, 90.0, phiy, 180.0, 0.0);
1079 TGeoCombiTrans mat1(geoTran1, geoRot1);
1080 matTtoL = new TGeoHMatrix(mat1);
1082 matTtoL->MultiplyLeft(&(globMatrix->Inverse()));
1083 alignableEntry->SetMatrix(matTtoL);
1091 //______________________________________________________________________
1092 void AliEMCALv0::AddAlignableVolumesInWSUC() const
1095 // Create entries for alignable volumes associating the symbolic volume
1096 // name with the corresponding volume path. Needs to be synchronized with
1097 // eventual changes in the geometry.
1100 TString vpstr1 = "WSUC_1/XEN1_1/SMOD_";
1101 TString snstr1 = "EMCAL/CosmicTestSupermodule";
1102 TString volpath, symname;
1105 for (Int_t smodnum=0; smodnum < 1; smodnum++) {
1107 symname += (smodnum+1);
1109 volpath += (smodnum+1);
1110 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1111 AliFatal("Unable to set alignable entry!!");