Move AliWarning and AliInfo to AliDebug to reduce prints during reconstruction
[u/mrichter/AliRoot.git] / EMCAL / SMcalib / WriteBiasV30.C
CommitLineData
a8827307 1/*
2*/
3
4static const int fgkEmCalRows = 24; // number of rows per module for EMCAL
5static const int fgkEmCalCols = 48; // number of columns per module for EMCAL
6
cdb5074a 7Float_t biasVoltage[fgkEmCalCols][fgkEmCalRows];
a8827307 8
9//____________________________________________________________________
10void 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//____________________________________________________________________
27void 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;
c093846b 46 int nNotFound = 0;
a8827307 47 for (int icol=0; icol<fgkEmCalCols; icol++) {
48 for (int irow=0; irow<fgkEmCalRows; irow++) {
49
50 int apdMap = fMap[0].fAPDNum[icol][irow]; // 0 = nSM - 1
51 int i = 0;
52 int apdCalib = -1;
53 while (i<fNCalibAPD && apdMap!=apdCalib) {
54 apdCalib = fCalib[i].fAPDNum;
55 i++;
56 }
57
58 if (apdCalib == apdMap) { // found!
c093846b 59 i--; // go back to what we found
a8827307 60 biasVoltage[icol][irow] = fCalib[i].fV30;
61 nFound++;
62 }
63 else {
64 biasVoltage[icol][irow] = defaultVoltage;
c093846b 65 cout << " APD " << apdMap << " could not be found! " << endl;
66 nNotFound++;
a8827307 67 }
68
69 }
70 }
71
72 cout << " found " << nFound << " matches " << endl;
c093846b 73 cout << " did not find " << nNotFound << " APDs " << endl;
74
a8827307 75 return;
76}
77