ROBAST logo
/******************************************************************************
 * Copyright (C) 2006-, Akira Okumura                                         *
 * All rights reserved.                                                       *
 *****************************************************************************/

///////////////////////////////////////////////////////////////////////////////
//
// AMirror
//
// Mirror class
//
///////////////////////////////////////////////////////////////////////////////

#include "AMirror.h"
#include "TGraph.h"
#include "TGraph2D.h"

ClassImp(AMirror);

//_____________________________________________________________________________
AMirror::AMirror() {
  // Default constructor
  fReflectance = 1.0;
  SetLineColor(16);
}

//_____________________________________________________________________________
AMirror::AMirror(const char* name, const TGeoShape* shape,
                 const TGeoMedium* med)
    : AOpticalComponent(name, shape, med) {
  fReflectance = 1.0;
  SetLineColor(16);
}

//_____________________________________________________________________________
AMirror::~AMirror() {}

//_____________________________________________________________________________
Double_t AMirror::GetReflectance(Double_t lambda, Double_t angle) {
  // Return mirror reflectance for a photon whose wavelength is lambda, and
  // whose incident angle is "angle" (rad)
  // This method should be const but TGraph2D::Interpolate and TH2::Interpolate
  // are non-const methods.
  Double_t ret;

  if (fReflectance2D) {
    ret = fReflectance2D->Interpolate(lambda, angle); // non-const as of 6.18
  } else if (fReflectanceTH2) {
    ret = fReflectanceTH2->Interpolate(lambda, angle); // const since ROOT 6.19
  } else if (fReflectance1D) {
    ret = fReflectance1D->Eval(lambda); // const
  } else {
    ret = fReflectance;
  }

  ret = ret > 1 ? 1 : ret;
  ret = ret < 0 ? 0 : ret;

  return ret;
}
 AMirror.cxx:1
 AMirror.cxx:2
 AMirror.cxx:3
 AMirror.cxx:4
 AMirror.cxx:5
 AMirror.cxx:6
 AMirror.cxx:7
 AMirror.cxx:8
 AMirror.cxx:9
 AMirror.cxx:10
 AMirror.cxx:11
 AMirror.cxx:12
 AMirror.cxx:13
 AMirror.cxx:14
 AMirror.cxx:15
 AMirror.cxx:16
 AMirror.cxx:17
 AMirror.cxx:18
 AMirror.cxx:19
 AMirror.cxx:20
 AMirror.cxx:21
 AMirror.cxx:22
 AMirror.cxx:23
 AMirror.cxx:24
 AMirror.cxx:25
 AMirror.cxx:26
 AMirror.cxx:27
 AMirror.cxx:28
 AMirror.cxx:29
 AMirror.cxx:30
 AMirror.cxx:31
 AMirror.cxx:32
 AMirror.cxx:33
 AMirror.cxx:34
 AMirror.cxx:35
 AMirror.cxx:36
 AMirror.cxx:37
 AMirror.cxx:38
 AMirror.cxx:39
 AMirror.cxx:40
 AMirror.cxx:41
 AMirror.cxx:42
 AMirror.cxx:43
 AMirror.cxx:44
 AMirror.cxx:45
 AMirror.cxx:46
 AMirror.cxx:47
 AMirror.cxx:48
 AMirror.cxx:49
 AMirror.cxx:50
 AMirror.cxx:51
 AMirror.cxx:52
 AMirror.cxx:53
 AMirror.cxx:54
 AMirror.cxx:55
 AMirror.cxx:56
 AMirror.cxx:57
 AMirror.cxx:58
 AMirror.cxx:59
 AMirror.cxx:60