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"
43 #include "AliEMCALShishKebabModule.h"
44 #include "AliEMCALShishKebabTrd1Module.h"
46 // --- Standard library ---
50 // --- AliRoot header files ---
52 #include "AliEMCALv0.h"
53 #include "AliEMCALGeometry.h"
59 TArrayF ENVELOP1; // now global for BuildGeometry() - 30-aug-2004
60 int idAIR=1599, idPB = 1600, idSC = 1601, idSTEEL = 1603; // global
61 Int_t *idtmed=0, idrotm=0;
62 double sampleWidth=0.;
63 double parEMOD[5], smodPar0=0., smodPar1=0., smodPar2=0.;
65 //______________________________________________________________________
66 AliEMCALv0::AliEMCALv0(const char *name, const char *title):
69 // ctor : title is used to identify the layout
71 fShishKebabModules = 0;
74 //______________________________________________________________________
75 void AliEMCALv0::BuildGeometry()
77 // Display Geometry for display.C
79 const Int_t kColorArm1 = kBlue ;
81 AliEMCALGeometry * geom = GetGeometry() ;
82 TString gn(geom->GetName());
85 // Define the shape of the Calorimeter
86 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
87 TNode * envelopNode = 0;
88 char *envn = "Envelop1";
89 if(!gn.Contains("SHISH") || gn.Contains("TRD2")){
90 new TTUBS(envn, "Tubs that contains arm 1", "void",
91 geom->GetEnvelop(0) -10, // rmin
92 geom->GetEnvelop(1) +40 ,// rmax
93 geom->GetEnvelop(2)/2.0, // half length in Z
94 geom->GetArm1PhiMin(), // minimum phi angle
95 geom->GetArm1PhiMax() // maximum phi angle
98 envelopNode = new TNode(envn, "Arm1 Envelop", "Envelop1", 0., 0., 0., "") ;
100 if(gn.Contains("WSUC")) {
101 envelopNode = BuildGeometryOfWSUC();
102 } else { // Shish-kebab now for compact, twist and TRD1 cases (ALIC)
104 TPGON *pgon = new TPGON(envn, "PGON that contains arm 1", "void",
105 geom->GetArm1PhiMin(),geom->GetArm1PhiMax()-geom->GetArm1PhiMin(),geom->GetNPhiSuperModule(), 2);
107 pgon->DefineSection(0, ENVELOP1[4], ENVELOP1[5], ENVELOP1[6]);
108 pgon->DefineSection(1, ENVELOP1[7], ENVELOP1[5], ENVELOP1[6]);
110 envelopNode = new TNode(envn, "Arm1 Envelop2", envn, 0., 0., 0., "") ;
114 envelopNode->SetLineColor(kColorArm1) ;
115 fNodes->Add(envelopNode);
118 TNode *AliEMCALv0::BuildGeometryOfWSUC()
119 { // June 8, 2005; see directory geant3/TGeant3/G3toRoot.cxx
120 // enum EColor { kWhite, kBlack, kRed, kGreen, kBlue, kYellow, kMagenta, kCyan } - see $ROOTSYS/include/Gtypes.h
121 AliEMCALGeometry * g = GetGeometry();
122 TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
125 TNode *envelopNode = 0;
129 new TBRIK(name, "WSUC(XEN1 in Geant)","void",ENVELOP1[0],ENVELOP1[1],ENVELOP1[2]);
130 envelopNode = new TNode(name, "envelope for WSUC", name, 0., 0., 0., "");
131 envelopNode->SetVisibility(0);
134 TNode *emod=0, *scmx=0;
135 name = "SMOD"; // super module
136 new TBRIK(name, "SMOD(SMOD in Geant)","void", smodPar0,smodPar1,smodPar2);
137 if(envelopNode) envelopNode->cd();
138 TNode *smod = new TNode(name, "SMOD", name, 0., 0., 0., "");
139 smod->SetLineColor(kBlue) ;
140 if(envelopNode==0) envelopNode = smod;
142 name = "EMOD"; // see CreateEMOD
143 TTRD1 *EMOD = new TTRD1(name, "EMOD(EMOD in Geant)","void", float(parEMOD[0]),
144 float(parEMOD[1]),float(parEMOD[2]),float(parEMOD[3]));
146 // SCMX = EMOD/4 for simplicity of drawing
148 Float_t dz=0.,theta=0.,phi=0.,h1=0.,bl1=0.,tl1=0.,alpha1=0.,h2=0.,bl2=0.,tl2=0.,alpha2=0.;
149 h1 = EMOD->GetDy()/2.;
150 bl1 = EMOD->GetDx()/2.;
153 h2 = EMOD->GetDy()/2.;
154 bl2 = EMOD->GetDx2()/2.;
159 double dr = TMath::Sqrt((h2-h1)*(h2-h1)+(bl2-bl1)*(bl2-bl1));
160 theta = TMath::ATan2(dr,2.*dz) * TMath::RadToDeg();
163 TTRAP *SCMX = new TTRAP(name, "SCMX(SCMX as in Geant)","void",
164 dz,theta,phi, h1,bl1,tl1,alpha1, h2,bl2,tl2,alpha2);
166 Float_t xShiftSCMX = (EMOD->GetDx() + EMOD->GetDx2())/4.;
167 Float_t yShiftSCMX = EMOD->GetDy()/2.;
168 printf(" xShiftSCMX %7.4f yShiftSCMX %7.4f \n",xShiftSCMX,yShiftSCMX);
170 name = "EMOD"; // see CreateEMOD
173 AliEMCALShishKebabTrd1Module *mod=0;
174 Double_t angle=90., xpos=0.,ypos=0.,zpos=0., xposSCMX=0.,yposSCMX=0.,zposSCMX=0.;
175 char rtmn[100], rtmt[100];
176 TRotMatrix *rtm=0, *rtmSCMX=0;
178 for(int iz=0; iz<g->GetNZ(); iz++) {
179 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
180 zpos = mod->GetPosZ() - smodPar2;
181 ypos = mod->GetPosXfromR() - smodPar1;
183 angle = mod->GetThetaInDegree();
184 sprintf(rtmn,"rmEmod%5.1f",angle);
185 sprintf(rtmt,"rotation matrix for EMOD, iz=%i, angle = %6.3f",iz, angle);
186 if(iz==0) rtm = new TRotMatrix(rtmn, rtmt,0.,0., 90.,0., 90.,90.); // z'(x); y'(y); x'(z)
187 else rtm = new TRotMatrix(rtmn, rtmt,90.-angle,270., 90.0,0.0, angle,90.);
189 TGeometry *tg = gAlice->GetGeometry();
190 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
191 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
192 sprintf(rtmt,"EMOD, iz %i, ix %i, angle %6.3f",iz,ix, angle);
193 TString namNode=name;
194 namNode += numEmod++;
196 emod = new TNode(namNode.Data(), rtmt, (TShape*)EMOD, xpos,ypos,zpos,rtm);
197 // emod->SetLineColor(kGreen) ;
198 emod->SetVisibility(0); // SCMX will bi visible
199 if(SCMX) { // 4(2x2) sensetive volume inside EMOD
202 for(int jy=0; jy<2; jy++){ // division on y
203 yposSCMX = yShiftSCMX *(2*jy - 1);
204 for(int jx=0; jx<2; jx++){ // division on x
205 Double_t theta1=90.,phi1=0., theta2=90.,phi2=90., theta3=0.,phi3=0 ;
206 xposSCMX = xShiftSCMX *(2*jx - 1);
210 sprintf(rtmn,"rm%s",namNode.Data());
211 sprintf(rtmt,"rotation matrix for %s inside EMOD",namNode.Data());
212 rtmSCMX = tg->GetRotMatrix(rtmn);
214 phi1 = 180.; // x' = -x
215 phi2 = 270.; // y' = -y
217 if(rtmSCMX == 0) rtmSCMX = new TRotMatrix(rtmn,rtmt, theta1,phi1, theta2,phi2, theta3,phi3);
218 sprintf(rtmt,"%s inside %s", namNode.Data(), emod->GetName());
219 scmx = new TNode(namNode.Data(), rtmt, (TShape*)SCMX, xposSCMX,yposSCMX,zposSCMX,rtmSCMX);
220 scmx->SetLineColor(kMagenta);
226 // emod->Draw(); // for testing
231 //______________________________________________________________________
232 void AliEMCALv0::CreateGeometry()
234 // Create the EMCAL geometry for Geant
235 // Geometry of a tower
236 //|-----------------------------------------------------| XEN1
238 //| | Al thickness = GetAlFrontThickness() | |
242 //| ------------------------------------------------- |
243 //| | Air Gap = GetGap2Active() | |
245 //| ------------------------------------------------- |
246 //| | XU1 : XPST (ECAL e = GetECScintThick() ) | |
247 //| ------------------------------------------------- |
248 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
249 //| ------------------------------------------------- |
250 //| | XU1 : XPST (ECAL e = GetECScintThick() | |
251 //| ------------------------------------------------- |
252 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
253 //| ------------------------------------------------- |
254 //| etc ..... GetNECLayers() - 1 times |
255 //| ------------------------------------------------- |
256 //| | XUNLayer : XPST (ECAL e = GetECScintThick() | |
257 //| ------------------------------------------------- |
259 AliEMCALGeometry * geom = GetGeometry() ;
260 TString gn(geom->GetName());
263 if(!(geom->IsInitialized())){
264 Error("CreateGeometry","EMCAL Geometry class has not been set up.");
267 // Get pointer to the array containing media indices
268 idtmed = fIdtmed->GetArray() - 1599 ;
271 // gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule
272 AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
274 // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1
276 Float_t envelopA[10];
277 if(gn.Contains("TRD2")) { // TUBS
278 envelopA[0] = geom->GetEnvelop(0) - 10.; // rmin
279 envelopA[1] = geom->GetEnvelop(1) + 12.; // rmax
280 // envelopA[2] = geom->ZFromEtaR(geom->GetEnvelop(1), geom->GetArm1EtaMin());
281 envelopA[2] = 390.; // 6-feb-05
282 envelopA[3] = geom->GetArm1PhiMin();
283 envelopA[4] = geom->GetArm1PhiMax();
284 gMC->Gsvolu("XEN1", "TUBS", idtmed[1599], envelopA, 5) ; // Tubs filled with air
285 ENVELOP1.Set(5, envelopA);
286 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
287 gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
288 } else if(gn.Contains("TRD1") && gn.Contains("WSUC") ) { // TRD1 for WSUC facility
289 // 17-may-05 - just BOX
293 gMC->Gsvolu("XEN1", "BOX", idtmed[idSC], envelopA, 3) ;
295 for(int i=0; i<3; i++) ENVELOP1[i] = envelopA[i]; // 23-may-05
296 // Position the EMCAL Mother Volume (XEN1) in WSUC
297 gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
299 envelopA[0] = geom->GetArm1PhiMin(); // minimum phi angle
300 envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
301 envelopA[2] = geom->GetNPhi(); // number of sections in phi
302 envelopA[3] = 2; // 2 z coordinates
303 envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1),
304 geom->GetArm1EtaMin()); // z coordinate 1
305 //add some padding for mother volume
306 envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1
307 envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1
308 envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1),
309 geom->GetArm1EtaMax()); // z coordinate 2
310 envelopA[8] = envelopA[5] ; // radii are the same.
311 envelopA[9] = envelopA[6] ; // radii are the same.
313 if(gn.Contains("SHISH")) envelopA[2] = geom->GetNPhiSuperModule();
315 gMC->Gsvolu("XEN1", "PGON ", idtmed[1599], envelopA, 10) ; // Polygone filled with air
316 ENVELOP1.Set(10, envelopA);
318 printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]);
319 printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]);
321 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
322 gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
325 if(gn.Contains("SHISH")){
326 // COMPACT, TWIST, TRD2 or TRD1
327 CreateShishKebabGeometry();
331 //______________________________________________________________________
332 void AliEMCALv0::Init(void)
334 // Just prints an information message
336 if(AliLog::GetGlobalDebugLevel()>0) {
337 TString message("\n") ;
338 message += "*****************************************\n" ;
340 // Here the EMCAL initialisation code (if any!)
342 AliEMCALGeometry * geom = GetGeometry() ;
345 message += "AliEMCAL " ;
346 message += Version() ;
347 message += "EMCAL geometry initialized for " ;
348 message += geom->GetName() ;
351 message += "AliEMCAL " ;
352 message += Version() ;
353 message += "EMCAL geometry initialization failed !" ;
355 message += "\n*****************************************" ;
356 printf(message.Data() ) ;
361 void AliEMCALv0::CreateShishKebabGeometry()
362 { // TWIST, TRD1 and TRD2
363 AliEMCALGeometry * g = GetGeometry();
364 TString gn(g->GetName()); gn.ToUpper();
365 // see AliModule::fIdtmed
366 // idtmed = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials()
367 // int idAIR=1599, idPB = 1600, idSC = 1601, idSTEEL = 1603;
369 Double_t par[10], xpos=0., ypos=0., zpos=0.;
371 CreateSmod("XEN1"); // 18-may-05
373 CreateEmod("SMOD","EMOD"); // 18-may-05
375 if(gn.Contains("110DEG")) CreateEmod("SM10","EMOD"); // 12-oct-05
377 // Sensitive SC (2x2 tiles)
378 double parSCM0[5], *dummy = 0, parTRAP[11];
379 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTmp = TMath::Tan(trd1Angle/2.);
380 if(!gn.Contains("TRD")) { // standard module
381 par[0] = (g->GetECPbRadThick()+g->GetECScintThick())*g->GetNECLayers()/2.;
382 par[1] = par[2] = g->GetPhiTileSize(); // Symetric case
383 gMC->Gsvolu("SCM0", "BOX", idtmed[idSC], par, 3); // 2x2 tiles
384 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
385 // Division to tile size
386 gMC->Gsdvn("SCM1","SCM0", g->GetNPHIdiv(), 2); // y-axis
387 gMC->Gsdvn("SCM2","SCM1", g->GetNETAdiv(), 3); // z-axis
388 // put LED to the SCM2
389 par[0] = g->GetECPbRadThick()/2.;
390 par[1] = par[2] = g->GetPhiTileSize()/2.; // Symetric case
391 gMC->Gsvolu("PBTI", "BOX", idtmed[idPB], par, 3);
393 printf(" Pb tiles \n");
396 xpos = -sampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
397 for(int ix=0; ix<g->GetNECLayers(); ix++){
398 gMC->Gspos("PBTI", ++nr, "SCM2", xpos, ypos, zpos, 0, "ONLY") ;
399 // printf(" %i xpos %f \n", ix+1, xpos);
402 printf(" Number of Pb tiles in SCM2 %i \n", nr);
403 } else if(gn.Contains("TRD1")) { // TRD1 - 30-sep-04
404 if(gn.Contains("MAY05")){
405 Double_t dzTmp = g->GetFrontSteelStrip()+g->GetPassiveScintThick();
406 parSCM0[0] = parEMOD[0] + tanTmp*dzTmp; // dx1
407 parSCM0[1] = parEMOD[1]; // dx2
408 parSCM0[2] = parEMOD[2]; // dy
409 for(int i=0; i<3; i++) parSCM0[i] -= g->GetLateralSteelStrip();
410 parSCM0[3] = parEMOD[3] - dzTmp/2.; // dz
412 gMC->Gsvolu("SCM0", "TRD1", idtmed[idAIR], parSCM0, 4);
413 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., dzTmp/2., 0, "ONLY") ;
414 } else { // before MAY 2005
415 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); // Need check
416 for(int i=0; i<3; i++) parSCM0[i] = parEMOD[i] - wallThickness;
417 parSCM0[3] = parEMOD[3];
418 gMC->Gsvolu("SCM0", "TRD1", idtmed[idAIR], parSCM0, 4);
419 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
422 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
423 // Division to tile size - 1-oct-04
424 printf("<I> Divide SCM0 on y-axis %i\n", g->GetNETAdiv());
425 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
427 parTRAP[0] = parSCM0[3]; // dz
428 parTRAP[1] = TMath::ATan2((parSCM0[1]-parSCM0[0])/2.,2.*parSCM0[3])*180./TMath::Pi(); // theta
429 parTRAP[2] = 0.; // phi
431 parTRAP[3] = parSCM0[2]/2.; // H1
432 parTRAP[4] = parSCM0[0]/2.; // BL1
433 parTRAP[5] = parTRAP[4]; // TL1
434 parTRAP[6] = 0.0; // ALP1
436 parTRAP[7] = parSCM0[2]/2.; // H2
437 parTRAP[8] = parSCM0[1]/2.; // BL2
438 parTRAP[9] = parTRAP[8]; // TL2
439 parTRAP[10]= 0.0; // ALP2
440 printf(" ** TRAP ** \n");
441 for(int i=0; i<11; i++) printf(" par[%2.2i] %9.4f\n", i, parTRAP[i]);
443 gMC->Gsvolu("SCMX", "TRAP", idtmed[idSC], parTRAP, 11);
444 xpos = +(parSCM0[1]+parSCM0[0])/4.;
445 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
447 // Using rotation because SCMX should be the same due to Pb tiles
449 AliMatrix(idrotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
450 gMC->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, idrotm, "ONLY");
451 // put LED to the SCM0
452 AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0);
453 gMC->Gsvolu("PBTI", "BOX", idtmed[idPB], dummy, 0);
455 par[1] = parSCM0[2]/2; // y
456 par[2] = g->GetECPbRadThick()/2.; // z
460 zpos = -sampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
461 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.;
462 if(!gn.Contains("NOPB")) { // for testing - 11-jul-05
463 printf(" Pb tiles \n");
464 for(int iz=0; iz<g->GetNECLayers(); iz++){
465 par[0] = (parSCM0[0] + mod->GetTanBetta()*sampleWidth*iz)/2.;
466 xpos = par[0] - xCenterSCMX;
467 gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
468 printf(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]);
471 printf(" Number of Pb tiles in SCMX %i \n", nr);
473 } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) {
474 Trd1Tower3X3(parSCM0);
475 } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) {
478 } else if(gn.Contains("TRD2")) { // TRD2 - 14-jan-05
479 // Scm0InTrd2(g, parEMOD, parSCM0); // First dessin
480 PbmoInTrd2(g, parEMOD, parSCM0); // Second dessin
484 void AliEMCALv0::CreateSmod(const char* mother)
485 { // 18-may-05; mother="XEN1";
486 // child="SMOD" from first to 10th, "SM10" (11th and 12th) (TRD1 case)
487 // child="SMON" and "SMOP"("TRD2" case)
488 AliEMCALGeometry * g = GetGeometry();
489 TString gn(g->GetName()); gn.ToUpper();
491 Double_t par[3], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.;
493 // ===== define Super Module from air - 14x30 module ==== ;
494 sampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
495 printf("\n ## Super Module | sampleWidth %5.3f ## %s \n", sampleWidth, gn.Data());
496 par[0] = g->GetShellThickness()/2.;
497 par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
498 par[2] = g->GetEtaModuleSize()*15.;
500 int nphism = g->GetNumberOfSuperModules()/2; // 20-may-05
502 dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/nphism;
503 // if(gn.Contains("110DEG")) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1);
504 rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.;
505 printf(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi);
508 if (gn.Contains("TRD2")) { // tubs - 27-jan-05
509 parTubs[0] = g->GetTubsR(); // rmin
510 parTubs[1] = parTubs[0] + g->GetShellThickness(); // rmax ??
511 parTubs[2] = 380./2.; // DZ half length in z; 11-oct-04 - for 26 division
512 parTubs[3] = -dphi/2.; // PHI1 starting angle of the segment;
513 parTubs[4] = +dphi/2.; // PHI2 ending angle of the segment;
515 gMC->Gsvolu("SMOP", "TUBS", idtmed[idAIR], parTubs, 5); // pozitive Z
516 gMC->Gsvolu("SMON", "TUBS", idtmed[idAIR], parTubs, 5); // negative Z
518 printf(" SMOP,N ** TUBS **\n");
519 printf("tmed %i | Rmin %7.2f Rmax %7.2f dz %7.2f phi1,2 (%7.2f,%7.2f)\n",
520 idtmed[idAIR], parTubs[0],parTubs[1],parTubs[2], parTubs[3],parTubs[4]);
521 // have to add 1 cm plastic before EMOD - time solution
522 } else if(gn.Contains("WSUC")) {
523 par[0] = g->GetPhiModuleSize()*g->GetNPhi()/2.;
524 par[1] = g->GetShellThickness()/2.;
525 par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5;
527 gMC->Gsvolu("SMOD", "BOX", idtmed[idAIR], par, 3);
529 printf("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
530 idtmed[idAIR], par[0],par[1],par[2]);
534 nphism = g->GetNumberOfSuperModules();
536 if (gn.Contains("TWIST")) {
537 par[2] += 0.4; // for 27 division
538 } else if(gn.Contains("TRD")) {
539 par[2] = 350./2.; // 11-oct-04 - for 26 division
541 // par[2] = g->GetXYModuleSize()*g->GetNZ()/2.;
542 gMC->Gsvolu("SMOD", "BOX", idtmed[idAIR], par, 3);
543 printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n",
544 idtmed[idAIR], par[0],par[1],par[2]);
547 if(gn.Contains("110DEG")) { // 12-oct-05
550 gMC->Gsvolu("SM10", "BOX", idtmed[idAIR], par, 3);
551 printf(" Super module with name \"SM10\" was created too par[1] = %f\n", par[1]);
555 if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
556 par[0] = g->GetSteelFrontThickness()/2.;
557 gMC->Gsvolu("STPL", "BOX", idtmed[idSTEEL], par, 3);
558 printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", idtmed[idSTEEL], par[0],par[1],par[2]);
559 xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.;
560 gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
564 int nr=0, nrsmod=0, i0=0;
565 if(gn.Contains("TEST")) {nphism = 1;} // just only 2 super modules;
567 // Turn whole super module
568 int TurnSupMod = 1; // should be ONE; for testing =0
569 for(int i=i0; i<nphism; i++) {
570 if (gn.Contains("TRD2")) { // tubs - 27-jan-05
572 printf("** TRD2 ** ");
573 if(TurnSupMod==1) printf(" No 3 degree rotation !!! ");
576 Double_t phic=0., phicRad=0.; // phi angle of arc center
577 phic = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; //
578 phicRad = phic*TMath::DegToRad();
579 phi = phic - g->GetTubsTurnAngle();
580 phiRad = phi*TMath::DegToRad();
582 TVector2 vc; // position of super module center
583 vc.SetMagPhi(parTubs[0], phicRad);
584 TVector2 vcTurn; // position of super module center with turn
585 vcTurn.SetMagPhi(parTubs[0], phiRad);
586 TVector2 vcShift = vc - vcTurn;
591 } else { // 1-mar-05 ; just for testing - no turn od SMOD; looks good
595 AliMatrix(idrotm, 90.0, phic, 90.0, 90.0+phic, 0.0, 0.0);
597 gMC->Gspos("SMOP", ++nr, mother, xpos, ypos, zpos, idrotm, "ONLY") ;
598 printf("SMOP %2i | %2i idrotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
599 i, nr, idrotm, phic, phicRad, xpos, ypos, zpos);
600 printf(" phiy(90+phic) %6.1f \n", 90. + phic);
602 if(!gn.Contains("TEST1") && g->GetNumberOfSuperModules() > 1){
603 // double phiy = 90. + phic + 180.;
604 // if(phiy>=360.) phiy -= 360.;
605 // printf(" phiy %6.1f \n", phiy);
606 // AliMatrix(idrotm, 90.0, phic, 90.0, phiy, 180.0, 0.0);
607 gMC->Gspos("SMON", nr, mother, xpos, ypos, -zpos, idrotm, "ONLY") ;
608 printf("SMON %2i | %2i idrotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
609 i, nr, idrotm, phic, phicRad, xpos, ypos, -zpos);
611 } else if(gn.Contains("WSUC")) {
612 xpos = ypos = zpos = 0.0;
614 gMC->Gspos("SMOD", 1, mother, xpos, ypos, zpos, idrotm, "ONLY") ;
615 printf(" idrotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n",
616 idrotm, phi, phiRad, xpos, ypos, zpos);
619 TString smName("SMOD"); // 12-oct-05
620 if(i==5 && gn.Contains("110DEG")) {
625 phi = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170
626 phiRad = phi*TMath::Pi()/180.;
628 AliMatrix(idrotm, 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0);
630 xpos = rpos * TMath::Cos(phiRad);
631 ypos = rpos * TMath::Sin(phiRad);
632 zpos = smodPar2; // 21-sep-04
633 if(i==5 && gn.Contains("110DEG")) {
634 xpos += (par1C/2. * TMath::Sin(phiRad));
635 ypos -= (par1C/2. * TMath::Cos(phiRad));
638 // 1th module in z-direction;
639 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, zpos, idrotm, "ONLY") ;
640 printf(" %s : %2i idrotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n",
641 smName.Data(), nr, idrotm, phi, phiRad, xpos, ypos, zpos, i);
642 // 2th module in z-direction;
643 if(gn.Contains("TWIST") || gn.Contains("TRD")) {
644 // turn arround X axis; 0<phi<360
645 double phiy = 90. + phi + 180.;
646 if(phiy>=360.) phiy -= 360.;
648 AliMatrix(idrotm, 90.0, phi, 90.0, phiy, 180.0, 0.0);
649 gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, -zpos, idrotm, "ONLY");
650 printf(" %s : %2i idrotm %3i phiy %6.1f xpos %7.2f ypos %7.2f zpos %7.2f \n",
651 smName.Data(), nr, idrotm, phiy, xpos, ypos, -zpos);
653 gMC->Gspos("SMOD", ++nr, mother, xpos, ypos, -zpos, idrotm, "ONLY");
657 printf(" Number of Super Modules %i \n", nr+nrsmod);
660 void AliEMCALv0::CreateEmod(const char* mother, const char* child)
661 { // 17-may-05; mother="SMOD"; child="EMOD"
662 AliEMCALGeometry * g = GetGeometry();
663 TString gn(g->GetName()); gn.ToUpper();
665 Double_t par[10], parTubs[5], xpos=0., ypos=0., zpos=0., rpos=0.;
666 Double_t parSCPA[5], zposSCPA=0.; // passive SC - 13-MAY-05, TRD1 case
667 Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
668 Double_t tanTrd2y = TMath::Tan(g->GetTrd2AngleY()*TMath::DegToRad()/2.);
671 if(!gn.Contains("TRD")) { // standard module
672 par[0] = (sampleWidth*g->GetNECLayers())/2.;
673 par[1] = par[2] = g->GetPhiModuleSize()/2.;
674 gMC->Gsvolu(child, "BOX", idtmed[idSTEEL], par, 3);
676 } else if (gn.Contains("TRD1")){ // TRD1 system coordinate iz differnet
677 if(strcmp(mother,"SMOD")==0) {
678 parEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
679 parEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
680 parEMOD[2] = g->GetPhiModuleSize()/2.;; // dy
681 parEMOD[3] = g->GetLongModuleSize()/2.; // dz
682 gMC->Gsvolu(child, "TRD1", idtmed[idSTEEL], parEMOD, 4);
683 if(gn.Contains("WSUC") || gn.Contains("MAY05")){
684 parSCPA[0] = g->GetEtaModuleSize()/2. + tanTrd1*g->GetFrontSteelStrip(); // dx1
685 parSCPA[1] = parSCPA[0] + tanTrd1*g->GetPassiveScintThick(); // dx2
686 parSCPA[2] = g->GetPhiModuleSize()/2.; // dy
687 parSCPA[3] = g->GetPassiveScintThick()/2.; // dz
688 gMC->Gsvolu("SCPA", "TRD1", idtmed[idSC], parSCPA, 4);
689 zposSCPA = -parEMOD[3] + g->GetFrontSteelStrip() + g->GetPassiveScintThick()/2.;
690 gMC->Gspos ("SCPA", ++nr, child, 0.0, 0.0, zposSCPA, 0, "ONLY");
693 } else if (gn.Contains("TRD2")){ // TRD2 as for TRD1 - 27-jan-05
694 parEMOD[0] = g->GetEtaModuleSize()/2.; // dx1
695 parEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2
696 parEMOD[2] = g->GetPhiModuleSize()/2.; // dy1
697 parEMOD[3] = parEMOD[2] + tanTrd2y*g->GetLongModuleSize();// dy2
698 parEMOD[4] = g->GetLongModuleSize()/2.; // dz
699 gMC->Gsvolu(child, "TRD2", idtmed[idSTEEL], parEMOD, 5);
703 if(gn.Contains("TWIST")) { // 13-sep-04
704 fShishKebabModules = new TList;
705 AliEMCALShishKebabModule *mod=0, *mTmp; // current module
706 for(int iz=0; iz<g->GetNZ(); iz++) {
707 //for(int iz=0; iz<4; iz++) {
709 mod = new AliEMCALShishKebabModule();
712 mTmp = new AliEMCALShishKebabModule(*mod);
714 Double_t angle = mod->GetThetaInDegree();
715 AliMatrix(idrotm, angle,0., 90.0,90.0, 90.-angle, 180.);
717 fShishKebabModules->Add(mod);
719 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - smodPar0;
720 zpos = mod->GetPosZ() - smodPar2;
721 for(int iy=0; iy<g->GetNPhi(); iy++) {
722 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
723 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, idrotm, "ONLY") ;
724 // printf(" %3i(%2i,2i) xpos %7.2f ypos %7.2f zpos %7.2f \n", nr,iy,iz, xpos, ypos, zpos);
727 } else if(gn.Contains("TRD")) { // 30-sep-04; 27-jan-05 - as for TRD1 as for TRD2
728 // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0)
729 AliEMCALShishKebabTrd1Module *mod=0, *mTmp; // current module
730 if(fShishKebabModules == 0) {
731 fShishKebabModules = new TList;
732 for(int iz=0; iz<g->GetNZ(); iz++) { // 27-may-05; g->GetNZ() -> 26
734 mod = new AliEMCALShishKebabTrd1Module();
736 mTmp = new AliEMCALShishKebabTrd1Module(*mod);
739 fShishKebabModules->Add(mod);
742 for(int iz=0; iz<g->GetNZ(); iz++) {
743 Double_t angle=90., phiOK=0;
744 if(gn.Contains("TRD1")) {
745 mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
746 angle = mod->GetThetaInDegree();
747 if(!gn.Contains("WSUC")) { // ALICE
748 if(iz==0) AliMatrix(idrotm, 0.,0., 90.,90., 90.,0.); // z'(x); y'(y); x'(z)
749 else AliMatrix(idrotm, 90.-angle,180., 90.0,90.0, angle, 0.);
750 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
751 // printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
752 //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
753 xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - smodPar0;
754 zpos = mod->GetPosZ() - smodPar2;
756 int iyMax = g->GetNPhi();
757 if(strcmp(mother,"SMOD") && gn.Contains("110DEG")) {
760 for(int iy=0; iy<iyMax; iy++) { // flat in phi
761 ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
762 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, idrotm, "ONLY") ;
763 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f idrotm %i\n", nr, xpos, ypos, zpos, idrotm);
764 printf("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1);
768 if(iz==0) AliMatrix(idrotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y)
769 else AliMatrix(idrotm, 90-angle,270., 90.0,0.0, angle,90.);
770 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
771 printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
772 iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
773 zpos = mod->GetPosZ() - smodPar2;
774 ypos = mod->GetPosXfromR() - smodPar1;
775 printf(" zpos %7.2f ypos %7.2f idrotm %i\n xpos ", zpos, xpos, idrotm);
776 for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
777 xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
778 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, idrotm, "ONLY") ;
779 printf(" %7.2f ", xpos);
783 } else if(gn.Contains("TRD2")){ // 1-feb-05 - TRD2; curve in phi
784 double angEtaRow = 0.;
785 double theta1=0.,phi1=0., theta2=0.,phi2=0., theta3=0.,phi3=0.;
788 mod = new AliEMCALShishKebabTrd1Module();
790 mTmp = new AliEMCALShishKebabTrd1Module(*mod);
792 angle = mod->GetThetaInDegree();
795 fShishKebabModules->Add(mod);
796 phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi();
797 printf(" %i | theta | %6.3f - %6.3f = %6.3f\n", iz+1, angle, phiOK, angle-phiOK);
799 zpos = mod->GetPosZ() - parTubs[2];
800 rpos = parTubs[0] + mod->GetPosXfromR();
802 angle = mod->GetThetaInDegree();
803 Double_t stepAngle = (parTubs[4] - parTubs[3])/g->GetNPhi(); // 11-mar-04
804 for(int iy=0; iy<g->GetNPhi(); iy++) {
805 angEtaRow = parTubs[3] + stepAngle*(0.5+double(iy));
807 theta1 = 90. + angle; phi1 = angEtaRow; // x' ~-z;
808 theta2 = 90.; phi2 = 90. + angEtaRow;// y' ~ y;
809 theta3 = angle; phi3 = angEtaRow; // z' ~ x;
810 if(phi3 < 0.0) phi3 += 360.;
811 AliMatrix(idrotm, theta1,phi1, theta2,phi2, theta3,phi3);
813 xpos = rpos * TMath::Cos(angEtaRow*TMath::DegToRad());
814 ypos = rpos * TMath::Sin(angEtaRow*TMath::DegToRad());
815 gMC->Gspos(child, ++nr, "SMOP", xpos, ypos, zpos, idrotm, "ONLY") ;
817 phi1 = 180 + angEtaRow;
818 theta3 = 180.-theta3; phi3 = angEtaRow;
819 AliMatrix(idrotm, theta1,phi1, theta2,phi2, theta3,phi3);
820 gMC->Gspos(child, nr, "SMON", xpos, ypos, -zpos, idrotm, "ONLY") ;
822 printf(" angEtaRow(phi) %7.2f | angle(eta) %7.2f \n", angEtaRow, angle);
823 printf("iy=%2i xpos %7.2f ypos %7.2f zpos %7.2f idrotm %i\n", iy, xpos, ypos, zpos, idrotm);
825 } // for(int iy=0; iy<g->GetNPhi(); iy++)
829 xpos = g->GetSteelFrontThickness()/2.;
830 for(int iz=0; iz<g->GetNZ(); iz++) {
831 zpos = -smodPar2 + g->GetEtaModuleSize()*(2*iz+1)/2.;
832 for(int iy=0; iy<g->GetNPhi(); iy++) {
833 ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.;
834 gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, 0, "ONLY") ;
835 //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f \n", nr, xpos, ypos, zpos);
839 printf(" Number of modules in Super Module %i \n", nr);
843 void AliEMCALv0::Trd1Tower3X3(const double parSCM0[4])
844 {// PB should be for whole SCM0 - ?
845 double parTRAP[11], *dummy=0;
846 AliEMCALGeometry * g = GetGeometry();
847 TString gn(g->GetName()), scmx;
849 // Division to tile size
850 Info("Trd1Tower3X3()","<I> Divide SCM0 on y-axis %i", g->GetNETAdiv());
851 gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
852 double dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3];
853 double ndiv=3., xpos=0.0;
854 // should be defined once
855 gMC->Gsvolu("PBTI", "BOX", idtmed[idPB], dummy, 0);
856 if(gn.Contains("TEST")==0) { // one name for all trapesoid
858 gMC->Gsvolu(scmx.Data(), "TRAP", idtmed[idSC], dummy, 0);
862 for(int ix=1; ix<=3; ix++) { // 3X3
865 parTRAP[1] = TMath::ATan2((dx2-dx1)/2.,2.*dz)*TMath::RadToDeg(); // theta
866 parTRAP[2] = 0.; // phi
868 parTRAP[3] = dy/ndiv; // H1
869 parTRAP[4] = dx1/ndiv; // BL1
870 parTRAP[5] = parTRAP[4]; // TL1
871 parTRAP[6] = 0.0; // ALP1
873 parTRAP[7] = dy/ndiv; // H2
874 parTRAP[8] = dx2/ndiv; // BL2
875 parTRAP[9] = parTRAP[8]; // TL2
876 parTRAP[10]= 0.0; // ALP2
877 xpos = +(dx1+dx2)/3.; // 6 or 3
880 parTRAP[1] = -parTRAP[1];
882 } else if(ix==2) { // central part is box but we treat as trapesoid due to numbering
884 parTRAP[8] = dx1/ndiv; // BL2
885 parTRAP[9] = parTRAP[8]; // TL2
888 printf(" ** TRAP ** xpos %9.3f\n", xpos);
889 for(int i=0; i<11; i++) printf(" par[%2.2i] %9.4f\n", i, parTRAP[i]);
890 if(gn.Contains("TEST")){
891 scmx = "SCX"; scmx += ix;
892 gMC->Gsvolu(scmx.Data(), "TRAP", idtmed[idSC], parTRAP, 11);
893 gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
895 gMC->Gsposp(scmx.Data(), ix, "SCMY", xpos, 0.0, 0.0, 0, "ONLY", parTRAP, 11) ;
897 PbInTrap(parTRAP, scmx);
900 Info("Trd1Tower3X3()", "Ver. 1.0 : was tested.");
904 void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
905 {// see for example CreateShishKebabGeometry(); just for case TRD1
907 printf(" Pb tiles : nrstart %i\n", nr);
908 AliEMCALGeometry * g = GetGeometry();
911 double sampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
912 double xpos = 0.0, ypos = 0.0;
913 double zpos = -sampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
915 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
916 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // ??
917 // double tan = TMath::Tan(parTRAP[1]*TMath::DegToRad());
919 par[1] = parTRAP[3]; // y
920 par[2] = g->GetECPbRadThick()/2.; // z
921 for(int iz=0; iz<g->GetNECLayers(); iz++){
922 par[0] = parTRAP[4] + coef*sampleWidth*iz;
923 xpos = par[0] - xCenterSCMX;
924 if(parTRAP[1] < 0.) xpos = -xpos;
925 gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
926 printf(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]);
928 if(iz%2>0) printf("\n");
930 printf(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef);
931 printf(" par[1] %9.3f par[2] %9.3f ypos %9.3f \n", par[1], par[2], ypos);
932 Info("PbInTrap", "Ver. 1.0 : was tested.");
936 void AliEMCALv0::Trd1Tower4X4()
937 {// see for example CreateShishKebabGeometry()
940 void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t parEMOD[5], Double_t parSCM0[5])
942 // Passive material inside the detector
943 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); //Need check
944 printf(" wall thickness %7.5f \n", wallThickness);
945 for(int i=0; i<4; i++) { // on pictures sometimes I can not see 0 -> be carefull!!
946 parSCM0[i] = parEMOD[i] - wallThickness;
947 printf(" %i parSCMO %7.3f parEMOD %7.3f : dif %7.3f \n", i, parSCM0[i],parEMOD[i], parSCM0[i]-parEMOD[i]);
949 parSCM0[4] = parEMOD[4];
950 gMC->Gsvolu("SCM0", "TRD2", idtmed[idSC], parSCM0, 5); // idAIR -> idSC
951 gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
953 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
954 Division2X2InScm0(g, parSCM0);
956 Info("Scm0InTrd2"," no division SCM0 in this geometry |%s|\n", g->GetName());
961 void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t parSCM0[5])
963 Double_t parTRAP[11], xpos=0.,ypos=0., dx1=0.0,dx2=0.,dy1=0.0,dy2=0.,dz=0.
967 Info("Division2X2InScm0","Divide SCM0 on y-axis %i\n", g->GetNETAdiv());
968 TString n("SCMX"), overLapFlagSCMY("ONLY"), overLapFlagSCMX("ONLY");
969 n = "SCM0"; // for testing - 14-mar-05
971 PbInTrapForTrd2(parSCM0, n);
972 // overLapFlagSCMY=overLapFlagSCMX="MANY"; // do not work
976 dy1 = parSCM0[2] , dy2 = parSCM0[3], dz = parSCM0[4];
978 parTRAP[0] = parSCM0[4]; // dz
979 parTRAP[1] = TMath::ATan2((dy2-dy1)/2.,2.*dz)*TMath::RadToDeg();
980 parTRAP[2] = 90.; // phi
982 parTRAP[3] = parSCM0[2]/2.; // H1
983 parTRAP[4] = parSCM0[0]; // BL1
984 parTRAP[5] = parTRAP[4]; // TL1
985 parTRAP[6] = 0.0; // ALP1
987 parTRAP[7] = parSCM0[3]/2.; // H2
988 parTRAP[8] = parSCM0[1]; // BL2
989 parTRAP[9] = parTRAP[8]; // TL2
990 parTRAP[10]= 0.0; // ALP2
991 printf(" ** SCMY ** \n");
992 for(int i=0; i<11; i++) printf(" par[%2.2i] %9.4f\n", i, parTRAP[i]);
995 gMC->Gsvolu("SCMY", "TRAP", idtmed[idSC], parTRAP, 11); // idAIR -> idSC
996 ypos = +(parTRAP[3]+parTRAP[7])/2.; //
997 printf(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data());
998 gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, idrotm, overLapFlagSCMY.Data()) ;
999 // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z
1000 AliMatrix(idrotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
1001 // We may have problem with numeration due to rotation - 4-feb-05
1002 gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, idrotm, overLapFlagSCMY.Data());
1004 Info("Division2X2InScm0","Divide SCMY on x-axis %i\n", g->GetNPHIdiv());
1007 dr1=TMath::Sqrt(dx1*dx1+dy1*dy1);
1008 dr2=TMath::Sqrt(dx2*dx2+dy2*dy2);
1010 parTRAP[0] = parSCM0[4]; // dz
1011 parTRAP[1] = TMath::ATan2((dr2-dr1)/2.,2.*dz)*TMath::RadToDeg(); //
1012 parTRAP[2] = 45.; // phi
1014 parTRAP[3] = parSCM0[2]/2.; // H1
1015 parTRAP[4] = parSCM0[0]/2.; // BL1
1016 parTRAP[5] = parTRAP[4]; // TL1
1017 parTRAP[6] = 0.0; // ALP1
1019 parTRAP[7] = parSCM0[3]/2.; // H2
1020 parTRAP[8] = parSCM0[1]/2; // BL2
1021 parTRAP[9] = parTRAP[8]; // TL2
1022 parTRAP[10]= 0.0; // ALP2
1023 printf(" ** SCMX ** \n");
1024 for(int i=0; i<11; i++) printf(" par[%2.2i] %9.4f\n", i, parTRAP[i]);
1027 gMC->Gsvolu("SCMX", "TRAP", idtmed[idSC], parTRAP, 11);
1028 xpos = (parTRAP[4]+parTRAP[8])/2.;
1029 printf(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data());
1030 gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, idrotm, overLapFlagSCMX.Data()) ;
1031 // AliMatrix(idrotm, 90.0,270., 90.0, 0.0, 0.0,0.0); // x'=-y; y'=x; z'=z
1032 AliMatrix(idrotm, 90.0,90., 90.0, -180.0, 0.0,0.0); // x'=y; y'=-x; z'=z
1033 gMC->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, idrotm, overLapFlagSCMX.Data()) ;
1035 if(n=="SCMX" && overLapFlagSCMY == "ONLY") {
1036 PbInTrapForTrd2(parTRAP, n);
1041 void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
1044 TString pbShape("BOX"), pbtiChonly("ONLY");
1047 // pbtiChonly = "MANY";
1049 gMC->Gsvolu("PBTI", pbShape.Data(), idtmed[idPB], dummy, 0);
1052 Info("PbInTrapForTrd2"," Pb tiles inside %s: shape %s :pbtiChonly %s\n nrstart %i\n",
1053 name.Data(), pbShape.Data(), pbtiChonly.Data(), nr);
1054 AliEMCALGeometry * g = GetGeometry();
1056 double par[5], parPB[5], parSC[5];
1057 double sampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1058 double xpos = 0.0, ypos = 0.0;
1059 double zpos = -sampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
1060 if(name == "SCMX") { // common trapezoid - 11 parameters
1061 double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]);
1062 double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // the same for y
1063 printf(" xCenterSCMX %8.5f : coef %8.7f \n", xCenterSCMX, coef);
1065 par[2] = g->GetECPbRadThick()/2.; // z
1066 for(int iz=0; iz<g->GetNECLayers(); iz++){
1067 par[0] = parTRAP[4] + coef*sampleWidth*iz;
1069 xpos = ypos = par[0] - xCenterSCMX;
1070 //if(parTRAP[1] < 0.) xpos = -xpos;
1071 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
1072 printf(" %2.2i xpos %8.5f zpos %6.3f par[0,1] %6.3f |", iz+1, xpos, zpos, par[0]);
1073 if(iz%2>0) printf("\n");
1074 zpos += sampleWidth;
1076 printf(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef);
1077 printf(" par[1] %9.5f par[2] %9.5f ypos %9.5f \n", par[1], par[2], ypos);
1078 } else if(name == "SCM0") { // 1-mar-05 ; TRD2 - 5 parameters
1079 printf(" SCM0 par = ");
1080 for(int i=0; i<5; i++) printf(" %9.5f ", parTRAP[i]);
1081 printf("\n zpos %f \n",zpos);
1083 double tanx = (parTRAP[1] - parTRAP[0]) / (2.*parTRAP[4]); // tanx = tany now
1084 double tany = (parTRAP[3] - parTRAP[2]) / (2.*parTRAP[4]), ztmp=0.;
1085 parPB[4] = g->GetECPbRadThick()/2.;
1086 parSC[2] = g->GetECScintThick()/2.;
1087 for(int iz=0; iz<g->GetNECLayers(); iz++){
1088 ztmp = sampleWidth*double(iz);
1089 parPB[0] = parTRAP[0] + tanx*ztmp;
1090 parPB[1] = parPB[0] + tanx*g->GetECPbRadThick();
1091 parPB[2] = parTRAP[2] + tany*ztmp;
1092 parPB[3] = parPB[2] + tany*g->GetECPbRadThick();
1093 gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ;
1094 printf("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos);
1096 for(int i=0; i<5; i++) printf(" %9.5f ", parPB[i]);
1097 // individual SC tile
1098 parSC[0] = parPB[0];
1099 parSC[1] = parPB[1];
1100 gMC->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(),
1101 0, pbtiChonly.Data(), parSC, 3) ;
1102 printf("\n SCTI zpos %6.3f | par = ", zpos+g->GetECScintThick());
1103 for(int i=0; i<3; i++) printf(" %9.5f ", parPB[i]);
1105 zpos += sampleWidth;
1109 Info("PbInTrapForTrd2", "Ver. 0.03 : was tested.");
1113 void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t parEMOD[5], Double_t parPBMO[5])
1115 Info("PbmoInTrd2"," started : geometry %s ", g->GetName());
1116 double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize();
1117 printf(" wall thickness %7.5f \n", wallThickness);
1118 for(int i=0; i<4; i++) {
1119 parPBMO[i] = parEMOD[i] - wallThickness;
1120 printf(" %i parPBMO %7.3f parEMOD %7.3f : dif %7.3f \n",
1121 i, parPBMO[i],parEMOD[i], parPBMO[i]-parEMOD[i]);
1123 parPBMO[4] = parEMOD[4];
1124 gMC->Gsvolu("PBMO", "TRD2", idtmed[idPB], parPBMO, 5);
1125 gMC->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
1127 if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
1128 Division2X2InPbmo(g, parPBMO);
1129 printf(" PBMO, division 2X2 | geometry |%s|\n", g->GetName());
1131 printf(" no division PBMO in this geometry |%s|\n", g->GetName());
1136 void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t parPBMO[5])
1138 Info("Division2X2InPbmo"," started : geometry %s ", g->GetName());
1139 //Double_t *dummy=0;
1140 // gMC->Gsvolu("SCTI", "BOX", idtmed[idSC], dummy, 0);
1143 double sampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
1144 double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;;
1145 double tanx = (parPBMO[1] - parPBMO[0]) / (2.*parPBMO[4]); // tanx = tany now
1146 double tany = (parPBMO[3] - parPBMO[2]) / (2.*parPBMO[4]);
1147 char name[10], named[10], named2[10];
1149 printf(" PBMO par = ");
1150 for(int i=0; i<5; i++) printf(" %9.5f ", parPBMO[i]);
1153 parSC[2] = g->GetECScintThick()/2.;
1154 zpos = -sampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick() + g->GetECScintThick()/2.;
1155 printf(" parSC[2] %9.5f \n", parSC[2]);
1156 for(int iz=0; iz<g->GetNECLayers(); iz++){
1157 ztmp = g->GetECPbRadThick() + sampleWidth*double(iz); // Z for previous PB
1158 parSC[0] = parPBMO[0] + tanx*ztmp;
1159 parSC[1] = parPBMO[2] + tany*ztmp;
1161 sprintf(name,"SC%2.2i", iz+1);
1162 gMC->Gsvolu(name, "BOX", idtmed[idSC], parSC, 3);
1163 gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
1164 printf("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ",
1165 name, zpos, parSC[0], parSC[1]);
1167 sprintf(named,"SY%2.2i", iz+1);
1168 printf(" %s -> ", named);
1169 gMC->Gsdvn(named,name, 2, 2);
1171 sprintf(named2,"SX%2.2i", iz+1);
1172 printf(" %s \n", named2);
1173 gMC->Gsdvn(named2,named, 2, 1);
1175 zpos += sampleWidth;
1179 AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(const Int_t neta)
1181 AliEMCALShishKebabTrd1Module* trd1=0;
1182 if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) {
1183 trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta);