]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONESDInterface.h
Version number incremented
[u/mrichter/AliRoot.git] / MUON / AliMUONESDInterface.h
CommitLineData
103e6575 1#ifndef ALIMUONESDINTERFACE_H
2#define ALIMUONESDINTERFACE_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5* See cxx source for full Copyright notice */
6
7// $Id$
8
9/// \ingroup rec
10/// \class AliMUONESDInterface
11/// \brief Converter between MUON track/cluster/digit and ESDMuon track/cluster/pad
12///
13// Author Philippe Pillot
14
15#include <AliMpExMap.h>
16#include <TObject.h>
17#include <TClonesArray.h>
18#include <TString.h>
19
20class AliMUONTrack;
21class AliMUONVTrackStore;
22class AliMUONVCluster;
23class AliMUONVClusterStore;
24class AliMUONVDigit;
25class AliMUONVDigitStore;
26class AliMUONTrackParam;
27class AliESDEvent;
28class AliESDMuonTrack;
29class AliESDMuonCluster;
30class AliESDMuonPad;
31class TIterator;
32
33class AliMUONESDInterface : public TObject
34{
35public: // methods to play with internal objects
36
37 AliMUONESDInterface();
38 virtual ~AliMUONESDInterface();
39
40 virtual void Clear(Option_t* = "");
41
42 void LoadEvent(AliESDEvent& esdEvent);
43
44 /// Return internal track store
45 AliMUONVTrackStore* GetTracks() const {return fTracks;}
46 /// Return internal track store
47 AliMUONVDigitStore* GetDigits() const {return fDigits;}
48
49 // Return numbers of tracks/clusters/digits
50 Int_t GetNTracks() const;
51 Int_t GetNClusters() const;
52 Int_t GetNClusters(Int_t iTrack) const;
53 Int_t GetNDigits() const;
54 Int_t GetNDigits(Int_t iTrack) const;
55 Int_t GetNDigits(Int_t iTrack, Int_t iCluster) const;
56 Int_t GetNDigitsInCluster(UInt_t clusterId) const;
57
58 // Return internal MUON objects (faster than finders)
59 // ordering of the MUON objects is the same as in ESD
60 AliMUONTrack* GetTrack(Int_t iTrack) const;
61 AliMUONVCluster* GetCluster(Int_t iTrack, Int_t iCluster) const;
62 AliMUONVDigit* GetDigit(Int_t iTrack, Int_t iCluster, Int_t iDigit) const;
63
64 // Quickly return internal MUON objects (indices unchecked)
65 // ordering of the MUON objects is the same as in ESD
66 AliMUONTrack* GetTrackFast(Int_t iTrack) const;
67 AliMUONVCluster* GetClusterFast(Int_t iTrack, Int_t iCluster) const;
68 AliMUONVDigit* GetDigitFast(Int_t iTrack, Int_t iCluster, Int_t iDigit) const;
69
70 // Find internal MUON objects (slower than getters)
71 AliMUONVCluster* FindCluster(UInt_t clusterId) const;
72 AliMUONVDigit* FindDigit(UInt_t digitId) const;
73
74 // iterate over internal MUON objects
75 TIterator* CreateTrackIterator() const;
76 TIterator* CreateClusterIterator() const;
77 TIterator* CreateClusterIterator(Int_t iTrack) const;
78 TIterator* CreateDigitIterator() const;
79 TIterator* CreateDigitIterator(Int_t iTrack) const;
80 TIterator* CreateDigitIterator(Int_t iTrack, Int_t iCluster) const;
81 TIterator* CreateDigitIteratorInCluster(UInt_t clusterId) const;
82
83
84public: // static methods
85
86 /// Set the version of track store
87 static void UseTrackStore(TString name) {fgTrackStoreName = name;}
88 /// Set the version of cluster store
89 static void UseClusterStore(TString name) {fgClusterStoreName = name;}
90 /// Set the version of digit store
91 static void UseDigitStore(TString name) {fgDigitStoreName = name;}
92
93 // Create empty stores (use the version defined in this interface)
94 static AliMUONVTrackStore* NewTrackStore();
95 static AliMUONVClusterStore* NewClusterStore();
96 static AliMUONVDigitStore* NewDigitStore();
97
98 // ESD track parameters --> MUON track parameters
99 static void GetParamAtVertex(const AliESDMuonTrack& esdTrack, AliMUONTrackParam& trackParam);
100 static void GetParamAtDCA(const AliESDMuonTrack& esdTrack, AliMUONTrackParam& trackParam);
101 static void GetParamAtFirstCluster(const AliESDMuonTrack& esdTrack, AliMUONTrackParam& trackParam);
102 static void GetParamCov(const AliESDMuonTrack& esdTrack, AliMUONTrackParam& trackParam);
103
104 // MUON track parameters --> ESD track parameters
105 static void SetParamAtVertex(const AliMUONTrackParam& trackParam, AliESDMuonTrack& esdTrack);
106 static void SetParamAtDCA(const AliMUONTrackParam& trackParam, AliESDMuonTrack& esdTrack);
107 static void SetParamAtFirstCluster(const AliMUONTrackParam& trackParam, AliESDMuonTrack& esdTrack);
108 static void SetParamCov(const AliMUONTrackParam& trackParam, AliESDMuonTrack& esdTrack);
109
110 // ESDMuon objects --> MUON objects conversion
111 static void ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONTrack& track);
112 static void ESDToMUON(const AliESDMuonCluster& esdCluster, AliMUONVCluster& cluster);
113 static void ESDToMUON(const AliESDMuonPad& esdPad, AliMUONVDigit& digit);
114
115 // MUON objects --> ESDMuon objects conversion
116 static void MUONToESD(const AliMUONTrack& track, AliESDMuonTrack& esdTrack, const Double_t vertex[3], const AliMUONVDigitStore* digits = 0x0);
117 static void MUONToESD(const AliMUONVCluster& cluster, AliESDMuonCluster& esdCluster, const AliMUONVDigitStore* digits = 0x0);
118 static void MUONToESD(const AliMUONVDigit& digit, AliESDMuonPad& esdPad);
119
120 // Add ESD object into the corresponding MUON store
121 // return a pointer to the corresponding MUON object into the store
122 static AliMUONTrack* Add(const AliESDMuonTrack& esdTrack, AliMUONVTrackStore& trackStore);
123 static AliMUONVCluster* Add(const AliESDMuonCluster& esdCluster, AliMUONVClusterStore& clusterStore);
124 static AliMUONVDigit* Add(const AliESDMuonPad& esdPad, AliMUONVDigitStore& digitStore);
125
126
127protected:
128
129 AliMUONESDInterface (const AliMUONESDInterface&); ///< copy constructor
130 AliMUONESDInterface& operator=(const AliMUONESDInterface&); ///< assignment operator
131
132
133private:
134
135 void Reset();
136 AliMUONVCluster* FindClusterInTrack(const AliMUONTrack& track, UInt_t clusterId) const;
137
138
139private:
140
141 static TString fgTrackStoreName; ///< class name of the track store to use
142 static TString fgClusterStoreName; ///< class name of the cluster store to use
143 static TString fgDigitStoreName; ///< class name of the digit store to use
144
145 // data containers
146 AliMUONVTrackStore* fTracks; ///< track container
147 AliMUONVDigitStore* fDigits; ///< digit container
148
149 // maps (to speed up data retrieval)
150 AliMpExMap* fTrackMap; ///< map of tracks
151 AliMpExMap* fClusterMap; ///< map of clusters
152 TClonesArray* fDigitMap; ///< map of digits
153
154
155 ClassDef(AliMUONESDInterface,0)
156};
157
158
159//___________________________________________________________________________
160inline AliMUONTrack* AliMUONESDInterface::GetTrackFast(Int_t iTrack) const
161{
162 /// return MUON track "iTrack" without any check
163 return (AliMUONTrack*) fTrackMap->GetObjectFast(iTrack);
164}
165
166//___________________________________________________________________________
167inline AliMUONVCluster* AliMUONESDInterface::GetClusterFast(Int_t iTrack, Int_t iCluster) const
168{
169 /// return MUON cluster numbered "iCluster" in track "iTrack" without any check
170 return (AliMUONVCluster*) ((AliMpExMap*) fClusterMap->GetObjectFast(iTrack))->GetObjectFast(iCluster);
171}
172
173//___________________________________________________________________________
174inline AliMUONVDigit* AliMUONESDInterface::GetDigitFast(Int_t iTrack, Int_t iCluster, Int_t iDigit) const
175{
176 /// return MUON digit numbered "iDigit" in cluster numbered "iCluster" of track "iTrack" without any check
177 return (AliMUONVDigit*) ((AliMpExMap*) ((AliMpExMap*) fDigitMap->UncheckedAt(iTrack))->GetObjectFast(iCluster))->GetObjectFast(iDigit);
178}
179
180
181#endif
182