Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

TimeCandle.cxx

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/FluxSvc/src/TimeCandle.cxx,v 1.1 2002/08/28 07:26:56 srobinsn Exp $
00002 
00003 
00004 #include "TimeCandle.h"
00005 
00006 #include "dom/DOM_Element.hpp"
00007 #include "xml/Dom.h"
00008 
00009 #include "FluxException.h" // for FATAL_MACRO
00010 #include <utility>
00011 #include <strstream>
00012 #include <cmath>
00013 #include "SpectrumFactory.h"
00014 
00015 static SpectrumFactory<TimeCandle> factory;
00016 //static SpectrumFactory<FILESpectrum> factory;
00017 const ISpectrumFactory& TimeCandleFactory = factory;
00018 
00019 TimeCandle::TimeCandle()
00020 :m_name("TimeTick")
00021 ,m_T0(30.)
00022 {}//default constructor
00023 TimeCandle::TimeCandle(const std::string& params)
00024 :m_name("TimeTick")
00025 ,m_T0(parseParamList(params,0))
00026 {}
00027 
00028 
00029 
00030 std::string TimeCandle::title()const
00031 {
00032     std::strstream s;
00033     s << particleName() << '(' << 1 << " GeV";
00034     //if( m_index >=1 ) s << ',' << m_index ;
00035     s << ")" << '\0';
00036     std::string t(s.str()); s.freeze(false);
00037     return t;
00038 }
00039 
00040 float
00041 TimeCandle::operator()(float f)const
00042 {
00043     return 1.;
00044 }
00045 
00046 const char*
00047 TimeCandle::particleName() const
00048 {
00049     return m_name.c_str();
00050 }
00051 
00052 //double TimeCandle::calculate_rate(double old_rate)
00053 //{
00054 //    return old_rate;
00055 //}
00056 
00057 float TimeCandle::parseParamList(std::string input, int index)
00058 {
00059     std::vector<float> output;
00060     int i=0;
00061     for(;!input.empty() && i!=std::string::npos;){
00062         float f = ::atof( input.c_str() );
00063         output.push_back(f);
00064         i=input.find_first_of(",");
00065         input= input.substr(i+1);
00066     } 
00067     return output[index];
00068 }

Generated on Wed Oct 16 14:01:31 2002 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001