]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpMotifMap.h
From Laurent
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpMotifMap.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 // $MpId: AliMpMotifMap.h,v 1.7 2005/08/26 15:43:36 ivana Exp $
6
7 /// \ingroup motif
8 /// \class AliMpMotifMap
9 /// \brief Motif map containers
10
11 /// The class defines:
12 /// - map of motif objects to their string IDs
13 /// - map of motif type objects to their string IDs
14 /// - map of motif position objects to their string IDs
15 /// - map of motif position objects to their global indices
16 ///
17 /// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
18
19 #ifndef ALI_MP_MOTIF_MAP_H
20 #define ALI_MP_MOTIF_MAP_H
21
22 #ifdef WITH_STL
23   #include <map>
24 #endif
25
26 #include <TObject.h>
27
28 #include "AliMpMotifTypes.h"
29
30 class TString;
31 class TVector2;
32
33 class AliMpVMotif;
34 class AliMpMotifType;
35 class AliMpMotifPosition;
36 class AliMpMotifMap;
37
38 class AliMpMotifMap : public TObject
39 {
40   public:
41     AliMpMotifMap();
42     virtual ~AliMpMotifMap();
43     
44     // methods
45     Bool_t  AddMotif(AliMpVMotif* motif, Bool_t warn = true);
46     Bool_t  AddMotifType(AliMpMotifType* motifType, Bool_t warn = true);
47     Bool_t  AddMotifPosition(AliMpMotifPosition* motifType, Bool_t warn = true);
48     void   FillMotifPositionMap2();
49     virtual void Print(const char* /*option*/ = "") const;
50     void   PrintGlobalIndices(const char* fileName) const;
51     void   UpdateGlobalIndices(const char* fileName);
52    
53     // find methods
54     AliMpVMotif*  FindMotif(const TString& motifID) const;
55     AliMpVMotif*  FindMotif(const TString& motifID, const TString& motifTypeID, 
56                             const TVector2& padDimensions) const;
57     AliMpMotifType*      FindMotifType(const TString& motifTypeID) const;
58     AliMpMotifPosition*  FindMotifPosition(Int_t motifPositionID) const;
59     // AliMpMotifPosition*  FindMotifPosition(const AliMpIntPair& indices) const;
60
61   private:
62 #ifdef WITH_ROOT
63     static const Int_t   fgkSeparator;  // the separator used for conversion
64                                         // of TString to Int_t
65     
66     // methods
67     Int_t  GetIndex(const TString& s) const;
68     Int_t  GetIndex(const AliMpIntPair& pair) const;
69     TString  GetString(Int_t index) const;
70     AliMpIntPair  GetPair(Int_t index) const;
71 #endif
72   
73     // methods
74     void  PrintMotif(const AliMpVMotif* motif) const;
75     void  PrintMotifType(const AliMpMotifType* motifType) const;
76     void  PrintMotifPosition(const AliMpMotifPosition* motifPosition) const;
77     void  PrintMotifPosition2(const AliMpMotifPosition* motifPosition) const;
78     void  PrintMotifs() const;
79     void  PrintMotifTypes() const;
80     void  PrintMotifPositions() const;
81     void  PrintMotifPositions2() const;
82  
83 #ifdef WITH_STL
84 #ifdef __HP_aCC
85     // data members
86             // EXCLUDED FOR CINT (does not compile on HP)
87     MotifMap          fMotifs; //! motifs map
88     MotifTypeMap      fMotifTypes; //!motif types map 
89     //MotifPositionMap  fMotifPositions;  //! motif positions map 
90                                           // not taken by cint
91     map<Int_t, AliMpMotifPosition*>  fMotifPositions; //! motif positions map by Id
92     MotifPositionMap2 fMotifPositions2; //! motif positions map
93 #else
94     // data members
95     MotifMap          fMotifs; // motifs map
96     MotifTypeMap      fMotifTypes; // motif types map 
97     //MotifPositionMap  fMotifPositions;  // motif positions map 
98                                           // not taken by cint
99     std::map<Int_t, AliMpMotifPosition*> fMotifPositions; // motif positions map by Id
100     MotifPositionMap2 fMotifPositions2; // motif positions map
101 #endif
102 #endif
103
104 #ifdef WITH_ROOT
105     // data members
106     mutable MotifMap           fMotifs;     //  motifs map
107     mutable MotifTypeMap       fMotifTypes; //  motifs types map
108     mutable MotifPositionMap   fMotifPositions; //  motifs positions map
109     mutable MotifPositionMap2  fMotifPositions2;//  motifs positions map
110 #endif
111
112   ClassDef(AliMpMotifMap,1)  // motif map
113 };
114
115 #endif //ALI_MP_MOTIF_MAP_H