1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 //_________________________________________________________________________
18 // Implementation version v0 of EMCAL Manager class
19 // An object of this class does not produce hits nor digits
20 // It is the one to use if you do not want to produce outputs in TREEH or TREED
21 // This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx
22 //*-- Author: Yves Schutz (SUBATECH)
23 //*-- and : Sahal Yacoob (LBL / UCT)
24 // : Aleksei Pavlinov (WSU) SHASHLYK
26 // --- ROOT system ---
36 #include <TGeometry.h>
37 #include <TVirtualMC.h>
44 #include "AliEMCALShishKebabModule.h"
45 #include "AliEMCALShishKebabTrd1Module.h"
47 // --- Standard library ---
51 // --- AliRoot header files ---
53 #include "AliEMCALv0.h"
54 #include "AliEMCALGeometry.h"
70 //______________________________________________________________________
71 AliEMCALv0::AliEMCALv0()
73 fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
74 fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0)
79 //______________________________________________________________________
80 AliEMCALv0::AliEMCALv0(const char *name, const char *title)
81 : AliEMCAL(name,title),
82 fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
83 fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0)
85 // ctor : title is used to identify the layout
87 // Nov 22, 2006 - case of 1X1
88 TString ntmp(GetTitle());
90 if(ntmp == "TRD1") { // TRD1 is alias for SHISH_77_TRD1_2X2_FINAL_110DEG NL=69
91 ntmp = "SHISH_77_TRD1_2X2_FINAL_110DEG NL=69";
92 SetTitle(ntmp.Data());
95 AliEMCALGeometry *geom = GetGeometry() ;
96 //geom->CreateListOfTrd1Modules();
97 fShishKebabModules = geom->GetShishKebabTrd1Modules();
100 //______________________________________________________________________
101 void AliEMCALv0::BuildGeometry()
103 // Display Geometry for display.C
105 const Int_t kColorArm1 = kBlue ;
107 AliEMCALGeometry * geom = GetGeometry();
109 TString gn(geom->GetName());
112 // Define the shape of the Calorimeter
113 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
114 TNode * envelopNode = 0;
115 char *envn = "Envelop1";
116 if(!gn.Contains("SHISH") || gn.Contains("TRD2")){
117 new TTUBS(envn, "Tubs that contains arm 1", "void",
118 geom->GetEnvelop(0) -10, // rmin
119 geom->GetEnvelop(1) +40 ,// rmax
120 geom->GetEnvelop(2)/2.0, // half length in Z
121 geom->GetArm1PhiMin(), // minimum phi angle
122 geom->GetArm1PhiMax() // maximum phi angle
125 envelopNode = new TNode(envn, "Arm1 Envelop", "Envelop1", 0., 0., 0., "") ;
127 if(gn.Contains("WSUC")) {
128 envelopNode = BuildGeometryOfWSUC();
129 } else { // Shish-kebab now for compact, twist and TRD1 cases (ALIC)
131 TPGON *pgon = new TPGON(envn, "PGON that contains arm 1", "void",
132 geom->GetArm1PhiMin(),geom->GetArm1PhiMax()-geom->GetArm1PhiMin(),geom->GetNPhiSuperModule(), 2);
134 if (fEnvelop1.GetSize()<8) {
136 fEnvelop1[0] = geom->GetArm1PhiMin(); // minimum phi angle
137 fEnvelop1[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
138 fEnvelop1[2] = geom->GetNPhi(); // number of sections in phi
139 fEnvelop1[3] = 2; // 2 z coordinates
140 fEnvelop1[4] = -350.;
141 fEnvelop1[5] = geom->GetEnvelop(0) ; // rmin at z1
142 fEnvelop1[6] = geom->GetEnvelop(1) ; // rmax at z1
144 fEnvelop1[8] = fEnvelop1[5] ; // radii are the same.
145 fEnvelop1[9] = fEnvelop1[6] ; // radii are the same.
147 if(gn.Contains("SHISH"))
148 fEnvelop1[2] = geom->GetNPhiSuperModule();
150 pgon->DefineSection(0, fEnvelop1[4], fEnvelop1[5], fEnvelop1[6]);
151 pgon->DefineSection(1, fEnvelop1[7], fEnvelop1[5], fEnvelop1[6]);
153 envelopNode = new TNode(envn, "Arm1 Envelop2", envn, 0., 0., 0., "") ;
157 envelopNode->SetLineColor(kColorArm1) ;
158 fNodes->Add(envelopNode);
161 TNode *AliEMCALv0::BuildGeometryOfWSUC()
163 // June 8, 2005; see directory geant3/TGeant3/G3toRoot.cxx
164 // enum EColor { kWhite, kBlack, kRed, kGreen, kBlue, kYellow, kMagenta, kCyan } - see $ROOTSYS/include/Gtypes.h
165 AliEMCALGeometry * g = GetGeometry();
166 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
169 TNode *envelopNode = 0;
173 new TBRIK(name, "WSUC(XEN1 in Geant)","void",fEnvelop1[0],fEnvelop1[1],fEnvelop1[2]);
174 envelopNode = new TNode(name, "envelope for WSUC", name, 0., 0., 0., "");
175 envelopNode->SetVisibility(0);
178 TNode *emod=0, *scmx=0;
179 name = "SMOD"; // super module
180 new TBRIK(name, "SMOD(SMOD in Geant)","void", fSmodPar0,fSmodPar1,fSmodPar2);
181 if(envelopNode) envelopNode->cd();
182 TNode *smod = new TNode(name, "SMOD", name, 0., 0., 0., "");
183 smod->SetLineColor(kBlue) ;
184 if(envelopNode==0) envelopNode = smod;
186 name = "EMOD"; // see CreateEMOD
187 TTRD1 *emodTrd1 = new TTRD1(name, "EMOD(EMOD in Geant)","void", float(fParEMOD[0]),
188 float(fParEMOD[1]),float(fParEMOD[2]),float(fParEMOD[3]));
190 // SCMX = EMOD/4 for simplicity of drawing
192 Float_t dz=0.,theta=0.,phi=0.,h1=0.,bl1=0.,tl1=0.,alpha1=0.,h2=0.,bl2=0.,tl2=0.,alpha2=0.;
193 h1 = emodTrd1->GetDy()/2.;
194 bl1 = emodTrd1->GetDx()/2.;
197 h2 = emodTrd1->GetDy()/2.;
198 bl2 = emodTrd1->GetDx2()/2.;
202 dz = emodTrd1->GetDz();
203 double dr = TMath::Sqrt((h2-h1)*(h2-h1)+(bl2-bl1)*(bl2-bl1));
204 theta = TMath::ATan2(dr,2.*dz) * TMath::RadToDeg();
207 TTRAP *scmxTrap = new TTRAP(name, "SCMX(SCMX as in Geant)","void",
208 dz,theta,phi, h1,bl1,tl1,alpha1, h2,bl2,tl2,alpha2);
210 Float_t xShiftSCMX = (emodTrd1->GetDx() + emodTrd1->GetDx2())/4.;
211 Float_t yShiftSCMX = emodTrd1->GetDy()/2.;
212 printf(" xShiftSCMX %7.4f yShiftSCMX %7.4f \n",xShiftSCMX,yShiftSCMX);
214 name = "EMOD"; // see CreateEMOD
217 AliEMCALShishKebabTrd1Module *mod=0;
218 Double_t angle=90., xpos=0.,ypos=0.,zpos=0., xposSCMX=0.,yposSCMX=0.,zposSCMX=0.;
219 char rtmn[100], rtmt[100];
220 TRotMatrix *rtm=0, *rtmSCMX=0;
222 for(int iz=0; iz<g->GetNZ(); iz++) {
223 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
224 zpos = mod->GetPosZ() - fSmodPar2;
225 ypos = mod->GetPosXfromR() - fSmodPar1;
227 angle = mod->GetThetaInDegree();
228 sprintf(rtmn,"rmEmod%5.1f",angle);
229 sprintf(rtmt,"rotation matrix for EMOD, iz=%i, angle = %6.3f",iz, angle);
230 if(iz==0) rtm = new TRotMatrix(rtmn, rtmt,0.,0., 90.,0., 90.,90.); // z'(x); y'(y); x'(z)
231 else rtm = new TRotMatrix(rtmn, rtmt,90.-angle,270., 90.0,0.0, angle,90.);
233 TGeometry *tg = gAlice->GetGeometry();
234 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
235 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
236 sprintf(rtmt,"EMOD, iz %i, ix %i, angle %6.3f",iz,ix, angle);
237 TString namNode=name;
238 namNode += numEmod++;
240 emod = new TNode(namNode.Data(), rtmt, (TShape*)emodTrd1, xpos,ypos,zpos,rtm);
241 // emod->SetLineColor(kGreen) ;
242 emod->SetVisibility(0); // SCMX will bi visible
243 if(scmxTrap) { // 4(2x2) sensetive volume inside EMOD
246 for(int jy=0; jy<2; jy++){ // division on y
247 yposSCMX = yShiftSCMX *(2*jy - 1);
248 for(int jx=0; jx<2; jx++){ // division on x
249 Double_t theta1=90.,phi1=0., theta2=90.,phi2=90., theta3=0.,phi3=0 ;
250 xposSCMX = xShiftSCMX *(2*jx - 1);
254 sprintf(rtmn,"rm%s",namNode.Data());
255 sprintf(rtmt,"rotation matrix for %s inside EMOD",namNode.Data());
256 rtmSCMX = tg->GetRotMatrix(rtmn);
258 phi1 = 180.; // x' = -x
259 phi2 = 270.; // y' = -y
261 if(rtmSCMX == 0) rtmSCMX = new TRotMatrix(rtmn,rtmt, theta1,phi1, theta2,phi2, theta3,phi3);
262 sprintf(rtmt,"%s inside %s", namNode.Data(), emod->GetName());
263 scmx = new TNode(namNode.Data(), rtmt, (TShape*)scmxTrap, xposSCMX,yposSCMX,zposSCMX,rtmSCMX);
264 scmx->SetLineColor(kMagenta);
270 // emod->Draw(); // for testing
275 //______________________________________________________________________
276 void AliEMCALv0::CreateGeometry()
278 // Create the EMCAL geometry for Geant
279 // Geometry of a tower
280 //|-----------------------------------------------------| XEN1
282 //| | Al thickness = GetAlFrontThickness() | |
286 //| ------------------------------------------------- |
287 //| | Air Gap = GetGap2Active() | |
289 //| ------------------------------------------------- |
290 //| | XU1 : XPST (ECAL e = GetECScintThick() ) | |
291 //| ------------------------------------------------- |
292 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
293 //| ------------------------------------------------- |
294 //| | XU1 : XPST (ECAL e = GetECScintThick() | |
295 //| ------------------------------------------------- |
296 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
297 //| ------------------------------------------------- |
298 //| etc ..... GetNECLayers() - 1 times |
299 //| ------------------------------------------------- |
300 //| | XUNLayer : XPST (ECAL e = GetECScintThick() | |
301 //| ------------------------------------------------- |
303 AliEMCALGeometry * geom = GetGeometry() ;
304 TString gn(geom->GetName());
307 if(!(geom->IsInitialized())){
308 Error("CreateGeometry","EMCAL Geometry class has not been set up.");
311 // Get pointer to the array containing media indices
312 fIdTmedArr = fIdtmed->GetArray() - 1599 ;
315 // gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule
316 AliMatrix(fIdRotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
318 // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1
320 Float_t envelopA[10];
321 if(gn.Contains("TRD2")) { // TUBS
322 envelopA[0] = geom->GetEnvelop(0) - 10.; // rmin
323 envelopA[1] = geom->GetEnvelop(1) + 12.; // rmax
324 // envelopA[2] = geom->ZFromEtaR(geom->GetEnvelop(1), geom->GetArm1EtaMin());
325 envelopA[2] = 390.; // 6-feb-05
326 envelopA[3] = geom->GetArm1PhiMin();
327 envelopA[4] = geom->GetArm1PhiMax();
328 gMC->Gsvolu("XEN1", "TUBS", fIdTmedArr[kIdAIR], envelopA, 5) ; // Tubs filled with air
329 fEnvelop1.Set(5, envelopA);
330 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
331 gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
332 } else if(gn.Contains("TRD1") && gn.Contains("WSUC") ) { // TRD1 for WSUC facility
333 // 17-may-05 - just BOX
337 gMC->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ;
339 for(int i=0; i<3; i++) fEnvelop1[i] = envelopA[i]; // 23-may-05
340 // Position the EMCAL Mother Volume (XEN1) in WSUC
341 gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
343 envelopA[0] = geom->GetArm1PhiMin(); // minimum phi angle
344 envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
345 envelopA[2] = geom->GetNPhi(); // number of sections in phi
346 envelopA[3] = 2; // 2 z coordinates
347 // envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1),
348 //geom->GetArm1EtaMin()); // z coordinate 1
349 envelopA[4] = -350.; // AM 30/5/2006
351 //add some padding for mother volume
352 envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1
353 envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1
354 // envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1),
355 // geom->GetArm1EtaMax()); // z coordinate 2
356 envelopA[7] = 350.; // AM 30/5/2006
358 envelopA[8] = envelopA[5] ; // radii are the same.
359 envelopA[9] = envelopA[6] ; // radii are the same.
361 if(gn.Contains("SHISH")) envelopA[2] = geom->GetNPhiSuperModule();
363 gMC->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ; // Polygone filled with air
364 fEnvelop1.Set(10, envelopA);
366 printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]);
367 printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]);
369 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
370 gMC->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
373 if(gn.Contains("SHISH")){
374 // COMPACT, TWIST, TRD2 or TRD1
375 AliDebug(2,Form("Shish-Kebab geometry : %s", GetTitle()));
376 CreateShishKebabGeometry();
380 //______________________________________________________________________
381 void AliEMCALv0::Init(void)
383 // Just prints an information message
385 if(AliLog::GetGlobalDebugLevel()>0) {
386 TString message("\n") ;
387 message += "*****************************************\n" ;
389 // Here the EMCAL initialisation code (if any!)
391 AliEMCALGeometry * geom = GetGeometry() ;
394 message += "AliEMCAL " ;
395 message += Version() ;
396 message += "EMCAL geometry initialized for " ;
397 message += geom->GetName() ;
400 message += "AliEMCAL " ;
401 message += Version() ;
402 message += "EMCAL geometry initialization failed !" ;
404 message += "\n*****************************************" ;
405 printf(message.Data() ) ;
410 void AliEMCALv0::CreateShishKebabGeometry()
412 // TWIST, TRD1 and TRD2
413 AliEMCALGeometry * g = GetGeometry();
414 TString gn(g->GetName()); gn.ToUpper();
415 // see AliModule::fFIdTmedArr
416 // fIdTmedArr = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials()
417 // int kIdAIR=1599, kIdPB = 1600, kIdSC = 1601, kIdSTEEL = 1603;
419 Double_t par[10], xpos=0., ypos=0., zpos=0.;
421 CreateSmod(g->GetNameOfEMCALEnvelope());
423 CreateEmod("SMOD","EMOD"); // 18-may-05
425 if(g->GetKey110DEG()) CreateEmod("SM10","EMOD"); // Nov 1,2006
427 // Sensitive SC (2x2 tiles)
428 double parSCM0[5]={0,0,0,0}, *dummy = 0, parTRAP[11];
429 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTmp = TMath::Tan(trd1Angle/2.);
430 if(!gn.Contains("TRD")) { // standard module
431 par[0] = (g->GetECPbRadThick()+g->GetECScintThick())*g->GetNECLayers()/2.;
432 par[1] = par[2] = g->GetPhiTileSize(); // Symetric case
433 gMC->Gsvolu("SCM0", "BOX", fIdTmedArr[kIdSC], par, 3); // 2x2 tiles
434 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
435 // Division to tile size
436 gMC->Gsdvn("SCM1","SCM0", g->GetNPHIdiv(), 2); // y-axis
437 gMC->Gsdvn("SCM2","SCM1", g->GetNETAdiv(), 3); // z-axis
438 // put LED to the SCM2
439 par[0] = g->GetECPbRadThick()/2.;
440 par[1] = par[2] = g->GetPhiTileSize()/2.; // Symetric case
441 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], par, 3);
443 printf(" Pb tiles \n");
446 xpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
447 for(int ix=0; ix<g->GetNECLayers(); ix++){
448 gMC->Gspos("PBTI", ++nr, "SCM2", xpos, ypos, zpos, 0, "ONLY") ;
449 // printf(" %i xpos %f \n", ix+1, xpos);
450 xpos += fSampleWidth;
452 printf(" Number of Pb tiles in SCM2 %i \n", nr);
453 } else if(gn.Contains("TRD1")) { // TRD1 - 30-sep-04
454 if(gn.Contains("MAY05")){
455 Double_t dzTmp = g->GetFrontSteelStrip()+g->GetPassiveScintThick();
456 parSCM0[0] = fParEMOD[0] + tanTmp*dzTmp; // dx1
457 parSCM0[1] = fParEMOD[1]; // dx2
458 parSCM0[2] = fParEMOD[2]; // dy
459 for(int i=0; i<3; i++) parSCM0[i] -= g->GetLateralSteelStrip();
460 parSCM0[3] = fParEMOD[3] - dzTmp/2.; // dz
462 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
463 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., dzTmp/2., 0, "ONLY") ;
464 } else { // before MAY 2005
465 // double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); // Need check
466 double wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() - g->GetPhiTileSize();
467 for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
468 parSCM0[3] = fParEMOD[3];
469 gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
470 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
473 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
474 // Division to tile size - 1-oct-04
475 AliDebug(2,Form(" Divide SCM0 on y-axis %i\n", g->GetNETAdiv()));
476 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
478 parTRAP[0] = parSCM0[3]; // dz
479 parTRAP[1] = TMath::ATan2((parSCM0[1]-parSCM0[0])/2.,2.*parSCM0[3])*180./TMath::Pi(); // theta
480 parTRAP[2] = 0.; // phi
482 parTRAP[3] = parSCM0[2]/2.; // H1
483 parTRAP[4] = parSCM0[0]/2.; // BL1
484 parTRAP[5] = parTRAP[4]; // TL1
485 parTRAP[6] = 0.0; // ALP1
487 parTRAP[7] = parSCM0[2]/2.; // H2
488 parTRAP[8] = parSCM0[1]/2.; // BL2
489 parTRAP[9] = parTRAP[8]; // TL2
490 parTRAP[10]= 0.0; // ALP2
491 AliDebug(2,Form(" ** TRAP ** \n"));
492 for(int i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
494 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
495 xpos = +(parSCM0[1]+parSCM0[0])/4.;
496 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
498 // Using rotation because SCMX should be the same due to Pb tiles
500 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
501 gMC->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, fIdRotm, "ONLY");
502 // put LED to the SCM0
503 AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0);
504 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
506 par[1] = parSCM0[2]/2; // y
507 par[2] = g->GetECPbRadThick()/2.; // z
511 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
512 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.;
513 if(!gn.Contains("NOPB")) { // for testing - 11-jul-05
514 AliDebug(2,Form(" Pb tiles \n"));
515 for(int iz=0; iz<g->GetNECLayers(); iz++){
516 par[0] = (parSCM0[0] + mod->GetTanBetta()*fSampleWidth*iz)/2.;
517 xpos = par[0] - xCenterSCMX;
518 gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
519 AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]));
520 zpos += fSampleWidth;
522 AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr));
524 } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) {
525 printf(" before AliEMCALv0::Trd1Tower3X3() : parSCM0");
526 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
528 Trd1Tower3X3(parSCM0);
529 } else if(g->GetNPHIdiv()==1 && g->GetNETAdiv()==1) {
530 // no division in SCM0
531 Trd1Tower1X1(parSCM0);
532 } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) {
535 } else if(gn.Contains("TRD2")) { // TRD2 - 14-jan-05
536 // Scm0InTrd2(g, fParEMOD, parSCM0); // First dessin
537 PbmoInTrd2(g, fParEMOD, parSCM0); // Second design
541 void AliEMCALv0::CreateSmod(const char* mother)
543 // 18-may-05; mother="XEN1";
544 // child="SMOD" from first to 10th, "SM10" (11th and 12th) (TRD1 case)
545 // child="SMON" and "SMOP"("TRD2" case)
546 AliEMCALGeometry * g = GetGeometry();
547 TString gn(g->GetName()); gn.ToUpper();
549 Double_t par[3], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.;
551 // ===== define Super Module from air - 14x30 module ==== ;
552 fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
553 AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data()));
554 par[0] = g->GetShellThickness()/2.;
555 par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
556 par[2] = g->GetEtaModuleSize()*15.;
558 int nphism = g->GetNumberOfSuperModules()/2; // 20-may-05
560 dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/nphism;
561 // if(g->GetKey110DEG()) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1);
562 rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.;
563 AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi));
566 if (gn.Contains("TRD2")) { // tubs - 27-jan-05
567 parTubs[0] = g->GetTubsR(); // rmin
568 parTubs[1] = parTubs[0] + g->GetShellThickness(); // rmax ??
569 parTubs[2] = 380./2.; // DZ half length in z; 11-oct-04 - for 26 division
570 parTubs[3] = -dphi/2.; // PHI1 starting angle of the segment;
571 parTubs[4] = +dphi/2.; // PHI2 ending angle of the segment;
573 gMC->Gsvolu("SMOP", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // pozitive Z
574 gMC->Gsvolu("SMON", "TUBS", fIdTmedArr[kIdAIR], parTubs, 5); // negative Z
576 AliDebug(2,Form(" SMOP,N ** TUBS **\n"));
577 AliDebug(2,Form("tmed %i | Rmin %7.2f Rmax %7.2f dz %7.2f phi1,2 (%7.2f,%7.2f)\n",
578 fIdTmedArr[kIdAIR], parTubs[0],parTubs[1],parTubs[2], parTubs[3],parTubs[4]));
579 // have to add 1 cm plastic before EMOD - time solution
580 } else if(gn.Contains("WSUC")) {
581 par[0] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
582 par[1] = g->GetShellThickness()/2.;
583 par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5;
585 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
587 AliDebug(2,Form("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
588 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
592 nphism = g->GetNumberOfSuperModules();
594 if (gn.Contains("TWIST")) {
595 par[2] += 0.4; // for 27 division
596 } else if(gn.Contains("TRD")) {
597 par[2] = 350./2.; // 11-oct-04 - for 26 division
598 if(gn.Contains("TRD1")) {
599 AliDebug(2,Form(" par[0] %7.2f (old) \n", par[0]));
600 Float_t *parSM = g->GetSuperModulesPars();
601 for(int i=0; i<3; i++) par[i] = parSM[i];
604 gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
605 AliDebug(2,Form("tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
606 fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
609 if(g->GetKey110DEG()) { // 12-oct-05
612 gMC->Gsvolu("SM10", "BOX", fIdTmedArr[kIdAIR], par, 3);
613 AliDebug(2,Form(" Super module with name \"SM10\" was created too par[1] = %f\n", par[1]));
617 if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
618 par[0] = g->GetSteelFrontThickness()/2.;
619 gMC->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3);
620 printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", fIdTmedArr[kIdSTEEL], par[0],par[1],par[2]);
621 xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.;
622 gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
626 int nr=0, nrsmod=0, i0=0;
627 if(gn.Contains("TEST")) {nphism = 1;} // just only 2 super modules;
629 // Turn whole super module
630 int turnSupMod = 1; // should be ONE; for testing = 0
631 for(int i=i0; i<nphism; i++) {
632 if (gn.Contains("TRD2")) { // tubs - 27-jan-05
634 printf("** TRD2 ** ");
635 if(turnSupMod==1) printf(" No 3 degree rotation !!! ");
638 Double_t phic=0., phicRad=0.; // phi angle of arc center
639 phic = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; //
640 phicRad = phic*TMath::DegToRad();
641 phi = phic - g->GetTubsTurnAngle();
642 phiRad = phi*TMath::DegToRad();
644 TVector2 vc; // position of super module center
645 vc.SetMagPhi(parTubs[0], phicRad);
646 TVector2 vcTurn; // position of super module center with turn
647 vcTurn.SetMagPhi(parTubs[0], phiRad);
648 TVector2 vcShift = vc - vcTurn;
653 } else { // 1-mar-05 ; just for testing - no turn od SMOD; looks good
657 AliMatrix(fIdRotm, 90.0, phic, 90.0, 90.0+phic, 0.0, 0.0);
659 gMC->Gspos("SMOP", ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
660 printf("SMOP %2i | %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
661 i, nr, fIdRotm, phic, phicRad, xpos, ypos, zpos);
662 printf(" phiy(90+phic) %6.1f \n", 90. + phic);
664 if(!gn.Contains("TEST1") && g->GetNumberOfSuperModules() > 1){
665 // double phiy = 90. + phic + 180.;
666 // if(phiy>=360.) phiy -= 360.;
667 // printf(" phiy %6.1f \n", phiy);
668 // AliMatrix(fIdRotm, 90.0, phic, 90.0, phiy, 180.0, 0.0);
669 gMC->Gspos("SMON", nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY") ;
670 printf("SMON %2i | %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
671 i, nr, fIdRotm, phic, phicRad, xpos, ypos, -zpos);
673 } else if(gn.Contains("WSUC")) {
674 xpos = ypos = zpos = 0.0;
676 gMC->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
677 printf(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
678 fIdRotm, phi, phiRad, xpos, ypos, zpos);
681 TString smName("SMOD"); // 12-oct-05
682 if(i==5 && g->GetKey110DEG()) {
687 phi = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170
688 phiRad = phi*TMath::Pi()/180.;
690 AliMatrix(fIdRotm, 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
692 xpos = rpos * TMath::Cos(phiRad);
693 ypos = rpos * TMath::Sin(phiRad);
694 zpos = fSmodPar2; // 21-sep-04
695 if(i==5 && g->GetKey110DEG()) {
696 xpos += (par1C/2. * TMath::Sin(phiRad));
697 ypos -= (par1C/2. * TMath::Cos(phiRad));
700 // 1th module in z-direction;
701 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
702 AliDebug(3, Form(" %s : %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n",
703 smName.Data(), nr, fIdRotm, phi, phiRad, xpos, ypos, zpos, i));
704 // 2th module in z-direction;
705 if(gn.Contains("TWIST") || gn.Contains("TRD")) {
706 // turn arround X axis; 0<phi<360
707 double phiy = 90. + phi + 180.;
708 if(phiy>=360.) phiy -= 360.;
710 AliMatrix(fIdRotm, 90.0, phi, 90.0, phiy, 180.0, 0.0);
711 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
712 AliDebug(3, Form(" %s : %2i fIdRotm %3i phiy %6.1f xpos %7.2f ypos %7.2f zpos %7.2f \n",
713 smName.Data(), nr, fIdRotm, phiy, xpos, ypos, -zpos));
715 gMC->Gspos("SMOD", ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY");
719 AliDebug(2,Form(" Number of Super Modules %i \n", nr+nrsmod));
722 void AliEMCALv0::CreateEmod(const char* mother, const char* child)
724 // 17-may-05; mother="SMOD"; child="EMOD"
725 AliEMCALGeometry * g = GetGeometry();
726 TString gn(g->GetName()); gn.ToUpper();
728 Double_t par[10], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0.;
729 Double_t parSCPA[5], zposSCPA=0.; // passive SC - 13-MAY-05, TRD1 case
730 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
731 Double_t tanTrd2y = TMath::Tan(g->GetTrd2AngleY()*TMath::DegToRad()/2.);
734 if(!gn.Contains("TRD")) { // standard module
735 par[0] = (fSampleWidth*g->GetNECLayers())/2.;
736 par[1] = par[2] = g->GetPhiModuleSize()/2.;
737 gMC->Gsvolu(child, "BOX", fIdTmedArr[kIdSTEEL], par, 3);
739 } else if (gn.Contains("TRD1")){ // TRD1 system coordinate iz differnet
740 if(strcmp(mother,"SMOD")==0) {
741 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
742 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
743 fParEMOD[2] = g->GetPhiModuleSize()/2.;; // dy
744 fParEMOD[3] = g->GetLongModuleSize()/2.; // dz
745 gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4);
746 if(gn.Contains("WSUC") || gn.Contains("MAY05")){
747 parSCPA[0] = g->GetEtaModuleSize()/2. + tanTrd1*g->GetFrontSteelStrip(); // dx1
748 parSCPA[1] = parSCPA[0] + tanTrd1*g->GetPassiveScintThick(); // dx2
749 parSCPA[2] = g->GetPhiModuleSize()/2.; // dy
750 parSCPA[3] = g->GetPassiveScintThick()/2.; // dz
751 gMC->Gsvolu("SCPA", "TRD1", fIdTmedArr[kIdSC], parSCPA, 4);
752 zposSCPA = -fParEMOD[3] + g->GetFrontSteelStrip() + g->GetPassiveScintThick()/2.;
753 gMC->Gspos ("SCPA", ++nr, child, 0.0, 0.0, zposSCPA, 0, "ONLY");
756 } else if (gn.Contains("TRD2")){ // TRD2 as for TRD1 - 27-jan-05
757 fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
758 fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
759 fParEMOD[2] = g->GetPhiModuleSize()/2.; // dy1
760 fParEMOD[3] = fParEMOD[2] + tanTrd2y*g->GetLongModuleSize();// dy2
761 fParEMOD[4] = g->GetLongModuleSize()/2.; // dz
762 gMC->Gsvolu(child, "TRD2", fIdTmedArr[kIdSTEEL], fParEMOD, 5);
766 if(gn.Contains("TWIST")) { // 13-sep-04
767 fShishKebabModules = new TList;
768 AliEMCALShishKebabModule *mod=0, *mTmp; // current module
769 for(int iz=0; iz<g->GetNZ(); iz++) {
770 //for(int iz=0; iz<4; iz++) {
772 mod = new AliEMCALShishKebabModule();
775 mTmp = new AliEMCALShishKebabModule(*mod);
777 Double_t angle = mod->GetThetaInDegree();
778 AliMatrix(fIdRotm, angle,0., 90.0,90.0, 90.-angle, 180.);
780 fShishKebabModules->Add(mod);
782 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
783 zpos = mod->GetPosZ() - fSmodPar2;
784 for(int iy=0; iy<g->GetNPhi(); iy++) {
785 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
786 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
787 // printf(" %3i(%2i,2i) xpos %7.2f ypos %7.2f zpos %7.2f \n", nr,iy,iz, xpos, ypos, zpos);
790 } else if(gn.Contains("TRD")) { // 30-sep-04; 27-jan-05 - as for TRD1 as for TRD2
791 // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0)
792 AliEMCALShishKebabTrd1Module *mod=0, *mTmp; // current module
794 for(int iz=0; iz<g->GetNZ(); iz++) {
795 Double_t angle=90., phiOK=0;
796 if(gn.Contains("TRD1")) {
797 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
798 angle = mod->GetThetaInDegree();
799 if(!gn.Contains("WSUC")) { // ALICE
800 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,90., 90.,0.); // z'(x); y'(y); x'(z)
801 else AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.);
802 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
803 // printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
804 //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
805 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0;
806 zpos = mod->GetPosZ() - fSmodPar2;
808 int iyMax = g->GetNPhi();
809 if(strcmp(mother,"SMOD") && g->GetKey110DEG()) {
812 for(int iy=0; iy<iyMax; iy++) { // flat in phi
813 ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
814 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
815 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm);
816 AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
820 if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y)
821 else AliMatrix(fIdRotm, 90-angle,270., 90.0,0.0, angle,90.);
822 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
823 printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
824 iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
825 zpos = mod->GetPosZ() - fSmodPar2;
826 ypos = mod->GetPosXfromR() - fSmodPar1;
827 printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm);
828 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
829 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
830 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
831 printf(" %7.2f ", xpos);
835 } else if(gn.Contains("TRD2")){ // 1-feb-05 - TRD2; curve in phi
836 double angEtaRow = 0.;
837 double theta1=0.,phi1=0., theta2=0.,phi2=0., theta3=0.,phi3=0.;
840 mod = new AliEMCALShishKebabTrd1Module();
842 mTmp = new AliEMCALShishKebabTrd1Module(*mod);
844 angle = mod->GetThetaInDegree();
847 fShishKebabModules->Add(mod);
848 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
849 AliDebug(2,Form(" %i | theta | %6.3f - %6.3f = %6.3f\n", iz+1, angle, phiOK, angle-phiOK));
851 zpos = mod->GetPosZ() - parTubs[2];
852 rpos = parTubs[0] + mod->GetPosXfromR();
854 angle = mod->GetThetaInDegree();
855 Double_t stepAngle = (parTubs[4] - parTubs[3])/g->GetNPhi(); // 11-mar-04
856 for(int iy=0; iy<g->GetNPhi(); iy++) {
857 angEtaRow = parTubs[3] + stepAngle*(0.5+double(iy));
859 theta1 = 90. + angle; phi1 = angEtaRow; // x' ~-z;
860 theta2 = 90.; phi2 = 90. + angEtaRow;// y' ~ y;
861 theta3 = angle; phi3 = angEtaRow; // z' ~ x;
862 if(phi3 < 0.0) phi3 += 360.;
863 AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
865 xpos = rpos * TMath::Cos(angEtaRow*TMath::DegToRad());
866 ypos = rpos * TMath::Sin(angEtaRow*TMath::DegToRad());
867 gMC->Gspos(child, ++nr, "SMOP", xpos, ypos, zpos, fIdRotm, "ONLY") ;
869 phi1 = 180 + angEtaRow;
870 theta3 = 180.-theta3; phi3 = angEtaRow;
871 AliMatrix(fIdRotm, theta1,phi1, theta2,phi2, theta3,phi3);
872 gMC->Gspos(child, nr, "SMON", xpos, ypos, -zpos, fIdRotm, "ONLY") ;
873 if(AliDebugLevel()>=2) {
874 printf(" angEtaRow(phi) %7.2f | angle(eta) %7.2f \n", angEtaRow, angle);
875 printf("iy=%2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", iy, xpos, ypos, zpos, fIdRotm);
877 } // for(int iy=0; iy<g->GetNPhi(); iy++)
881 xpos = g->GetSteelFrontThickness()/2.;
882 for(int iz=0; iz<g->GetNZ(); iz++) {
883 zpos = -fSmodPar2 + g->GetEtaModuleSize()*(2*iz+1)/2.;
884 for(int iy=0; iy<g->GetNPhi(); iy++) {
885 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
886 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, 0, "ONLY") ;
887 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f \n", nr, xpos, ypos, zpos);
891 AliDebug(2,Form(" Number of modules in Super Module(%s) %i \n", mother, nr));
894 void AliEMCALv0::Trd1Tower3X3(const double *parSCM0)
896 // Started Dec 8,2004 by PAI
898 printf(" AliEMCALv0::Trd1Tower3X3() : parSCM0");
899 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
901 // Nov 10, 2006 - different name of SCMX
902 double parTRAP[11], *dummy=0;
903 AliEMCALGeometry * g = GetGeometry();
904 TString gn(g->GetName()), scmx;
906 // Division to tile size
907 AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv()));
908 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
909 double dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3];
910 double ndiv=3., xpos=0.0;
911 // should be defined once
912 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
913 for(int ix=1; ix<=3; ix++) { // 3X3
914 scmx = "SCX"; // Nov 10,2006
917 double xCentBot = 2.*dx1/3.;
918 double xCentTop = 2.*(dx2/4. + dx1/12.);
919 parTRAP[1] = TMath::ATan2((xCentTop-xCentBot),2.*dz)*TMath::RadToDeg(); // theta
920 parTRAP[2] = 0.; // phi
922 parTRAP[3] = dy/ndiv; // H1
923 parTRAP[4] = dx1/ndiv; // BL1
924 parTRAP[5] = parTRAP[4]; // TL1
925 parTRAP[6] = 0.0; // ALP1
927 parTRAP[7] = dy/ndiv; // H2
928 parTRAP[8] = dx2/2 - dx1/6.;// BL2
929 parTRAP[9] = parTRAP[8]; // TL2
930 parTRAP[10]= 0.0; // ALP2
931 xpos = (xCentBot+xCentTop)/2.;
934 parTRAP[1] = -parTRAP[1];
936 } else if(ix==2) { // central part is box but we treat as trapesoid due to numbering
938 parTRAP[8] = dx1/ndiv; // BL2
939 parTRAP[9] = parTRAP[8]; // TL2
942 AliDebug(2,Form(" ** TRAP ** xpos %9.3f\n", xpos));
943 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
946 gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
947 gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
949 PbInTrap(parTRAP, scmx);
951 AliDebug(2,Form("Trd1Tower3X3()", "Ver. 1.0 : was tested."));
955 void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
957 // see for example CreateShishKebabGeometry(); just for case TRD1
959 AliDebug(2,Form(" Pb tiles : nrstart %i\n", nr));
960 AliEMCALGeometry * g = GetGeometry();
963 // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
964 double xpos = 0.0, ypos = 0.0;
965 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
967 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
968 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // ??
969 // double tan = TMath::Tan(parTRAP[1]*TMath::DegToRad());
971 par[1] = parTRAP[3]; // y
972 par[2] = g->GetECPbRadThick()/2.; // z
973 for(int iz=0; iz<g->GetNECLayers(); iz++){
974 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
975 xpos = par[0] - xCenterSCMX;
976 if(parTRAP[1] < 0.) xpos = -xpos;
977 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
978 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
979 zpos += fSampleWidth;
980 if(iz%2>0) printf("\n");
982 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
983 AliDebug(2,Form(" par[1] %9.3f par[2] %9.3f ypos %9.3f \n", par[1], par[2], ypos));
984 AliDebug(2,Form(" PbInTrap Ver. 1.0 : was tested."));
988 void AliEMCALv0::Trd1Tower4X4()
993 void AliEMCALv0::Trd1Tower1X1(double *parSCM0)
995 // Started Nov 22,2006 by PAI
996 AliDebug(1," AliEMCALv0::Trd1Tower1X1() : parSCM0");
997 for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]);
1000 // No division - keeping the same volume logic
1001 // and as consequence the same abs is scheme
1002 AliDebug(2,"Trd1Tower1X1() : Create SCMX(SCMY) as SCM0");
1004 gMC->Gsvolu("SCMY", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
1005 gMC->Gspos("SCMY", 1, "SCM0", 0.0, 0.0, 0.0, 0, "ONLY");
1006 gMC->Gsvolu("SCMX", "TRD1", fIdTmedArr[kIdSC], parSCM0, 4);
1007 gMC->Gspos("SCMX", 1, "SCMY", 0.0, 0.0, 0.0, 0, "ONLY");
1009 // should be defined once
1011 gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
1013 PbInTrd1(parSCM0, "SCMX");
1015 AliDebug(1,"Trd1Tower1X1() : Ver. 0.1 : was tested.");
1018 void AliEMCALv0::PbInTrd1(double *parTrd1, TString n)
1020 // see PbInTrap(const double parTrd1[11], TString n)
1021 static int nr=0, ndeb=2;
1022 AliDebug(ndeb,Form(" Pb tiles : nrstart %i\n", nr));
1023 AliEMCALGeometry * g = GetGeometry();
1026 // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1027 double xpos = 0.0, ypos = 0.0;
1028 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1029 double coef = (parTrd1[1] - parTrd1[0]) / (2.*parTrd1[3]);
1031 par[1] = parTrd1[2]; // y
1032 par[2] = g->GetECPbRadThick()/2.; // z
1034 for(int iz=0; iz<g->GetNECLayers(); iz++){
1035 par[0] = parTrd1[0] + coef*fSampleWidth*iz;
1036 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
1037 AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
1038 zpos += fSampleWidth;
1039 if(iz%2>0) printf("\n");
1041 AliDebug(ndeb,Form(" Number of Pb tiles in SCMX %i coef %9.7f ", nr, coef));
1042 AliDebug(ndeb,Form(" PbInTrd1 Ver. 0.1 : was tested."));
1046 void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parSCM0[5])
1048 // Passive material inside the detector
1049 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); //Need check
1050 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
1051 for(int i=0; i<4; i++) { // on pictures sometimes I can not see 0 -> be carefull!!
1052 parSCM0[i] = emodPar[i] - wallThickness;
1053 AliDebug(2,Form(" %i parSCMO %7.3f emodPar %7.3f : dif %7.3f \n",
1054 i, parSCM0[i],emodPar[i], parSCM0[i]-emodPar[i]));
1056 parSCM0[4] = emodPar[4];
1057 gMC->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC
1058 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
1060 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
1061 Division2X2InScm0(g, parSCM0);
1063 Info("Scm0InTrd2"," no division SCM0 in this geometry |%s|\n", g->GetName());
1068 void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t parSCM0[5])
1071 Double_t parTRAP[11], xpos=0.,ypos=0., dx1=0.0,dx2=0.,dy1=0.0,dy2=0.,dz=0.
1075 Info("Division2X2InScm0","Divide SCM0 on y-axis %i\n", g->GetNETAdiv());
1076 TString n("SCMX"), overLapFlagSCMY("ONLY"), overLapFlagSCMX("ONLY");
1077 n = "SCM0"; // for testing - 14-mar-05
1079 PbInTrapForTrd2(parSCM0, n);
1080 // overLapFlagSCMY=overLapFlagSCMX="MANY"; // do not work
1084 dy1 = parSCM0[2] , dy2 = parSCM0[3], dz = parSCM0[4];
1086 parTRAP[0] = parSCM0[4]; // dz
1087 parTRAP[1] = TMath::ATan2((dy2-dy1)/2.,2.*dz)*TMath::RadToDeg();
1088 parTRAP[2] = 90.; // phi
1090 parTRAP[3] = parSCM0[2]/2.; // H1
1091 parTRAP[4] = parSCM0[0]; // BL1
1092 parTRAP[5] = parTRAP[4]; // TL1
1093 parTRAP[6] = 0.0; // ALP1
1095 parTRAP[7] = parSCM0[3]/2.; // H2
1096 parTRAP[8] = parSCM0[1]; // BL2
1097 parTRAP[9] = parTRAP[8]; // TL2
1098 parTRAP[10]= 0.0; // ALP2
1099 AliDebug(2,Form(" ** SCMY ** \n"));
1100 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1103 gMC->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC
1104 ypos = +(parTRAP[3]+parTRAP[7])/2.; //
1105 AliDebug(2,Form(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data()));
1106 gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm, overLapFlagSCMY.Data()) ;
1107 // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z
1108 AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
1109 // We may have problem with numeration due to rotation - 4-feb-05
1110 gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm, overLapFlagSCMY.Data());
1112 Info("Division2X2InScm0","Divide SCMY on x-axis %i\n", g->GetNPHIdiv());
1115 dr1=TMath::Sqrt(dx1*dx1+dy1*dy1);
1116 dr2=TMath::Sqrt(dx2*dx2+dy2*dy2);
1118 parTRAP[0] = parSCM0[4]; // dz
1119 parTRAP[1] = TMath::ATan2((dr2-dr1)/2.,2.*dz)*TMath::RadToDeg(); //
1120 parTRAP[2] = 45.; // phi
1122 parTRAP[3] = parSCM0[2]/2.; // H1
1123 parTRAP[4] = parSCM0[0]/2.; // BL1
1124 parTRAP[5] = parTRAP[4]; // TL1
1125 parTRAP[6] = 0.0; // ALP1
1127 parTRAP[7] = parSCM0[3]/2.; // H2
1128 parTRAP[8] = parSCM0[1]/2; // BL2
1129 parTRAP[9] = parTRAP[8]; // TL2
1130 parTRAP[10]= 0.0; // ALP2
1131 AliDebug(2,Form(" ** SCMX ** \n"));
1132 for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
1135 gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
1136 xpos = (parTRAP[4]+parTRAP[8])/2.;
1137 AliDebug(2,Form(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data()));
1138 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
1139 // AliMatrix(fIdRotm, 90.0,270., 90.0, 0.0, 0.0,0.0); // x'=-y; y'=x; z'=z
1140 AliMatrix(fIdRotm, 90.0,90., 90.0, -180.0, 0.0,0.0); // x'=y; y'=-x; z'=z
1141 gMC->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ;
1143 if(n=="SCMX" && overLapFlagSCMY == "ONLY") {
1144 PbInTrapForTrd2(parTRAP, n);
1149 void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
1153 TString pbShape("BOX"), pbtiChonly("ONLY");
1156 // pbtiChonly = "MANY";
1158 gMC->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0);
1161 Info("PbInTrapForTrd2"," Pb tiles inside %s: shape %s :pbtiChonly %s\n nrstart %i\n",
1162 name.Data(), pbShape.Data(), pbtiChonly.Data(), nr);
1163 AliEMCALGeometry * g = GetGeometry();
1165 double par[5], parPB[5], parSC[5];
1166 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1167 double xpos = 0.0, ypos = 0.0;
1168 double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1169 if(name == "SCMX") { // common trapezoid - 11 parameters
1170 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
1171 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // the same for y
1172 AliDebug(2,Form(" xCenterSCMX %8.5f : coef %8.7f \n", xCenterSCMX, coef));
1174 par[2] = g->GetECPbRadThick()/2.; // z
1175 for(int iz=0; iz<g->GetNECLayers(); iz++){
1176 par[0] = parTRAP[4] + coef*fSampleWidth*iz;
1178 xpos = ypos = par[0] - xCenterSCMX;
1179 //if(parTRAP[1] < 0.) xpos = -xpos;
1180 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
1181 AliDebug(2,Form(" %2.2i xpos %8.5f zpos %6.3f par[0,1] %6.3f |", iz+1, xpos, zpos, par[0]));
1182 if(iz%2>0) AliDebug(2,Form("\n"));
1183 zpos += fSampleWidth;
1185 AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef));
1186 AliDebug(2,Form(" par[1] %9.5f par[2] %9.5f ypos %9.5f \n", par[1], par[2], ypos));
1187 } else if(name == "SCM0") { // 1-mar-05 ; TRD2 - 5 parameters
1188 AliDebug(2,Form(" SCM0 par = "));
1189 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parTRAP[i]));
1190 AliDebug(2,Form("\n zpos %f \n",zpos));
1192 double tanx = (parTRAP[1] - parTRAP[0]) / (2.*parTRAP[4]); // tanx = tany now
1193 double tany = (parTRAP[3] - parTRAP[2]) / (2.*parTRAP[4]), ztmp=0.;
1194 parPB[4] = g->GetECPbRadThick()/2.;
1195 parSC[2] = g->GetECScintThick()/2.;
1196 for(int iz=0; iz<g->GetNECLayers(); iz++){
1197 ztmp = fSampleWidth*double(iz);
1198 parPB[0] = parTRAP[0] + tanx*ztmp;
1199 parPB[1] = parPB[0] + tanx*g->GetECPbRadThick();
1200 parPB[2] = parTRAP[2] + tany*ztmp;
1201 parPB[3] = parPB[2] + tany*g->GetECPbRadThick();
1202 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ;
1203 AliDebug(2,Form("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos));
1205 for(int i=0; i<5; i++) printf(" %9.5f ", parPB[i]);
1206 // individual SC tile
1207 parSC[0] = parPB[0];
1208 parSC[1] = parPB[1];
1209 gMC->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(),
1210 0, pbtiChonly.Data(), parSC, 3) ;
1211 printf("\n SCTI zpos %6.3f | par = ", zpos+g->GetECScintThick());
1212 for(int i=0; i<3; i++) printf(" %9.5f ", parPB[i]);
1214 zpos += fSampleWidth;
1216 AliDebug(2,Form("\n"));
1218 Info("PbInTrapForTrd2", "Ver. 0.03 : was tested.");
1222 void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parPBMO[5])
1225 Info("PbmoInTrd2"," started : geometry %s ", g->GetName());
1226 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize();
1227 AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness));
1228 for(int i=0; i<4; i++) {
1229 parPBMO[i] = emodPar[i] - wallThickness;
1230 AliDebug(2,Form(" %i parPBMO %7.3f emodPar %7.3f : dif %7.3f \n",
1231 i, parPBMO[i],emodPar[i], parPBMO[i]-emodPar[i]));
1233 parPBMO[4] = emodPar[4];
1234 gMC->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5);
1235 gMC->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
1237 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
1238 Division2X2InPbmo(g, parPBMO);
1239 AliDebug(2,Form(" PBMO, division 2X2 | geometry |%s|\n", g->GetName()));
1241 AliDebug(2,Form(" no division PBMO in this geometry |%s|\n", g->GetName()));
1246 void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t parPBMO[5])
1249 Info("Division2X2InPbmo"," started : geometry %s ", g->GetName());
1250 //Double_t *dummy=0;
1251 // gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0);
1254 //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1255 double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;;
1256 double tanx = (parPBMO[1] - parPBMO[0]) / (2.*parPBMO[4]); // tanx = tany now
1257 double tany = (parPBMO[3] - parPBMO[2]) / (2.*parPBMO[4]);
1258 char name[10], named[10], named2[10];
1260 AliDebug(2,Form(" PBMO par = "));
1261 for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parPBMO[i]));
1262 AliDebug(2,Form("\n"));
1264 parSC[2] = g->GetECScintThick()/2.;
1265 zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick() + g->GetECScintThick()/2.;
1266 AliDebug(2,Form(" parSC[2] %9.5f \n", parSC[2]));
1267 for(int iz=0; iz<g->GetNECLayers(); iz++){
1268 ztmp = g->GetECPbRadThick() + fSampleWidth*double(iz); // Z for previous PB
1269 parSC[0] = parPBMO[0] + tanx*ztmp;
1270 parSC[1] = parPBMO[2] + tany*ztmp;
1272 sprintf(name,"SC%2.2i", iz+1);
1273 gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3);
1274 gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
1275 AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ",
1276 name, zpos, parSC[0], parSC[1]));
1278 sprintf(named,"SY%2.2i", iz+1);
1279 printf(" %s -> ", named);
1280 gMC->Gsdvn(named,name, 2, 2);
1282 sprintf(named2,"SX%2.2i", iz+1);
1283 printf(" %s \n", named2);
1284 gMC->Gsdvn(named2,named, 2, 1);
1286 zpos += fSampleWidth;
1290 AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta)
1293 AliEMCALShishKebabTrd1Module* trd1=0;
1294 if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) {
1295 trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta);
1300 //_____________________________________________________________________________
1301 void AliEMCALv0::AddAlignableVolumes() const
1304 // Create entries for alignable volumes associating the symbolic volume
1305 // name with the corresponding volume path. Needs to be synchronized with
1306 // eventual changes in the geometry.
1309 TString vpstr1 = "ALIC_1/XEN1_1/SMOD_";
1310 TString snstr1 = "EMCAL/FullSupermodule";
1311 TString volpath, symname;
1313 //Int_t nSMod = ((AliEMCALGeometry*)GetGeometry())->GetNumberOfSuperModules();
1314 //could use this, but what happens if it is > 10?
1316 for (Int_t smodnum=0; smodnum < 10; smodnum++) {
1318 symname += (smodnum+1);
1320 volpath += (smodnum+1);
1321 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1322 AliFatal("Unable to set alignable entry!!");
1325 if(GetGeometry()->GetKey110DEG()) {
1326 TString vpstr2 = "ALIC_1/XEN1_1/SM10_";
1327 TString snstr2 = "EMCAL/HalfSupermodule";
1328 for (Int_t smodnum=0; smodnum < 2; smodnum++) {
1330 symname += (smodnum+1);
1332 volpath += (smodnum+1);
1333 if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
1334 AliFatal("Unable to set alignable entry!!");