1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 //_________________________________________________________________________
18 // Implementation version v0 of EMCAL Manager class
19 // An object of this class does not produce hits nor digits
20 // It is the one to use if you do not want to produce outputs in TREEH or TREED
21 // This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx
22 //*-- Author: Yves Schutz (SUBATECH)
23 //*-- and : Sahal Yacoob (LBL / UCT)
24 // : Aleksei Pavlinov (WSU) SHASHLYK
26 // --- ROOT system ---
35 #include <TGeometry.h>
36 #include <TVirtualMC.h>
42 #include "AliEMCALShishKebabModule.h"
43 #include "AliEMCALShishKebabTrd1Module.h"
45 // --- Standard library ---
49 // --- AliRoot header files ---
51 #include "AliEMCALv0.h"
52 #include "AliEMCALGeometry.h"
68 //______________________________________________________________________
69 AliEMCALv0::AliEMCALv0()
71 fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
72 fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0)
77 //______________________________________________________________________
78 AliEMCALv0::AliEMCALv0(const char *name, const char *title)
79 : AliEMCAL(name,title),
80 fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
81 fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0)
83 // ctor : title is used to identify the layout
85 TString ntmp(GetTitle());
87 if(ntmp == "TRD1") { // TRD1 is alias for SHISH_77_TRD1_2X2_FINAL_110DEG NL=69
88 ntmp = "SHISH_77_TRD1_2X2_FINAL_110DEG NL=69";
89 SetTitle(ntmp.Data());
92 AliEMCALGeometry *geom = GetGeometry() ;
93 //geom->CreateListOfTrd1Modules();
94 fShishKebabModules = geom->GetShishKebabTrd1Modules();
97 //______________________________________________________________________
98 AliEMCALv0::AliEMCALv0(const AliEMCALv0 & emcal)
100 fShishKebabModules(emcal.fShishKebabModules),
101 fEnvelop1(emcal.fEnvelop1),
102 fIdRotm(emcal.fIdRotm),
103 fIdTmedArr(emcal.fIdTmedArr),
104 fSampleWidth(emcal.fSampleWidth),
105 fSmodPar0(emcal.fSmodPar0),
106 fSmodPar1(emcal.fSmodPar1),
107 fSmodPar2(emcal.fSmodPar2)
110 for(Int_t i = 0; i < 5; i++) fParEMOD[i] = emcal.fParEMOD[i];
113 //______________________________________________________________________
114 void AliEMCALv0::BuildGeometry()
116 // Display Geometry for display.C
118 const Int_t kColorArm1 = kBlue ;
120 AliEMCALGeometry * geom = GetGeometry();
122 TString gn(geom->GetName());
125 // Define the shape of the Calorimeter
126 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
127 TNode * envelopNode = 0;
128 char *envn = "Envelop1";
129 if(!gn.Contains("SHISH") || gn.Contains("TRD2")){
130 new TTUBS(envn, "Tubs that contains arm 1", "void",
131 geom->GetEnvelop(0) -10, // rmin
132 geom->GetEnvelop(1) +40 ,// rmax
133 geom->GetEnvelop(2)/2.0, // half length in Z
134 geom->GetArm1PhiMin(), // minimum phi angle
135 geom->GetArm1PhiMax() // maximum phi angle
138 envelopNode = new TNode(envn, "Arm1 Envelop", "Envelop1", 0., 0., 0., "") ;
140 if(gn.Contains("WSUC")) {
141 envelopNode = BuildGeometryOfWSUC();
142 } else { // Shish-kebab now for compact, twist and TRD1 cases (ALIC)
144 TPGON *pgon = new TPGON(envn, "PGON that contains arm 1", "void",
145 geom->GetArm1PhiMin(),geom->GetArm1PhiMax()-geom->GetArm1PhiMin(),geom->GetNPhiSuperModule(), 2);
147 pgon->DefineSection(0, fEnvelop1[4], fEnvelop1[5], fEnvelop1[6]);
148 pgon->DefineSection(1, fEnvelop1[7], fEnvelop1[5], fEnvelop1[6]);
150 envelopNode = new TNode(envn, "Arm1 Envelop2", envn, 0., 0., 0., "") ;
154 envelopNode->SetLineColor(kColorArm1) ;
155 fNodes->Add(envelopNode);
158 TNode *AliEMCALv0::BuildGeometryOfWSUC()
160 // June 8, 2005; see directory geant3/TGeant3/G3toRoot.cxx
161 // enum EColor { kWhite, kBlack, kRed, kGreen, kBlue, kYellow, kMagenta, kCyan } - see $ROOTSYS/include/Gtypes.h
162 AliEMCALGeometry * g = GetGeometry();
163 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
166 TNode *envelopNode = 0;
170 new TBRIK(name, "WSUC(XEN1 in Geant)","void",fEnvelop1[0],fEnvelop1[1],fEnvelop1[2]);
171 envelopNode = new TNode(name, "envelope for WSUC", name, 0., 0., 0., "");
172 envelopNode->SetVisibility(0);
175 TNode *emod=0, *scmx=0;
176 name = "SMOD"; // super module
177 new TBRIK(name, "SMOD(SMOD in Geant)","void", fSmodPar0,fSmodPar1,fSmodPar2);
178 if(envelopNode) envelopNode->cd();
179 TNode *smod = new TNode(name, "SMOD", name, 0., 0., 0., "");
180 smod->SetLineColor(kBlue) ;
181 if(envelopNode==0) envelopNode = smod;
183 name = "EMOD"; // see CreateEMOD
184 TTRD1 *emodTrd1 = new TTRD1(name, "EMOD(EMOD in Geant)","void", float(fParEMOD[0]),
185 float(fParEMOD[1]),float(fParEMOD[2]),float(fParEMOD[3]));
187 // SCMX = EMOD/4 for simplicity of drawing
189 Float_t dz=0.,theta=0.,phi=0.,h1=0.,bl1=0.,tl1=0.,alpha1=0.,h2=0.,bl2=0.,tl2=0.,alpha2=0.;
190 h1 = emodTrd1->GetDy()/2.;
191 bl1 = emodTrd1->GetDx()/2.;
194 h2 = emodTrd1->GetDy()/2.;
195 bl2 = emodTrd1->GetDx2()/2.;
199 dz = emodTrd1->GetDz();
200 double dr = TMath::Sqrt((h2-h1)*(h2-h1)+(bl2-bl1)*(bl2-bl1));
201 theta = TMath::ATan2(dr,2.*dz) * TMath::RadToDeg();
204 TTRAP *scmxTrap = new TTRAP(name, "SCMX(SCMX as in Geant)","void",
205 dz,theta,phi, h1,bl1,tl1,alpha1, h2,bl2,tl2,alpha2);
207 Float_t xShiftSCMX = (emodTrd1->GetDx() + emodTrd1->GetDx2())/4.;
208 Float_t yShiftSCMX = emodTrd1->GetDy()/2.;
209 printf(" xShiftSCMX %7.4f yShiftSCMX %7.4f \n",xShiftSCMX,yShiftSCMX);
211 name = "EMOD"; // see CreateEMOD
214 AliEMCALShishKebabTrd1Module *mod=0;
215 Double_t angle=90., xpos=0.,ypos=0.,zpos=0., xposSCMX=0.,yposSCMX=0.,zposSCMX=0.;
216 char rtmn[100], rtmt[100];
217 TRotMatrix *rtm=0, *rtmSCMX=0;
219 for(int iz=0; iz<g->GetNZ(); iz++) {
220 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
221 zpos = mod->GetPosZ() - fSmodPar2;
222 ypos = mod->GetPosXfromR() - fSmodPar1;
224 angle = mod->GetThetaInDegree();
225 sprintf(rtmn,"rmEmod%5.1f",angle);
226 sprintf(rtmt,"rotation matrix for EMOD, iz=%i, angle = %6.3f",iz, angle);
227 if(iz==0) rtm = new TRotMatrix(rtmn, rtmt,0.,0., 90.,0., 90.,90.); // z'(x); y'(y); x'(z)
228 else rtm = new TRotMatrix(rtmn, rtmt,90.-angle,270., 90.0,0.0, angle,90.);
230 TGeometry *tg = gAlice->GetGeometry();
231 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
232 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
233 sprintf(rtmt,"EMOD, iz %i, ix %i, angle %6.3f",iz,ix, angle);
234 TString namNode=name;
235 namNode += numEmod++;
237 emod = new TNode(namNode.Data(), rtmt, (TShape*)emodTrd1, xpos,ypos,zpos,rtm);
238 // emod->SetLineColor(kGreen) ;
239 emod->SetVisibility(0); // SCMX will bi visible
240 if(scmxTrap) { // 4(2x2) sensetive volume inside EMOD
243 for(int jy=0; jy<2; jy++){ // division on y
244 yposSCMX = yShiftSCMX *(2*jy - 1);
245 for(int jx=0; jx<2; jx++){ // division on x
246 Double_t theta1=90.,phi1=0., theta2=90.,phi2=90., theta3=0.,phi3=0 ;
247 xposSCMX = xShiftSCMX *(2*jx - 1);
251 sprintf(rtmn,"rm%s",namNode.Data());
252 sprintf(rtmt,"rotation matrix for %s inside EMOD",namNode.Data());
253 rtmSCMX = tg->GetRotMatrix(rtmn);
255 phi1 = 180.; // x' = -x
256 phi2 = 270.; // y' = -y
258 if(rtmSCMX == 0) rtmSCMX = new TRotMatrix(rtmn,rtmt, theta1,phi1, theta2,phi2, theta3,phi3);
259 sprintf(rtmt,"%s inside %s", namNode.Data(), emod->GetName());
260 scmx = new TNode(namNode.Data(), rtmt, (TShape*)scmxTrap, xposSCMX,yposSCMX,zposSCMX,rtmSCMX);
261 scmx->SetLineColor(kMagenta);
267 // emod->Draw(); // for testing
272 //______________________________________________________________________
273 void AliEMCALv0::CreateGeometry()
275 // Create the EMCAL geometry for Geant
276 // Geometry of a tower
277 //|-----------------------------------------------------| XEN1
279 //| | Al thickness = GetAlFrontThickness() | |
283 //| ------------------------------------------------- |
284 //| | Air Gap = GetGap2Active() | |
286 //| ------------------------------------------------- |
287 //| | XU1 : XPST (ECAL e = GetECScintThick() ) | |
288 //| ------------------------------------------------- |
289 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
290 //| ------------------------------------------------- |
291 //| | XU1 : XPST (ECAL e = GetECScintThick() | |
292 //| ------------------------------------------------- |
293 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
294 //| ------------------------------------------------- |
295 //| etc ..... GetNECLayers() - 1 times |
296 //| ------------------------------------------------- |
297 //| | XUNLayer : XPST (ECAL e = GetECScintThick() | |
298 //| ------------------------------------------------- |
300 AliEMCALGeometry * geom = GetGeometry() ;
301 TString gn(geom->GetName());
304 if(!(geom->IsInitialized())){
305 Error("CreateGeometry","EMCAL Geometry class has not been set up.");
308 // Get pointer to the array containing media indices
309 fIdTmedArr = fIdtmed->GetArray() - 1599 ;
312 // gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule
313 AliMatrix(fIdRotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
315 // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1
317 Float_t envelopA[10];
318 if(gn.Contains("TRD2")) { // TUBS
319 envelopA[0] = geom->GetEnvelop(0) - 10.; // rmin
320 envelopA[1] = geom->GetEnvelop(1) + 12.; // rmax
321 // envelopA[2] = geom->ZFromEtaR(geom->GetEnvelop(1), geom->GetArm1EtaMin());
322 envelopA[2] = 390.; // 6-feb-05
323 envelopA[3] = geom->GetArm1PhiMin();
324 envelopA[4] = geom->GetArm1PhiMax();
325 gMC->Gsvolu("XEN1", "TUBS", fIdTmedArr[kIdAIR], envelopA, 5) ; // Tubs filled with air
326 fEnvelop1.Set(5, envelopA);
327 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
328 gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
329 } else if(gn.Contains("TRD1") && gn.Contains("WSUC") ) { // TRD1 for WSUC facility
330 // 17-may-05 - just BOX
334 gMC->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ;
336 for(int i=0; i<3; i++) fEnvelop1[i] = envelopA[i]; // 23-may-05
337 // Position the EMCAL Mother Volume (XEN1) in WSUC
338 gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
340 envelopA[0] = geom->GetArm1PhiMin(); // minimum phi angle
341 envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
342 envelopA[2] = geom->GetNPhi(); // number of sections in phi
343 envelopA[3] = 2; // 2 z coordinates
344 // envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1),
345 //geom->GetArm1EtaMin()); // z coordinate 1
346 envelopA[4] = -350.; // AM 30/5/2006
348 //add some padding for mother volume
349 envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1
350 envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1
351 // envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1),
352 // geom->GetArm1EtaMax()); // z coordinate 2
353 envelopA[7] = 350.; // AM 30/5/2006
355 envelopA[8] = envelopA[5] ; // radii are the same.
356 envelopA[9] = envelopA[6] ; // radii are the same.
358 if(gn.Contains("SHISH")) envelopA[2] = geom->GetNPhiSuperModule();
360 gMC->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ; // Polygone filled with air
361 fEnvelop1.Set(10, envelopA);
363 printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]);
364 printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]);
366 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
367 gMC->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
370 if(gn.Contains("SHISH")){
371 // COMPACT, TWIST, TRD2 or TRD1
372 AliInfo(Form("Shish-Kebab geometry : %s", GetTitle()));
373 CreateShishKebabGeometry();
377 //______________________________________________________________________
378 void AliEMCALv0::Init(void)
380 // Just prints an information message
382 if(AliLog::GetGlobalDebugLevel()>0) {
383 TString message("\n") ;
384 message += "*****************************************\n" ;
386 // Here the EMCAL initialisation code (if any!)
388 AliEMCALGeometry * geom = GetGeometry() ;
391 message += "AliEMCAL " ;
392 message += Version() ;
393 message += "EMCAL geometry initialized for " ;
394 message += geom->GetName() ;
397 message += "AliEMCAL " ;
398 message += Version() ;
399 message += "EMCAL geometry initialization failed !" ;
401 message += "\n*****************************************" ;
402 printf(message.Data() ) ;
407 void AliEMCALv0::CreateShishKebabGeometry()
409 // TWIST, TRD1 and TRD2
410 AliEMCALGeometry * g = GetGeometry();
411 TString gn(g->GetName()); gn.ToUpper();
412 // see AliModule::fFIdTmedArr
413 // fIdTmedArr = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials()
414 // int kIdAIR=1599, kIdPB = 1600, kIdSC = 1601, kIdSTEEL = 1603;
416 Double_t par[10], xpos=0., ypos=0., zpos=0.;
418 CreateSmod(g->GetNameOfEMCALEnvelope());
420 CreateEmod("SMOD","EMOD"); // 18-may-05
422 if(gn.Contains("110DEG")) CreateEmod("SM10","EMOD"); // 12-oct-05
424 // Sensitive SC (2x2 tiles)
425 double parSCM0[5], *dummy = 0, parTRAP[11];
426 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTmp = TMath::Tan(trd1Angle/2.);
427 if(!gn.Contains("TRD")) { // standard module
428 par[0] = (g->GetECPbRadThick()+g->GetECScintThick())*g->GetNECLayers()/2.;
429 par[1] = par[2] = g->GetPhiTileSize(); // Symetric case
430 gMC->Gsvolu("SCM0", "BOX", fIdTmedArr[kIdSC], par, 3); // 2x2 tiles
431 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
432 // Division to tile size
433 gMC->Gsdvn("SCM1","SCM0", g->GetNPHIdiv(), 2); // y-axis
434 gMC->Gsdvn("SCM2","SCM1", g->GetNETAdiv(), 3); // z-axis
435 // put LED to the SCM2
436 par[0] = g->GetECPbRadThick()/2.;
437 par[1] = par[2] = g->GetPhiTileSize()/2.; // Symetric case
438 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], par, 3);
440 printf(" Pb tiles \n");
443 xpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
444 for(int ix=0; ix<g->GetNECLayers(); ix++){
445 gMC->Gspos("PBTI", ++nr, "SCM2", xpos, ypos, zpos, 0, "ONLY") ;
446 // printf(" %i xpos %f \n", ix+1, xpos);
447 xpos += fSampleWidth;
449 printf(" Number of Pb tiles in SCM2 %i \n", nr);
450 } else if(gn.Contains("TRD1")) { // TRD1 - 30-sep-04
451 if(gn.Contains("MAY05")){
452 Double_t dzTmp = g->GetFrontSteelStrip()+g->GetPassiveScintThick();
453 parSCM0[0] = fParEMOD[0] + tanTmp*dzTmp; // dx1
454 parSCM0[1] = fParEMOD[1]; // dx2
455 parSCM0[2] = fParEMOD[2]; // dy
456 for(int i=0; i<3; i++) parSCM0[i] -= g->GetLateralSteelStrip();
457 parSCM0[3] = fParEMOD[3] - dzTmp/2.; // dz
459 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
460 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., dzTmp/2., 0, "ONLY") ;
461 } else { // before MAY 2005
462 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); // Need check
463 for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
464 parSCM0[3] = fParEMOD[3];
465 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
466 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
469 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
470 // Division to tile size - 1-oct-04
471 AliDebug(2,Form(" Divide SCM0 on y-axis %i\n", g->GetNETAdiv()));
472 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
474 parTRAP[0] = parSCM0[3]; // dz
475 parTRAP[1] = TMath::ATan2((parSCM0[1]-parSCM0[0])/2.,2.*parSCM0[3])*180./TMath::Pi(); // theta
476 parTRAP[2] = 0.; // phi
478 parTRAP[3] = parSCM0[2]/2.; // H1
479 parTRAP[4] = parSCM0[0]/2.; // BL1
480 parTRAP[5] = parTRAP[4]; // TL1
481 parTRAP[6] = 0.0; // ALP1
483 parTRAP[7] = parSCM0[2]/2.; // H2
484 parTRAP[8] = parSCM0[1]/2.; // BL2
485 parTRAP[9] = parTRAP[8]; // TL2
486 parTRAP[10]= 0.0; // ALP2
487 AliDebug(2,Form(" ** TRAP ** \n"));
488 for(int i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
490 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
491 xpos = +(parSCM0[1]+parSCM0[0])/4.;
492 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
494 // Using rotation because SCMX should be the same due to Pb tiles
496 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
497 gMC->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, fIdRotm, "ONLY");
498 // put LED to the SCM0
499 AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0);
500 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
502 par[1] = parSCM0[2]/2; // y
503 par[2] = g->GetECPbRadThick()/2.; // z
507 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
508 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.;
509 if(!gn.Contains("NOPB")) { // for testing - 11-jul-05
510 AliDebug(2,Form(" Pb tiles \n"));
511 for(int iz=0; iz<g->GetNECLayers(); iz++){
512 par[0] = (parSCM0[0] + mod->GetTanBetta()*fSampleWidth*iz)/2.;
513 xpos = par[0] - xCenterSCMX;
514 gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
515 AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]));
516 zpos += fSampleWidth;
518 AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr));
520 } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) {
521 Trd1Tower3X3(parSCM0);
522 } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) {
525 } else if(gn.Contains("TRD2")) { // TRD2 - 14-jan-05
526 // Scm0InTrd2(g, fParEMOD, parSCM0); // First dessin
527 PbmoInTrd2(g, fParEMOD, parSCM0); // Second dessin
531 void AliEMCALv0::CreateSmod(const char* mother)
533 // 18-may-05; mother="XEN1";
534 // child="SMOD" from first to 10th, "SM10" (11th and 12th) (TRD1 case)
535 // child="SMON" and "SMOP"("TRD2" case)
536 AliEMCALGeometry * g = GetGeometry();
537 TString gn(g->GetName()); gn.ToUpper();
539 Double_t par[3], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.;
541 // ===== define Super Module from air - 14x30 module ==== ;
542 fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
543 AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data()));
544 par[0] = g->GetShellThickness()/2.;
545 par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
546 par[2] = g->GetEtaModuleSize()*15.;
548 int nphism = g->GetNumberOfSuperModules()/2; // 20-may-05
550 dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/nphism;
551 // if(gn.Contains("110DEG")) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1);
552 rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.;
553 AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi));
556 if (gn.Contains("TRD2")) { // tubs - 27-jan-05
557 parTubs[0] = g->GetTubsR(); // rmin
558 parTubs[1] = parTubs[0] + g->GetShellThickness(); // rmax ??
559 parTubs[2] = 380./2.; // DZ half length in z; 11-oct-04 - for 26 division
560 parTubs[3] = -dphi/2.; // PHI1 starting angle of the segment;
561 parTubs[4] = +dphi/2.; // PHI2 ending angle of the segment;
563 gMC->Gsvolu("SMOP", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // pozitive Z
564 gMC->Gsvolu("SMON", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // negative Z
566 AliDebug(2,Form(" SMOP,N ** TUBS **\n"));
567 AliDebug(2,Form("tmed %i | Rmin %7.2f Rmax %7.2f dz %7.2f phi1,2 (%7.2f,%7.2f)\n",
568 fIdTmedArr[kIdAIR], parTubs[0],parTubs[1],parTubs[2], parTubs[3],parTubs[4]));
569 // have to add 1 cm plastic before EMOD - time solution
570 } else if(gn.Contains("WSUC")) {
571 par[0] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
572 par[1] = g->GetShellThickness()/2.;
573 par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5;
575 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
577 AliDebug(2,Form("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
578 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
582 nphism = g->GetNumberOfSuperModules();
584 if (gn.Contains("TWIST")) {
585 par[2] += 0.4; // for 27 division
586 } else if(gn.Contains("TRD")) {
587 par[2] = 350./2.; // 11-oct-04 - for 26 division
588 if(gn.Contains("TRD1")) {
589 AliDebug(2,Form(" par[0] %7.2f (old) \n", par[0]));
590 Float_t *parSM = g->GetSuperModulesPars();
591 for(int i=0; i<3; i++) par[i] = parSM[i];
594 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
595 AliDebug(2,Form("tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
596 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
599 if(gn.Contains("110DEG")) { // 12-oct-05
602 gMC->Gsvolu("SM10", "BOX", fIdTmedArr[kIdAIR], par, 3);
603 AliDebug(2,Form(" Super module with name \"SM10\" was created too par[1] = %f\n", par[1]));
607 if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
608 par[0] = g->GetSteelFrontThickness()/2.;
609 gMC->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3);
610 printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", fIdTmedArr[kIdSTEEL], par[0],par[1],par[2]);
611 xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.;
612 gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
616 int nr=0, nrsmod=0, i0=0;
617 if(gn.Contains("TEST")) {nphism = 1;} // just only 2 super modules;
619 // Turn whole super module
620 int turnSupMod = 1; // should be ONE; for testing = 0
621 for(int i=i0; i<nphism; i++) {
622 if (gn.Contains("TRD2")) { // tubs - 27-jan-05
624 printf("** TRD2 ** ");
625 if(turnSupMod==1) printf(" No 3 degree rotation !!! ");
628 Double_t phic=0., phicRad=0.; // phi angle of arc center
629 phic = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; //
630 phicRad = phic*TMath::DegToRad();
631 phi = phic - g->GetTubsTurnAngle();
632 phiRad = phi*TMath::DegToRad();
634 TVector2 vc; // position of super module center
635 vc.SetMagPhi(parTubs[0], phicRad);
636 TVector2 vcTurn; // position of super module center with turn
637 vcTurn.SetMagPhi(parTubs[0], phiRad);
638 TVector2 vcShift = vc - vcTurn;
643 } else { // 1-mar-05 ; just for testing - no turn od SMOD; looks good
647 AliMatrix(fIdRotm, 90.0, phic, 90.0, 90.0+phic, 0.0, 0.0);
649 gMC->Gspos("SMOP", ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
650 printf("SMOP %2i | %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
651 i, nr, fIdRotm, phic, phicRad, xpos, ypos, zpos);
652 printf(" phiy(90+phic) %6.1f \n", 90. + phic);
654 if(!gn.Contains("TEST1") && g->GetNumberOfSuperModules() > 1){
655 // double phiy = 90. + phic + 180.;
656 // if(phiy>=360.) phiy -= 360.;
657 // printf(" phiy %6.1f \n", phiy);
658 // AliMatrix(fIdRotm, 90.0, phic, 90.0, phiy, 180.0, 0.0);
659 gMC->Gspos("SMON", nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY") ;
660 printf("SMON %2i | %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
661 i, nr, fIdRotm, phic, phicRad, xpos, ypos, -zpos);
663 } else if(gn.Contains("WSUC")) {
664 xpos = ypos = zpos = 0.0;
666 gMC->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
667 printf(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
668 fIdRotm, phi, phiRad, xpos, ypos, zpos);
671 TString smName("SMOD"); // 12-oct-05
672 if(i==5 && gn.Contains("110DEG")) {
677 phi = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170
678 phiRad = phi*TMath::Pi()/180.;
680 AliMatrix(fIdRotm, 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
682 xpos = rpos * TMath::Cos(phiRad);
683 ypos = rpos * TMath::Sin(phiRad);
684 zpos = fSmodPar2; // 21-sep-04
685 if(i==5 && gn.Contains("110DEG")) {
686 xpos += (par1C/2. * TMath::Sin(phiRad));
687 ypos -= (par1C/2. * TMath::Cos(phiRad));
690 // 1th module in z-direction;
691 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
692 AliDebug(3, Form(" %s : %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n",
693 smName.Data(), nr, fIdRotm, phi, phiRad, xpos, ypos, zpos, i));
694 // 2th module in z-direction;
695 if(gn.Contains("TWIST") || gn.Contains("TRD")) {
696 // turn arround X axis; 0<phi<360
697 double phiy = 90. + phi + 180.;
698 if(phiy>=360.) phiy -= 360.;
700 AliMatrix(fIdRotm, 90.0, phi, 90.0, phiy, 180.0, 0.0);
701 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
702 AliDebug(3, Form(" %s : %2i fIdRotm %3i phiy %6.1f xpos %7.2f ypos %7.2f zpos %7.2f \n",
703 smName.Data(), nr, fIdRotm, phiy, xpos, ypos, -zpos));
705 gMC->Gspos("SMOD", ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
709 AliDebug(2,Form(" Number of Super Modules %i \n", nr+nrsmod));
712 void AliEMCALv0::CreateEmod(const char* mother, const char* child)
714 // 17-may-05; mother="SMOD"; child="EMOD"
715 AliEMCALGeometry * g = GetGeometry();
716 TString gn(g->GetName()); gn.ToUpper();
718 Double_t par[10], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0.;
719 Double_t parSCPA[5], zposSCPA=0.; // passive SC - 13-MAY-05, TRD1 case
720 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
721 Double_t tanTrd2y = TMath::Tan(g->GetTrd2AngleY()*TMath::DegToRad()/2.);
724 if(!gn.Contains("TRD")) { // standard module
725 par[0] = (fSampleWidth*g->GetNECLayers())/2.;
726 par[1] = par[2] = g->GetPhiModuleSize()/2.;
727 gMC->Gsvolu(child, "BOX", fIdTmedArr[kIdSTEEL], par, 3);
729 } else if (gn.Contains("TRD1")){ // TRD1 system coordinate iz differnet
730 if(strcmp(mother,"SMOD")==0) {
731 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
732 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
733 fParEMOD[2] = g->GetPhiModuleSize()/2.;; // dy
734 fParEMOD[3] = g->GetLongModuleSize()/2.; // dz
735 gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4);
736 if(gn.Contains("WSUC") || gn.Contains("MAY05")){
737 parSCPA[0] = g->GetEtaModuleSize()/2. + tanTrd1*g->GetFrontSteelStrip(); // dx1
738 parSCPA[1] = parSCPA[0] + tanTrd1*g->GetPassiveScintThick(); // dx2
739 parSCPA[2] = g->GetPhiModuleSize()/2.; // dy
740 parSCPA[3] = g->GetPassiveScintThick()/2.; // dz
741 gMC->Gsvolu("SCPA", "TRD1", fIdTmedArr[kIdSC], parSCPA, 4);
742 zposSCPA = -fParEMOD[3] + g->GetFrontSteelStrip() + g->GetPassiveScintThick()/2.;
743 gMC->Gspos ("SCPA", ++nr, child, 0.0, 0.0, zposSCPA, 0, "ONLY");
746 } else if (gn.Contains("TRD2")){ // TRD2 as for TRD1 - 27-jan-05
747 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
748 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
749 fParEMOD[2] = g->GetPhiModuleSize()/2.; // dy1
750 fParEMOD[3] = fParEMOD[2] + tanTrd2y*g->GetLongModuleSize();// dy2
751 fParEMOD[4] = g->GetLongModuleSize()/2.; // dz
752 gMC->Gsvolu(child, "TRD2", fIdTmedArr[kIdSTEEL], fParEMOD, 5);
756 if(gn.Contains("TWIST")) { // 13-sep-04
757 fShishKebabModules = new TList;
758 AliEMCALShishKebabModule *mod=0, *mTmp; // current module
759 for(int iz=0; iz<g->GetNZ(); iz++) {
760 //for(int iz=0; iz<4; iz++) {
762 mod = new AliEMCALShishKebabModule();
765 mTmp = new AliEMCALShishKebabModule(*mod);
767 Double_t angle = mod->GetThetaInDegree();
768 AliMatrix(fIdRotm, angle,0., 90.0,90.0, 90.-angle, 180.);
770 fShishKebabModules->Add(mod);
772 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
773 zpos = mod->GetPosZ() - fSmodPar2;
774 for(int iy=0; iy<g->GetNPhi(); iy++) {
775 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
776 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
777 // printf(" %3i(%2i,2i) xpos %7.2f ypos %7.2f zpos %7.2f \n", nr,iy,iz, xpos, ypos, zpos);
780 } else if(gn.Contains("TRD")) { // 30-sep-04; 27-jan-05 - as for TRD1 as for TRD2
781 // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0)
782 AliEMCALShishKebabTrd1Module *mod=0, *mTmp; // current module
784 for(int iz=0; iz<g->GetNZ(); iz++) {
785 Double_t angle=90., phiOK=0;
786 if(gn.Contains("TRD1")) {
787 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
788 angle = mod->GetThetaInDegree();
789 if(!gn.Contains("WSUC")) { // ALICE
790 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,90., 90.,0.); // z'(x); y'(y); x'(z)
791 else AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.);
792 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
793 // printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
794 //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
795 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
796 zpos = mod->GetPosZ() - fSmodPar2;
798 int iyMax = g->GetNPhi();
799 if(strcmp(mother,"SMOD") && gn.Contains("110DEG")) {
802 for(int iy=0; iy<iyMax; iy++) { // flat in phi
803 ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
804 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
805 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm);
806 AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
810 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y)
811 else AliMatrix(fIdRotm, 90-angle,270., 90.0,0.0, angle,90.);
812 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
813 printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
814 iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
815 zpos = mod->GetPosZ() - fSmodPar2;
816 ypos = mod->GetPosXfromR() - fSmodPar1;
817 printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm);
818 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
819 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
820 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
821 printf(" %7.2f ", xpos);
825 } else if(gn.Contains("TRD2")){ // 1-feb-05 - TRD2; curve in phi
826 double angEtaRow = 0.;
827 double theta1=0.,phi1=0., theta2=0.,phi2=0., theta3=0.,phi3=0.;
830 mod = new AliEMCALShishKebabTrd1Module();
832 mTmp = new AliEMCALShishKebabTrd1Module(*mod);
834 angle = mod->GetThetaInDegree();
837 fShishKebabModules->Add(mod);
838 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
839 AliDebug(2,Form(" %i | theta | %6.3f - %6.3f = %6.3f\n", iz+1, angle, phiOK, angle-phiOK));
841 zpos = mod->GetPosZ() - parTubs[2];
842 rpos = parTubs[0] + mod->GetPosXfromR();
844 angle = mod->GetThetaInDegree();
845 Double_t stepAngle = (parTubs[4] - parTubs[3])/g->GetNPhi(); // 11-mar-04
846 for(int iy=0; iy<g->GetNPhi(); iy++) {
847 angEtaRow = parTubs[3] + stepAngle*(0.5+double(iy));
849 theta1 = 90. + angle; phi1 = angEtaRow; // x' ~-z;
850 theta2 = 90.; phi2 = 90. + angEtaRow;// y' ~ y;
851 theta3 = angle; phi3 = angEtaRow; // z' ~ x;
852 if(phi3 < 0.0) phi3 += 360.;
853 AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
855 xpos = rpos * TMath::Cos(angEtaRow*TMath::DegToRad());
856 ypos = rpos * TMath::Sin(angEtaRow*TMath::DegToRad());
857 gMC->Gspos(child, ++nr, "SMOP", xpos, ypos, zpos, fIdRotm, "ONLY") ;
859 phi1 = 180 + angEtaRow;
860 theta3 = 180.-theta3; phi3 = angEtaRow;
861 AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
862 gMC->Gspos(child, nr, "SMON", xpos, ypos, -zpos, fIdRotm, "ONLY") ;
863 if(AliDebugLevel()>=2) {
864 printf(" angEtaRow(phi) %7.2f | angle(eta) %7.2f \n", angEtaRow, angle);
865 printf("iy=%2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", iy, xpos, ypos, zpos, fIdRotm);
867 } // for(int iy=0; iy<g->GetNPhi(); iy++)
871 xpos = g->GetSteelFrontThickness()/2.;
872 for(int iz=0; iz<g->GetNZ(); iz++) {
873 zpos = -fSmodPar2 + g->GetEtaModuleSize()*(2*iz+1)/2.;
874 for(int iy=0; iy<g->GetNPhi(); iy++) {
875 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
876 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, 0, "ONLY") ;
877 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f \n", nr, xpos, ypos, zpos);
881 AliDebug(2,Form(" Number of modules in Super Module %i \n", nr));
885 void AliEMCALv0::Trd1Tower3X3(const double parSCM0[4])
887 // PB should be for whole SCM0 - ?
888 double parTRAP[11], *dummy=0;
889 AliEMCALGeometry * g = GetGeometry();
890 TString gn(g->GetName()), scmx;
892 // Division to tile size
893 AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv()));
894 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
895 double dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3];
896 double ndiv=3., xpos=0.0;
897 // should be defined once
898 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
899 if(gn.Contains("TEST")==0) { // one name for all trapesoid
901 gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], dummy, 0);
905 for(int ix=1; ix<=3; ix++) { // 3X3
908 parTRAP[1] = TMath::ATan2((dx2-dx1)/2.,2.*dz)*TMath::RadToDeg(); // theta
909 parTRAP[2] = 0.; // phi
911 parTRAP[3] = dy/ndiv; // H1
912 parTRAP[4] = dx1/ndiv; // BL1
913 parTRAP[5] = parTRAP[4]; // TL1
914 parTRAP[6] = 0.0; // ALP1
916 parTRAP[7] = dy/ndiv; // H2
917 parTRAP[8] = dx2/ndiv; // BL2
918 parTRAP[9] = parTRAP[8]; // TL2
919 parTRAP[10]= 0.0; // ALP2
920 xpos = +(dx1+dx2)/3.; // 6 or 3
923 parTRAP[1] = -parTRAP[1];
925 } else if(ix==2) { // central part is box but we treat as trapesoid due to numbering
927 parTRAP[8] = dx1/ndiv; // BL2
928 parTRAP[9] = parTRAP[8]; // TL2
931 AliDebug(2,Form(" ** TRAP ** xpos %9.3f\n", xpos));
932 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
933 if(gn.Contains("TEST")){
934 scmx = "SCX"; scmx += ix;
935 gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
936 gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
938 gMC->Gsposp(scmx.Data(), ix, "SCMY", xpos, 0.0, 0.0, 0, "ONLY", parTRAP, 11) ;
940 PbInTrap(parTRAP, scmx);
942 AliDebug(2,Form("Trd1Tower3X3()", "Ver. 1.0 : was tested."));
946 void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
948 // see for example CreateShishKebabGeometry(); just for case TRD1
950 AliDebug(2,Form(" Pb tiles : nrstart %i\n", nr));
951 AliEMCALGeometry * g = GetGeometry();
954 // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
955 double xpos = 0.0, ypos = 0.0;
956 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
958 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
959 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // ??
960 // double tan = TMath::Tan(parTRAP[1]*TMath::DegToRad());
962 par[1] = parTRAP[3]; // y
963 par[2] = g->GetECPbRadThick()/2.; // z
964 for(int iz=0; iz<g->GetNECLayers(); iz++){
965 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
966 xpos = par[0] - xCenterSCMX;
967 if(parTRAP[1] < 0.) xpos = -xpos;
968 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
969 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
970 zpos += fSampleWidth;
971 if(iz%2>0) printf("\n");
973 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
974 AliDebug(2,Form(" par[1] %9.3f par[2] %9.3f ypos %9.3f \n", par[1], par[2], ypos));
975 AliDebug(2,Form(" PbInTrap Ver. 1.0 : was tested."));
979 void AliEMCALv0::Trd1Tower4X4()
984 void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parSCM0[5])
986 // Passive material inside the detector
987 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); //Need check
988 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
989 for(int i=0; i<4; i++) { // on pictures sometimes I can not see 0 -> be carefull!!
990 parSCM0[i] = emodPar[i] - wallThickness;
991 AliDebug(2,Form(" %i parSCMO %7.3f emodPar %7.3f : dif %7.3f \n",
992 i, parSCM0[i],emodPar[i], parSCM0[i]-emodPar[i]));
994 parSCM0[4] = emodPar[4];
995 gMC->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC
996 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
998 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
999 Division2X2InScm0(g, parSCM0);
1001 Info("Scm0InTrd2"," no division SCM0 in this geometry |%s|\n", g->GetName());
1006 void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t parSCM0[5])
1009 Double_t parTRAP[11], xpos=0.,ypos=0., dx1=0.0,dx2=0.,dy1=0.0,dy2=0.,dz=0.
1013 Info("Division2X2InScm0","Divide SCM0 on y-axis %i\n", g->GetNETAdiv());
1014 TString n("SCMX"), overLapFlagSCMY("ONLY"), overLapFlagSCMX("ONLY");
1015 n = "SCM0"; // for testing - 14-mar-05
1017 PbInTrapForTrd2(parSCM0, n);
1018 // overLapFlagSCMY=overLapFlagSCMX="MANY"; // do not work
1022 dy1 = parSCM0[2] , dy2 = parSCM0[3], dz = parSCM0[4];
1024 parTRAP[0] = parSCM0[4]; // dz
1025 parTRAP[1] = TMath::ATan2((dy2-dy1)/2.,2.*dz)*TMath::RadToDeg();
1026 parTRAP[2] = 90.; // phi
1028 parTRAP[3] = parSCM0[2]/2.; // H1
1029 parTRAP[4] = parSCM0[0]; // BL1
1030 parTRAP[5] = parTRAP[4]; // TL1
1031 parTRAP[6] = 0.0; // ALP1
1033 parTRAP[7] = parSCM0[3]/2.; // H2
1034 parTRAP[8] = parSCM0[1]; // BL2
1035 parTRAP[9] = parTRAP[8]; // TL2
1036 parTRAP[10]= 0.0; // ALP2
1037 AliDebug(2,Form(" ** SCMY ** \n"));
1038 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1041 gMC->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC
1042 ypos = +(parTRAP[3]+parTRAP[7])/2.; //
1043 AliDebug(2,Form(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data()));
1044 gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm, overLapFlagSCMY.Data()) ;
1045 // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z
1046 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
1047 // We may have problem with numeration due to rotation - 4-feb-05
1048 gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm, overLapFlagSCMY.Data());
1050 Info("Division2X2InScm0","Divide SCMY on x-axis %i\n", g->GetNPHIdiv());
1053 dr1=TMath::Sqrt(dx1*dx1+dy1*dy1);
1054 dr2=TMath::Sqrt(dx2*dx2+dy2*dy2);
1056 parTRAP[0] = parSCM0[4]; // dz
1057 parTRAP[1] = TMath::ATan2((dr2-dr1)/2.,2.*dz)*TMath::RadToDeg(); //
1058 parTRAP[2] = 45.; // phi
1060 parTRAP[3] = parSCM0[2]/2.; // H1
1061 parTRAP[4] = parSCM0[0]/2.; // BL1
1062 parTRAP[5] = parTRAP[4]; // TL1
1063 parTRAP[6] = 0.0; // ALP1
1065 parTRAP[7] = parSCM0[3]/2.; // H2
1066 parTRAP[8] = parSCM0[1]/2; // BL2
1067 parTRAP[9] = parTRAP[8]; // TL2
1068 parTRAP[10]= 0.0; // ALP2
1069 AliDebug(2,Form(" ** SCMX ** \n"));
1070 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1073 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
1074 xpos = (parTRAP[4]+parTRAP[8])/2.;
1075 AliDebug(2,Form(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data()));
1076 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
1077 // AliMatrix(fIdRotm, 90.0,270., 90.0, 0.0, 0.0,0.0); // x'=-y; y'=x; z'=z
1078 AliMatrix(fIdRotm, 90.0,90., 90.0, -180.0, 0.0,0.0); // x'=y; y'=-x; z'=z
1079 gMC->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
1081 if(n=="SCMX" && overLapFlagSCMY == "ONLY") {
1082 PbInTrapForTrd2(parTRAP, n);
1087 void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
1091 TString pbShape("BOX"), pbtiChonly("ONLY");
1094 // pbtiChonly = "MANY";
1096 gMC->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0);
1099 Info("PbInTrapForTrd2"," Pb tiles inside %s: shape %s :pbtiChonly %s\n nrstart %i\n",
1100 name.Data(), pbShape.Data(), pbtiChonly.Data(), nr);
1101 AliEMCALGeometry * g = GetGeometry();
1103 double par[5], parPB[5], parSC[5];
1104 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1105 double xpos = 0.0, ypos = 0.0;
1106 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1107 if(name == "SCMX") { // common trapezoid - 11 parameters
1108 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
1109 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // the same for y
1110 AliDebug(2,Form(" xCenterSCMX %8.5f : coef %8.7f \n", xCenterSCMX, coef));
1112 par[2] = g->GetECPbRadThick()/2.; // z
1113 for(int iz=0; iz<g->GetNECLayers(); iz++){
1114 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
1116 xpos = ypos = par[0] - xCenterSCMX;
1117 //if(parTRAP[1] < 0.) xpos = -xpos;
1118 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
1119 AliDebug(2,Form(" %2.2i xpos %8.5f zpos %6.3f par[0,1] %6.3f |", iz+1, xpos, zpos, par[0]));
1120 if(iz%2>0) AliDebug(2,Form("\n"));
1121 zpos += fSampleWidth;
1123 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
1124 AliDebug(2,Form(" par[1] %9.5f par[2] %9.5f ypos %9.5f \n", par[1], par[2], ypos));
1125 } else if(name == "SCM0") { // 1-mar-05 ; TRD2 - 5 parameters
1126 AliDebug(2,Form(" SCM0 par = "));
1127 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parTRAP[i]));
1128 AliDebug(2,Form("\n zpos %f \n",zpos));
1130 double tanx = (parTRAP[1] - parTRAP[0]) / (2.*parTRAP[4]); // tanx = tany now
1131 double tany = (parTRAP[3] - parTRAP[2]) / (2.*parTRAP[4]), ztmp=0.;
1132 parPB[4] = g->GetECPbRadThick()/2.;
1133 parSC[2] = g->GetECScintThick()/2.;
1134 for(int iz=0; iz<g->GetNECLayers(); iz++){
1135 ztmp = fSampleWidth*double(iz);
1136 parPB[0] = parTRAP[0] + tanx*ztmp;
1137 parPB[1] = parPB[0] + tanx*g->GetECPbRadThick();
1138 parPB[2] = parTRAP[2] + tany*ztmp;
1139 parPB[3] = parPB[2] + tany*g->GetECPbRadThick();
1140 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ;
1141 AliDebug(2,Form("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos));
1143 for(int i=0; i<5; i++) printf(" %9.5f ", parPB[i]);
1144 // individual SC tile
1145 parSC[0] = parPB[0];
1146 parSC[1] = parPB[1];
1147 gMC->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(),
1148 0, pbtiChonly.Data(), parSC, 3) ;
1149 printf("\n SCTI zpos %6.3f | par = ", zpos+g->GetECScintThick());
1150 for(int i=0; i<3; i++) printf(" %9.5f ", parPB[i]);
1152 zpos += fSampleWidth;
1154 AliDebug(2,Form("\n"));
1156 Info("PbInTrapForTrd2", "Ver. 0.03 : was tested.");
1160 void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parPBMO[5])
1163 Info("PbmoInTrd2"," started : geometry %s ", g->GetName());
1164 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize();
1165 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
1166 for(int i=0; i<4; i++) {
1167 parPBMO[i] = emodPar[i] - wallThickness;
1168 AliDebug(2,Form(" %i parPBMO %7.3f emodPar %7.3f : dif %7.3f \n",
1169 i, parPBMO[i],emodPar[i], parPBMO[i]-emodPar[i]));
1171 parPBMO[4] = emodPar[4];
1172 gMC->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5);
1173 gMC->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
1175 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
1176 Division2X2InPbmo(g, parPBMO);
1177 AliDebug(2,Form(" PBMO, division 2X2 | geometry |%s|\n", g->GetName()));
1179 AliDebug(2,Form(" no division PBMO in this geometry |%s|\n", g->GetName()));
1184 void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t parPBMO[5])
1187 Info("Division2X2InPbmo"," started : geometry %s ", g->GetName());
1188 //Double_t *dummy=0;
1189 // gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0);
1192 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1193 double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;;
1194 double tanx = (parPBMO[1] - parPBMO[0]) / (2.*parPBMO[4]); // tanx = tany now
1195 double tany = (parPBMO[3] - parPBMO[2]) / (2.*parPBMO[4]);
1196 char name[10], named[10], named2[10];
1198 AliDebug(2,Form(" PBMO par = "));
1199 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parPBMO[i]));
1200 AliDebug(2,Form("\n"));
1202 parSC[2] = g->GetECScintThick()/2.;
1203 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick() + g->GetECScintThick()/2.;
1204 AliDebug(2,Form(" parSC[2] %9.5f \n", parSC[2]));
1205 for(int iz=0; iz<g->GetNECLayers(); iz++){
1206 ztmp = g->GetECPbRadThick() + fSampleWidth*double(iz); // Z for previous PB
1207 parSC[0] = parPBMO[0] + tanx*ztmp;
1208 parSC[1] = parPBMO[2] + tany*ztmp;
1210 sprintf(name,"SC%2.2i", iz+1);
1211 gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3);
1212 gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
1213 AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ",
1214 name, zpos, parSC[0], parSC[1]));
1216 sprintf(named,"SY%2.2i", iz+1);
1217 printf(" %s -> ", named);
1218 gMC->Gsdvn(named,name, 2, 2);
1220 sprintf(named2,"SX%2.2i", iz+1);
1221 printf(" %s \n", named2);
1222 gMC->Gsdvn(named2,named, 2, 1);
1224 zpos += fSampleWidth;
1228 AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta)
1231 AliEMCALShishKebabTrd1Module* trd1=0;
1232 if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) {
1233 trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta);
1238 //_____________________________________________________________________________
1239 void AliEMCALv0::AddAlignableVolumes() const
1242 // Create entries for alignable volumes associating the symbolic volume
1243 // name with the corresponding volume path. Needs to be synchronized with
1244 // eventual changes in the geometry.
1247 TString vpstr1 = "ALIC_1/XEN1_1/SMOD_";
1248 TString snstr1 = "EMCAL/FullSupermodule";
1249 TString volpath, symname;
1251 //Int_t nSMod = ((AliEMCALGeometry*)GetGeometry())->GetNumberOfSuperModules();
1252 //could use this, but what happens if it is > 10?
1255 for (Int_t smodnum=0; smodnum < 10; smodnum++) {
1257 symname += (smodnum+1);
1259 volpath += (smodnum+1);
1260 gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data());
1263 AliFatal("Trying to set alignable entry with open geometry");
1266 TString gn( ((AliEMCALGeometry*)GetGeometry())->GetName() );
1268 if(gn.Contains("110DEG")) {
1269 TString vpstr2 = "ALIC_1/XEN1_1/SM10_";
1270 TString snstr2 = "EMCAL/HalfSupermodule";
1272 for (Int_t smodnum=0; smodnum < 2; smodnum++) {
1274 symname += (smodnum+1);
1276 volpath += (smodnum+1);
1277 gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data());
1280 AliFatal("Trying to set alignable entry with open geometry");