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