Adding functions for iterating over motif positions
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpMotifMap.h
CommitLineData
dee1d5f1 1/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
3
5f91c9e8 4// $Id$
13985652 5// $MpId: AliMpMotifMap.h,v 1.14 2006/05/24 13:58:18 ivana Exp $
dee1d5f1 6
7/// \ingroup motif
8/// \class AliMpMotifMap
9/// \brief Motif map containers
13985652 10///
dee1d5f1 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///
13985652 17/// \author David Guez, Ivana Hrivnacova; IPN Orsay
5f91c9e8 18
19#ifndef ALI_MP_MOTIF_MAP_H
20#define ALI_MP_MOTIF_MAP_H
21
2a7ea2e6 22#include <TObject.h>
23
5006ec94 24#include "AliMpContainers.h"
25
f79c58a5 26#ifdef WITH_STL
5006ec94 27#include "AliMpIntPair.h"
f79c58a5 28#endif
5f91c9e8 29
5006ec94 30#ifdef WITH_ROOT
31#include "AliMpExMap.h"
32#endif
5f91c9e8 33
2a7ea2e6 34#ifdef WITH_STL
35#include <map>
a70d5d20 36#include <iterator>
2a7ea2e6 37#endif
5f91c9e8 38
39class AliMpVMotif;
40class AliMpMotifType;
41class AliMpMotifPosition;
ffb47139 42class AliMpMotifMap;
5f91c9e8 43
2a7ea2e6 44class TArrayI;
45class TString;
46class TVector2;
47
5f91c9e8 48class AliMpMotifMap : public TObject
49{
50 public:
5006ec94 51#ifdef WITH_STL
52 typedef std::map<TString, AliMpVMotif*> MotifMap;
53 typedef MotifMap::const_iterator MotifMapIterator;
54 typedef std::map<TString, AliMpMotifType*> MotifTypeMap;
55 typedef MotifTypeMap::const_iterator MotifTypeMapIterator;
56 typedef std::map<Int_t, AliMpMotifPosition*> MotiPositionMap;
57 typedef MotiPositionMap::const_iterator MotifPositionMapIterator;
58 typedef std::map<AliMpIntPair, AliMpMotifPosition*> MotifPositionMap2;
59 typedef MotifPositionMap2::const_iterator MotifPositionMap2Iterator;
60#endif
61#ifdef WITH_ROOT
62 typedef AliMpExMap MotifMap;
63 typedef AliMpExMap MotifTypeMap;
64 typedef AliMpExMap MotifPositionMap;
65 typedef AliMpExMap MotifPositionMap2;
66#endif
67
68 public:
69 AliMpMotifMap(Bool_t /*standardConstructor*/);
5f91c9e8 70 AliMpMotifMap();
71 virtual ~AliMpMotifMap();
72
73 // methods
74 Bool_t AddMotif(AliMpVMotif* motif, Bool_t warn = true);
75 Bool_t AddMotifType(AliMpMotifType* motifType, Bool_t warn = true);
76 Bool_t AddMotifPosition(AliMpMotifPosition* motifType, Bool_t warn = true);
77 void FillMotifPositionMap2();
6d5f608a 78 virtual void Print(const char* option = "ALL") const;
5f91c9e8 79 void PrintGlobalIndices(const char* fileName) const;
80 void UpdateGlobalIndices(const char* fileName);
81
82 // find methods
83 AliMpVMotif* FindMotif(const TString& motifID) const;
84 AliMpVMotif* FindMotif(const TString& motifID, const TString& motifTypeID,
ffb47139 85 const TVector2& padDimensions) const;
5f91c9e8 86 AliMpMotifType* FindMotifType(const TString& motifTypeID) const;
87 AliMpMotifPosition* FindMotifPosition(Int_t motifPositionID) const;
5f91c9e8 88
6d5f608a 89 /// Find all motifPositionsIDs (=electronicCardNumbers) handled by this map
a70d5d20 90 void GetAllMotifPositionsIDs(TArrayI& enc) const;
91 UInt_t GetNofMotifPositions() const;
92 AliMpMotifPosition* GetMotifPosition(UInt_t index) const;
3283cfc7 93
94 /// Calculate total number of pads defined in the map
95 Int_t CalculateNofPads() const;
6d5f608a 96
5f91c9e8 97 private:
98 // methods
f79c58a5 99 void PrintMotif(const AliMpVMotif* motif) const;
100 void PrintMotifType(const AliMpMotifType* motifType) const;
101 void PrintMotifPosition(const AliMpMotifPosition* motifPosition) const;
102 void PrintMotifPosition2(const AliMpMotifPosition* motifPosition) const;
5f91c9e8 103 void PrintMotifs() const;
104 void PrintMotifTypes() const;
105 void PrintMotifPositions() const;
106 void PrintMotifPositions2() const;
5f91c9e8 107
5f91c9e8 108 // data members
829425a5 109 MotifMap fMotifs; ///< motifs map
110 MotifTypeMap fMotifTypes; ///< motifs types map
5006ec94 111#ifdef WITH_STL
829425a5 112 std::map<Int_t, AliMpMotifPosition*> fMotifPositions; ///< motif positions map by Id
f79c58a5 113#endif
f79c58a5 114#ifdef WITH_ROOT
829425a5 115 MotifPositionMap fMotifPositions; ///< motifs positions map
f79c58a5 116#endif
829425a5 117 MotifPositionMap2 fMotifPositions2;///< motifs positions map
5f91c9e8 118
119 ClassDef(AliMpMotifMap,1) // motif map
120};
121
122#endif //ALI_MP_MOTIF_MAP_H