Ignore:
Timestamp:
08/19/13 23:24:21 (11 years ago)
Author:
tbretz
Message:
Fixed some possible crashes at startup when some of the arrays do not yet have valid contents.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/smartfact.cc

    r17020 r17029  
    10781078        double power_apd = 0;
    10791079
    1080         // Calibrate the data (subtract offset)
    1081         for (int i=0; i<320; i++)
    1082         {
    1083             // Group index (0 or 1) of the of the pixel (4 or 5 pixel patch)
    1084             const int N = fPixelMap.hv(i).count();
    1085 
    1086             // Serial resistor of the individual G-APDs
    1087             double R5 = 3900/N;
    1088 
    1089             // This is also valid for the patches with wrong resistors,
    1090             // because Iapd is a factor f larger but R a factor f smaller
    1091             double Iapd = ptr[i] * 1e-6;  // [A]
    1092             double Iout = Iapd*N;         // [A]
    1093 
    1094             double UdrpCam =     1000 *Iout;  // Voltage seen by everything in Camera
    1095             double UdrpApd = (R5+2000)*Iout;  // Voltage seen by G-APD
    1096 
    1097             const double pwrCam = Iapd * (fBiasControlVoltageVec[i]-UdrpCam);
    1098             const double pwrApd = Iapd * (fBiasControlVoltageVec[i]-UdrpApd);
    1099 
    1100             // Total power participated in the camera at the G-APD
    1101             // and the serial resistors (total voltage minus voltage
    1102             // drop at resistors in bias crate)
    1103             power_tot += pwrCam;
    1104 
    1105             // Power consumption per G-APD
    1106             power_apd += pwrApd;
     1080        if (fBiasControlVoltageVec.size()>0)
     1081        {
     1082            // Calibrate the data (subtract offset)
     1083            for (int i=0; i<320; i++)
     1084            {
     1085                // Group index (0 or 1) of the of the pixel (4 or 5 pixel patch)
     1086                const int N = fPixelMap.hv(i).count();
     1087
     1088                // Serial resistor of the individual G-APDs
     1089                double R5 = 3900/N;
     1090
     1091                // This is also valid for the patches with wrong resistors,
     1092                // because Iapd is a factor f larger but R a factor f smaller
     1093                double Iapd = ptr[i] * 1e-6;  // [A]
     1094                double Iout = Iapd*N;         // [A]
     1095
     1096                double UdrpCam =     1000 *Iout;  // Voltage seen by everything in Camera
     1097                double UdrpApd = (R5+2000)*Iout;  // Voltage seen by G-APD
     1098
     1099                const double pwrCam = Iapd * (fBiasControlVoltageVec[i]-UdrpCam);
     1100                const double pwrApd = Iapd * (fBiasControlVoltageVec[i]-UdrpApd);
     1101
     1102                // Total power participated in the camera at the G-APD
     1103                // and the serial resistors (total voltage minus voltage
     1104                // drop at resistors in bias crate)
     1105                power_tot += pwrCam;
     1106
     1107                // Power consumption per G-APD
     1108                power_apd += pwrApd;
     1109            }
    11071110        }
    11081111
Note: See TracChangeset for help on using the changeset viewer.