1 /**************************************************************************
2 * This file is property of and copyright by the Experimental Nuclear *
3 * Physics Group, Dep. of Physics *
4 * University of Oslo, Norway, 2006 *
6 * Author: Per Thomas Hille perthi@fys.uio.no for the ALICE DCS Project. *
7 * Contributors are mentioned in the code where appropriate. *
8 * Please report bugs to perthi@fys.uio.no *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
20 // Mapping class fro mapping
21 // from hardware address to geometrical address
25 #include "AliHLTPHOSMapper.h"
28 AliHLTPHOSMapper::AliHLTPHOSMapper() : AliHLTPHOSBase(),
30 fIsInitializedMapping(false)
36 AliHLTPHOSMapper::~AliHLTPHOSMapper()
38 delete [] fHw2geomapPtr;
43 AliHLTPHOSMapper::InitAltroMapping()
45 // Loads mapping between Altro addresses and geometrical addresses from file
47 // char filename[256];
48 char *base = getenv("ALICE_ROOT");
58 sprintf(fFilepath,"%s/PHOS/mapping/RCU0.data", base);
60 FILE *fp = fopen(fFilepath, "r");
63 fscanf(fp, "%d", &nChannels);
64 fscanf(fp, "%d", &maxaddr);
65 fHw2geomapPtr = new fAltromap[maxaddr +1];
67 for(int i=0; i< maxaddr + 1 ; i ++)
69 fHw2geomapPtr[i].fXCol = 0;
70 fHw2geomapPtr[i].fZRow = 0;
71 fHw2geomapPtr[i].fGain = 0;
74 for(int i=0; i<nChannels; i ++)
76 fscanf(fp, "%d %d %d %d\n", &tmpHwaddr, &tmpXCol, &tmpZRow, &tmpGain);
77 fHw2geomapPtr[tmpHwaddr].fXCol = tmpXCol;
78 fHw2geomapPtr[tmpHwaddr].fZRow = tmpZRow;
79 fHw2geomapPtr[tmpHwaddr].fGain = tmpGain;
81 fIsInitializedMapping = true;
86 fIsInitializedMapping = false;
91 fIsInitializedMapping = false;
97 AliHLTPHOSMapper::GetIsInitializedMapping()
99 return fIsInitializedMapping;
104 AliHLTPHOSMapper::GetFilePath()