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