00001
00002
00003
00004 #include "TimeCandle.h"
00005
00006 #include "dom/DOM_Element.hpp"
00007 #include "xml/Dom.h"
00008
00009 #include "FluxException.h"
00010 #include <utility>
00011 #include <strstream>
00012 #include <cmath>
00013 #include "SpectrumFactory.h"
00014
00015 static SpectrumFactory<TimeCandle> factory;
00016
00017 const ISpectrumFactory& TimeCandleFactory = factory;
00018
00019 TimeCandle::TimeCandle()
00020 :m_name("TimeTick")
00021 ,m_T0(30.)
00022 {}
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
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
00053
00054
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 }