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(), fHw2geomapPtr(0)
30 // printf("\nCreating new mapper\n");
35 AliHLTPHOSMapper::~AliHLTPHOSMapper()
41 AliHLTPHOSMapper::InitAltroMapping()
43 // Loads mapping between Altro addresses and geometrical addresses from file
46 char *base = getenv("ALICE_ROOT");
56 sprintf(filename,"%s/PHOS/mapping/RCU0.data", base);
58 FILE *fp = fopen(filename, "r");
61 cout << "mapping file found" << endl;
62 fscanf(fp, "%d", &nChannels);
63 fscanf(fp, "%d", &maxaddr);
64 printf("nChannels = %d", nChannels);
65 printf("maxaddr = %d", maxaddr);
66 fHw2geomapPtr = new fAltromap[maxaddr +1];
68 for(int i=0; i< maxaddr + 1 ; i ++)
70 fHw2geomapPtr[i].fXCol = 0;
71 fHw2geomapPtr[i].fZRow = 0;
72 fHw2geomapPtr[i].fGain = 0;
75 for(int i=0; i<nChannels; i ++)
77 fscanf(fp, "%d %d %d %d\n", &tmpHwaddr, &tmpXCol, &tmpZRow, &tmpGain);
78 fHw2geomapPtr[tmpHwaddr].fXCol = tmpXCol;
79 fHw2geomapPtr[tmpHwaddr].fZRow = tmpZRow;
80 fHw2geomapPtr[tmpHwaddr].fGain = tmpGain;
86 cout << "ERROR could not find mapping file" << endl;
92 printf("AliHLTPHOSMapper::InitAltroMapping(), ERROR environment ALICE_ROOT is not set, cannot find mapping file");