1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 //_________________________________________________________________________
18 // Implementation version v0 of EMCAL Manager class
19 // An object of this class does not produce hits nor digits
20 // It is the one to use if you do not want to produce outputs in TREEH or TREED
21 // This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx
22 //*-- Author: Yves Schutz (SUBATECH)
23 //*-- and : Sahal Yacoob (LBL / UCT)
24 // : Aleksei Pavlinov (WSU) SHASHLYK
26 // --- ROOT system ---
36 #include <TGeometry.h>
37 #include <TGeoPhysicalNode.h>
38 #include <TGeoManager.h>
39 #include <TVirtualMC.h>
46 #include "AliEMCALShishKebabModule.h"
47 #include "AliEMCALShishKebabTrd1Module.h"
49 // --- Standard library ---
53 // --- AliRoot header files ---
55 #include "AliEMCALv0.h"
56 #include "AliEMCALGeometry.h"
72 //______________________________________________________________________
73 AliEMCALv0::AliEMCALv0()
75 fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
76 fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0)
81 //______________________________________________________________________
82 AliEMCALv0::AliEMCALv0(const char *name, const char *title)
83 : AliEMCAL(name,title),
84 fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
85 fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0)
87 // ctor : title is used to identify the layout
89 // Nov 22, 2006 - case of 1X1
90 TString ntmp(GetTitle());
92 if(ntmp == "TRD1") { // TRD1 is alias for SHISH_77_TRD1_2X2_FINAL_110DEG NL=69
93 ntmp = "SHISH_77_TRD1_2X2_FINAL_110DEG NL=69";
94 SetTitle(ntmp.Data());
97 AliEMCALGeometry *geom = GetGeometry() ;
98 //geom->CreateListOfTrd1Modules();
99 fShishKebabModules = geom->GetShishKebabTrd1Modules();
102 //______________________________________________________________________
103 void AliEMCALv0::BuildGeometry()
105 // Display Geometry for display.C
107 const Int_t kColorArm1 = kBlue ;
109 AliEMCALGeometry * geom = GetGeometry();
111 TString gn(geom->GetName());
114 // Define the shape of the Calorimeter
115 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
116 TNode * envelopNode = 0;
117 char *envn = "Envelop1";
118 if(!gn.Contains("SHISH") || gn.Contains("TRD2")){
119 new TTUBS(envn, "Tubs that contains arm 1", "void",
120 geom->GetEnvelop(0) -10, // rmin
121 geom->GetEnvelop(1) +40 ,// rmax
122 geom->GetEnvelop(2)/2.0, // half length in Z
123 geom->GetArm1PhiMin(), // minimum phi angle
124 geom->GetArm1PhiMax() // maximum phi angle
127 envelopNode = new TNode(envn, "Arm1 Envelop", "Envelop1", 0., 0., 0., "") ;
129 if(gn.Contains("WSUC")) {
130 envelopNode = BuildGeometryOfWSUC();
131 } else { // Shish-kebab now for compact, twist and TRD1 cases (ALIC)
133 TPGON *pgon = new TPGON(envn, "PGON that contains arm 1", "void",
134 geom->GetArm1PhiMin(),geom->GetArm1PhiMax()-geom->GetArm1PhiMin(),geom->GetNPhiSuperModule(), 2);
136 if (fEnvelop1.GetSize()<8) {
138 fEnvelop1[0] = geom->GetArm1PhiMin(); // minimum phi angle
139 fEnvelop1[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
140 fEnvelop1[2] = geom->GetNPhi(); // number of sections in phi
141 fEnvelop1[3] = 2; // 2 z coordinates
142 fEnvelop1[4] = -350.;
143 fEnvelop1[5] = geom->GetEnvelop(0) ; // rmin at z1
144 fEnvelop1[6] = geom->GetEnvelop(1) ; // rmax at z1
146 fEnvelop1[8] = fEnvelop1[5] ; // radii are the same.
147 fEnvelop1[9] = fEnvelop1[6] ; // radii are the same.
149 if(gn.Contains("SHISH"))
150 fEnvelop1[2] = geom->GetNPhiSuperModule();
152 pgon->DefineSection(0, fEnvelop1[4], fEnvelop1[5], fEnvelop1[6]);
153 pgon->DefineSection(1, fEnvelop1[7], fEnvelop1[5], fEnvelop1[6]);
155 envelopNode = new TNode(envn, "Arm1 Envelop2", envn, 0., 0., 0., "") ;
159 envelopNode->SetLineColor(kColorArm1) ;
160 fNodes->Add(envelopNode);
163 TNode *AliEMCALv0::BuildGeometryOfWSUC()
165 // June 8, 2005; see directory geant3/TGeant3/G3toRoot.cxx
166 // enum EColor { kWhite, kBlack, kRed, kGreen, kBlue, kYellow, kMagenta, kCyan } - see $ROOTSYS/include/Gtypes.h
167 AliEMCALGeometry * g = GetGeometry();
168 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
171 TNode *envelopNode = 0;
175 new TBRIK(name, "WSUC(XEN1 in Geant)","void",fEnvelop1[0],fEnvelop1[1],fEnvelop1[2]);
176 envelopNode = new TNode(name, "envelope for WSUC", name, 0., 0., 0., "");
177 envelopNode->SetVisibility(0);
180 TNode *emod=0, *scmx=0;
181 name = "SMOD"; // super module
182 new TBRIK(name, "SMOD(SMOD in Geant)","void", fSmodPar0,fSmodPar1,fSmodPar2);
183 if(envelopNode) envelopNode->cd();
184 TNode *smod = new TNode(name, "SMOD", name, 0., 0., 0., "");
185 smod->SetLineColor(kBlue) ;
186 if(envelopNode==0) envelopNode = smod;
188 name = "EMOD"; // see CreateEMOD
189 TTRD1 *emodTrd1 = new TTRD1(name, "EMOD(EMOD in Geant)","void", float(fParEMOD[0]),
190 float(fParEMOD[1]),float(fParEMOD[2]),float(fParEMOD[3]));
192 // SCMX = EMOD/4 for simplicity of drawing
194 Float_t dz=0.,theta=0.,phi=0.,h1=0.,bl1=0.,tl1=0.,alpha1=0.,h2=0.,bl2=0.,tl2=0.,alpha2=0.;
195 h1 = emodTrd1->GetDy()/2.;
196 bl1 = emodTrd1->GetDx()/2.;
199 h2 = emodTrd1->GetDy()/2.;
200 bl2 = emodTrd1->GetDx2()/2.;
204 dz = emodTrd1->GetDz();
205 double dr = TMath::Sqrt((h2-h1)*(h2-h1)+(bl2-bl1)*(bl2-bl1));
206 theta = TMath::ATan2(dr,2.*dz) * TMath::RadToDeg();
209 TTRAP *scmxTrap = new TTRAP(name, "SCMX(SCMX as in Geant)","void",
210 dz,theta,phi, h1,bl1,tl1,alpha1, h2,bl2,tl2,alpha2);
212 Float_t xShiftSCMX = (emodTrd1->GetDx() + emodTrd1->GetDx2())/4.;
213 Float_t yShiftSCMX = emodTrd1->GetDy()/2.;
214 printf(" xShiftSCMX %7.4f yShiftSCMX %7.4f \n",xShiftSCMX,yShiftSCMX);
216 name = "EMOD"; // see CreateEMOD
219 AliEMCALShishKebabTrd1Module *mod=0;
220 Double_t angle=90., xpos=0.,ypos=0.,zpos=0., xposSCMX=0.,yposSCMX=0.,zposSCMX=0.;
221 char rtmn[100], rtmt[100];
222 TRotMatrix *rtm=0, *rtmSCMX=0;
224 for(int iz=0; iz<g->GetNZ(); iz++) {
225 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
226 zpos = mod->GetPosZ() - fSmodPar2;
227 ypos = mod->GetPosXfromR() - fSmodPar1;
229 angle = mod->GetThetaInDegree();
230 sprintf(rtmn,"rmEmod%5.1f",angle);
231 sprintf(rtmt,"rotation matrix for EMOD, iz=%i, angle = %6.3f",iz, angle);
232 if(iz==0) rtm = new TRotMatrix(rtmn, rtmt,0.,0., 90.,0., 90.,90.); // z'(x); y'(y); x'(z)
233 else rtm = new TRotMatrix(rtmn, rtmt,90.-angle,270., 90.0,0.0, angle,90.);
235 TGeometry *tg = gAlice->GetGeometry();
236 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
237 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
238 sprintf(rtmt,"EMOD, iz %i, ix %i, angle %6.3f",iz,ix, angle);
239 TString namNode=name;
240 namNode += numEmod++;
242 emod = new TNode(namNode.Data(), rtmt, (TShape*)emodTrd1, xpos,ypos,zpos,rtm);
243 // emod->SetLineColor(kGreen) ;
244 emod->SetVisibility(0); // SCMX will bi visible
245 if(scmxTrap) { // 4(2x2) sensetive volume inside EMOD
248 for(int jy=0; jy<2; jy++){ // division on y
249 yposSCMX = yShiftSCMX *(2*jy - 1);
250 for(int jx=0; jx<2; jx++){ // division on x
251 Double_t theta1=90.,phi1=0., theta2=90.,phi2=90., theta3=0.,phi3=0 ;
252 xposSCMX = xShiftSCMX *(2*jx - 1);
256 sprintf(rtmn,"rm%s",namNode.Data());
257 sprintf(rtmt,"rotation matrix for %s inside EMOD",namNode.Data());
258 rtmSCMX = tg->GetRotMatrix(rtmn);
260 phi1 = 180.; // x' = -x
261 phi2 = 270.; // y' = -y
263 if(rtmSCMX == 0) rtmSCMX = new TRotMatrix(rtmn,rtmt, theta1,phi1, theta2,phi2, theta3,phi3);
264 sprintf(rtmt,"%s inside %s", namNode.Data(), emod->GetName());
265 scmx = new TNode(namNode.Data(), rtmt, (TShape*)scmxTrap, xposSCMX,yposSCMX,zposSCMX,rtmSCMX);
266 scmx->SetLineColor(kMagenta);
272 // emod->Draw(); // for testing
277 //______________________________________________________________________
278 void AliEMCALv0::CreateGeometry()
280 // Create the EMCAL geometry for Geant
281 // Geometry of a tower
282 //|-----------------------------------------------------| XEN1
284 //| | Al thickness = GetAlFrontThickness() | |
288 //| ------------------------------------------------- |
289 //| | Air Gap = GetGap2Active() | |
291 //| ------------------------------------------------- |
292 //| | XU1 : XPST (ECAL e = GetECScintThick() ) | |
293 //| ------------------------------------------------- |
294 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
295 //| ------------------------------------------------- |
296 //| | XU1 : XPST (ECAL e = GetECScintThick() | |
297 //| ------------------------------------------------- |
298 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
299 //| ------------------------------------------------- |
300 //| etc ..... GetNECLayers() - 1 times |
301 //| ------------------------------------------------- |
302 //| | XUNLayer : XPST (ECAL e = GetECScintThick() | |
303 //| ------------------------------------------------- |
305 AliEMCALGeometry * geom = GetGeometry() ;
306 TString gn(geom->GetName());
309 if(!(geom->IsInitialized())){
310 Error("CreateGeometry","EMCAL Geometry class has not been set up.");
313 // Get pointer to the array containing media indices
314 fIdTmedArr = fIdtmed->GetArray() - 1599 ;
317 // gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule
318 AliMatrix(fIdRotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
320 // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1
322 Float_t envelopA[10];
323 if(gn.Contains("TRD2")) { // TUBS
324 envelopA[0] = geom->GetEnvelop(0) - 10.; // rmin
325 envelopA[1] = geom->GetEnvelop(1) + 12.; // rmax
326 // envelopA[2] = geom->ZFromEtaR(geom->GetEnvelop(1), geom->GetArm1EtaMin());
327 envelopA[2] = 390.; // 6-feb-05
328 envelopA[3] = geom->GetArm1PhiMin();
329 envelopA[4] = geom->GetArm1PhiMax();
330 gMC->Gsvolu("XEN1", "TUBS", fIdTmedArr[kIdAIR], envelopA, 5) ; // Tubs filled with air
331 fEnvelop1.Set(5, envelopA);
332 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
333 gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
334 } else if(gn.Contains("TRD1") && gn.Contains("WSUC") ) { // TRD1 for WSUC facility
335 // 17-may-05 - just BOX
339 gMC->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ;
341 for(int i=0; i<3; i++) fEnvelop1[i] = envelopA[i]; // 23-may-05
342 // Position the EMCAL Mother Volume (XEN1) in WSUC
343 gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
345 envelopA[0] = geom->GetArm1PhiMin(); // minimum phi angle
346 envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
347 envelopA[2] = geom->GetNPhi(); // number of sections in phi
348 envelopA[3] = 2; // 2 z coordinates
349 // envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1),
350 //geom->GetArm1EtaMin()); // z coordinate 1
351 envelopA[4] = -350.; // AM 30/5/2006
353 //add some padding for mother volume
354 envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1
355 envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1
356 // envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1),
357 // geom->GetArm1EtaMax()); // z coordinate 2
358 envelopA[7] = 350.; // AM 30/5/2006
360 envelopA[8] = envelopA[5] ; // radii are the same.
361 envelopA[9] = envelopA[6] ; // radii are the same.
363 if(gn.Contains("SHISH")) envelopA[2] = geom->GetNPhiSuperModule();
365 gMC->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ; // Polygone filled with air
366 fEnvelop1.Set(10, envelopA);
368 printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]);
369 printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]);
371 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
372 gMC->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
375 if(gn.Contains("SHISH")){
376 // COMPACT, TWIST, TRD2 or TRD1
377 AliDebug(2,Form("Shish-Kebab geometry : %s", GetTitle()));
378 CreateShishKebabGeometry();
382 //______________________________________________________________________
383 void AliEMCALv0::Init(void)
385 // Just prints an information message
387 if(AliLog::GetGlobalDebugLevel()>0) {
388 TString message("\n") ;
389 message += "*****************************************\n" ;
391 // Here the EMCAL initialisation code (if any!)
393 AliEMCALGeometry * geom = GetGeometry() ;
396 message += "AliEMCAL " ;
397 message += Version() ;
398 message += "EMCAL geometry initialized for " ;
399 message += geom->GetName() ;
402 message += "AliEMCAL " ;
403 message += Version() ;
404 message += "EMCAL geometry initialization failed !" ;
406 message += "\n*****************************************" ;
407 printf(message.Data() ) ;
412 void AliEMCALv0::CreateShishKebabGeometry()
414 // TWIST, TRD1 and TRD2
415 AliEMCALGeometry * g = GetGeometry();
416 TString gn(g->GetName()); gn.ToUpper();
417 // see AliModule::fFIdTmedArr
418 // fIdTmedArr = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials()
419 // int kIdAIR=1599, kIdPB = 1600, kIdSC = 1601, kIdSTEEL = 1603;
421 Double_t par[10], xpos=0., ypos=0., zpos=0.;
423 CreateSmod(g->GetNameOfEMCALEnvelope());
425 CreateEmod("SMOD","EMOD"); // 18-may-05
427 if(g->GetKey110DEG()) CreateEmod("SM10","EMOD"); // Nov 1,2006
429 // Sensitive SC (2x2 tiles)
430 double parSCM0[5]={0,0,0,0}, *dummy = 0, parTRAP[11];
431 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTmp = TMath::Tan(trd1Angle/2.);
432 if(!gn.Contains("TRD")) { // standard module
433 par[0] = (g->GetECPbRadThick()+g->GetECScintThick())*g->GetNECLayers()/2.;
434 par[1] = par[2] = g->GetPhiTileSize(); // Symetric case
435 gMC->Gsvolu("SCM0", "BOX", fIdTmedArr[kIdSC], par, 3); // 2x2 tiles
436 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
437 // Division to tile size
438 gMC->Gsdvn("SCM1","SCM0", g->GetNPHIdiv(), 2); // y-axis
439 gMC->Gsdvn("SCM2","SCM1", g->GetNETAdiv(), 3); // z-axis
440 // put LED to the SCM2
441 par[0] = g->GetECPbRadThick()/2.;
442 par[1] = par[2] = g->GetPhiTileSize()/2.; // Symetric case
443 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], par, 3);
445 printf(" Pb tiles \n");
448 xpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
449 for(int ix=0; ix<g->GetNECLayers(); ix++){
450 gMC->Gspos("PBTI", ++nr, "SCM2", xpos, ypos, zpos, 0, "ONLY") ;
451 // printf(" %i xpos %f \n", ix+1, xpos);
452 xpos += fSampleWidth;
454 printf(" Number of Pb tiles in SCM2 %i \n", nr);
455 } else if(gn.Contains("TRD1")) { // TRD1 - 30-sep-04
456 if(gn.Contains("MAY05")){
457 Double_t dzTmp = g->GetFrontSteelStrip()+g->GetPassiveScintThick();
458 parSCM0[0] = fParEMOD[0] + tanTmp*dzTmp; // dx1
459 parSCM0[1] = fParEMOD[1]; // dx2
460 parSCM0[2] = fParEMOD[2]; // dy
461 for(int i=0; i<3; i++) parSCM0[i] -= g->GetLateralSteelStrip();
462 parSCM0[3] = fParEMOD[3] - dzTmp/2.; // dz
464 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
465 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., dzTmp/2., 0, "ONLY") ;
466 } else { // before MAY 2005
467 // double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); // Need check
468 double wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() - g->GetPhiTileSize();
469 for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
470 parSCM0[3] = fParEMOD[3];
471 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
472 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
475 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
476 // Division to tile size - 1-oct-04
477 AliDebug(2,Form(" Divide SCM0 on y-axis %i\n", g->GetNETAdiv()));
478 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
480 parTRAP[0] = parSCM0[3]; // dz
481 parTRAP[1] = TMath::ATan2((parSCM0[1]-parSCM0[0])/2.,2.*parSCM0[3])*180./TMath::Pi(); // theta
482 parTRAP[2] = 0.; // phi
484 parTRAP[3] = parSCM0[2]/2.; // H1
485 parTRAP[4] = parSCM0[0]/2.; // BL1
486 parTRAP[5] = parTRAP[4]; // TL1
487 parTRAP[6] = 0.0; // ALP1
489 parTRAP[7] = parSCM0[2]/2.; // H2
490 parTRAP[8] = parSCM0[1]/2.; // BL2
491 parTRAP[9] = parTRAP[8]; // TL2
492 parTRAP[10]= 0.0; // ALP2
493 AliDebug(2,Form(" ** TRAP ** \n"));
494 for(int i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
496 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
497 xpos = +(parSCM0[1]+parSCM0[0])/4.;
498 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
500 // Using rotation because SCMX should be the same due to Pb tiles
502 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
503 gMC->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, fIdRotm, "ONLY");
504 // put LED to the SCM0
505 AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0);
506 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
508 par[1] = parSCM0[2]/2; // y
509 par[2] = g->GetECPbRadThick()/2.; // z
513 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
514 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.;
515 if(!gn.Contains("NOPB")) { // for testing - 11-jul-05
516 AliDebug(2,Form(" Pb tiles \n"));
517 for(int iz=0; iz<g->GetNECLayers(); iz++){
518 par[0] = (parSCM0[0] + mod->GetTanBetta()*fSampleWidth*iz)/2.;
519 xpos = par[0] - xCenterSCMX;
520 gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
521 AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]));
522 zpos += fSampleWidth;
524 AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr));
526 } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) {
527 printf(" before AliEMCALv0::Trd1Tower3X3() : parSCM0");
528 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
530 Trd1Tower3X3(parSCM0);
531 } else if(g->GetNPHIdiv()==1 && g->GetNETAdiv()==1) {
532 // no division in SCM0
533 Trd1Tower1X1(parSCM0);
534 } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) {
537 } else if(gn.Contains("TRD2")) { // TRD2 - 14-jan-05
538 // Scm0InTrd2(g, fParEMOD, parSCM0); // First dessin
539 PbmoInTrd2(g, fParEMOD, parSCM0); // Second design
543 void AliEMCALv0::CreateSmod(const char* mother)
545 // 18-may-05; mother="XEN1";
546 // child="SMOD" from first to 10th, "SM10" (11th and 12th) (TRD1 case)
547 // child="SMON" and "SMOP"("TRD2" case)
548 AliEMCALGeometry * g = GetGeometry();
549 TString gn(g->GetName()); gn.ToUpper();
551 Double_t par[3], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.;
553 // ===== define Super Module from air - 14x30 module ==== ;
554 fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
555 AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data()));
556 par[0] = g->GetShellThickness()/2.;
557 par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
558 par[2] = g->GetEtaModuleSize()*15.;
560 int nphism = g->GetNumberOfSuperModules()/2; // 20-may-05
562 dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/nphism;
563 // if(g->GetKey110DEG()) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1);
564 rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.;
565 AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi));
568 if (gn.Contains("TRD2")) { // tubs - 27-jan-05
569 parTubs[0] = g->GetTubsR(); // rmin
570 parTubs[1] = parTubs[0] + g->GetShellThickness(); // rmax ??
571 parTubs[2] = 380./2.; // DZ half length in z; 11-oct-04 - for 26 division
572 parTubs[3] = -dphi/2.; // PHI1 starting angle of the segment;
573 parTubs[4] = +dphi/2.; // PHI2 ending angle of the segment;
575 gMC->Gsvolu("SMOP", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // pozitive Z
576 gMC->Gsvolu("SMON", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // negative Z
578 AliDebug(2,Form(" SMOP,N ** TUBS **\n"));
579 AliDebug(2,Form("tmed %i | Rmin %7.2f Rmax %7.2f dz %7.2f phi1,2 (%7.2f,%7.2f)\n",
580 fIdTmedArr[kIdAIR], parTubs[0],parTubs[1],parTubs[2], parTubs[3],parTubs[4]));
581 // have to add 1 cm plastic before EMOD - time solution
582 } else if(gn.Contains("WSUC")) {
583 par[0] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
584 par[1] = g->GetShellThickness()/2.;
585 par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5;
587 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
589 AliDebug(2,Form("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
590 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
594 nphism = g->GetNumberOfSuperModules();
596 if (gn.Contains("TWIST")) {
597 par[2] += 0.4; // for 27 division
598 } else if(gn.Contains("TRD")) {
599 par[2] = 350./2.; // 11-oct-04 - for 26 division
600 if(gn.Contains("TRD1")) {
601 AliDebug(2,Form(" par[0] %7.2f (old) \n", par[0]));
602 Float_t *parSM = g->GetSuperModulesPars();
603 for(int i=0; i<3; i++) par[i] = parSM[i];
606 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
607 AliDebug(2,Form("tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
608 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
611 if(g->GetKey110DEG()) { // 12-oct-05
614 gMC->Gsvolu("SM10", "BOX", fIdTmedArr[kIdAIR], par, 3);
615 AliDebug(2,Form(" Super module with name \"SM10\" was created too par[1] = %f\n", par[1]));
619 if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
620 par[0] = g->GetSteelFrontThickness()/2.;
621 gMC->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3);
622 printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", fIdTmedArr[kIdSTEEL], par[0],par[1],par[2]);
623 xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.;
624 gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
628 int nr=0, nrsmod=0, i0=0;
629 if(gn.Contains("TEST")) {nphism = 1;} // just only 2 super modules;
631 // Turn whole super module
632 int turnSupMod = 1; // should be ONE; for testing = 0
633 for(int i=i0; i<nphism; i++) {
634 if (gn.Contains("TRD2")) { // tubs - 27-jan-05
636 printf("** TRD2 ** ");
637 if(turnSupMod==1) printf(" No 3 degree rotation !!! ");
640 Double_t phic=0., phicRad=0.; // phi angle of arc center
641 phic = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; //
642 phicRad = phic*TMath::DegToRad();
643 phi = phic - g->GetTubsTurnAngle();
644 phiRad = phi*TMath::DegToRad();
646 TVector2 vc; // position of super module center
647 vc.SetMagPhi(parTubs[0], phicRad);
648 TVector2 vcTurn; // position of super module center with turn
649 vcTurn.SetMagPhi(parTubs[0], phiRad);
650 TVector2 vcShift = vc - vcTurn;
655 } else { // 1-mar-05 ; just for testing - no turn od SMOD; looks good
659 AliMatrix(fIdRotm, 90.0, phic, 90.0, 90.0+phic, 0.0, 0.0);
661 gMC->Gspos("SMOP", ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
662 printf("SMOP %2i | %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
663 i, nr, fIdRotm, phic, phicRad, xpos, ypos, zpos);
664 printf(" phiy(90+phic) %6.1f \n", 90. + phic);
666 if(!gn.Contains("TEST1") && g->GetNumberOfSuperModules() > 1){
667 // double phiy = 90. + phic + 180.;
668 // if(phiy>=360.) phiy -= 360.;
669 // printf(" phiy %6.1f \n", phiy);
670 // AliMatrix(fIdRotm, 90.0, phic, 90.0, phiy, 180.0, 0.0);
671 gMC->Gspos("SMON", nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY") ;
672 printf("SMON %2i | %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
673 i, nr, fIdRotm, phic, phicRad, xpos, ypos, -zpos);
675 } else if(gn.Contains("WSUC")) {
676 xpos = ypos = zpos = 0.0;
678 gMC->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
679 printf(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
680 fIdRotm, phi, phiRad, xpos, ypos, zpos);
683 TString smName("SMOD"); // 12-oct-05
684 if(i==5 && g->GetKey110DEG()) {
689 phi = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170
690 phiRad = phi*TMath::Pi()/180.;
692 AliMatrix(fIdRotm, 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
694 xpos = rpos * TMath::Cos(phiRad);
695 ypos = rpos * TMath::Sin(phiRad);
696 zpos = fSmodPar2; // 21-sep-04
697 if(i==5 && g->GetKey110DEG()) {
698 xpos += (par1C/2. * TMath::Sin(phiRad));
699 ypos -= (par1C/2. * TMath::Cos(phiRad));
702 // 1th module in z-direction;
703 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
704 AliDebug(3, Form(" %s : %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n",
705 smName.Data(), nr, fIdRotm, phi, phiRad, xpos, ypos, zpos, i));
706 // 2th module in z-direction;
707 if(gn.Contains("TWIST") || gn.Contains("TRD")) {
708 // turn arround X axis; 0<phi<360
709 double phiy = 90. + phi + 180.;
710 if(phiy>=360.) phiy -= 360.;
712 AliMatrix(fIdRotm, 90.0, phi, 90.0, phiy, 180.0, 0.0);
713 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
714 AliDebug(3, Form(" %s : %2i fIdRotm %3i phiy %6.1f xpos %7.2f ypos %7.2f zpos %7.2f \n",
715 smName.Data(), nr, fIdRotm, phiy, xpos, ypos, -zpos));
717 gMC->Gspos("SMOD", ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
721 AliDebug(2,Form(" Number of Super Modules %i \n", nr+nrsmod));
724 void AliEMCALv0::CreateEmod(const char* mother, const char* child)
726 // 17-may-05; mother="SMOD"; child="EMOD"
727 AliEMCALGeometry * g = GetGeometry();
728 TString gn(g->GetName()); gn.ToUpper();
730 Double_t par[10], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0.;
731 Double_t parSCPA[5], zposSCPA=0.; // passive SC - 13-MAY-05, TRD1 case
732 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
733 Double_t tanTrd2y = TMath::Tan(g->GetTrd2AngleY()*TMath::DegToRad()/2.);
736 if(!gn.Contains("TRD")) { // standard module
737 par[0] = (fSampleWidth*g->GetNECLayers())/2.;
738 par[1] = par[2] = g->GetPhiModuleSize()/2.;
739 gMC->Gsvolu(child, "BOX", fIdTmedArr[kIdSTEEL], par, 3);
741 } else if (gn.Contains("TRD1")){ // TRD1 system coordinate iz differnet
742 if(strcmp(mother,"SMOD")==0) {
743 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
744 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
745 fParEMOD[2] = g->GetPhiModuleSize()/2.;; // dy
746 fParEMOD[3] = g->GetLongModuleSize()/2.; // dz
747 gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4);
748 // if(gn.Contains("WSUC") || gn.Contains("MAY05")){
749 if(0){ // Jul 12 - should be checked
750 parSCPA[0] = g->GetEtaModuleSize()/2. + tanTrd1*g->GetFrontSteelStrip(); // dx1
751 parSCPA[1] = parSCPA[0] + tanTrd1*g->GetPassiveScintThick(); // dx2
752 parSCPA[2] = g->GetPhiModuleSize()/2.; // dy
753 parSCPA[3] = g->GetPassiveScintThick()/2.; // dz
754 gMC->Gsvolu("SCPA", "TRD1", fIdTmedArr[kIdSC], parSCPA, 4);
755 zposSCPA = -fParEMOD[3] + g->GetFrontSteelStrip() + g->GetPassiveScintThick()/2.;
756 gMC->Gspos ("SCPA", ++nr, child, 0.0, 0.0, zposSCPA, 0, "ONLY");
759 } else if (gn.Contains("TRD2")){ // TRD2 as for TRD1 - 27-jan-05
760 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
761 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
762 fParEMOD[2] = g->GetPhiModuleSize()/2.; // dy1
763 fParEMOD[3] = fParEMOD[2] + tanTrd2y*g->GetLongModuleSize();// dy2
764 fParEMOD[4] = g->GetLongModuleSize()/2.; // dz
765 gMC->Gsvolu(child, "TRD2", fIdTmedArr[kIdSTEEL], fParEMOD, 5);
769 if(gn.Contains("TWIST")) { // 13-sep-04
770 fShishKebabModules = new TList;
771 AliEMCALShishKebabModule *mod=0, *mTmp; // current module
772 for(int iz=0; iz<g->GetNZ(); iz++) {
773 //for(int iz=0; iz<4; iz++) {
775 mod = new AliEMCALShishKebabModule();
778 mTmp = new AliEMCALShishKebabModule(*mod);
780 Double_t angle = mod->GetThetaInDegree();
781 AliMatrix(fIdRotm, angle,0., 90.0,90.0, 90.-angle, 180.);
783 fShishKebabModules->Add(mod);
785 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
786 zpos = mod->GetPosZ() - fSmodPar2;
787 for(int iy=0; iy<g->GetNPhi(); iy++) {
788 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
789 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
790 // printf(" %3i(%2i,2i) xpos %7.2f ypos %7.2f zpos %7.2f \n", nr,iy,iz, xpos, ypos, zpos);
793 } else if(gn.Contains("TRD")) { // 30-sep-04; 27-jan-05 - as for TRD1 as for TRD2
794 // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0)
795 AliEMCALShishKebabTrd1Module *mod=0, *mTmp; // current module
797 for(int iz=0; iz<g->GetNZ(); iz++) {
798 Double_t angle=90., phiOK=0;
799 if(gn.Contains("TRD1")) {
800 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
801 angle = mod->GetThetaInDegree();
802 if(!gn.Contains("WSUC")) { // ALICE
803 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,90., 90.,0.); // z'(x); y'(y); x'(z)
804 else AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.);
805 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
806 // printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
807 //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
808 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
809 zpos = mod->GetPosZ() - fSmodPar2;
811 int iyMax = g->GetNPhi();
812 if(strcmp(mother,"SMOD") && g->GetKey110DEG()) {
815 for(int iy=0; iy<iyMax; iy++) { // flat in phi
816 ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
817 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
818 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm);
819 AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
823 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y)
824 else AliMatrix(fIdRotm, 90-angle,270., 90.0,0.0, angle,90.);
825 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
826 printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
827 iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
828 zpos = mod->GetPosZ() - fSmodPar2;
829 ypos = mod->GetPosXfromR() - fSmodPar1;
830 printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm);
831 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
832 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
833 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
834 printf(" %7.2f ", xpos);
838 } else if(gn.Contains("TRD2")){ // 1-feb-05 - TRD2; curve in phi
839 double angEtaRow = 0.;
840 double theta1=0.,phi1=0., theta2=0.,phi2=0., theta3=0.,phi3=0.;
843 mod = new AliEMCALShishKebabTrd1Module();
845 mTmp = new AliEMCALShishKebabTrd1Module(*mod);
847 angle = mod->GetThetaInDegree();
850 fShishKebabModules->Add(mod);
851 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
852 AliDebug(2,Form(" %i | theta | %6.3f - %6.3f = %6.3f\n", iz+1, angle, phiOK, angle-phiOK));
854 zpos = mod->GetPosZ() - parTubs[2];
855 rpos = parTubs[0] + mod->GetPosXfromR();
857 angle = mod->GetThetaInDegree();
858 Double_t stepAngle = (parTubs[4] - parTubs[3])/g->GetNPhi(); // 11-mar-04
859 for(int iy=0; iy<g->GetNPhi(); iy++) {
860 angEtaRow = parTubs[3] + stepAngle*(0.5+double(iy));
862 theta1 = 90. + angle; phi1 = angEtaRow; // x' ~-z;
863 theta2 = 90.; phi2 = 90. + angEtaRow;// y' ~ y;
864 theta3 = angle; phi3 = angEtaRow; // z' ~ x;
865 if(phi3 < 0.0) phi3 += 360.;
866 AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
868 xpos = rpos * TMath::Cos(angEtaRow*TMath::DegToRad());
869 ypos = rpos * TMath::Sin(angEtaRow*TMath::DegToRad());
870 gMC->Gspos(child, ++nr, "SMOP", xpos, ypos, zpos, fIdRotm, "ONLY") ;
872 phi1 = 180 + angEtaRow;
873 theta3 = 180.-theta3; phi3 = angEtaRow;
874 AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
875 gMC->Gspos(child, nr, "SMON", xpos, ypos, -zpos, fIdRotm, "ONLY") ;
876 if(AliDebugLevel()>=2) {
877 printf(" angEtaRow(phi) %7.2f | angle(eta) %7.2f \n", angEtaRow, angle);
878 printf("iy=%2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", iy, xpos, ypos, zpos, fIdRotm);
880 } // for(int iy=0; iy<g->GetNPhi(); iy++)
884 xpos = g->GetSteelFrontThickness()/2.;
885 for(int iz=0; iz<g->GetNZ(); iz++) {
886 zpos = -fSmodPar2 + g->GetEtaModuleSize()*(2*iz+1)/2.;
887 for(int iy=0; iy<g->GetNPhi(); iy++) {
888 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
889 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, 0, "ONLY") ;
890 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f \n", nr, xpos, ypos, zpos);
894 AliDebug(2,Form(" Number of modules in Super Module(%s) %i \n", mother, nr));
897 void AliEMCALv0::Trd1Tower3X3(const double *parSCM0)
899 // Started Dec 8,2004 by PAI
901 printf(" AliEMCALv0::Trd1Tower3X3() : parSCM0");
902 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
904 // Nov 10, 2006 - different name of SCMX
905 double parTRAP[11], *dummy=0;
906 AliEMCALGeometry * g = GetGeometry();
907 TString gn(g->GetName()), scmx;
909 // Division to tile size
910 AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv()));
911 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
912 double dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3];
913 double ndiv=3., xpos=0.0;
914 // should be defined once
915 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
916 for(int ix=1; ix<=3; ix++) { // 3X3
917 scmx = "SCX"; // Nov 10,2006
920 double xCentBot = 2.*dx1/3.;
921 double xCentTop = 2.*(dx2/4. + dx1/12.);
922 parTRAP[1] = TMath::ATan2((xCentTop-xCentBot),2.*dz)*TMath::RadToDeg(); // theta
923 parTRAP[2] = 0.; // phi
925 parTRAP[3] = dy/ndiv; // H1
926 parTRAP[4] = dx1/ndiv; // BL1
927 parTRAP[5] = parTRAP[4]; // TL1
928 parTRAP[6] = 0.0; // ALP1
930 parTRAP[7] = dy/ndiv; // H2
931 parTRAP[8] = dx2/2 - dx1/6.;// BL2
932 parTRAP[9] = parTRAP[8]; // TL2
933 parTRAP[10]= 0.0; // ALP2
934 xpos = (xCentBot+xCentTop)/2.;
937 parTRAP[1] = -parTRAP[1];
939 } else if(ix==2) { // central part is box but we treat as trapesoid due to numbering
941 parTRAP[8] = dx1/ndiv; // BL2
942 parTRAP[9] = parTRAP[8]; // TL2
945 AliDebug(2,Form(" ** TRAP ** xpos %9.3f\n", xpos));
946 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
949 gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
950 gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
952 PbInTrap(parTRAP, scmx);
954 AliDebug(2,Form("Trd1Tower3X3()", "Ver. 1.0 : was tested."));
958 void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
960 // see for example CreateShishKebabGeometry(); just for case TRD1
962 AliDebug(2,Form(" Pb tiles : nrstart %i\n", nr));
963 AliEMCALGeometry * g = GetGeometry();
966 // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
967 double xpos = 0.0, ypos = 0.0;
968 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
970 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
971 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // ??
972 // double tan = TMath::Tan(parTRAP[1]*TMath::DegToRad());
974 par[1] = parTRAP[3]; // y
975 par[2] = g->GetECPbRadThick()/2.; // z
976 for(int iz=0; iz<g->GetNECLayers(); iz++){
977 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
978 xpos = par[0] - xCenterSCMX;
979 if(parTRAP[1] < 0.) xpos = -xpos;
980 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
981 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
982 zpos += fSampleWidth;
983 if(iz%2>0) printf("\n");
985 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
986 AliDebug(2,Form(" par[1] %9.3f par[2] %9.3f ypos %9.3f \n", par[1], par[2], ypos));
987 AliDebug(2,Form(" PbInTrap Ver. 1.0 : was tested."));
991 void AliEMCALv0::Trd1Tower4X4()
996 void AliEMCALv0::Trd1Tower1X1(double *parSCM0)
998 // Started Nov 22,2006 by PAI
999 AliDebug(1," AliEMCALv0::Trd1Tower1X1() : parSCM0");
1000 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
1003 // No division - keeping the same volume logic
1004 // and as consequence the same abs is scheme
1005 AliDebug(2,"Trd1Tower1X1() : Create SCMX(SCMY) as SCM0");
1007 gMC->Gsvolu("SCMY", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
1008 gMC->Gspos("SCMY", 1, "SCM0", 0.0, 0.0, 0.0, 0, "ONLY");
1009 gMC->Gsvolu("SCMX", "TRD1", fIdTmedArr[kIdSC], parSCM0, 4);
1010 gMC->Gspos("SCMX", 1, "SCMY", 0.0, 0.0, 0.0, 0, "ONLY");
1012 // should be defined once
1014 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
1016 PbInTrd1(parSCM0, "SCMX");
1018 AliDebug(1,"Trd1Tower1X1() : Ver. 0.1 : was tested.");
1021 void AliEMCALv0::PbInTrd1(double *parTrd1, TString n)
1023 // see PbInTrap(const double parTrd1[11], TString n)
1024 static int nr=0, ndeb=2;
1025 AliDebug(ndeb,Form(" Pb tiles : nrstart %i\n", nr));
1026 AliEMCALGeometry * g = GetGeometry();
1029 // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1030 double xpos = 0.0, ypos = 0.0;
1031 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1032 double coef = (parTrd1[1] - parTrd1[0]) / (2.*parTrd1[3]);
1034 par[1] = parTrd1[2]; // y
1035 par[2] = g->GetECPbRadThick()/2.; // z
1037 for(int iz=0; iz<g->GetNECLayers(); iz++){
1038 par[0] = parTrd1[0] + coef*fSampleWidth*iz;
1039 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
1040 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
1041 zpos += fSampleWidth;
1042 if(iz%2>0) printf("\n");
1044 AliDebug(ndeb,Form(" Number of Pb tiles in SCMX %i coef %9.7f ", nr, coef));
1045 AliDebug(ndeb,Form(" PbInTrd1 Ver. 0.1 : was tested."));
1049 void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parSCM0[5])
1051 // Passive material inside the detector
1052 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); //Need check
1053 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
1054 for(int i=0; i<4; i++) { // on pictures sometimes I can not see 0 -> be carefull!!
1055 parSCM0[i] = emodPar[i] - wallThickness;
1056 AliDebug(2,Form(" %i parSCMO %7.3f emodPar %7.3f : dif %7.3f \n",
1057 i, parSCM0[i],emodPar[i], parSCM0[i]-emodPar[i]));
1059 parSCM0[4] = emodPar[4];
1060 gMC->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC
1061 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
1063 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
1064 Division2X2InScm0(g, parSCM0);
1066 Info("Scm0InTrd2"," no division SCM0 in this geometry |%s|\n", g->GetName());
1071 void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t parSCM0[5])
1074 Double_t parTRAP[11], xpos=0.,ypos=0., dx1=0.0,dx2=0.,dy1=0.0,dy2=0.,dz=0.
1078 Info("Division2X2InScm0","Divide SCM0 on y-axis %i\n", g->GetNETAdiv());
1079 TString n("SCMX"), overLapFlagSCMY("ONLY"), overLapFlagSCMX("ONLY");
1080 n = "SCM0"; // for testing - 14-mar-05
1082 PbInTrapForTrd2(parSCM0, n);
1083 // overLapFlagSCMY=overLapFlagSCMX="MANY"; // do not work
1087 dy1 = parSCM0[2] , dy2 = parSCM0[3], dz = parSCM0[4];
1089 parTRAP[0] = parSCM0[4]; // dz
1090 parTRAP[1] = TMath::ATan2((dy2-dy1)/2.,2.*dz)*TMath::RadToDeg();
1091 parTRAP[2] = 90.; // phi
1093 parTRAP[3] = parSCM0[2]/2.; // H1
1094 parTRAP[4] = parSCM0[0]; // BL1
1095 parTRAP[5] = parTRAP[4]; // TL1
1096 parTRAP[6] = 0.0; // ALP1
1098 parTRAP[7] = parSCM0[3]/2.; // H2
1099 parTRAP[8] = parSCM0[1]; // BL2
1100 parTRAP[9] = parTRAP[8]; // TL2
1101 parTRAP[10]= 0.0; // ALP2
1102 AliDebug(2,Form(" ** SCMY ** \n"));
1103 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1106 gMC->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC
1107 ypos = +(parTRAP[3]+parTRAP[7])/2.; //
1108 AliDebug(2,Form(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data()));
1109 gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm, overLapFlagSCMY.Data()) ;
1110 // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z
1111 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
1112 // We may have problem with numeration due to rotation - 4-feb-05
1113 gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm, overLapFlagSCMY.Data());
1115 Info("Division2X2InScm0","Divide SCMY on x-axis %i\n", g->GetNPHIdiv());
1118 dr1=TMath::Sqrt(dx1*dx1+dy1*dy1);
1119 dr2=TMath::Sqrt(dx2*dx2+dy2*dy2);
1121 parTRAP[0] = parSCM0[4]; // dz
1122 parTRAP[1] = TMath::ATan2((dr2-dr1)/2.,2.*dz)*TMath::RadToDeg(); //
1123 parTRAP[2] = 45.; // phi
1125 parTRAP[3] = parSCM0[2]/2.; // H1
1126 parTRAP[4] = parSCM0[0]/2.; // BL1
1127 parTRAP[5] = parTRAP[4]; // TL1
1128 parTRAP[6] = 0.0; // ALP1
1130 parTRAP[7] = parSCM0[3]/2.; // H2
1131 parTRAP[8] = parSCM0[1]/2; // BL2
1132 parTRAP[9] = parTRAP[8]; // TL2
1133 parTRAP[10]= 0.0; // ALP2
1134 AliDebug(2,Form(" ** SCMX ** \n"));
1135 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1138 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
1139 xpos = (parTRAP[4]+parTRAP[8])/2.;
1140 AliDebug(2,Form(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data()));
1141 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
1142 // AliMatrix(fIdRotm, 90.0,270., 90.0, 0.0, 0.0,0.0); // x'=-y; y'=x; z'=z
1143 AliMatrix(fIdRotm, 90.0,90., 90.0, -180.0, 0.0,0.0); // x'=y; y'=-x; z'=z
1144 gMC->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
1146 if(n=="SCMX" && overLapFlagSCMY == "ONLY") {
1147 PbInTrapForTrd2(parTRAP, n);
1152 void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
1156 TString pbShape("BOX"), pbtiChonly("ONLY");
1159 // pbtiChonly = "MANY";
1161 gMC->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0);
1164 Info("PbInTrapForTrd2"," Pb tiles inside %s: shape %s :pbtiChonly %s\n nrstart %i\n",
1165 name.Data(), pbShape.Data(), pbtiChonly.Data(), nr);
1166 AliEMCALGeometry * g = GetGeometry();
1168 double par[5], parPB[5], parSC[5];
1169 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1170 double xpos = 0.0, ypos = 0.0;
1171 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1172 if(name == "SCMX") { // common trapezoid - 11 parameters
1173 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
1174 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // the same for y
1175 AliDebug(2,Form(" xCenterSCMX %8.5f : coef %8.7f \n", xCenterSCMX, coef));
1177 par[2] = g->GetECPbRadThick()/2.; // z
1178 for(int iz=0; iz<g->GetNECLayers(); iz++){
1179 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
1181 xpos = ypos = par[0] - xCenterSCMX;
1182 //if(parTRAP[1] < 0.) xpos = -xpos;
1183 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
1184 AliDebug(2,Form(" %2.2i xpos %8.5f zpos %6.3f par[0,1] %6.3f |", iz+1, xpos, zpos, par[0]));
1185 if(iz%2>0) AliDebug(2,Form("\n"));
1186 zpos += fSampleWidth;
1188 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
1189 AliDebug(2,Form(" par[1] %9.5f par[2] %9.5f ypos %9.5f \n", par[1], par[2], ypos));
1190 } else if(name == "SCM0") { // 1-mar-05 ; TRD2 - 5 parameters
1191 AliDebug(2,Form(" SCM0 par = "));
1192 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parTRAP[i]));
1193 AliDebug(2,Form("\n zpos %f \n",zpos));
1195 double tanx = (parTRAP[1] - parTRAP[0]) / (2.*parTRAP[4]); // tanx = tany now
1196 double tany = (parTRAP[3] - parTRAP[2]) / (2.*parTRAP[4]), ztmp=0.;
1197 parPB[4] = g->GetECPbRadThick()/2.;
1198 parSC[2] = g->GetECScintThick()/2.;
1199 for(int iz=0; iz<g->GetNECLayers(); iz++){
1200 ztmp = fSampleWidth*double(iz);
1201 parPB[0] = parTRAP[0] + tanx*ztmp;
1202 parPB[1] = parPB[0] + tanx*g->GetECPbRadThick();
1203 parPB[2] = parTRAP[2] + tany*ztmp;
1204 parPB[3] = parPB[2] + tany*g->GetECPbRadThick();
1205 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ;
1206 AliDebug(2,Form("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos));
1208 for(int i=0; i<5; i++) printf(" %9.5f ", parPB[i]);
1209 // individual SC tile
1210 parSC[0] = parPB[0];
1211 parSC[1] = parPB[1];
1212 gMC->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(),
1213 0, pbtiChonly.Data(), parSC, 3) ;
1214 printf("\n SCTI zpos %6.3f | par = ", zpos+g->GetECScintThick());
1215 for(int i=0; i<3; i++) printf(" %9.5f ", parPB[i]);
1217 zpos += fSampleWidth;
1219 AliDebug(2,Form("\n"));
1221 Info("PbInTrapForTrd2", "Ver. 0.03 : was tested.");
1225 void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parPBMO[5])
1228 Info("PbmoInTrd2"," started : geometry %s ", g->GetName());
1229 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize();
1230 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
1231 for(int i=0; i<4; i++) {
1232 parPBMO[i] = emodPar[i] - wallThickness;
1233 AliDebug(2,Form(" %i parPBMO %7.3f emodPar %7.3f : dif %7.3f \n",
1234 i, parPBMO[i],emodPar[i], parPBMO[i]-emodPar[i]));
1236 parPBMO[4] = emodPar[4];
1237 gMC->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5);
1238 gMC->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
1240 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
1241 Division2X2InPbmo(g, parPBMO);
1242 AliDebug(2,Form(" PBMO, division 2X2 | geometry |%s|\n", g->GetName()));
1244 AliDebug(2,Form(" no division PBMO in this geometry |%s|\n", g->GetName()));
1249 void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t parPBMO[5])
1252 Info("Division2X2InPbmo"," started : geometry %s ", g->GetName());
1253 //Double_t *dummy=0;
1254 // gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0);
1257 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1258 double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;;
1259 double tanx = (parPBMO[1] - parPBMO[0]) / (2.*parPBMO[4]); // tanx = tany now
1260 double tany = (parPBMO[3] - parPBMO[2]) / (2.*parPBMO[4]);
1261 char name[10], named[10], named2[10];
1263 AliDebug(2,Form(" PBMO par = "));
1264 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parPBMO[i]));
1265 AliDebug(2,Form("\n"));
1267 parSC[2] = g->GetECScintThick()/2.;
1268 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick() + g->GetECScintThick()/2.;
1269 AliDebug(2,Form(" parSC[2] %9.5f \n", parSC[2]));
1270 for(int iz=0; iz<g->GetNECLayers(); iz++){
1271 ztmp = g->GetECPbRadThick() + fSampleWidth*double(iz); // Z for previous PB
1272 parSC[0] = parPBMO[0] + tanx*ztmp;
1273 parSC[1] = parPBMO[2] + tany*ztmp;
1275 sprintf(name,"SC%2.2i", iz+1);
1276 gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3);
1277 gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
1278 AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ",
1279 name, zpos, parSC[0], parSC[1]));
1281 sprintf(named,"SY%2.2i", iz+1);
1282 printf(" %s -> ", named);
1283 gMC->Gsdvn(named,name, 2, 2);
1285 sprintf(named2,"SX%2.2i", iz+1);
1286 printf(" %s \n", named2);
1287 gMC->Gsdvn(named2,named, 2, 1);
1289 zpos += fSampleWidth;
1293 AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta)
1296 AliEMCALShishKebabTrd1Module* trd1=0;
1297 if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) {
1298 trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta);
1303 //_____________________________________________________________________________
1304 void AliEMCALv0::AddAlignableVolumes() const
1306 TString ntmp(GetTitle()); // name of EMCAL geometry
1308 if(ntmp.Contains("WSUC")) {
1309 AddAlignableVolumesInWSUC(); // WSUC case
1311 AddAlignableVolumesInALICE(); // ALICE case
1315 void AliEMCALv0::AddAlignableVolumesInALICE() const
1318 // Create entries for alignable volumes associating the symbolic volume
1319 // name with the corresponding volume path. Needs to be synchronized with
1320 // eventual changes in the geometry.
1323 Float_t * pars = GetGeometry()->GetSuperModulesPars();
1324 double rpos = (GetGeometry()->GetEnvelop(0) + GetGeometry()->GetEnvelop(1))/2.;
1325 double phi, phiRad, xpos, ypos, zpos;
1327 TString volpath, symname;
1329 Int_t nSMod = ((AliEMCALGeometry*)GetGeometry())->GetNumberOfSuperModules();
1330 for (Int_t smodnum=0; smodnum < nSMod; smodnum++) {
1331 volpath = "ALIC_1/XEN1_1/SMOD_";
1332 volpath += (smodnum+1);
1333 symname = "EMCAL/FullSupermodule";
1334 symname += (smodnum+1);
1336 if(GetGeometry()->GetKey110DEG() && smodnum>=10) {
1337 volpath = "ALIC_1/XEN1_1/SM10_";
1338 volpath += (smodnum-10+1);
1339 symname = "EMCAL/HalfSupermodule";
1340 symname += (smodnum-10+1);
1343 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1344 AliFatal("AliEMCALv0::Unable to set alignable entry!!");
1346 // Creates the Tracking to Local transformation matrix for EMCAL
1348 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(symname.Data()) ;
1349 const char *path = alignableEntry->GetTitle();
1350 if (!gGeoManager->cd(path))
1351 AliFatal(Form("Volume path %s not valid!",path));
1353 phi = GetGeometry()->GetPhiCenterOfSM(smodnum);
1354 phiRad = phi*TMath::Pi()/180.;
1355 xpos = rpos * TMath::Cos(phiRad);
1356 ypos = rpos * TMath::Sin(phiRad);
1358 if(GetGeometry()->GetKey110DEG() && smodnum >= 10) {
1359 xpos += (pars[1]/2. * TMath::Sin(phiRad));
1360 ypos -= (pars[1]/2. * TMath::Cos(phiRad));
1363 TGeoHMatrix *matTtoL;
1364 TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
1366 if(smodnum%2 == 0) {
1368 TGeoTranslation geoTran0(xpos,ypos, zpos);
1369 TGeoRotation geoRot0("geoRot0", 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
1370 TGeoCombiTrans mat0(geoTran0, geoRot0);
1371 matTtoL = new TGeoHMatrix(mat0);
1373 matTtoL->MultiplyLeft(&(globMatrix->Inverse()));
1374 alignableEntry->SetMatrix(matTtoL);
1378 double phiy = 90. + phi + 180.;
1379 if(phiy>=360.) phiy -= 360.;
1380 TGeoTranslation geoTran1(xpos,ypos,-zpos);
1381 TGeoRotation geoRot1("geoRot1", 90.0, phi, 90.0, phiy, 180.0, 0.0);
1382 TGeoCombiTrans mat1(geoTran1, geoRot1);
1383 matTtoL = new TGeoHMatrix(mat1);
1385 matTtoL->MultiplyLeft(&(globMatrix->Inverse()));
1386 alignableEntry->SetMatrix(matTtoL);
1395 void AliEMCALv0::AddAlignableVolumesInWSUC() const
1398 // Create entries for alignable volumes associating the symbolic volume
1399 // name with the corresponding volume path. Needs to be synchronized with
1400 // eventual changes in the geometry.
1403 TString vpstr1 = "WSUC_1/XEN1_1/SMOD_";
1404 TString snstr1 = "EMCAL/CosmicTestSupermodule";
1405 TString volpath, symname;
1408 for (Int_t smodnum=0; smodnum < 1; smodnum++) {
1410 symname += (smodnum+1);
1412 volpath += (smodnum+1);
1413 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1414 AliFatal("Unable to set alignable entry!!");