#ifndef DDataConversion_h #define DDataConversion_h #include #include #include #include #include "TObject.h" #include "TH1D.h" #include "TObjArray.h" #include "TGraph.h" #include "TGraphErrors.h" #include "DCrossSectionData.h" using namespace std; class DDataConversion : public TObject { public: //Graph to Hist static TH1D* Convert_GraphToHist(const TGraphErrors* locGraphErrors); //Hist to graph static TGraphErrors* Convert_HistToGraph(TH1D *locHist, bool locExcludeZeroesFlag = false); static TObjArray* Convert_HistArrayToGraphArray(TObjArray *locHistArray, bool locExcludeZeroesFlag = false); static TGraph* Convert_HistToGraph_NoErrors(TH1D *locHist, bool locExcludeZeroesFlag = false); static TObjArray* Convert_HistArrayToGraphArray_NoErrors(TObjArray *locHistArray, bool locExcludeZeroesFlag = false); //Graphs static TObjArray* Convert_DistroToMatch_GraphErrors(TObjArray *locDistroArrayToInterpolate, TObjArray *locDistroArrayToMatchTo, double locMinX = -100.0, double locMaxX = 100.0); static TGraphErrors* Convert_DistroToMatch(TGraphErrors *locGraph_DistroToConvert, TGraphErrors *locGraph_DistroToMatchTo, double locMinX = -100.0, double locMaxX = 100.0); static TGraphErrors* Reverse_PointOrder(TGraphErrors *locInputGraph); //Hists static TObjArray* Convert_DistroArrayToMatch_Hists(TObjArray *locDistroArrayToInterpolate, TObjArray *locDistroArrayToMatchTo); static TH1D* Convert_DistroToMatch(TH1D *locHist_DistroToConvert, TH1D *locHist_DistroToMatchTo); static void Interpolate_DistroToPoint(TH1D* locHist, double locPoint, double &locValue, double &locUncertainty, bool locPrintFlag); static TObjArray* Offset_Points_HistArray(TObjArray *locHistArray, double locOffset); static TH1D* Offset_Points(TH1D *locHist, double locOffset); //Deviations //assumes bins line up static void Calculate_AverageDeviationPercentageArray_GraphErrors(TObjArray *locDistroArrayToCompare, TObjArray *locDistroArrayToCompareTo, double locRangeMin = -1e9, double locRangeMax = 1e9); static double Calculate_AverageDeviationPercentage(TGraphErrors* locGraph_DistroToCompare, TGraphErrors* locGraph_DistroToCompareTo, double& locWeightedMeanNumerator_Total, double& locWeightedMeanDenominator_Total, double locRangeMin = -1e9, double locRangeMax = 1e9); static void Calculate_AverageDeviationPercentageArray_Hists(TObjArray *locDistroArrayToCompare, TObjArray *locDistroArrayToCompareTo, double locRangeMin = -1e9, double locRangeMax = 1e9); static double Calculate_AverageDeviationPercentage(TH1D* locHist_DistroToCompare, TH1D* locHist_DistroToCompareTo, double& locWeightedMeanNumerator_Total, double& locWeightedMeanDenominator_Total, double locRangeMin = -1e9, double locRangeMax = 1e9); //Cross Section Data static DCrossSectionData* Convert_CrossSection_WithGaps(DCrossSectionData* locCrossSectionData_ToConvert, DCrossSectionData* locCrossSectionData_ConvertTo); static DCrossSectionData* Convert_CrossSection_NearbyOnly(DCrossSectionData* locCrossSectionData_ToConvert, DCrossSectionData* locCrossSectionData_ConvertTo, double locMaxDistance); static DCrossSectionData* Convert_CrossSection_FillGaps(DCrossSectionData* locCrossSectionData_ToConvert, DCrossSectionData* locCrossSectionData_ConvertTo); static TGraphErrors* Interpolate_CrossSection_ToOtherBin(TGraphErrors* locGraphErrors_Low, TGraphErrors* locGraphErrors_High, double locFirstDimValue_Low, double locFirstDimValue_High, double locFirstDimValue_Target); ClassDef(DDataConversion, 1) }; #endif