-// $Id: AliHLTCalorimeterMapper.cxx 34622 2009-09-04 13:22:01Z odjuvsla $
+// $Id$
/**************************************************************************
* This file is property of and copyright by the Experimental Nuclear *
#include <iostream>
#include "AliHLTCaloCoordinate.h"
#include "AliHLTCaloConstantsHandler.h"
-#include "AliHLTCaloConstants.h"
+
+//#include "AliHLTCaloConstants.h"
+
+
+//typedef AliHLTCaloConstantsHandler::fCaloConstants->GetCELLSTEP() CELLSTEP;
+
+//#define fCaloConstants->GetCELLSTEP() CELLSTEP
+
+
+
+//typedef CELLSTEP fCaloConstants->GetCELLSTEP();
ClassImp(AliHLTCaloMapper);
AliHLTCaloMapper::AliHLTCaloMapper( const unsigned long specification , TString det) :
- AliHLTLogging(),
AliHLTCaloConstantsHandler(det),
+ AliHLTLogging(),
fHw2geomapPtr(0),
fCellSize(0),
fSpecification(specification),
fIsInitializedMapping(false),
- fSpecificationMapPtr(0)
+ fSpecificationMapPtr(0),
+ fCaloDet(det)
{
//see header file for class documentation
+ fFilepath[0] = '\0';
}
AliHLTCaloMapper::~AliHLTCaloMapper()
{
- delete [] fHw2geomapPtr;
- fHw2geomapPtr = 0;
+ if (fSpecificationMapPtr) delete [] fSpecificationMapPtr;
+ fSpecificationMapPtr = NULL;
+ if (fHw2geomapPtr) delete [] fHw2geomapPtr;
+ fHw2geomapPtr = NULL;
}
int
AliHLTCaloMapper::GetChannelID(const AliHLTUInt32_t spec, const Int_t hadd)
{
+ if (!fSpecificationMapPtr) return -ENODEV;
Short_t index = GetDDLFromSpec(spec);
if( index < 0 )
{
}
-
-// UShort_t
-// AliHLTCaloMapper::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);
-// // HLTError("Channel ID: 0x%X Coordinates: x = %d, z = %d, gain = %d", ((fHw2geomapPtr[hwAddress].fXCol + fSpecificationMapPtr[index].fRcuXOffset) |((fHw2geomapPtr[hwAddress].fZRow + fSpecificationMapPtr[index].fRcuZOffset) << 6) | (fHw2geomapPtr[hwAddress].fGain << 12) | fSpecificationMapPtr[index].fModId << 13),
-// // fHw2geomapPtr[hwAddress].fXCol,
-// // fHw2geomapPtr[hwAddress].fZRow,
-// // fHw2geomapPtr[hwAddress].fGain);
-// return ((fHw2geomapPtr[hwAddress].fXCol + fSpecificationMapPtr[index].fRcuXOffset) |
-// ((fHw2geomapPtr[hwAddress].fZRow + fSpecificationMapPtr[index].fRcuZOffset) << 6) |
-// (fHw2geomapPtr[hwAddress].fGain << 12) |
-// fSpecificationMapPtr[index].fModId << 13);
-// }
-
-
void
AliHLTCaloMapper::GetChannelCoord(const UShort_t channelId, UShort_t* channelCoord)
{
AliHLTCaloMapper::GetLocalCoord(const int channelId, Float_t* localCoord) const
{
localCoord[0] = (static_cast<Float_t>(channelId&0x3f) - fCaloConstants->GetNXCOLUMNSMOD()/2)* fCaloConstants->GetCELLSTEP();
+ // localCoord[0] = (static_cast<Float_t>(channelId&0x3f) - fCaloConstants->GetNXCOLUMNSMOD()/2)*CELLSTEP;
localCoord[1] = (static_cast<Float_t>((channelId >> 6)&0x3f) - fCaloConstants->GetNZROWSMOD()/2) * fCaloConstants->GetCELLSTEP();
// printf("Local coordinates: x = %f, z = %f\n", channelCoord[0], channelCoord[1]);
}
Int_t
-AliHLTCaloMapper::GetModuleFromSpec(Int_t specification)
+AliHLTCaloMapper::GetModuleFromSpec(UInt_t specification)
{
- Int_t module = -1;
-
- if(specification & 0xf) module = 0;
- else if((specification >> 4) & 0xf) module = 1;
- else if((specification >> 8) & 0xf) module = 2;
- else if((specification >> 12) & 0xf) module = 3;
- else if((specification >> 16) & 0xf) module = 4;
-
- else HLTError("Specification 0x%X not consistent with single module in PHOS", specification);
+ Int_t module = -1;
+ // get rid of too much string operations
+
+ // if (fCaloDet.CompareTo("PHOS") == 0) {
+
+ if (fCaloDet[0]=='P') {
+ // P = is the short for PHOS
+ // 1 module = 4 bits
+ if(specification & 0xf) module = 0;
+ else if((specification >> 4) & 0xf) module = 1;
+ else if((specification >> 8) & 0xf) module = 2;
+ else if((specification >> 12) & 0xf) module = 3;
+ else if((specification >> 16) & 0xf) module = 4;
+ else {
+ HLTDebug("Specification 0x%X not consistent with single module in PHOS", specification);
+ }
+
+ return module;
+ }
+ //else if (fCaloDet.CompareTo("EMCAL") == 0) {
+ else if (fCaloDet[0]=='E') {
+
+ // E = is the short for EMCAL
+ // 1 module = 2 bits
+ if(specification & 0x3) module = 0;
+ else if((specification >> 2) & 0x3) module = 1;
+ else if((specification >> 4) & 0x3) module = 2;
+ else if((specification >> 6) & 0x3) module = 3;
+ else if((specification >> 8) & 0x3) module = 4;
+ else if((specification >> 10) & 0x3) module = 5;
+ else if((specification >> 12) & 0x3) module = 6;
+ else if((specification >> 14) & 0x3) module = 7;
+ else if((specification >> 16) & 0x3) module = 8;
+ else if((specification >> 18) & 0x3) module = 9;
+ else {
+ HLTDebug("Specification 0x%X not consistent with single module in EMCAL", specification);
+ }
+ return module;
+
+ } else {
+ HLTDebug("Specification 0x%X not consistent with single module in EMCAL or PHOS", specification);
+ }
return module;
}