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 // 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.)
25 // Author: Ivana Hrivnacova, IPN Orsay
27 #include <Riostream.h>
28 #include <TGeoMatrix.h>
29 #include <TObjString.h>
33 #include "AliMUONGeometryDEIndexing.h"
34 #include "AliMUONConstants.h"
36 ClassImp(AliMUONGeometryDEIndexing)
38 const Int_t AliMUONGeometryDEIndexing::fgkHemisphere = 50;
40 //______________________________________________________________________________
41 AliMUONGeometryDEIndexing::AliMUONGeometryDEIndexing(
42 Int_t moduleId, Int_t nofDetElements)
43 : AliMUONVGeometryDEIndexing(),
45 fNofDetElements(nofDetElements)
47 // Standard constructor
50 //______________________________________________________________________________
51 AliMUONGeometryDEIndexing::AliMUONGeometryDEIndexing()
52 : AliMUONVGeometryDEIndexing(),
56 // Ddefault constructor
59 //______________________________________________________________________________
60 AliMUONGeometryDEIndexing::~AliMUONGeometryDEIndexing() {
68 //______________________________________________________________________________
69 Int_t AliMUONGeometryDEIndexing::GetFirstDetElemId() const
71 // Get first detection element Id for chamber specified by moduleId
74 return (fModuleId+1)*100;
81 //______________________________________________________________________________
82 Int_t AliMUONGeometryDEIndexing::GetDetElementIndex(Int_t detElemId) const
84 // Returns the index of detector element specified by detElemId
87 if ( fNofDetElements == 0 ) {
88 AliFatal("The number of detection elements has not been set.");
92 Int_t index = detElemId - GetFirstDetElemId();
93 if (index >= fgkHemisphere)
94 index += - fgkHemisphere + fNofDetElements/2;
99 //______________________________________________________________________________
100 Int_t AliMUONGeometryDEIndexing::GetDetElementId(Int_t detElemIndex) const
102 // Returns the ID of detector element specified by index
105 if ( fNofDetElements == 0 ) {
106 AliFatal("The number of detection elements has not been set.");
110 Int_t detElemId = detElemIndex;
112 if ( detElemIndex >= fNofDetElements/2 )
113 detElemId += fgkHemisphere - fNofDetElements/2;
115 detElemId += GetFirstDetElemId();