]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/SMcalib/WriteBiasV30.C
Updated version of ITS QA Checker and related modifications (Melinda)
[u/mrichter/AliRoot.git] / EMCAL / SMcalib / WriteBiasV30.C
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 Float_t 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   int nNotFound = 0;
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!
59         i--; // go back to what we found
60         biasVoltage[icol][irow] = fCalib[i].fV30;
61         nFound++;
62       }
63       else {
64         biasVoltage[icol][irow] = defaultVoltage;
65         cout << " APD " << apdMap << " could not be found! " << endl;
66         nNotFound++;
67       }
68
69     }
70   }
71
72   cout << " found " << nFound << " matches " << endl;
73   cout << " did not find " << nNotFound << " APDs " << endl;
74
75   return;
76 }
77