coding conventions
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSMapper.cxx
CommitLineData
2f09efe8 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 *
5 * *
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 *
9 * *
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 **************************************************************************/
18
19#include "AliHLTPHOSMapper.h"
20
c37f821f 21
22AliHLTPHOSMapper::AliHLTPHOSMapper() : AliHLTPHOSBase(), hw2geomapPtr(0)
2f09efe8 23{
24 // printf("\nCreating new mapper\n");
c37f821f 25 InitAltroMapping();
2f09efe8 26}
27
c37f821f 28
29AliHLTPHOSMapper::~AliHLTPHOSMapper()
2f09efe8 30{
c37f821f 31
32}
2f09efe8 33
c37f821f 34void
35AliHLTPHOSMapper::InitAltroMapping()
36{
37 char filename[256];
38 char *base = getenv("ALICE_ROOT");
c37f821f 39 int nChannels = 0;
40 int maxaddr = 0;
c37f821f 41 int tmpHwaddr = 0;
42 int tmpZRow = 0;
43 int tmpXCol = 0;
44 int tmpGain = 0;
45
46 if(base !=0)
2f09efe8 47 {
c37f821f 48 sprintf(filename,"%s/PHOS/mapping/RCU0.data", base);
49 // printf("AliHLTPHOSMapper::InitAltroMapping()")
50 FILE *fp = fopen(filename, "r");
51 if(fp != 0)
2f09efe8 52 {
c37f821f 53 cout << "mapping file found" << endl;
54 fscanf(fp, "%d", &nChannels);
55 fscanf(fp, "%d", &maxaddr);
56 printf("nChannels = %d", nChannels);
57 printf("maxaddr = %d", maxaddr);
58 hw2geomapPtr = new altromap[maxaddr +1];
59
43dd7c5e 60 for(int i=0; i< maxaddr + 1 ; i ++)
2f09efe8 61 {
9c9d15d6 62 hw2geomapPtr[i].xCol = 0;
63 hw2geomapPtr[i].zRow = 0;
c37f821f 64 hw2geomapPtr[i].gain = 0;
65 }
66
43dd7c5e 67
9c9d15d6 68 // printf("\n");
c37f821f 69
70 for(int i=0; i<nChannels; i ++)
71 {
72 fscanf(fp, "%d %d %d %d\n", &tmpHwaddr, &tmpXCol, &tmpZRow, &tmpGain);
73 // printf("tmpHwaddr = %d\t tmpXCol = %d\t tmpZRow = %d\t tmpGain = %d\n", tmpHwaddr, tmpXCol, tmpZRow, tmpGain);
74
9c9d15d6 75 hw2geomapPtr[tmpHwaddr].xCol = tmpXCol;
76 hw2geomapPtr[tmpHwaddr].zRow = tmpZRow;
c37f821f 77 hw2geomapPtr[tmpHwaddr].gain = tmpGain;
78
79 }
2f09efe8 80
9c9d15d6 81 // printf("\n");
c37f821f 82 // for(int i=0; i< nChannels; i ++)
83
84
85