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 void AliEMCALv0::BuildGeometry()
100 // Display Geometry for display.C
102 const Int_t kColorArm1 = kBlue ;
104 AliEMCALGeometry * geom = GetGeometry();
106 TString gn(geom->GetName());
109 // Define the shape of the Calorimeter
110 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
111 TNode * envelopNode = 0;
112 char *envn = "Envelop1";
113 if(!gn.Contains("SHISH") || gn.Contains("TRD2")){
114 new TTUBS(envn, "Tubs that contains arm 1", "void",
115 geom->GetEnvelop(0) -10, // rmin
116 geom->GetEnvelop(1) +40 ,// rmax
117 geom->GetEnvelop(2)/2.0, // half length in Z
118 geom->GetArm1PhiMin(), // minimum phi angle
119 geom->GetArm1PhiMax() // maximum phi angle
122 envelopNode = new TNode(envn, "Arm1 Envelop", "Envelop1", 0., 0., 0., "") ;
124 if(gn.Contains("WSUC")) {
125 envelopNode = BuildGeometryOfWSUC();
126 } else { // Shish-kebab now for compact, twist and TRD1 cases (ALIC)
128 TPGON *pgon = new TPGON(envn, "PGON that contains arm 1", "void",
129 geom->GetArm1PhiMin(),geom->GetArm1PhiMax()-geom->GetArm1PhiMin(),geom->GetNPhiSuperModule(), 2);
131 pgon->DefineSection(0, fEnvelop1[4], fEnvelop1[5], fEnvelop1[6]);
132 pgon->DefineSection(1, fEnvelop1[7], fEnvelop1[5], fEnvelop1[6]);
134 envelopNode = new TNode(envn, "Arm1 Envelop2", envn, 0., 0., 0., "") ;
138 envelopNode->SetLineColor(kColorArm1) ;
139 fNodes->Add(envelopNode);
142 TNode *AliEMCALv0::BuildGeometryOfWSUC()
144 // June 8, 2005; see directory geant3/TGeant3/G3toRoot.cxx
145 // enum EColor { kWhite, kBlack, kRed, kGreen, kBlue, kYellow, kMagenta, kCyan } - see $ROOTSYS/include/Gtypes.h
146 AliEMCALGeometry * g = GetGeometry();
147 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
150 TNode *envelopNode = 0;
154 new TBRIK(name, "WSUC(XEN1 in Geant)","void",fEnvelop1[0],fEnvelop1[1],fEnvelop1[2]);
155 envelopNode = new TNode(name, "envelope for WSUC", name, 0., 0., 0., "");
156 envelopNode->SetVisibility(0);
159 TNode *emod=0, *scmx=0;
160 name = "SMOD"; // super module
161 new TBRIK(name, "SMOD(SMOD in Geant)","void", fSmodPar0,fSmodPar1,fSmodPar2);
162 if(envelopNode) envelopNode->cd();
163 TNode *smod = new TNode(name, "SMOD", name, 0., 0., 0., "");
164 smod->SetLineColor(kBlue) ;
165 if(envelopNode==0) envelopNode = smod;
167 name = "EMOD"; // see CreateEMOD
168 TTRD1 *emodTrd1 = new TTRD1(name, "EMOD(EMOD in Geant)","void", float(fParEMOD[0]),
169 float(fParEMOD[1]),float(fParEMOD[2]),float(fParEMOD[3]));
171 // SCMX = EMOD/4 for simplicity of drawing
173 Float_t dz=0.,theta=0.,phi=0.,h1=0.,bl1=0.,tl1=0.,alpha1=0.,h2=0.,bl2=0.,tl2=0.,alpha2=0.;
174 h1 = emodTrd1->GetDy()/2.;
175 bl1 = emodTrd1->GetDx()/2.;
178 h2 = emodTrd1->GetDy()/2.;
179 bl2 = emodTrd1->GetDx2()/2.;
183 dz = emodTrd1->GetDz();
184 double dr = TMath::Sqrt((h2-h1)*(h2-h1)+(bl2-bl1)*(bl2-bl1));
185 theta = TMath::ATan2(dr,2.*dz) * TMath::RadToDeg();
188 TTRAP *scmxTrap = new TTRAP(name, "SCMX(SCMX as in Geant)","void",
189 dz,theta,phi, h1,bl1,tl1,alpha1, h2,bl2,tl2,alpha2);
191 Float_t xShiftSCMX = (emodTrd1->GetDx() + emodTrd1->GetDx2())/4.;
192 Float_t yShiftSCMX = emodTrd1->GetDy()/2.;
193 printf(" xShiftSCMX %7.4f yShiftSCMX %7.4f \n",xShiftSCMX,yShiftSCMX);
195 name = "EMOD"; // see CreateEMOD
198 AliEMCALShishKebabTrd1Module *mod=0;
199 Double_t angle=90., xpos=0.,ypos=0.,zpos=0., xposSCMX=0.,yposSCMX=0.,zposSCMX=0.;
200 char rtmn[100], rtmt[100];
201 TRotMatrix *rtm=0, *rtmSCMX=0;
203 for(int iz=0; iz<g->GetNZ(); iz++) {
204 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
205 zpos = mod->GetPosZ() - fSmodPar2;
206 ypos = mod->GetPosXfromR() - fSmodPar1;
208 angle = mod->GetThetaInDegree();
209 sprintf(rtmn,"rmEmod%5.1f",angle);
210 sprintf(rtmt,"rotation matrix for EMOD, iz=%i, angle = %6.3f",iz, angle);
211 if(iz==0) rtm = new TRotMatrix(rtmn, rtmt,0.,0., 90.,0., 90.,90.); // z'(x); y'(y); x'(z)
212 else rtm = new TRotMatrix(rtmn, rtmt,90.-angle,270., 90.0,0.0, angle,90.);
214 TGeometry *tg = gAlice->GetGeometry();
215 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
216 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
217 sprintf(rtmt,"EMOD, iz %i, ix %i, angle %6.3f",iz,ix, angle);
218 TString namNode=name;
219 namNode += numEmod++;
221 emod = new TNode(namNode.Data(), rtmt, (TShape*)emodTrd1, xpos,ypos,zpos,rtm);
222 // emod->SetLineColor(kGreen) ;
223 emod->SetVisibility(0); // SCMX will bi visible
224 if(scmxTrap) { // 4(2x2) sensetive volume inside EMOD
227 for(int jy=0; jy<2; jy++){ // division on y
228 yposSCMX = yShiftSCMX *(2*jy - 1);
229 for(int jx=0; jx<2; jx++){ // division on x
230 Double_t theta1=90.,phi1=0., theta2=90.,phi2=90., theta3=0.,phi3=0 ;
231 xposSCMX = xShiftSCMX *(2*jx - 1);
235 sprintf(rtmn,"rm%s",namNode.Data());
236 sprintf(rtmt,"rotation matrix for %s inside EMOD",namNode.Data());
237 rtmSCMX = tg->GetRotMatrix(rtmn);
239 phi1 = 180.; // x' = -x
240 phi2 = 270.; // y' = -y
242 if(rtmSCMX == 0) rtmSCMX = new TRotMatrix(rtmn,rtmt, theta1,phi1, theta2,phi2, theta3,phi3);
243 sprintf(rtmt,"%s inside %s", namNode.Data(), emod->GetName());
244 scmx = new TNode(namNode.Data(), rtmt, (TShape*)scmxTrap, xposSCMX,yposSCMX,zposSCMX,rtmSCMX);
245 scmx->SetLineColor(kMagenta);
251 // emod->Draw(); // for testing
256 //______________________________________________________________________
257 void AliEMCALv0::CreateGeometry()
259 // Create the EMCAL geometry for Geant
260 // Geometry of a tower
261 //|-----------------------------------------------------| XEN1
263 //| | Al thickness = GetAlFrontThickness() | |
267 //| ------------------------------------------------- |
268 //| | Air Gap = GetGap2Active() | |
270 //| ------------------------------------------------- |
271 //| | XU1 : XPST (ECAL e = GetECScintThick() ) | |
272 //| ------------------------------------------------- |
273 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
274 //| ------------------------------------------------- |
275 //| | XU1 : XPST (ECAL e = GetECScintThick() | |
276 //| ------------------------------------------------- |
277 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
278 //| ------------------------------------------------- |
279 //| etc ..... GetNECLayers() - 1 times |
280 //| ------------------------------------------------- |
281 //| | XUNLayer : XPST (ECAL e = GetECScintThick() | |
282 //| ------------------------------------------------- |
284 AliEMCALGeometry * geom = GetGeometry() ;
285 TString gn(geom->GetName());
288 if(!(geom->IsInitialized())){
289 Error("CreateGeometry","EMCAL Geometry class has not been set up.");
292 // Get pointer to the array containing media indices
293 fIdTmedArr = fIdtmed->GetArray() - 1599 ;
296 // gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule
297 AliMatrix(fIdRotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
299 // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1
301 Float_t envelopA[10];
302 if(gn.Contains("TRD2")) { // TUBS
303 envelopA[0] = geom->GetEnvelop(0) - 10.; // rmin
304 envelopA[1] = geom->GetEnvelop(1) + 12.; // rmax
305 // envelopA[2] = geom->ZFromEtaR(geom->GetEnvelop(1), geom->GetArm1EtaMin());
306 envelopA[2] = 390.; // 6-feb-05
307 envelopA[3] = geom->GetArm1PhiMin();
308 envelopA[4] = geom->GetArm1PhiMax();
309 gMC->Gsvolu("XEN1", "TUBS", fIdTmedArr[kIdAIR], envelopA, 5) ; // Tubs filled with air
310 fEnvelop1.Set(5, envelopA);
311 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
312 gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
313 } else if(gn.Contains("TRD1") && gn.Contains("WSUC") ) { // TRD1 for WSUC facility
314 // 17-may-05 - just BOX
318 gMC->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ;
320 for(int i=0; i<3; i++) fEnvelop1[i] = envelopA[i]; // 23-may-05
321 // Position the EMCAL Mother Volume (XEN1) in WSUC
322 gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
324 envelopA[0] = geom->GetArm1PhiMin(); // minimum phi angle
325 envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
326 envelopA[2] = geom->GetNPhi(); // number of sections in phi
327 envelopA[3] = 2; // 2 z coordinates
328 // envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1),
329 //geom->GetArm1EtaMin()); // z coordinate 1
330 envelopA[4] = -350.; // AM 30/5/2006
332 //add some padding for mother volume
333 envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1
334 envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1
335 // envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1),
336 // geom->GetArm1EtaMax()); // z coordinate 2
337 envelopA[7] = 350.; // AM 30/5/2006
339 envelopA[8] = envelopA[5] ; // radii are the same.
340 envelopA[9] = envelopA[6] ; // radii are the same.
342 if(gn.Contains("SHISH")) envelopA[2] = geom->GetNPhiSuperModule();
344 gMC->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ; // Polygone filled with air
345 fEnvelop1.Set(10, envelopA);
347 printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]);
348 printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]);
350 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
351 gMC->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
354 if(gn.Contains("SHISH")){
355 // COMPACT, TWIST, TRD2 or TRD1
356 AliDebug(2,Form("Shish-Kebab geometry : %s", GetTitle()));
357 CreateShishKebabGeometry();
361 //______________________________________________________________________
362 void AliEMCALv0::Init(void)
364 // Just prints an information message
366 if(AliLog::GetGlobalDebugLevel()>0) {
367 TString message("\n") ;
368 message += "*****************************************\n" ;
370 // Here the EMCAL initialisation code (if any!)
372 AliEMCALGeometry * geom = GetGeometry() ;
375 message += "AliEMCAL " ;
376 message += Version() ;
377 message += "EMCAL geometry initialized for " ;
378 message += geom->GetName() ;
381 message += "AliEMCAL " ;
382 message += Version() ;
383 message += "EMCAL geometry initialization failed !" ;
385 message += "\n*****************************************" ;
386 printf(message.Data() ) ;
391 void AliEMCALv0::CreateShishKebabGeometry()
393 // TWIST, TRD1 and TRD2
394 AliEMCALGeometry * g = GetGeometry();
395 TString gn(g->GetName()); gn.ToUpper();
396 // see AliModule::fFIdTmedArr
397 // fIdTmedArr = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials()
398 // int kIdAIR=1599, kIdPB = 1600, kIdSC = 1601, kIdSTEEL = 1603;
400 Double_t par[10], xpos=0., ypos=0., zpos=0.;
402 CreateSmod(g->GetNameOfEMCALEnvelope());
404 CreateEmod("SMOD","EMOD"); // 18-may-05
406 if(gn.Contains("110DEG")) CreateEmod("SM10","EMOD"); // 12-oct-05
408 // Sensitive SC (2x2 tiles)
409 double parSCM0[5], *dummy = 0, parTRAP[11];
410 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTmp = TMath::Tan(trd1Angle/2.);
411 if(!gn.Contains("TRD")) { // standard module
412 par[0] = (g->GetECPbRadThick()+g->GetECScintThick())*g->GetNECLayers()/2.;
413 par[1] = par[2] = g->GetPhiTileSize(); // Symetric case
414 gMC->Gsvolu("SCM0", "BOX", fIdTmedArr[kIdSC], par, 3); // 2x2 tiles
415 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
416 // Division to tile size
417 gMC->Gsdvn("SCM1","SCM0", g->GetNPHIdiv(), 2); // y-axis
418 gMC->Gsdvn("SCM2","SCM1", g->GetNETAdiv(), 3); // z-axis
419 // put LED to the SCM2
420 par[0] = g->GetECPbRadThick()/2.;
421 par[1] = par[2] = g->GetPhiTileSize()/2.; // Symetric case
422 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], par, 3);
424 printf(" Pb tiles \n");
427 xpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
428 for(int ix=0; ix<g->GetNECLayers(); ix++){
429 gMC->Gspos("PBTI", ++nr, "SCM2", xpos, ypos, zpos, 0, "ONLY") ;
430 // printf(" %i xpos %f \n", ix+1, xpos);
431 xpos += fSampleWidth;
433 printf(" Number of Pb tiles in SCM2 %i \n", nr);
434 } else if(gn.Contains("TRD1")) { // TRD1 - 30-sep-04
435 if(gn.Contains("MAY05")){
436 Double_t dzTmp = g->GetFrontSteelStrip()+g->GetPassiveScintThick();
437 parSCM0[0] = fParEMOD[0] + tanTmp*dzTmp; // dx1
438 parSCM0[1] = fParEMOD[1]; // dx2
439 parSCM0[2] = fParEMOD[2]; // dy
440 for(int i=0; i<3; i++) parSCM0[i] -= g->GetLateralSteelStrip();
441 parSCM0[3] = fParEMOD[3] - dzTmp/2.; // dz
443 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
444 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., dzTmp/2., 0, "ONLY") ;
445 } else { // before MAY 2005
446 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); // Need check
447 for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
448 parSCM0[3] = fParEMOD[3];
449 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
450 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
453 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
454 // Division to tile size - 1-oct-04
455 AliDebug(2,Form(" Divide SCM0 on y-axis %i\n", g->GetNETAdiv()));
456 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
458 parTRAP[0] = parSCM0[3]; // dz
459 parTRAP[1] = TMath::ATan2((parSCM0[1]-parSCM0[0])/2.,2.*parSCM0[3])*180./TMath::Pi(); // theta
460 parTRAP[2] = 0.; // phi
462 parTRAP[3] = parSCM0[2]/2.; // H1
463 parTRAP[4] = parSCM0[0]/2.; // BL1
464 parTRAP[5] = parTRAP[4]; // TL1
465 parTRAP[6] = 0.0; // ALP1
467 parTRAP[7] = parSCM0[2]/2.; // H2
468 parTRAP[8] = parSCM0[1]/2.; // BL2
469 parTRAP[9] = parTRAP[8]; // TL2
470 parTRAP[10]= 0.0; // ALP2
471 AliDebug(2,Form(" ** TRAP ** \n"));
472 for(int i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
474 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
475 xpos = +(parSCM0[1]+parSCM0[0])/4.;
476 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
478 // Using rotation because SCMX should be the same due to Pb tiles
480 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
481 gMC->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, fIdRotm, "ONLY");
482 // put LED to the SCM0
483 AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0);
484 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
486 par[1] = parSCM0[2]/2; // y
487 par[2] = g->GetECPbRadThick()/2.; // z
491 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
492 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.;
493 if(!gn.Contains("NOPB")) { // for testing - 11-jul-05
494 AliDebug(2,Form(" Pb tiles \n"));
495 for(int iz=0; iz<g->GetNECLayers(); iz++){
496 par[0] = (parSCM0[0] + mod->GetTanBetta()*fSampleWidth*iz)/2.;
497 xpos = par[0] - xCenterSCMX;
498 gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
499 AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]));
500 zpos += fSampleWidth;
502 AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr));
504 } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) {
505 Trd1Tower3X3(parSCM0);
506 } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) {
509 } else if(gn.Contains("TRD2")) { // TRD2 - 14-jan-05
510 // Scm0InTrd2(g, fParEMOD, parSCM0); // First dessin
511 PbmoInTrd2(g, fParEMOD, parSCM0); // Second dessin
515 void AliEMCALv0::CreateSmod(const char* mother)
517 // 18-may-05; mother="XEN1";
518 // child="SMOD" from first to 10th, "SM10" (11th and 12th) (TRD1 case)
519 // child="SMON" and "SMOP"("TRD2" case)
520 AliEMCALGeometry * g = GetGeometry();
521 TString gn(g->GetName()); gn.ToUpper();
523 Double_t par[3], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.;
525 // ===== define Super Module from air - 14x30 module ==== ;
526 fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
527 AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data()));
528 par[0] = g->GetShellThickness()/2.;
529 par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
530 par[2] = g->GetEtaModuleSize()*15.;
532 int nphism = g->GetNumberOfSuperModules()/2; // 20-may-05
534 dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/nphism;
535 // if(gn.Contains("110DEG")) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1);
536 rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.;
537 AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi));
540 if (gn.Contains("TRD2")) { // tubs - 27-jan-05
541 parTubs[0] = g->GetTubsR(); // rmin
542 parTubs[1] = parTubs[0] + g->GetShellThickness(); // rmax ??
543 parTubs[2] = 380./2.; // DZ half length in z; 11-oct-04 - for 26 division
544 parTubs[3] = -dphi/2.; // PHI1 starting angle of the segment;
545 parTubs[4] = +dphi/2.; // PHI2 ending angle of the segment;
547 gMC->Gsvolu("SMOP", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // pozitive Z
548 gMC->Gsvolu("SMON", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // negative Z
550 AliDebug(2,Form(" SMOP,N ** TUBS **\n"));
551 AliDebug(2,Form("tmed %i | Rmin %7.2f Rmax %7.2f dz %7.2f phi1,2 (%7.2f,%7.2f)\n",
552 fIdTmedArr[kIdAIR], parTubs[0],parTubs[1],parTubs[2], parTubs[3],parTubs[4]));
553 // have to add 1 cm plastic before EMOD - time solution
554 } else if(gn.Contains("WSUC")) {
555 par[0] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
556 par[1] = g->GetShellThickness()/2.;
557 par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5;
559 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
561 AliDebug(2,Form("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
562 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
566 nphism = g->GetNumberOfSuperModules();
568 if (gn.Contains("TWIST")) {
569 par[2] += 0.4; // for 27 division
570 } else if(gn.Contains("TRD")) {
571 par[2] = 350./2.; // 11-oct-04 - for 26 division
572 if(gn.Contains("TRD1")) {
573 AliDebug(2,Form(" par[0] %7.2f (old) \n", par[0]));
574 Float_t *parSM = g->GetSuperModulesPars();
575 for(int i=0; i<3; i++) par[i] = parSM[i];
578 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
579 AliDebug(2,Form("tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
580 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
583 if(gn.Contains("110DEG")) { // 12-oct-05
586 gMC->Gsvolu("SM10", "BOX", fIdTmedArr[kIdAIR], par, 3);
587 AliDebug(2,Form(" Super module with name \"SM10\" was created too par[1] = %f\n", par[1]));
591 if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
592 par[0] = g->GetSteelFrontThickness()/2.;
593 gMC->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3);
594 printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", fIdTmedArr[kIdSTEEL], par[0],par[1],par[2]);
595 xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.;
596 gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
600 int nr=0, nrsmod=0, i0=0;
601 if(gn.Contains("TEST")) {nphism = 1;} // just only 2 super modules;
603 // Turn whole super module
604 int turnSupMod = 1; // should be ONE; for testing = 0
605 for(int i=i0; i<nphism; i++) {
606 if (gn.Contains("TRD2")) { // tubs - 27-jan-05
608 printf("** TRD2 ** ");
609 if(turnSupMod==1) printf(" No 3 degree rotation !!! ");
612 Double_t phic=0., phicRad=0.; // phi angle of arc center
613 phic = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; //
614 phicRad = phic*TMath::DegToRad();
615 phi = phic - g->GetTubsTurnAngle();
616 phiRad = phi*TMath::DegToRad();
618 TVector2 vc; // position of super module center
619 vc.SetMagPhi(parTubs[0], phicRad);
620 TVector2 vcTurn; // position of super module center with turn
621 vcTurn.SetMagPhi(parTubs[0], phiRad);
622 TVector2 vcShift = vc - vcTurn;
627 } else { // 1-mar-05 ; just for testing - no turn od SMOD; looks good
631 AliMatrix(fIdRotm, 90.0, phic, 90.0, 90.0+phic, 0.0, 0.0);
633 gMC->Gspos("SMOP", ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
634 printf("SMOP %2i | %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
635 i, nr, fIdRotm, phic, phicRad, xpos, ypos, zpos);
636 printf(" phiy(90+phic) %6.1f \n", 90. + phic);
638 if(!gn.Contains("TEST1") && g->GetNumberOfSuperModules() > 1){
639 // double phiy = 90. + phic + 180.;
640 // if(phiy>=360.) phiy -= 360.;
641 // printf(" phiy %6.1f \n", phiy);
642 // AliMatrix(fIdRotm, 90.0, phic, 90.0, phiy, 180.0, 0.0);
643 gMC->Gspos("SMON", nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY") ;
644 printf("SMON %2i | %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
645 i, nr, fIdRotm, phic, phicRad, xpos, ypos, -zpos);
647 } else if(gn.Contains("WSUC")) {
648 xpos = ypos = zpos = 0.0;
650 gMC->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
651 printf(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
652 fIdRotm, phi, phiRad, xpos, ypos, zpos);
655 TString smName("SMOD"); // 12-oct-05
656 if(i==5 && gn.Contains("110DEG")) {
661 phi = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170
662 phiRad = phi*TMath::Pi()/180.;
664 AliMatrix(fIdRotm, 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
666 xpos = rpos * TMath::Cos(phiRad);
667 ypos = rpos * TMath::Sin(phiRad);
668 zpos = fSmodPar2; // 21-sep-04
669 if(i==5 && gn.Contains("110DEG")) {
670 xpos += (par1C/2. * TMath::Sin(phiRad));
671 ypos -= (par1C/2. * TMath::Cos(phiRad));
674 // 1th module in z-direction;
675 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
676 AliDebug(3, Form(" %s : %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n",
677 smName.Data(), nr, fIdRotm, phi, phiRad, xpos, ypos, zpos, i));
678 // 2th module in z-direction;
679 if(gn.Contains("TWIST") || gn.Contains("TRD")) {
680 // turn arround X axis; 0<phi<360
681 double phiy = 90. + phi + 180.;
682 if(phiy>=360.) phiy -= 360.;
684 AliMatrix(fIdRotm, 90.0, phi, 90.0, phiy, 180.0, 0.0);
685 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
686 AliDebug(3, Form(" %s : %2i fIdRotm %3i phiy %6.1f xpos %7.2f ypos %7.2f zpos %7.2f \n",
687 smName.Data(), nr, fIdRotm, phiy, xpos, ypos, -zpos));
689 gMC->Gspos("SMOD", ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
693 AliDebug(2,Form(" Number of Super Modules %i \n", nr+nrsmod));
696 void AliEMCALv0::CreateEmod(const char* mother, const char* child)
698 // 17-may-05; mother="SMOD"; child="EMOD"
699 AliEMCALGeometry * g = GetGeometry();
700 TString gn(g->GetName()); gn.ToUpper();
702 Double_t par[10], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0.;
703 Double_t parSCPA[5], zposSCPA=0.; // passive SC - 13-MAY-05, TRD1 case
704 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
705 Double_t tanTrd2y = TMath::Tan(g->GetTrd2AngleY()*TMath::DegToRad()/2.);
708 if(!gn.Contains("TRD")) { // standard module
709 par[0] = (fSampleWidth*g->GetNECLayers())/2.;
710 par[1] = par[2] = g->GetPhiModuleSize()/2.;
711 gMC->Gsvolu(child, "BOX", fIdTmedArr[kIdSTEEL], par, 3);
713 } else if (gn.Contains("TRD1")){ // TRD1 system coordinate iz differnet
714 if(strcmp(mother,"SMOD")==0) {
715 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
716 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
717 fParEMOD[2] = g->GetPhiModuleSize()/2.;; // dy
718 fParEMOD[3] = g->GetLongModuleSize()/2.; // dz
719 gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4);
720 if(gn.Contains("WSUC") || gn.Contains("MAY05")){
721 parSCPA[0] = g->GetEtaModuleSize()/2. + tanTrd1*g->GetFrontSteelStrip(); // dx1
722 parSCPA[1] = parSCPA[0] + tanTrd1*g->GetPassiveScintThick(); // dx2
723 parSCPA[2] = g->GetPhiModuleSize()/2.; // dy
724 parSCPA[3] = g->GetPassiveScintThick()/2.; // dz
725 gMC->Gsvolu("SCPA", "TRD1", fIdTmedArr[kIdSC], parSCPA, 4);
726 zposSCPA = -fParEMOD[3] + g->GetFrontSteelStrip() + g->GetPassiveScintThick()/2.;
727 gMC->Gspos ("SCPA", ++nr, child, 0.0, 0.0, zposSCPA, 0, "ONLY");
730 } else if (gn.Contains("TRD2")){ // TRD2 as for TRD1 - 27-jan-05
731 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
732 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
733 fParEMOD[2] = g->GetPhiModuleSize()/2.; // dy1
734 fParEMOD[3] = fParEMOD[2] + tanTrd2y*g->GetLongModuleSize();// dy2
735 fParEMOD[4] = g->GetLongModuleSize()/2.; // dz
736 gMC->Gsvolu(child, "TRD2", fIdTmedArr[kIdSTEEL], fParEMOD, 5);
740 if(gn.Contains("TWIST")) { // 13-sep-04
741 fShishKebabModules = new TList;
742 AliEMCALShishKebabModule *mod=0, *mTmp; // current module
743 for(int iz=0; iz<g->GetNZ(); iz++) {
744 //for(int iz=0; iz<4; iz++) {
746 mod = new AliEMCALShishKebabModule();
749 mTmp = new AliEMCALShishKebabModule(*mod);
751 Double_t angle = mod->GetThetaInDegree();
752 AliMatrix(fIdRotm, angle,0., 90.0,90.0, 90.-angle, 180.);
754 fShishKebabModules->Add(mod);
756 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
757 zpos = mod->GetPosZ() - fSmodPar2;
758 for(int iy=0; iy<g->GetNPhi(); iy++) {
759 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
760 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
761 // printf(" %3i(%2i,2i) xpos %7.2f ypos %7.2f zpos %7.2f \n", nr,iy,iz, xpos, ypos, zpos);
764 } else if(gn.Contains("TRD")) { // 30-sep-04; 27-jan-05 - as for TRD1 as for TRD2
765 // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0)
766 AliEMCALShishKebabTrd1Module *mod=0, *mTmp; // current module
768 for(int iz=0; iz<g->GetNZ(); iz++) {
769 Double_t angle=90., phiOK=0;
770 if(gn.Contains("TRD1")) {
771 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
772 angle = mod->GetThetaInDegree();
773 if(!gn.Contains("WSUC")) { // ALICE
774 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,90., 90.,0.); // z'(x); y'(y); x'(z)
775 else AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.);
776 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
777 // printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
778 //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
779 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
780 zpos = mod->GetPosZ() - fSmodPar2;
782 int iyMax = g->GetNPhi();
783 if(strcmp(mother,"SMOD") && gn.Contains("110DEG")) {
786 for(int iy=0; iy<iyMax; iy++) { // flat in phi
787 ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
788 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
789 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm);
790 AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
794 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y)
795 else AliMatrix(fIdRotm, 90-angle,270., 90.0,0.0, angle,90.);
796 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
797 printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
798 iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
799 zpos = mod->GetPosZ() - fSmodPar2;
800 ypos = mod->GetPosXfromR() - fSmodPar1;
801 printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm);
802 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
803 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
804 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
805 printf(" %7.2f ", xpos);
809 } else if(gn.Contains("TRD2")){ // 1-feb-05 - TRD2; curve in phi
810 double angEtaRow = 0.;
811 double theta1=0.,phi1=0., theta2=0.,phi2=0., theta3=0.,phi3=0.;
814 mod = new AliEMCALShishKebabTrd1Module();
816 mTmp = new AliEMCALShishKebabTrd1Module(*mod);
818 angle = mod->GetThetaInDegree();
821 fShishKebabModules->Add(mod);
822 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
823 AliDebug(2,Form(" %i | theta | %6.3f - %6.3f = %6.3f\n", iz+1, angle, phiOK, angle-phiOK));
825 zpos = mod->GetPosZ() - parTubs[2];
826 rpos = parTubs[0] + mod->GetPosXfromR();
828 angle = mod->GetThetaInDegree();
829 Double_t stepAngle = (parTubs[4] - parTubs[3])/g->GetNPhi(); // 11-mar-04
830 for(int iy=0; iy<g->GetNPhi(); iy++) {
831 angEtaRow = parTubs[3] + stepAngle*(0.5+double(iy));
833 theta1 = 90. + angle; phi1 = angEtaRow; // x' ~-z;
834 theta2 = 90.; phi2 = 90. + angEtaRow;// y' ~ y;
835 theta3 = angle; phi3 = angEtaRow; // z' ~ x;
836 if(phi3 < 0.0) phi3 += 360.;
837 AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
839 xpos = rpos * TMath::Cos(angEtaRow*TMath::DegToRad());
840 ypos = rpos * TMath::Sin(angEtaRow*TMath::DegToRad());
841 gMC->Gspos(child, ++nr, "SMOP", xpos, ypos, zpos, fIdRotm, "ONLY") ;
843 phi1 = 180 + angEtaRow;
844 theta3 = 180.-theta3; phi3 = angEtaRow;
845 AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
846 gMC->Gspos(child, nr, "SMON", xpos, ypos, -zpos, fIdRotm, "ONLY") ;
847 if(AliDebugLevel()>=2) {
848 printf(" angEtaRow(phi) %7.2f | angle(eta) %7.2f \n", angEtaRow, angle);
849 printf("iy=%2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", iy, xpos, ypos, zpos, fIdRotm);
851 } // for(int iy=0; iy<g->GetNPhi(); iy++)
855 xpos = g->GetSteelFrontThickness()/2.;
856 for(int iz=0; iz<g->GetNZ(); iz++) {
857 zpos = -fSmodPar2 + g->GetEtaModuleSize()*(2*iz+1)/2.;
858 for(int iy=0; iy<g->GetNPhi(); iy++) {
859 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
860 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, 0, "ONLY") ;
861 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f \n", nr, xpos, ypos, zpos);
865 AliDebug(2,Form(" Number of modules in Super Module %i \n", nr));
869 void AliEMCALv0::Trd1Tower3X3(const double parSCM0[4])
871 // PB should be for whole SCM0 - ?
872 double parTRAP[11], *dummy=0;
873 AliEMCALGeometry * g = GetGeometry();
874 TString gn(g->GetName()), scmx;
876 // Division to tile size
877 AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv()));
878 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
879 double dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3];
880 double ndiv=3., xpos=0.0;
881 // should be defined once
882 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
883 if(gn.Contains("TEST")==0) { // one name for all trapesoid
885 gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], dummy, 0);
889 for(int ix=1; ix<=3; ix++) { // 3X3
892 parTRAP[1] = TMath::ATan2((dx2-dx1)/2.,2.*dz)*TMath::RadToDeg(); // theta
893 parTRAP[2] = 0.; // phi
895 parTRAP[3] = dy/ndiv; // H1
896 parTRAP[4] = dx1/ndiv; // BL1
897 parTRAP[5] = parTRAP[4]; // TL1
898 parTRAP[6] = 0.0; // ALP1
900 parTRAP[7] = dy/ndiv; // H2
901 parTRAP[8] = dx2/ndiv; // BL2
902 parTRAP[9] = parTRAP[8]; // TL2
903 parTRAP[10]= 0.0; // ALP2
904 xpos = +(dx1+dx2)/3.; // 6 or 3
907 parTRAP[1] = -parTRAP[1];
909 } else if(ix==2) { // central part is box but we treat as trapesoid due to numbering
911 parTRAP[8] = dx1/ndiv; // BL2
912 parTRAP[9] = parTRAP[8]; // TL2
915 AliDebug(2,Form(" ** TRAP ** xpos %9.3f\n", xpos));
916 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
917 if(gn.Contains("TEST")){
918 scmx = "SCX"; scmx += ix;
919 gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
920 gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
922 gMC->Gsposp(scmx.Data(), ix, "SCMY", xpos, 0.0, 0.0, 0, "ONLY", parTRAP, 11) ;
924 PbInTrap(parTRAP, scmx);
926 AliDebug(2,Form("Trd1Tower3X3()", "Ver. 1.0 : was tested."));
930 void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
932 // see for example CreateShishKebabGeometry(); just for case TRD1
934 AliDebug(2,Form(" Pb tiles : nrstart %i\n", nr));
935 AliEMCALGeometry * g = GetGeometry();
938 // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
939 double xpos = 0.0, ypos = 0.0;
940 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
942 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
943 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // ??
944 // double tan = TMath::Tan(parTRAP[1]*TMath::DegToRad());
946 par[1] = parTRAP[3]; // y
947 par[2] = g->GetECPbRadThick()/2.; // z
948 for(int iz=0; iz<g->GetNECLayers(); iz++){
949 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
950 xpos = par[0] - xCenterSCMX;
951 if(parTRAP[1] < 0.) xpos = -xpos;
952 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
953 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
954 zpos += fSampleWidth;
955 if(iz%2>0) printf("\n");
957 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
958 AliDebug(2,Form(" par[1] %9.3f par[2] %9.3f ypos %9.3f \n", par[1], par[2], ypos));
959 AliDebug(2,Form(" PbInTrap Ver. 1.0 : was tested."));
963 void AliEMCALv0::Trd1Tower4X4()
968 void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parSCM0[5])
970 // Passive material inside the detector
971 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); //Need check
972 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
973 for(int i=0; i<4; i++) { // on pictures sometimes I can not see 0 -> be carefull!!
974 parSCM0[i] = emodPar[i] - wallThickness;
975 AliDebug(2,Form(" %i parSCMO %7.3f emodPar %7.3f : dif %7.3f \n",
976 i, parSCM0[i],emodPar[i], parSCM0[i]-emodPar[i]));
978 parSCM0[4] = emodPar[4];
979 gMC->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC
980 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
982 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
983 Division2X2InScm0(g, parSCM0);
985 Info("Scm0InTrd2"," no division SCM0 in this geometry |%s|\n", g->GetName());
990 void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t parSCM0[5])
993 Double_t parTRAP[11], xpos=0.,ypos=0., dx1=0.0,dx2=0.,dy1=0.0,dy2=0.,dz=0.
997 Info("Division2X2InScm0","Divide SCM0 on y-axis %i\n", g->GetNETAdiv());
998 TString n("SCMX"), overLapFlagSCMY("ONLY"), overLapFlagSCMX("ONLY");
999 n = "SCM0"; // for testing - 14-mar-05
1001 PbInTrapForTrd2(parSCM0, n);
1002 // overLapFlagSCMY=overLapFlagSCMX="MANY"; // do not work
1006 dy1 = parSCM0[2] , dy2 = parSCM0[3], dz = parSCM0[4];
1008 parTRAP[0] = parSCM0[4]; // dz
1009 parTRAP[1] = TMath::ATan2((dy2-dy1)/2.,2.*dz)*TMath::RadToDeg();
1010 parTRAP[2] = 90.; // phi
1012 parTRAP[3] = parSCM0[2]/2.; // H1
1013 parTRAP[4] = parSCM0[0]; // BL1
1014 parTRAP[5] = parTRAP[4]; // TL1
1015 parTRAP[6] = 0.0; // ALP1
1017 parTRAP[7] = parSCM0[3]/2.; // H2
1018 parTRAP[8] = parSCM0[1]; // BL2
1019 parTRAP[9] = parTRAP[8]; // TL2
1020 parTRAP[10]= 0.0; // ALP2
1021 AliDebug(2,Form(" ** SCMY ** \n"));
1022 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1025 gMC->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC
1026 ypos = +(parTRAP[3]+parTRAP[7])/2.; //
1027 AliDebug(2,Form(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data()));
1028 gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm, overLapFlagSCMY.Data()) ;
1029 // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z
1030 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
1031 // We may have problem with numeration due to rotation - 4-feb-05
1032 gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm, overLapFlagSCMY.Data());
1034 Info("Division2X2InScm0","Divide SCMY on x-axis %i\n", g->GetNPHIdiv());
1037 dr1=TMath::Sqrt(dx1*dx1+dy1*dy1);
1038 dr2=TMath::Sqrt(dx2*dx2+dy2*dy2);
1040 parTRAP[0] = parSCM0[4]; // dz
1041 parTRAP[1] = TMath::ATan2((dr2-dr1)/2.,2.*dz)*TMath::RadToDeg(); //
1042 parTRAP[2] = 45.; // phi
1044 parTRAP[3] = parSCM0[2]/2.; // H1
1045 parTRAP[4] = parSCM0[0]/2.; // BL1
1046 parTRAP[5] = parTRAP[4]; // TL1
1047 parTRAP[6] = 0.0; // ALP1
1049 parTRAP[7] = parSCM0[3]/2.; // H2
1050 parTRAP[8] = parSCM0[1]/2; // BL2
1051 parTRAP[9] = parTRAP[8]; // TL2
1052 parTRAP[10]= 0.0; // ALP2
1053 AliDebug(2,Form(" ** SCMX ** \n"));
1054 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1057 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
1058 xpos = (parTRAP[4]+parTRAP[8])/2.;
1059 AliDebug(2,Form(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data()));
1060 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
1061 // AliMatrix(fIdRotm, 90.0,270., 90.0, 0.0, 0.0,0.0); // x'=-y; y'=x; z'=z
1062 AliMatrix(fIdRotm, 90.0,90., 90.0, -180.0, 0.0,0.0); // x'=y; y'=-x; z'=z
1063 gMC->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
1065 if(n=="SCMX" && overLapFlagSCMY == "ONLY") {
1066 PbInTrapForTrd2(parTRAP, n);
1071 void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
1075 TString pbShape("BOX"), pbtiChonly("ONLY");
1078 // pbtiChonly = "MANY";
1080 gMC->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0);
1083 Info("PbInTrapForTrd2"," Pb tiles inside %s: shape %s :pbtiChonly %s\n nrstart %i\n",
1084 name.Data(), pbShape.Data(), pbtiChonly.Data(), nr);
1085 AliEMCALGeometry * g = GetGeometry();
1087 double par[5], parPB[5], parSC[5];
1088 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1089 double xpos = 0.0, ypos = 0.0;
1090 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1091 if(name == "SCMX") { // common trapezoid - 11 parameters
1092 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
1093 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // the same for y
1094 AliDebug(2,Form(" xCenterSCMX %8.5f : coef %8.7f \n", xCenterSCMX, coef));
1096 par[2] = g->GetECPbRadThick()/2.; // z
1097 for(int iz=0; iz<g->GetNECLayers(); iz++){
1098 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
1100 xpos = ypos = par[0] - xCenterSCMX;
1101 //if(parTRAP[1] < 0.) xpos = -xpos;
1102 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
1103 AliDebug(2,Form(" %2.2i xpos %8.5f zpos %6.3f par[0,1] %6.3f |", iz+1, xpos, zpos, par[0]));
1104 if(iz%2>0) AliDebug(2,Form("\n"));
1105 zpos += fSampleWidth;
1107 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
1108 AliDebug(2,Form(" par[1] %9.5f par[2] %9.5f ypos %9.5f \n", par[1], par[2], ypos));
1109 } else if(name == "SCM0") { // 1-mar-05 ; TRD2 - 5 parameters
1110 AliDebug(2,Form(" SCM0 par = "));
1111 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parTRAP[i]));
1112 AliDebug(2,Form("\n zpos %f \n",zpos));
1114 double tanx = (parTRAP[1] - parTRAP[0]) / (2.*parTRAP[4]); // tanx = tany now
1115 double tany = (parTRAP[3] - parTRAP[2]) / (2.*parTRAP[4]), ztmp=0.;
1116 parPB[4] = g->GetECPbRadThick()/2.;
1117 parSC[2] = g->GetECScintThick()/2.;
1118 for(int iz=0; iz<g->GetNECLayers(); iz++){
1119 ztmp = fSampleWidth*double(iz);
1120 parPB[0] = parTRAP[0] + tanx*ztmp;
1121 parPB[1] = parPB[0] + tanx*g->GetECPbRadThick();
1122 parPB[2] = parTRAP[2] + tany*ztmp;
1123 parPB[3] = parPB[2] + tany*g->GetECPbRadThick();
1124 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ;
1125 AliDebug(2,Form("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos));
1127 for(int i=0; i<5; i++) printf(" %9.5f ", parPB[i]);
1128 // individual SC tile
1129 parSC[0] = parPB[0];
1130 parSC[1] = parPB[1];
1131 gMC->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(),
1132 0, pbtiChonly.Data(), parSC, 3) ;
1133 printf("\n SCTI zpos %6.3f | par = ", zpos+g->GetECScintThick());
1134 for(int i=0; i<3; i++) printf(" %9.5f ", parPB[i]);
1136 zpos += fSampleWidth;
1138 AliDebug(2,Form("\n"));
1140 Info("PbInTrapForTrd2", "Ver. 0.03 : was tested.");
1144 void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parPBMO[5])
1147 Info("PbmoInTrd2"," started : geometry %s ", g->GetName());
1148 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize();
1149 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
1150 for(int i=0; i<4; i++) {
1151 parPBMO[i] = emodPar[i] - wallThickness;
1152 AliDebug(2,Form(" %i parPBMO %7.3f emodPar %7.3f : dif %7.3f \n",
1153 i, parPBMO[i],emodPar[i], parPBMO[i]-emodPar[i]));
1155 parPBMO[4] = emodPar[4];
1156 gMC->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5);
1157 gMC->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
1159 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
1160 Division2X2InPbmo(g, parPBMO);
1161 AliDebug(2,Form(" PBMO, division 2X2 | geometry |%s|\n", g->GetName()));
1163 AliDebug(2,Form(" no division PBMO in this geometry |%s|\n", g->GetName()));
1168 void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t parPBMO[5])
1171 Info("Division2X2InPbmo"," started : geometry %s ", g->GetName());
1172 //Double_t *dummy=0;
1173 // gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0);
1176 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1177 double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;;
1178 double tanx = (parPBMO[1] - parPBMO[0]) / (2.*parPBMO[4]); // tanx = tany now
1179 double tany = (parPBMO[3] - parPBMO[2]) / (2.*parPBMO[4]);
1180 char name[10], named[10], named2[10];
1182 AliDebug(2,Form(" PBMO par = "));
1183 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parPBMO[i]));
1184 AliDebug(2,Form("\n"));
1186 parSC[2] = g->GetECScintThick()/2.;
1187 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick() + g->GetECScintThick()/2.;
1188 AliDebug(2,Form(" parSC[2] %9.5f \n", parSC[2]));
1189 for(int iz=0; iz<g->GetNECLayers(); iz++){
1190 ztmp = g->GetECPbRadThick() + fSampleWidth*double(iz); // Z for previous PB
1191 parSC[0] = parPBMO[0] + tanx*ztmp;
1192 parSC[1] = parPBMO[2] + tany*ztmp;
1194 sprintf(name,"SC%2.2i", iz+1);
1195 gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3);
1196 gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
1197 AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ",
1198 name, zpos, parSC[0], parSC[1]));
1200 sprintf(named,"SY%2.2i", iz+1);
1201 printf(" %s -> ", named);
1202 gMC->Gsdvn(named,name, 2, 2);
1204 sprintf(named2,"SX%2.2i", iz+1);
1205 printf(" %s \n", named2);
1206 gMC->Gsdvn(named2,named, 2, 1);
1208 zpos += fSampleWidth;
1212 AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta)
1215 AliEMCALShishKebabTrd1Module* trd1=0;
1216 if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) {
1217 trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta);
1222 //_____________________________________________________________________________
1223 void AliEMCALv0::AddAlignableVolumes() const
1226 // Create entries for alignable volumes associating the symbolic volume
1227 // name with the corresponding volume path. Needs to be synchronized with
1228 // eventual changes in the geometry.
1231 TString vpstr1 = "ALIC_1/XEN1_1/SMOD_";
1232 TString snstr1 = "EMCAL/FullSupermodule";
1233 TString volpath, symname;
1235 //Int_t nSMod = ((AliEMCALGeometry*)GetGeometry())->GetNumberOfSuperModules();
1236 //could use this, but what happens if it is > 10?
1238 for (Int_t smodnum=0; smodnum < 10; smodnum++) {
1240 symname += (smodnum+1);
1242 volpath += (smodnum+1);
1243 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1244 AliFatal("Unable to set alignable entry!!");
1247 TString gn( ((AliEMCALGeometry*)GetGeometry())->GetName() );
1249 if(gn.Contains("110DEG")) {
1250 TString vpstr2 = "ALIC_1/XEN1_1/SM10_";
1251 TString snstr2 = "EMCAL/HalfSupermodule";
1252 for (Int_t smodnum=0; smodnum < 2; smodnum++) {
1254 symname += (smodnum+1);
1256 volpath += (smodnum+1);
1257 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1258 AliFatal("Unable to set alignable entry!!");