/*************************************************************************** PNL_RgeHandler.cpp Author: Andreas Suter e-mail: andreas.suter@psi.ch $Id$ ***************************************************************************/ /*************************************************************************** * Copyright (C) 2009 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include #include "PNL_RgeHandler.h" //-------------------------------------------------------------------------- // Constructor //-------------------------------------------------------------------------- /** * */ PNL_RgeHandler::PNL_RgeHandler(const PStringVector &rgeDataPathList, const PDoubleVector &rgeDataEnergyList) { fIsValid = false; fIsValid = LoadRgeData(rgeDataPathList, rgeDataEnergyList); } //-------------------------------------------------------------------------- // Destructor //-------------------------------------------------------------------------- /** * */ PNL_RgeHandler::~PNL_RgeHandler() { fRgeDataList.clear(); } //-------------------------------------------------------------------------- // GetRgeEnergyIndex //-------------------------------------------------------------------------- /** * */ Int_t PNL_RgeHandler::GetRgeEnergyIndex(const Double_t energy) { Int_t idx = -1; for (UInt_t i=0; i dist) { distIdx = i-1; break; } } // get the proper n(z) value if (distIdx < 0) { rgeVal = 0.0; } else { rgeVal = fRgeDataList[index].stoppingAmplitude[distIdx] + (fRgeDataList[index].stoppingAmplitude[distIdx+1] - fRgeDataList[index].stoppingAmplitude[distIdx]) * (dist-fRgeDataList[index].stoppingDistance[distIdx])/(fRgeDataList[index].stoppingDistance[distIdx+1]-fRgeDataList[index].stoppingDistance[distIdx]); } return rgeVal; } //-------------------------------------------------------------------------- // GetRgeValue //-------------------------------------------------------------------------- /** * */ Double_t PNL_RgeHandler::GetRgeValue(const Double_t energy, const Double_t dist) { // check if energy is present in rge data list Int_t idx = -1; for (UInt_t i=0; i