/************************************************************************** * This file is property of and copyright by the Experimental Nuclear * * Physics Group, Dep. of Physics * * University of Oslo, Norway, 2007 * * * * Author: Per Thomas Hille for the ALICE HLT Project.* * Contributors are mentioned in the code where appropriate. * * Please report bugs to perthi@fys.uio.no * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ #include "AliHLTEMCALMapper.h" #include "AliHLTEMCALConstant.h" #include "assert.h" using namespace EmcalHLTConst; 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 } AliHLTEMCALMapper::~AliHLTEMCALMapper() { } // channelCoord[0] = (static_cast(channelId&0x3f) - NXCOLUMNSMOD/2)* fCellStep; // channelCoord[1] = (static_cast((channelId >> 6)&0x3f) - NZROWSMOD/2) * fCellStep; 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"); int nChannels = 0; int maxaddr = 0; int tmpHwaddr = 0; int tmpZRow = 0; int tmpXCol = 0; int tmpGain = 0; int res = 0; if(base !=0) { // int tmpddlindex = GetDDLFromSpec( specification )%2; sprintf(fFilepath, "%s/EMCAL/mapping/%s", base, DDL2RcuMapFileName( GetDDLFromSpec( specification ) ) ); sprintf(fFilepath, "%s/EMCAL/mapping/%s", base, DDL2RcuMapFileName( GetDDLFromSpec( specification ) ) ); // assert("DDL spec is %d", GetDDLFromSpec( specification ) ); cout << __FILE__ <<":"<< __LINE__ <<"DDL spec is " << GetDDLFromSpec( specification ) << endl; cout << __FILE__ <<":"<< __LINE__ <<"mapping filename is " << fFilepath << endl; // sprintf(fFilepath,"%s/PHOS/mapping/RCU0.data", base); FILE *fp = fopen(fFilepath, "r"); if(fp != 0) { res = fscanf(fp, "%d\n", &nChannels); res = fscanf(fp, "%d\n", &maxaddr); fHw2geomapPtr = new fAltromap[maxaddr +1]; for(int i=0; i< maxaddr + 1 ; i ++) { fHw2geomapPtr[i].fXCol = 0; fHw2geomapPtr[i].fZRow = 0; fHw2geomapPtr[i].fGain = 0; } for(int i=0; i