13 # include <FMD/AliFMDAltroMapping.h> 28 Addr2Str(UInt_t ddl, UInt_t hwaddr, UShort_t timebin)
31 UInt_t board = (hwaddr >> 7) & 0x1F;
32 UInt_t chip = (hwaddr >> 4) & 0x7;
33 UInt_t chan = hwaddr & 0xF;
34 s = Form(
"(0x%05X,0x%02X,0x%1X,0x%1X,%04d)", ddl, board, chip, chan, timebin);
46 Det2Str(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, UShort_t sam)
49 s = Form(
"FMD%d%c[%2d,%3d]-%d", det, ring, sec, str, sam);
67 PrintTrans(UShort_t det, Char_t ring, UShort_t sec, Short_t str, UShort_t sam,
68 UInt_t ddl, UInt_t hwaddr, UShort_t timebin,
69 UShort_t odet, Char_t oring, UShort_t osec, Short_t ostr,
72 static TString s1, s2, s3;
73 s1 =
Det2Str(det, ring, sec, str, sam);
75 s3 =
Det2Str(odet, oring, osec, ostr, osam);
76 Info(
"TestHWMap",
"%s -> %s -> %s", s1.Data(), s2.Data(), s3.Data());
91 CheckTrans(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, UShort_t sam,
92 UInt_t ddl, UInt_t hwaddr, UShort_t timebin,
93 UShort_t odet, Char_t oring, UShort_t osec, UShort_t ostr,
98 Warning(
"TestHWMap",
"Detector # differ %d != %d", det, odet);
102 Warning(
"TestHWMap",
"Ring Id differ %c != %c", ring, oring);
106 Warning(
"TestHWMap",
"Sector # differ %d != %d", sec, osec);
111 Warning(
"TestHWMap",
"Strip # differ %d != %d", str, ostr);
115 Warning(
"TestHWMap",
"Sample # differ %d != %d", sam, osam);
122 odet,oring,osec,ostr,osam);
135 if (max < min) max = min;
138 UShort_t presamp = 19;
139 UShort_t oversamp = 4;
141 for (UShort_t det = min; det <= max; det++) {
142 for (UShort_t rng = 0; rng < 2; rng++) {
143 Char_t ring = (rng == 0 ?
'I' :
'O');
144 Int_t nsec = (ring ==
'I' ? 20 : 40);
145 Int_t nstr = (ring ==
'I' ? 512 : 256);
146 for (UShort_t sec = 0; sec < nsec; sec++) {
147 for (Short_t str = 0; str < nstr; str ++ ) {
148 for(UShort_t sam = 0; sam < oversamp; sam++) {
149 UShort_t ddl, hwaddr;
153 ddl, hwaddr, timebin)) {
154 Warning(
"TestHWMap",
"detector to hardware failed on %s",
155 Det2Str(det, ring, sec, str, sam));
158 UShort_t odet, osec, osam;
163 odet, oring, osec, ostr, osam)){
164 Warning(
"TestHWMap",
"hardware to detector failed on %s",
171 odet,oring,osec,ostr,osam);
174 odet,oring,osec,ostr,osam);
const Char_t * Addr2Str(UInt_t ddl, UInt_t hwaddr, UShort_t timebin)
Bool_t Hardware2Detector(UShort_t ddl, UShort_t hwaddr, UShort_t timebin, UShort_t preSamples, UShort_t sampleRate, UShort_t &det, Char_t &ring, UShort_t &sec, Short_t &str, UShort_t &sam) const
void TestAltroMapping(bool sa=false, Int_t min=1, Int_t max=3)
void CheckTrans(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, UShort_t sam, UInt_t ddl, UInt_t hwaddr, UShort_t timebin, UShort_t odet, Char_t oring, UShort_t osec, UShort_t ostr, UShort_t osam)
Bool_t Detector2Hardware(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, UShort_t sam, UShort_t preSamples, UShort_t sampleRate, UShort_t &ddl, UShort_t &board, UShort_t &altro, UShort_t &channel, UShort_t &timebin) const
Class that encodes a map to/from ALTRO hardware address to FMD detector coordinates.
void PrintTrans(UShort_t det, Char_t ring, UShort_t sec, Short_t str, UShort_t sam, UInt_t ddl, UInt_t hwaddr, UShort_t timebin, UShort_t odet, Char_t oring, UShort_t osec, Short_t ostr, UShort_t osam)
const Char_t * Det2Str(UShort_t det, Char_t ring, UShort_t sec, UShort_t str, UShort_t sam)