//20201113 //MiuMorita // #ifndef FUNCTION_H #define FUNCTION_H int fitHisto(TH1* hist, TF1* fit, float *mean = NULL, float *sigma = NULL, float *emean = NULL){ hist -> Fit(fit->GetName(), "q"); if(mean !=NULL) *mean = fit -> GetParameter(1); if(sigma!=NULL) *sigma = fit -> GetParameter(2); if(emean!=NULL) *emean = fit -> GetParError(1); return 0; } //int AxisTitle(TGraph* graph, TString* title, string *xaxis = NULL, string *yaxis = NULL){ template < class TTemplate > int AxisTitle(TTemplate* plot, TString* title = NULL, string *xaxis = NULL, string *yaxis = NULL){ if(title != NULL){ plot -> SetTitle(Form("%s", title -> Data())); //cout<c_str()< SetTitle(Form("%s", title)); } if(xaxis != NULL)plot -> GetXaxis() -> SetTitle(Form("%s", xaxis)); if(yaxis != NULL)plot -> GetYaxis() -> SetTitle(Form("%s", yaxis)); plot -> GetXaxis() -> CenterTitle(); plot -> GetYaxis() -> CenterTitle(); return 0; } double sgn(double y){ if (y > 0)return 1; else if(y < 0)return -1; else return 0; } //int GetRankContent(TH1* h, Int_t num){ //int GetRankContent(TH1* hist){ //int NBIN = hist -> GetNbinsX(); //cout << hist -> GetNbinsX() << endl; //return hist -> GetNbinsX(); //int BIN_CONTENT[NBIN] = 0; //int RANK_CONTENT[NBIN] = 0; // //for(int i = 0; i < NBIN; i++){ // BIN_CONTENT[i] = h -> GetBinContent(i); //} //RANK_CONTENT[0] = h -> GetMaximum(); //for(int i = 1; i < NBIN; i++){ // for(int j = 0; j < NBIN; j++){ // if(RANK_CONTENT[i] < BIN_CONTENT[j] && BIN_CONTENT[j] < RANK_CONTENT[i - 1]){ // RANK_CONTENT[i] = BIN_CONTENT[j]; // } // } //} ////cout << RANK_CONTENT[num - 1] << endl; ////cout << RANK_CONTENT[3] << endl; // ////return RANK_CONTENT[num - 1]; //return RANK_CONTENT[3]; //} #endif