00001 #ifndef UTILS_INTERPOLATEPULSE_H
00002 #define UTILS_INTERPOLATEPULSE_H
00003
00004 class TPulseIsland;
00005 #include <string>
00006 #include <vector>
00007 #include <TH1.h>
00008
00009 namespace functions{
00010
00011 TH1D* InterpolatePulse(
00012 const TPulseIsland* pulse, std::string histname,
00013 std::string histtitle, bool interpolate, int refine);
00014
00015 void FillBinLabels(double* labels, int size, int start=-1, int increment=1);
00016
00017 template<typename ValueType>
00018 TH1F* VectorToHist( const std::vector<ValueType>& vect, std::string name,
00019 std::string title){
00020 const int size=vect.size();
00021 double labels[size];
00022 FillBinLabels(labels,size);
00023 TH1F* hist=new TH1F(name.c_str(),title.c_str(), size,0,size);
00024 hist->FillN(size,labels,vect.data());
00025 hist->SetDirectory(0);
00026 return hist;
00027 }
00028
00029 }
00030
00031 using functions::InterpolatePulse;
00032
00033 #endif //UTILS_INTERPOLATEPULSE_H