Fixes for building of DA (Anshul)
[u/mrichter/AliRoot.git] / TPC / AliTPCmapper.h
CommitLineData
bb18c002 1#ifndef AliTPCmapper_H
2#define AliTPCmapper_H
3/* Copyright(c) 1998-2006, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
bdf99a93 6////////////////////////////////////////////////////////////////////////
7//
8// AliTPCmapper class
9// Class for all mapping functions (hardware coordinates <-> pad coordinates)
10// Author: Christian Lippmann
11//
12/////////////////////////////////////////////////////////////////////////
13
0e75e410 14#include <TObject.h>
bb18c002 15
accfa4d9 16class AliTPCAltroMapping;
bb18c002 17
accfa4d9 18class AliTPCmapper : public TObject{
bb18c002 19
20public:
21
07b9e95c 22 AliTPCmapper();
23 AliTPCmapper(const char * dirname);
accfa4d9 24 virtual ~AliTPCmapper();
25
26 AliTPCmapper& operator = (const AliTPCmapper& mapper);
27 AliTPCmapper(const AliTPCmapper& mapper);
28
0e46ed2e 29 void Init(const char * dirname);
30 //
fee88714 31 AliTPCAltroMapping **GetAltroMapping() { return fMapping; };
accfa4d9 32
33 // ALTRO mapping functions
34 Int_t GetPad(Int_t patch, Int_t hwAddress) const;
35 Int_t GetPad(Int_t patch, Int_t branch, Int_t fec, Int_t chip, Int_t channel) const;
bdf99a93 36 Int_t GetPadRow(Int_t patch, Int_t hwAddress) const;
37 Int_t GetPadRow(Int_t patch, Int_t branch, Int_t fec, Int_t chip, Int_t channel) const;
accfa4d9 38
39 // ALTRO mapping functions on roc level (padrow = 0 ... kNpadrowIROC, kNpadrowOROC)
40 Int_t GetHWAddress(Int_t roc, Int_t padrow, Int_t pad) const;
41 Int_t GetRcu(Int_t roc, Int_t padrow, Int_t pad) const;
42 Int_t GetPatch(Int_t roc, Int_t padrow, Int_t pad) const;
accfa4d9 43 Int_t GetBranch(Int_t roc, Int_t padrow, Int_t pad) const;
44 Int_t GetFEChw(Int_t roc, Int_t padrow, Int_t pad) const;
45 Int_t GetFEC(Int_t roc, Int_t padrow, Int_t pad) const;
46 Int_t GetChip(Int_t roc, Int_t padrow, Int_t pad) const;
47 Int_t GetChannel(Int_t roc, Int_t padrow, Int_t pad) const;
48
bdf99a93 49 // ALTRO mapping functions on sector level (globalpadrow = 0 ... kNpadrow)
50 Int_t GetGlobalPadRow(Int_t patch, Int_t hwAddress) const;
51 Int_t GetGlobalPadRow(Int_t patch, Int_t branch, Int_t fec, Int_t chip, Int_t channel) const;
52 Int_t GetHWAddressSector(Int_t globalpadrow, Int_t pad) const;
53 Int_t GetRcuSector(Int_t globalpadrow, Int_t pad) const;
54 Int_t GetPatchSector(Int_t globalpadrow, Int_t pad) const;
55 Int_t GetBranchSector(Int_t globalpadrow, Int_t pad) const;
56 Int_t GetFEChwSector(Int_t globalpadrow, Int_t pad) const;
57 Int_t GetFECSector(Int_t globalpadrow, Int_t pad) const;
58 Int_t GetChipSector(Int_t globalpadrow, Int_t pad) const;
59 Int_t GetChannelSector(Int_t globalpadrow, Int_t pad) const;
accfa4d9 60
61 // Coding and decoding of hardware addresses
62 Int_t CodeHWAddress(Int_t branch, Int_t fec, Int_t chip, Int_t channel) const;
63 Int_t DecodedHWAddressBranch(Int_t hwAddress) const;
64 Int_t DecodedHWAddressFECaddr(Int_t hwAddress) const;
65 Int_t DecodedHWAddressChipaddr(Int_t hwAddress) const;
66 Int_t DecodedHWAddressChanneladdr(Int_t hwAddress) const;
67
68 // Pad Geometry on sector level (padrow = 0 ... kNpadrow)
69 Int_t GetNpads(Int_t roc, Int_t padrow) const;
bdf99a93 70 Int_t GetNpads(Int_t globalpadrow) const;
accfa4d9 71 Int_t GetNpadrows(Int_t roc) const;
72 /*
bdf99a93 73 Double_t GetPadXlocal(Int_t globalpadrow) const;
74 Double_t GetPadYlocal(Int_t globalpadrow, Int_t pad) const;
75 Double_t GetPadXglobal(Int_t globalpadrow, Int_t pad, Int_t sector) const;
76 Double_t GetPadYglobal(Int_t globalpadrow, Int_t pad, Int_t sector) const;
77 Double_t GetPadWidth(Int_t globalpadrow) const;
78 Double_t GetPadLength(Int_t globalpadrow) const;
accfa4d9 79 */
80
81 // Conversion between hardware FEC numbering and official numbering
82 Int_t HwToOffline(Int_t patch, Int_t branch, Int_t fec) const;
83 Int_t OfflineToHwBranch(Int_t patch, Int_t fec) const;
84 Int_t OfflineToHwFec(Int_t patch, Int_t fec) const;
85
86 // More mapping functions
87 Int_t GetEquipmentID(Int_t roc, Int_t padrow, Int_t pad) const;
bdf99a93 88 Int_t GetEquipmentIDsector(Int_t side, Int_t sector, Int_t globalpadrow, Int_t pad) const;
accfa4d9 89 Int_t GetEquipmentIDfromPatch(Int_t side, Int_t sector, Int_t patch) const;
90 Int_t GetSectorFromRoc(Int_t roc) const;
91 Int_t GetSideFromRoc(Int_t roc) const;
92 Int_t GetRocFromPatch(Int_t side, Int_t sector, Int_t patch) const;
bdf99a93 93 Int_t GetRoc(Int_t side, Int_t sector, Int_t globalpadrow, Int_t pad) const;
accfa4d9 94 Int_t GetSideFromEquipmentID(Int_t equipmentID) const;
95 Int_t GetSectorFromEquipmentID(Int_t equipmentID) const;
96 Int_t GetRocFromEquipmentID(Int_t equipmentID) const;
97 Int_t GetPatchFromEquipmentID(Int_t equipmentID) const;
98
99 // Even more
100 Int_t GetNfec(Int_t patch, Int_t branch) const;
101 Int_t GetNfec(Int_t patch) const;
102 Bool_t IsIROC(Int_t roc) const;
103 Bool_t IsOROC(Int_t roc) const;
f6b5fa33 104
105 Int_t GetTpcDdlOffset() const {return fTpcDdlOffset;}
106 Int_t GetNumDdl() const {return fNside*fNsector*fNrcu; }
accfa4d9 107
108 private:
109
bdf99a93 110 Int_t fNside; // TPC has 2 sides
fee88714 111 Int_t fNsector; // TPC side has 18 sectors
112 Int_t fNrcu; // Sector has 6 RCUs (patches)
bdf99a93 113 Int_t fNbranch; // RCU has 2 branches
114 Int_t fNaltro; // FEC has 8 ALTROs
115 Int_t fNchannel; // ALTRO has 16 channels
116 Int_t fNpadrow; // Sector has 159 padrows
117 Int_t fNpadrowIROC; // IROC has 63 padrows
118 Int_t fNpadrowOROC; // OROC has 96 padrows
119
120 Int_t fTpcDdlOffset; // DDL offset for TPC
accfa4d9 121
122 AliTPCAltroMapping *fMapping[6]; // The ALTRO mapping for each patch (rcu)
accfa4d9 123
fee88714 124 ClassDef(AliTPCmapper,2)
bb18c002 125
bb18c002 126};
127
128#endif