bug fixed
[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>
103e6575 17#include <TString.h>
630711ed 18#include "AliLog.h"
103e6575 19
20class AliMUONTrack;
21class AliMUONVTrackStore;
22class AliMUONVCluster;
23class AliMUONVClusterStore;
24class AliMUONVDigit;
25class AliMUONVDigitStore;
b1fea02e 26class AliMUONLocalTrigger;
67c201be 27class AliMUONTriggerTrack;
9f164762 28class AliMUONVTriggerTrackStore;
b1fea02e 29class AliMUONVTriggerStore;
103e6575 30class AliMUONTrackParam;
b1fea02e 31class AliMUONVTrackReconstructor;
103e6575 32class AliESDEvent;
33class AliESDMuonTrack;
34class AliESDMuonCluster;
35class AliESDMuonPad;
36class TIterator;
a0dc65b4 37class AliMUONRecoParam;
103e6575 38
39class AliMUONESDInterface : public TObject
40{
41public: // methods to play with internal objects
42
ad3c6eda 43 AliMUONESDInterface();
103e6575 44 virtual ~AliMUONESDInterface();
45
46 virtual void Clear(Option_t* = "");
47
a99c3449 48 void LoadEvent(AliESDEvent& esdEvent, Bool_t refit = kTRUE);
103e6575 49
50 /// Return internal track store
51 AliMUONVTrackStore* GetTracks() const {return fTracks;}
52 /// Return internal track store
53 AliMUONVDigitStore* GetDigits() const {return fDigits;}
b1fea02e 54 /// Return internal trigger store
55 AliMUONVTriggerStore* GetTriggers() const {return fTriggers;}
103e6575 56
57 // Return numbers of tracks/clusters/digits
58 Int_t GetNTracks() const;
59 Int_t GetNClusters() const;
630711ed 60 Int_t GetNClusters(UInt_t trackId) const;
103e6575 61 Int_t GetNDigits() const;
630711ed 62 Int_t GetNDigits(UInt_t trackId) const;
63 Int_t GetNDigits(UInt_t trackId, UInt_t clusterId) const;
103e6575 64 Int_t GetNDigitsInCluster(UInt_t clusterId) const;
b1fea02e 65 Int_t GetNTriggers() const;
103e6575 66
630711ed 67 // Find internal MUON objects
b1fea02e 68 AliMUONTrack* FindTrack(UInt_t trackId) const;
69 AliMUONVCluster* FindCluster(UInt_t clusterId) const;
70 AliMUONVCluster* FindCluster(UInt_t trackId, UInt_t clusterId) const;
71 AliMUONVDigit* FindDigit(UInt_t digitId) const;
72 AliMUONLocalTrigger* FindLocalTrigger(Int_t boardNumber) const;
103e6575 73
74 // iterate over internal MUON objects
75 TIterator* CreateTrackIterator() const;
76 TIterator* CreateClusterIterator() const;
630711ed 77 TIterator* CreateClusterIterator(UInt_t trackId) const;
103e6575 78 TIterator* CreateDigitIterator() const;
630711ed 79 TIterator* CreateDigitIterator(UInt_t trackId) const;
80 TIterator* CreateDigitIterator(UInt_t trackId, UInt_t clusterId) const;
103e6575 81 TIterator* CreateDigitIteratorInCluster(UInt_t clusterId) const;
b1fea02e 82 TIterator* CreateLocalTriggerIterator() const;
103e6575 83
84
85public: // static methods
86
a99c3449 87 // Reset the MUON tracker (using "recoParam" if provided)
88 static void ResetTracker(const AliMUONRecoParam* recoParam = 0x0, Bool_t info = kTRUE);
e285fab2 89 /// Return pointer to the MUON tracker if any (use first ResetTracker(...) to create it)
90 static AliMUONVTrackReconstructor* GetTracker() {return fgTracker;}
ad3c6eda 91
103e6575 92 /// Set the version of track store
93 static void UseTrackStore(TString name) {fgTrackStoreName = name;}
94 /// Set the version of cluster store
95 static void UseClusterStore(TString name) {fgClusterStoreName = name;}
96 /// Set the version of digit store
97 static void UseDigitStore(TString name) {fgDigitStoreName = name;}
b1fea02e 98 /// Set the version of trigger store
99 static void UseTriggerStore(TString name) {fgTriggerStoreName = name;}
103e6575 100
101 // Create empty stores (use the version defined in this interface)
102 static AliMUONVTrackStore* NewTrackStore();
103 static AliMUONVClusterStore* NewClusterStore();
104 static AliMUONVDigitStore* NewDigitStore();
b1fea02e 105 static AliMUONVTriggerStore* NewTriggerStore();
9f164762 106 static AliMUONVTriggerTrackStore* NewTriggerTrackStore();
103e6575 107
108 // ESD track parameters --> MUON track parameters
109 static void GetParamAtVertex(const AliESDMuonTrack& esdTrack, AliMUONTrackParam& trackParam);
110 static void GetParamAtDCA(const AliESDMuonTrack& esdTrack, AliMUONTrackParam& trackParam);
111 static void GetParamAtFirstCluster(const AliESDMuonTrack& esdTrack, AliMUONTrackParam& trackParam);
112 static void GetParamCov(const AliESDMuonTrack& esdTrack, AliMUONTrackParam& trackParam);
113
114 // MUON track parameters --> ESD track parameters
115 static void SetParamAtVertex(const AliMUONTrackParam& trackParam, AliESDMuonTrack& esdTrack);
116 static void SetParamAtDCA(const AliMUONTrackParam& trackParam, AliESDMuonTrack& esdTrack);
117 static void SetParamAtFirstCluster(const AliMUONTrackParam& trackParam, AliESDMuonTrack& esdTrack);
118 static void SetParamCov(const AliMUONTrackParam& trackParam, AliESDMuonTrack& esdTrack);
119
120 // ESDMuon objects --> MUON objects conversion
a99c3449 121 static void ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONTrack& track, Bool_t refit = kTRUE);
b1fea02e 122 static void ESDToMUON(const AliESDMuonTrack& esdTrack, AliMUONLocalTrigger& locTrg);
103e6575 123 static void ESDToMUON(const AliESDMuonCluster& esdCluster, AliMUONVCluster& cluster);
124 static void ESDToMUON(const AliESDMuonPad& esdPad, AliMUONVDigit& digit);
125
126 // MUON objects --> ESDMuon objects conversion
b1fea02e 127 static void MUONToESD(const AliMUONTrack& track, AliESDMuonTrack& esdTrack, const Double_t vertex[3],
128 const AliMUONVDigitStore* digits = 0x0, const AliMUONLocalTrigger* locTrg = 0x0);
67c201be 129 static void MUONToESD(const AliMUONLocalTrigger& locTrg, AliESDMuonTrack& esdTrack, UInt_t trackId,
130 const AliMUONTriggerTrack* triggerTrack = 0x0);
103e6575 131 static void MUONToESD(const AliMUONVCluster& cluster, AliESDMuonCluster& esdCluster, const AliMUONVDigitStore* digits = 0x0);
132 static void MUONToESD(const AliMUONVDigit& digit, AliESDMuonPad& esdPad);
133
134 // Add ESD object into the corresponding MUON store
135 // return a pointer to the corresponding MUON object into the store
a99c3449 136 static AliMUONTrack* Add(const AliESDMuonTrack& esdTrack, AliMUONVTrackStore& trackStore, Bool_t refit = kTRUE);
b1fea02e 137 static void Add(const AliESDMuonTrack& esdTrack, AliMUONVTriggerStore& triggerStore);
103e6575 138 static AliMUONVCluster* Add(const AliESDMuonCluster& esdCluster, AliMUONVClusterStore& clusterStore);
139 static AliMUONVDigit* Add(const AliESDMuonPad& esdPad, AliMUONVDigitStore& digitStore);
140
141
142protected:
143
144 AliMUONESDInterface (const AliMUONESDInterface&); ///< copy constructor
145 AliMUONESDInterface& operator=(const AliMUONESDInterface&); ///< assignment operator
146
147
148private:
149
150 void Reset();
151 AliMUONVCluster* FindClusterInTrack(const AliMUONTrack& track, UInt_t clusterId) const;
152
153
154private:
155
ad3c6eda 156 static AliMUONRecoParam* fgRecoParam; ///< reconstruction parameters for refitting
157 static AliMUONVTrackReconstructor* fgTracker; ///< track reconstructor for refitting
b1fea02e 158
103e6575 159 static TString fgTrackStoreName; ///< class name of the track store to use
160 static TString fgClusterStoreName; ///< class name of the cluster store to use
161 static TString fgDigitStoreName; ///< class name of the digit store to use
b1fea02e 162 static TString fgTriggerStoreName; ///< class name of the trigger store to use
9f164762 163 static TString fgTriggerTrackStoreName; ///< class name of the trigger track store to use
103e6575 164
165 // data containers
b1fea02e 166 AliMUONVTrackStore* fTracks; ///< track container
167 AliMUONVDigitStore* fDigits; ///< digit container
168 AliMUONVTriggerStore* fTriggers; ///< trigger container
103e6575 169
170 // maps (to speed up data retrieval)
630711ed 171 AliMpExMap* fClusterMap; ///< map of clusters
172 AliMpExMap* fDigitMap; ///< map of digits
b1fea02e 173
a0dc65b4 174
103e6575 175 ClassDef(AliMUONESDInterface,0)
176};
177
103e6575 178#endif
179