]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONGeometryDEIndexing.cxx
Added <assert.h> include
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometryDEIndexing.cxx
CommitLineData
e118b27e 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 **************************************************************************/
15
16// $Id$
17//
18// Class AliMUONGeometryDEIndexing
19// -------------------------------
20// The class that provides conversion between the detection element Id
21// and the index in the array.
22// Used in storing DE transformations and segmentations.
23// (See more in the header file.)
24//
25// Author: Ivana Hrivnacova, IPN Orsay
26
27#include <Riostream.h>
28#include <TGeoMatrix.h>
29#include <TObjString.h>
30
31#include "AliLog.h"
32
33#include "AliMUONGeometryDEIndexing.h"
34#include "AliMUONConstants.h"
35
36ClassImp(AliMUONGeometryDEIndexing)
37
e768a44b 38const Int_t AliMUONGeometryDEIndexing::fgkHemisphere = 50;
39
e118b27e 40//______________________________________________________________________________
41AliMUONGeometryDEIndexing::AliMUONGeometryDEIndexing(
42 Int_t moduleId, Int_t nofDetElements)
43 : AliMUONVGeometryDEIndexing(),
44 fModuleId(moduleId),
45 fNofDetElements(nofDetElements)
46{
692de412 47/// Standard constructor
e118b27e 48}
49
50//______________________________________________________________________________
51AliMUONGeometryDEIndexing::AliMUONGeometryDEIndexing()
52 : AliMUONVGeometryDEIndexing(),
53 fModuleId(0),
54 fNofDetElements(0)
55{
692de412 56/// Default constructor
e118b27e 57}
58
59//______________________________________________________________________________
692de412 60AliMUONGeometryDEIndexing::~AliMUONGeometryDEIndexing()
61{
62/// Destructor
e118b27e 63}
64
65//
66// private methods
67//
68
69//______________________________________________________________________________
70Int_t AliMUONGeometryDEIndexing::GetFirstDetElemId() const
71{
692de412 72/// Get first detection element Id for chamber specified by moduleId
e118b27e 73
74 return (fModuleId+1)*100;
75}
76
77//
78// public methods
79//
80
81//______________________________________________________________________________
82Int_t AliMUONGeometryDEIndexing::GetDetElementIndex(Int_t detElemId) const
83{
692de412 84/// Returns the index of detector element specified by detElemId
e118b27e 85
86 if ( fNofDetElements == 0 ) {
87 AliFatal("The number of detection elements has not been set.");
88 return 0;
89 }
90
e768a44b 91 Int_t index = detElemId - GetFirstDetElemId();
92 if (index >= fgkHemisphere)
93 index += - fgkHemisphere + fNofDetElements/2;
94
95 return index;
e118b27e 96}
97
98//______________________________________________________________________________
99Int_t AliMUONGeometryDEIndexing::GetDetElementId(Int_t detElemIndex) const
100{
692de412 101/// Returns the ID of detector element specified by index
e118b27e 102
103 if ( fNofDetElements == 0 ) {
104 AliFatal("The number of detection elements has not been set.");
105 return 0;
106 }
107
e768a44b 108 Int_t detElemId = detElemIndex;
109
110 if ( detElemIndex >= fNofDetElements/2 )
111 detElemId += fgkHemisphere - fNofDetElements/2;
112
113 detElemId += GetFirstDetElemId();
114
115 return detElemId;
e118b27e 116}