/* */ const int debug = 0; // 0=quiet; 1=print some parameter info const int kMaxHV = 395; // default max voltage limit; could possibly be relaxed in future const int kBreakDownMargin = 5; // at least 5 V away from breakDown voltage.. static const int fgkEmCalRows = 24; // number of rows per module for EMCAL static const int fgkEmCalCols = 48; // number of columns per module for EMCAL Float_t previousVoltage[fgkEmCalCols][fgkEmCalRows]; Float_t gainFactor[fgkEmCalCols][fgkEmCalRows]; Float_t biasVoltage[fgkEmCalCols][fgkEmCalRows]; //____________________________________________________________________ void WriteNewBias(const char * inputDBName, const char * inputMapName, const char * previousVoltageFileName, const char * gainFactorFileName, const char * outputFileName) { ofstream outputFile(outputFileName); ReadFiles(previousVoltageFileName, gainFactorFileName); SetBiasVoltage(inputDBName, inputMapName); for (int icol=0; icol> icolp >> irowp >> pVoltage; gainFactorFile >> icolg >> irowg >> gFactor; previousVoltage[icolp][irowp] = pVoltage; gainFactor[icolg][irowg] = gFactor; } } previousVoltageFile.close(); gainFactorFile.close(); return; } //____________________________________________________________________ void SetBiasVoltage(const char * inputDBName, const char * inputMapName) { gSystem->Load("AliEMCALCalibAPD_cxx"); AliEMCALCalibAPD *calibAPD = new AliEMCALCalibAPD(); calibAPD->ReadCalibAPDInfo(10000, inputDBName); int fNCalibAPD = calibAPD->GetNCalibAPD(); AliEMCALCalibAPD::AliEMCALCalibAPDData * fCalib = calibAPD->GetCalibAPDData(); gSystem->Load("AliEMCALMapAPD_cxx"); AliEMCALMapAPD *mapAPD = new AliEMCALMapAPD(); int nSM = 1; mapAPD->ReadMapAPDInfo(nSM, inputMapName); AliEMCALMapAPD::AliEMCALSuperModuleMapAPD * fMap = mapAPD->GetSuperModuleData(); int nFound = 0; for (int icol=0; icol0 && par2>0 ) { newHV = log ( (newGain - par0)/par1 ) / par2; } // check results before returning.. if (newHV < 0) { // conversion failed: let's just keep the old custom value then newHV = initialHV; } if (newHV>kMaxHV) { // we reached a too high voltage: let's keep the max then newHV = kMaxHV; } // in case we increase the kMaxHV limit some time in the future we could // also enter get close to the Hamamatsu breakdown limit - let's avoid that if (newHV>breakDown) { newHV = breakDown - kBreakDownMargin; } return newHV; }