]>
Commit | Line | Data |
---|---|---|
2012850d | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
2012850d | 15 | /* $Id$ */ |
16 | ||
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 | |
ffa6d63b | 21 | // This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx |
2012850d | 22 | //*-- Author: Yves Schutz (SUBATECH) |
b13bbe81 | 23 | //*-- and : Sahal Yacoob (LBL / UCT) |
d87bd045 | 24 | // : Aleksei Pavlinov (WSU) SHASHLYK |
2012850d | 25 | |
26 | // --- ROOT system --- | |
7dd95fbf | 27 | #include <cassert> |
a1469a24 | 28 | |
cde6a23d | 29 | #include <TGeometry.h> |
9aa6a5f6 | 30 | #include <TGeoPhysicalNode.h> |
31 | #include <TGeoManager.h> | |
268f57b1 | 32 | #include <TGeoMatrix.h> |
cde6a23d | 33 | #include <TVirtualMC.h> |
34 | #include <TArrayI.h> | |
35 | #include <TROOT.h> | |
36 | #include <TList.h> | |
37 | #include <TVector2.h> | |
21e7df44 | 38 | #include <cassert> |
1963b290 | 39 | |
7c995da4 | 40 | //--- EMCAL system--- |
1963b290 | 41 | #include "AliEMCALShishKebabTrd1Module.h" |
a1469a24 | 42 | |
2012850d | 43 | // --- Standard library --- |
44 | ||
d64c959b | 45 | //#include <stdio.h> |
2012850d | 46 | |
47 | // --- AliRoot header files --- | |
48 | ||
49 | #include "AliEMCALv0.h" | |
50 | #include "AliEMCALGeometry.h" | |
51 | #include "AliRun.h" | |
4951e003 | 52 | #include "AliLog.h" |
200e17a4 | 53 | #include "AliGeomManager.h" |
e3697737 | 54 | #include "AliEMCALSpaceFrame.h" |
2012850d | 55 | |
56 | ClassImp(AliEMCALv0) | |
57 | ||
cde6a23d | 58 | // EMCAL material |
59 | enum | |
60 | { | |
61 | kIdAIR = 1599, | |
62 | kIdPB = 1600, | |
63 | kIdSC = 1601, | |
64 | kIdSTEEL = 1603 | |
65 | }; | |
18a21c7c | 66 | |
67 | ||
68 | //______________________________________________________________________ | |
69 | AliEMCALv0::AliEMCALv0() | |
70 | : AliEMCAL(), | |
71 | fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0), | |
e3697737 | 72 | fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0),fCalFrame(0) |
18a21c7c | 73 | { |
74 | //default ctor | |
51e4198e | 75 | for(Int_t i = 0; i < 5 ; i++) fParEMOD[i]=0.0; |
18a21c7c | 76 | } |
77 | ||
b13bbe81 | 78 | //______________________________________________________________________ |
18a21c7c | 79 | AliEMCALv0::AliEMCALv0(const char *name, const char *title) |
80 | : AliEMCAL(name,title), | |
81 | fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0), | |
e3697737 | 82 | fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0),fCalFrame(0) |
05a92d59 | 83 | { |
84 | // ctor : title is used to identify the layout | |
d25f2c54 | 85 | // Apr 25, 2006 |
86 | // Nov 22, 2006 - case of 1X1 | |
51e4198e | 87 | |
88 | for(Int_t i = 0; i < 5 ; i++) fParEMOD[i]=0.0; | |
e5a93224 | 89 | TString ntmp(GetTitle()); |
90 | ntmp.ToUpper(); | |
e5a93224 | 91 | |
e52475ed | 92 | AliEMCALGeometry *geom = GetGeometry() ; |
e52475ed | 93 | fShishKebabModules = geom->GetShishKebabTrd1Modules(); |
2012850d | 94 | } |
a1469a24 | 95 | |
b13bbe81 | 96 | //______________________________________________________________________ |
05a92d59 | 97 | void AliEMCALv0::CreateGeometry() |
98 | { | |
f590bb15 | 99 | // Create the EMCAL geometry for Geant |
100 | // Geometry of a tower | |
d297ef6e | 101 | |
102 | AliEMCALGeometry * geom = GetGeometry() ; | |
103 | TString gn(geom->GetName()); | |
104 | gn.ToUpper(); | |
105 | ||
106 | if(!(geom->IsInitialized())){ | |
107 | Error("CreateGeometry","EMCAL Geometry class has not been set up."); | |
108 | } // end if | |
109 | ||
110 | // Get pointer to the array containing media indices | |
111 | fIdTmedArr = fIdtmed->GetArray() - 1599 ; | |
112 | ||
113 | fIdRotm = 1; | |
114 | // gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule | |
115 | AliMatrix(fIdRotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ; | |
116 | ||
117 | // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1 | |
118 | ||
119 | Float_t envelopA[10]; | |
120 | if(gn.Contains("WSUC") ) { // TRD1 for WSUC facility | |
121 | // 17-may-05 - just BOX | |
122 | envelopA[0] = 26; | |
123 | envelopA[1] = 15; | |
124 | envelopA[2] = 30; | |
125 | gMC->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ; | |
126 | fEnvelop1.Set(3); | |
127 | for(int i=0; i<3; i++) fEnvelop1[i] = envelopA[i]; // 23-may-05 | |
128 | // Position the EMCAL Mother Volume (XEN1) in WSUC | |
129 | gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ; | |
130 | } else { | |
131 | envelopA[0] = geom->GetArm1PhiMin(); // minimum phi angle | |
132 | envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi | |
133 | envelopA[2] = geom->GetNPhiSuperModule(); // number of sections in phi | |
134 | envelopA[3] = 2; // 2 z coordinates | |
facb5967 | 135 | envelopA[4] = -geom->GetEnvelop(2)/2.; // zmin - includes padding |
136 | envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1 - includes padding | |
137 | envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1 - includes padding | |
138 | envelopA[7] = geom->GetEnvelop(2)/2.; // zmax includes padding | |
d297ef6e | 139 | |
140 | envelopA[8] = envelopA[5] ; // radii are the same. | |
141 | envelopA[9] = envelopA[6] ; // radii are the same. | |
142 | ||
143 | gMC->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ; // Polygone filled with air | |
144 | fEnvelop1.Set(10, envelopA); | |
145 | if (gDebug==2) { | |
146 | printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]); | |
147 | printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]); | |
1963b290 | 148 | } |
d297ef6e | 149 | // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC) |
150 | gMC->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ; | |
151 | } | |
152 | ||
153 | // COMPACT, TRD1 | |
154 | AliDebug(2,Form("Shish-Kebab geometry : %s", GetTitle())); | |
155 | CreateShishKebabGeometry(); | |
1963b290 | 156 | |
e3697737 | 157 | //Space Frame |
158 | AliDebug(2,"Creating EMCAL Space Frame"); | |
159 | fCalFrame = new AliEMCALSpaceFrame(); | |
160 | fCalFrame->CreateGeometry(); | |
161 | ||
2012850d | 162 | } |
a1469a24 | 163 | |
b13bbe81 | 164 | //______________________________________________________________________ |
05a92d59 | 165 | void AliEMCALv0::Init(void) |
166 | { | |
b13bbe81 | 167 | // Just prints an information message |
aa61eaea | 168 | AliEMCAL::Init(); |
4951e003 | 169 | if(AliLog::GetGlobalDebugLevel()>0) { |
9859bfc0 | 170 | TString message("\n") ; |
c27ad3fb | 171 | message += "*****************************************\n" ; |
05a92d59 | 172 | |
b13bbe81 | 173 | // Here the EMCAL initialisation code (if any!) |
9859bfc0 | 174 | |
05a92d59 | 175 | AliEMCALGeometry * geom = GetGeometry() ; |
9859bfc0 | 176 | |
177 | if (geom!=0) { | |
178 | message += "AliEMCAL " ; | |
179 | message += Version() ; | |
c27ad3fb | 180 | message += "EMCAL geometry initialized for " ; |
9859bfc0 | 181 | message += geom->GetName() ; |
182 | } | |
183 | else { | |
184 | message += "AliEMCAL " ; | |
185 | message += Version() ; | |
186 | message += "EMCAL geometry initialization failed !" ; | |
05a92d59 | 187 | } |
c27ad3fb | 188 | message += "\n*****************************************" ; |
d804d556 | 189 | printf("%s",message.Data() ) ; |
9859bfc0 | 190 | } |
2012850d | 191 | } |
1963b290 | 192 | |
193 | // 24-aug-04 by PAI | |
4d2e7dc7 | 194 | //______________________________________________________________________ |
1963b290 | 195 | void AliEMCALv0::CreateShishKebabGeometry() |
cde6a23d | 196 | { |
937d0661 | 197 | // TRD1 |
1963b290 | 198 | AliEMCALGeometry * g = GetGeometry(); |
199 | TString gn(g->GetName()); gn.ToUpper(); | |
cde6a23d | 200 | // see AliModule::fFIdTmedArr |
201 | // fIdTmedArr = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials() | |
202 | // int kIdAIR=1599, kIdPB = 1600, kIdSC = 1601, kIdSTEEL = 1603; | |
1963b290 | 203 | // idAL = 1602; |
204 | Double_t par[10], xpos=0., ypos=0., zpos=0.; | |
205 | ||
e52475ed | 206 | CreateSmod(g->GetNameOfEMCALEnvelope()); |
1963b290 | 207 | |
d87bd045 | 208 | CreateEmod("SMOD","EMOD"); // 18-may-05 |
209 | ||
1d46d1f6 | 210 | if(g->GetKey110DEG()) CreateEmod("SM10","EMOD"); // Nov 1,2006 |
1963b290 | 211 | |
212 | // Sensitive SC (2x2 tiles) | |
1d46d1f6 | 213 | double parSCM0[5]={0,0,0,0}, *dummy = 0, parTRAP[11]; |
d297ef6e | 214 | |
215 | // double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); // Need check | |
216 | double wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() - g->GetPhiTileSize(); | |
217 | for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness; | |
218 | parSCM0[3] = fParEMOD[3]; | |
219 | gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4); | |
220 | gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ; | |
221 | ||
222 | if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) { | |
1963b290 | 223 | // Division to tile size - 1-oct-04 |
d297ef6e | 224 | AliDebug(2,Form(" Divide SCM0 on y-axis %i\n", g->GetNETAdiv())); |
225 | gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis | |
1963b290 | 226 | // Trapesoid 2x2 |
d297ef6e | 227 | parTRAP[0] = parSCM0[3]; // dz |
228 | parTRAP[1] = TMath::ATan2((parSCM0[1]-parSCM0[0])/2.,2.*parSCM0[3])*180./TMath::Pi(); // theta | |
229 | parTRAP[2] = 0.; // phi | |
230 | // bottom | |
231 | parTRAP[3] = parSCM0[2]/2.; // H1 | |
232 | parTRAP[4] = parSCM0[0]/2.; // BL1 | |
233 | parTRAP[5] = parTRAP[4]; // TL1 | |
234 | parTRAP[6] = 0.0; // ALP1 | |
235 | // top | |
236 | parTRAP[7] = parSCM0[2]/2.; // H2 | |
237 | parTRAP[8] = parSCM0[1]/2.; // BL2 | |
238 | parTRAP[9] = parTRAP[8]; // TL2 | |
239 | parTRAP[10]= 0.0; // ALP2 | |
240 | AliDebug(2,Form(" ** TRAP ** \n")); | |
241 | for(int i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i])); | |
242 | ||
243 | gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); | |
244 | xpos = +(parSCM0[1]+parSCM0[0])/4.; | |
245 | gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ; | |
246 | ||
247 | // Using rotation because SCMX should be the same due to Pb tiles | |
248 | xpos = -xpos; | |
249 | AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ; | |
250 | gMC->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, fIdRotm, "ONLY"); | |
1963b290 | 251 | // put LED to the SCM0 |
d297ef6e | 252 | AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0); |
253 | gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0); | |
254 | ||
255 | par[1] = parSCM0[2]/2; // y | |
256 | par[2] = g->GetECPbRadThick()/2.; // z | |
257 | ||
258 | int nr=0; | |
259 | ypos = 0.0; | |
260 | zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.; | |
261 | double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; | |
262 | AliDebug(2,Form(" Pb tiles \n")); | |
263 | for(int iz=0; iz<g->GetNECLayers(); iz++){ | |
264 | par[0] = (parSCM0[0] + mod->GetTanBetta()*fSampleWidth*iz)/2.; | |
265 | xpos = par[0] - xCenterSCMX; | |
266 | gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ; | |
267 | AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0])); | |
268 | zpos += fSampleWidth; | |
269 | } | |
270 | AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr)); | |
271 | ||
272 | } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) { | |
273 | printf(" before AliEMCALv0::Trd1Tower3X3() : parSCM0"); | |
274 | for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]); | |
275 | printf("\n"); | |
276 | Trd1Tower3X3(parSCM0); | |
277 | } else if(g->GetNPHIdiv()==1 && g->GetNETAdiv()==1) { | |
278 | // no division in SCM0 | |
279 | Trd1Tower1X1(parSCM0); | |
280 | } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) { | |
281 | Trd1Tower4X4(); | |
1963b290 | 282 | } |
d297ef6e | 283 | |
1963b290 | 284 | } |
285 | ||
4d2e7dc7 | 286 | //______________________________________________________________________ |
1963b290 | 287 | void AliEMCALv0::CreateSmod(const char* mother) |
cde6a23d | 288 | { |
289 | // 18-may-05; mother="XEN1"; | |
d87bd045 | 290 | // child="SMOD" from first to 10th, "SM10" (11th and 12th) (TRD1 case) |
1963b290 | 291 | AliEMCALGeometry * g = GetGeometry(); |
292 | TString gn(g->GetName()); gn.ToUpper(); | |
293 | ||
6f377f0c | 294 | Double_t par[3], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.; |
d87bd045 | 295 | Double_t par1C = 0.; |
1963b290 | 296 | // ===== define Super Module from air - 14x30 module ==== ; |
cde6a23d | 297 | fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick()); |
e5a93224 | 298 | AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data())); |
1963b290 | 299 | par[0] = g->GetShellThickness()/2.; |
300 | par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.; | |
301 | par[2] = g->GetEtaModuleSize()*15.; | |
cde6a23d | 302 | fIdRotm=0; |
1963b290 | 303 | int nphism = g->GetNumberOfSuperModules()/2; // 20-may-05 |
304 | if(nphism>0) { | |
305 | dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/nphism; | |
1d46d1f6 | 306 | // if(g->GetKey110DEG()) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1); |
1963b290 | 307 | rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.; |
e5a93224 | 308 | AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi)); |
1963b290 | 309 | } |
310 | ||
6f377f0c | 311 | if(gn.Contains("WSUC")) { |
1963b290 | 312 | par[0] = g->GetPhiModuleSize()*g->GetNPhi()/2.; |
313 | par[1] = g->GetShellThickness()/2.; | |
314 | par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5; | |
315 | ||
cde6a23d | 316 | gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3); |
1963b290 | 317 | |
e5a93224 | 318 | AliDebug(2,Form("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n", |
319 | fIdTmedArr[kIdAIR], par[0],par[1],par[2])); | |
cde6a23d | 320 | fSmodPar0 = par[0]; |
321 | fSmodPar1 = par[1]; | |
322 | fSmodPar2 = par[2]; | |
1963b290 | 323 | nphism = g->GetNumberOfSuperModules(); |
324 | } else { | |
d297ef6e | 325 | par[2] = 350./2.; // 11-oct-04 - for 26 division |
326 | AliDebug(2,Form(" par[0] %7.2f (old) \n", par[0])); | |
327 | Float_t *parSM = g->GetSuperModulesPars(); | |
328 | for(int i=0; i<3; i++) par[i] = parSM[i]; | |
329 | } | |
330 | gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3); | |
331 | AliDebug(2,Form("tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n", | |
332 | fIdTmedArr[kIdAIR], par[0],par[1],par[2])); | |
333 | fSmodPar0 = par[0]; | |
334 | fSmodPar2 = par[2]; | |
335 | if(g->GetKey110DEG()) { // 12-oct-05 | |
336 | par1C = par[1]; | |
337 | par[1] /= 2.; | |
338 | gMC->Gsvolu("SM10", "BOX", fIdTmedArr[kIdAIR], par, 3); | |
339 | AliDebug(2,Form(" Super module with name \"SM10\" was created too par[1] = %f\n", par[1])); | |
340 | par[1] = par1C; | |
341 | } | |
1963b290 | 342 | // Steel plate |
d297ef6e | 343 | if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05 |
344 | par[0] = g->GetSteelFrontThickness()/2.; | |
345 | gMC->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3); | |
346 | printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", fIdTmedArr[kIdSTEEL], par[0],par[1],par[2]); | |
347 | xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.; | |
348 | gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ; | |
1963b290 | 349 | } |
350 | ||
d87bd045 | 351 | int nr=0, nrsmod=0, i0=0; |
1963b290 | 352 | |
353 | // Turn whole super module | |
1963b290 | 354 | for(int i=i0; i<nphism; i++) { |
6f377f0c | 355 | if(gn.Contains("WSUC")) { |
d87bd045 | 356 | xpos = ypos = zpos = 0.0; |
cde6a23d | 357 | fIdRotm = 0; |
358 | gMC->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ; | |
359 | printf(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n", | |
360 | fIdRotm, phi, phiRad, xpos, ypos, zpos); | |
d87bd045 | 361 | nr++; |
c63c3c5d | 362 | } else { // TRD1 |
d87bd045 | 363 | TString smName("SMOD"); // 12-oct-05 |
1d46d1f6 | 364 | if(i==5 && g->GetKey110DEG()) { |
d87bd045 | 365 | smName = "SM10"; |
366 | nrsmod = nr; | |
367 | nr = 0; | |
368 | } | |
1963b290 | 369 | phi = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170 |
370 | phiRad = phi*TMath::Pi()/180.; | |
371 | ||
cde6a23d | 372 | AliMatrix(fIdRotm, 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0); |
1963b290 | 373 | |
374 | xpos = rpos * TMath::Cos(phiRad); | |
375 | ypos = rpos * TMath::Sin(phiRad); | |
cde6a23d | 376 | zpos = fSmodPar2; // 21-sep-04 |
1d46d1f6 | 377 | if(i==5 && g->GetKey110DEG()) { |
d87bd045 | 378 | xpos += (par1C/2. * TMath::Sin(phiRad)); |
379 | ypos -= (par1C/2. * TMath::Cos(phiRad)); | |
380 | } | |
381 | ||
1963b290 | 382 | // 1th module in z-direction; |
cde6a23d | 383 | gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ; |
384 | AliDebug(3, Form(" %s : %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n", | |
385 | smName.Data(), nr, fIdRotm, phi, phiRad, xpos, ypos, zpos, i)); | |
1963b290 | 386 | // 2th module in z-direction; |
1963b290 | 387 | // turn arround X axis; 0<phi<360 |
d297ef6e | 388 | double phiy = 90. + phi + 180.; |
389 | if(phiy>=360.) phiy -= 360.; | |
390 | ||
391 | AliMatrix(fIdRotm, 90.0, phi, 90.0, phiy, 180.0, 0.0); | |
392 | gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY"); | |
393 | AliDebug(3, Form(" %s : %2i fIdRotm %3i phiy %6.1f xpos %7.2f ypos %7.2f zpos %7.2f \n", | |
394 | smName.Data(), nr, fIdRotm, phiy, xpos, ypos, -zpos)); | |
1963b290 | 395 | } |
396 | } | |
e5a93224 | 397 | AliDebug(2,Form(" Number of Super Modules %i \n", nr+nrsmod)); |
1963b290 | 398 | } |
399 | ||
4d2e7dc7 | 400 | //______________________________________________________________________ |
1963b290 | 401 | void AliEMCALv0::CreateEmod(const char* mother, const char* child) |
cde6a23d | 402 | { |
403 | // 17-may-05; mother="SMOD"; child="EMOD" | |
1963b290 | 404 | AliEMCALGeometry * g = GetGeometry(); |
405 | TString gn(g->GetName()); gn.ToUpper(); | |
406 | // Module definition | |
d297ef6e | 407 | Double_t xpos=0., ypos=0., zpos=0.; |
1963b290 | 408 | Double_t parSCPA[5], zposSCPA=0.; // passive SC - 13-MAY-05, TRD1 case |
409 | Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.); | |
1963b290 | 410 | int nr=0; |
cde6a23d | 411 | fIdRotm=0; |
d297ef6e | 412 | if(strcmp(mother,"SMOD")==0) { |
413 | fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1 | |
414 | fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2 | |
415 | fParEMOD[2] = g->GetPhiModuleSize()/2.;; // dy | |
416 | fParEMOD[3] = g->GetLongModuleSize()/2.; // dz | |
417 | gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4); | |
418 | // if(gn.Contains("WSUC") || gn.Contains("MAY05")){ | |
419 | if(0){ // Jul 12 - should be checked | |
420 | parSCPA[0] = g->GetEtaModuleSize()/2. + tanTrd1*g->GetFrontSteelStrip(); // dx1 | |
421 | parSCPA[1] = parSCPA[0] + tanTrd1*g->GetPassiveScintThick(); // dx2 | |
422 | parSCPA[2] = g->GetPhiModuleSize()/2.; // dy | |
423 | parSCPA[3] = g->GetPassiveScintThick()/2.; // dz | |
424 | gMC->Gsvolu("SCPA", "TRD1", fIdTmedArr[kIdSC], parSCPA, 4); | |
425 | zposSCPA = -fParEMOD[3] + g->GetFrontSteelStrip() + g->GetPassiveScintThick()/2.; | |
426 | gMC->Gspos ("SCPA", ++nr, child, 0.0, 0.0, zposSCPA, 0, "ONLY"); | |
1963b290 | 427 | } |
1963b290 | 428 | } |
d297ef6e | 429 | |
1963b290 | 430 | nr = 0; |
d297ef6e | 431 | // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0) |
432 | AliEMCALShishKebabTrd1Module *mod=0; // current module | |
433 | ||
434 | for(int iz=0; iz<g->GetNZ(); iz++) { | |
435 | Double_t angle=90., phiOK=0; | |
436 | mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz); | |
437 | angle = mod->GetThetaInDegree(); | |
438 | if(!gn.Contains("WSUC")) { // ALICE | |
439 | if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,90., 90.,0.); // z'(x); y'(y); x'(z) | |
440 | else AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.); | |
441 | phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi(); | |
442 | // printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n", | |
443 | //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule()); | |
444 | xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0; | |
445 | zpos = mod->GetPosZ() - fSmodPar2; | |
446 | ||
447 | int iyMax = g->GetNPhi(); | |
448 | if(strcmp(mother,"SMOD") && g->GetKey110DEG()) { | |
449 | iyMax /= 2; | |
1963b290 | 450 | } |
d297ef6e | 451 | for(int iy=0; iy<iyMax; iy++) { // flat in phi |
452 | ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.; | |
453 | gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ; | |
454 | //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm); | |
455 | AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1)); | |
456 | } | |
457 | //PH printf("\n"); | |
458 | } else { //WSUC | |
459 | if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y) | |
460 | else AliMatrix(fIdRotm, 90-angle,270., 90.0,0.0, angle,90.); | |
461 | phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi(); | |
462 | printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n", | |
463 | iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule()); | |
464 | zpos = mod->GetPosZ() - fSmodPar2; | |
465 | ypos = mod->GetPosXfromR() - fSmodPar1; | |
466 | printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm); | |
467 | for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi | |
468 | xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.; | |
469 | gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ; | |
470 | printf(" %7.2f ", xpos); | |
1963b290 | 471 | } |
d297ef6e | 472 | printf("\n"); |
1963b290 | 473 | } |
474 | } | |
1d46d1f6 | 475 | AliDebug(2,Form(" Number of modules in Super Module(%s) %i \n", mother, nr)); |
1963b290 | 476 | } |
477 | ||
4d2e7dc7 | 478 | //______________________________________________________________________ |
479 | void AliEMCALv0::Trd1Tower3X3(const double *parSCM0) | |
cde6a23d | 480 | { |
4d2e7dc7 | 481 | // Started Dec 8,2004 by PAI |
482 | // Fixed Nov 13,2006 | |
483 | printf(" AliEMCALv0::Trd1Tower3X3() : parSCM0"); | |
484 | for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]); | |
485 | printf("\n"); | |
486 | // Nov 10, 2006 - different name of SCMX | |
487 | double parTRAP[11], *dummy=0; | |
488 | AliEMCALGeometry * g = GetGeometry(); | |
489 | TString gn(g->GetName()), scmx; | |
490 | gn.ToUpper(); | |
491 | // Division to tile size | |
492 | AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv())); | |
493 | gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis | |
494 | double dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3]; | |
495 | double ndiv=3., xpos=0.0; | |
496 | // should be defined once | |
497 | gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0); | |
498 | for(int ix=1; ix<=3; ix++) { // 3X3 | |
499 | scmx = "SCX"; // Nov 10,2006 | |
500 | // ix=1 | |
501 | parTRAP[0] = dz; | |
502 | double xCentBot = 2.*dx1/3.; | |
503 | double xCentTop = 2.*(dx2/4. + dx1/12.); | |
504 | parTRAP[1] = TMath::ATan2((xCentTop-xCentBot),2.*dz)*TMath::RadToDeg(); // theta | |
505 | parTRAP[2] = 0.; // phi | |
506 | // bottom | |
507 | parTRAP[3] = dy/ndiv; // H1 | |
508 | parTRAP[4] = dx1/ndiv; // BL1 | |
509 | parTRAP[5] = parTRAP[4]; // TL1 | |
510 | parTRAP[6] = 0.0; // ALP1 | |
511 | // top | |
512 | parTRAP[7] = dy/ndiv; // H2 | |
513 | parTRAP[8] = dx2/2 - dx1/6.;// BL2 | |
514 | parTRAP[9] = parTRAP[8]; // TL2 | |
515 | parTRAP[10]= 0.0; // ALP2 | |
516 | xpos = (xCentBot+xCentTop)/2.; | |
517 | ||
518 | if (ix==3) { | |
519 | parTRAP[1] = -parTRAP[1]; | |
520 | xpos = -xpos; | |
521 | } else if(ix==2) { // central part is box but we treat as trapesoid due to numbering | |
522 | parTRAP[1] = 0.; | |
523 | parTRAP[8] = dx1/ndiv; // BL2 | |
524 | parTRAP[9] = parTRAP[8]; // TL2 | |
525 | xpos = 0.0; | |
526 | } | |
527 | AliDebug(2,Form(" ** TRAP ** xpos %9.3f\n", xpos)); | |
528 | for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i])); | |
529 | ||
530 | scmx += ix; | |
531 | gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); | |
532 | gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ; | |
533 | ||
534 | PbInTrap(parTRAP, scmx); | |
535 | } | |
29b7e56e | 536 | AliDebug(2,"Trd1Tower3X3 - Ver. 1.0 : was tested."); |
1963b290 | 537 | } |
538 | ||
539 | // 8-dec-04 by PAI | |
4d2e7dc7 | 540 | //______________________________________________________________________ |
1963b290 | 541 | void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n) |
cde6a23d | 542 | { |
543 | // see for example CreateShishKebabGeometry(); just for case TRD1 | |
1963b290 | 544 | static int nr=0; |
e5a93224 | 545 | AliDebug(2,Form(" Pb tiles : nrstart %i\n", nr)); |
1963b290 | 546 | AliEMCALGeometry * g = GetGeometry(); |
547 | ||
548 | double par[3]; | |
cde6a23d | 549 | // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick()); |
1963b290 | 550 | double xpos = 0.0, ypos = 0.0; |
cde6a23d | 551 | double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.; |
1963b290 | 552 | |
553 | double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]); | |
554 | double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // ?? | |
555 | // double tan = TMath::Tan(parTRAP[1]*TMath::DegToRad()); | |
556 | ||
557 | par[1] = parTRAP[3]; // y | |
558 | par[2] = g->GetECPbRadThick()/2.; // z | |
559 | for(int iz=0; iz<g->GetNECLayers(); iz++){ | |
cde6a23d | 560 | par[0] = parTRAP[4] + coef*fSampleWidth*iz; |
1963b290 | 561 | xpos = par[0] - xCenterSCMX; |
562 | if(parTRAP[1] < 0.) xpos = -xpos; | |
563 | gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ; | |
e5a93224 | 564 | AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0])); |
cde6a23d | 565 | zpos += fSampleWidth; |
1963b290 | 566 | if(iz%2>0) printf("\n"); |
567 | } | |
e5a93224 | 568 | AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef)); |
569 | AliDebug(2,Form(" par[1] %9.3f par[2] %9.3f ypos %9.3f \n", par[1], par[2], ypos)); | |
570 | AliDebug(2,Form(" PbInTrap Ver. 1.0 : was tested.")); | |
1963b290 | 571 | } |
572 | ||
573 | // 8-dec-04 by PAI | |
4d2e7dc7 | 574 | //______________________________________________________________________ |
d804d556 | 575 | void AliEMCALv0::Trd1Tower4X4() const |
cde6a23d | 576 | { |
577 | // Not ready yet | |
1963b290 | 578 | } |
d25f2c54 | 579 | |
4d2e7dc7 | 580 | //______________________________________________________________________ |
581 | void AliEMCALv0::Trd1Tower1X1(double *parSCM0) | |
d25f2c54 | 582 | { |
4d2e7dc7 | 583 | // Started Nov 22,2006 by PAI |
584 | AliDebug(1," AliEMCALv0::Trd1Tower1X1() : parSCM0"); | |
585 | for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]); | |
586 | printf("\n"); | |
587 | ||
588 | // No division - keeping the same volume logic | |
589 | // and as consequence the same abs is scheme | |
590 | AliDebug(2,"Trd1Tower1X1() : Create SCMX(SCMY) as SCM0"); | |
591 | ||
592 | gMC->Gsvolu("SCMY", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4); | |
593 | gMC->Gspos("SCMY", 1, "SCM0", 0.0, 0.0, 0.0, 0, "ONLY"); | |
594 | gMC->Gsvolu("SCMX", "TRD1", fIdTmedArr[kIdSC], parSCM0, 4); | |
595 | gMC->Gspos("SCMX", 1, "SCMY", 0.0, 0.0, 0.0, 0, "ONLY"); | |
596 | ||
597 | // should be defined once | |
598 | double *dummy=0; | |
599 | gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0); | |
600 | ||
601 | PbInTrd1(parSCM0, "SCMX"); | |
602 | ||
603 | AliDebug(1,"Trd1Tower1X1() : Ver. 0.1 : was tested."); | |
604 | } | |
605 | ||
606 | //______________________________________________________________________ | |
d804d556 | 607 | void AliEMCALv0::PbInTrd1(const double *parTrd1, TString n) |
4d2e7dc7 | 608 | { |
609 | // see PbInTrap(const double parTrd1[11], TString n) | |
610 | static int nr=0, ndeb=2; | |
611 | AliDebug(ndeb,Form(" Pb tiles : nrstart %i\n", nr)); | |
612 | AliEMCALGeometry * g = GetGeometry(); | |
613 | ||
614 | double par[3]; | |
615 | // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick()); | |
616 | double xpos = 0.0, ypos = 0.0; | |
617 | double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.; | |
618 | double coef = (parTrd1[1] - parTrd1[0]) / (2.*parTrd1[3]); | |
619 | ||
620 | par[1] = parTrd1[2]; // y | |
621 | par[2] = g->GetECPbRadThick()/2.; // z | |
622 | ||
623 | for(int iz=0; iz<g->GetNECLayers(); iz++){ | |
624 | par[0] = parTrd1[0] + coef*fSampleWidth*iz; | |
625 | gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ; | |
626 | AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0])); | |
627 | zpos += fSampleWidth; | |
628 | if(iz%2>0) printf("\n"); | |
629 | } | |
630 | AliDebug(ndeb,Form(" Number of Pb tiles in SCMX %i coef %9.7f ", nr, coef)); | |
631 | AliDebug(ndeb,Form(" PbInTrd1 Ver. 0.1 : was tested.")); | |
d25f2c54 | 632 | } |
633 | ||
1963b290 | 634 | // 3-feb-05 |
4d2e7dc7 | 635 | //______________________________________________________________________ |
636 | void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parSCM0[5]) | |
1963b290 | 637 | { |
4d2e7dc7 | 638 | // Passive material inside the detector |
639 | double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); //Need check | |
640 | AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness)); | |
641 | for(int i=0; i<4; i++) { // on pictures sometimes I can not see 0 -> be carefull!! | |
642 | parSCM0[i] = emodPar[i] - wallThickness; | |
643 | AliDebug(2,Form(" %i parSCMO %7.3f emodPar %7.3f : dif %7.3f \n", | |
644 | i, parSCM0[i],emodPar[i], parSCM0[i]-emodPar[i])); | |
645 | } | |
646 | parSCM0[4] = emodPar[4]; | |
647 | gMC->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC | |
648 | gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ; | |
649 | // Division | |
650 | if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) { | |
651 | Division2X2InScm0(g, parSCM0); | |
652 | } else { | |
653 | Info("Scm0InTrd2"," no division SCM0 in this geometry |%s|\n", g->GetName()); | |
654 | assert(0); | |
655 | } | |
1963b290 | 656 | } |
657 | ||
4d2e7dc7 | 658 | //______________________________________________________________________ |
1963b290 | 659 | void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t parSCM0[5]) |
660 | { | |
cde6a23d | 661 | // Division 2X2 |
1963b290 | 662 | Double_t parTRAP[11], xpos=0.,ypos=0., dx1=0.0,dx2=0.,dy1=0.0,dy2=0.,dz=0. |
663 | ,dr1=0.0,dr2=0.; | |
cde6a23d | 664 | fIdRotm=0; |
1963b290 | 665 | |
666 | Info("Division2X2InScm0","Divide SCM0 on y-axis %i\n", g->GetNETAdiv()); | |
667 | TString n("SCMX"), overLapFlagSCMY("ONLY"), overLapFlagSCMX("ONLY"); | |
668 | n = "SCM0"; // for testing - 14-mar-05 | |
669 | if(n=="SCM0"){ | |
670 | PbInTrapForTrd2(parSCM0, n); | |
671 | // overLapFlagSCMY=overLapFlagSCMX="MANY"; // do not work | |
672 | return; | |
673 | } | |
674 | ||
675 | dy1 = parSCM0[2] , dy2 = parSCM0[3], dz = parSCM0[4]; | |
676 | ||
677 | parTRAP[0] = parSCM0[4]; // dz | |
678 | parTRAP[1] = TMath::ATan2((dy2-dy1)/2.,2.*dz)*TMath::RadToDeg(); | |
679 | parTRAP[2] = 90.; // phi | |
680 | // bottom | |
681 | parTRAP[3] = parSCM0[2]/2.; // H1 | |
682 | parTRAP[4] = parSCM0[0]; // BL1 | |
683 | parTRAP[5] = parTRAP[4]; // TL1 | |
684 | parTRAP[6] = 0.0; // ALP1 | |
685 | // top | |
686 | parTRAP[7] = parSCM0[3]/2.; // H2 | |
687 | parTRAP[8] = parSCM0[1]; // BL2 | |
688 | parTRAP[9] = parTRAP[8]; // TL2 | |
689 | parTRAP[10]= 0.0; // ALP2 | |
e5a93224 | 690 | AliDebug(2,Form(" ** SCMY ** \n")); |
691 | for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i])); | |
1963b290 | 692 | |
cde6a23d | 693 | fIdRotm=0; |
694 | gMC->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC | |
1963b290 | 695 | ypos = +(parTRAP[3]+parTRAP[7])/2.; // |
e5a93224 | 696 | AliDebug(2,Form(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data())); |
cde6a23d | 697 | gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm, overLapFlagSCMY.Data()) ; |
1963b290 | 698 | // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z |
cde6a23d | 699 | AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ; |
1963b290 | 700 | // We may have problem with numeration due to rotation - 4-feb-05 |
cde6a23d | 701 | gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm, overLapFlagSCMY.Data()); |
1963b290 | 702 | |
703 | Info("Division2X2InScm0","Divide SCMY on x-axis %i\n", g->GetNPHIdiv()); | |
704 | dx1 = parSCM0[0]; | |
705 | dx2 = parSCM0[1]; | |
706 | dr1=TMath::Sqrt(dx1*dx1+dy1*dy1); | |
707 | dr2=TMath::Sqrt(dx2*dx2+dy2*dy2); | |
708 | ||
709 | parTRAP[0] = parSCM0[4]; // dz | |
710 | parTRAP[1] = TMath::ATan2((dr2-dr1)/2.,2.*dz)*TMath::RadToDeg(); // | |
711 | parTRAP[2] = 45.; // phi | |
712 | // bottom | |
713 | parTRAP[3] = parSCM0[2]/2.; // H1 | |
714 | parTRAP[4] = parSCM0[0]/2.; // BL1 | |
715 | parTRAP[5] = parTRAP[4]; // TL1 | |
716 | parTRAP[6] = 0.0; // ALP1 | |
717 | // top | |
718 | parTRAP[7] = parSCM0[3]/2.; // H2 | |
719 | parTRAP[8] = parSCM0[1]/2; // BL2 | |
720 | parTRAP[9] = parTRAP[8]; // TL2 | |
721 | parTRAP[10]= 0.0; // ALP2 | |
e5a93224 | 722 | AliDebug(2,Form(" ** SCMX ** \n")); |
723 | for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i])); | |
1963b290 | 724 | |
cde6a23d | 725 | fIdRotm=0; |
726 | gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); | |
1963b290 | 727 | xpos = (parTRAP[4]+parTRAP[8])/2.; |
e5a93224 | 728 | AliDebug(2,Form(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data())); |
cde6a23d | 729 | gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ; |
730 | // AliMatrix(fIdRotm, 90.0,270., 90.0, 0.0, 0.0,0.0); // x'=-y; y'=x; z'=z | |
731 | AliMatrix(fIdRotm, 90.0,90., 90.0, -180.0, 0.0,0.0); // x'=y; y'=-x; z'=z | |
732 | gMC->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ; | |
1963b290 | 733 | // PB: |
734 | if(n=="SCMX" && overLapFlagSCMY == "ONLY") { | |
735 | PbInTrapForTrd2(parTRAP, n); | |
736 | } | |
737 | } | |
738 | ||
739 | // 4-feb-05 by PAI | |
4d2e7dc7 | 740 | //______________________________________________________________________ |
741 | void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name) | |
cde6a23d | 742 | { |
4d2e7dc7 | 743 | // TRD2 cases |
744 | Double_t *dummy=0; | |
745 | TString pbShape("BOX"), pbtiChonly("ONLY"); | |
746 | if(name=="SCM0") { | |
747 | pbShape = "TRD2"; | |
748 | // pbtiChonly = "MANY"; | |
749 | } | |
750 | gMC->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0); | |
751 | ||
752 | int nr=0; | |
753 | Info("PbInTrapForTrd2"," Pb tiles inside %s: shape %s :pbtiChonly %s\n nrstart %i\n", | |
754 | name.Data(), pbShape.Data(), pbtiChonly.Data(), nr); | |
755 | AliEMCALGeometry * g = GetGeometry(); | |
756 | ||
757 | double par[5], parPB[5], parSC[5]; | |
758 | //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick()); | |
759 | double xpos = 0.0, ypos = 0.0; | |
760 | double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.; | |
761 | if(name == "SCMX") { // common trapezoid - 11 parameters | |
762 | double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]); | |
763 | double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // the same for y | |
764 | AliDebug(2,Form(" xCenterSCMX %8.5f : coef %8.7f \n", xCenterSCMX, coef)); | |
765 | ||
766 | par[2] = g->GetECPbRadThick()/2.; // z | |
767 | for(int iz=0; iz<g->GetNECLayers(); iz++){ | |
768 | par[0] = parTRAP[4] + coef*fSampleWidth*iz; | |
769 | par[1] = par[0]; | |
770 | xpos = ypos = par[0] - xCenterSCMX; | |
771 | //if(parTRAP[1] < 0.) xpos = -xpos; | |
772 | gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ; | |
773 | AliDebug(2,Form(" %2.2i xpos %8.5f zpos %6.3f par[0,1] %6.3f |", iz+1, xpos, zpos, par[0])); | |
774 | if(iz%2>0) AliDebug(2,Form("\n")); | |
775 | zpos += fSampleWidth; | |
776 | } | |
777 | AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef)); | |
778 | AliDebug(2,Form(" par[1] %9.5f par[2] %9.5f ypos %9.5f \n", par[1], par[2], ypos)); | |
779 | } else if(name == "SCM0") { // 1-mar-05 ; TRD2 - 5 parameters | |
780 | AliDebug(2,Form(" SCM0 par = ")); | |
781 | for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parTRAP[i])); | |
782 | AliDebug(2,Form("\n zpos %f \n",zpos)); | |
783 | ||
784 | double tanx = (parTRAP[1] - parTRAP[0]) / (2.*parTRAP[4]); // tanx = tany now | |
785 | double tany = (parTRAP[3] - parTRAP[2]) / (2.*parTRAP[4]), ztmp=0.; | |
786 | parPB[4] = g->GetECPbRadThick()/2.; | |
787 | parSC[2] = g->GetECScintThick()/2.; | |
788 | for(int iz=0; iz<g->GetNECLayers(); iz++){ | |
789 | ztmp = fSampleWidth*double(iz); | |
790 | parPB[0] = parTRAP[0] + tanx*ztmp; | |
791 | parPB[1] = parPB[0] + tanx*g->GetECPbRadThick(); | |
792 | parPB[2] = parTRAP[2] + tany*ztmp; | |
793 | parPB[3] = parPB[2] + tany*g->GetECPbRadThick(); | |
794 | gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ; | |
795 | AliDebug(2,Form("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos)); | |
796 | /* | |
797 | for(int i=0; i<5; i++) printf(" %9.5f ", parPB[i]); | |
798 | // individual SC tile | |
799 | parSC[0] = parPB[0]; | |
800 | parSC[1] = parPB[1]; | |
801 | gMC->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(), | |
802 | 0, pbtiChonly.Data(), parSC, 3) ; | |
803 | printf("\n SCTI zpos %6.3f | par = ", zpos+g->GetECScintThick()); | |
804 | for(int i=0; i<3; i++) printf(" %9.5f ", parPB[i]); | |
805 | */ | |
806 | zpos += fSampleWidth; | |
807 | } | |
808 | AliDebug(2,Form("\n")); | |
809 | } | |
810 | Info("PbInTrapForTrd2", "Ver. 0.03 : was tested."); | |
1963b290 | 811 | } |
812 | ||
813 | // 15-mar-05 | |
4d2e7dc7 | 814 | //______________________________________________________________________ |
815 | void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parPBMO[5]) | |
1963b290 | 816 | { |
4d2e7dc7 | 817 | // Pb inside Trd2 |
818 | Info("PbmoInTrd2"," started : geometry %s ", g->GetName()); | |
819 | double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); | |
820 | AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness)); | |
821 | for(int i=0; i<4; i++) { | |
822 | parPBMO[i] = emodPar[i] - wallThickness; | |
823 | AliDebug(2,Form(" %i parPBMO %7.3f emodPar %7.3f : dif %7.3f \n", | |
824 | i, parPBMO[i],emodPar[i], parPBMO[i]-emodPar[i])); | |
825 | } | |
826 | parPBMO[4] = emodPar[4]; | |
827 | gMC->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5); | |
828 | gMC->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ; | |
829 | // Division | |
830 | if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) { | |
831 | Division2X2InPbmo(g, parPBMO); | |
832 | AliDebug(2,Form(" PBMO, division 2X2 | geometry |%s|\n", g->GetName())); | |
833 | } else { | |
834 | AliDebug(2,Form(" no division PBMO in this geometry |%s|\n", g->GetName())); | |
835 | assert(0); | |
836 | } | |
1963b290 | 837 | } |
838 | ||
4d2e7dc7 | 839 | //______________________________________________________________________ |
cde6a23d | 840 | void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t parPBMO[5]) |
1963b290 | 841 | { |
cde6a23d | 842 | // Division 2X2 |
1963b290 | 843 | Info("Division2X2InPbmo"," started : geometry %s ", g->GetName()); |
844 | //Double_t *dummy=0; | |
cde6a23d | 845 | // gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0); |
1963b290 | 846 | |
847 | double parSC[3]; | |
cde6a23d | 848 | //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick()); |
1963b290 | 849 | double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;; |
850 | double tanx = (parPBMO[1] - parPBMO[0]) / (2.*parPBMO[4]); // tanx = tany now | |
851 | double tany = (parPBMO[3] - parPBMO[2]) / (2.*parPBMO[4]); | |
51e4198e | 852 | const Int_t buffersize = 10; |
853 | char name[buffersize], named[buffersize], named2[buffersize]; | |
1963b290 | 854 | |
e5a93224 | 855 | AliDebug(2,Form(" PBMO par = ")); |
856 | for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parPBMO[i])); | |
857 | AliDebug(2,Form("\n")); | |
1963b290 | 858 | |
859 | parSC[2] = g->GetECScintThick()/2.; | |
cde6a23d | 860 | zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick() + g->GetECScintThick()/2.; |
e5a93224 | 861 | AliDebug(2,Form(" parSC[2] %9.5f \n", parSC[2])); |
1963b290 | 862 | for(int iz=0; iz<g->GetNECLayers(); iz++){ |
cde6a23d | 863 | ztmp = g->GetECPbRadThick() + fSampleWidth*double(iz); // Z for previous PB |
1963b290 | 864 | parSC[0] = parPBMO[0] + tanx*ztmp; |
865 | parSC[1] = parPBMO[2] + tany*ztmp; | |
866 | ||
51e4198e | 867 | snprintf(name,buffersize,"SC%2.2i", iz+1); |
cde6a23d | 868 | gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3); |
1963b290 | 869 | gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ; |
e5a93224 | 870 | AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ", |
871 | name, zpos, parSC[0], parSC[1])); | |
1963b290 | 872 | |
51e4198e | 873 | snprintf(named,buffersize,"SY%2.2i", iz+1); |
1963b290 | 874 | printf(" %s -> ", named); |
875 | gMC->Gsdvn(named,name, 2, 2); | |
876 | ||
51e4198e | 877 | snprintf(named2,buffersize,"SX%2.2i", iz+1); |
1963b290 | 878 | printf(" %s \n", named2); |
879 | gMC->Gsdvn(named2,named, 2, 1); | |
880 | ||
cde6a23d | 881 | zpos += fSampleWidth; |
1963b290 | 882 | } |
883 | } | |
c01485dd | 884 | |
4d2e7dc7 | 885 | //______________________________________________________________________ |
21cf2b24 | 886 | AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta) |
cde6a23d | 887 | { |
888 | // 28-oct-05 | |
c01485dd | 889 | AliEMCALShishKebabTrd1Module* trd1=0; |
890 | if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) { | |
891 | trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta); | |
892 | } | |
893 | return trd1; | |
894 | } | |
5f66b6c6 | 895 | |
896 | //_____________________________________________________________________________ | |
897 | void AliEMCALv0::AddAlignableVolumes() const | |
1ae500a2 | 898 | { |
d804d556 | 899 | //Add volumes which are alignable (?) |
1ae500a2 | 900 | TString ntmp(GetTitle()); // name of EMCAL geometry |
901 | ||
902 | if(ntmp.Contains("WSUC")) { | |
903 | AddAlignableVolumesInWSUC(); // WSUC case | |
904 | } else { | |
905 | AddAlignableVolumesInALICE(); // ALICE case | |
906 | } | |
907 | } | |
908 | ||
4d2e7dc7 | 909 | //______________________________________________________________________ |
1ae500a2 | 910 | void AliEMCALv0::AddAlignableVolumesInALICE() const |
5f66b6c6 | 911 | { |
912 | // | |
913 | // Create entries for alignable volumes associating the symbolic volume | |
914 | // name with the corresponding volume path. Needs to be synchronized with | |
915 | // eventual changes in the geometry. | |
916 | // | |
917 | ||
9aa6a5f6 | 918 | Float_t * pars = GetGeometry()->GetSuperModulesPars(); |
919 | double rpos = (GetGeometry()->GetEnvelop(0) + GetGeometry()->GetEnvelop(1))/2.; | |
920 | double phi, phiRad, xpos, ypos, zpos; | |
921 | ||
200e17a4 | 922 | AliGeomManager::ELayerID idEMCAL = AliGeomManager::kEMCAL; |
923 | Int_t modUID, modnum = 0; | |
5f66b6c6 | 924 | TString volpath, symname; |
925 | ||
85653ebc | 926 | Int_t nSMod = GetGeometry()->GetNumberOfSuperModules(); |
9aa6a5f6 | 927 | for (Int_t smodnum=0; smodnum < nSMod; smodnum++) { |
200e17a4 | 928 | modUID = AliGeomManager::LayerToVolUID(idEMCAL,modnum++); |
9aa6a5f6 | 929 | volpath = "ALIC_1/XEN1_1/SMOD_"; |
1082109f | 930 | volpath += (smodnum+1); |
9aa6a5f6 | 931 | symname = "EMCAL/FullSupermodule"; |
932 | symname += (smodnum+1); | |
933 | ||
934 | if(GetGeometry()->GetKey110DEG() && smodnum>=10) { | |
935 | volpath = "ALIC_1/XEN1_1/SM10_"; | |
936 | volpath += (smodnum-10+1); | |
937 | symname = "EMCAL/HalfSupermodule"; | |
938 | symname += (smodnum-10+1); | |
939 | } | |
940 | ||
200e17a4 | 941 | if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID)) |
9aa6a5f6 | 942 | AliFatal("AliEMCALv0::Unable to set alignable entry!!"); |
943 | ||
944 | // Creates the Tracking to Local transformation matrix for EMCAL | |
945 | // modules | |
200e17a4 | 946 | TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID) ; |
9aa6a5f6 | 947 | |
85653ebc | 948 | phiRad = GetGeometry()->GetPhiCenterOfSM(smodnum); //comes in radians, not degrees |
949 | phi = phiRad*180./TMath::Pi(); //need degrees for rot. matrix | |
9aa6a5f6 | 950 | xpos = rpos * TMath::Cos(phiRad); |
951 | ypos = rpos * TMath::Sin(phiRad); | |
952 | zpos = pars[2]; | |
953 | if(GetGeometry()->GetKey110DEG() && smodnum >= 10) { | |
954 | xpos += (pars[1]/2. * TMath::Sin(phiRad)); | |
955 | ypos -= (pars[1]/2. * TMath::Cos(phiRad)); | |
956 | } | |
957 | ||
958 | TGeoHMatrix *matTtoL; | |
200e17a4 | 959 | TGeoHMatrix *globMatrix = alignableEntry->GetGlobalOrig(); |
9aa6a5f6 | 960 | |
961 | if(smodnum%2 == 0) { | |
962 | // pozitive z | |
963 | TGeoTranslation geoTran0(xpos,ypos, zpos); | |
964 | TGeoRotation geoRot0("geoRot0", 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0); | |
965 | TGeoCombiTrans mat0(geoTran0, geoRot0); | |
966 | matTtoL = new TGeoHMatrix(mat0); | |
967 | ||
968 | matTtoL->MultiplyLeft(&(globMatrix->Inverse())); | |
969 | alignableEntry->SetMatrix(matTtoL); | |
970 | ||
971 | } else { | |
972 | // negative z | |
973 | double phiy = 90. + phi + 180.; | |
974 | if(phiy>=360.) phiy -= 360.; | |
975 | TGeoTranslation geoTran1(xpos,ypos,-zpos); | |
976 | TGeoRotation geoRot1("geoRot1", 90.0, phi, 90.0, phiy, 180.0, 0.0); | |
977 | TGeoCombiTrans mat1(geoTran1, geoRot1); | |
978 | matTtoL = new TGeoHMatrix(mat1); | |
979 | ||
980 | matTtoL->MultiplyLeft(&(globMatrix->Inverse())); | |
981 | alignableEntry->SetMatrix(matTtoL); | |
5f66b6c6 | 982 | |
5f66b6c6 | 983 | } |
9aa6a5f6 | 984 | |
5f66b6c6 | 985 | } |
986 | ||
987 | } | |
988 | ||
4d2e7dc7 | 989 | //______________________________________________________________________ |
1ae500a2 | 990 | void AliEMCALv0::AddAlignableVolumesInWSUC() const |
991 | { | |
992 | // | |
993 | // Create entries for alignable volumes associating the symbolic volume | |
994 | // name with the corresponding volume path. Needs to be synchronized with | |
995 | // eventual changes in the geometry. | |
996 | // | |
997 | ||
998 | TString vpstr1 = "WSUC_1/XEN1_1/SMOD_"; | |
999 | TString snstr1 = "EMCAL/CosmicTestSupermodule"; | |
1000 | TString volpath, symname; | |
1001 | ||
1002 | // #SM is just one | |
1003 | for (Int_t smodnum=0; smodnum < 1; smodnum++) { | |
1004 | symname = snstr1; | |
1005 | symname += (smodnum+1); | |
1006 | volpath = vpstr1; | |
1007 | volpath += (smodnum+1); | |
1008 | if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data())) | |
1009 | AliFatal("Unable to set alignable entry!!"); | |
1010 | } | |
1011 | } |