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