Classes | |
class | QuadraticFit |
Functor(-ish) class to calculate fit of a quadratic to N data-points. More... | |
Functions | |
double | gauss_lin (double *x, double *par) |
TH1D * | InterpolatePulse (const TPulseIsland *pulse, std::string histname, std::string histtitle, bool interpolate, int refine) |
void | FillBinLabels (double *labels, int size, int start=-1, int increment=1) |
template<typename ValueType > | |
TH1F * | VectorToHist (const std::vector< ValueType > &vect, std::string name, std::string title) |
void functions::FillBinLabels | ( | double * | labels, | |
int | size, | |||
int | start = -1 , |
|||
int | increment = 1 | |||
) |
Definition at line 67 of file InterpolatePulse.cpp.
Referenced by VectorToHist().
double functions::gauss_lin | ( | double * | x, | |
double * | par | |||
) |
Definition at line 5 of file Functions.cpp.
Referenced by TGaussFitAnalysedPulse::Draw(), and GaussFitAPGenerator::GaussFitAPGenerator().
00005 { 00006 // parameters: 00007 // 0: constant (pedestal) 00008 // 1: gradient 00009 // 2: Gauss amplitude 00010 // 3: Gauss mean 00011 // 4: Gauss width 00012 Double_t arg=(x[0]-par[3])/par[4]; 00013 Double_t gauss1=par[2]*TMath::Exp(-0.5*arg*arg)/(2.5066283*par[4]); 00014 // function=gauss+constant background 00015 return gauss1+par[0] + par[1]*x[0]; 00016 }
TH1D * functions::InterpolatePulse | ( | const TPulseIsland * | pulse, | |
std::string | histname, | |||
std::string | histtitle, | |||
bool | interpolate, | |||
int | refine | |||
) |
Definition at line 10 of file InterpolatePulse.cpp.
References TPulseIsland::GetBankName(), TSetupData::GetDetectorName(), SetupNavigator::GetNoise(), TPulseIsland::GetSamples(), SetupNavigator::Instance(), and TSetupData::Instance().
Referenced by TemplateCreator::CreateRefinedPulseHistogram(), and TemplateFitAPGenerator::ProcessPulses().
00012 { 00013 00014 // Get a few things first 00015 const std::string& bankname = pulse->GetBankName(); 00016 const std::string detname = TSetupData::Instance()->GetDetectorName(bankname); 00017 const std::vector<int>& theSamples = pulse->GetSamples(); 00018 int n_samples = theSamples.size(); 00019 int n_bins = refine*n_samples; // number of bins in the template 00020 00021 // Create the higher resolution histogram 00022 TH1D* hist = new TH1D(histname.c_str(), histtitle.c_str(), n_bins, 0, n_samples); 00023 00024 double pedestal_error = SetupNavigator::Instance()->GetNoise(detname); 00025 00026 // Go through the bins in the high-resolution histogram 00027 // NB sample numbers go grom 0 to n-1 and bins go from 1 to n 00028 for (int i = 0; i < n_bins; ++i) { 00029 int bin = i+1; // bins go from 1 to n rather than 0 to n-1 00030 int sample_number = i / refine; 00031 double remainder = i % refine; 00032 double sample_value; 00033 00034 // We may want to interpolate between the samples in the samples vector 00035 if (interpolate) { 00036 try { 00037 sample_value = theSamples.at(sample_number) 00038 + (remainder / refine)*(theSamples.at(sample_number+1) 00039 - theSamples.at(sample_number)); 00040 } 00041 catch (const std::out_of_range& oor) { // if we'll be going out of range of the samples vector 00042 sample_value = theSamples.at(sample_number); 00043 } 00044 } 00045 else { 00046 sample_value = theSamples.at(sample_number); 00047 } 00048 00049 // Set the bin contents and bin error 00050 hist->SetBinContent( bin, sample_value); 00051 hist->SetBinError( bin, pedestal_error); 00052 } 00053 hist->SetDirectory(0); 00054 00055 return hist; 00056 }
TH1F* functions::VectorToHist | ( | const std::vector< ValueType > & | vect, | |
std::string | name, | |||
std::string | title | |||
) | [inline] |
Definition at line 18 of file InterpolatePulse.h.
References FillBinLabels().
Referenced by TemplateConvolver::CharacteriseTemplate(), and TTemplateConvolveAnalysedPulse::Draw().
00019 { 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 }