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_t(g->GetECPbRadThick()+g->GetECScintThick());
103 if(gn.Contains("V1")) fSampleWidth += 2.*g->GetTrd1BondPaperThick();
104 AliDebug(2,Form("fGeometry %p : TVirtualMC::GetMC() %p : fSampleWidth %5.4f\n",
105 fGeometry, TVirtualMC::GetMC(), 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 // TVirtualMC::GetMC()->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 TVirtualMC::GetMC()->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ;
142 for(Int_t 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 TVirtualMC::GetMC()->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 TVirtualMC::GetMC()->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 TVirtualMC::GetMC()->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_t 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_t 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_t parSCM0[5]={0,0,0,0}, *dummy = 0, parTRAP[11];
244 if(!gn.Contains("V1")) {
245 Double_t wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() - g->GetPhiTileSize();
246 for(Int_t i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
247 parSCM0[3] = fParEMOD[3];
248 TVirtualMC::GetMC()->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
249 TVirtualMC::GetMC()->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
251 Double_t 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 TVirtualMC::GetMC()->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
257 Double_t zshift = g->GetTrd1AlFrontThick()/2.;
258 TVirtualMC::GetMC()->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 TVirtualMC::GetMC()->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_t i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
284 TVirtualMC::GetMC()->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
285 xpos = +(parSCM0[1]+parSCM0[0])/4.;
286 TVirtualMC::GetMC()->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 TVirtualMC::GetMC()->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_t 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 TVirtualMC::GetMC()->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_t iz=0; iz<g->GetNECLayers(); iz++){
306 par[0] = (parSCM0[0] + tanBetta*fSampleWidth*iz)/2.;
307 xpos = par[0] - xCenterSCMX;
308 TVirtualMC::GetMC()->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 TVirtualMC::GetMC()->Gsvolu("PAP1", "BOX", fIdTmedArr[kIdPAPER], par, 3);
320 xpos = par[0] - xCenterSCMX;
321 zpos = -parSCM0[3] + g->GetTrd1BondPaperThick()/2.;
322 TVirtualMC::GetMC()->Gspos("PAP1", 1, "SCMX", xpos, ypos, zpos, 0, "ONLY");
323 for(Int_t 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 TVirtualMC::GetMC()->Gsvolu(pa.Data(), "BOX", fIdTmedArr[kIdPAPER], par, 3);
331 xpos = par[0] - xCenterSCMX;
332 zpos = -parSCM0[3] + dz + par[2];
333 TVirtualMC::GetMC()->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 TVirtualMC::GetMC()->Gsvolu(pb.Data(), "BOX", fIdTmedArr[kIdPB], par, 3);
338 TVirtualMC::GetMC()->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_t 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);
354 //______________________________________________________________________
355 void AliEMCALv0::CreateSmod(const char* mother)
357 // 18-may-05; mother="XEN1";
358 // child="SMOD" from first to 10th, "SM10" (11th and 12th)
359 // "DCSM" from 13th to 18/22th (TRD1 case), "DCEXT"(18th and 19th) adapted for DCAL, Oct-23-2012
360 AliEMCALGeometry * g = GetGeometry();
361 TString gn(g->GetName()); gn.ToUpper();
363 Double_t par[3], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.;
364 Double_t parC[3] = {0};
368 // ===== define Super Module from air - 14x30 module ==== ;
369 AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data()));
370 par[0] = g->GetShellThickness()/2.;
371 par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
372 par[2] = g->GetEtaModuleSize()*g->GetNEta()/2.;
374 Int_t nSMod = g->GetNumberOfSuperModules();
375 Int_t nphism = nSMod/2; // 20-may-05
377 dphi = g->GetEMCGeometry()->GetPhiSuperModule();
378 rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.;
379 AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi));
382 if(gn.Contains("WSUC")) {
384 par[0] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
385 par[1] = g->GetShellThickness()/2.;
386 par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5;
388 TVirtualMC::GetMC()->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
390 AliDebug(2,Form("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
391 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
395 nphism = g->GetNumberOfSuperModules();
396 for(Int_t i=0; i<nphism; i++) {
397 xpos = ypos = zpos = 0.0;
399 TVirtualMC::GetMC()->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
400 printf(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
401 fIdRotm, phi, phiRad, xpos, ypos, zpos);
405 AliDebug(2,Form(" par[0] %7.2f (old) \n", par[0]));
406 for(Int_t i=0; i<3; i++) par[i] = g->GetSuperModulesPar(i);
411 for (Int_t smodnum = 0; smodnum < nSMod; ++smodnum) {
412 for(Int_t i=0; i<3; i++) parC[i] = par[i];
413 if(g->GetSMType(smodnum) == tmpType) {
416 tmpType = g->GetSMType(smodnum);
420 phiRad = g->GetPhiCenterOfSMSec(smodnum); // NEED phi= 90, 110, 130, 150, 170, 190(not center)...
421 phi = phiRad *180./TMath::Pi();
422 Double_t phiy = 90. + phi;
425 xpos = rpos * TMath::Cos(phiRad);
426 ypos = rpos * TMath::Sin(phiRad);
427 zpos = fSmodPar2; // 21-sep-04
428 if( tmpType == AliEMCALGeometry::kEMCAL_Standard ) {
430 } else if( tmpType == AliEMCALGeometry::kEMCAL_Half ) {
433 xpos += (par[1]/2. * TMath::Sin(phiRad));
434 ypos -= (par[1]/2. * TMath::Cos(phiRad));
435 } else if( tmpType == AliEMCALGeometry::kEMCAL_3rd ) {
438 xpos += (2.*par[1]/3. * TMath::Sin(phiRad));
439 ypos -= (2.*par[1]/3. * TMath::Cos(phiRad));
440 } else if( tmpType == AliEMCALGeometry::kDCAL_Standard ) {
443 zpos = fSmodPar2 + g->GetDCALInnerEdge()/2.; // 21-sep-04
444 } else if( tmpType == AliEMCALGeometry::kDCAL_Ext ) {
447 xpos += (2.*par[1]/3. * TMath::Sin(phiRad));
448 ypos -= (2.*par[1]/3. * TMath::Cos(phiRad));
449 } else AliError("Unkown SM Type!!");
451 if(SMOrder == 1) {//first time, create the SM
452 TVirtualMC::GetMC()->Gsvolu(smName.Data(), "BOX", fIdTmedArr[kIdAIR], parC, 3);
453 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]));
456 if( smodnum%2 == 1) {
458 if(phiy>=360.) phiy -= 360.;
462 AliMatrix(fIdRotm, 90.0, phi, 90.0, phiy, phiz, 0.0);
463 TVirtualMC::GetMC()->Gspos(smName.Data(), SMOrder, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
464 AliDebug(3, Form(" %s : %2i, fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n",
465 smName.Data(), SMOrder, fIdRotm, phi, phiRad, xpos, ypos, zpos, smodnum));
468 AliDebug(2,Form(" Number of Super Modules %i \n", nSMod));
471 if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
472 par[0] = g->GetSteelFrontThickness()/2.;
473 TVirtualMC::GetMC()->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3);
474 printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", fIdTmedArr[kIdSTEEL], par[0],par[1],par[2]);
475 xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.;
476 TVirtualMC::GetMC()->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
480 //______________________________________________________________________
481 void AliEMCALv0::CreateEmod(const char* mother, const char* child)
483 // 17-may-05; mother="SMOD"; child="EMOD"
485 AliEMCALGeometry * g = GetGeometry();
486 TString gn(g->GetName()); gn.ToUpper();
488 Double_t xpos=0., ypos=0., zpos=0.;
489 //Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad();tanTrd1 = TMath::Tan(trd1Angle/2.);
491 if(strcmp(mother,"SMOD")==0) {
492 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
493 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
494 fParEMOD[2] = g->GetPhiModuleSize()/2.;; // dy
495 fParEMOD[3] = g->GetLongModuleSize()/2.; // dz
496 TVirtualMC::GetMC()->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4);
501 // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0)
502 AliEMCALShishKebabTrd1Module *mod=0; // current module
504 for(Int_t iz=0; iz<g->GetNZ(); iz++) {
505 Double_t angle=90., phiOK=0;
506 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
507 angle = mod->GetThetaInDegree();
508 if(!gn.Contains("WSUC")) { // ALICE
509 AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.);
510 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
511 AliDebug(4,Form(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
512 iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule()));
513 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
514 zpos = mod->GetPosZ() - fSmodPar2;
516 Int_t iyMax = g->GetNPhi();
517 if(strcmp(mother,"SM10") == 0 ) {
519 } else if(strcmp(mother,"SM3rd") == 0 ) {
521 } else if(strcmp(mother,"DCEXT") == 0 ) {
523 } else if(strcmp(mother,"DCSM") == 0 ) {
524 if(iz < 8 ) continue;//!!!DCSM from 8th to 23th
525 zpos = mod->GetPosZ() - fSmodPar2 - g->GetDCALInnerEdge()/2.;
526 } else if(strcmp(mother,"SMOD") != 0 )
527 AliError("Unknown super module Type!!");
528 for(Int_t iy=0; iy<iyMax; iy++) { // flat in phi
529 ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
530 TVirtualMC::GetMC()->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
532 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm);
533 AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
537 if(iz == 0) AliMatrix(fIdRotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y)
538 else AliMatrix(fIdRotm, 90-angle,270., 90.0,0.0, angle,90.);
539 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
540 AliDebug(4,Form(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
541 iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule()));
542 zpos = mod->GetPosZ() - fSmodPar2;
543 ypos = mod->GetPosXfromR() - fSmodPar1;
544 //printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm);
545 for(Int_t ix=0; ix<g->GetNPhi(); ix++)
547 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
548 TVirtualMC::GetMC()->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
549 //printf(" %7.2f ", xpos);
554 AliDebug(2,Form(" Number of modules in Super Module(%s) %i \n", mother, nr));
557 void AliEMCALv0::CreateAlFrontPlate(const char* mother, const char* child)
559 // Oct 26,2010 : Al front plate : ALFP
560 AliEMCALGeometry * g = GetGeometry();
561 TString gn(g->GetName()); gn.ToUpper();
562 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
563 Double_t parALFP[5], zposALFP=0.;
565 parALFP[0] = g->GetEtaModuleSize()/2. - g->GetLateralSteelStrip(); // dx1
566 parALFP[1] = parALFP[0] + tanTrd1*g->GetTrd1AlFrontThick(); // dx2
567 parALFP[2] = g->GetPhiModuleSize()/2. - g->GetLateralSteelStrip(); // dy
568 parALFP[3] = g->GetTrd1AlFrontThick()/2.; // dz
569 TVirtualMC::GetMC()->Gsvolu(child, "TRD1", fIdTmedArr[kIdAL], parALFP, 4);
570 zposALFP = -fParEMOD[3] + g->GetTrd1AlFrontThick()/2.;
571 TVirtualMC::GetMC()->Gspos (child, 1, mother, 0.0, 0.0, zposALFP, 0, "ONLY");
574 //______________________________________________________________________
575 void AliEMCALv0::Trd1Tower3X3(const Double_t *parSCM0)
577 // Started Dec 8,2004 by PAI
579 printf(" AliEMCALv0::Trd1Tower3X3() : parSCM0");
580 for(Int_t i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
582 // Nov 10, 2006 - different name of SCMX
583 Double_t parTRAP[11], *dummy=0;
584 AliEMCALGeometry * g = GetGeometry();
585 TString gn(g->GetName()), scmx;
587 // Division to tile size
588 AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv()));
589 TVirtualMC::GetMC()->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
590 Double_t dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3];
591 Double_t ndiv=3., xpos=0.0;
592 // should be defined once
593 TVirtualMC::GetMC()->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
594 for(Int_t ix=1; ix<=3; ix++) { // 3X3
595 scmx = "SCX"; // Nov 10,2006
598 Double_t xCentBot = 2.*dx1/3.;
599 Double_t xCentTop = 2.*(dx2/4. + dx1/12.);
600 parTRAP[1] = TMath::ATan2((xCentTop-xCentBot),2.*dz)*TMath::RadToDeg(); // theta
601 parTRAP[2] = 0.; // phi
603 parTRAP[3] = dy/ndiv; // H1
604 parTRAP[4] = dx1/ndiv; // BL1
605 parTRAP[5] = parTRAP[4]; // TL1
606 parTRAP[6] = 0.0; // ALP1
608 parTRAP[7] = dy/ndiv; // H2
609 parTRAP[8] = dx2/2 - dx1/6.;// BL2
610 parTRAP[9] = parTRAP[8]; // TL2
611 parTRAP[10]= 0.0; // ALP2
612 xpos = (xCentBot+xCentTop)/2.;
615 parTRAP[1] = -parTRAP[1];
617 } else if(ix==2) { // central part is box but we treat as trapesoid due to numbering
619 parTRAP[8] = dx1/ndiv; // BL2
620 parTRAP[9] = parTRAP[8]; // TL2
623 AliDebug(2,Form(" ** TRAP ** xpos %9.3f\n", xpos));
624 for(Int_t i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
627 TVirtualMC::GetMC()->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
628 TVirtualMC::GetMC()->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
630 PbInTrap(parTRAP, scmx);
632 AliDebug(2,"Trd1Tower3X3 - Ver. 1.0 : was tested.");
636 //______________________________________________________________________
637 void AliEMCALv0::PbInTrap(const Double_t parTRAP[11], TString n)
639 // see for example CreateShishKebabGeometry(); just for case TRD1
641 AliDebug(2,Form(" Pb tiles : nrstart %i\n", nr));
642 AliEMCALGeometry * g = GetGeometry();
645 Double_t xpos = 0.0, ypos = 0.0;
646 Double_t zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
648 Double_t coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
649 Double_t xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // ??
650 // Double_t tan = TMath::Tan(parTRAP[1]*TMath::DegToRad());
652 par[1] = parTRAP[3]; // y
653 par[2] = g->GetECPbRadThick()/2.; // z
654 for(Int_t iz=0; iz<g->GetNECLayers(); iz++){
655 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
656 xpos = par[0] - xCenterSCMX;
657 if(parTRAP[1] < 0.) xpos = -xpos;
658 TVirtualMC::GetMC()->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
659 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
660 zpos += fSampleWidth;
661 if(iz%2>0) printf("\n");
663 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
664 AliDebug(2,Form(" par[1] %9.3f par[2] %9.3f ypos %9.3f \n", par[1], par[2], ypos));
665 AliDebug(2,Form(" PbInTrap Ver. 1.0 : was tested."));
668 //______________________________________________________________________
669 void AliEMCALv0::Trd1Tower1X1(Double_t *parSCM0)
671 // Started Nov 22,2006 by PAI
672 AliDebug(1," AliEMCALv0::Trd1Tower1X1() : parSCM0");
673 for(Int_t i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
676 // No division - keeping the same volume logic
677 // and as consequence the same abs is scheme
678 AliDebug(2,"Trd1Tower1X1() : Create SCMX(SCMY) as SCM0");
680 TVirtualMC::GetMC()->Gsvolu("SCMY", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
681 TVirtualMC::GetMC()->Gspos("SCMY", 1, "SCM0", 0.0, 0.0, 0.0, 0, "ONLY");
682 TVirtualMC::GetMC()->Gsvolu("SCMX", "TRD1", fIdTmedArr[kIdSC], parSCM0, 4);
683 TVirtualMC::GetMC()->Gspos("SCMX", 1, "SCMY", 0.0, 0.0, 0.0, 0, "ONLY");
685 // should be defined once
687 TVirtualMC::GetMC()->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
689 PbInTrd1(parSCM0, "SCMX");
691 AliDebug(1,"Trd1Tower1X1() : Ver. 0.1 : was tested.");
694 //______________________________________________________________________
695 void AliEMCALv0::PbInTrd1(const Double_t *parTrd1, TString n)
697 // see PbInTrap(const Double_t parTrd1[11], TString n)
698 static Int_t nr=0, ndeb=2;
699 AliDebug(ndeb,Form(" Pb tiles : nrstart %i\n", nr));
700 AliEMCALGeometry * g = GetGeometry();
703 Double_t xpos = 0.0, ypos = 0.0;
704 Double_t zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
705 Double_t coef = (parTrd1[1] - parTrd1[0]) / (2.*parTrd1[3]);
707 par[1] = parTrd1[2]; // y
708 par[2] = g->GetECPbRadThick()/2.; // z
710 for(Int_t iz=0; iz<g->GetNECLayers(); iz++){
711 par[0] = parTrd1[0] + coef*fSampleWidth*iz;
712 TVirtualMC::GetMC()->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
713 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
714 zpos += fSampleWidth;
715 if(iz%2>0) printf("\n");
717 AliDebug(ndeb,Form(" Number of Pb tiles in SCMX %i coef %9.7f ", nr, coef));
718 AliDebug(ndeb,Form(" PbInTrd1 Ver. 0.1 : was tested."));
721 //______________________________________________________________________
722 AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta)
725 AliEMCALShishKebabTrd1Module* trd1=0;
726 if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) {
727 trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta);
732 //_____________________________________________________________________________
733 void AliEMCALv0::AddAlignableVolumes() const
735 //Add volumes which are alignable (?)
736 TString ntmp(GetTitle()); // name of EMCAL geometry
738 if(ntmp.Contains("WSUC")) {
739 AddAlignableVolumesInWSUC(); // WSUC case
741 AddAlignableVolumesInALICE(); // ALICE case
745 //______________________________________________________________________
746 void AliEMCALv0::AddAlignableVolumesInALICE() const
749 // Create entries for alignable volumes associating the symbolic volume
750 // name with the corresponding volume path. Needs to be synchronized with
751 // eventual changes in the geometry.
754 Float_t pars[] = {GetGeometry()->GetSuperModulesPar(0),GetGeometry()->GetSuperModulesPar(1),GetGeometry()->GetSuperModulesPar(2)};
755 Double_t rpos = (GetGeometry()->GetEnvelop(0) + GetGeometry()->GetEnvelop(1))/2.;
756 Double_t phi, phiRad, xpos, ypos, zpos;
758 AliGeomManager::ELayerID idEMCAL = AliGeomManager::kEMCAL;
759 Int_t modUID, modnum = 0;
760 TString volpath, symname;
762 AliEMCALGeometry * geom = GetGeometry();
763 Int_t nSMod = geom->GetNumberOfSuperModules();
769 for (Int_t smodnum = 0; smodnum < nSMod; ++smodnum) {
770 modUID = AliGeomManager::LayerToVolUID(idEMCAL,modnum++);
771 if(geom->GetSMType(smodnum) == AliEMCALGeometry::kEMCAL_Standard ) { SMPathName = "SMOD"; SMName = "FullSupermodule";}
772 else if(geom->GetSMType(smodnum) == AliEMCALGeometry::kEMCAL_Half ) { SMPathName = "SM10"; SMName = "HalfSupermodule";}
773 else if(geom->GetSMType(smodnum) == AliEMCALGeometry::kEMCAL_3rd ) { SMPathName = "SM3rd"; SMName = "OneThrdSupermodule";}
774 else if( geom->GetSMType(smodnum) == AliEMCALGeometry::kDCAL_Standard ) { SMPathName = "DCSM"; SMName = "DCALSupermodule";}
775 else if( geom->GetSMType(smodnum) == AliEMCALGeometry::kDCAL_Ext ) { SMPathName = "DCEXT"; SMName = "DCALExtensionSM";}
776 else AliError("Unkown SM Type!!");
778 if(geom->GetSMType(smodnum) == tmpType) {
781 tmpType = geom->GetSMType(smodnum);
785 volpath.Form("ALIC_1/XEN1_1/%s_%d",SMPathName.Data(), SMOrder);
786 symname.Form("EMCAL/%s%d",SMName.Data(), SMOrder);
788 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
789 AliFatal(Form("AliEMCALv0::Unable to set alignable entry!!\nName: %s\t Path: %s\t ModuleID: %d\n",symname.Data(),volpath.Data(), modUID));
791 // Creates the Tracking to Local transformation matrix for EMCAL
793 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID) ;
795 phiRad = GetGeometry()->GetPhiCenterOfSM(smodnum); //comes in radians, not degrees
796 phi = phiRad*180./TMath::Pi(); //need degrees for rot. matrix
797 xpos = rpos * TMath::Cos(phiRad);
798 ypos = rpos * TMath::Sin(phiRad);
800 if( geom->GetSMType(smodnum) == AliEMCALGeometry::kEMCAL_Half ) {
801 xpos += (pars[1]/2. * TMath::Sin(phiRad)); // half SM!
802 ypos -= (pars[1]/2. * TMath::Cos(phiRad));
803 } else if ( geom->GetSMType(smodnum) == AliEMCALGeometry::kEMCAL_3rd || geom->GetSMType(smodnum) == AliEMCALGeometry::kDCAL_Ext ) {
804 xpos += (pars[1]/3. * TMath::Sin(phiRad)); // one_third SM !
805 ypos -= (pars[1]/3. * TMath::Cos(phiRad));
806 } else if( geom->GetSMType(smodnum) == AliEMCALGeometry::kDCAL_Standard ) {
807 zpos = pars[2]*2./3. + GetGeometry()->GetDCALInnerEdge()/2.;
810 AliDebug(3, Form(" fIdRotm %3i phi %6.13f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : smodnum %i \n",
811 fIdRotm, phi, phiRad, xpos, ypos, zpos, smodnum));
813 TGeoHMatrix *matTtoL;
814 TGeoHMatrix *globMatrix = alignableEntry->GetGlobalOrig();
818 TGeoTranslation geoTran0(xpos, ypos, zpos);
819 TGeoRotation geoRot0("geoRot0", 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
820 TGeoCombiTrans mat0(geoTran0, geoRot0);
821 matTtoL = new TGeoHMatrix(mat0);
823 matTtoL->MultiplyLeft(&(globMatrix->Inverse()));
824 alignableEntry->SetMatrix(matTtoL);
828 Double_t phiy = 90. + phi + 180.;
829 if(phiy>=360.) phiy -= 360.;
830 TGeoTranslation geoTran1(xpos,ypos,-zpos);
831 TGeoRotation geoRot1("geoRot1", 90.0, phi, 90.0, phiy, 180.0, 0.0);
832 TGeoCombiTrans mat1(geoTran1, geoRot1);
833 matTtoL = new TGeoHMatrix(mat1);
835 matTtoL->MultiplyLeft(&(globMatrix->Inverse()));
836 alignableEntry->SetMatrix(matTtoL);
844 //______________________________________________________________________
845 void AliEMCALv0::AddAlignableVolumesInWSUC() const
848 // Create entries for alignable volumes associating the symbolic volume
849 // name with the corresponding volume path. Needs to be synchronized with
850 // eventual changes in the geometry.
853 TString vpstr1 = "WSUC_1/XEN1_1/SMOD_";
854 TString snstr1 = "EMCAL/CosmicTestSupermodule";
855 TString volpath, symname;
858 for (Int_t smodnum=0; smodnum < 1; smodnum++) {
860 symname += (smodnum+1);
862 volpath += (smodnum+1);
863 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
864 AliFatal("Unable to set alignable entry!!");