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