* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
+
#include "AliHLTEMCALMapper.h"
-#include "AliHLTEMCALConstants.h"
+//#include "AliHLTEMCALConstant.h"
+// #include "AliHLTCaloConstant.h"
+
+#include "assert.h"
-using namespace EmcalHLTConst;
+//using namespace EmcalHLTConst;
-//AliHLTCaloMapper
+#include "AliHLTCaloConstants.h"
+using EMCAL::NXCOLUMNSMOD;
+using EMCAL::NZROWSMOD;
+using EMCAL::NMODULES;
+using EMCAL::NRCUSPERMODULE;
+using EMCAL::NRCUSPERSECTOR;
-AliHLTEMCALMapper::AliHLTEMCALMapper(const unsigned long specification ) : AliHLTCaloMapper(specification)
+AliHLTEMCALMapper::AliHLTEMCALMapper(const unsigned long specification ) : AliHLTCaloMapper(specification, "EMCAL")
{
+ fCellSize = 6;
InitAltroMapping(specification);
InitDDLSpecificationMapping();
- fIsInitializedMapping = true; //CRAP PTH, must check is the initilization actually went ok
+ fIsInitializedMapping = true; //CRAP PTH, must check if the initilization actually went ok
}
{
}
-
+
void
+AliHLTEMCALMapper::GetLocalCoord(const int channelId, Float_t* localCoord) const
+{
+ localCoord[0] = ( ( Float_t )(channelId&0x3f) - NXCOLUMNSMOD/2) * fCellSize;
+ localCoord[1] = ( (Float_t)((channelId >> 6)&0x3f) - NZROWSMOD/2) * fCellSize;
+}
+
+
+Bool_t
AliHLTEMCALMapper::InitAltroMapping(const unsigned long specification )
{
char *base = getenv("ALICE_ROOT");
if(base !=0)
{
sprintf(fFilepath, "%s/EMCAL/mapping/%s", base, DDL2RcuMapFileName( GetDDLFromSpec( specification ) ) );
- cout << __FILE__ <<":"<< __LINE__ <<"mapping filename is " << fFilepath << endl;
- // sprintf(fFilepath,"%s/PHOS/mapping/RCU0.data", base);
+ sprintf(fFilepath, "%s/EMCAL/mapping/%s", base, DDL2RcuMapFileName( GetDDLFromSpec( specification ) ) );
+
FILE *fp = fopen(fFilepath, "r");
if(fp != 0)
{
{
res = fscanf(fp, "%d %d %d %d\n", &tmpHwaddr, &tmpXCol, &tmpZRow, &tmpGain);
- // cout << __FILE__ << __LINE__ << " tmpHwaddr = " << tmpHwaddr << ", tmpXCol = " << (int)tmpXCol << ", tmpZRow = "<< (int)tmpZRow << ", tmpGain= "<< (int)tmpGain << endl;
-
if(tmpGain < 2)
{
fHw2geomapPtr[tmpHwaddr].fXCol = (char)tmpXCol;
}
else
{
- cout << __FUNCTION__ << ":"<<__FILE__<<":"<< __LINE__ << "ERROR, could not open mapping file %s" << fFilepath << endl;
fIsInitializedMapping = false;
}
}
{
fIsInitializedMapping = false;
}
+
+ return fIsInitializedMapping;
}
void
AliHLTEMCALMapper::InitDDLSpecificationMapping()
{
- fSpecificationMapPtr = new fDDLSpecificationMap[EmcalHLTConst::NMODULES*EmcalHLTConst::NRCUSPERMODULE];
+ fSpecificationMapPtr = new fDDLSpecificationMap[NMODULES*NRCUSPERMODULE];
- for(Int_t ddl = 0; ddl < EmcalHLTConst::NMODULES*EmcalHLTConst::NRCUSPERMODULE; ddl++)
+ for(Int_t ddl = 0; ddl < NMODULES*NRCUSPERMODULE; ddl++)
{
- fSpecificationMapPtr[ddl].fModId = ddl/EmcalHLTConst::NRCUSPERMODULE;
- fSpecificationMapPtr[ddl].fRcuX = 0;
- fSpecificationMapPtr[ddl].fRcuZ = ddl%2;
- // fSpecificationMapPtr[ddl].fRcuZOffset = NZROWSRCU*(fSpecificationMapPtr[ddl].fRcuZ);
- // fSpecificationMapPtr[ddl].fRcuXOffset = NXCOLUMNSRCU*(fSpecificationMapPtr[ddl].fRcuX);
+ fSpecificationMapPtr[ddl].fModId = ddl/( NRCUSPERMODULE );
}
}
-
-
-//RCU1C.data
-
-
const char*
AliHLTEMCALMapper::DDL2RcuMapFileName(const int ddlIndex) const //0=4608, 1=4607 etc...
{
{
tmpSide = 'C';
}
-
- sprintf(rname,"RCU%d%c.data", ddlIndex/NRCUSPERSECTOR, tmpSide );
+ int tmprcuindex = ddlIndex%2;
+ sprintf(rname,"RCU%d%c.data", tmprcuindex, tmpSide );
+ //sprintf(rname,"RCU%d%c.data", ddlIndex/NRCUSPERSECTOR, tmpSide );
return rname;
- // rname.fSector = ddlIndex/NRCUSPERSECTOR;
-}
-
-
-/*
-unsigned long
-AliHLTEMCALMapper::GetSpecFromDDLIndex( const int ddlindex )
-{
- return ( (unsigned long)1 << ddlindex ));
-}
-*/
-
-/*
-AliHLTEMCALMapper::GlobalX2ModuleId( const int globalX )
-{
- return globalX/NXCOLUMNSMOD;
}
-*/
-
- /*
-static const int
-AliHLTEMCALMapper::GlobalZ2ModuleId( const int globalZ )
-{
- return globalZ/NZROWSMOD;
- }
- */
-
-
- /*
- const int
- AliHLTEMCALMapper::Global2ModuleId( const int globalZ, const int globalX )
-{
- int tmpModX =
-}
- */