1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________
19 // Geometry class for EMCAL : singleton
20 // EMCAL consists of layers of scintillator and lead
21 // with scintillator fiber arranged as "shish-kebab" skewers
22 // Places the the Barrel Geometry of The EMCAL at Midrapidity
23 // between 80 and 180(or 190) degrees of Phi and
26 // EMCAL geometry tree:
27 // EMCAL -> superModule -> module -> tower(cell)
29 // absId -> nSupMod -> nModule -> (nIphi,nIeta)
32 // EMCAL_PDC06 (geometry used for PDC06 simulations, kept for backward compatibility)
33 // = equivalent to SHISH_77_TRD1_2X2_FINAL_110DEG in old notation
34 // EMCAL_COMPLETE (geometry for expected complete detector)
35 // = equivalent to SHISH_77_TRD1_2X2_FINAL_110DEG scTh=0.176 pbTh=0.144
37 // EMCAL_FIRSTYEARV1 - geometry for December 2009 to December 2010 run period;
38 // fixed bug for positions of modules inside SM
39 // (first module has tilt 0.75 degree);
40 // the sizes updated with last information from production
41 // drawing (end of October 2010).
43 // EMCAL_COMPLETEV1: Same fixes as FIRSTYEAR and 10 SM instead of 10+2 half SM
45 // EMCAL_WSUC (Wayne State test stand)
46 // = no definite equivalent in old notation, was only used by
47 // Aleksei, but kept for testing purposes
53 //*-- Author: Sahal Yacoob (LBL / UCT)
54 // and : Yves Schutz (SUBATECH)
55 // and : Jennifer Klay (LBL)
56 // and : Alexei Pavlinov (WSU)
59 //--- Root header files ---
65 // // --- EMCAL headers
66 #include "AliEMCALGeometry.h"
67 #include "AliEMCALShishKebabTrd1Module.h"
68 //#include "AliEMCALRecPoint.h"
69 //#include "AliEMCALHistoUtilities.h"
71 ClassImp(AliEMCALGeometry)
73 // these initialisations are needed for a singleton
74 AliEMCALGeometry *AliEMCALGeometry::fgGeom = 0;
75 const Char_t* AliEMCALGeometry::fgkDefaultGeometryName = "EMCAL_COMPLETEV1";
78 // You can create the AliEMCALGeometry object independently from anything.
79 // You have to use just the correct name of geometry. If name is empty string the
80 // default name of geometry will be used.
82 // AliEMCALGeometry* g = AliEMCALGeometry::GetInstance(name,title); // first time
84 // g = AliEMCALGeometry::GetInstance(); // after first time
86 // MC: If you work with MC data you have to get geometry the next way:
87 // == =============================
88 // AliRunLoader *rl = AliRunLoader::Instance();
89 // AliEMCALGeometry *geom = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
90 // TGeoManager::Import("geometry.root");
92 AliEMCALGeometry::AliEMCALGeometry()
95 // default ctor only for internal usage (singleton)
96 // must be kept public for root persistency purposes,
97 // but should never be called by the outside world
99 AliDebug(2, "AliEMCALGeometry : default ctor ");
101 //______________________________________________________________________
102 AliEMCALGeometry::AliEMCALGeometry(const Text_t* name, const Text_t* title)
103 : AliEMCALGeoUtils(name, title)
105 // ctor only for internal usage (singleton)
106 AliDebug(2, Form("AliEMCALGeometry(%s,%s) ", name,title));
109 //______________________________________________________________________
110 AliEMCALGeometry::AliEMCALGeometry(const AliEMCALGeometry& geom)
111 : AliEMCALGeoUtils(geom)
116 //______________________________________________________________________
117 AliEMCALGeometry::~AliEMCALGeometry(void){
122 //______________________________________________________________________
123 AliEMCALGeometry * AliEMCALGeometry::GetInstance(){
124 // Returns the pointer of the unique instance
126 AliEMCALGeometry * rv = static_cast<AliEMCALGeometry *>( fgGeom );
130 //______________________________________________________________________
131 AliEMCALGeometry* AliEMCALGeometry::GetInstance(const Text_t* name,
132 const Text_t* title){
133 // Returns the pointer of the unique instance
135 AliEMCALGeometry * rv = 0;
137 if ( strcmp(name,"") == 0 ) { // get default geometry
138 fgGeom = new AliEMCALGeometry(fgkDefaultGeometryName, title);
140 fgGeom = new AliEMCALGeometry(name, title);
141 } // end if strcmp(name,"")
142 if ( AliEMCALEMCGeometry::fgInit ) rv = (AliEMCALGeometry * ) fgGeom;
149 if ( strcmp(fgGeom->GetName(), name) != 0) {
150 printf("\ncurrent geometry is %s : ", fgGeom->GetName());
151 printf(" you cannot call %s ",name);
153 rv = (AliEMCALGeometry *) fgGeom;
159 //________________________________________________________________________________________________
160 Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Double_t distEff, Double_t &xr, Double_t &yr, Double_t &zr) const
162 // Jul 30, 2007 - taking into account position of shower max
163 // Look to see what the relative
164 // position inside a given cell is
167 // absId - cell is as in Geant, 0<= absId < fNCells;
168 // e - cluster energy
170 // xr,yr,zr - x,y,z coordinates of cell with absId inside SM
172 // Shift index taking into account the difference between standard SM
173 // and SM of half size in phi direction
174 const Int_t kphiIndexShift = fCentersOfCellsPhiDir.GetSize()/4; // Nov 22, 2006; was 6 for cas 2X2
175 static Int_t nSupMod=0, nModule=-1, nIphi=-1, nIeta=-1, iphi=-1, ieta=-1;
176 static Int_t iphim=-1, ietam=-1;
177 static AliEMCALShishKebabTrd1Module *mod = 0;
179 if(!CheckAbsCellId(absId)) return kFALSE;
181 GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
182 GetModulePhiEtaIndexInSModule(nSupMod, nModule, iphim, ietam);
183 GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi, ieta);
185 //Get eta position. Careful with ALICE conventions (increase index decrease eta)
187 ietam = (fCentersOfCellsEtaDir.GetSize()/2-1)-ietam;// 47-ietam, revert the ordering on A side in order to keep convention.
188 if(nIeta == 0) nIeta = 1;
191 mod = GetShishKebabModule(ietam);
192 mod ->GetPositionAtCenterCellLine(nIeta, distEff, v);
193 xr = v.Y() - fParSM[0];
194 zr = v.X() - fParSM[2];
196 //Get phi position. Careful with ALICE conventions (increase index increase phi)
200 iphi2 = (fCentersOfCellsPhiDir.GetSize()-1)-iphi;// 23-iphi, revert the ordering on C side in order to keep convention.
201 yr = fCentersOfCellsPhiDir.At(iphi2);
205 iphi2 = (fCentersOfCellsPhiDir.GetSize()/2-1)-iphi;// 11-iphi, revert the ordering on C side in order to keep convention.
206 yr = fCentersOfCellsPhiDir.At(iphi2 + kphiIndexShift);
209 AliDebug(1,Form("absId %i nSupMod %i iphi %i ieta %i xr %f yr %f zr %f ",absId,nSupMod,iphi,ieta,xr,yr,zr));
214 //Not in use, comment for the moment
215 //________________________________________________________________________________________________
216 //Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Int_t maxAbsId, Double_t distEff, Double_t &xr, Double_t &yr, Double_t &zr) const
218 // // Jul 31, 2007 - taking into account position of shower max and apply coor2.
219 // // Look to see what the relative
220 // // position inside a given cell is
221 // // for a recpoint.
223 // // absId - cell is as in Geant, 0<= absId < fNCells;
224 // // maxAbsId - abs id of cell with highest energy
225 // // e - cluster energy
227 // // xr,yr,zr - x,y,z coordinates of cell with absId inside SM
229 // // Shift index taking into account the difference between standard SM
230 // // and SM of half size in phi direction
231 // const Int_t kphiIndexShift = fCentersOfCellsPhiDir.GetSize()/4; // Nov 22, 2006; was 6 for cas 2X2
232 // static Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta;
233 // static Int_t iphim, ietam;
234 // static AliEMCALShishKebabTrd1Module *mod = 0;
235 // static TVector2 v;
237 // static Int_t nSupModM, nModuleM, nIphiM, nIetaM, iphiM, ietaM;
238 // static Int_t iphimM, ietamM, maxAbsIdCopy=-1;
239 // static AliEMCALShishKebabTrd1Module *modM = 0;
240 // static Double_t distCorr;
242 // if(!CheckAbsCellId(absId)) return kFALSE;
244 // GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
245 // GetModulePhiEtaIndexInSModule(nSupMod, nModule, iphim, ietam);
246 // GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi, ieta);
248 // //Get eta position. Careful with ALICE conventions (increase index decrease eta)
249 // if(nSupMod%2 == 0) {
250 // ietam = (fCentersOfCellsEtaDir.GetSize()/2-1)-ietam;// 23-ietam, revert the ordering on A side in order to keep convention.
251 // if(nIeta == 0) nIeta = 1;
255 // mod = GetShishKebabModule(ietam);
257 // if(absId != maxAbsId) {
259 // if(maxAbsIdCopy != maxAbsId) {
260 // GetCellIndex(maxAbsId, nSupModM, nModuleM, nIphiM, nIetaM);
261 // GetModulePhiEtaIndexInSModule(nSupModM, nModuleM, iphimM, ietamM);
262 // GetCellPhiEtaIndexInSModule(nSupModM,nModuleM,nIphiM,nIetaM, iphiM, ietaM);
263 // //Careful with ALICE conventions (increase index decrease eta)
264 // if(nSupModM%2 == 0) {
265 // ietamM = (fCentersOfCellsEtaDir.GetSize()/2-1)-ietamM;// 47-ietam, revert the ordering on A side in order to keep convention.
268 // modM = GetShishKebabModule(ietamM); // do I need this ?
269 // maxAbsIdCopy = maxAbsId;
273 // distCorr = fEMCGeometry->GetEtaModuleSize()*(ietam-ietamM)/TMath::Tan(modM->GetTheta()); // Stay here
274 // //printf(" distCorr %f | dist %f | ietam %i -> etamM %i\n", distCorr, dist, ietam, ietamM);
276 // // distEff += distCorr;
278 // // Bad resolution in this case, strong bias vs phi
280 // mod->GetPositionAtCenterCellLine(nIeta, distEff, v); // Stay here
281 // xr = v.Y() - fParSM[0];
282 // zr = v.X() - fParSM[2];
284 // //Get phi position. Careful with ALICE conventions (increase index increase phi)
285 // Int_t iphi2 = iphi;
287 // if(nSupMod%2 != 0)
288 // iphi2 = (fCentersOfCellsPhiDir.GetSize()-1)-iphi;// 23-iphi, revert the ordering on C side in order to keep convention.
289 // yr = fCentersOfCellsPhiDir.At(iphi2);
292 // if(nSupMod%2 != 0)
293 // iphi2 = (fCentersOfCellsPhiDir.GetSize()/2-1)-iphi;// 11-iphi, revert the ordering on C side in order to keep convention.
294 // yr = fCentersOfCellsPhiDir.At(iphi2 + kphiIndexShift);
296 // AliDebug(1,Form("absId %i nSupMod %i iphi %i ieta %i xr %f yr %f zr %f ",absId,nSupMod,iphi,ieta,xr,yr,zr));
303 // == Shish-kebab cases ==
307 ////_________________________________________________________________________________
308 //void AliEMCALGeometry::GetGlobalEMCAL(const AliEMCALRecPoint *rp, TVector3 &vglob) const
310 // // Figure out the global numbering
311 // // of a given supermodule from the
312 // // local numbering for RecPoints
314 // static TVector3 vloc;
315 // static Int_t nSupMod, nModule, nIphi, nIeta;
317 // const AliEMCALRecPoint *rpTmp = rp;
318 // const AliEMCALRecPoint *rpEmc = rpTmp;
320 // GetCellIndex(rpEmc->GetAbsId(0), nSupMod, nModule, nIphi, nIeta);
321 // rpTmp->GetLocalPosition(vloc);
322 // GetGlobal(vloc, vglob, nSupMod);