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