ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/bm409/QuantileError.h
Revision: 1.1
Committed: Wed Jul 7 10:51:54 2010 UTC (14 years, 9 months ago) by bm409
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 bm409 1.1 #include "TH1.h"
2     #include "TMath.h"
3     #include "TF1.h"
4    
5    
6     void QuantileError(TH1 *h1, int Number, double *whatever){
7    
8     TH1 *abs1;
9     abs1=(TH1F*)h1->Clone("abs1");
10    
11     double a = h1->GetXaxis()->GetNbins()+1;
12     for( Int_t i = 1; i <=a; i++){
13     double temp1 = h1->GetBinContent(i);
14     double temp2 = h1->GetBinContent(a-i);
15     if(i < h1->GetBin(81) ) {
16     abs1->SetBinContent(i,0);
17     }
18     else{ abs1->SetBinContent(i,temp1+temp2);}
19     }
20     double prob[Number];
21     for(int h = 0; h < Number; h++){
22     prob[h] = TMath::Erf((0.1*(h+1))/sqrt(2)) ; }
23    
24    
25     for(int h = 0; h < Number; h++){
26    
27     double small = 0.01;
28     double g = 0.000001;
29     while( g < (prob[h] + small)){
30     g += ((abs1->Integral(1,abs1->FindBin(g)-1)+(abs1->GetBinContent(abs1->FindBin(g))*(g - abs1->GetBinLowEdge(abs1->FindBin(g)))/abs1->GetBinWidth(81)))/ abs1->Integral());// /
31    
32     }
33    
34     double x = 0.000001;
35     while(x < prob[h]){
36     x+= ((abs1->Integral(1,abs1->FindBin(x)-1)+(abs1->GetBinContent(abs1->FindBin(x))*(x - abs1->GetBinLowEdge(abs1->FindBin(x)))/abs1->GetBinWidth(81)))/ abs1->Integral());// /
37     }
38     if((sqrt(prob[h]*(1-prob[h])/abs1->Integral())*(g-x) / small) > 0.05){
39     whatever[h] = sqrt(prob[h]*(1-prob[h])/abs1->Integral())*(g-x) / small;}
40     else{whatever[h] = sqrt(prob[h]*(1-prob[h]));}
41    
42     }
43    
44     }