]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSMapper.cxx
som minor changes, committed to be in synch with build system
[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
2f09efe8 34
c37f821f 35void
36AliHLTPHOSMapper::InitAltroMapping()
37{
38 char filename[256];
39 char *base = getenv("ALICE_ROOT");
2f09efe8 40
c37f821f 41 int nChannels = 0;
42 int maxaddr = 0;
2f09efe8 43
c37f821f 44 int tmpHwaddr = 0;
45 int tmpZRow = 0;
46 int tmpXCol = 0;
47 int tmpGain = 0;
48
49 if(base !=0)
2f09efe8 50 {
c37f821f 51 sprintf(filename,"%s/PHOS/mapping/RCU0.data", base);
52 // printf("AliHLTPHOSMapper::InitAltroMapping()")
53 FILE *fp = fopen(filename, "r");
54 if(fp != 0)
2f09efe8 55 {
c37f821f 56 cout << "mapping file found" << endl;
57 fscanf(fp, "%d", &nChannels);
58 fscanf(fp, "%d", &maxaddr);
59 printf("nChannels = %d", nChannels);
60 printf("maxaddr = %d", maxaddr);
61 hw2geomapPtr = new altromap[maxaddr +1];
62
63
43dd7c5e 64 for(int i=0; i< maxaddr + 1 ; i ++)
2f09efe8 65 {
c37f821f 66 hw2geomapPtr[i].col = 0;
67 hw2geomapPtr[i].row = 0;
68 hw2geomapPtr[i].gain = 0;
69 }
70
43dd7c5e 71
c37f821f 72 printf("\n");
73
74 for(int i=0; i<nChannels; i ++)
75 {
76 fscanf(fp, "%d %d %d %d\n", &tmpHwaddr, &tmpXCol, &tmpZRow, &tmpGain);
77 // printf("tmpHwaddr = %d\t tmpXCol = %d\t tmpZRow = %d\t tmpGain = %d\n", tmpHwaddr, tmpXCol, tmpZRow, tmpGain);
78
79 hw2geomapPtr[tmpHwaddr].col = tmpXCol;
80 hw2geomapPtr[tmpHwaddr].row = tmpZRow;
81 hw2geomapPtr[tmpHwaddr].gain = tmpGain;
82
83 }
2f09efe8 84
c37f821f 85 printf("\n");
86 // for(int i=0; i< nChannels; i ++)
87
88
89