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 // Nov 22, 2006 - case of 1X1
86 TString ntmp(GetTitle());
88 if(ntmp == "TRD1") { // TRD1 is alias for SHISH_77_TRD1_2X2_FINAL_110DEG NL=69
89 ntmp = "SHISH_77_TRD1_2X2_FINAL_110DEG NL=69";
90 SetTitle(ntmp.Data());
93 AliEMCALGeometry *geom = GetGeometry() ;
94 //geom->CreateListOfTrd1Modules();
95 fShishKebabModules = geom->GetShishKebabTrd1Modules();
98 //______________________________________________________________________
99 void AliEMCALv0::BuildGeometry()
101 // Display Geometry for display.C
103 const Int_t kColorArm1 = kBlue ;
105 AliEMCALGeometry * geom = GetGeometry();
107 TString gn(geom->GetName());
110 // Define the shape of the Calorimeter
111 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
112 TNode * envelopNode = 0;
113 char *envn = "Envelop1";
114 if(!gn.Contains("SHISH") || gn.Contains("TRD2")){
115 new TTUBS(envn, "Tubs that contains arm 1", "void",
116 geom->GetEnvelop(0) -10, // rmin
117 geom->GetEnvelop(1) +40 ,// rmax
118 geom->GetEnvelop(2)/2.0, // half length in Z
119 geom->GetArm1PhiMin(), // minimum phi angle
120 geom->GetArm1PhiMax() // maximum phi angle
123 envelopNode = new TNode(envn, "Arm1 Envelop", "Envelop1", 0., 0., 0., "") ;
125 if(gn.Contains("WSUC")) {
126 envelopNode = BuildGeometryOfWSUC();
127 } else { // Shish-kebab now for compact, twist and TRD1 cases (ALIC)
129 TPGON *pgon = new TPGON(envn, "PGON that contains arm 1", "void",
130 geom->GetArm1PhiMin(),geom->GetArm1PhiMax()-geom->GetArm1PhiMin(),geom->GetNPhiSuperModule(), 2);
132 pgon->DefineSection(0, fEnvelop1[4], fEnvelop1[5], fEnvelop1[6]);
133 pgon->DefineSection(1, fEnvelop1[7], fEnvelop1[5], fEnvelop1[6]);
135 envelopNode = new TNode(envn, "Arm1 Envelop2", envn, 0., 0., 0., "") ;
139 envelopNode->SetLineColor(kColorArm1) ;
140 fNodes->Add(envelopNode);
143 TNode *AliEMCALv0::BuildGeometryOfWSUC()
145 // June 8, 2005; see directory geant3/TGeant3/G3toRoot.cxx
146 // enum EColor { kWhite, kBlack, kRed, kGreen, kBlue, kYellow, kMagenta, kCyan } - see $ROOTSYS/include/Gtypes.h
147 AliEMCALGeometry * g = GetGeometry();
148 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
151 TNode *envelopNode = 0;
155 new TBRIK(name, "WSUC(XEN1 in Geant)","void",fEnvelop1[0],fEnvelop1[1],fEnvelop1[2]);
156 envelopNode = new TNode(name, "envelope for WSUC", name, 0., 0., 0., "");
157 envelopNode->SetVisibility(0);
160 TNode *emod=0, *scmx=0;
161 name = "SMOD"; // super module
162 new TBRIK(name, "SMOD(SMOD in Geant)","void", fSmodPar0,fSmodPar1,fSmodPar2);
163 if(envelopNode) envelopNode->cd();
164 TNode *smod = new TNode(name, "SMOD", name, 0., 0., 0., "");
165 smod->SetLineColor(kBlue) ;
166 if(envelopNode==0) envelopNode = smod;
168 name = "EMOD"; // see CreateEMOD
169 TTRD1 *emodTrd1 = new TTRD1(name, "EMOD(EMOD in Geant)","void", float(fParEMOD[0]),
170 float(fParEMOD[1]),float(fParEMOD[2]),float(fParEMOD[3]));
172 // SCMX = EMOD/4 for simplicity of drawing
174 Float_t dz=0.,theta=0.,phi=0.,h1=0.,bl1=0.,tl1=0.,alpha1=0.,h2=0.,bl2=0.,tl2=0.,alpha2=0.;
175 h1 = emodTrd1->GetDy()/2.;
176 bl1 = emodTrd1->GetDx()/2.;
179 h2 = emodTrd1->GetDy()/2.;
180 bl2 = emodTrd1->GetDx2()/2.;
184 dz = emodTrd1->GetDz();
185 double dr = TMath::Sqrt((h2-h1)*(h2-h1)+(bl2-bl1)*(bl2-bl1));
186 theta = TMath::ATan2(dr,2.*dz) * TMath::RadToDeg();
189 TTRAP *scmxTrap = new TTRAP(name, "SCMX(SCMX as in Geant)","void",
190 dz,theta,phi, h1,bl1,tl1,alpha1, h2,bl2,tl2,alpha2);
192 Float_t xShiftSCMX = (emodTrd1->GetDx() + emodTrd1->GetDx2())/4.;
193 Float_t yShiftSCMX = emodTrd1->GetDy()/2.;
194 printf(" xShiftSCMX %7.4f yShiftSCMX %7.4f \n",xShiftSCMX,yShiftSCMX);
196 name = "EMOD"; // see CreateEMOD
199 AliEMCALShishKebabTrd1Module *mod=0;
200 Double_t angle=90., xpos=0.,ypos=0.,zpos=0., xposSCMX=0.,yposSCMX=0.,zposSCMX=0.;
201 char rtmn[100], rtmt[100];
202 TRotMatrix *rtm=0, *rtmSCMX=0;
204 for(int iz=0; iz<g->GetNZ(); iz++) {
205 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
206 zpos = mod->GetPosZ() - fSmodPar2;
207 ypos = mod->GetPosXfromR() - fSmodPar1;
209 angle = mod->GetThetaInDegree();
210 sprintf(rtmn,"rmEmod%5.1f",angle);
211 sprintf(rtmt,"rotation matrix for EMOD, iz=%i, angle = %6.3f",iz, angle);
212 if(iz==0) rtm = new TRotMatrix(rtmn, rtmt,0.,0., 90.,0., 90.,90.); // z'(x); y'(y); x'(z)
213 else rtm = new TRotMatrix(rtmn, rtmt,90.-angle,270., 90.0,0.0, angle,90.);
215 TGeometry *tg = gAlice->GetGeometry();
216 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
217 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
218 sprintf(rtmt,"EMOD, iz %i, ix %i, angle %6.3f",iz,ix, angle);
219 TString namNode=name;
220 namNode += numEmod++;
222 emod = new TNode(namNode.Data(), rtmt, (TShape*)emodTrd1, xpos,ypos,zpos,rtm);
223 // emod->SetLineColor(kGreen) ;
224 emod->SetVisibility(0); // SCMX will bi visible
225 if(scmxTrap) { // 4(2x2) sensetive volume inside EMOD
228 for(int jy=0; jy<2; jy++){ // division on y
229 yposSCMX = yShiftSCMX *(2*jy - 1);
230 for(int jx=0; jx<2; jx++){ // division on x
231 Double_t theta1=90.,phi1=0., theta2=90.,phi2=90., theta3=0.,phi3=0 ;
232 xposSCMX = xShiftSCMX *(2*jx - 1);
236 sprintf(rtmn,"rm%s",namNode.Data());
237 sprintf(rtmt,"rotation matrix for %s inside EMOD",namNode.Data());
238 rtmSCMX = tg->GetRotMatrix(rtmn);
240 phi1 = 180.; // x' = -x
241 phi2 = 270.; // y' = -y
243 if(rtmSCMX == 0) rtmSCMX = new TRotMatrix(rtmn,rtmt, theta1,phi1, theta2,phi2, theta3,phi3);
244 sprintf(rtmt,"%s inside %s", namNode.Data(), emod->GetName());
245 scmx = new TNode(namNode.Data(), rtmt, (TShape*)scmxTrap, xposSCMX,yposSCMX,zposSCMX,rtmSCMX);
246 scmx->SetLineColor(kMagenta);
252 // emod->Draw(); // for testing
257 //______________________________________________________________________
258 void AliEMCALv0::CreateGeometry()
260 // Create the EMCAL geometry for Geant
261 // Geometry of a tower
262 //|-----------------------------------------------------| XEN1
264 //| | Al thickness = GetAlFrontThickness() | |
268 //| ------------------------------------------------- |
269 //| | Air Gap = GetGap2Active() | |
271 //| ------------------------------------------------- |
272 //| | XU1 : XPST (ECAL e = GetECScintThick() ) | |
273 //| ------------------------------------------------- |
274 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
275 //| ------------------------------------------------- |
276 //| | XU1 : XPST (ECAL e = GetECScintThick() | |
277 //| ------------------------------------------------- |
278 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
279 //| ------------------------------------------------- |
280 //| etc ..... GetNECLayers() - 1 times |
281 //| ------------------------------------------------- |
282 //| | XUNLayer : XPST (ECAL e = GetECScintThick() | |
283 //| ------------------------------------------------- |
285 AliEMCALGeometry * geom = GetGeometry() ;
286 TString gn(geom->GetName());
289 if(!(geom->IsInitialized())){
290 Error("CreateGeometry","EMCAL Geometry class has not been set up.");
293 // Get pointer to the array containing media indices
294 fIdTmedArr = fIdtmed->GetArray() - 1599 ;
297 // gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule
298 AliMatrix(fIdRotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
300 // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1
302 Float_t envelopA[10];
303 if(gn.Contains("TRD2")) { // TUBS
304 envelopA[0] = geom->GetEnvelop(0) - 10.; // rmin
305 envelopA[1] = geom->GetEnvelop(1) + 12.; // rmax
306 // envelopA[2] = geom->ZFromEtaR(geom->GetEnvelop(1), geom->GetArm1EtaMin());
307 envelopA[2] = 390.; // 6-feb-05
308 envelopA[3] = geom->GetArm1PhiMin();
309 envelopA[4] = geom->GetArm1PhiMax();
310 gMC->Gsvolu("XEN1", "TUBS", fIdTmedArr[kIdAIR], envelopA, 5) ; // Tubs filled with air
311 fEnvelop1.Set(5, envelopA);
312 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
313 gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
314 } else if(gn.Contains("TRD1") && gn.Contains("WSUC") ) { // TRD1 for WSUC facility
315 // 17-may-05 - just BOX
319 gMC->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ;
321 for(int i=0; i<3; i++) fEnvelop1[i] = envelopA[i]; // 23-may-05
322 // Position the EMCAL Mother Volume (XEN1) in WSUC
323 gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
325 envelopA[0] = geom->GetArm1PhiMin(); // minimum phi angle
326 envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
327 envelopA[2] = geom->GetNPhi(); // number of sections in phi
328 envelopA[3] = 2; // 2 z coordinates
329 // envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1),
330 //geom->GetArm1EtaMin()); // z coordinate 1
331 envelopA[4] = -350.; // AM 30/5/2006
333 //add some padding for mother volume
334 envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1
335 envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1
336 // envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1),
337 // geom->GetArm1EtaMax()); // z coordinate 2
338 envelopA[7] = 350.; // AM 30/5/2006
340 envelopA[8] = envelopA[5] ; // radii are the same.
341 envelopA[9] = envelopA[6] ; // radii are the same.
343 if(gn.Contains("SHISH")) envelopA[2] = geom->GetNPhiSuperModule();
345 gMC->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ; // Polygone filled with air
346 fEnvelop1.Set(10, envelopA);
348 printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]);
349 printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]);
351 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
352 gMC->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
355 if(gn.Contains("SHISH")){
356 // COMPACT, TWIST, TRD2 or TRD1
357 AliDebug(2,Form("Shish-Kebab geometry : %s", GetTitle()));
358 CreateShishKebabGeometry();
362 //______________________________________________________________________
363 void AliEMCALv0::Init(void)
365 // Just prints an information message
367 if(AliLog::GetGlobalDebugLevel()>0) {
368 TString message("\n") ;
369 message += "*****************************************\n" ;
371 // Here the EMCAL initialisation code (if any!)
373 AliEMCALGeometry * geom = GetGeometry() ;
376 message += "AliEMCAL " ;
377 message += Version() ;
378 message += "EMCAL geometry initialized for " ;
379 message += geom->GetName() ;
382 message += "AliEMCAL " ;
383 message += Version() ;
384 message += "EMCAL geometry initialization failed !" ;
386 message += "\n*****************************************" ;
387 printf(message.Data() ) ;
392 void AliEMCALv0::CreateShishKebabGeometry()
394 // TWIST, TRD1 and TRD2
395 AliEMCALGeometry * g = GetGeometry();
396 TString gn(g->GetName()); gn.ToUpper();
397 // see AliModule::fFIdTmedArr
398 // fIdTmedArr = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials()
399 // int kIdAIR=1599, kIdPB = 1600, kIdSC = 1601, kIdSTEEL = 1603;
401 Double_t par[10], xpos=0., ypos=0., zpos=0.;
403 CreateSmod(g->GetNameOfEMCALEnvelope());
405 CreateEmod("SMOD","EMOD"); // 18-may-05
407 if(g->GetKey110DEG()) CreateEmod("SM10","EMOD"); // Nov 1,2006
409 // Sensitive SC (2x2 tiles)
410 double parSCM0[5]={0,0,0,0}, *dummy = 0, parTRAP[11];
411 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTmp = TMath::Tan(trd1Angle/2.);
412 if(!gn.Contains("TRD")) { // standard module
413 par[0] = (g->GetECPbRadThick()+g->GetECScintThick())*g->GetNECLayers()/2.;
414 par[1] = par[2] = g->GetPhiTileSize(); // Symetric case
415 gMC->Gsvolu("SCM0", "BOX", fIdTmedArr[kIdSC], par, 3); // 2x2 tiles
416 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
417 // Division to tile size
418 gMC->Gsdvn("SCM1","SCM0", g->GetNPHIdiv(), 2); // y-axis
419 gMC->Gsdvn("SCM2","SCM1", g->GetNETAdiv(), 3); // z-axis
420 // put LED to the SCM2
421 par[0] = g->GetECPbRadThick()/2.;
422 par[1] = par[2] = g->GetPhiTileSize()/2.; // Symetric case
423 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], par, 3);
425 printf(" Pb tiles \n");
428 xpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
429 for(int ix=0; ix<g->GetNECLayers(); ix++){
430 gMC->Gspos("PBTI", ++nr, "SCM2", xpos, ypos, zpos, 0, "ONLY") ;
431 // printf(" %i xpos %f \n", ix+1, xpos);
432 xpos += fSampleWidth;
434 printf(" Number of Pb tiles in SCM2 %i \n", nr);
435 } else if(gn.Contains("TRD1")) { // TRD1 - 30-sep-04
436 if(gn.Contains("MAY05")){
437 Double_t dzTmp = g->GetFrontSteelStrip()+g->GetPassiveScintThick();
438 parSCM0[0] = fParEMOD[0] + tanTmp*dzTmp; // dx1
439 parSCM0[1] = fParEMOD[1]; // dx2
440 parSCM0[2] = fParEMOD[2]; // dy
441 for(int i=0; i<3; i++) parSCM0[i] -= g->GetLateralSteelStrip();
442 parSCM0[3] = fParEMOD[3] - dzTmp/2.; // dz
444 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
445 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., dzTmp/2., 0, "ONLY") ;
446 } else { // before MAY 2005
447 // double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); // Need check
448 double wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() - g->GetPhiTileSize();
449 for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
450 parSCM0[3] = fParEMOD[3];
451 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
452 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
455 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
456 // Division to tile size - 1-oct-04
457 AliDebug(2,Form(" Divide SCM0 on y-axis %i\n", g->GetNETAdiv()));
458 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
460 parTRAP[0] = parSCM0[3]; // dz
461 parTRAP[1] = TMath::ATan2((parSCM0[1]-parSCM0[0])/2.,2.*parSCM0[3])*180./TMath::Pi(); // theta
462 parTRAP[2] = 0.; // phi
464 parTRAP[3] = parSCM0[2]/2.; // H1
465 parTRAP[4] = parSCM0[0]/2.; // BL1
466 parTRAP[5] = parTRAP[4]; // TL1
467 parTRAP[6] = 0.0; // ALP1
469 parTRAP[7] = parSCM0[2]/2.; // H2
470 parTRAP[8] = parSCM0[1]/2.; // BL2
471 parTRAP[9] = parTRAP[8]; // TL2
472 parTRAP[10]= 0.0; // ALP2
473 AliDebug(2,Form(" ** TRAP ** \n"));
474 for(int i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
476 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
477 xpos = +(parSCM0[1]+parSCM0[0])/4.;
478 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
480 // Using rotation because SCMX should be the same due to Pb tiles
482 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
483 gMC->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, fIdRotm, "ONLY");
484 // put LED to the SCM0
485 AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0);
486 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
488 par[1] = parSCM0[2]/2; // y
489 par[2] = g->GetECPbRadThick()/2.; // z
493 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
494 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.;
495 if(!gn.Contains("NOPB")) { // for testing - 11-jul-05
496 AliDebug(2,Form(" Pb tiles \n"));
497 for(int iz=0; iz<g->GetNECLayers(); iz++){
498 par[0] = (parSCM0[0] + mod->GetTanBetta()*fSampleWidth*iz)/2.;
499 xpos = par[0] - xCenterSCMX;
500 gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
501 AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]));
502 zpos += fSampleWidth;
504 AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr));
506 } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) {
507 printf(" before AliEMCALv0::Trd1Tower3X3() : parSCM0");
508 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
510 Trd1Tower3X3(parSCM0);
511 } else if(g->GetNPHIdiv()==1 && g->GetNETAdiv()==1) {
512 // no division in SCM0
513 Trd1Tower1X1(parSCM0);
514 } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) {
517 } else if(gn.Contains("TRD2")) { // TRD2 - 14-jan-05
518 // Scm0InTrd2(g, fParEMOD, parSCM0); // First dessin
519 PbmoInTrd2(g, fParEMOD, parSCM0); // Second design
523 void AliEMCALv0::CreateSmod(const char* mother)
525 // 18-may-05; mother="XEN1";
526 // child="SMOD" from first to 10th, "SM10" (11th and 12th) (TRD1 case)
527 // child="SMON" and "SMOP"("TRD2" case)
528 AliEMCALGeometry * g = GetGeometry();
529 TString gn(g->GetName()); gn.ToUpper();
531 Double_t par[3], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.;
533 // ===== define Super Module from air - 14x30 module ==== ;
534 fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
535 AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data()));
536 par[0] = g->GetShellThickness()/2.;
537 par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
538 par[2] = g->GetEtaModuleSize()*15.;
540 int nphism = g->GetNumberOfSuperModules()/2; // 20-may-05
542 dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/nphism;
543 // if(g->GetKey110DEG()) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1);
544 rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.;
545 AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi));
548 if (gn.Contains("TRD2")) { // tubs - 27-jan-05
549 parTubs[0] = g->GetTubsR(); // rmin
550 parTubs[1] = parTubs[0] + g->GetShellThickness(); // rmax ??
551 parTubs[2] = 380./2.; // DZ half length in z; 11-oct-04 - for 26 division
552 parTubs[3] = -dphi/2.; // PHI1 starting angle of the segment;
553 parTubs[4] = +dphi/2.; // PHI2 ending angle of the segment;
555 gMC->Gsvolu("SMOP", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // pozitive Z
556 gMC->Gsvolu("SMON", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // negative Z
558 AliDebug(2,Form(" SMOP,N ** TUBS **\n"));
559 AliDebug(2,Form("tmed %i | Rmin %7.2f Rmax %7.2f dz %7.2f phi1,2 (%7.2f,%7.2f)\n",
560 fIdTmedArr[kIdAIR], parTubs[0],parTubs[1],parTubs[2], parTubs[3],parTubs[4]));
561 // have to add 1 cm plastic before EMOD - time solution
562 } else if(gn.Contains("WSUC")) {
563 par[0] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
564 par[1] = g->GetShellThickness()/2.;
565 par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5;
567 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
569 AliDebug(2,Form("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
570 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
574 nphism = g->GetNumberOfSuperModules();
576 if (gn.Contains("TWIST")) {
577 par[2] += 0.4; // for 27 division
578 } else if(gn.Contains("TRD")) {
579 par[2] = 350./2.; // 11-oct-04 - for 26 division
580 if(gn.Contains("TRD1")) {
581 AliDebug(2,Form(" par[0] %7.2f (old) \n", par[0]));
582 Float_t *parSM = g->GetSuperModulesPars();
583 for(int i=0; i<3; i++) par[i] = parSM[i];
586 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
587 AliDebug(2,Form("tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
588 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
591 if(g->GetKey110DEG()) { // 12-oct-05
594 gMC->Gsvolu("SM10", "BOX", fIdTmedArr[kIdAIR], par, 3);
595 AliDebug(2,Form(" Super module with name \"SM10\" was created too par[1] = %f\n", par[1]));
599 if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
600 par[0] = g->GetSteelFrontThickness()/2.;
601 gMC->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3);
602 printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", fIdTmedArr[kIdSTEEL], par[0],par[1],par[2]);
603 xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.;
604 gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
608 int nr=0, nrsmod=0, i0=0;
609 if(gn.Contains("TEST")) {nphism = 1;} // just only 2 super modules;
611 // Turn whole super module
612 int turnSupMod = 1; // should be ONE; for testing = 0
613 for(int i=i0; i<nphism; i++) {
614 if (gn.Contains("TRD2")) { // tubs - 27-jan-05
616 printf("** TRD2 ** ");
617 if(turnSupMod==1) printf(" No 3 degree rotation !!! ");
620 Double_t phic=0., phicRad=0.; // phi angle of arc center
621 phic = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; //
622 phicRad = phic*TMath::DegToRad();
623 phi = phic - g->GetTubsTurnAngle();
624 phiRad = phi*TMath::DegToRad();
626 TVector2 vc; // position of super module center
627 vc.SetMagPhi(parTubs[0], phicRad);
628 TVector2 vcTurn; // position of super module center with turn
629 vcTurn.SetMagPhi(parTubs[0], phiRad);
630 TVector2 vcShift = vc - vcTurn;
635 } else { // 1-mar-05 ; just for testing - no turn od SMOD; looks good
639 AliMatrix(fIdRotm, 90.0, phic, 90.0, 90.0+phic, 0.0, 0.0);
641 gMC->Gspos("SMOP", ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
642 printf("SMOP %2i | %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
643 i, nr, fIdRotm, phic, phicRad, xpos, ypos, zpos);
644 printf(" phiy(90+phic) %6.1f \n", 90. + phic);
646 if(!gn.Contains("TEST1") && g->GetNumberOfSuperModules() > 1){
647 // double phiy = 90. + phic + 180.;
648 // if(phiy>=360.) phiy -= 360.;
649 // printf(" phiy %6.1f \n", phiy);
650 // AliMatrix(fIdRotm, 90.0, phic, 90.0, phiy, 180.0, 0.0);
651 gMC->Gspos("SMON", nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY") ;
652 printf("SMON %2i | %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
653 i, nr, fIdRotm, phic, phicRad, xpos, ypos, -zpos);
655 } else if(gn.Contains("WSUC")) {
656 xpos = ypos = zpos = 0.0;
658 gMC->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
659 printf(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
660 fIdRotm, phi, phiRad, xpos, ypos, zpos);
663 TString smName("SMOD"); // 12-oct-05
664 if(i==5 && g->GetKey110DEG()) {
669 phi = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170
670 phiRad = phi*TMath::Pi()/180.;
672 AliMatrix(fIdRotm, 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
674 xpos = rpos * TMath::Cos(phiRad);
675 ypos = rpos * TMath::Sin(phiRad);
676 zpos = fSmodPar2; // 21-sep-04
677 if(i==5 && g->GetKey110DEG()) {
678 xpos += (par1C/2. * TMath::Sin(phiRad));
679 ypos -= (par1C/2. * TMath::Cos(phiRad));
682 // 1th module in z-direction;
683 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
684 AliDebug(3, Form(" %s : %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n",
685 smName.Data(), nr, fIdRotm, phi, phiRad, xpos, ypos, zpos, i));
686 // 2th module in z-direction;
687 if(gn.Contains("TWIST") || gn.Contains("TRD")) {
688 // turn arround X axis; 0<phi<360
689 double phiy = 90. + phi + 180.;
690 if(phiy>=360.) phiy -= 360.;
692 AliMatrix(fIdRotm, 90.0, phi, 90.0, phiy, 180.0, 0.0);
693 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
694 AliDebug(3, Form(" %s : %2i fIdRotm %3i phiy %6.1f xpos %7.2f ypos %7.2f zpos %7.2f \n",
695 smName.Data(), nr, fIdRotm, phiy, xpos, ypos, -zpos));
697 gMC->Gspos("SMOD", ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
701 AliDebug(2,Form(" Number of Super Modules %i \n", nr+nrsmod));
704 void AliEMCALv0::CreateEmod(const char* mother, const char* child)
706 // 17-may-05; mother="SMOD"; child="EMOD"
707 AliEMCALGeometry * g = GetGeometry();
708 TString gn(g->GetName()); gn.ToUpper();
710 Double_t par[10], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0.;
711 Double_t parSCPA[5], zposSCPA=0.; // passive SC - 13-MAY-05, TRD1 case
712 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
713 Double_t tanTrd2y = TMath::Tan(g->GetTrd2AngleY()*TMath::DegToRad()/2.);
716 if(!gn.Contains("TRD")) { // standard module
717 par[0] = (fSampleWidth*g->GetNECLayers())/2.;
718 par[1] = par[2] = g->GetPhiModuleSize()/2.;
719 gMC->Gsvolu(child, "BOX", fIdTmedArr[kIdSTEEL], par, 3);
721 } else if (gn.Contains("TRD1")){ // TRD1 system coordinate iz differnet
722 if(strcmp(mother,"SMOD")==0) {
723 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
724 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
725 fParEMOD[2] = g->GetPhiModuleSize()/2.;; // dy
726 fParEMOD[3] = g->GetLongModuleSize()/2.; // dz
727 gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4);
728 if(gn.Contains("WSUC") || gn.Contains("MAY05")){
729 parSCPA[0] = g->GetEtaModuleSize()/2. + tanTrd1*g->GetFrontSteelStrip(); // dx1
730 parSCPA[1] = parSCPA[0] + tanTrd1*g->GetPassiveScintThick(); // dx2
731 parSCPA[2] = g->GetPhiModuleSize()/2.; // dy
732 parSCPA[3] = g->GetPassiveScintThick()/2.; // dz
733 gMC->Gsvolu("SCPA", "TRD1", fIdTmedArr[kIdSC], parSCPA, 4);
734 zposSCPA = -fParEMOD[3] + g->GetFrontSteelStrip() + g->GetPassiveScintThick()/2.;
735 gMC->Gspos ("SCPA", ++nr, child, 0.0, 0.0, zposSCPA, 0, "ONLY");
738 } else if (gn.Contains("TRD2")){ // TRD2 as for TRD1 - 27-jan-05
739 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
740 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
741 fParEMOD[2] = g->GetPhiModuleSize()/2.; // dy1
742 fParEMOD[3] = fParEMOD[2] + tanTrd2y*g->GetLongModuleSize();// dy2
743 fParEMOD[4] = g->GetLongModuleSize()/2.; // dz
744 gMC->Gsvolu(child, "TRD2", fIdTmedArr[kIdSTEEL], fParEMOD, 5);
748 if(gn.Contains("TWIST")) { // 13-sep-04
749 fShishKebabModules = new TList;
750 AliEMCALShishKebabModule *mod=0, *mTmp; // current module
751 for(int iz=0; iz<g->GetNZ(); iz++) {
752 //for(int iz=0; iz<4; iz++) {
754 mod = new AliEMCALShishKebabModule();
757 mTmp = new AliEMCALShishKebabModule(*mod);
759 Double_t angle = mod->GetThetaInDegree();
760 AliMatrix(fIdRotm, angle,0., 90.0,90.0, 90.-angle, 180.);
762 fShishKebabModules->Add(mod);
764 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
765 zpos = mod->GetPosZ() - fSmodPar2;
766 for(int iy=0; iy<g->GetNPhi(); iy++) {
767 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
768 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
769 // printf(" %3i(%2i,2i) xpos %7.2f ypos %7.2f zpos %7.2f \n", nr,iy,iz, xpos, ypos, zpos);
772 } else if(gn.Contains("TRD")) { // 30-sep-04; 27-jan-05 - as for TRD1 as for TRD2
773 // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0)
774 AliEMCALShishKebabTrd1Module *mod=0, *mTmp; // current module
776 for(int iz=0; iz<g->GetNZ(); iz++) {
777 Double_t angle=90., phiOK=0;
778 if(gn.Contains("TRD1")) {
779 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
780 angle = mod->GetThetaInDegree();
781 if(!gn.Contains("WSUC")) { // ALICE
782 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,90., 90.,0.); // z'(x); y'(y); x'(z)
783 else AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.);
784 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
785 // printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
786 //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
787 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
788 zpos = mod->GetPosZ() - fSmodPar2;
790 int iyMax = g->GetNPhi();
791 if(strcmp(mother,"SMOD") && g->GetKey110DEG()) {
794 for(int iy=0; iy<iyMax; iy++) { // flat in phi
795 ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
796 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
797 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm);
798 AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
802 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y)
803 else AliMatrix(fIdRotm, 90-angle,270., 90.0,0.0, angle,90.);
804 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
805 printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
806 iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
807 zpos = mod->GetPosZ() - fSmodPar2;
808 ypos = mod->GetPosXfromR() - fSmodPar1;
809 printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm);
810 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
811 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
812 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
813 printf(" %7.2f ", xpos);
817 } else if(gn.Contains("TRD2")){ // 1-feb-05 - TRD2; curve in phi
818 double angEtaRow = 0.;
819 double theta1=0.,phi1=0., theta2=0.,phi2=0., theta3=0.,phi3=0.;
822 mod = new AliEMCALShishKebabTrd1Module();
824 mTmp = new AliEMCALShishKebabTrd1Module(*mod);
826 angle = mod->GetThetaInDegree();
829 fShishKebabModules->Add(mod);
830 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
831 AliDebug(2,Form(" %i | theta | %6.3f - %6.3f = %6.3f\n", iz+1, angle, phiOK, angle-phiOK));
833 zpos = mod->GetPosZ() - parTubs[2];
834 rpos = parTubs[0] + mod->GetPosXfromR();
836 angle = mod->GetThetaInDegree();
837 Double_t stepAngle = (parTubs[4] - parTubs[3])/g->GetNPhi(); // 11-mar-04
838 for(int iy=0; iy<g->GetNPhi(); iy++) {
839 angEtaRow = parTubs[3] + stepAngle*(0.5+double(iy));
841 theta1 = 90. + angle; phi1 = angEtaRow; // x' ~-z;
842 theta2 = 90.; phi2 = 90. + angEtaRow;// y' ~ y;
843 theta3 = angle; phi3 = angEtaRow; // z' ~ x;
844 if(phi3 < 0.0) phi3 += 360.;
845 AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
847 xpos = rpos * TMath::Cos(angEtaRow*TMath::DegToRad());
848 ypos = rpos * TMath::Sin(angEtaRow*TMath::DegToRad());
849 gMC->Gspos(child, ++nr, "SMOP", xpos, ypos, zpos, fIdRotm, "ONLY") ;
851 phi1 = 180 + angEtaRow;
852 theta3 = 180.-theta3; phi3 = angEtaRow;
853 AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
854 gMC->Gspos(child, nr, "SMON", xpos, ypos, -zpos, fIdRotm, "ONLY") ;
855 if(AliDebugLevel()>=2) {
856 printf(" angEtaRow(phi) %7.2f | angle(eta) %7.2f \n", angEtaRow, angle);
857 printf("iy=%2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", iy, xpos, ypos, zpos, fIdRotm);
859 } // for(int iy=0; iy<g->GetNPhi(); iy++)
863 xpos = g->GetSteelFrontThickness()/2.;
864 for(int iz=0; iz<g->GetNZ(); iz++) {
865 zpos = -fSmodPar2 + g->GetEtaModuleSize()*(2*iz+1)/2.;
866 for(int iy=0; iy<g->GetNPhi(); iy++) {
867 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
868 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, 0, "ONLY") ;
869 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f \n", nr, xpos, ypos, zpos);
873 AliDebug(2,Form(" Number of modules in Super Module(%s) %i \n", mother, nr));
876 void AliEMCALv0::Trd1Tower3X3(const double *parSCM0)
878 // Started Dec 8,2004 by PAI
880 printf(" AliEMCALv0::Trd1Tower3X3() : parSCM0");
881 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
883 // Nov 10, 2006 - different name of SCMX
884 double parTRAP[11], *dummy=0;
885 AliEMCALGeometry * g = GetGeometry();
886 TString gn(g->GetName()), scmx;
888 // Division to tile size
889 AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv()));
890 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
891 double dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3];
892 double ndiv=3., xpos=0.0;
893 // should be defined once
894 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
895 for(int ix=1; ix<=3; ix++) { // 3X3
896 scmx = "SCX"; // Nov 10,2006
899 double xCentBot = 2.*dx1/3.;
900 double xCentTop = 2.*(dx2/4. + dx1/12.);
901 parTRAP[1] = TMath::ATan2((xCentTop-xCentBot),2.*dz)*TMath::RadToDeg(); // theta
902 parTRAP[2] = 0.; // phi
904 parTRAP[3] = dy/ndiv; // H1
905 parTRAP[4] = dx1/ndiv; // BL1
906 parTRAP[5] = parTRAP[4]; // TL1
907 parTRAP[6] = 0.0; // ALP1
909 parTRAP[7] = dy/ndiv; // H2
910 parTRAP[8] = dx2/2 - dx1/6.;// BL2
911 parTRAP[9] = parTRAP[8]; // TL2
912 parTRAP[10]= 0.0; // ALP2
913 xpos = (xCentBot+xCentTop)/2.;
916 parTRAP[1] = -parTRAP[1];
918 } else if(ix==2) { // central part is box but we treat as trapesoid due to numbering
920 parTRAP[8] = dx1/ndiv; // BL2
921 parTRAP[9] = parTRAP[8]; // TL2
924 AliDebug(2,Form(" ** TRAP ** xpos %9.3f\n", xpos));
925 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
928 gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
929 gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
931 PbInTrap(parTRAP, scmx);
933 AliDebug(2,Form("Trd1Tower3X3()", "Ver. 1.0 : was tested."));
937 void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
939 // see for example CreateShishKebabGeometry(); just for case TRD1
941 AliDebug(2,Form(" Pb tiles : nrstart %i\n", nr));
942 AliEMCALGeometry * g = GetGeometry();
945 // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
946 double xpos = 0.0, ypos = 0.0;
947 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
949 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
950 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // ??
951 // double tan = TMath::Tan(parTRAP[1]*TMath::DegToRad());
953 par[1] = parTRAP[3]; // y
954 par[2] = g->GetECPbRadThick()/2.; // z
955 for(int iz=0; iz<g->GetNECLayers(); iz++){
956 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
957 xpos = par[0] - xCenterSCMX;
958 if(parTRAP[1] < 0.) xpos = -xpos;
959 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
960 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
961 zpos += fSampleWidth;
962 if(iz%2>0) printf("\n");
964 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
965 AliDebug(2,Form(" par[1] %9.3f par[2] %9.3f ypos %9.3f \n", par[1], par[2], ypos));
966 AliDebug(2,Form(" PbInTrap Ver. 1.0 : was tested."));
970 void AliEMCALv0::Trd1Tower4X4()
975 void AliEMCALv0::Trd1Tower1X1(double *parSCM0)
977 // Started Nov 22,2006 by PAI
978 AliDebug(1," AliEMCALv0::Trd1Tower1X1() : parSCM0");
979 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
982 // No division - keeping the same volume logic
983 // and as consequence the same abs is scheme
984 AliDebug(2,"Trd1Tower1X1() : Create SCMX(SCMY) as SCM0");
986 gMC->Gsvolu("SCMY", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
987 gMC->Gspos("SCMY", 1, "SCM0", 0.0, 0.0, 0.0, 0, "ONLY");
988 gMC->Gsvolu("SCMX", "TRD1", fIdTmedArr[kIdSC], parSCM0, 4);
989 gMC->Gspos("SCMX", 1, "SCMY", 0.0, 0.0, 0.0, 0, "ONLY");
991 // should be defined once
993 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
995 PbInTrd1(parSCM0, "SCMX");
997 AliDebug(1,"Trd1Tower1X1() : Ver. 0.1 : was tested.");
1000 void AliEMCALv0::PbInTrd1(double *parTrd1, TString n)
1002 // see PbInTrap(const double parTrd1[11], TString n)
1003 static int nr=0, ndeb=2;
1004 AliDebug(ndeb,Form(" Pb tiles : nrstart %i\n", nr));
1005 AliEMCALGeometry * g = GetGeometry();
1008 // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1009 double xpos = 0.0, ypos = 0.0;
1010 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1011 double coef = (parTrd1[1] - parTrd1[0]) / (2.*parTrd1[3]);
1013 par[1] = parTrd1[2]; // y
1014 par[2] = g->GetECPbRadThick()/2.; // z
1016 for(int iz=0; iz<g->GetNECLayers(); iz++){
1017 par[0] = parTrd1[0] + coef*fSampleWidth*iz;
1018 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
1019 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
1020 zpos += fSampleWidth;
1021 if(iz%2>0) printf("\n");
1023 AliDebug(ndeb,Form(" Number of Pb tiles in SCMX %i coef %9.7f ", nr, coef));
1024 AliDebug(ndeb,Form(" PbInTrd1 Ver. 0.1 : was tested."));
1028 void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parSCM0[5])
1030 // Passive material inside the detector
1031 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); //Need check
1032 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
1033 for(int i=0; i<4; i++) { // on pictures sometimes I can not see 0 -> be carefull!!
1034 parSCM0[i] = emodPar[i] - wallThickness;
1035 AliDebug(2,Form(" %i parSCMO %7.3f emodPar %7.3f : dif %7.3f \n",
1036 i, parSCM0[i],emodPar[i], parSCM0[i]-emodPar[i]));
1038 parSCM0[4] = emodPar[4];
1039 gMC->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC
1040 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
1042 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
1043 Division2X2InScm0(g, parSCM0);
1045 Info("Scm0InTrd2"," no division SCM0 in this geometry |%s|\n", g->GetName());
1050 void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t parSCM0[5])
1053 Double_t parTRAP[11], xpos=0.,ypos=0., dx1=0.0,dx2=0.,dy1=0.0,dy2=0.,dz=0.
1057 Info("Division2X2InScm0","Divide SCM0 on y-axis %i\n", g->GetNETAdiv());
1058 TString n("SCMX"), overLapFlagSCMY("ONLY"), overLapFlagSCMX("ONLY");
1059 n = "SCM0"; // for testing - 14-mar-05
1061 PbInTrapForTrd2(parSCM0, n);
1062 // overLapFlagSCMY=overLapFlagSCMX="MANY"; // do not work
1066 dy1 = parSCM0[2] , dy2 = parSCM0[3], dz = parSCM0[4];
1068 parTRAP[0] = parSCM0[4]; // dz
1069 parTRAP[1] = TMath::ATan2((dy2-dy1)/2.,2.*dz)*TMath::RadToDeg();
1070 parTRAP[2] = 90.; // phi
1072 parTRAP[3] = parSCM0[2]/2.; // H1
1073 parTRAP[4] = parSCM0[0]; // BL1
1074 parTRAP[5] = parTRAP[4]; // TL1
1075 parTRAP[6] = 0.0; // ALP1
1077 parTRAP[7] = parSCM0[3]/2.; // H2
1078 parTRAP[8] = parSCM0[1]; // BL2
1079 parTRAP[9] = parTRAP[8]; // TL2
1080 parTRAP[10]= 0.0; // ALP2
1081 AliDebug(2,Form(" ** SCMY ** \n"));
1082 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1085 gMC->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC
1086 ypos = +(parTRAP[3]+parTRAP[7])/2.; //
1087 AliDebug(2,Form(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data()));
1088 gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm, overLapFlagSCMY.Data()) ;
1089 // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z
1090 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
1091 // We may have problem with numeration due to rotation - 4-feb-05
1092 gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm, overLapFlagSCMY.Data());
1094 Info("Division2X2InScm0","Divide SCMY on x-axis %i\n", g->GetNPHIdiv());
1097 dr1=TMath::Sqrt(dx1*dx1+dy1*dy1);
1098 dr2=TMath::Sqrt(dx2*dx2+dy2*dy2);
1100 parTRAP[0] = parSCM0[4]; // dz
1101 parTRAP[1] = TMath::ATan2((dr2-dr1)/2.,2.*dz)*TMath::RadToDeg(); //
1102 parTRAP[2] = 45.; // phi
1104 parTRAP[3] = parSCM0[2]/2.; // H1
1105 parTRAP[4] = parSCM0[0]/2.; // BL1
1106 parTRAP[5] = parTRAP[4]; // TL1
1107 parTRAP[6] = 0.0; // ALP1
1109 parTRAP[7] = parSCM0[3]/2.; // H2
1110 parTRAP[8] = parSCM0[1]/2; // BL2
1111 parTRAP[9] = parTRAP[8]; // TL2
1112 parTRAP[10]= 0.0; // ALP2
1113 AliDebug(2,Form(" ** SCMX ** \n"));
1114 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1117 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
1118 xpos = (parTRAP[4]+parTRAP[8])/2.;
1119 AliDebug(2,Form(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data()));
1120 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
1121 // AliMatrix(fIdRotm, 90.0,270., 90.0, 0.0, 0.0,0.0); // x'=-y; y'=x; z'=z
1122 AliMatrix(fIdRotm, 90.0,90., 90.0, -180.0, 0.0,0.0); // x'=y; y'=-x; z'=z
1123 gMC->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
1125 if(n=="SCMX" && overLapFlagSCMY == "ONLY") {
1126 PbInTrapForTrd2(parTRAP, n);
1131 void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
1135 TString pbShape("BOX"), pbtiChonly("ONLY");
1138 // pbtiChonly = "MANY";
1140 gMC->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0);
1143 Info("PbInTrapForTrd2"," Pb tiles inside %s: shape %s :pbtiChonly %s\n nrstart %i\n",
1144 name.Data(), pbShape.Data(), pbtiChonly.Data(), nr);
1145 AliEMCALGeometry * g = GetGeometry();
1147 double par[5], parPB[5], parSC[5];
1148 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1149 double xpos = 0.0, ypos = 0.0;
1150 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1151 if(name == "SCMX") { // common trapezoid - 11 parameters
1152 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
1153 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // the same for y
1154 AliDebug(2,Form(" xCenterSCMX %8.5f : coef %8.7f \n", xCenterSCMX, coef));
1156 par[2] = g->GetECPbRadThick()/2.; // z
1157 for(int iz=0; iz<g->GetNECLayers(); iz++){
1158 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
1160 xpos = ypos = par[0] - xCenterSCMX;
1161 //if(parTRAP[1] < 0.) xpos = -xpos;
1162 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
1163 AliDebug(2,Form(" %2.2i xpos %8.5f zpos %6.3f par[0,1] %6.3f |", iz+1, xpos, zpos, par[0]));
1164 if(iz%2>0) AliDebug(2,Form("\n"));
1165 zpos += fSampleWidth;
1167 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
1168 AliDebug(2,Form(" par[1] %9.5f par[2] %9.5f ypos %9.5f \n", par[1], par[2], ypos));
1169 } else if(name == "SCM0") { // 1-mar-05 ; TRD2 - 5 parameters
1170 AliDebug(2,Form(" SCM0 par = "));
1171 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parTRAP[i]));
1172 AliDebug(2,Form("\n zpos %f \n",zpos));
1174 double tanx = (parTRAP[1] - parTRAP[0]) / (2.*parTRAP[4]); // tanx = tany now
1175 double tany = (parTRAP[3] - parTRAP[2]) / (2.*parTRAP[4]), ztmp=0.;
1176 parPB[4] = g->GetECPbRadThick()/2.;
1177 parSC[2] = g->GetECScintThick()/2.;
1178 for(int iz=0; iz<g->GetNECLayers(); iz++){
1179 ztmp = fSampleWidth*double(iz);
1180 parPB[0] = parTRAP[0] + tanx*ztmp;
1181 parPB[1] = parPB[0] + tanx*g->GetECPbRadThick();
1182 parPB[2] = parTRAP[2] + tany*ztmp;
1183 parPB[3] = parPB[2] + tany*g->GetECPbRadThick();
1184 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ;
1185 AliDebug(2,Form("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos));
1187 for(int i=0; i<5; i++) printf(" %9.5f ", parPB[i]);
1188 // individual SC tile
1189 parSC[0] = parPB[0];
1190 parSC[1] = parPB[1];
1191 gMC->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(),
1192 0, pbtiChonly.Data(), parSC, 3) ;
1193 printf("\n SCTI zpos %6.3f | par = ", zpos+g->GetECScintThick());
1194 for(int i=0; i<3; i++) printf(" %9.5f ", parPB[i]);
1196 zpos += fSampleWidth;
1198 AliDebug(2,Form("\n"));
1200 Info("PbInTrapForTrd2", "Ver. 0.03 : was tested.");
1204 void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parPBMO[5])
1207 Info("PbmoInTrd2"," started : geometry %s ", g->GetName());
1208 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize();
1209 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
1210 for(int i=0; i<4; i++) {
1211 parPBMO[i] = emodPar[i] - wallThickness;
1212 AliDebug(2,Form(" %i parPBMO %7.3f emodPar %7.3f : dif %7.3f \n",
1213 i, parPBMO[i],emodPar[i], parPBMO[i]-emodPar[i]));
1215 parPBMO[4] = emodPar[4];
1216 gMC->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5);
1217 gMC->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
1219 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
1220 Division2X2InPbmo(g, parPBMO);
1221 AliDebug(2,Form(" PBMO, division 2X2 | geometry |%s|\n", g->GetName()));
1223 AliDebug(2,Form(" no division PBMO in this geometry |%s|\n", g->GetName()));
1228 void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t parPBMO[5])
1231 Info("Division2X2InPbmo"," started : geometry %s ", g->GetName());
1232 //Double_t *dummy=0;
1233 // gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0);
1236 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1237 double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;;
1238 double tanx = (parPBMO[1] - parPBMO[0]) / (2.*parPBMO[4]); // tanx = tany now
1239 double tany = (parPBMO[3] - parPBMO[2]) / (2.*parPBMO[4]);
1240 char name[10], named[10], named2[10];
1242 AliDebug(2,Form(" PBMO par = "));
1243 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parPBMO[i]));
1244 AliDebug(2,Form("\n"));
1246 parSC[2] = g->GetECScintThick()/2.;
1247 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick() + g->GetECScintThick()/2.;
1248 AliDebug(2,Form(" parSC[2] %9.5f \n", parSC[2]));
1249 for(int iz=0; iz<g->GetNECLayers(); iz++){
1250 ztmp = g->GetECPbRadThick() + fSampleWidth*double(iz); // Z for previous PB
1251 parSC[0] = parPBMO[0] + tanx*ztmp;
1252 parSC[1] = parPBMO[2] + tany*ztmp;
1254 sprintf(name,"SC%2.2i", iz+1);
1255 gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3);
1256 gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
1257 AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ",
1258 name, zpos, parSC[0], parSC[1]));
1260 sprintf(named,"SY%2.2i", iz+1);
1261 printf(" %s -> ", named);
1262 gMC->Gsdvn(named,name, 2, 2);
1264 sprintf(named2,"SX%2.2i", iz+1);
1265 printf(" %s \n", named2);
1266 gMC->Gsdvn(named2,named, 2, 1);
1268 zpos += fSampleWidth;
1272 AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta)
1275 AliEMCALShishKebabTrd1Module* trd1=0;
1276 if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) {
1277 trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta);
1282 //_____________________________________________________________________________
1283 void AliEMCALv0::AddAlignableVolumes() const
1286 // Create entries for alignable volumes associating the symbolic volume
1287 // name with the corresponding volume path. Needs to be synchronized with
1288 // eventual changes in the geometry.
1291 TString vpstr1 = "ALIC_1/XEN1_1/SMOD_";
1292 TString snstr1 = "EMCAL/FullSupermodule";
1293 TString volpath, symname;
1295 //Int_t nSMod = ((AliEMCALGeometry*)GetGeometry())->GetNumberOfSuperModules();
1296 //could use this, but what happens if it is > 10?
1298 for (Int_t smodnum=0; smodnum < 10; smodnum++) {
1300 symname += (smodnum+1);
1302 volpath += (smodnum+1);
1303 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1304 AliFatal("Unable to set alignable entry!!");
1307 if(GetGeometry()->GetKey110DEG()) {
1308 TString vpstr2 = "ALIC_1/XEN1_1/SM10_";
1309 TString snstr2 = "EMCAL/HalfSupermodule";
1310 for (Int_t smodnum=0; smodnum < 2; smodnum++) {
1312 symname += (smodnum+1);
1314 volpath += (smodnum+1);
1315 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1316 AliFatal("Unable to set alignable entry!!");