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
25 // : Adapted for DCAL by M.L. Wang CCNU & Subatech Oct-19-2012
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),
76 fInnerEdge(0),fCalFrame(0)
79 for(Int_t i = 0; i < 5 ; i++) fParEMOD[i]=0.0;
82 //______________________________________________________________________
83 AliEMCALv0::AliEMCALv0(const char *name, const char *title,
84 const Bool_t checkGeoAndRun)
85 : AliEMCAL(name,title,checkGeoAndRun),
86 fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
87 fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0),
88 fInnerEdge(0),fCalFrame(0)
90 // ctor : title is used to identify the layout
92 // Nov 22, 2006 - case of 1X1
94 for(Int_t i = 0; i < 5 ; i++) fParEMOD[i]=0.0;
95 TString ntmp(GetTitle());
98 AliEMCALGeometry *g = GetGeometry() ;
99 TString gn(g->GetName()); gn.ToUpper();
100 fShishKebabModules = g->GetShishKebabTrd1Modules();
102 fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
103 if(gn.Contains("V1")) fSampleWidth += 2.*g->GetTrd1BondPaperThick();
104 AliDebug(2,Form("fGeometry %p : gMC %p : fSampleWidth %5.4f\n",
105 fGeometry, gMC, fSampleWidth));
106 //Set geometry name again, in case it was changed during the initialization of the geometry.
107 SetTitle(fGeometry->GetEMCGeometry()->GetName());
111 //______________________________________________________________________
112 void AliEMCALv0::CreateGeometry()
114 // Create the EMCAL geometry for Geant
115 // Geometry of a tower
117 AliEMCALGeometry * geom = GetGeometry() ;
118 TString gn(geom->GetName());
121 if(!(geom->IsInitialized())){
122 Error("CreateGeometry","EMCAL Geometry class has not been set up.");
125 // Get pointer to the array containing media indices
126 fIdTmedArr = fIdtmed->GetArray() - 1599 ;
129 // gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule
130 AliMatrix(fIdRotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
132 // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1
134 Float_t envelopA[10];
135 if(gn.Contains("WSUC") ) { // TRD1 for WSUC facility
140 gMC->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ;
142 for(int i=0; i<3; i++) fEnvelop1[i] = envelopA[i]; // 23-may-05
143 // Position the EMCAL Mother Volume (XEN1) in WSUC.
144 // Look to AliEMCALWsuCosmicRaySetUp.
145 gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, + 265., fIdRotm, "ONLY") ;
147 envelopA[0] = geom->GetArm1PhiMin(); // minimum phi angle
148 envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
149 envelopA[2] = envelopA[1]/geom->GetEMCGeometry()->GetPhiSuperModule(); // Section of that
150 envelopA[3] = 2; // 2: z coordinates
151 envelopA[4] = -geom->GetEnvelop(2)/2.; // zmin - includes padding
152 envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1 - includes padding
153 envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1 - includes padding
154 envelopA[7] = geom->GetEnvelop(2)/2.; // zmax includes padding
156 envelopA[8] = envelopA[5] ; // radii are the same.
157 envelopA[9] = envelopA[6] ; // radii are the same.
159 gMC->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ; // Polygone filled with air
160 fEnvelop1.Set(10, envelopA);
162 printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]);
163 printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]);
165 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
166 gMC->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
170 AliDebug(2,Form("Shish-Kebab geometry : %s", GetTitle()));
171 CreateShishKebabGeometry();
173 if(gn.Contains("WSUC")==0) { // Nov 24,2010 for TB
175 AliDebug(2,"Creating EMCAL Space Frame");
176 fCalFrame = new AliEMCALSpaceFrame();
177 fCalFrame->CreateGeometry();
181 //______________________________________________________________________
182 void AliEMCALv0::Init(void)
184 // Just prints an information message
186 if(AliLog::GetGlobalDebugLevel()>0) {
187 TString message("\n") ;
188 message += "*****************************************\n" ;
190 // Here the EMCAL initialisation code (if any!)
192 AliEMCALGeometry * geom = GetGeometry() ;
195 message += "AliEMCAL " ;
196 message += Version() ;
197 message += "EMCAL geometry initialized for " ;
198 message += geom->GetName() ;
201 message += "AliEMCAL " ;
202 message += Version() ;
203 message += "EMCAL geometry initialization failed !" ;
205 message += "\n*****************************************" ;
206 printf("%s",message.Data() ) ;
211 //______________________________________________________________________
212 void AliEMCALv0::CreateShishKebabGeometry()
216 AliEMCALGeometry * g = GetGeometry();
217 TString gn(g->GetName()); gn.ToUpper();
218 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
219 // see AliModule::fFIdTmedArr
220 // fIdTmedArr = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials()
221 // int kIdAIR=1599, kIdPB = 1600, kIdSC = 1601, kIdSTEEL = 1603;
223 Double_t par[10], xpos=0., ypos=0., zpos=0.;
225 CreateSmod(g->GetNameOfEMCALEnvelope());
227 Int_t * SMTypeList = g->GetEMCSystem();
229 for(int i = 0 ; i < g->GetNumberOfSuperModules(); i++) {
230 if( SMTypeList[i] == tmpType) continue;
231 else tmpType = SMTypeList[i];
233 if( tmpType == AliEMCALGeometry::kEMCAL_Standard ) CreateEmod("SMOD","EMOD"); // 18-may-05
234 else if( tmpType == AliEMCALGeometry::kEMCAL_Half ) CreateEmod("SM10","EMOD"); // Nov 1,2006 1/2 SM
235 else if( tmpType == AliEMCALGeometry::kEMCAL_3rd ) CreateEmod("SM3rd","EMOD"); // Feb 1,2012 1/3 SM
236 else if( tmpType == AliEMCALGeometry::kDCAL_Standard ) CreateEmod("DCSM","EMOD"); // Mar 13, 2012, 6 or 10 DCSM
237 else if( tmpType == AliEMCALGeometry::kDCAL_Ext ) CreateEmod("DCEXT","EMOD"); // Mar 13, 2012, DCAL extension SM
238 else AliError("Unkown SM Type!!");
241 // Sensitive SC (2x2 tiles)
242 double parSCM0[5]={0,0,0,0}, *dummy = 0, parTRAP[11];
244 if(!gn.Contains("V1")) {
245 double wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() - g->GetPhiTileSize();
246 for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
247 parSCM0[3] = fParEMOD[3];
248 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
249 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
251 double wTh = g->GetLateralSteelStrip();
252 parSCM0[0] = fParEMOD[0] - wTh + tanTrd1*g->GetTrd1AlFrontThick();
253 parSCM0[1] = fParEMOD[1] - wTh;
254 parSCM0[2] = fParEMOD[2] - wTh;
255 parSCM0[3] = fParEMOD[3] - g->GetTrd1AlFrontThick()/2.;
256 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
257 double zshift = g->GetTrd1AlFrontThick()/2.;
258 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., zshift, 0, "ONLY");
260 CreateAlFrontPlate("EMOD","ALFP");
263 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
264 // Division to tile size - 1-oct-04
265 AliDebug(2,Form(" Divide SCM0 on y-axis %i\n", g->GetNETAdiv()));
266 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
268 parTRAP[0] = parSCM0[3]; // dz
269 parTRAP[1] = TMath::ATan2((parSCM0[1]-parSCM0[0])/2.,2.*parSCM0[3])*180./TMath::Pi(); // theta
270 parTRAP[2] = 0.; // phi
272 parTRAP[3] = parSCM0[2]/2.; // H1
273 parTRAP[4] = parSCM0[0]/2.; // BL1
274 parTRAP[5] = parTRAP[4]; // TL1
275 parTRAP[6] = 0.0; // ALP1
277 parTRAP[7] = parSCM0[2]/2.; // H2
278 parTRAP[8] = parSCM0[1]/2.; // BL2
279 parTRAP[9] = parTRAP[8]; // TL2
280 parTRAP[10]= 0.0; // ALP2
281 AliDebug(2,Form(" ** TRAP ** \n"));
282 for(int i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
284 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
285 xpos = +(parSCM0[1]+parSCM0[0])/4.;
286 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
288 // Using rotation because SCMX should be the same due to Pb tiles
290 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
291 gMC->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, fIdRotm, "ONLY");
292 // put LED to the SCM0
293 AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0);
294 Double_t tanBetta = mod->GetTanBetta();
298 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.;
299 if(!gn.Contains("V1")) {
300 par[1] = parSCM0[2]/2; // y
301 par[2] = g->GetECPbRadThick()/2.; // z
302 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
303 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
304 AliDebug(2,Form(" Pb tiles \n"));
305 for(int iz=0; iz<g->GetNECLayers(); iz++){
306 par[0] = (parSCM0[0] + tanBetta*fSampleWidth*iz)/2.;
307 xpos = par[0] - xCenterSCMX;
308 gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
309 AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]));
310 zpos += fSampleWidth;
312 AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr));
315 // First sheet of paper
316 par[1] = parSCM0[2]/2.; // y
317 par[2] = g->GetTrd1BondPaperThick()/2.; // z
318 par[0] = parSCM0[0]/2.; // x
319 gMC->Gsvolu("PAP1", "BOX", fIdTmedArr[kIdPAPER], par, 3);
320 xpos = par[0] - xCenterSCMX;
321 zpos = -parSCM0[3] + g->GetTrd1BondPaperThick()/2.;
322 gMC->Gspos("PAP1", 1, "SCMX", xpos, ypos, zpos, 0, "ONLY");
323 for(int iz=0; iz<g->GetNECLayers()-1; iz++){
325 Double_t dz = g->GetECScintThick() + g->GetTrd1BondPaperThick() + fSampleWidth*iz;
326 // PB + 2 paper sheets
327 par[2] = g->GetECPbRadThick()/2. + g->GetTrd1BondPaperThick(); // z
328 par[0] = (parSCM0[0] + tanBetta*dz)/2.;
329 TString pa(Form("PA%2.2i",nr));
330 gMC->Gsvolu(pa.Data(), "BOX", fIdTmedArr[kIdPAPER], par, 3);
331 xpos = par[0] - xCenterSCMX;
332 zpos = -parSCM0[3] + dz + par[2];
333 gMC->Gspos(pa.Data(), 1, "SCMX", xpos, ypos, zpos, 0, "ONLY") ;
335 TString pb(Form("PB%2.2i",nr));
336 par[2] = g->GetECPbRadThick()/2.; // z
337 gMC->Gsvolu(pb.Data(), "BOX", fIdTmedArr[kIdPB], par, 3);
338 gMC->Gspos(pb.Data(), 1, pa.Data(), 0.0, 0.0, 0.0, 0, "ONLY") ;
342 } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) {
343 printf(" before AliEMCALv0::Trd1Tower3X3() : parSCM0");
344 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
346 Trd1Tower3X3(parSCM0);
347 } else if(g->GetNPHIdiv()==1 && g->GetNETAdiv()==1) {
348 // no division in SCM0
349 Trd1Tower1X1(parSCM0);
350 } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) {
356 //______________________________________________________________________
357 void AliEMCALv0::CreateSmod(const char* mother)
359 // 18-may-05; mother="XEN1";
360 // child="SMOD" from first to 10th, "SM10" (11th and 12th)
361 // "DCSM" from 13th to 18/22th (TRD1 case), "DCEXT"(18th and 19th) adapted for DCAL, Oct-23-2012
362 AliEMCALGeometry * g = GetGeometry();
363 TString gn(g->GetName()); gn.ToUpper();
365 Double_t par[3], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.;
366 Double_t parC[3] = {0};
370 // ===== define Super Module from air - 14x30 module ==== ;
371 AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data()));
372 par[0] = g->GetShellThickness()/2.;
373 par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
374 par[2] = g->GetEtaModuleSize()*g->GetNEta()/2.;
376 Int_t nSMod = g->GetNumberOfSuperModules();
377 int nphism = nSMod/2; // 20-may-05
379 dphi = g->GetEMCGeometry()->GetPhiSuperModule();
380 rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.;
381 AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi));
384 if(gn.Contains("WSUC")) {
386 par[0] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
387 par[1] = g->GetShellThickness()/2.;
388 par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5;
390 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
392 AliDebug(2,Form("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
393 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
397 nphism = g->GetNumberOfSuperModules();
398 for(int i=0; i<nphism; i++) {
399 xpos = ypos = zpos = 0.0;
401 gMC->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
402 printf(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
403 fIdRotm, phi, phiRad, xpos, ypos, zpos);
407 AliDebug(2,Form(" par[0] %7.2f (old) \n", par[0]));
408 for(int i=0; i<3; i++) par[i] = g->GetSuperModulesPar(i);
413 for (Int_t smodnum = 0; smodnum < nSMod; ++smodnum) {
414 for(int i=0; i<3; i++) parC[i] = par[i];
415 if(g->GetSMType(smodnum) == tmpType) {
418 tmpType = g->GetSMType(smodnum);
422 phiRad = g->GetPhiCenterOfSMSec(smodnum); // NEED phi= 90, 110, 130, 150, 170, 190(not center)...
423 phi = phiRad *180./TMath::Pi();
424 Double_t phiy = 90. + phi;
427 xpos = rpos * TMath::Cos(phiRad);
428 ypos = rpos * TMath::Sin(phiRad);
429 zpos = fSmodPar2; // 21-sep-04
430 if( tmpType == AliEMCALGeometry::kEMCAL_Standard ) {
432 } else if( tmpType == AliEMCALGeometry::kEMCAL_Half ) {
435 xpos += (par[1]/2. * TMath::Sin(phiRad));
436 ypos -= (par[1]/2. * TMath::Cos(phiRad));
437 } else if( tmpType == AliEMCALGeometry::kEMCAL_3rd ) {
440 xpos += (2.*par[1]/3. * TMath::Sin(phiRad));
441 ypos -= (2.*par[1]/3. * TMath::Cos(phiRad));
442 } else if( tmpType == AliEMCALGeometry::kDCAL_Standard ) {
445 zpos = fSmodPar2 + g->GetDCALInnerEdge()/2.; // 21-sep-04
446 } else if( tmpType == AliEMCALGeometry::kDCAL_Ext ) {
449 xpos += (2.*par[1]/3. * TMath::Sin(phiRad));
450 ypos -= (2.*par[1]/3. * TMath::Cos(phiRad));
451 } else AliError("Unkown SM Type!!");
453 if(SMOrder == 1) {//first time, create the SM
454 gMC->Gsvolu(smName.Data(), "BOX", fIdTmedArr[kIdAIR], parC, 3);
455 AliDebug(2,Form(" Super module with name \"%s\" was created in \"box\" with: par[0] = %f, par[1] = %f, par[2] = %f\n", smName.Data(), parC[0], parC[1], parC[2]));
458 if( smodnum%2 == 1) {
460 if(phiy>=360.) phiy -= 360.;
464 AliMatrix(fIdRotm, 90.0, phi, 90.0, phiy, phiz, 0.0);
465 gMC->Gspos(smName.Data(), SMOrder, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
466 AliDebug(3, Form(" %s : %2i, fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n",
467 smName.Data(), SMOrder, fIdRotm, phi, phiRad, xpos, ypos, zpos, smodnum));
470 AliDebug(2,Form(" Number of Super Modules %i \n", nSMod));
473 if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
474 par[0] = g->GetSteelFrontThickness()/2.;
475 gMC->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3);
476 printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", fIdTmedArr[kIdSTEEL], par[0],par[1],par[2]);
477 xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.;
478 gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
482 //______________________________________________________________________
483 void AliEMCALv0::CreateEmod(const char* mother, const char* child)
485 // 17-may-05; mother="SMOD"; child="EMOD"
487 AliEMCALGeometry * g = GetGeometry();
488 TString gn(g->GetName()); gn.ToUpper();
490 Double_t xpos=0., ypos=0., zpos=0.;
491 //Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad();tanTrd1 = TMath::Tan(trd1Angle/2.);
493 if(strcmp(mother,"SMOD")==0) {
494 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
495 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
496 fParEMOD[2] = g->GetPhiModuleSize()/2.;; // dy
497 fParEMOD[3] = g->GetLongModuleSize()/2.; // dz
498 gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4);
503 // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0)
504 AliEMCALShishKebabTrd1Module *mod=0; // current module
506 for(int iz=0; iz<g->GetNZ(); iz++) {
507 Double_t angle=90., phiOK=0;
508 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
509 angle = mod->GetThetaInDegree();
510 if(!gn.Contains("WSUC")) { // ALICE
511 AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.);
512 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
513 // printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
514 //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
515 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
516 zpos = mod->GetPosZ() - fSmodPar2;
518 int iyMax = g->GetNPhi();
519 if(strcmp(mother,"SM10") == 0 ) {
521 } else if(strcmp(mother,"SM3rd") == 0 ) {
523 } else if(strcmp(mother,"DCEXT") == 0 ) {
525 } else if(strcmp(mother,"DCSM") == 0 ) {
526 if(iz < 8 ) continue;//!!!DCSM from 8th to 23th
527 zpos = mod->GetPosZ() - fSmodPar2 - g->GetDCALInnerEdge()/2.;
528 } else if(strcmp(mother,"SMOD") != 0 )
529 AliError("Unknown super module Type!!");
530 for(int iy=0; iy<iyMax; iy++) { // flat in phi
531 ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
532 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
534 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm);
535 AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
539 if(iz == 0) AliMatrix(fIdRotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y)
540 else AliMatrix(fIdRotm, 90-angle,270., 90.0,0.0, angle,90.);
541 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
542 //printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
543 //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
544 zpos = mod->GetPosZ() - fSmodPar2;
545 ypos = mod->GetPosXfromR() - fSmodPar1;
546 //printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm);
547 for(int ix=0; ix<g->GetNPhi(); ix++)
549 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
550 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
551 printf(" %7.2f ", xpos);
556 AliDebug(2,Form(" Number of modules in Super Module(%s) %i \n", mother, nr));
559 void AliEMCALv0::CreateAlFrontPlate(const char* mother, const char* child)
561 // Oct 26,2010 : Al front plate : ALFP
562 AliEMCALGeometry * g = GetGeometry();
563 TString gn(g->GetName()); gn.ToUpper();
564 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
565 Double_t parALFP[5], zposALFP=0.;
567 parALFP[0] = g->GetEtaModuleSize()/2. - g->GetLateralSteelStrip(); // dx1
568 parALFP[1] = parALFP[0] + tanTrd1*g->GetTrd1AlFrontThick(); // dx2
569 parALFP[2] = g->GetPhiModuleSize()/2. - g->GetLateralSteelStrip(); // dy
570 parALFP[3] = g->GetTrd1AlFrontThick()/2.; // dz
571 gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdAL], parALFP, 4);
572 zposALFP = -fParEMOD[3] + g->GetTrd1AlFrontThick()/2.;
573 gMC->Gspos (child, 1, mother, 0.0, 0.0, zposALFP, 0, "ONLY");
576 //______________________________________________________________________
577 void AliEMCALv0::Trd1Tower3X3(const double *parSCM0)
579 // Started Dec 8,2004 by PAI
581 printf(" AliEMCALv0::Trd1Tower3X3() : parSCM0");
582 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
584 // Nov 10, 2006 - different name of SCMX
585 double parTRAP[11], *dummy=0;
586 AliEMCALGeometry * g = GetGeometry();
587 TString gn(g->GetName()), scmx;
589 // Division to tile size
590 AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv()));
591 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
592 double dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3];
593 double ndiv=3., xpos=0.0;
594 // should be defined once
595 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
596 for(int ix=1; ix<=3; ix++) { // 3X3
597 scmx = "SCX"; // Nov 10,2006
600 double xCentBot = 2.*dx1/3.;
601 double xCentTop = 2.*(dx2/4. + dx1/12.);
602 parTRAP[1] = TMath::ATan2((xCentTop-xCentBot),2.*dz)*TMath::RadToDeg(); // theta
603 parTRAP[2] = 0.; // phi
605 parTRAP[3] = dy/ndiv; // H1
606 parTRAP[4] = dx1/ndiv; // BL1
607 parTRAP[5] = parTRAP[4]; // TL1
608 parTRAP[6] = 0.0; // ALP1
610 parTRAP[7] = dy/ndiv; // H2
611 parTRAP[8] = dx2/2 - dx1/6.;// BL2
612 parTRAP[9] = parTRAP[8]; // TL2
613 parTRAP[10]= 0.0; // ALP2
614 xpos = (xCentBot+xCentTop)/2.;
617 parTRAP[1] = -parTRAP[1];
619 } else if(ix==2) { // central part is box but we treat as trapesoid due to numbering
621 parTRAP[8] = dx1/ndiv; // BL2
622 parTRAP[9] = parTRAP[8]; // TL2
625 AliDebug(2,Form(" ** TRAP ** xpos %9.3f\n", xpos));
626 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
629 gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
630 gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
632 PbInTrap(parTRAP, scmx);
634 AliDebug(2,"Trd1Tower3X3 - Ver. 1.0 : was tested.");
638 //______________________________________________________________________
639 void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
641 // see for example CreateShishKebabGeometry(); just for case TRD1
643 AliDebug(2,Form(" Pb tiles : nrstart %i\n", nr));
644 AliEMCALGeometry * g = GetGeometry();
647 double xpos = 0.0, ypos = 0.0;
648 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
650 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
651 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // ??
652 // double tan = TMath::Tan(parTRAP[1]*TMath::DegToRad());
654 par[1] = parTRAP[3]; // y
655 par[2] = g->GetECPbRadThick()/2.; // z
656 for(int iz=0; iz<g->GetNECLayers(); iz++){
657 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
658 xpos = par[0] - xCenterSCMX;
659 if(parTRAP[1] < 0.) xpos = -xpos;
660 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
661 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
662 zpos += fSampleWidth;
663 if(iz%2>0) printf("\n");
665 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
666 AliDebug(2,Form(" par[1] %9.3f par[2] %9.3f ypos %9.3f \n", par[1], par[2], ypos));
667 AliDebug(2,Form(" PbInTrap Ver. 1.0 : was tested."));
671 //______________________________________________________________________
672 void AliEMCALv0::Trd1Tower4X4() const
677 //______________________________________________________________________
678 void AliEMCALv0::Trd1Tower1X1(double *parSCM0)
680 // Started Nov 22,2006 by PAI
681 AliDebug(1," AliEMCALv0::Trd1Tower1X1() : parSCM0");
682 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
685 // No division - keeping the same volume logic
686 // and as consequence the same abs is scheme
687 AliDebug(2,"Trd1Tower1X1() : Create SCMX(SCMY) as SCM0");
689 gMC->Gsvolu("SCMY", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
690 gMC->Gspos("SCMY", 1, "SCM0", 0.0, 0.0, 0.0, 0, "ONLY");
691 gMC->Gsvolu("SCMX", "TRD1", fIdTmedArr[kIdSC], parSCM0, 4);
692 gMC->Gspos("SCMX", 1, "SCMY", 0.0, 0.0, 0.0, 0, "ONLY");
694 // should be defined once
696 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
698 PbInTrd1(parSCM0, "SCMX");
700 AliDebug(1,"Trd1Tower1X1() : Ver. 0.1 : was tested.");
703 //______________________________________________________________________
704 void AliEMCALv0::PbInTrd1(const double *parTrd1, TString n)
706 // see PbInTrap(const double parTrd1[11], TString n)
707 static int nr=0, ndeb=2;
708 AliDebug(ndeb,Form(" Pb tiles : nrstart %i\n", nr));
709 AliEMCALGeometry * g = GetGeometry();
712 double xpos = 0.0, ypos = 0.0;
713 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
714 double coef = (parTrd1[1] - parTrd1[0]) / (2.*parTrd1[3]);
716 par[1] = parTrd1[2]; // y
717 par[2] = g->GetECPbRadThick()/2.; // z
719 for(int iz=0; iz<g->GetNECLayers(); iz++){
720 par[0] = parTrd1[0] + coef*fSampleWidth*iz;
721 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
722 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
723 zpos += fSampleWidth;
724 if(iz%2>0) printf("\n");
726 AliDebug(ndeb,Form(" Number of Pb tiles in SCMX %i coef %9.7f ", nr, coef));
727 AliDebug(ndeb,Form(" PbInTrd1 Ver. 0.1 : was tested."));
731 //______________________________________________________________________
732 void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parSCM0[5])
734 // Passive material inside the detector
735 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); //Need check
736 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
737 for(int i=0; i<4; i++) { // on pictures sometimes I can not see 0 -> be carefull!!
738 parSCM0[i] = emodPar[i] - wallThickness;
739 AliDebug(2,Form(" %i parSCMO %7.3f emodPar %7.3f : dif %7.3f \n",
740 i, parSCM0[i],emodPar[i], parSCM0[i]-emodPar[i]));
742 parSCM0[4] = emodPar[4];
743 gMC->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC
744 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
746 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
747 Division2X2InScm0(g, parSCM0);
749 Info("Scm0InTrd2"," no division SCM0 in this geometry |%s|\n", g->GetName());
754 //______________________________________________________________________
755 void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t parSCM0[5])
758 Double_t parTRAP[11], xpos=0.,ypos=0., dx1=0.0,dx2=0.,dy1=0.0,dy2=0.,dz=0.
762 Info("Division2X2InScm0","Divide SCM0 on y-axis %i\n", g->GetNETAdiv());
763 TString n("SCMX"), overLapFlagSCMY("ONLY"), overLapFlagSCMX("ONLY");
764 n = "SCM0"; // for testing - 14-mar-05
766 PbInTrapForTrd2(parSCM0, n);
767 // overLapFlagSCMY=overLapFlagSCMX="MANY"; // do not work
771 dy1 = parSCM0[2] , dy2 = parSCM0[3], dz = parSCM0[4];
773 parTRAP[0] = parSCM0[4]; // dz
774 parTRAP[1] = TMath::ATan2((dy2-dy1)/2.,2.*dz)*TMath::RadToDeg();
775 parTRAP[2] = 90.; // phi
777 parTRAP[3] = parSCM0[2]/2.; // H1
778 parTRAP[4] = parSCM0[0]; // BL1
779 parTRAP[5] = parTRAP[4]; // TL1
780 parTRAP[6] = 0.0; // ALP1
782 parTRAP[7] = parSCM0[3]/2.; // H2
783 parTRAP[8] = parSCM0[1]; // BL2
784 parTRAP[9] = parTRAP[8]; // TL2
785 parTRAP[10]= 0.0; // ALP2
786 AliDebug(2,Form(" ** SCMY ** \n"));
787 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
790 gMC->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC
791 ypos = +(parTRAP[3]+parTRAP[7])/2.; //
792 AliDebug(2,Form(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data()));
793 gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm, overLapFlagSCMY.Data()) ;
794 // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z
795 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
796 // We may have problem with numeration due to rotation - 4-feb-05
797 gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm, overLapFlagSCMY.Data());
799 Info("Division2X2InScm0","Divide SCMY on x-axis %i\n", g->GetNPHIdiv());
802 dr1=TMath::Sqrt(dx1*dx1+dy1*dy1);
803 dr2=TMath::Sqrt(dx2*dx2+dy2*dy2);
805 parTRAP[0] = parSCM0[4]; // dz
806 parTRAP[1] = TMath::ATan2((dr2-dr1)/2.,2.*dz)*TMath::RadToDeg(); //
807 parTRAP[2] = 45.; // phi
809 parTRAP[3] = parSCM0[2]/2.; // H1
810 parTRAP[4] = parSCM0[0]/2.; // BL1
811 parTRAP[5] = parTRAP[4]; // TL1
812 parTRAP[6] = 0.0; // ALP1
814 parTRAP[7] = parSCM0[3]/2.; // H2
815 parTRAP[8] = parSCM0[1]/2; // BL2
816 parTRAP[9] = parTRAP[8]; // TL2
817 parTRAP[10]= 0.0; // ALP2
818 AliDebug(2,Form(" ** SCMX ** \n"));
819 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
822 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
823 xpos = (parTRAP[4]+parTRAP[8])/2.;
824 AliDebug(2,Form(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data()));
825 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
826 // AliMatrix(fIdRotm, 90.0,270., 90.0, 0.0, 0.0,0.0); // x'=-y; y'=x; z'=z
827 AliMatrix(fIdRotm, 90.0,90., 90.0, -180.0, 0.0,0.0); // x'=y; y'=-x; z'=z
828 gMC->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
830 if(n=="SCMX" && overLapFlagSCMY == "ONLY") {
831 PbInTrapForTrd2(parTRAP, n);
836 //______________________________________________________________________
837 void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
841 TString pbShape("BOX"), pbtiChonly("ONLY");
844 // pbtiChonly = "MANY";
846 gMC->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0);
849 Info("PbInTrapForTrd2"," Pb tiles inside %s: shape %s :pbtiChonly %s\n nrstart %i\n",
850 name.Data(), pbShape.Data(), pbtiChonly.Data(), nr);
851 AliEMCALGeometry * g = GetGeometry();
853 double par[5], parPB[5], parSC[5];
854 double xpos = 0.0, ypos = 0.0;
855 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
856 if(name == "SCMX") { // common trapezoid - 11 parameters
857 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
858 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // the same for y
859 AliDebug(2,Form(" xCenterSCMX %8.5f : coef %8.7f \n", xCenterSCMX, coef));
861 par[2] = g->GetECPbRadThick()/2.; // z
862 for(int iz=0; iz<g->GetNECLayers(); iz++){
863 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
865 xpos = ypos = par[0] - xCenterSCMX;
866 //if(parTRAP[1] < 0.) xpos = -xpos;
867 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
868 AliDebug(2,Form(" %2.2i xpos %8.5f zpos %6.3f par[0,1] %6.3f |", iz+1, xpos, zpos, par[0]));
869 if(iz%2>0) AliDebug(2,Form("\n"));
870 zpos += fSampleWidth;
872 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
873 AliDebug(2,Form(" par[1] %9.5f par[2] %9.5f ypos %9.5f \n", par[1], par[2], ypos));
874 } else if(name == "SCM0") { // 1-mar-05 ; TRD2 - 5 parameters
875 AliDebug(2,Form(" SCM0 par = "));
876 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parTRAP[i]));
877 AliDebug(2,Form("\n zpos %f \n",zpos));
879 double tanx = (parTRAP[1] - parTRAP[0]) / (2.*parTRAP[4]); // tanx = tany now
880 double tany = (parTRAP[3] - parTRAP[2]) / (2.*parTRAP[4]), ztmp=0.;
881 parPB[4] = g->GetECPbRadThick()/2.;
882 parSC[2] = g->GetECScintThick()/2.;
883 for(int iz=0; iz<g->GetNECLayers(); iz++){
884 ztmp = fSampleWidth*double(iz);
885 parPB[0] = parTRAP[0] + tanx*ztmp;
886 parPB[1] = parPB[0] + tanx*g->GetECPbRadThick();
887 parPB[2] = parTRAP[2] + tany*ztmp;
888 parPB[3] = parPB[2] + tany*g->GetECPbRadThick();
889 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ;
890 AliDebug(2,Form("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos));
892 for(int i=0; i<5; i++) printf(" %9.5f ", parPB[i]);
893 // individual SC tile
896 gMC->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(),
897 0, pbtiChonly.Data(), parSC, 3) ;
898 printf("\n SCTI zpos %6.3f | par = ", zpos+g->GetECScintThick());
899 for(int i=0; i<3; i++) printf(" %9.5f ", parPB[i]);
901 zpos += fSampleWidth;
903 AliDebug(2,Form("\n"));
905 Info("PbInTrapForTrd2", "Ver. 0.03 : was tested.");
909 //______________________________________________________________________
910 void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parPBMO[5])
913 Info("PbmoInTrd2"," started : geometry %s ", g->GetName());
914 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize();
915 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
916 for(int i=0; i<4; i++) {
917 parPBMO[i] = emodPar[i] - wallThickness;
918 AliDebug(2,Form(" %i parPBMO %7.3f emodPar %7.3f : dif %7.3f \n",
919 i, parPBMO[i],emodPar[i], parPBMO[i]-emodPar[i]));
921 parPBMO[4] = emodPar[4];
922 gMC->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5);
923 gMC->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
925 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
926 Division2X2InPbmo(g, parPBMO);
927 AliDebug(2,Form(" PBMO, division 2X2 | geometry |%s|\n", g->GetName()));
929 AliDebug(2,Form(" no division PBMO in this geometry |%s|\n", g->GetName()));
934 //______________________________________________________________________
935 void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t parPBMO[5])
938 Info("Division2X2InPbmo"," started : geometry %s ", g->GetName());
940 // gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0);
943 double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;;
944 double tanx = (parPBMO[1] - parPBMO[0]) / (2.*parPBMO[4]); // tanx = tany now
945 double tany = (parPBMO[3] - parPBMO[2]) / (2.*parPBMO[4]);
946 const Int_t buffersize = 10;
947 char name[buffersize], named[buffersize], named2[buffersize];
949 AliDebug(2,Form(" PBMO par = "));
950 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parPBMO[i]));
951 AliDebug(2,Form("\n"));
953 parSC[2] = g->GetECScintThick()/2.;
954 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick() + g->GetECScintThick()/2.;
955 AliDebug(2,Form(" parSC[2] %9.5f \n", parSC[2]));
956 for(int iz=0; iz<g->GetNECLayers(); iz++){
957 ztmp = g->GetECPbRadThick() + fSampleWidth*double(iz); // Z for previous PB
958 parSC[0] = parPBMO[0] + tanx*ztmp;
959 parSC[1] = parPBMO[2] + tany*ztmp;
961 snprintf(name,buffersize,"SC%2.2i", iz+1);
962 gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3);
963 gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
964 AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ",
965 name, zpos, parSC[0], parSC[1]));
967 snprintf(named,buffersize,"SY%2.2i", iz+1);
968 printf(" %s -> ", named);
969 gMC->Gsdvn(named,name, 2, 2);
971 snprintf(named2,buffersize,"SX%2.2i", iz+1);
972 printf(" %s \n", named2);
973 gMC->Gsdvn(named2,named, 2, 1);
975 zpos += fSampleWidth;
979 //______________________________________________________________________
980 AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta)
983 AliEMCALShishKebabTrd1Module* trd1=0;
984 if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) {
985 trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta);
990 //_____________________________________________________________________________
991 void AliEMCALv0::AddAlignableVolumes() const
993 //Add volumes which are alignable (?)
994 TString ntmp(GetTitle()); // name of EMCAL geometry
996 if(ntmp.Contains("WSUC")) {
997 AddAlignableVolumesInWSUC(); // WSUC case
999 AddAlignableVolumesInALICE(); // ALICE case
1003 //______________________________________________________________________
1004 void AliEMCALv0::AddAlignableVolumesInALICE() const
1007 // Create entries for alignable volumes associating the symbolic volume
1008 // name with the corresponding volume path. Needs to be synchronized with
1009 // eventual changes in the geometry.
1012 Float_t pars[] = {GetGeometry()->GetSuperModulesPar(0),GetGeometry()->GetSuperModulesPar(1),GetGeometry()->GetSuperModulesPar(2)};
1013 double rpos = (GetGeometry()->GetEnvelop(0) + GetGeometry()->GetEnvelop(1))/2.;
1014 double phi, phiRad, xpos, ypos, zpos;
1016 AliGeomManager::ELayerID idEMCAL = AliGeomManager::kEMCAL;
1017 Int_t modUID, modnum = 0;
1018 TString volpath, symname;
1020 AliEMCALGeometry * geom = GetGeometry();
1021 Int_t nSMod = geom->GetNumberOfSuperModules();
1027 for (Int_t smodnum = 0; smodnum < nSMod; ++smodnum) {
1028 modUID = AliGeomManager::LayerToVolUID(idEMCAL,modnum++);
1029 if(geom->GetSMType(smodnum) == AliEMCALGeometry::kEMCAL_Standard ) { SMPathName = "SMOD"; SMName = "FullSupermodule";}
1030 else if(geom->GetSMType(smodnum) == AliEMCALGeometry::kEMCAL_Half ) { SMPathName = "SM10"; SMName = "HalfSupermodule";}
1031 else if(geom->GetSMType(smodnum) == AliEMCALGeometry::kEMCAL_3rd ) { SMPathName = "SM3rd"; SMName = "OneThrdSupermodule";}
1032 else if( geom->GetSMType(smodnum) == AliEMCALGeometry::kDCAL_Standard ) { SMPathName = "DCSM"; SMName = "DCALSupermodule";}
1033 else if( geom->GetSMType(smodnum) == AliEMCALGeometry::kDCAL_Ext ) { SMPathName = "DCEXT"; SMName = "DCALExtensionSM";}
1034 else AliError("Unkown SM Type!!");
1036 if(geom->GetSMType(smodnum) == tmpType) {
1039 tmpType = geom->GetSMType(smodnum);
1043 volpath.Form("ALIC_1/XEN1_1/%s_%d",SMPathName.Data(), SMOrder);
1044 symname.Form("EMCAL/%s%d",SMName.Data(), SMOrder);
1046 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
1047 AliFatal(Form("AliEMCALv0::Unable to set alignable entry!!\nName: %s\t Path: %s\t ModuleID: %d\n",symname.Data(),volpath.Data(), modUID));
1049 // Creates the Tracking to Local transformation matrix for EMCAL
1051 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID) ;
1053 phiRad = GetGeometry()->GetPhiCenterOfSM(smodnum); //comes in radians, not degrees
1054 phi = phiRad*180./TMath::Pi(); //need degrees for rot. matrix
1055 xpos = rpos * TMath::Cos(phiRad);
1056 ypos = rpos * TMath::Sin(phiRad);
1058 if( geom->GetSMType(smodnum) == AliEMCALGeometry::kEMCAL_Half ) {
1059 xpos += (pars[1]/2. * TMath::Sin(phiRad)); // half SM!
1060 ypos -= (pars[1]/2. * TMath::Cos(phiRad));
1061 } else if ( geom->GetSMType(smodnum) == AliEMCALGeometry::kEMCAL_3rd || geom->GetSMType(smodnum) == AliEMCALGeometry::kDCAL_Ext ) {
1062 xpos += (pars[1]/3. * TMath::Sin(phiRad)); // one_third SM !
1063 ypos -= (pars[1]/3. * TMath::Cos(phiRad));
1064 } else if( geom->GetSMType(smodnum) == AliEMCALGeometry::kDCAL_Standard ) {
1065 zpos = pars[2]*2./3. + GetGeometry()->GetDCALInnerEdge()/2.;
1068 AliDebug(3, Form(" fIdRotm %3i phi %6.13f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : smodnum %i \n",
1069 fIdRotm, phi, phiRad, xpos, ypos, zpos, smodnum));
1071 TGeoHMatrix *matTtoL;
1072 TGeoHMatrix *globMatrix = alignableEntry->GetGlobalOrig();
1074 if(smodnum%2 == 0) {
1076 TGeoTranslation geoTran0(xpos, ypos, zpos);
1077 TGeoRotation geoRot0("geoRot0", 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
1078 TGeoCombiTrans mat0(geoTran0, geoRot0);
1079 matTtoL = new TGeoHMatrix(mat0);
1081 matTtoL->MultiplyLeft(&(globMatrix->Inverse()));
1082 alignableEntry->SetMatrix(matTtoL);
1086 double phiy = 90. + phi + 180.;
1087 if(phiy>=360.) phiy -= 360.;
1088 TGeoTranslation geoTran1(xpos,ypos,-zpos);
1089 TGeoRotation geoRot1("geoRot1", 90.0, phi, 90.0, phiy, 180.0, 0.0);
1090 TGeoCombiTrans mat1(geoTran1, geoRot1);
1091 matTtoL = new TGeoHMatrix(mat1);
1093 matTtoL->MultiplyLeft(&(globMatrix->Inverse()));
1094 alignableEntry->SetMatrix(matTtoL);
1102 //______________________________________________________________________
1103 void AliEMCALv0::AddAlignableVolumesInWSUC() const
1106 // Create entries for alignable volumes associating the symbolic volume
1107 // name with the corresponding volume path. Needs to be synchronized with
1108 // eventual changes in the geometry.
1111 TString vpstr1 = "WSUC_1/XEN1_1/SMOD_";
1112 TString snstr1 = "EMCAL/CosmicTestSupermodule";
1113 TString volpath, symname;
1116 for (Int_t smodnum=0; smodnum < 1; smodnum++) {
1118 symname += (smodnum+1);
1120 volpath += (smodnum+1);
1121 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1122 AliFatal("Unable to set alignable entry!!");