| 41 | #include "G4UIcommand.hh" |
| 42 | |
| 43 | void G4ScoreLogColorMap::GetMapColor(G4double val, G4double color[4]) |
| 44 | { |
| 45 | G4bool lmin = true, lmax = true, lval = true; |
| 46 | if(fMinVal < 0.) |
| 47 | { |
| 48 | lmin = false; |
| 49 | G4String message = " The min. value (fMinVal) is negative. : "; |
| 50 | message += G4UIcommand::ConvertToString(fMinVal); |
| 51 | G4Exception("G4ScoreLogColorMap::GetMapColor()", |
| 52 | "DigiHitsUtilsScoreLogColorMap000", JustWarning, message); |
| 53 | } |
| 54 | if(fMaxVal < 0.) |
| 55 | { |
| 56 | lmax = false; |
| 57 | G4String message = " The max. value (fMaxVal) is negative. : "; |
| 58 | message += G4UIcommand::ConvertToString(fMaxVal); |
| 59 | G4Exception("G4ScoreLogColorMap::GetMapColor()", |
| 60 | "DigiHitsUtilsScoreLogColorMap001", JustWarning, message); |
| 61 | } |
| 62 | if(!lmin || !lmax) |
| 63 | { |
| 64 | color[0] = 0.; |
| 65 | color[1] = 0.; |
| 66 | color[2] = 0.; |
| 67 | color[3] = 0.; |
| 68 | return; |
| 69 | } |
| 70 | |
| 71 | if(val < 0.) |
| 72 | { |
| 73 | lval = false; |
| 74 | G4String message = " 'val' (first argument) is negative : "; |
| 75 | message += G4UIcommand::ConvertToString(fMaxVal); |
| 76 | G4Exception("G4ScoreLogColorMap::GetMapColor()", |
| 77 | "DigiHitsUtilsScoreLogColorMap002", JustWarning, message); |
| 78 | } |
| 79 | if(!lval) |
| 80 | { |
| 81 | color[0] = 0.; |
| 82 | color[1] = 0.; |
| 83 | color[2] = 0.; |
| 84 | color[3] = -1.; |
| 85 | return; |
| 86 | } |
| 87 | |
| 88 | G4double logmin = 0., logmax = 0., logval = 0.; |
| 89 | if(lmin) |
| 90 | { |
| 91 | if(fMinVal > 0.) |
| 92 | logmin = std::log10(fMinVal); |
| 93 | else |
| 94 | logmin = 0.; |
| 95 | } |
| 96 | if(lmax) |
| 97 | logmax = std::log10(fMaxVal); |
| 98 | if(lval) |
| 99 | logval = std::log10(val); |
| 100 | G4double value = 0.; |
no test coverage detected