New parametrization of the geometry and new geometry interface (Working week effort)
[u/mrichter/AliRoot.git] / MUON / AliMUONGeometrySVMap.h
1 // $Id$
2 //
3 // Class AliMUONGeometrySVMap
4 // -----------------------------------
5 // As the detection element frame is different from the
6 // frame of the sensitive volume(s) defined in Geant,
7 // the sensitive volumes have to be mapped to the detection 
8 // elements. In the map, fSVMap, the sensitive voolumes are specified
9 // by the full path in the volume hierarchy, defined as:
10 //  /volname.copyNo/volName.copyNo1/...
11 //
12 // The array of global positions of sensitive volumes fSVPositions
13 // is included to make easier the verification of the assignements 
14 // in the fSVMap.
15 //
16 // Author: Ivana Hrivnacova, IPN Orsay
17
18 #ifndef ALI_MUON_GEOMETRY_SV_MAP_H
19 #define ALI_MUON_GEOMETRY_SV_MAP_H
20
21 #include <Riostream.h>
22 #include <TObject.h>
23 #include <TObjArray.h>
24 #include <TArrayI.h>
25
26 class TGeoCombiTrans;
27 class TGeoTranslation;
28
29 // Substitutes map <string, int>
30 // which ALICE does not allow to use 
31
32 class AliMUONStringIntMap : public TObject
33 {
34   public:
35     AliMUONStringIntMap();
36     virtual ~AliMUONStringIntMap();
37     
38     // methods
39     Bool_t  Add(const TString& first, Int_t second);
40     Int_t   Get(const TString& first) const;
41     Int_t   GetNofItems() const;
42     void    Clear();
43     virtual void Print(const char* /*option*/ = "") const;
44     void Print(const TString& key, ofstream& out) const;
45     
46   protected:
47     AliMUONStringIntMap(const AliMUONStringIntMap& rhs);
48
49     // operators  
50     AliMUONStringIntMap& operator = (const AliMUONStringIntMap& rhs);
51  
52   private:
53     // data members
54     Int_t      fNofItems;    // number of items
55     TObjArray  fFirstArray;  // first item array
56     TArrayI    fSecondArray; // second item array
57  
58   ClassDef(AliMUONStringIntMap,1)  // motif map
59 };    
60
61
62 class AliMUONGeometrySVMap : public TObject
63 {
64   public:
65     AliMUONGeometrySVMap(Int_t initSize);
66     AliMUONGeometrySVMap();
67     virtual ~AliMUONGeometrySVMap();
68
69     // methods
70     void Add(const TString& volumePath, 
71              Int_t detElemId);  
72     void AddPosition(const TString& volumePath, 
73              const TGeoTranslation& globalPosition);  
74
75     void Clear();
76     void ClearPositions();
77     void SortPositions();
78     virtual void Print(Option_t* option) const;
79     void PrintPositions() const;
80     void WriteMap(ofstream& out) const;
81     
82     // get methods
83     Int_t  GetDetElemId(const TString& volumePath) const;
84
85   protected:
86     AliMUONGeometrySVMap(const AliMUONGeometrySVMap& rhs);
87
88     // operators  
89     AliMUONGeometrySVMap& operator 
90       = (const AliMUONGeometrySVMap& rhs);
91   
92   private:
93     const TGeoCombiTrans* FindByName(const TString& name) const;
94
95     // data members
96     AliMUONStringIntMap  fSVMap;       // Map of sensitive volume paths
97                                        // and detector element id 
98     TObjArray            fSVPositions; // The array of transformations
99
100   ClassDef(AliMUONGeometrySVMap,1) // MUON sensitive volume map
101 };
102
103 #endif //ALI_MUON_GEOMETRY_TRANSFORM_STORE_H