]>
Commit | Line | Data |
---|---|---|
a8827307 | 1 | /* |
2 | */ | |
3 | ||
4 | static const int fgkEmCalRows = 24; // number of rows per module for EMCAL | |
5 | static const int fgkEmCalCols = 48; // number of columns per module for EMCAL | |
6 | ||
7 | int biasVoltage[fgkEmCalCols][fgkEmCalRows]; | |
8 | ||
9 | //____________________________________________________________________ | |
10 | void WriteBiasV30(const char * inputDBName, const char * inputMapName, | |
11 | const int defaultVoltage, const char * outputFileName) | |
12 | { | |
13 | ||
14 | ofstream outputFile(outputFileName); | |
15 | SetBiasVoltage(inputDBName, inputMapName, defaultVoltage); | |
16 | ||
17 | for (int icol=0; icol<fgkEmCalCols; icol++) { | |
18 | for (int irow=0; irow<fgkEmCalRows; irow++) { | |
19 | outputFile << icol << " " << irow << " " << biasVoltage[icol][irow] << endl; | |
20 | } | |
21 | } | |
22 | ||
23 | outputFile.close(); | |
24 | } | |
25 | ||
26 | //____________________________________________________________________ | |
27 | void SetBiasVoltage(const char * inputDBName, const char * inputMapName, | |
28 | const int defaultVoltage) | |
29 | { | |
30 | gSystem->Load("AliEMCALCalibAPD_cxx"); | |
31 | AliEMCALCalibAPD *calibAPD = new AliEMCALCalibAPD(); | |
32 | ||
33 | calibAPD->ReadCalibAPDInfo(10000, inputDBName); | |
34 | int fNCalibAPD = calibAPD->GetNCalibAPD(); | |
35 | AliEMCALCalibAPD::AliEMCALCalibAPDData * fCalib = calibAPD->GetCalibAPDData(); | |
36 | ||
37 | ||
38 | gSystem->Load("AliEMCALMapAPD_cxx"); | |
39 | AliEMCALMapAPD *mapAPD = new AliEMCALMapAPD(); | |
40 | ||
41 | int nSM = 1; | |
42 | mapAPD->ReadMapAPDInfo(nSM, inputMapName); | |
43 | AliEMCALMapAPD::AliEMCALSuperModuleMapAPD * fMap = mapAPD->GetSuperModuleData(); | |
44 | ||
45 | int nFound = 0; | |
46 | for (int icol=0; icol<fgkEmCalCols; icol++) { | |
47 | for (int irow=0; irow<fgkEmCalRows; irow++) { | |
48 | ||
49 | int apdMap = fMap[0].fAPDNum[icol][irow]; // 0 = nSM - 1 | |
50 | int i = 0; | |
51 | int apdCalib = -1; | |
52 | while (i<fNCalibAPD && apdMap!=apdCalib) { | |
53 | apdCalib = fCalib[i].fAPDNum; | |
54 | i++; | |
55 | } | |
56 | ||
57 | if (apdCalib == apdMap) { // found! | |
58 | i--; // go back to what we dound | |
59 | biasVoltage[icol][irow] = fCalib[i].fV30; | |
60 | nFound++; | |
61 | } | |
62 | else { | |
63 | biasVoltage[icol][irow] = defaultVoltage; | |
64 | } | |
65 | ||
66 | } | |
67 | } | |
68 | ||
69 | cout << " found " << nFound << " matches " << endl; | |
70 | return; | |
71 | } | |
72 |