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