]>
Commit | Line | Data |
---|---|---|
1963b290 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2004, 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 | **************************************************************************/ | |
15 | // GeometryOfflineTrd1 class for EMCAL : singleton | |
16 | //*-- Author: Aleksei Pavlinov (WSU) | |
17 | ||
18 | /* $Id$*/ | |
19 | ||
20 | #include <TBrowser.h> | |
21 | #include <TMath.h> | |
22 | #include <TVector2.h> | |
23 | #include <TVector3.h> | |
24 | #include <TObjArray.h> | |
25 | ||
26 | #include "AliEMCALGeometryOfflineTrd1.h" | |
27 | #include "AliEMCALShishKebabTrd1Module.h" | |
28 | #include "AliEMCALGeometry.h" | |
29 | ||
30 | ClassImp(AliEMCALGeometryOfflineTrd1); | |
31 | ||
32 | AliEMCALGeometryOfflineTrd1* AliEMCALGeometryOfflineTrd1::fgGeomOfflineTrd1=0; | |
33 | ||
34 | AliEMCALGeometryOfflineTrd1* AliEMCALGeometryOfflineTrd1::GetInstance() | |
35 | { | |
36 | if(fgGeomOfflineTrd1==0) { | |
37 | fgGeomOfflineTrd1 = new AliEMCALGeometryOfflineTrd1(); | |
38 | } | |
39 | return fgGeomOfflineTrd1; | |
40 | } | |
41 | ||
42 | AliEMCALGeometryOfflineTrd1::AliEMCALGeometryOfflineTrd1() : TNamed("geomTRD1","") | |
43 | { // this private constarctor | |
44 | fGeometry = AliEMCALGeometry::GetInstance("SHISH_62_TRD1"); | |
45 | Init(); | |
46 | } | |
47 | ||
48 | void AliEMCALGeometryOfflineTrd1::Init() | |
49 | { | |
50 | // Super module | |
51 | // ETA direction | |
52 | fMaxInEta = fGeometry->GetNZ(); | |
53 | fTrd1Modules[0] = new AliEMCALShishKebabTrd1Module(); | |
54 | fSMMaxEta = 2*fMaxInEta; | |
55 | fSMPositionEta = new TVector2[fSMMaxEta]; | |
56 | fSMPositionEta[0] = fTrd1Modules[0]->GetCenterOfCell(1); | |
57 | fSMPositionEta[1] = fTrd1Modules[0]->GetCenterOfCell(2); | |
58 | for(Int_t i=1; i<fMaxInEta; i++) { | |
59 | fTrd1Modules[i] = new AliEMCALShishKebabTrd1Module(*(fTrd1Modules[i-1])); | |
60 | fSMPositionEta[2*i] = fTrd1Modules[i]->GetCenterOfCell(1); | |
61 | fSMPositionEta[2*i+1] = fTrd1Modules[i]->GetCenterOfCell(2); | |
62 | } | |
63 | // PHI direction | |
64 | fSMPositionPhi.Set(2*fGeometry->GetNPhi()); | |
65 | fShiftOnPhi = -fGeometry->GetPhiModuleSize()*fGeometry->GetNPhi()/2; | |
66 | for(Int_t i=0; i<fGeometry->GetNPhi(); i++) { | |
67 | fSMPositionPhi[2*i] = fGeometry->GetPhiModuleSize() * (double(i) + 0.25); | |
68 | fSMPositionPhi[2*i+1] = fGeometry->GetPhiTileSize() + fSMPositionPhi[2*i]; | |
69 | } | |
70 | ||
71 | // Super Module rotations | |
72 | fNPhiSuperModule = fGeometry->GetNPhiSuperModule(); // see AliEMCALv0 | |
73 | double dphi = (fGeometry->GetArm1PhiMax() - fGeometry->GetArm1PhiMin()) / fNPhiSuperModule; | |
74 | double phi, phiRad; | |
75 | fSuperModuleRotationX.RotateX(TMath::Pi()); // matrix looks not so nice | |
76 | for(Int_t i=0; i<fNPhiSuperModule; i++){ | |
77 | // rotations arround Z | |
78 | phi = fGeometry->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170 | |
79 | phiRad = phi*TMath::DegToRad(); | |
80 | if(i==1) phiRad = TMath::PiOver2(); | |
81 | fSuperModuleRotationZ[i].RotateZ(phiRad); | |
82 | TString ntmp("rotationZ_"); | |
83 | ntmp += int(phi); | |
84 | fNameSuperModuleRotationZ[i] = ntmp; | |
85 | // Super Module rotation | |
86 | fSuperModuleRotation[2*i] = fSuperModuleRotationZ[i]; // Z | |
87 | fSuperModuleRotation[2*i+1] = fSuperModuleRotationZ[i] * fSuperModuleRotationX; // Z*X | |
88 | } | |
89 | // Fill fXYZofCells | |
90 | fXYZofCells = new TObjArray(fGeometry->GetNCells()); | |
91 | fXYZofCells->SetName("CellsInGC"); | |
92 | Int_t nSupMod, nTower, nIphi, nIeta, iphi, ieta; | |
93 | for(Int_t absId=1; absId<=fGeometry->GetNCells(); absId++){ | |
94 | if(fGeometry->GetCellIndex(absId, nSupMod,nTower,nIphi,nIeta)){ | |
95 | fGeometry->GetCellPhiEtaIndexInSModule(nTower,nIphi,nIeta, iphi,ieta); | |
96 | TVector3 *v = new TVector3; | |
97 | v->SetX(fSMPositionEta[ieta-1].Y()); | |
98 | v->SetZ(fSMPositionEta[ieta-1].X()); | |
99 | v->SetY(fSMPositionPhi[iphi-1] + fShiftOnPhi); | |
100 | v->Transform(fSuperModuleRotation[nSupMod-1]); | |
101 | fXYZofCells->AddAt(v,absId-1); | |
102 | } | |
103 | } | |
104 | } | |
105 | ||
106 | TVector3& AliEMCALGeometryOfflineTrd1::PosInSuperModule(const Int_t nTower,const Int_t nIphi,const Int_t nIeta) | |
107 | { // 10-nov-04 | |
108 | static Int_t iphi, ieta; | |
109 | static TVector3 v; | |
110 | fGeometry->GetCellPhiEtaIndexInSModule(nTower,nIphi,nIeta, iphi,ieta); | |
111 | ||
112 | // x-radius; y-phi; eta-z; | |
113 | v.SetXYZ(fSMPositionEta[ieta].Y(), fSMPositionPhi[iphi], fSMPositionEta[ieta].X()); | |
114 | return v; | |
115 | } | |
116 | ||
117 | void AliEMCALGeometryOfflineTrd1::PositionInSuperModule(const Int_t iphi, const Int_t ieta, | |
118 | double &lphi, double &leta) | |
119 | { | |
120 | static Int_t ie=0; | |
121 | lphi = fSMPositionPhi[iphi-1]; | |
122 | ie = ieta - 1; | |
123 | if(ie<0) ie = 0; | |
124 | if(ie>fSMMaxEta-1) ie = fSMMaxEta-1; | |
125 | leta = fSMPositionEta[ie].X(); | |
126 | } | |
127 | ||
128 | void AliEMCALGeometryOfflineTrd1::PositionInSuperModule(const Int_t nTower, const Int_t nIphi, const Int_t nIeta, | |
129 | double &lphi, double &leta) | |
130 | { | |
131 | static Int_t iphi,ieta; | |
132 | fGeometry->GetCellPhiEtaIndexInSModule(nTower,nIphi,nIeta,iphi,ieta); | |
133 | PositionInSuperModule(iphi,ieta, lphi,leta); | |
134 | } | |
135 | ||
136 | TRotation* AliEMCALGeometryOfflineTrd1::Rotation(Int_t module) | |
137 | { // module chabge from 1 to 12 | |
138 | if(module<1) module=1; | |
139 | if(module>12) module=12; | |
140 | return &fSuperModuleRotation[module]; | |
141 | } | |
142 | ||
143 | TVector3* AliEMCALGeometryOfflineTrd1::CellPosition(int absId) | |
144 | { // 15-nov-04 | |
145 | if(absId<1 || absId>fXYZofCells->GetSize()) return 0; | |
146 | return (TVector3*)fXYZofCells->At(absId-1); | |
147 | } | |
148 | ||
149 | void AliEMCALGeometryOfflineTrd1::PrintSuperModule() | |
150 | { // 12-nov-04 | |
151 | printf(" ** Super module ** fSMMaxEta %i fSMMaxPHI %i\n ETA eta(Z) (X)\n", | |
152 | fSMMaxEta,fSMPositionPhi.GetSize()); | |
153 | for(Int_t i=0; i<fSMMaxEta; i++) { | |
154 | printf("%3i | %8.3f %8.3f\n", i+1,fSMPositionEta[i].X(), fSMPositionEta[i].Y()); | |
155 | } | |
156 | printf("\n PHI (Y)\n"); | |
157 | for(Int_t i=0; i<fSMPositionPhi.GetSize(); i++) { | |
158 | printf("%3i | %8.3f\n",i+1, fSMPositionPhi[i]); | |
159 | } | |
160 | } | |
161 | ||
162 | void AliEMCALGeometryOfflineTrd1::PrintCell(Int_t absId) | |
163 | { | |
164 | Int_t nSupMod, nTower, nIphi, nIeta, iphi, ieta; | |
165 | if(fGeometry->GetCellIndex(absId, nSupMod,nTower,nIphi,nIeta)){ | |
166 | fGeometry->GetCellPhiEtaIndexInSModule(nTower,nIphi,nIeta, iphi,ieta); | |
167 | TVector3 *v = CellPosition(absId); | |
168 | printf("(%5i) X %8.3f Y %8.3f Z %8.3f | #sup.Mod %2i #tower %3i nIphi %1i nIeta %1i | iphi %2i ieta %2i\n", | |
169 | absId, v->X(),v->Y(),v->Z(), nSupMod,nTower,nIphi,nIeta, iphi,ieta); | |
170 | } else { | |
171 | Warning("PrintCell","Wrong abs id %i\n",absId); | |
172 | } | |
173 | } | |
174 | ||
175 | void AliEMCALGeometryOfflineTrd1::Browse(TBrowser* b) | |
176 | { | |
177 | if(fGeometry) b->Add(fGeometry); | |
178 | ||
179 | for(Int_t i=0; i<fMaxInEta; i++) if(fTrd1Modules[i]>0) b->Add(fTrd1Modules[i]); | |
180 | ||
181 | for(Int_t i=0; i<fNPhiSuperModule; i++){ | |
182 | b->Add(&fSuperModuleRotationZ[i], fNameSuperModuleRotationZ[i].Data()); | |
183 | for(Int_t j=0; j<2; j++) { | |
184 | TString name("rotationM_"); name += (2*i+j); | |
185 | b->Add(&fSuperModuleRotation[2*i+j], name.Data()); | |
186 | } | |
187 | } | |
188 | ||
189 | b->Add(&fSuperModuleRotationX, "rotationX_180"); | |
190 | ||
191 | b->Add(fXYZofCells); | |
192 | } | |
193 | ||
194 | Bool_t AliEMCALGeometryOfflineTrd1::IsFolder() const | |
195 | { | |
196 | return kTRUE; | |
197 | } |