AtNuOscFitHistogram Class Reference

#include <AtNuOscFitHistogram.h>

List of all members.

Public Member Functions

 AtNuOscFitHistogram ()
 AtNuOscFitHistogram (Int_t bins, Double_t min, Double_t max)
 AtNuOscFitHistogram (TH1D *h_up_neg, TH1D *h_up_0, TH1D *h_up_pos, TH1D *h_dn_neg, TH1D *h_dn_0, TH1D *h_dn_pos, TH1D *h_lores)
 AtNuOscFitHistogram (const AtNuOscFitHistogram &hist)
 ~AtNuOscFitHistogram ()
void Fill (Double_t x, Double_t w, Int_t updn=0, Int_t chg=0)
void Add (AtNuOscFitHistogram *hist, Double_t scale=1.0)
Double_t GetEntries (Int_t updn, Int_t chg)
Double_t GetContent (Int_t bin, Int_t updn, Int_t chg)
Double_t GetContent (Double_t x, Int_t updn, Int_t chg)
Double_t GetTotalContent (Int_t updn, Int_t chg)
Double_t GetTotalContent ()
Int_t GetBins ()
Double_t GetMin ()
Double_t GetMax ()
Double_t GetCenter (Int_t bin)
void Scale (Double_t scale)
void Reset ()
void PrintMe ()
void Randomize (TRandom *random)
void MakeTH1D (const char *name, TH1D *&h_up_neg, TH1D *&h_up_0, TH1D *&h_up_pos, TH1D *&h_dn_neg, TH1D *&h_dn_0, TH1D *&h_dn_pos, TH1D *&h_lores)
void MakeTH1D (const char *name, TH1D *&h_up_neg, TH1D *&h_up_0, TH1D *&h_up_pos, TH1D *&h_dn_neg, TH1D *&h_dn_0, TH1D *&h_dn_pos, TH1D *&h_lores, TH1D *&h_neg, TH1D *&h_0, TH1D *&h_pos, TH1D *&h)
void Truncate ()

Private Member Functions

Int_t GetBin (Double_t x)

Private Attributes

Int_t fBins
Double_t fMin
Double_t fMax
Double_t fN_up_neg
Double_t fN_up_0
Double_t fN_up_pos
Double_t fN_dn_neg
Double_t fN_dn_0
Double_t fN_dn_pos
Double_t fN_low_res
Double_t * fX_up_neg
Double_t * fX_up_0
Double_t * fX_up_pos
Double_t * fX_dn_neg
Double_t * fX_dn_0
Double_t * fX_dn_pos
Double_t * fX_low_res

Detailed Description

Definition at line 10 of file AtNuOscFitHistogram.h.


Constructor & Destructor Documentation

AtNuOscFitHistogram::AtNuOscFitHistogram (  ) 

Definition at line 8 of file AtNuOscFitHistogram.cxx.

References n.

00009 {
00010   fBins = 1;
00011   fMin = 0.0;
00012   fMax = 1.0;
00013   
00014   fX_up_neg = new Double_t[fBins];
00015   for( Int_t n=0; n<fBins; n++ ){ fX_up_neg[n]=0.0; }
00016   fN_up_neg = 0.0;
00017 
00018   fX_up_0 = new Double_t[fBins];
00019   for( Int_t n=0; n<fBins; n++ ){ fX_up_0[n]=0.0; }
00020   fN_up_0 = 0.0;
00021 
00022   fX_up_pos = new Double_t[fBins];
00023   for( Int_t n=0; n<fBins; n++ ){ fX_up_pos[n]=0.0; }
00024   fN_up_pos = 0.0;  
00025 
00026   fX_dn_neg = new Double_t[fBins];
00027   for( Int_t n=0; n<fBins; n++ ){ fX_dn_neg[n]=0.0; }
00028   fN_dn_neg = 0.0;
00029 
00030   fX_dn_0 = new Double_t[fBins];
00031   for( Int_t n=0; n<fBins; n++ ){ fX_dn_0[n]=0.0; }
00032   fN_dn_0 = 0.0;
00033 
00034   fX_dn_pos = new Double_t[fBins];
00035   for( Int_t n=0; n<fBins; n++ ){ fX_dn_pos[n]=0.0; }
00036   fN_dn_pos = 0.0;  
00037 
00038   fX_low_res = new Double_t[fBins];
00039   for( Int_t n=0; n<fBins; n++ ){ fX_low_res[n]=0.0; }
00040   fN_low_res = 0.0;
00041 }

AtNuOscFitHistogram::AtNuOscFitHistogram ( Int_t  bins,
Double_t  min,
Double_t  max 
)

Definition at line 43 of file AtNuOscFitHistogram.cxx.

References fBins, fMax, fMin, fN_dn_0, fN_dn_neg, fN_dn_pos, fN_low_res, fN_up_0, fN_up_neg, fN_up_pos, fX_dn_0, fX_dn_neg, fX_dn_pos, fX_low_res, fX_up_0, fX_up_neg, fX_up_pos, and n.

00043                                                                                :
00044   fBins(bins), 
00045   fMin(min), 
00046   fMax(max)
00047 {
00048   if( fBins<1 ){
00049     std::cout << " error: bins<1, using 1 bin. " << std::endl;
00050     fBins=1;
00051   }
00052 
00053   // set maximum bins
00054   // if( fBins>100 ){
00055   //   std::cout << " error: bins>100, using 100 bins. " << std::endl;
00056   //   fBins=100;
00057   // }
00058  
00059   if( fMin==fMax ){
00060     std::cout << " error: min=max, shifting by +/-1. " << std::endl;
00061     fMin -= 1.0;
00062     fMax += 1.0;
00063   }
00064 
00065   if( fMin>fMax ){
00066     std::cout << " error: min>max, switching min and max. " << std::endl;
00067     Double_t temp_min = fMax;
00068     Double_t temp_max = fMin;
00069     fMin = temp_min;
00070     fMax = temp_max;
00071   }
00072 
00073   fX_up_neg = new Double_t[fBins];
00074   for( Int_t n=0; n<fBins; n++ ){ fX_up_neg[n]=0.0; }
00075   fN_up_neg = 0.0;
00076 
00077   fX_up_0 = new Double_t[fBins];
00078   for( Int_t n=0; n<fBins; n++ ){ fX_up_0[n]=0.0; }
00079   fN_up_0 = 0.0;
00080 
00081   fX_up_pos = new Double_t[fBins];
00082   for( Int_t n=0; n<fBins; n++ ){ fX_up_pos[n]=0.0; }
00083   fN_up_pos = 0.0;  
00084 
00085   fX_dn_neg = new Double_t[fBins];
00086   for( Int_t n=0; n<fBins; n++ ){ fX_dn_neg[n]=0.0; }
00087   fN_dn_neg = 0.0;
00088 
00089   fX_dn_0 = new Double_t[fBins];
00090   for( Int_t n=0; n<fBins; n++ ){ fX_dn_0[n]=0.0; }
00091   fN_dn_0 = 0.0;
00092 
00093   fX_dn_pos = new Double_t[fBins];
00094   for( Int_t n=0; n<fBins; n++ ){ fX_dn_pos[n]=0.0; }
00095   fN_dn_pos = 0.0;  
00096 
00097   fX_low_res = new Double_t[fBins];
00098   for( Int_t n=0; n<fBins; n++ ){ fX_low_res[n]=0.0; }
00099   fN_low_res = 0.0;
00100 }

AtNuOscFitHistogram::AtNuOscFitHistogram ( TH1D *  h_up_neg,
TH1D *  h_up_0,
TH1D *  h_up_pos,
TH1D *  h_dn_neg,
TH1D *  h_dn_0,
TH1D *  h_dn_pos,
TH1D *  h_lores 
)

Definition at line 137 of file AtNuOscFitHistogram.cxx.

References fBins, fMax, fMin, fN_dn_0, fN_dn_neg, fN_dn_pos, fN_low_res, fN_up_0, fN_up_neg, fN_up_pos, fX_dn_0, fX_dn_neg, fX_dn_pos, fX_low_res, fX_up_0, fX_up_neg, fX_up_pos, and n.

00140 {
00141   fBins = h_lores->GetNbinsX();
00142   fMin = h_lores->GetBinLowEdge(1);
00143   fMax = h_lores->GetBinLowEdge(fBins+1);
00144 
00145   fX_up_neg = new Double_t[fBins];
00146   fN_up_neg = 0.0;
00147   if( h_up_neg ){
00148     for( Int_t n=0; n<fBins; n++ ){ fX_up_neg[n] = h_up_neg->GetBinContent(n+1); }
00149     fN_up_neg = h_up_neg->GetEntries();
00150   }
00151 
00152   fX_up_0 = new Double_t[fBins];
00153   fN_up_0 = 0.0;
00154   if( h_up_0 ){
00155     for( Int_t n=0; n<fBins; n++ ){ fX_up_0[n] = h_up_0->GetBinContent(n+1); }
00156     fN_up_0 = h_up_0->GetEntries();
00157   }
00158 
00159   fX_up_pos = new Double_t[fBins];
00160   fN_up_pos = 0.0;
00161   if( h_up_pos ){
00162     for( Int_t n=0; n<fBins; n++ ){ fX_up_pos[n] = h_up_pos->GetBinContent(n+1); }
00163     fN_up_pos = h_up_pos->GetEntries();
00164   }  
00165 
00166   fX_dn_neg = new Double_t[fBins];
00167   fN_dn_neg = 0.0;
00168   if( h_dn_neg ){
00169     for( Int_t n=0; n<fBins; n++ ){ fX_dn_neg[n] = h_dn_neg->GetBinContent(n+1); }
00170     fN_dn_neg = h_dn_neg->GetEntries();
00171   }
00172 
00173   fX_dn_0 = new Double_t[fBins];
00174   fN_dn_0 = 0.0;
00175   if( h_dn_0 ){
00176     for( Int_t n=0; n<fBins; n++ ){ fX_dn_0[n] = h_dn_0->GetBinContent(n+1); }
00177     fN_dn_0 = h_dn_0->GetEntries();
00178   }
00179 
00180   fX_dn_pos = new Double_t[fBins];
00181   fN_dn_pos = 0.0;
00182   if( h_dn_pos ){
00183     for( Int_t n=0; n<fBins; n++ ){ fX_dn_pos[n] = h_dn_pos->GetBinContent(n+1); }
00184     fN_dn_pos = h_dn_pos->GetEntries();
00185   }  
00186 
00187   fX_low_res = new Double_t[fBins];
00188   fN_low_res = 0.0;
00189   if( h_lores ){
00190     for( Int_t n=0; n<fBins; n++ ){ fX_low_res[n] = h_lores->GetBinContent(n+1); }
00191     fN_low_res = h_lores->GetEntries();
00192   }
00193 }

AtNuOscFitHistogram::AtNuOscFitHistogram ( const AtNuOscFitHistogram hist  ) 

Definition at line 102 of file AtNuOscFitHistogram.cxx.

References fBins, fN_dn_0, fN_dn_neg, fN_dn_pos, fN_low_res, fN_up_0, fN_up_neg, fN_up_pos, fX_dn_0, fX_dn_neg, fX_dn_pos, fX_low_res, fX_up_0, fX_up_neg, fX_up_pos, and n.

00102                                                                        :
00103   TObject(rhs),
00104   fBins(rhs.fBins),
00105   fMin(rhs.fMin),
00106   fMax(rhs.fMax)
00107 {
00108   fX_up_neg = new Double_t[fBins];
00109   for( Int_t n=0; n<fBins; n++ ){ fX_up_neg[n]=rhs.fX_up_neg[n]; }
00110   fN_up_neg = rhs.fN_up_neg;
00111 
00112   fX_up_0 = new Double_t[fBins];
00113   for( Int_t n=0; n<fBins; n++ ){ fX_up_0[n]=rhs.fX_up_0[n]; }
00114   fN_up_0 = rhs.fN_up_0;
00115 
00116   fX_up_pos = new Double_t[fBins];
00117   for( Int_t n=0; n<fBins; n++ ){ fX_up_pos[n]=rhs.fX_up_pos[n]; }
00118   fN_up_pos = rhs.fN_up_pos;  
00119 
00120   fX_dn_neg = new Double_t[fBins];
00121   for( Int_t n=0; n<fBins; n++ ){ fX_dn_neg[n]=rhs.fX_dn_neg[n]; }
00122   fN_dn_neg = rhs.fN_dn_neg;
00123 
00124   fX_dn_0 = new Double_t[fBins];
00125   for( Int_t n=0; n<fBins; n++ ){ fX_dn_0[n]=rhs.fX_dn_0[n]; }
00126   fN_dn_0 = rhs.fN_dn_0;
00127 
00128   fX_dn_pos = new Double_t[fBins];
00129   for( Int_t n=0; n<fBins; n++ ){ fX_dn_pos[n]=rhs.fX_dn_pos[n]; }
00130   fN_dn_pos = rhs.fN_dn_pos;  
00131 
00132   fX_low_res = new Double_t[fBins];
00133   for( Int_t n=0; n<fBins; n++ ){ fX_low_res[n]=rhs.fX_low_res[n]; }
00134   fN_low_res = rhs.fN_low_res;
00135 }

AtNuOscFitHistogram::~AtNuOscFitHistogram (  ) 

Definition at line 195 of file AtNuOscFitHistogram.cxx.

References fX_dn_0, fX_dn_neg, fX_dn_pos, fX_low_res, fX_up_0, fX_up_neg, and fX_up_pos.

00196 {
00197   delete [] fX_up_neg; 
00198   delete [] fX_up_0;  
00199   delete [] fX_up_pos; 
00200 
00201   delete [] fX_dn_neg; 
00202   delete [] fX_dn_0;  
00203   delete [] fX_dn_pos;
00204 
00205   delete [] fX_low_res;
00206 }


Member Function Documentation

void AtNuOscFitHistogram::Add ( AtNuOscFitHistogram hist,
Double_t  scale = 1.0 
)

Definition at line 225 of file AtNuOscFitHistogram.cxx.

References fN_dn_0, fN_dn_neg, fN_dn_pos, fN_low_res, fN_up_0, fN_up_neg, fN_up_pos, fX_dn_0, fX_dn_neg, fX_dn_pos, fX_low_res, fX_up_0, fX_up_neg, fX_up_pos, GetBins(), GetContent(), and GetEntries().

Referenced by AtNuOscFit::AddToExpectation().

00226 {
00227   if( this->GetBins()==hist->GetBins() ){
00228 
00229     for( Int_t bin=0; bin<this->GetBins(); bin++ ){      
00230       fX_up_neg[bin] += scale*hist->GetContent(bin,+1,-1); 
00231       fN_up_neg += hist->GetEntries(+1,-1);
00232                                                       
00233       fX_up_0[bin] += scale*hist->GetContent(bin,+1,0); 
00234       fN_up_0 += hist->GetEntries(+1,0);   
00235 
00236       fX_up_pos[bin] += scale*hist->GetContent(bin,+1,+1); 
00237       fN_up_pos += hist->GetEntries(+1,+1);      
00238 
00239       fX_dn_neg[bin] += scale*hist->GetContent(bin,-1,-1); 
00240       fN_dn_neg += hist->GetEntries(-1,-1);
00241                                                       
00242       fX_dn_0[bin] += scale*hist->GetContent(bin,-1,0); 
00243       fN_dn_0 += hist->GetEntries(-1,0);   
00244 
00245       fX_dn_pos[bin] += scale*hist->GetContent(bin,-1,+1); 
00246       fN_dn_pos += hist->GetEntries(-1,+1);      
00247 
00248       fX_low_res[bin] += scale*hist->GetContent(bin,0,0); 
00249       fN_low_res += hist->GetEntries(0,0);
00250     }
00251 
00252   }
00253 }

void AtNuOscFitHistogram::Fill ( Double_t  x,
Double_t  w,
Int_t  updn = 0,
Int_t  chg = 0 
)

Definition at line 208 of file AtNuOscFitHistogram.cxx.

References fBins, fN_dn_0, fN_dn_neg, fN_dn_pos, fN_low_res, fN_up_0, fN_up_neg, fN_up_pos, fX_dn_0, fX_dn_neg, fX_dn_pos, fX_low_res, fX_up_0, fX_up_neg, fX_up_pos, and GetBin().

Referenced by AtNuEventCounter::FillTemplates(), and AtNuOscFitTemplateMaker::Run().

00209 {
00210   Int_t bin = this->GetBin(x);
00211 
00212   if( bin>=0 && bin<fBins ){ 
00213     if( updn==+1 && chg==-1 ){ fX_up_neg[bin] += w;  fN_up_neg += 1.0; }
00214     if( updn==+1 && chg==0  ){ fX_up_0[bin]   += w;  fN_up_0   += 1.0; }
00215     if( updn==+1 && chg==+1 ){ fX_up_pos[bin] += w;  fN_up_pos += 1.0; }    
00216     if( updn==-1 && chg==-1 ){ fX_dn_neg[bin] += w;  fN_dn_neg += 1.0; }
00217     if( updn==-1 && chg==0  ){ fX_dn_0[bin]   += w;  fN_dn_0   += 1.0; }
00218     if( updn==-1 && chg==+1 ){ fX_dn_pos[bin] += w;  fN_dn_pos += 1.0; }
00219     if( updn==0  && chg==0  ){ fX_low_res[bin] += w; fN_low_res += 1.0; }
00220   }
00221 
00222   return;
00223 }

Int_t AtNuOscFitHistogram::GetBin ( Double_t  x  )  [private]

Definition at line 458 of file AtNuOscFitHistogram.cxx.

References fBins, fMax, and fMin.

Referenced by Fill(), and GetContent().

00459 {
00460   Int_t bin;
00461 
00462   if( x<fMin ){
00463     bin = -1;
00464   }
00465   else if( x>=fMax ){
00466     bin = fBins;
00467   }
00468   else {
00469     //if( x>=fMin && x<fMax ){
00470     bin = (Int_t)(fBins*(x-fMin)/(fMax-fMin));
00471   }
00472 
00473   return bin;
00474 }

Int_t AtNuOscFitHistogram::GetBins (  )  [inline]

Definition at line 30 of file AtNuOscFitHistogram.h.

References fBins.

Referenced by Add(), AtNuOscFit::GetDeltaLikelihood(), and AtNuOscFit::GetDeltaLikelihoodBayes().

00030 { return fBins; }

Double_t AtNuOscFitHistogram::GetCenter ( Int_t  bin  ) 

Definition at line 320 of file AtNuOscFitHistogram.cxx.

References fBins, fMax, and fMin.

Referenced by PrintMe().

00321 {
00322   if( bin<0 ){
00323     return fMin - 0.5*(fMax-fMin);
00324   }
00325   
00326   if( bin>=0 && bin<fBins ){
00327     return fMin + (bin+0.5)*(fMax-fMin)/(fBins+0.0);
00328   }
00329 
00330   if( bin>=fBins ){
00331     return fMax + 0.5*(fMax-fMin);
00332   }
00333 
00334   return -99999.9;
00335 }

Double_t AtNuOscFitHistogram::GetContent ( Double_t  x,
Int_t  updn,
Int_t  chg 
)

Definition at line 291 of file AtNuOscFitHistogram.cxx.

References GetBin(), and GetContent().

00292 {
00293   Int_t bin = this->GetBin(x);
00294 
00295   return this->GetContent(bin,updn,chg);
00296 }

Double_t AtNuOscFitHistogram::GetContent ( Int_t  bin,
Int_t  updn,
Int_t  chg 
)

Definition at line 268 of file AtNuOscFitHistogram.cxx.

References fBins, fX_dn_0, fX_dn_neg, fX_dn_pos, fX_low_res, fX_up_0, fX_up_neg, and fX_up_pos.

Referenced by Add(), GetContent(), AtNuOscFit::GetDeltaLikelihood(), AtNuOscFit::GetDeltaLikelihoodBayes(), GetTotalContent(), and PrintMe().

00269 {
00270   if( bin<0 ){
00271     return 0.0;
00272   }
00273 
00274   if( bin>=0 && bin<fBins ){  
00275     if( updn==+1 && chg==-1 ){ return fX_up_neg[bin];  }
00276     if( updn==+1 && chg==0  ){ return fX_up_0[bin];    }
00277     if( updn==+1 && chg==+1 ){ return fX_up_pos[bin];  }    
00278     if( updn==-1 && chg==-1 ){ return fX_dn_neg[bin];  }
00279     if( updn==-1 && chg==0  ){ return fX_dn_0[bin];    }
00280     if( updn==-1 && chg==+1 ){ return fX_dn_pos[bin];  }
00281     if( updn==0  && chg==0  ){ return fX_low_res[bin]; }
00282   }
00283   
00284   if( bin>=fBins ){
00285     return 0.0;
00286   }
00287 
00288   return 0.0;
00289 }

Double_t AtNuOscFitHistogram::GetEntries ( Int_t  updn,
Int_t  chg 
)

Definition at line 255 of file AtNuOscFitHistogram.cxx.

References fN_dn_0, fN_dn_neg, fN_dn_pos, fN_low_res, fN_up_0, fN_up_neg, and fN_up_pos.

Referenced by Add().

00256 {
00257   if( updn==+1 && chg==-1 ){ return fN_up_neg;  }
00258   if( updn==+1 && chg==0  ){ return fN_up_0;    }
00259   if( updn==+1 && chg==+1 ){ return fN_up_pos;  }    
00260   if( updn==-1 && chg==-1 ){ return fN_dn_neg;  }
00261   if( updn==-1 && chg==0  ){ return fN_dn_0;    }
00262   if( updn==-1 && chg==+1 ){ return fN_dn_pos;  }
00263   if( updn==0  && chg==0  ){ return fN_low_res; }
00264 
00265   return 0.0;
00266 }

Double_t AtNuOscFitHistogram::GetMax (  )  [inline]

Definition at line 32 of file AtNuOscFitHistogram.h.

References fMax.

00032 { return fMax; }

Double_t AtNuOscFitHistogram::GetMin (  )  [inline]

Definition at line 31 of file AtNuOscFitHistogram.h.

References fMin.

00031 { return fMin; }

Double_t AtNuOscFitHistogram::GetTotalContent (  ) 

Definition at line 309 of file AtNuOscFitHistogram.cxx.

Referenced by PrintMe().

00310 {
00311   return this->GetTotalContent(+1,-1)
00312        + this->GetTotalContent(+1,0)
00313        + this->GetTotalContent(+1,+1)
00314        + this->GetTotalContent(-1,-1)
00315        + this->GetTotalContent(-1,0)
00316        + this->GetTotalContent(-1,+1)
00317        + this->GetTotalContent(0,0);
00318 }

Double_t AtNuOscFitHistogram::GetTotalContent ( Int_t  updn,
Int_t  chg 
)

Definition at line 298 of file AtNuOscFitHistogram.cxx.

References fBins, GetContent(), n, and total().

Referenced by AtNuOscFit::GetDeltaLikelihoodBayes(), and AtNuOscFitTemplate::GetTotalContent().

00299 {
00300   Double_t total = 0.0;
00301   
00302   for( Int_t n=0; n<fBins; n++ ){
00303     total += this->GetContent(n,updn,chg);
00304   }
00305 
00306   return total;
00307 }

void AtNuOscFitHistogram::MakeTH1D ( const char *  name,
TH1D *&  h_up_neg,
TH1D *&  h_up_0,
TH1D *&  h_up_pos,
TH1D *&  h_dn_neg,
TH1D *&  h_dn_0,
TH1D *&  h_dn_pos,
TH1D *&  h_lores,
TH1D *&  h_neg,
TH1D *&  h_0,
TH1D *&  h_pos,
TH1D *&  h 
)

Definition at line 564 of file AtNuOscFitHistogram.cxx.

References fBins, fMax, fMin, fN_dn_0, fN_dn_neg, fN_dn_pos, fN_low_res, fN_up_0, fN_up_neg, fN_up_pos, fX_dn_0, fX_dn_neg, fX_dn_pos, fX_low_res, fX_up_0, fX_up_neg, fX_up_pos, and MakeTH1D().

00565 {
00566   this->MakeTH1D(name,
00567                  h_up_neg,h_up_0,h_up_pos,
00568                  h_dn_neg,h_dn_0,h_dn_pos,
00569                  h_low_res);
00570 
00571   TString name_neg = name;
00572   name_neg.Append("_neg");  
00573 
00574   h_neg = new TH1D(name_neg,name_neg,fBins,fMin,fMax);
00575   h_neg->SetBinContent(0,0.0);
00576   h_neg->SetBinContent(fBins+1,0.0);
00577   h_neg->SetEntries( fN_up_neg + fN_dn_neg );
00578 
00579   for( Int_t i=0; i<fBins; i++){
00580     h_neg->SetBinContent(i+1, fX_up_neg[i] + fX_dn_neg[i] );
00581   }
00582 
00583   TString name_0 = name;
00584   name_0.Append("_0");
00585 
00586   h_0 = new TH1D(name_0,name_0,fBins,fMin,fMax);
00587   h_0->SetBinContent(0,0.0);
00588   h_0->SetBinContent(fBins+1,0.0);
00589   h_0->SetEntries( fN_up_0 + fN_low_res + fN_dn_0 );
00590 
00591   for( Int_t i=0; i<fBins; i++){
00592     h_0->SetBinContent(i+1, fX_up_0[i] + fX_low_res[i] + fX_dn_0[i] );
00593   }
00594 
00595   TString name_pos = name;
00596   name_pos.Append("_pos");
00597 
00598   h_pos = new TH1D(name_pos,name_pos,fBins,fMin,fMax);
00599   h_pos->SetBinContent(0,0.0);
00600   h_pos->SetBinContent(fBins+1,0.0);
00601   h_pos->SetEntries( fN_up_pos + fN_dn_pos );
00602 
00603   for( Int_t i=0; i<fBins; i++){
00604     h_pos->SetBinContent(i+1, fX_up_pos[i] + fX_dn_pos[i] );
00605   }  
00606 
00607   h = new TH1D(name,name,fBins,fMin,fMax);
00608   h->SetBinContent(0,0.0);
00609   h->SetBinContent(fBins+1,0.0);
00610   h->SetEntries( fN_up_neg              + fN_dn_neg
00611                + fN_up_0   + fN_low_res + fN_dn_0
00612                + fN_up_pos              + fN_dn_pos );
00613 
00614   for( Int_t i=0; i<fBins; i++){
00615     h->SetBinContent(i+1, fX_up_neg[i]                 + fX_dn_neg[i]
00616                         + fX_up_0[i]   + fX_low_res[i] + fX_dn_0[i]
00617                         + fX_up_pos[i]                 + fX_dn_pos[i] );
00618   }
00619 
00620 }

void AtNuOscFitHistogram::MakeTH1D ( const char *  name,
TH1D *&  h_up_neg,
TH1D *&  h_up_0,
TH1D *&  h_up_pos,
TH1D *&  h_dn_neg,
TH1D *&  h_dn_0,
TH1D *&  h_dn_pos,
TH1D *&  h_lores 
)

Definition at line 476 of file AtNuOscFitHistogram.cxx.

References fBins, fMax, fMin, fN_dn_0, fN_dn_neg, fN_dn_pos, fN_low_res, fN_up_0, fN_up_neg, fN_up_pos, fX_dn_0, fX_dn_neg, fX_dn_pos, fX_low_res, fX_up_0, fX_up_neg, and fX_up_pos.

Referenced by MakeTH1D(), and AtNuOscFitTemplate::WriteHistograms().

00477 {
00478   TString name_up_neg = name;
00479   name_up_neg.Append("_up_neg");  
00480 
00481   h_up_neg = new TH1D(name_up_neg,name_up_neg,fBins,fMin,fMax);
00482   h_up_neg->SetBinContent(0,0.0);
00483   h_up_neg->SetBinContent(fBins+1,0.0);
00484   h_up_neg->SetEntries(fN_up_neg);
00485 
00486   for( Int_t i=0; i<fBins; i++){
00487     h_up_neg->SetBinContent(i+1,fX_up_neg[i]);
00488   }
00489 
00490   TString name_up_0 = name;
00491   name_up_0.Append("_up_0");
00492 
00493   h_up_0 = new TH1D(name_up_0,name_up_0,fBins,fMin,fMax);
00494   h_up_0->SetBinContent(0,0.0);
00495   h_up_0->SetBinContent(fBins+1,0.0);
00496   h_up_0->SetEntries(fN_up_0);
00497 
00498   for( Int_t i=0; i<fBins; i++){
00499     h_up_0->SetBinContent(i+1,fX_up_0[i]);
00500   }
00501 
00502   TString name_up_pos = name;
00503   name_up_pos.Append("_up_pos");
00504 
00505   h_up_pos = new TH1D(name_up_pos,name_up_pos,fBins,fMin,fMax);
00506   h_up_pos->SetBinContent(0,0.0);
00507   h_up_pos->SetBinContent(fBins+1,0.0);
00508   h_up_pos->SetEntries(fN_up_pos);
00509 
00510   for( Int_t i=0; i<fBins; i++){
00511     h_up_pos->SetBinContent(i+1,fX_up_pos[i]);
00512   }
00513 
00514   TString name_dn_neg = name;
00515   name_dn_neg.Append("_dn_neg");  
00516 
00517   h_dn_neg = new TH1D(name_dn_neg,name_dn_neg,fBins,fMin,fMax);
00518   h_dn_neg->SetBinContent(0,0.0);
00519   h_dn_neg->SetBinContent(fBins+1,0.0);
00520   h_dn_neg->SetEntries(fN_dn_neg);
00521 
00522   for( Int_t i=0; i<fBins; i++){
00523     h_dn_neg->SetBinContent(i+1,fX_dn_neg[i]);
00524   }
00525 
00526   TString name_dn_0 = name;
00527   name_dn_0.Append("_dn_0");
00528 
00529   h_dn_0 = new TH1D(name_dn_0,name_dn_0,fBins,fMin,fMax);
00530   h_dn_0->SetBinContent(0,0.0);
00531   h_dn_0->SetBinContent(fBins+1,0.0);
00532   h_dn_0->SetEntries(fN_dn_0);
00533 
00534   for( Int_t i=0; i<fBins; i++){
00535     h_dn_0->SetBinContent(i+1,fX_dn_0[i]);
00536   }
00537 
00538   TString name_dn_pos = name;
00539   name_dn_pos.Append("_dn_pos");
00540 
00541   h_dn_pos = new TH1D(name_dn_pos,name_dn_pos,fBins,fMin,fMax);
00542   h_dn_pos->SetBinContent(0,0.0);
00543   h_dn_pos->SetBinContent(fBins+1,0.0);
00544   h_dn_pos->SetEntries(fN_dn_pos);
00545 
00546   for( Int_t i=0; i<fBins; i++){
00547     h_dn_pos->SetBinContent(i+1,fX_dn_pos[i]);
00548   }  
00549 
00550   TString name_lores = name;
00551   name_lores.Append("_lores");
00552 
00553   h_lores = new TH1D(name_lores,name_lores,fBins,fMin,fMax);
00554   h_lores->SetBinContent(0,0.0);
00555   h_lores->SetBinContent(fBins+1,0.0);
00556   h_lores->SetEntries(fN_low_res);
00557 
00558   for( Int_t i=0; i<fBins; i++){
00559     h_lores->SetBinContent(i+1,fX_low_res[i]);
00560   }
00561 
00562 }

void AtNuOscFitHistogram::PrintMe (  ) 

Definition at line 389 of file AtNuOscFitHistogram.cxx.

References fBins, fMax, fMin, fN_dn_0, fN_dn_neg, fN_dn_pos, fN_low_res, fN_up_0, fN_up_neg, fN_up_pos, GetCenter(), GetContent(), and GetTotalContent().

00390 {
00391   std::cout << " PRINT HISTOGRAM: " << std::endl;
00392   std::cout << "  bins: " << fBins << std::endl;
00393   std::cout << "  min: " << fMin << std::endl;
00394   std::cout << "  max: " << fMax << std::endl;
00395 
00396 
00397   std::cout << " up|-ve: " << std::endl;
00398   for(Int_t i=0; i<fBins; i++){
00399     std::cout << " " << i 
00400          << " " << this->GetCenter(i) 
00401          << " " << this->GetContent(i,+1,-1) << std::endl;
00402   }    
00403   std::cout << "  total up|-ve: " << this->GetTotalContent(+1,-1) << " (entries: " << fN_up_neg << ")" << std::endl; 
00404 
00405   std::cout << " up|0: " << std::endl;
00406   for(Int_t i=0; i<fBins; i++){
00407     std::cout << " " << i 
00408          << " " << this->GetCenter(i) 
00409          << " " << this->GetContent(i,+1,0) << std::endl;
00410   }    
00411   std::cout << "  total up|0: " << this->GetTotalContent(+1,0) << " (entries: " << fN_up_0 << ")" << std::endl; 
00412 
00413   std::cout << " up|+ve: " << std::endl;
00414   for(Int_t i=0; i<fBins; i++){
00415     std::cout << " " << i 
00416          << " " << this->GetCenter(i) 
00417          << " " << this->GetContent(i,+1,+1) << std::endl;
00418   }
00419   std::cout << "  total up|+ve: " << this->GetTotalContent(+1,+1)  << " (entries: " << fN_up_pos << ")" << std::endl;  
00420 
00421 
00422   std::cout << " dn|-ve: " << std::endl;
00423   for(Int_t i=0; i<fBins; i++){
00424     std::cout << " " << i 
00425          << " " << this->GetCenter(i) 
00426          << " " << this->GetContent(i,-1,-1) << std::endl;
00427   }    
00428   std::cout << "  total dn|-ve: " << this->GetTotalContent(-1,-1) << " (entries: " << fN_dn_neg << ")" << std::endl; 
00429 
00430   std::cout << " dn|0: " << std::endl;
00431   for(Int_t i=0; i<fBins; i++){
00432     std::cout << " " << i 
00433          << " " << this->GetCenter(i) 
00434          << " " << this->GetContent(i,-1,0) << std::endl;
00435   }    
00436   std::cout << "  total dn|0: " << this->GetTotalContent(-1,0) << " (entries: " << fN_dn_0 << ")" << std::endl; 
00437 
00438   std::cout << " dn|+ve: " << std::endl;
00439   for(Int_t i=0; i<fBins; i++){
00440     std::cout << " " << i 
00441          << " " << this->GetCenter(i) 
00442          << " " << this->GetContent(i,-1,+1) << std::endl;
00443   }
00444   std::cout << "  total dn|+ve: " << this->GetTotalContent(-1,+1)  << " (entries: " << fN_dn_pos << ")" << std::endl;  
00445 
00446 
00447   std::cout << " lores: " << std::endl;
00448   for(Int_t i=0; i<fBins; i++){
00449     std::cout << " " << i 
00450          << " " << this->GetCenter(i) 
00451          << " " << this->GetContent(i,0,0) << std::endl;
00452   }
00453   std::cout << "  total lores: " << this->GetTotalContent(0,0)  << " (entries: " << fN_low_res << ")" << std::endl;
00454 
00455   return;
00456 }

void AtNuOscFitHistogram::Randomize ( TRandom *  random  ) 

Definition at line 350 of file AtNuOscFitHistogram.cxx.

References fBins, fX_dn_0, fX_dn_neg, fX_dn_pos, fX_low_res, fX_up_0, fX_up_neg, and fX_up_pos.

Referenced by AtNuOscFitTemplate::Randomize().

00351 {
00352   for( Int_t i=0; i<fBins; i++ ){
00353     fX_up_neg[i]  = random->Poisson(fX_up_neg[i]);    
00354     fX_up_0[i]    = random->Poisson(fX_up_0[i]);    
00355     fX_up_pos[i]  = random->Poisson(fX_up_pos[i]);    
00356     fX_dn_neg[i]  = random->Poisson(fX_dn_neg[i]);    
00357     fX_dn_0[i]    = random->Poisson(fX_dn_0[i]);    
00358     fX_dn_pos[i]  = random->Poisson(fX_dn_pos[i]);
00359     fX_low_res[i] = random->Poisson(fX_low_res[i]);
00360   }
00361 }

void AtNuOscFitHistogram::Reset (  ) 

Definition at line 363 of file AtNuOscFitHistogram.cxx.

References fBins, fX_dn_0, fX_dn_neg, fX_dn_pos, fX_low_res, fX_up_0, fX_up_neg, and fX_up_pos.

Referenced by AtNuOscFitTemplate::ClearHistograms().

00364 {
00365   for(Int_t i=0; i<fBins; i++){
00366     fX_up_neg[i]  = 0.0;    
00367     fX_up_0[i]    = 0.0;    
00368     fX_up_pos[i]  = 0.0;    
00369     fX_dn_neg[i]  = 0.0;    
00370     fX_dn_0[i]    = 0.0;    
00371     fX_dn_pos[i]  = 0.0;
00372     fX_low_res[i] = 0.0;
00373   } 
00374 }

void AtNuOscFitHistogram::Scale ( Double_t  scale  ) 

Definition at line 337 of file AtNuOscFitHistogram.cxx.

References fBins, fX_dn_0, fX_dn_neg, fX_dn_pos, fX_low_res, fX_up_0, fX_up_neg, and fX_up_pos.

Referenced by AtNuOscFitTemplate::Scale().

00338 {
00339   for( Int_t i=0; i<fBins; i++ ){
00340     fX_up_neg[i]  = scale*fX_up_neg[i];    
00341     fX_up_0[i]    = scale*fX_up_0[i];    
00342     fX_up_pos[i]  = scale*fX_up_pos[i]; 
00343     fX_dn_neg[i]  = scale*fX_dn_neg[i];    
00344     fX_dn_0[i]    = scale*fX_dn_0[i];    
00345     fX_dn_pos[i]  = scale*fX_dn_pos[i];
00346     fX_low_res[i] = scale*fX_low_res[i];   
00347   } 
00348 }

void AtNuOscFitHistogram::Truncate (  ) 

Definition at line 376 of file AtNuOscFitHistogram.cxx.

References fBins, fX_dn_0, fX_dn_neg, fX_dn_pos, fX_low_res, fX_up_0, fX_up_neg, and fX_up_pos.

Referenced by AtNuOscFitTemplate::TruncateHistograms().

00377 {
00378   for(Int_t i=0; i<fBins; i++){
00379     if( fX_up_neg[i]<0.0 )  fX_up_neg[i]  = 0.0;    
00380     if( fX_up_0[i]<0.0 )    fX_up_0[i]    = 0.0;    
00381     if( fX_up_pos[i]<0.0 )  fX_up_pos[i]  = 0.0;    
00382     if( fX_dn_neg[i]<0.0 )  fX_dn_neg[i]  = 0.0;    
00383     if( fX_dn_0[i]<0.0 )    fX_dn_0[i]    = 0.0;    
00384     if( fX_dn_pos[i]<0.0 )  fX_dn_pos[i]  = 0.0;
00385     if( fX_low_res[i]<0.0 ) fX_low_res[i] = 0.0;
00386   } 
00387 }


Member Data Documentation

Int_t AtNuOscFitHistogram::fBins [private]
Double_t AtNuOscFitHistogram::fMax [private]

Definition at line 57 of file AtNuOscFitHistogram.h.

Referenced by AtNuOscFitHistogram(), GetBin(), GetCenter(), GetMax(), MakeTH1D(), and PrintMe().

Double_t AtNuOscFitHistogram::fMin [private]

Definition at line 56 of file AtNuOscFitHistogram.h.

Referenced by AtNuOscFitHistogram(), GetBin(), GetCenter(), GetMin(), MakeTH1D(), and PrintMe().

Double_t AtNuOscFitHistogram::fN_dn_0 [private]

Definition at line 63 of file AtNuOscFitHistogram.h.

Referenced by Add(), AtNuOscFitHistogram(), Fill(), GetEntries(), MakeTH1D(), and PrintMe().

Double_t AtNuOscFitHistogram::fN_dn_neg [private]

Definition at line 62 of file AtNuOscFitHistogram.h.

Referenced by Add(), AtNuOscFitHistogram(), Fill(), GetEntries(), MakeTH1D(), and PrintMe().

Double_t AtNuOscFitHistogram::fN_dn_pos [private]

Definition at line 64 of file AtNuOscFitHistogram.h.

Referenced by Add(), AtNuOscFitHistogram(), Fill(), GetEntries(), MakeTH1D(), and PrintMe().

Double_t AtNuOscFitHistogram::fN_low_res [private]

Definition at line 65 of file AtNuOscFitHistogram.h.

Referenced by Add(), AtNuOscFitHistogram(), Fill(), GetEntries(), MakeTH1D(), and PrintMe().

Double_t AtNuOscFitHistogram::fN_up_0 [private]

Definition at line 60 of file AtNuOscFitHistogram.h.

Referenced by Add(), AtNuOscFitHistogram(), Fill(), GetEntries(), MakeTH1D(), and PrintMe().

Double_t AtNuOscFitHistogram::fN_up_neg [private]

Definition at line 59 of file AtNuOscFitHistogram.h.

Referenced by Add(), AtNuOscFitHistogram(), Fill(), GetEntries(), MakeTH1D(), and PrintMe().

Double_t AtNuOscFitHistogram::fN_up_pos [private]

Definition at line 61 of file AtNuOscFitHistogram.h.

Referenced by Add(), AtNuOscFitHistogram(), Fill(), GetEntries(), MakeTH1D(), and PrintMe().

Double_t* AtNuOscFitHistogram::fX_dn_0 [private]
Double_t* AtNuOscFitHistogram::fX_dn_neg [private]
Double_t* AtNuOscFitHistogram::fX_dn_pos [private]
Double_t* AtNuOscFitHistogram::fX_low_res [private]
Double_t* AtNuOscFitHistogram::fX_up_0 [private]
Double_t* AtNuOscFitHistogram::fX_up_neg [private]
Double_t* AtNuOscFitHistogram::fX_up_pos [private]

The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1