//
#include "AliHLTPHOSMapper.h"
+#include "AliHLTPHOSConstants.h"
+#include "AliHLTLogging.h"
+#include "Rtypes.h"
+#include "unistd.h"
+#include <iostream>
-
-AliHLTPHOSMapper::AliHLTPHOSMapper() : AliHLTPHOSBase(),
+using namespace PhosHLTConst;
+AliHLTPHOSMapper::AliHLTPHOSMapper(): AliHLTLogging(),
fHw2geomapPtr(0),
- fIsInitializedMapping(false)
+ fIsInitializedMapping(false),
+ fSpecificationMapPtr(0)
{
InitAltroMapping();
+ InitDDLSpecificationMapping();
}
}
}
+void
+AliHLTPHOSMapper::InitDDLSpecificationMapping()
+{
+ fSpecificationMapPtr = new fDDLSpecificationMap[PhosHLTConst::N_MODULES*PhosHLTConst::N_RCUS_PER_MODULE];
+ for(Int_t ddl = 0; ddl < PhosHLTConst::N_MODULES*PhosHLTConst::N_RCUS_PER_MODULE; ddl++)
+ {
+
+ fSpecificationMapPtr[ddl].fModId = ddl/PhosHLTConst::N_RCUS_PER_MODULE;
+
+ if(ddl%4 == 0)
+ {
+ fSpecificationMapPtr[ddl].fRcuX = 0;
+ fSpecificationMapPtr[ddl].fRcuZ = 0;
+ }
+
+ else if(ddl%4 == 1)
+ {
+ fSpecificationMapPtr[ddl].fRcuX = 0;
+ fSpecificationMapPtr[ddl].fRcuZ = 1;
+ }
+
+ else if( ddl%4 == 2)
+ {
+ fSpecificationMapPtr[ddl].fRcuX = 1;
+ fSpecificationMapPtr[ddl].fRcuZ = 0;
+ }
+ else
+ {
+ fSpecificationMapPtr[ddl].fRcuX = 1;
+ fSpecificationMapPtr[ddl].fRcuZ = 1;
+ }
+
+ fSpecificationMapPtr[ddl].fRcuZOffset = N_ZROWS_RCU*(fSpecificationMapPtr[ddl].fRcuZ);
+ fSpecificationMapPtr[ddl].fRcuXOffset = N_XCOLUMNS_RCU*(fSpecificationMapPtr[ddl].fRcuX);
+ }
+}
+
bool
AliHLTPHOSMapper::GetIsInitializedMapping()
{
return fFilepath;
}
+
+UShort_t
+AliHLTPHOSMapper::GetChannelID(Int_t specification, Int_t hwAddress)
+{
+
+ Short_t index = 0;
+
+ if(specification == 0x00001) index = 0;
+ else if(specification == 0x00002) index = 1;
+ else if(specification == 0x00004) index = 2;
+ else if(specification == 0x00008) index = 3;
+
+ else if(specification == 0x00010) index = 4;
+ else if(specification == 0x00020) index = 5;
+ else if(specification == 0x00040) index = 6;
+ else if(specification == 0x00080) index = 7;
+
+ else if(specification == 0x00100) index = 8;
+ else if(specification == 0x00200) index = 9;
+ else if(specification == 0x00400) index = 10;
+ else if(specification == 0x00800) index = 11;
+
+ else if(specification == 0x01000) index = 12;
+ else if(specification == 0x02000) index = 13;
+ else if(specification == 0x04000) index = 14;
+ else if(specification == 0x08000) index = 15;
+
+ else if(specification == 0x10000) index = 16;
+ else if(specification == 0x20000) index = 17;
+ else if(specification == 0x40000) index = 18;
+ else if(specification == 0x80000) index = 19;
+
+ else HLTError("Specification 0x%X not consistent with single DDL in PHOS", specification);
+
+ return ((fHw2geomapPtr[hwAddress].fXCol + fSpecificationMapPtr[index].fRcuXOffset) |
+ ((fHw2geomapPtr[hwAddress].fZRow + fSpecificationMapPtr[index].fRcuZOffset) << 6) |
+ (fHw2geomapPtr[hwAddress].fGain << 12) |
+ fSpecificationMapPtr[index].fModId << 13);
+}
+
+void
+AliHLTPHOSMapper::GetChannelCoord(UShort_t channelId, UShort_t* channelCoord)
+{
+ channelCoord[0] = channelId&0x3f;
+ channelCoord[1] = (channelId >> 6)&0x3f;
+ channelCoord[2] = (channelId >> 12)&0x1;
+ channelCoord[3] = (channelId >> 13)&0x1f;
+}