![]() |
![]() |
#include <string>
#include <vector>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <fstream>
#include <map>
#include <cmath>
#include <TFile.h>
#include <TH1F.h>
#include <TF1.h>
#include <TStyle.h>
#include <TMath.h>
Go to the source code of this file.
Classes | |
class | CommandLine |
Functions | |
void | CalculateCorrection (bool UseRatioForResponse, double x, double ex, double y, double ey, double &c, double &e) |
void | CalculateResponse (bool UseRatioForResponse, double x, double ex, double y, double ey, double &r, double &e) |
int | getBin (double x, std::vector< double > boundaries) |
void | GetMEAN (TH1F *histo, double &peak, double &error, double &sigma) |
void | GetMPV (char name[100], TH1F *histo, TDirectory *Dir, double &peak, double &error, double &sigma, double &err_sigma) |
bool | HistoExists (std::vector< std::string > LIST, std::string hname) |
void | Invert (TF1 *f, double Min, double Max, double y, double &x) |
void CalculateCorrection | ( | bool | UseRatioForResponse, |
double | x, | ||
double | ex, | ||
double | y, | ||
double | ey, | ||
double & | c, | ||
double & | e | ||
) |
Definition at line 474 of file Utilities.h.
References funct::pow(), mathSSE::sqrt(), and detailsBasic3DVector::y.
Referenced by main().
void CalculateResponse | ( | bool | UseRatioForResponse, |
double | x, | ||
double | ex, | ||
double | y, | ||
double | ey, | ||
double & | r, | ||
double & | e | ||
) |
Definition at line 452 of file Utilities.h.
References funct::pow(), mathSSE::sqrt(), and detailsBasic3DVector::y.
Referenced by main().
int getBin | ( | double | x, |
std::vector< double > | boundaries | ||
) |
void GetMEAN | ( | TH1F * | histo, |
double & | peak, | ||
double & | error, | ||
double & | sigma | ||
) |
void GetMPV | ( | char | name[100], |
TH1F * | histo, | ||
TDirectory * | Dir, | ||
double & | peak, | ||
double & | error, | ||
double & | sigma, | ||
double & | err_sigma | ||
) |
Definition at line 368 of file Utilities.h.
References a, gather_cfg::cout, g, funct::integral(), gen::k, siStripFEDMonitor_P5_cff::Max, plotscripts::mean(), siStripFEDMonitor_P5_cff::Min, lumiNorm::norm, and plotscripts::rms().
Referenced by main().
{ double norm,mean,rms,integral,lowlimit,highlimit,LowResponse,HighResponse,a; int k; LowResponse = histo->GetXaxis()->GetXmin(); HighResponse = histo->GetXaxis()->GetXmax(); Dir->cd(); TF1 *g; TStyle *myStyle = new TStyle("mystyle","mystyle"); myStyle->Reset(); myStyle->SetOptFit(1111); myStyle->SetOptStat(2200); myStyle->SetStatColor(0); myStyle->SetTitleFillColor(0); myStyle->cd(); integral = histo->Integral(); mean = histo->GetMean(); rms = histo->GetRMS(); a = 1.5; if (integral>0) { lowlimit = TMath::Max(LowResponse,mean-a*rms); highlimit= TMath::Min(mean+a*rms,HighResponse); norm = histo->GetMaximumStored(); peak = mean; sigma = rms; for (k=0; k<3; k++) { g = new TF1("g","gaus",lowlimit, highlimit); g->SetParNames("N","#mu","#sigma"); g->SetParameter(0,norm); g->SetParameter(1,peak); g->SetParameter(2,sigma); lowlimit = TMath::Max(LowResponse,peak-a*sigma); highlimit= TMath::Min(peak+a*sigma,HighResponse); g->SetRange(lowlimit,highlimit); histo->Fit(g,"RQ"); norm = g->GetParameter(0); peak = g->GetParameter(1); sigma = g->GetParameter(2); } if (g->GetNDF()>5) { peak = g->GetParameter(1); sigma = g->GetParameter(2); error = g->GetParError(1); err_sigma = g->GetParError(2); } else { std::cout<<"FIT FAILURE: histogram "<<name<<"...Using MEAN and RMS."<<std::endl; peak = mean; sigma = rms; error = histo->GetMeanError(); err_sigma = histo->GetRMSError(); } } else { peak = 0; sigma = 0; error = 0; err_sigma = 0; } histo->Write(); }
bool HistoExists | ( | std::vector< std::string > | LIST, |
std::string | hname | ||
) |
Definition at line 496 of file Utilities.h.
References gather_cfg::cout, newFWLiteAna::found, i, and MultiGaussianStateTransform::N.
Referenced by main().
{ unsigned int i,N; bool found(false); N = LIST.size(); if (N==0) std::cout<<"WARNING: empty file histogram list!!!!"<<std::endl; else for(i=0;i<N;i++) if (hname==LIST[i]) found = true; if (!found) std::cout<<"Histogram: "<<hname<<" NOT FOUND!!! Check list of existing objects."<<std::endl; return found; }
void Invert | ( | TF1 * | f, |
double | Min, | ||
double | Max, | ||
double | y, | ||
double & | x | ||
) |