]>
Commit | Line | Data |
---|---|---|
2012850d | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
2012850d | 15 | /* $Id$ */ |
16 | ||
17 | //_________________________________________________________________________ | |
18 | // Implementation version v0 of EMCAL Manager class | |
19 | // An object of this class does not produce hits nor digits | |
20 | // It is the one to use if you do not want to produce outputs in TREEH or TREED | |
ffa6d63b | 21 | // This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx |
2012850d | 22 | //*-- Author: Yves Schutz (SUBATECH) |
b13bbe81 | 23 | //*-- and : Sahal Yacoob (LBL / UCT) |
d87bd045 | 24 | // : Aleksei Pavlinov (WSU) SHASHLYK |
2012850d | 25 | |
26 | // --- ROOT system --- | |
7dd95fbf | 27 | #include <cassert> |
a1469a24 | 28 | |
cde6a23d | 29 | #include <TNode.h> |
30 | #include <TBRIK.h> | |
31 | #include <TTRD1.h> | |
cde6a23d | 32 | #include <TTRAP.h> |
33 | #include <TPGON.h> | |
34 | #include <TTUBS.h> | |
35 | #include <TGeometry.h> | |
9aa6a5f6 | 36 | #include <TGeoPhysicalNode.h> |
37 | #include <TGeoManager.h> | |
268f57b1 | 38 | #include <TGeoMatrix.h> |
cde6a23d | 39 | #include <TVirtualMC.h> |
40 | #include <TArrayI.h> | |
41 | #include <TROOT.h> | |
42 | #include <TList.h> | |
43 | #include <TVector2.h> | |
21e7df44 | 44 | #include <cassert> |
1963b290 | 45 | |
46 | #include "AliEMCALShishKebabModule.h" | |
47 | #include "AliEMCALShishKebabTrd1Module.h" | |
a1469a24 | 48 | |
2012850d | 49 | // --- Standard library --- |
50 | ||
d64c959b | 51 | //#include <stdio.h> |
2012850d | 52 | |
53 | // --- AliRoot header files --- | |
54 | ||
55 | #include "AliEMCALv0.h" | |
56 | #include "AliEMCALGeometry.h" | |
57 | #include "AliRun.h" | |
4951e003 | 58 | #include "AliLog.h" |
200e17a4 | 59 | #include "AliGeomManager.h" |
2012850d | 60 | |
61 | ClassImp(AliEMCALv0) | |
62 | ||
cde6a23d | 63 | // EMCAL material |
64 | enum | |
65 | { | |
66 | kIdAIR = 1599, | |
67 | kIdPB = 1600, | |
68 | kIdSC = 1601, | |
69 | kIdSTEEL = 1603 | |
70 | }; | |
18a21c7c | 71 | |
72 | ||
73 | //______________________________________________________________________ | |
74 | AliEMCALv0::AliEMCALv0() | |
75 | : AliEMCAL(), | |
76 | fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0), | |
77 | fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0) | |
78 | { | |
79 | //default ctor | |
80 | } | |
81 | ||
b13bbe81 | 82 | //______________________________________________________________________ |
18a21c7c | 83 | AliEMCALv0::AliEMCALv0(const char *name, const char *title) |
84 | : AliEMCAL(name,title), | |
85 | fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0), | |
86 | fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0) | |
05a92d59 | 87 | { |
88 | // ctor : title is used to identify the layout | |
d25f2c54 | 89 | // Apr 25, 2006 |
90 | // Nov 22, 2006 - case of 1X1 | |
e5a93224 | 91 | TString ntmp(GetTitle()); |
92 | ntmp.ToUpper(); | |
93 | if(ntmp == "TRD1") { // TRD1 is alias for SHISH_77_TRD1_2X2_FINAL_110DEG NL=69 | |
94 | ntmp = "SHISH_77_TRD1_2X2_FINAL_110DEG NL=69"; | |
95 | SetTitle(ntmp.Data()); | |
96 | } | |
97 | ||
e52475ed | 98 | AliEMCALGeometry *geom = GetGeometry() ; |
99 | //geom->CreateListOfTrd1Modules(); | |
100 | fShishKebabModules = geom->GetShishKebabTrd1Modules(); | |
2012850d | 101 | } |
a1469a24 | 102 | |
b13bbe81 | 103 | //______________________________________________________________________ |
05a92d59 | 104 | void AliEMCALv0::BuildGeometry() |
105 | { | |
b13bbe81 | 106 | // Display Geometry for display.C |
2012850d | 107 | |
b13bbe81 | 108 | const Int_t kColorArm1 = kBlue ; |
91e9918b | 109 | |
e52475ed | 110 | AliEMCALGeometry * geom = GetGeometry(); |
111 | ||
1963b290 | 112 | TString gn(geom->GetName()); |
113 | gn.ToUpper(); | |
a1469a24 | 114 | |
05a92d59 | 115 | // Define the shape of the Calorimeter |
1963b290 | 116 | TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes |
117 | TNode * envelopNode = 0; | |
118 | char *envn = "Envelop1"; | |
6f377f0c | 119 | if(!gn.Contains("SHISH")){ |
1963b290 | 120 | new TTUBS(envn, "Tubs that contains arm 1", "void", |
121 | geom->GetEnvelop(0) -10, // rmin | |
122 | geom->GetEnvelop(1) +40 ,// rmax | |
05a92d59 | 123 | geom->GetEnvelop(2)/2.0, // half length in Z |
fdebddeb | 124 | geom->GetArm1PhiMin(), // minimum phi angle |
125 | geom->GetArm1PhiMax() // maximum phi angle | |
b13bbe81 | 126 | ); |
1963b290 | 127 | top->cd(); |
128 | envelopNode = new TNode(envn, "Arm1 Envelop", "Envelop1", 0., 0., 0., "") ; | |
129 | } else { | |
130 | if(gn.Contains("WSUC")) { | |
131 | envelopNode = BuildGeometryOfWSUC(); | |
4d2e7dc7 | 132 | } else { // Shish-kebab now for compact and TRD1 cases (ALIC) |
1963b290 | 133 | envn="Envelop2"; |
134 | TPGON *pgon = new TPGON(envn, "PGON that contains arm 1", "void", | |
135 | geom->GetArm1PhiMin(),geom->GetArm1PhiMax()-geom->GetArm1PhiMin(),geom->GetNPhiSuperModule(), 2); | |
136 | // define section | |
4f2691c9 | 137 | if (fEnvelop1.GetSize()<8) { |
138 | fEnvelop1.Set(10); | |
139 | fEnvelop1[0] = geom->GetArm1PhiMin(); // minimum phi angle | |
140 | fEnvelop1[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi | |
141 | fEnvelop1[2] = geom->GetNPhi(); // number of sections in phi | |
142 | fEnvelop1[3] = 2; // 2 z coordinates | |
143 | fEnvelop1[4] = -350.; | |
144 | fEnvelop1[5] = geom->GetEnvelop(0) ; // rmin at z1 | |
145 | fEnvelop1[6] = geom->GetEnvelop(1) ; // rmax at z1 | |
146 | fEnvelop1[7] = 350.; | |
147 | fEnvelop1[8] = fEnvelop1[5] ; // radii are the same. | |
148 | fEnvelop1[9] = fEnvelop1[6] ; // radii are the same. | |
149 | ||
150 | if(gn.Contains("SHISH")) | |
151 | fEnvelop1[2] = geom->GetNPhiSuperModule(); | |
152 | } | |
cde6a23d | 153 | pgon->DefineSection(0, fEnvelop1[4], fEnvelop1[5], fEnvelop1[6]); |
154 | pgon->DefineSection(1, fEnvelop1[7], fEnvelop1[5], fEnvelop1[6]); | |
1963b290 | 155 | top->cd(); |
156 | envelopNode = new TNode(envn, "Arm1 Envelop2", envn, 0., 0., 0., "") ; | |
157 | } | |
158 | } | |
159 | ||
160 | envelopNode->SetLineColor(kColorArm1) ; | |
161 | fNodes->Add(envelopNode); | |
162 | } | |
163 | ||
4d2e7dc7 | 164 | //______________________________________________________________________ |
1963b290 | 165 | TNode *AliEMCALv0::BuildGeometryOfWSUC() |
cde6a23d | 166 | { |
167 | // June 8, 2005; see directory geant3/TGeant3/G3toRoot.cxx | |
1963b290 | 168 | // enum EColor { kWhite, kBlack, kRed, kGreen, kBlue, kYellow, kMagenta, kCyan } - see $ROOTSYS/include/Gtypes.h |
169 | AliEMCALGeometry * g = GetGeometry(); | |
170 | TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes | |
171 | top->cd(); | |
172 | ||
173 | TNode *envelopNode = 0; | |
174 | char *name = ""; | |
175 | /* | |
176 | name = "WSUC"; | |
cde6a23d | 177 | new TBRIK(name, "WSUC(XEN1 in Geant)","void",fEnvelop1[0],fEnvelop1[1],fEnvelop1[2]); |
1963b290 | 178 | envelopNode = new TNode(name, "envelope for WSUC", name, 0., 0., 0., ""); |
179 | envelopNode->SetVisibility(0); | |
180 | */ | |
181 | ||
182 | TNode *emod=0, *scmx=0; | |
183 | name = "SMOD"; // super module | |
cde6a23d | 184 | new TBRIK(name, "SMOD(SMOD in Geant)","void", fSmodPar0,fSmodPar1,fSmodPar2); |
1963b290 | 185 | if(envelopNode) envelopNode->cd(); |
186 | TNode *smod = new TNode(name, "SMOD", name, 0., 0., 0., ""); | |
187 | smod->SetLineColor(kBlue) ; | |
188 | if(envelopNode==0) envelopNode = smod; | |
189 | ||
190 | name = "EMOD"; // see CreateEMOD | |
cde6a23d | 191 | TTRD1 *emodTrd1 = new TTRD1(name, "EMOD(EMOD in Geant)","void", float(fParEMOD[0]), |
192 | float(fParEMOD[1]),float(fParEMOD[2]),float(fParEMOD[3])); | |
1963b290 | 193 | |
194 | // SCMX = EMOD/4 for simplicity of drawing | |
195 | name = "SCMX"; | |
196 | Float_t dz=0.,theta=0.,phi=0.,h1=0.,bl1=0.,tl1=0.,alpha1=0.,h2=0.,bl2=0.,tl2=0.,alpha2=0.; | |
cde6a23d | 197 | h1 = emodTrd1->GetDy()/2.; |
198 | bl1 = emodTrd1->GetDx()/2.; | |
1963b290 | 199 | tl1 = bl1; |
200 | alpha1 = 0.; | |
cde6a23d | 201 | h2 = emodTrd1->GetDy()/2.; |
202 | bl2 = emodTrd1->GetDx2()/2.; | |
1963b290 | 203 | tl2 = bl2; |
204 | alpha2 = 0.; | |
205 | ||
cde6a23d | 206 | dz = emodTrd1->GetDz(); |
1963b290 | 207 | double dr = TMath::Sqrt((h2-h1)*(h2-h1)+(bl2-bl1)*(bl2-bl1)); |
208 | theta = TMath::ATan2(dr,2.*dz) * TMath::RadToDeg(); | |
209 | phi = 180.; | |
210 | ||
cde6a23d | 211 | TTRAP *scmxTrap = new TTRAP(name, "SCMX(SCMX as in Geant)","void", |
1963b290 | 212 | dz,theta,phi, h1,bl1,tl1,alpha1, h2,bl2,tl2,alpha2); |
cde6a23d | 213 | // scmxTrap->Dump(); |
214 | Float_t xShiftSCMX = (emodTrd1->GetDx() + emodTrd1->GetDx2())/4.; | |
215 | Float_t yShiftSCMX = emodTrd1->GetDy()/2.; | |
1963b290 | 216 | printf(" xShiftSCMX %7.4f yShiftSCMX %7.4f \n",xShiftSCMX,yShiftSCMX); |
217 | ||
218 | name = "EMOD"; // see CreateEMOD | |
219 | smod->cd(); | |
220 | ||
221 | AliEMCALShishKebabTrd1Module *mod=0; | |
222 | Double_t angle=90., xpos=0.,ypos=0.,zpos=0., xposSCMX=0.,yposSCMX=0.,zposSCMX=0.; | |
223 | char rtmn[100], rtmt[100]; | |
224 | TRotMatrix *rtm=0, *rtmSCMX=0; | |
225 | int numEmod=0; | |
226 | for(int iz=0; iz<g->GetNZ(); iz++) { | |
227 | mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz); | |
cde6a23d | 228 | zpos = mod->GetPosZ() - fSmodPar2; |
229 | ypos = mod->GetPosXfromR() - fSmodPar1; | |
1963b290 | 230 | |
231 | angle = mod->GetThetaInDegree(); | |
232 | sprintf(rtmn,"rmEmod%5.1f",angle); | |
233 | sprintf(rtmt,"rotation matrix for EMOD, iz=%i, angle = %6.3f",iz, angle); | |
234 | if(iz==0) rtm = new TRotMatrix(rtmn, rtmt,0.,0., 90.,0., 90.,90.); // z'(x); y'(y); x'(z) | |
235 | else rtm = new TRotMatrix(rtmn, rtmt,90.-angle,270., 90.0,0.0, angle,90.); | |
a1469a24 | 236 | |
1963b290 | 237 | TGeometry *tg = gAlice->GetGeometry(); |
238 | for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi | |
239 | xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.; | |
240 | sprintf(rtmt,"EMOD, iz %i, ix %i, angle %6.3f",iz,ix, angle); | |
241 | TString namNode=name; | |
242 | namNode += numEmod++; | |
243 | smod->cd(); | |
cde6a23d | 244 | emod = new TNode(namNode.Data(), rtmt, (TShape*)emodTrd1, xpos,ypos,zpos,rtm); |
1963b290 | 245 | // emod->SetLineColor(kGreen) ; |
246 | emod->SetVisibility(0); // SCMX will bi visible | |
cde6a23d | 247 | if(scmxTrap) { // 4(2x2) sensetive volume inside EMOD |
1963b290 | 248 | emod->cd(); |
249 | zposSCMX = 0.; | |
250 | for(int jy=0; jy<2; jy++){ // division on y | |
251 | yposSCMX = yShiftSCMX *(2*jy - 1); | |
252 | for(int jx=0; jx<2; jx++){ // division on x | |
253 | Double_t theta1=90.,phi1=0., theta2=90.,phi2=90., theta3=0.,phi3=0 ; | |
254 | xposSCMX = xShiftSCMX *(2*jx - 1); | |
255 | namNode = "SCMX"; | |
256 | namNode += jy; | |
257 | namNode += jx; | |
258 | sprintf(rtmn,"rm%s",namNode.Data()); | |
259 | sprintf(rtmt,"rotation matrix for %s inside EMOD",namNode.Data()); | |
260 | rtmSCMX = tg->GetRotMatrix(rtmn); | |
261 | if(jx == 1) { | |
262 | phi1 = 180.; // x' = -x | |
263 | phi2 = 270.; // y' = -y | |
264 | } | |
265 | if(rtmSCMX == 0) rtmSCMX = new TRotMatrix(rtmn,rtmt, theta1,phi1, theta2,phi2, theta3,phi3); | |
266 | sprintf(rtmt,"%s inside %s", namNode.Data(), emod->GetName()); | |
cde6a23d | 267 | scmx = new TNode(namNode.Data(), rtmt, (TShape*)scmxTrap, xposSCMX,yposSCMX,zposSCMX,rtmSCMX); |
1963b290 | 268 | scmx->SetLineColor(kMagenta); |
269 | } | |
270 | } | |
271 | } | |
272 | } | |
273 | } | |
274 | // emod->Draw(); // for testing | |
275 | ||
276 | return envelopNode; | |
2012850d | 277 | } |
a1469a24 | 278 | |
b13bbe81 | 279 | //______________________________________________________________________ |
05a92d59 | 280 | void AliEMCALv0::CreateGeometry() |
281 | { | |
f590bb15 | 282 | // Create the EMCAL geometry for Geant |
283 | // Geometry of a tower | |
284 | //|-----------------------------------------------------| XEN1 | |
285 | //| | | | | |
286 | //| | Al thickness = GetAlFrontThickness() | | | |
287 | //| | | | | |
288 | //| | | | | |
289 | //| | | | | |
290 | //| ------------------------------------------------- | | |
291 | //| | Air Gap = GetGap2Active() | | | |
292 | //| | | | | |
293 | //| ------------------------------------------------- | | |
ca148d5b | 294 | //| | XU1 : XPST (ECAL e = GetECScintThick() ) | | |
f590bb15 | 295 | //| ------------------------------------------------- | |
ca148d5b | 296 | //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | | |
f590bb15 | 297 | //| ------------------------------------------------- | |
ca148d5b | 298 | //| | XU1 : XPST (ECAL e = GetECScintThick() | | |
f590bb15 | 299 | //| ------------------------------------------------- | |
ca148d5b | 300 | //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | | |
f590bb15 | 301 | //| ------------------------------------------------- | |
fdebddeb | 302 | //| etc ..... GetNECLayers() - 1 times | |
ca148d5b | 303 | //| ------------------------------------------------- | |
fdebddeb | 304 | //| | XUNLayer : XPST (ECAL e = GetECScintThick() | | |
ca148d5b | 305 | //| ------------------------------------------------- | |
fdebddeb | 306 | |
05a92d59 | 307 | AliEMCALGeometry * geom = GetGeometry() ; |
1963b290 | 308 | TString gn(geom->GetName()); |
309 | gn.ToUpper(); | |
a1469a24 | 310 | |
05a92d59 | 311 | if(!(geom->IsInitialized())){ |
a1469a24 | 312 | Error("CreateGeometry","EMCAL Geometry class has not been set up."); |
b13bbe81 | 313 | } // end if |
a1469a24 | 314 | |
b13bbe81 | 315 | // Get pointer to the array containing media indices |
cde6a23d | 316 | fIdTmedArr = fIdtmed->GetArray() - 1599 ; |
e13bd4f0 | 317 | |
cde6a23d | 318 | fIdRotm = 1; |
1963b290 | 319 | // gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule |
cde6a23d | 320 | AliMatrix(fIdRotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ; |
09641ef5 | 321 | |
c13b5a7c | 322 | // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1 |
323 | ||
324 | Float_t envelopA[10]; | |
6f377f0c | 325 | if(gn.Contains("TRD1") && gn.Contains("WSUC") ) { // TRD1 for WSUC facility |
1963b290 | 326 | // 17-may-05 - just BOX |
327 | envelopA[0] = 26; | |
328 | envelopA[1] = 15; | |
329 | envelopA[2] = 30; | |
cde6a23d | 330 | gMC->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ; |
331 | fEnvelop1.Set(3); | |
332 | for(int i=0; i<3; i++) fEnvelop1[i] = envelopA[i]; // 23-may-05 | |
1963b290 | 333 | // Position the EMCAL Mother Volume (XEN1) in WSUC |
cde6a23d | 334 | gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ; |
1963b290 | 335 | } else { |
336 | envelopA[0] = geom->GetArm1PhiMin(); // minimum phi angle | |
337 | envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi | |
338 | envelopA[2] = geom->GetNPhi(); // number of sections in phi | |
339 | envelopA[3] = 2; // 2 z coordinates | |
3dd39418 | 340 | // envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1), |
341 | //geom->GetArm1EtaMin()); // z coordinate 1 | |
342 | envelopA[4] = -350.; // AM 30/5/2006 | |
343 | ||
fdebddeb | 344 | //add some padding for mother volume |
1963b290 | 345 | envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1 |
346 | envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1 | |
3dd39418 | 347 | // envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1), |
348 | // geom->GetArm1EtaMax()); // z coordinate 2 | |
349 | envelopA[7] = 350.; // AM 30/5/2006 | |
350 | ||
1963b290 | 351 | envelopA[8] = envelopA[5] ; // radii are the same. |
352 | envelopA[9] = envelopA[6] ; // radii are the same. | |
c13b5a7c | 353 | |
1963b290 | 354 | if(gn.Contains("SHISH")) envelopA[2] = geom->GetNPhiSuperModule(); |
09641ef5 | 355 | |
cde6a23d | 356 | gMC->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ; // Polygone filled with air |
357 | fEnvelop1.Set(10, envelopA); | |
1963b290 | 358 | if (gDebug==2) { |
359 | printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]); | |
360 | printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]); | |
361 | } | |
c13b5a7c | 362 | // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC) |
cde6a23d | 363 | gMC->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ; |
1963b290 | 364 | } |
365 | ||
366 | if(gn.Contains("SHISH")){ | |
937d0661 | 367 | // COMPACT, TRD1 |
b42d4197 | 368 | AliDebug(2,Form("Shish-Kebab geometry : %s", GetTitle())); |
1963b290 | 369 | CreateShishKebabGeometry(); |
fdebddeb | 370 | } |
2012850d | 371 | } |
a1469a24 | 372 | |
b13bbe81 | 373 | //______________________________________________________________________ |
05a92d59 | 374 | void AliEMCALv0::Init(void) |
375 | { | |
b13bbe81 | 376 | // Just prints an information message |
aa61eaea | 377 | AliEMCAL::Init(); |
4951e003 | 378 | if(AliLog::GetGlobalDebugLevel()>0) { |
9859bfc0 | 379 | TString message("\n") ; |
c27ad3fb | 380 | message += "*****************************************\n" ; |
05a92d59 | 381 | |
b13bbe81 | 382 | // Here the EMCAL initialisation code (if any!) |
9859bfc0 | 383 | |
05a92d59 | 384 | AliEMCALGeometry * geom = GetGeometry() ; |
9859bfc0 | 385 | |
386 | if (geom!=0) { | |
387 | message += "AliEMCAL " ; | |
388 | message += Version() ; | |
c27ad3fb | 389 | message += "EMCAL geometry initialized for " ; |
9859bfc0 | 390 | message += geom->GetName() ; |
391 | } | |
392 | else { | |
393 | message += "AliEMCAL " ; | |
394 | message += Version() ; | |
395 | message += "EMCAL geometry initialization failed !" ; | |
05a92d59 | 396 | } |
c27ad3fb | 397 | message += "\n*****************************************" ; |
fdebddeb | 398 | printf(message.Data() ) ; |
9859bfc0 | 399 | } |
2012850d | 400 | } |
1963b290 | 401 | |
402 | // 24-aug-04 by PAI | |
4d2e7dc7 | 403 | //______________________________________________________________________ |
1963b290 | 404 | void AliEMCALv0::CreateShishKebabGeometry() |
cde6a23d | 405 | { |
937d0661 | 406 | // TRD1 |
1963b290 | 407 | AliEMCALGeometry * g = GetGeometry(); |
408 | TString gn(g->GetName()); gn.ToUpper(); | |
cde6a23d | 409 | // see AliModule::fFIdTmedArr |
410 | // fIdTmedArr = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials() | |
411 | // int kIdAIR=1599, kIdPB = 1600, kIdSC = 1601, kIdSTEEL = 1603; | |
1963b290 | 412 | // idAL = 1602; |
413 | Double_t par[10], xpos=0., ypos=0., zpos=0.; | |
414 | ||
e52475ed | 415 | CreateSmod(g->GetNameOfEMCALEnvelope()); |
1963b290 | 416 | |
d87bd045 | 417 | CreateEmod("SMOD","EMOD"); // 18-may-05 |
418 | ||
1d46d1f6 | 419 | if(g->GetKey110DEG()) CreateEmod("SM10","EMOD"); // Nov 1,2006 |
1963b290 | 420 | |
421 | // Sensitive SC (2x2 tiles) | |
1d46d1f6 | 422 | double parSCM0[5]={0,0,0,0}, *dummy = 0, parTRAP[11]; |
4d2e7dc7 | 423 | Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(); |
1963b290 | 424 | if(!gn.Contains("TRD")) { // standard module |
425 | par[0] = (g->GetECPbRadThick()+g->GetECScintThick())*g->GetNECLayers()/2.; | |
426 | par[1] = par[2] = g->GetPhiTileSize(); // Symetric case | |
cde6a23d | 427 | gMC->Gsvolu("SCM0", "BOX", fIdTmedArr[kIdSC], par, 3); // 2x2 tiles |
1963b290 | 428 | gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ; |
429 | // Division to tile size | |
430 | gMC->Gsdvn("SCM1","SCM0", g->GetNPHIdiv(), 2); // y-axis | |
431 | gMC->Gsdvn("SCM2","SCM1", g->GetNETAdiv(), 3); // z-axis | |
432 | // put LED to the SCM2 | |
433 | par[0] = g->GetECPbRadThick()/2.; | |
434 | par[1] = par[2] = g->GetPhiTileSize()/2.; // Symetric case | |
cde6a23d | 435 | gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], par, 3); |
1963b290 | 436 | |
437 | printf(" Pb tiles \n"); | |
438 | int nr=0; | |
439 | ypos = zpos = 0.0; | |
cde6a23d | 440 | xpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.; |
1963b290 | 441 | for(int ix=0; ix<g->GetNECLayers(); ix++){ |
442 | gMC->Gspos("PBTI", ++nr, "SCM2", xpos, ypos, zpos, 0, "ONLY") ; | |
443 | // printf(" %i xpos %f \n", ix+1, xpos); | |
cde6a23d | 444 | xpos += fSampleWidth; |
1963b290 | 445 | } |
446 | printf(" Number of Pb tiles in SCM2 %i \n", nr); | |
447 | } else if(gn.Contains("TRD1")) { // TRD1 - 30-sep-04 | |
937d0661 | 448 | // double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); // Need check |
449 | double wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() - g->GetPhiTileSize(); | |
450 | for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness; | |
451 | parSCM0[3] = fParEMOD[3]; | |
452 | gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4); | |
453 | gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ; | |
4d2e7dc7 | 454 | |
1963b290 | 455 | if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) { |
456 | // Division to tile size - 1-oct-04 | |
e5a93224 | 457 | AliDebug(2,Form(" Divide SCM0 on y-axis %i\n", g->GetNETAdiv())); |
1963b290 | 458 | gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis |
459 | // Trapesoid 2x2 | |
460 | parTRAP[0] = parSCM0[3]; // dz | |
461 | parTRAP[1] = TMath::ATan2((parSCM0[1]-parSCM0[0])/2.,2.*parSCM0[3])*180./TMath::Pi(); // theta | |
462 | parTRAP[2] = 0.; // phi | |
463 | // bottom | |
464 | parTRAP[3] = parSCM0[2]/2.; // H1 | |
465 | parTRAP[4] = parSCM0[0]/2.; // BL1 | |
466 | parTRAP[5] = parTRAP[4]; // TL1 | |
467 | parTRAP[6] = 0.0; // ALP1 | |
468 | // top | |
469 | parTRAP[7] = parSCM0[2]/2.; // H2 | |
470 | parTRAP[8] = parSCM0[1]/2.; // BL2 | |
471 | parTRAP[9] = parTRAP[8]; // TL2 | |
472 | parTRAP[10]= 0.0; // ALP2 | |
e5a93224 | 473 | AliDebug(2,Form(" ** TRAP ** \n")); |
d434833b | 474 | for(int i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i])); |
1963b290 | 475 | |
cde6a23d | 476 | gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); |
1963b290 | 477 | xpos = +(parSCM0[1]+parSCM0[0])/4.; |
478 | gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ; | |
479 | ||
480 | // Using rotation because SCMX should be the same due to Pb tiles | |
481 | xpos = -xpos; | |
cde6a23d | 482 | AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ; |
483 | gMC->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, fIdRotm, "ONLY"); | |
1963b290 | 484 | // put LED to the SCM0 |
485 | AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0); | |
cde6a23d | 486 | gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0); |
1963b290 | 487 | |
488 | par[1] = parSCM0[2]/2; // y | |
489 | par[2] = g->GetECPbRadThick()/2.; // z | |
490 | ||
491 | int nr=0; | |
d434833b | 492 | ypos = 0.0; |
cde6a23d | 493 | zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.; |
1963b290 | 494 | double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; |
495 | if(!gn.Contains("NOPB")) { // for testing - 11-jul-05 | |
e5a93224 | 496 | AliDebug(2,Form(" Pb tiles \n")); |
1963b290 | 497 | for(int iz=0; iz<g->GetNECLayers(); iz++){ |
cde6a23d | 498 | par[0] = (parSCM0[0] + mod->GetTanBetta()*fSampleWidth*iz)/2.; |
1963b290 | 499 | xpos = par[0] - xCenterSCMX; |
500 | gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ; | |
d434833b | 501 | AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0])); |
cde6a23d | 502 | zpos += fSampleWidth; |
1963b290 | 503 | } |
e5a93224 | 504 | AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr)); |
1963b290 | 505 | } |
4d2e7dc7 | 506 | } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) { |
507 | printf(" before AliEMCALv0::Trd1Tower3X3() : parSCM0"); | |
508 | for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]); | |
509 | printf("\n"); | |
510 | Trd1Tower3X3(parSCM0); | |
511 | } else if(g->GetNPHIdiv()==1 && g->GetNETAdiv()==1) { | |
512 | // no division in SCM0 | |
513 | Trd1Tower1X1(parSCM0); | |
514 | } else if(g->GetNPHIdiv()==4 && g->GetNETAdiv()==4) { | |
515 | Trd1Tower4X4(); | |
1963b290 | 516 | } |
1963b290 | 517 | } |
518 | } | |
519 | ||
4d2e7dc7 | 520 | //______________________________________________________________________ |
1963b290 | 521 | void AliEMCALv0::CreateSmod(const char* mother) |
cde6a23d | 522 | { |
523 | // 18-may-05; mother="XEN1"; | |
d87bd045 | 524 | // child="SMOD" from first to 10th, "SM10" (11th and 12th) (TRD1 case) |
1963b290 | 525 | AliEMCALGeometry * g = GetGeometry(); |
526 | TString gn(g->GetName()); gn.ToUpper(); | |
527 | ||
6f377f0c | 528 | Double_t par[3], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.; |
d87bd045 | 529 | Double_t par1C = 0.; |
1963b290 | 530 | // ===== define Super Module from air - 14x30 module ==== ; |
cde6a23d | 531 | fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick()); |
e5a93224 | 532 | AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data())); |
1963b290 | 533 | par[0] = g->GetShellThickness()/2.; |
534 | par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.; | |
535 | par[2] = g->GetEtaModuleSize()*15.; | |
cde6a23d | 536 | fIdRotm=0; |
1963b290 | 537 | int nphism = g->GetNumberOfSuperModules()/2; // 20-may-05 |
538 | if(nphism>0) { | |
539 | dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/nphism; | |
1d46d1f6 | 540 | // if(g->GetKey110DEG()) dphi = (g->GetArm1PhiMax() - g->GetArm1PhiMin())/(nphism-1); |
1963b290 | 541 | rpos = (g->GetEnvelop(0) + g->GetEnvelop(1))/2.; |
e5a93224 | 542 | AliDebug(2,Form(" rpos %8.2f : dphi %6.1f degree \n", rpos, dphi)); |
1963b290 | 543 | } |
544 | ||
6f377f0c | 545 | if(gn.Contains("WSUC")) { |
1963b290 | 546 | par[0] = g->GetPhiModuleSize()*g->GetNPhi()/2.; |
547 | par[1] = g->GetShellThickness()/2.; | |
548 | par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5; | |
549 | ||
cde6a23d | 550 | gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3); |
1963b290 | 551 | |
e5a93224 | 552 | AliDebug(2,Form("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n", |
553 | fIdTmedArr[kIdAIR], par[0],par[1],par[2])); | |
cde6a23d | 554 | fSmodPar0 = par[0]; |
555 | fSmodPar1 = par[1]; | |
556 | fSmodPar2 = par[2]; | |
1963b290 | 557 | nphism = g->GetNumberOfSuperModules(); |
558 | } else { | |
937d0661 | 559 | if(gn.Contains("TRD")) { |
1963b290 | 560 | par[2] = 350./2.; // 11-oct-04 - for 26 division |
e52475ed | 561 | if(gn.Contains("TRD1")) { |
e5a93224 | 562 | AliDebug(2,Form(" par[0] %7.2f (old) \n", par[0])); |
e52475ed | 563 | Float_t *parSM = g->GetSuperModulesPars(); |
564 | for(int i=0; i<3; i++) par[i] = parSM[i]; | |
565 | } | |
1963b290 | 566 | } |
cde6a23d | 567 | gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3); |
e5a93224 | 568 | AliDebug(2,Form("tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n", |
569 | fIdTmedArr[kIdAIR], par[0],par[1],par[2])); | |
cde6a23d | 570 | fSmodPar0 = par[0]; |
571 | fSmodPar2 = par[2]; | |
1d46d1f6 | 572 | if(g->GetKey110DEG()) { // 12-oct-05 |
d87bd045 | 573 | par1C = par[1]; |
574 | par[1] /= 2.; | |
cde6a23d | 575 | gMC->Gsvolu("SM10", "BOX", fIdTmedArr[kIdAIR], par, 3); |
e5a93224 | 576 | AliDebug(2,Form(" Super module with name \"SM10\" was created too par[1] = %f\n", par[1])); |
d87bd045 | 577 | par[1] = par1C; |
578 | } | |
1963b290 | 579 | // Steel plate |
580 | if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05 | |
581 | par[0] = g->GetSteelFrontThickness()/2.; | |
cde6a23d | 582 | gMC->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3); |
583 | printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", fIdTmedArr[kIdSTEEL], par[0],par[1],par[2]); | |
1963b290 | 584 | xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.; |
585 | gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ; | |
586 | } | |
587 | } | |
588 | ||
d87bd045 | 589 | int nr=0, nrsmod=0, i0=0; |
1963b290 | 590 | |
591 | // Turn whole super module | |
1963b290 | 592 | for(int i=i0; i<nphism; i++) { |
6f377f0c | 593 | if(gn.Contains("WSUC")) { |
d87bd045 | 594 | xpos = ypos = zpos = 0.0; |
cde6a23d | 595 | fIdRotm = 0; |
596 | gMC->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ; | |
597 | printf(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n", | |
598 | fIdRotm, phi, phiRad, xpos, ypos, zpos); | |
d87bd045 | 599 | nr++; |
c63c3c5d | 600 | } else { // TRD1 |
d87bd045 | 601 | TString smName("SMOD"); // 12-oct-05 |
1d46d1f6 | 602 | if(i==5 && g->GetKey110DEG()) { |
d87bd045 | 603 | smName = "SM10"; |
604 | nrsmod = nr; | |
605 | nr = 0; | |
606 | } | |
1963b290 | 607 | phi = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170 |
608 | phiRad = phi*TMath::Pi()/180.; | |
609 | ||
cde6a23d | 610 | AliMatrix(fIdRotm, 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0); |
1963b290 | 611 | |
612 | xpos = rpos * TMath::Cos(phiRad); | |
613 | ypos = rpos * TMath::Sin(phiRad); | |
cde6a23d | 614 | zpos = fSmodPar2; // 21-sep-04 |
1d46d1f6 | 615 | if(i==5 && g->GetKey110DEG()) { |
d87bd045 | 616 | xpos += (par1C/2. * TMath::Sin(phiRad)); |
617 | ypos -= (par1C/2. * TMath::Cos(phiRad)); | |
618 | } | |
619 | ||
1963b290 | 620 | // 1th module in z-direction; |
cde6a23d | 621 | gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ; |
622 | AliDebug(3, Form(" %s : %2i fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n", | |
623 | smName.Data(), nr, fIdRotm, phi, phiRad, xpos, ypos, zpos, i)); | |
1963b290 | 624 | // 2th module in z-direction; |
937d0661 | 625 | if(gn.Contains("TRD")) { |
1963b290 | 626 | // turn arround X axis; 0<phi<360 |
627 | double phiy = 90. + phi + 180.; | |
628 | if(phiy>=360.) phiy -= 360.; | |
629 | ||
cde6a23d | 630 | AliMatrix(fIdRotm, 90.0, phi, 90.0, phiy, 180.0, 0.0); |
631 | gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY"); | |
632 | AliDebug(3, Form(" %s : %2i fIdRotm %3i phiy %6.1f xpos %7.2f ypos %7.2f zpos %7.2f \n", | |
633 | smName.Data(), nr, fIdRotm, phiy, xpos, ypos, -zpos)); | |
1963b290 | 634 | } else { |
cde6a23d | 635 | gMC->Gspos("SMOD", ++nr, mother, xpos, ypos, -zpos, fIdRotm, "ONLY"); |
1963b290 | 636 | } |
637 | } | |
638 | } | |
e5a93224 | 639 | AliDebug(2,Form(" Number of Super Modules %i \n", nr+nrsmod)); |
1963b290 | 640 | } |
641 | ||
4d2e7dc7 | 642 | //______________________________________________________________________ |
1963b290 | 643 | void AliEMCALv0::CreateEmod(const char* mother, const char* child) |
cde6a23d | 644 | { |
645 | // 17-may-05; mother="SMOD"; child="EMOD" | |
1963b290 | 646 | AliEMCALGeometry * g = GetGeometry(); |
647 | TString gn(g->GetName()); gn.ToUpper(); | |
648 | // Module definition | |
6f377f0c | 649 | Double_t par[10], xpos=0., ypos=0., zpos=0.; |
1963b290 | 650 | Double_t parSCPA[5], zposSCPA=0.; // passive SC - 13-MAY-05, TRD1 case |
651 | Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.); | |
1963b290 | 652 | int nr=0; |
cde6a23d | 653 | fIdRotm=0; |
4d2e7dc7 | 654 | if(!gn.Contains("TRD")) { // standard module |
655 | par[0] = (fSampleWidth*g->GetNECLayers())/2.; | |
656 | par[1] = par[2] = g->GetPhiModuleSize()/2.; | |
657 | gMC->Gsvolu(child, "BOX", fIdTmedArr[kIdSTEEL], par, 3); | |
658 | ||
659 | } else if (gn.Contains("TRD1")){ // TRD1 system coordinate iz differnet | |
d87bd045 | 660 | if(strcmp(mother,"SMOD")==0) { |
cde6a23d | 661 | fParEMOD[0] = g->GetEtaModuleSize()/2.; // dx1 |
662 | fParEMOD[1] = g->Get2Trd1Dx2()/2.; // dx2 | |
663 | fParEMOD[2] = g->GetPhiModuleSize()/2.;; // dy | |
664 | fParEMOD[3] = g->GetLongModuleSize()/2.; // dz | |
665 | gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4); | |
1ae500a2 | 666 | // if(gn.Contains("WSUC") || gn.Contains("MAY05")){ |
667 | if(0){ // Jul 12 - should be checked | |
d87bd045 | 668 | parSCPA[0] = g->GetEtaModuleSize()/2. + tanTrd1*g->GetFrontSteelStrip(); // dx1 |
669 | parSCPA[1] = parSCPA[0] + tanTrd1*g->GetPassiveScintThick(); // dx2 | |
670 | parSCPA[2] = g->GetPhiModuleSize()/2.; // dy | |
671 | parSCPA[3] = g->GetPassiveScintThick()/2.; // dz | |
cde6a23d | 672 | gMC->Gsvolu("SCPA", "TRD1", fIdTmedArr[kIdSC], parSCPA, 4); |
673 | zposSCPA = -fParEMOD[3] + g->GetFrontSteelStrip() + g->GetPassiveScintThick()/2.; | |
d87bd045 | 674 | gMC->Gspos ("SCPA", ++nr, child, 0.0, 0.0, zposSCPA, 0, "ONLY"); |
675 | } | |
1963b290 | 676 | } |
1963b290 | 677 | } |
678 | ||
679 | nr = 0; | |
937d0661 | 680 | if(gn.Contains("TRD")) { // 30-sep-04; 27-jan-05 - as for TRD1 |
1963b290 | 681 | // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0) |
6f377f0c | 682 | AliEMCALShishKebabTrd1Module *mod=0; // current module |
e52475ed | 683 | |
1963b290 | 684 | for(int iz=0; iz<g->GetNZ(); iz++) { |
685 | Double_t angle=90., phiOK=0; | |
d87bd045 | 686 | if(gn.Contains("TRD1")) { |
1963b290 | 687 | mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz); |
688 | angle = mod->GetThetaInDegree(); | |
689 | if(!gn.Contains("WSUC")) { // ALICE | |
cde6a23d | 690 | if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,90., 90.,0.); // z'(x); y'(y); x'(z) |
691 | else AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.); | |
1963b290 | 692 | phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi(); |
c01485dd | 693 | // printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n", |
694 | //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule()); | |
cde6a23d | 695 | xpos = mod->GetPosXfromR() + g->GetSteelFrontThickness() - fSmodPar0; |
696 | zpos = mod->GetPosZ() - fSmodPar2; | |
d87bd045 | 697 | |
698 | int iyMax = g->GetNPhi(); | |
1d46d1f6 | 699 | if(strcmp(mother,"SMOD") && g->GetKey110DEG()) { |
d87bd045 | 700 | iyMax /= 2; |
701 | } | |
702 | for(int iy=0; iy<iyMax; iy++) { // flat in phi | |
703 | ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.; | |
cde6a23d | 704 | gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ; |
705 | //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm); | |
d434833b | 706 | AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1)); |
1963b290 | 707 | } |
813d27b5 | 708 | //PH printf("\n"); |
1963b290 | 709 | } else { |
cde6a23d | 710 | if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y) |
711 | else AliMatrix(fIdRotm, 90-angle,270., 90.0,0.0, angle,90.); | |
1963b290 | 712 | phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi(); |
713 | printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n", | |
714 | iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule()); | |
cde6a23d | 715 | zpos = mod->GetPosZ() - fSmodPar2; |
716 | ypos = mod->GetPosXfromR() - fSmodPar1; | |
717 | printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm); | |
1963b290 | 718 | for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi |
719 | xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.; | |
cde6a23d | 720 | gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ; |
1963b290 | 721 | printf(" %7.2f ", xpos); |
722 | } | |
723 | printf("\n"); | |
724 | } | |
1963b290 | 725 | } |
726 | } | |
727 | } else { | |
728 | xpos = g->GetSteelFrontThickness()/2.; | |
729 | for(int iz=0; iz<g->GetNZ(); iz++) { | |
cde6a23d | 730 | zpos = -fSmodPar2 + g->GetEtaModuleSize()*(2*iz+1)/2.; |
1963b290 | 731 | for(int iy=0; iy<g->GetNPhi(); iy++) { |
732 | ypos = g->GetPhiModuleSize()*(2*iy+1 - g->GetNPhi())/2.; | |
733 | gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, 0, "ONLY") ; | |
734 | //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f \n", nr, xpos, ypos, zpos); | |
735 | } | |
736 | } | |
737 | } | |
1d46d1f6 | 738 | AliDebug(2,Form(" Number of modules in Super Module(%s) %i \n", mother, nr)); |
1963b290 | 739 | } |
740 | ||
4d2e7dc7 | 741 | //______________________________________________________________________ |
742 | void AliEMCALv0::Trd1Tower3X3(const double *parSCM0) | |
cde6a23d | 743 | { |
4d2e7dc7 | 744 | // Started Dec 8,2004 by PAI |
745 | // Fixed Nov 13,2006 | |
746 | printf(" AliEMCALv0::Trd1Tower3X3() : parSCM0"); | |
747 | for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]); | |
748 | printf("\n"); | |
749 | // Nov 10, 2006 - different name of SCMX | |
750 | double parTRAP[11], *dummy=0; | |
751 | AliEMCALGeometry * g = GetGeometry(); | |
752 | TString gn(g->GetName()), scmx; | |
753 | gn.ToUpper(); | |
754 | // Division to tile size | |
755 | AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv())); | |
756 | gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis | |
757 | double dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3]; | |
758 | double ndiv=3., xpos=0.0; | |
759 | // should be defined once | |
760 | gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0); | |
761 | for(int ix=1; ix<=3; ix++) { // 3X3 | |
762 | scmx = "SCX"; // Nov 10,2006 | |
763 | // ix=1 | |
764 | parTRAP[0] = dz; | |
765 | double xCentBot = 2.*dx1/3.; | |
766 | double xCentTop = 2.*(dx2/4. + dx1/12.); | |
767 | parTRAP[1] = TMath::ATan2((xCentTop-xCentBot),2.*dz)*TMath::RadToDeg(); // theta | |
768 | parTRAP[2] = 0.; // phi | |
769 | // bottom | |
770 | parTRAP[3] = dy/ndiv; // H1 | |
771 | parTRAP[4] = dx1/ndiv; // BL1 | |
772 | parTRAP[5] = parTRAP[4]; // TL1 | |
773 | parTRAP[6] = 0.0; // ALP1 | |
774 | // top | |
775 | parTRAP[7] = dy/ndiv; // H2 | |
776 | parTRAP[8] = dx2/2 - dx1/6.;// BL2 | |
777 | parTRAP[9] = parTRAP[8]; // TL2 | |
778 | parTRAP[10]= 0.0; // ALP2 | |
779 | xpos = (xCentBot+xCentTop)/2.; | |
780 | ||
781 | if (ix==3) { | |
782 | parTRAP[1] = -parTRAP[1]; | |
783 | xpos = -xpos; | |
784 | } else if(ix==2) { // central part is box but we treat as trapesoid due to numbering | |
785 | parTRAP[1] = 0.; | |
786 | parTRAP[8] = dx1/ndiv; // BL2 | |
787 | parTRAP[9] = parTRAP[8]; // TL2 | |
788 | xpos = 0.0; | |
789 | } | |
790 | AliDebug(2,Form(" ** TRAP ** xpos %9.3f\n", xpos)); | |
791 | for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i])); | |
792 | ||
793 | scmx += ix; | |
794 | gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); | |
795 | gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ; | |
796 | ||
797 | PbInTrap(parTRAP, scmx); | |
798 | } | |
799 | AliDebug(2,Form("Trd1Tower3X3()", "Ver. 1.0 : was tested.")); | |
1963b290 | 800 | } |
801 | ||
802 | // 8-dec-04 by PAI | |
4d2e7dc7 | 803 | //______________________________________________________________________ |
1963b290 | 804 | void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n) |
cde6a23d | 805 | { |
806 | // see for example CreateShishKebabGeometry(); just for case TRD1 | |
1963b290 | 807 | static int nr=0; |
e5a93224 | 808 | AliDebug(2,Form(" Pb tiles : nrstart %i\n", nr)); |
1963b290 | 809 | AliEMCALGeometry * g = GetGeometry(); |
810 | ||
811 | double par[3]; | |
cde6a23d | 812 | // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick()); |
1963b290 | 813 | double xpos = 0.0, ypos = 0.0; |
cde6a23d | 814 | double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.; |
1963b290 | 815 | |
816 | double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]); | |
817 | double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // ?? | |
818 | // double tan = TMath::Tan(parTRAP[1]*TMath::DegToRad()); | |
819 | ||
820 | par[1] = parTRAP[3]; // y | |
821 | par[2] = g->GetECPbRadThick()/2.; // z | |
822 | for(int iz=0; iz<g->GetNECLayers(); iz++){ | |
cde6a23d | 823 | par[0] = parTRAP[4] + coef*fSampleWidth*iz; |
1963b290 | 824 | xpos = par[0] - xCenterSCMX; |
825 | if(parTRAP[1] < 0.) xpos = -xpos; | |
826 | gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ; | |
e5a93224 | 827 | AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0])); |
cde6a23d | 828 | zpos += fSampleWidth; |
1963b290 | 829 | if(iz%2>0) printf("\n"); |
830 | } | |
e5a93224 | 831 | AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef)); |
832 | AliDebug(2,Form(" par[1] %9.3f par[2] %9.3f ypos %9.3f \n", par[1], par[2], ypos)); | |
833 | AliDebug(2,Form(" PbInTrap Ver. 1.0 : was tested.")); | |
1963b290 | 834 | } |
835 | ||
836 | // 8-dec-04 by PAI | |
4d2e7dc7 | 837 | //______________________________________________________________________ |
1963b290 | 838 | void AliEMCALv0::Trd1Tower4X4() |
cde6a23d | 839 | { |
840 | // Not ready yet | |
1963b290 | 841 | } |
d25f2c54 | 842 | |
4d2e7dc7 | 843 | //______________________________________________________________________ |
844 | void AliEMCALv0::Trd1Tower1X1(double *parSCM0) | |
d25f2c54 | 845 | { |
4d2e7dc7 | 846 | // Started Nov 22,2006 by PAI |
847 | AliDebug(1," AliEMCALv0::Trd1Tower1X1() : parSCM0"); | |
848 | for(int i=0; i<4; i++) printf(" %7.4f ", parSCM0[i]); | |
849 | printf("\n"); | |
850 | ||
851 | // No division - keeping the same volume logic | |
852 | // and as consequence the same abs is scheme | |
853 | AliDebug(2,"Trd1Tower1X1() : Create SCMX(SCMY) as SCM0"); | |
854 | ||
855 | gMC->Gsvolu("SCMY", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4); | |
856 | gMC->Gspos("SCMY", 1, "SCM0", 0.0, 0.0, 0.0, 0, "ONLY"); | |
857 | gMC->Gsvolu("SCMX", "TRD1", fIdTmedArr[kIdSC], parSCM0, 4); | |
858 | gMC->Gspos("SCMX", 1, "SCMY", 0.0, 0.0, 0.0, 0, "ONLY"); | |
859 | ||
860 | // should be defined once | |
861 | double *dummy=0; | |
862 | gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0); | |
863 | ||
864 | PbInTrd1(parSCM0, "SCMX"); | |
865 | ||
866 | AliDebug(1,"Trd1Tower1X1() : Ver. 0.1 : was tested."); | |
867 | } | |
868 | ||
869 | //______________________________________________________________________ | |
870 | void AliEMCALv0::PbInTrd1(double *parTrd1, TString n) | |
871 | { | |
872 | // see PbInTrap(const double parTrd1[11], TString n) | |
873 | static int nr=0, ndeb=2; | |
874 | AliDebug(ndeb,Form(" Pb tiles : nrstart %i\n", nr)); | |
875 | AliEMCALGeometry * g = GetGeometry(); | |
876 | ||
877 | double par[3]; | |
878 | // double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick()); | |
879 | double xpos = 0.0, ypos = 0.0; | |
880 | double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.; | |
881 | double coef = (parTrd1[1] - parTrd1[0]) / (2.*parTrd1[3]); | |
882 | ||
883 | par[1] = parTrd1[2]; // y | |
884 | par[2] = g->GetECPbRadThick()/2.; // z | |
885 | ||
886 | for(int iz=0; iz<g->GetNECLayers(); iz++){ | |
887 | par[0] = parTrd1[0] + coef*fSampleWidth*iz; | |
888 | gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ; | |
889 | AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0])); | |
890 | zpos += fSampleWidth; | |
891 | if(iz%2>0) printf("\n"); | |
892 | } | |
893 | AliDebug(ndeb,Form(" Number of Pb tiles in SCMX %i coef %9.7f ", nr, coef)); | |
894 | AliDebug(ndeb,Form(" PbInTrd1 Ver. 0.1 : was tested.")); | |
d25f2c54 | 895 | } |
896 | ||
1963b290 | 897 | // 3-feb-05 |
4d2e7dc7 | 898 | //______________________________________________________________________ |
899 | void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parSCM0[5]) | |
1963b290 | 900 | { |
4d2e7dc7 | 901 | // Passive material inside the detector |
902 | double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); //Need check | |
903 | AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness)); | |
904 | for(int i=0; i<4; i++) { // on pictures sometimes I can not see 0 -> be carefull!! | |
905 | parSCM0[i] = emodPar[i] - wallThickness; | |
906 | AliDebug(2,Form(" %i parSCMO %7.3f emodPar %7.3f : dif %7.3f \n", | |
907 | i, parSCM0[i],emodPar[i], parSCM0[i]-emodPar[i])); | |
908 | } | |
909 | parSCM0[4] = emodPar[4]; | |
910 | gMC->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC | |
911 | gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ; | |
912 | // Division | |
913 | if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) { | |
914 | Division2X2InScm0(g, parSCM0); | |
915 | } else { | |
916 | Info("Scm0InTrd2"," no division SCM0 in this geometry |%s|\n", g->GetName()); | |
917 | assert(0); | |
918 | } | |
1963b290 | 919 | } |
920 | ||
4d2e7dc7 | 921 | //______________________________________________________________________ |
1963b290 | 922 | void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t parSCM0[5]) |
923 | { | |
cde6a23d | 924 | // Division 2X2 |
1963b290 | 925 | Double_t parTRAP[11], xpos=0.,ypos=0., dx1=0.0,dx2=0.,dy1=0.0,dy2=0.,dz=0. |
926 | ,dr1=0.0,dr2=0.; | |
cde6a23d | 927 | fIdRotm=0; |
1963b290 | 928 | |
929 | Info("Division2X2InScm0","Divide SCM0 on y-axis %i\n", g->GetNETAdiv()); | |
930 | TString n("SCMX"), overLapFlagSCMY("ONLY"), overLapFlagSCMX("ONLY"); | |
931 | n = "SCM0"; // for testing - 14-mar-05 | |
932 | if(n=="SCM0"){ | |
933 | PbInTrapForTrd2(parSCM0, n); | |
934 | // overLapFlagSCMY=overLapFlagSCMX="MANY"; // do not work | |
935 | return; | |
936 | } | |
937 | ||
938 | dy1 = parSCM0[2] , dy2 = parSCM0[3], dz = parSCM0[4]; | |
939 | ||
940 | parTRAP[0] = parSCM0[4]; // dz | |
941 | parTRAP[1] = TMath::ATan2((dy2-dy1)/2.,2.*dz)*TMath::RadToDeg(); | |
942 | parTRAP[2] = 90.; // phi | |
943 | // bottom | |
944 | parTRAP[3] = parSCM0[2]/2.; // H1 | |
945 | parTRAP[4] = parSCM0[0]; // BL1 | |
946 | parTRAP[5] = parTRAP[4]; // TL1 | |
947 | parTRAP[6] = 0.0; // ALP1 | |
948 | // top | |
949 | parTRAP[7] = parSCM0[3]/2.; // H2 | |
950 | parTRAP[8] = parSCM0[1]; // BL2 | |
951 | parTRAP[9] = parTRAP[8]; // TL2 | |
952 | parTRAP[10]= 0.0; // ALP2 | |
e5a93224 | 953 | AliDebug(2,Form(" ** SCMY ** \n")); |
954 | for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i])); | |
1963b290 | 955 | |
cde6a23d | 956 | fIdRotm=0; |
957 | gMC->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC | |
1963b290 | 958 | ypos = +(parTRAP[3]+parTRAP[7])/2.; // |
e5a93224 | 959 | AliDebug(2,Form(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data())); |
cde6a23d | 960 | gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm, overLapFlagSCMY.Data()) ; |
1963b290 | 961 | // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z |
cde6a23d | 962 | AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ; |
1963b290 | 963 | // We may have problem with numeration due to rotation - 4-feb-05 |
cde6a23d | 964 | gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm, overLapFlagSCMY.Data()); |
1963b290 | 965 | |
966 | Info("Division2X2InScm0","Divide SCMY on x-axis %i\n", g->GetNPHIdiv()); | |
967 | dx1 = parSCM0[0]; | |
968 | dx2 = parSCM0[1]; | |
969 | dr1=TMath::Sqrt(dx1*dx1+dy1*dy1); | |
970 | dr2=TMath::Sqrt(dx2*dx2+dy2*dy2); | |
971 | ||
972 | parTRAP[0] = parSCM0[4]; // dz | |
973 | parTRAP[1] = TMath::ATan2((dr2-dr1)/2.,2.*dz)*TMath::RadToDeg(); // | |
974 | parTRAP[2] = 45.; // phi | |
975 | // bottom | |
976 | parTRAP[3] = parSCM0[2]/2.; // H1 | |
977 | parTRAP[4] = parSCM0[0]/2.; // BL1 | |
978 | parTRAP[5] = parTRAP[4]; // TL1 | |
979 | parTRAP[6] = 0.0; // ALP1 | |
980 | // top | |
981 | parTRAP[7] = parSCM0[3]/2.; // H2 | |
982 | parTRAP[8] = parSCM0[1]/2; // BL2 | |
983 | parTRAP[9] = parTRAP[8]; // TL2 | |
984 | parTRAP[10]= 0.0; // ALP2 | |
e5a93224 | 985 | AliDebug(2,Form(" ** SCMX ** \n")); |
986 | for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i])); | |
1963b290 | 987 | |
cde6a23d | 988 | fIdRotm=0; |
989 | gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); | |
1963b290 | 990 | xpos = (parTRAP[4]+parTRAP[8])/2.; |
e5a93224 | 991 | AliDebug(2,Form(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data())); |
cde6a23d | 992 | gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ; |
993 | // AliMatrix(fIdRotm, 90.0,270., 90.0, 0.0, 0.0,0.0); // x'=-y; y'=x; z'=z | |
994 | AliMatrix(fIdRotm, 90.0,90., 90.0, -180.0, 0.0,0.0); // x'=y; y'=-x; z'=z | |
995 | gMC->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, fIdRotm, overLapFlagSCMX.Data()) ; | |
1963b290 | 996 | // PB: |
997 | if(n=="SCMX" && overLapFlagSCMY == "ONLY") { | |
998 | PbInTrapForTrd2(parTRAP, n); | |
999 | } | |
1000 | } | |
1001 | ||
1002 | // 4-feb-05 by PAI | |
4d2e7dc7 | 1003 | //______________________________________________________________________ |
1004 | void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name) | |
cde6a23d | 1005 | { |
4d2e7dc7 | 1006 | // TRD2 cases |
1007 | Double_t *dummy=0; | |
1008 | TString pbShape("BOX"), pbtiChonly("ONLY"); | |
1009 | if(name=="SCM0") { | |
1010 | pbShape = "TRD2"; | |
1011 | // pbtiChonly = "MANY"; | |
1012 | } | |
1013 | gMC->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0); | |
1014 | ||
1015 | int nr=0; | |
1016 | Info("PbInTrapForTrd2"," Pb tiles inside %s: shape %s :pbtiChonly %s\n nrstart %i\n", | |
1017 | name.Data(), pbShape.Data(), pbtiChonly.Data(), nr); | |
1018 | AliEMCALGeometry * g = GetGeometry(); | |
1019 | ||
1020 | double par[5], parPB[5], parSC[5]; | |
1021 | //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick()); | |
1022 | double xpos = 0.0, ypos = 0.0; | |
1023 | double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.; | |
1024 | if(name == "SCMX") { // common trapezoid - 11 parameters | |
1025 | double coef = (parTRAP[8] - parTRAP[4]) / (2.*parTRAP[0]); | |
1026 | double xCenterSCMX = (parTRAP[4] + parTRAP[8])/2.; // the same for y | |
1027 | AliDebug(2,Form(" xCenterSCMX %8.5f : coef %8.7f \n", xCenterSCMX, coef)); | |
1028 | ||
1029 | par[2] = g->GetECPbRadThick()/2.; // z | |
1030 | for(int iz=0; iz<g->GetNECLayers(); iz++){ | |
1031 | par[0] = parTRAP[4] + coef*fSampleWidth*iz; | |
1032 | par[1] = par[0]; | |
1033 | xpos = ypos = par[0] - xCenterSCMX; | |
1034 | //if(parTRAP[1] < 0.) xpos = -xpos; | |
1035 | gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ; | |
1036 | AliDebug(2,Form(" %2.2i xpos %8.5f zpos %6.3f par[0,1] %6.3f |", iz+1, xpos, zpos, par[0])); | |
1037 | if(iz%2>0) AliDebug(2,Form("\n")); | |
1038 | zpos += fSampleWidth; | |
1039 | } | |
1040 | AliDebug(2,Form(" Number of Pb tiles in SCMX %i coef %9.7f \n", nr, coef)); | |
1041 | AliDebug(2,Form(" par[1] %9.5f par[2] %9.5f ypos %9.5f \n", par[1], par[2], ypos)); | |
1042 | } else if(name == "SCM0") { // 1-mar-05 ; TRD2 - 5 parameters | |
1043 | AliDebug(2,Form(" SCM0 par = ")); | |
1044 | for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parTRAP[i])); | |
1045 | AliDebug(2,Form("\n zpos %f \n",zpos)); | |
1046 | ||
1047 | double tanx = (parTRAP[1] - parTRAP[0]) / (2.*parTRAP[4]); // tanx = tany now | |
1048 | double tany = (parTRAP[3] - parTRAP[2]) / (2.*parTRAP[4]), ztmp=0.; | |
1049 | parPB[4] = g->GetECPbRadThick()/2.; | |
1050 | parSC[2] = g->GetECScintThick()/2.; | |
1051 | for(int iz=0; iz<g->GetNECLayers(); iz++){ | |
1052 | ztmp = fSampleWidth*double(iz); | |
1053 | parPB[0] = parTRAP[0] + tanx*ztmp; | |
1054 | parPB[1] = parPB[0] + tanx*g->GetECPbRadThick(); | |
1055 | parPB[2] = parTRAP[2] + tany*ztmp; | |
1056 | parPB[3] = parPB[2] + tany*g->GetECPbRadThick(); | |
1057 | gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ; | |
1058 | AliDebug(2,Form("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos)); | |
1059 | /* | |
1060 | for(int i=0; i<5; i++) printf(" %9.5f ", parPB[i]); | |
1061 | // individual SC tile | |
1062 | parSC[0] = parPB[0]; | |
1063 | parSC[1] = parPB[1]; | |
1064 | gMC->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(), | |
1065 | 0, pbtiChonly.Data(), parSC, 3) ; | |
1066 | printf("\n SCTI zpos %6.3f | par = ", zpos+g->GetECScintThick()); | |
1067 | for(int i=0; i<3; i++) printf(" %9.5f ", parPB[i]); | |
1068 | */ | |
1069 | zpos += fSampleWidth; | |
1070 | } | |
1071 | AliDebug(2,Form("\n")); | |
1072 | } | |
1073 | Info("PbInTrapForTrd2", "Ver. 0.03 : was tested."); | |
1963b290 | 1074 | } |
1075 | ||
1076 | // 15-mar-05 | |
4d2e7dc7 | 1077 | //______________________________________________________________________ |
1078 | void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5], Double_t parPBMO[5]) | |
1963b290 | 1079 | { |
4d2e7dc7 | 1080 | // Pb inside Trd2 |
1081 | Info("PbmoInTrd2"," started : geometry %s ", g->GetName()); | |
1082 | double wallThickness = g->GetPhiModuleSize()/2. - g->GetPhiTileSize(); | |
1083 | AliDebug(2,Form(" wall thickness %7.5f \n", wallThickness)); | |
1084 | for(int i=0; i<4; i++) { | |
1085 | parPBMO[i] = emodPar[i] - wallThickness; | |
1086 | AliDebug(2,Form(" %i parPBMO %7.3f emodPar %7.3f : dif %7.3f \n", | |
1087 | i, parPBMO[i],emodPar[i], parPBMO[i]-emodPar[i])); | |
1088 | } | |
1089 | parPBMO[4] = emodPar[4]; | |
1090 | gMC->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5); | |
1091 | gMC->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ; | |
1092 | // Division | |
1093 | if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) { | |
1094 | Division2X2InPbmo(g, parPBMO); | |
1095 | AliDebug(2,Form(" PBMO, division 2X2 | geometry |%s|\n", g->GetName())); | |
1096 | } else { | |
1097 | AliDebug(2,Form(" no division PBMO in this geometry |%s|\n", g->GetName())); | |
1098 | assert(0); | |
1099 | } | |
1963b290 | 1100 | } |
1101 | ||
4d2e7dc7 | 1102 | //______________________________________________________________________ |
cde6a23d | 1103 | void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t parPBMO[5]) |
1963b290 | 1104 | { |
cde6a23d | 1105 | // Division 2X2 |
1963b290 | 1106 | Info("Division2X2InPbmo"," started : geometry %s ", g->GetName()); |
1107 | //Double_t *dummy=0; | |
cde6a23d | 1108 | // gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0); |
1963b290 | 1109 | |
1110 | double parSC[3]; | |
cde6a23d | 1111 | //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick()); |
1963b290 | 1112 | double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;; |
1113 | double tanx = (parPBMO[1] - parPBMO[0]) / (2.*parPBMO[4]); // tanx = tany now | |
1114 | double tany = (parPBMO[3] - parPBMO[2]) / (2.*parPBMO[4]); | |
1115 | char name[10], named[10], named2[10]; | |
1116 | ||
e5a93224 | 1117 | AliDebug(2,Form(" PBMO par = ")); |
1118 | for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parPBMO[i])); | |
1119 | AliDebug(2,Form("\n")); | |
1963b290 | 1120 | |
1121 | parSC[2] = g->GetECScintThick()/2.; | |
cde6a23d | 1122 | zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick() + g->GetECScintThick()/2.; |
e5a93224 | 1123 | AliDebug(2,Form(" parSC[2] %9.5f \n", parSC[2])); |
1963b290 | 1124 | for(int iz=0; iz<g->GetNECLayers(); iz++){ |
cde6a23d | 1125 | ztmp = g->GetECPbRadThick() + fSampleWidth*double(iz); // Z for previous PB |
1963b290 | 1126 | parSC[0] = parPBMO[0] + tanx*ztmp; |
1127 | parSC[1] = parPBMO[2] + tany*ztmp; | |
1128 | ||
1129 | sprintf(name,"SC%2.2i", iz+1); | |
cde6a23d | 1130 | gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3); |
1963b290 | 1131 | gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ; |
e5a93224 | 1132 | AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ", |
1133 | name, zpos, parSC[0], parSC[1])); | |
1963b290 | 1134 | |
1135 | sprintf(named,"SY%2.2i", iz+1); | |
1136 | printf(" %s -> ", named); | |
1137 | gMC->Gsdvn(named,name, 2, 2); | |
1138 | ||
1139 | sprintf(named2,"SX%2.2i", iz+1); | |
1140 | printf(" %s \n", named2); | |
1141 | gMC->Gsdvn(named2,named, 2, 1); | |
1142 | ||
cde6a23d | 1143 | zpos += fSampleWidth; |
1963b290 | 1144 | } |
1145 | } | |
c01485dd | 1146 | |
4d2e7dc7 | 1147 | //______________________________________________________________________ |
21cf2b24 | 1148 | AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta) |
cde6a23d | 1149 | { |
1150 | // 28-oct-05 | |
c01485dd | 1151 | AliEMCALShishKebabTrd1Module* trd1=0; |
1152 | if(fShishKebabModules && neta>=0 && neta<fShishKebabModules->GetSize()) { | |
1153 | trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(neta); | |
1154 | } | |
1155 | return trd1; | |
1156 | } | |
5f66b6c6 | 1157 | |
1158 | //_____________________________________________________________________________ | |
1159 | void AliEMCALv0::AddAlignableVolumes() const | |
1ae500a2 | 1160 | { |
1161 | TString ntmp(GetTitle()); // name of EMCAL geometry | |
1162 | ||
1163 | if(ntmp.Contains("WSUC")) { | |
1164 | AddAlignableVolumesInWSUC(); // WSUC case | |
1165 | } else { | |
1166 | AddAlignableVolumesInALICE(); // ALICE case | |
1167 | } | |
1168 | } | |
1169 | ||
4d2e7dc7 | 1170 | //______________________________________________________________________ |
1ae500a2 | 1171 | void AliEMCALv0::AddAlignableVolumesInALICE() const |
5f66b6c6 | 1172 | { |
1173 | // | |
1174 | // Create entries for alignable volumes associating the symbolic volume | |
1175 | // name with the corresponding volume path. Needs to be synchronized with | |
1176 | // eventual changes in the geometry. | |
1177 | // | |
1178 | ||
9aa6a5f6 | 1179 | Float_t * pars = GetGeometry()->GetSuperModulesPars(); |
1180 | double rpos = (GetGeometry()->GetEnvelop(0) + GetGeometry()->GetEnvelop(1))/2.; | |
1181 | double phi, phiRad, xpos, ypos, zpos; | |
1182 | ||
200e17a4 | 1183 | AliGeomManager::ELayerID idEMCAL = AliGeomManager::kEMCAL; |
1184 | Int_t modUID, modnum = 0; | |
5f66b6c6 | 1185 | TString volpath, symname; |
1186 | ||
85653ebc | 1187 | Int_t nSMod = GetGeometry()->GetNumberOfSuperModules(); |
9aa6a5f6 | 1188 | for (Int_t smodnum=0; smodnum < nSMod; smodnum++) { |
200e17a4 | 1189 | modUID = AliGeomManager::LayerToVolUID(idEMCAL,modnum++); |
9aa6a5f6 | 1190 | volpath = "ALIC_1/XEN1_1/SMOD_"; |
1082109f | 1191 | volpath += (smodnum+1); |
9aa6a5f6 | 1192 | symname = "EMCAL/FullSupermodule"; |
1193 | symname += (smodnum+1); | |
1194 | ||
1195 | if(GetGeometry()->GetKey110DEG() && smodnum>=10) { | |
1196 | volpath = "ALIC_1/XEN1_1/SM10_"; | |
1197 | volpath += (smodnum-10+1); | |
1198 | symname = "EMCAL/HalfSupermodule"; | |
1199 | symname += (smodnum-10+1); | |
1200 | } | |
1201 | ||
200e17a4 | 1202 | if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID)) |
9aa6a5f6 | 1203 | AliFatal("AliEMCALv0::Unable to set alignable entry!!"); |
1204 | ||
1205 | // Creates the Tracking to Local transformation matrix for EMCAL | |
1206 | // modules | |
200e17a4 | 1207 | TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID) ; |
9aa6a5f6 | 1208 | |
85653ebc | 1209 | phiRad = GetGeometry()->GetPhiCenterOfSM(smodnum); //comes in radians, not degrees |
1210 | phi = phiRad*180./TMath::Pi(); //need degrees for rot. matrix | |
9aa6a5f6 | 1211 | xpos = rpos * TMath::Cos(phiRad); |
1212 | ypos = rpos * TMath::Sin(phiRad); | |
1213 | zpos = pars[2]; | |
1214 | if(GetGeometry()->GetKey110DEG() && smodnum >= 10) { | |
1215 | xpos += (pars[1]/2. * TMath::Sin(phiRad)); | |
1216 | ypos -= (pars[1]/2. * TMath::Cos(phiRad)); | |
1217 | } | |
1218 | ||
1219 | TGeoHMatrix *matTtoL; | |
200e17a4 | 1220 | TGeoHMatrix *globMatrix = alignableEntry->GetGlobalOrig(); |
9aa6a5f6 | 1221 | |
1222 | if(smodnum%2 == 0) { | |
1223 | // pozitive z | |
1224 | TGeoTranslation geoTran0(xpos,ypos, zpos); | |
1225 | TGeoRotation geoRot0("geoRot0", 90.0, phi, 90.0, 90.0+phi, 0.0, 0.0); | |
1226 | TGeoCombiTrans mat0(geoTran0, geoRot0); | |
1227 | matTtoL = new TGeoHMatrix(mat0); | |
1228 | ||
1229 | matTtoL->MultiplyLeft(&(globMatrix->Inverse())); | |
1230 | alignableEntry->SetMatrix(matTtoL); | |
1231 | ||
1232 | } else { | |
1233 | // negative z | |
1234 | double phiy = 90. + phi + 180.; | |
1235 | if(phiy>=360.) phiy -= 360.; | |
1236 | TGeoTranslation geoTran1(xpos,ypos,-zpos); | |
1237 | TGeoRotation geoRot1("geoRot1", 90.0, phi, 90.0, phiy, 180.0, 0.0); | |
1238 | TGeoCombiTrans mat1(geoTran1, geoRot1); | |
1239 | matTtoL = new TGeoHMatrix(mat1); | |
1240 | ||
1241 | matTtoL->MultiplyLeft(&(globMatrix->Inverse())); | |
1242 | alignableEntry->SetMatrix(matTtoL); | |
5f66b6c6 | 1243 | |
5f66b6c6 | 1244 | } |
9aa6a5f6 | 1245 | |
5f66b6c6 | 1246 | } |
1247 | ||
1248 | } | |
1249 | ||
4d2e7dc7 | 1250 | //______________________________________________________________________ |
1ae500a2 | 1251 | void AliEMCALv0::AddAlignableVolumesInWSUC() const |
1252 | { | |
1253 | // | |
1254 | // Create entries for alignable volumes associating the symbolic volume | |
1255 | // name with the corresponding volume path. Needs to be synchronized with | |
1256 | // eventual changes in the geometry. | |
1257 | // | |
1258 | ||
1259 | TString vpstr1 = "WSUC_1/XEN1_1/SMOD_"; | |
1260 | TString snstr1 = "EMCAL/CosmicTestSupermodule"; | |
1261 | TString volpath, symname; | |
1262 | ||
1263 | // #SM is just one | |
1264 | for (Int_t smodnum=0; smodnum < 1; smodnum++) { | |
1265 | symname = snstr1; | |
1266 | symname += (smodnum+1); | |
1267 | volpath = vpstr1; | |
1268 | volpath += (smodnum+1); | |
1269 | if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data())) | |
1270 | AliFatal("Unable to set alignable entry!!"); | |
1271 | } | |
1272 | } |