本文整理汇总了C++中TPaveStats::SetTextColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TPaveStats::SetTextColor方法的具体用法?C++ TPaveStats::SetTextColor怎么用?C++ TPaveStats::SetTextColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPaveStats
的用法示例。
在下文中一共展示了TPaveStats::SetTextColor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ColourStatsBoxes
//________________________________________________________
void GFHistManager::ColourStatsBoxes(GFHistArray *hists) const
{
// colours stats boxes like hists' line colors and moves the next to each other
if (!hists) return;
Double_t x1 = fStatsX1, x2 = fStatsX2, y1 = fStatsY1, y2 = fStatsY2;
for (Int_t iH = 0; iH < hists->GetEntriesFast(); ++iH) {
TH1 *h = hists->At(iH);
if (!h) continue;
TObject *statObj = h->GetListOfFunctions()->FindObject("stats");
if (statObj && statObj->InheritsFrom(TPaveStats::Class())) {
TPaveStats *stats = static_cast<TPaveStats*>(statObj);
stats->SetLineColor(hists->At(iH)->GetLineColor());
stats->SetTextColor(hists->At(iH)->GetLineColor());
stats->SetX1NDC(x1);
stats->SetX2NDC(x2);
stats->SetY1NDC(y1);
stats->SetY2NDC(y2);
y2 = y1 - 0.005; // shift down 2
y1 = y2 - (fStatsY2 - fStatsY1); // shift down 1
if (y1 < 0.) {
y1 = fStatsY1; y2 = fStatsY2; // restart y-positions
x2 = x1 - 0.005; // shift left 2
x1 = x2 - (fStatsX2 - fStatsX1); // shift left 1
if (x1 < 0.) { // give up, start again:
x1 = fStatsX1, x2 = fStatsX2, y1 = fStatsY1, y2 = fStatsY2;
}
}
} else if (gStyle->GetOptStat() != 0) { // failure in case changed in list via TExec....
this->Warning("ColourStatsBoxes", "No stats found for %s", hists->At(iH)->GetName());
}
}
}
示例2: resizeStatBox
// Resize any histograms (they all inherit from h1) stat box. Uses NDC coordinates (e.g. 0.65, 0.5)
bool resizeStatBox( TCanvas *c1, TH1* h1, float x1, float y1, float x2=-1, float y2=-1,
TString newname = "", int color = -1, TString oldname = "", int iDebug = 0 )
{
if( !c1 || !h1 ) {cerr<<"Null pointer given to resizeStatBox!"<<endl; return 0;}
c1->Update();
if( oldname.Length() <= 0 ) oldname = "stats";
if( iDebug > 20 ) print_list_of_functions( *h1 );
TPaveStats *stats = (TPaveStats*) h1->FindObject( oldname );
if( iDebug ) cout<<"Found old name (\""<<oldname<<"\"? "<<( stats != 0 )<<endl;
if( (!stats) && newname.Length() > 0 ){ // maybe it was already renamed
stats = (TPaveStats*) h1->FindObject( newname );
if( iDebug ) cout<<"Found new name (\""<<newname<<"\"? "<<(stats != 0)<<endl;
}
if( !stats ) {cerr<<"Can't find stat box"<<endl; return 0;}
stats->SetX1NDC( x1 );
stats->SetY1NDC( y1 );
if( x2 >= 0 ) stats->SetX2NDC( x2 );
if( y2 >= 0 ) stats->SetY2NDC( y2 );
if( newname.Length() > 0 ) {
stats->SetName( newname );
if( iDebug ) cout<<"SetName to "<<newname<<endl;
}
if( color != -1 ) stats->SetTextColor (color);
stats->Draw(); // maybe, just maybe, this will finally make them appear every time, even with draw "same"
return 1;
}
示例3: drawStatBox
// überladen: Statbox-Größen manuell eingeben
void drawStatBox(int& step, TH1D* histo, int color = -1, double statboxHeight = 0.1, double statboxSpacing = 0.15){
TPaveStats* statBox = dynamic_cast<TPaveStats*>( histo->GetListOfFunctions()->FindObject("stats") );
if(color == -1) color = step+1;
statBox->SetX1NDC(0.80);
statBox->SetX2NDC(0.99);
statBox->SetY2NDC(0.95-step*statboxSpacing);
statBox->SetY1NDC(0.95-step*statboxSpacing-statboxHeight);
statBox->SetTextColor(color);
statBox->Draw();
step++;
}
示例4: SetStPadPos
TPaveStats* SetStPadPos(TH1* hst,float x1,float x2,float y1,float y2, Int_t stl, Int_t col)
{
TPaveStats* pad = GetStPad(hst);
if (!pad) return 0;
pad->SetX1NDC( x1 );
pad->SetX2NDC( x2 );
pad->SetY1NDC( y1 );
pad->SetY2NDC( y2 );
if (stl>=0) pad->SetFillStyle(stl);
if (col>=0) pad->SetTextColor(col);
pad->SetFillColor(0);
//
gPad->Modified();
return pad;
}
示例5: plotSubDetResiduals
//------------------------------------------------------------------------------
void PlotAlignmentValidation::plotSubDetResiduals(bool plotNormHisto,unsigned int subDetId)
{
setNiceStyle();
gStyle->SetOptStat(11111);
gStyle->SetOptFit(0000);
TCanvas *c = new TCanvas("c", "c", 600,600);
c->SetTopMargin(0.15);
TString histoName= "";
if (plotNormHisto) {histoName= "h_NormXprime";}
else histoName= "h_Xprime_";
switch (subDetId){
case 1 : histoName+="TPBBarrel_0";break;
case 2 : histoName+="TPEendcap_1";break;
case 3 : histoName+="TPEendcap_2";break;
case 4 : histoName+="TIBBarrel_0";break;
case 5 : histoName+="TIDEndcap_1";break;
case 6 : histoName+="TIDEndcap_2";break;
case 7 : histoName+="TOBBarrel_3";break;
case 8 : histoName+="TECEndcap_4";break;
case 9 : histoName+="TECEndcap_5";break;
}
int tmpcounter = 0;
TH1 *sumHisto = 0;
for(std::vector<TkOfflineVariables*>::iterator it = sourceList.begin();
it != sourceList.end(); ++it) {
if (tmpcounter == 0 ) {
TFile *f= (*it)->getFile();
sumHisto =(TH1*) f->FindKeyAny(histoName)->ReadObj();//FindObjectAny(histoName.Data());
sumHisto->SetLineColor(tmpcounter+1);
sumHisto->SetLineStyle(tmpcounter+1);
sumHisto->GetFunction("tmp")->SetBit(TF1::kNotDraw);
sumHisto->Draw();
//get statistic box coordinate to plot all boxes one below the other
//gStyle->SetStatY(0.91);
//gStyle->SetStatW(0.15);
//gStyle->SetStatBorderSize(1);
//gStyle->SetStatH(0.10);
tmpcounter++;
} else {
sumHisto = (TH1*) (*it)->getFile()->FindObjectAny(histoName);
sumHisto->SetLineColor(tmpcounter+1);
sumHisto->SetLineStyle(tmpcounter+1);
sumHisto->GetFunction("tmp")->SetBit(TF1::kNotDraw);
//hstack->Add(sumHisto);
c->Update();
tmpcounter++;
}
TObject *statObj = sumHisto->GetListOfFunctions()->FindObject("stats");
if (statObj && statObj->InheritsFrom(TPaveStats::Class())) {
TPaveStats *stats = static_cast<TPaveStats*>(statObj);
stats->SetLineColor(tmpcounter+1);
stats->SetTextColor(tmpcounter+1);
stats->SetFillColor(10);
stats->SetX1NDC(0.91-tmpcounter*0.1);
stats->SetX2NDC(0.15);
stats->SetY1NDC(1);
stats->SetY2NDC(0.10);
sumHisto->Draw("sames");
}
}
//hstack->Draw("nostack");
char PlotName[1000];
sprintf( PlotName, "%s/%s.eps", outputDir.c_str(), histoName.Data() );
c->Print(PlotName);
//delete c;
//c=0;
}
示例6: CompHist
void CompHist(TH1 *h1, TH1 *href, int run1, int runref) {
if (!h1 || !href || h1->Integral()==0 || href->Integral()==0) return;
// first check if both histograms are compatible
Stat_t s[TH1F::kNstat];
h1->GetStats(s);// s[1] sum of squares of weights, s[0] sum of weights
Double_t sumBinContent1 = s[0];
Double_t effEntries1 = (s[1] ? s[0] * s[0] / s[1] : 0.0);
href->GetStats(s);// s[1] sum of squares of weights, s[0] sum of weights
Double_t sumBinContent2 = s[0];
Double_t effEntries2 = (s[1] ? s[0] * s[0] / s[1] : 0.0);
float pval_chi2=1, pval_ks=1,pval_ad=1;
bool iswt = (sumBinContent1==0 || effEntries1==0 || sumBinContent2==0 || effEntries2==0 || TMath::Abs(sumBinContent1 - effEntries1) != 0 || TMath::Abs(sumBinContent2 - effEntries2) != 0);
if (iswt) {
// weighted histograms
pval_chi2 = h1->Chi2Test(href,"WW");
// pval_ks = h1->KolmogorovTest(href);
} else {
// unweighted histograms
pval_ks = h1->KolmogorovTest(href);
pval_ad = h1->AndersonDarlingTest(href);
// double int1 = h1->Integral();
// double intref = href->Integral();
// if (int1==0 || intref==0) return;
// h1->Scale(1./int1);
// href->Scale(1./intref);
// pval_chi2 = h1->Chi2Test(href,"NORM UU");
}
if (pval_chi2>minpval && pval_ks>minpval) return;
// looks like we have a discrepancy! let's plot the histograms and print the output
cout << h1->GetTitle() << ": p-val(chi2) = " << pval_chi2 << ", p-val(KS) = " << pval_ks << ", pval_ad = " << pval_ad << endl;
TCanvas *c1 = new TCanvas();
href->SetLineColor(kRed);
href->SetMarkerColor(kRed);
if (!iswt) href->DrawNormalized();
else href->Draw();
c1->Update();
// Retrieve the stat box
TPaveStats *ps = (TPaveStats*)c1->GetPrimitive("stats");
ps->SetName("statsref");
ps->SetTextColor(kRed);
ps->SetX1NDC(0.8);
ps->SetX2NDC(1.);
ps->SetY1NDC(0.6);
ps->SetY2NDC(0.8);
h1->SetLineColor(kBlack);
h1->SetMarkerColor(kBlack);
if (!iswt) h1->DrawNormalized("sames");
else h1->Draw("sames");
c1->Update();
TPaveStats *psref = (TPaveStats*)c1->GetPrimitive("stats");
psref->SetName("stats1");
psref->SetX1NDC(0.8);
psref->SetX2NDC(1.);
psref->SetY1NDC(0.8);
psref->SetY2NDC(1.);
c1->Modified();
c1->Update();
TLatex *txt = new TLatex();
if (!iswt) txt->DrawLatexNDC(0.02,0.02,Form("p(KS) = %f, p(AD) = %f",pval_ks,pval_ad));
else txt->DrawLatexNDC(0.02,0.02,Form("p(#chi^{2}) = %f",pval_chi2));
c1->SaveAs(Form("%s_%i_%i.png",h1->GetName(),run1,runref));
delete c1;
}
示例7: FitDijetMass_Data
void FitDijetMass_Data() {
TFile *inf = new TFile("MassResults_ak7calo.root");
TH1F *hCorMassDen = (TH1F*) inf->Get("DiJetMass");
hCorMassDen->SetXTitle("Corrected Dijet Mass (GeV)");
hCorMassDen->SetYTitle("Events/GeV");
hCorMassDen->GetYaxis()->SetTitleOffset(1.5);
hCorMassDen->SetMarkerStyle(20);
hCorMassDen->GetXaxis()->SetRangeUser(120.,900.);
gROOT->ProcessLine(".L tdrstyle.C");
setTDRStyle();
tdrStyle->SetErrorX(0.5);
tdrStyle->SetPadRightMargin(0.08);
tdrStyle->SetLegendBorderSize(0);
gStyle->SetOptFit(1111);
tdrStyle->SetOptStat(0);
TCanvas* c2 = new TCanvas("c2","DijetMass", 500, 500);
/////// perform 4 parameters fit
TF1 *func = new TF1("func", "[0]*((1-x/7000.+[3]*(x/7000)^2)^[1])/(x^[2])",
100., 1000.);
func->SetParameter(0, 1.0e+08);
func->SetParameter(1, -1.23);
func->SetParameter(2, 4.13);
func->SetParameter(3, 1.0);
func->SetLineColor(4);
func->SetLineWidth(3);
TVirtualFitter::SetMaxIterations( 10000 );
TVirtualFitter *fitter;
TMatrixDSym* cov_matrix;
int fitStatus = hCorMassDen->Fit("func","LLI","",130.0, 800.0); // QCD fit
TH1F *hFitUncertainty = hCorMassDen->Clone("hFitUncertainty");
hFitUncertainty->SetLineColor(5);
hFitUncertainty->SetFillColor(5);
hFitUncertainty->SetMarkerColor(5);
if (fitStatus == 0) {
fitter = TVirtualFitter::GetFitter();
double* m_elements = fitter->GetCovarianceMatrix();
cov_matrix = new TMatrixDSym( func->GetNumberFreeParameters(),m_elements);
cov_matrix->Print();
double x, y, e;
for(int i=0;i<hFitUncertainty->GetNbinsX();i++)
{
x = hFitUncertainty->GetBinCenter(i+1);
y = func->Eval(x);
e = QCDFitUncertainty( func, *cov_matrix, x);
hFitUncertainty->SetBinContent(i+1,y);
hFitUncertainty->SetBinError(i+1,e);
}
}
hCorMassDen->Draw("ep");
gPad->Update();
TPaveStats *st = (TPaveStats*)hCorMassDen->FindObject("stats");
st->SetName("stats1");
st->SetX1NDC(0.3); //new x start position
st->SetX2NDC(0.6); //new x end position
st->SetTextColor(4);
hCorMassDen->GetListOfFunctions()->Add(st);
/////// perform 2 parameters fit
TF1 *func2 = new TF1("func2", "[0]*(1-x/7000.)/(x^[1])", 100., 1000.);
func2->SetParameter(0, 10000.);
func2->SetParameter(1, 5.0);
func2->SetLineWidth(3);
fitStatus = hCorMassDen->Fit("func2","LLI","",130.0, 800.0); // QCD fit
TH1F *hFitUncertainty2 = hCorMassDen->Clone("hFitUncertainty2");
hFitUncertainty2->SetLineColor(kGray);
hFitUncertainty2->SetFillColor(kGray);
hFitUncertainty2->SetMarkerColor(kGray);
if (fitStatus == 0) {
fitter = TVirtualFitter::GetFitter();
double* m_elements = fitter->GetCovarianceMatrix();
cov_matrix = new TMatrixDSym( func2->GetNumberFreeParameters(),m_elements);
cov_matrix->Print();
double x, y, e;
for(int i=0;i<hFitUncertainty2->GetNbinsX();i++)
{
x = hFitUncertainty2->GetBinCenter(i+1);
y = func2->Eval(x);
e = QCDFitUncertainty( func2, *cov_matrix, x);
hFitUncertainty2->SetBinContent(i+1,y);
hFitUncertainty2->SetBinError(i+1,e);
//.........这里部分代码省略.........
示例8: JetEtaBC
void JetEtaBC(void){
std::cout << "Hellowww!!" << std::endl;
TFile *file1;
file1 = TFile::Open("PF_second.root");
TH1F* f1 = (TH1F*)file1->FindObjectAny("JetEtaBC");
TFile *file2;
file2 = TFile::Open("PAT_second.root");
TH1F* f2 = (TH1F*)file2->FindObjectAny("JetEtaBC");
TFile *file3;
file3 = TFile::Open("PF_IC5_Jets_Corrected.root");
TH1F* f3 = (TH1F*)file3->FindObjectAny("JetEtaBC");
TFile *file4;
file4 = TFile::Open("PF_ak5_tot.root");
TH1F* f4 = (TH1F*)file4->FindObjectAny("JetEtaBC");
TCanvas *c1 = new TCanvas("canvas","Plotting Canvas",150,10,990,660);
c1->Range(-0.1486535,-622.7141,1.350808,5500.641);
c1->SetFillColor(0);
c1->SetBorderSize(2);
c1->SetLogy();
c1->SetTickx(1);
c1->SetTicky(1);
f1->SetStats(kFALSE);
f4->GetXaxis()->SetTitle("#eta");
f4->GetXaxis()->SetLabelFont(42);
f4->GetXaxis()->SetTitleFont(42);
f4->GetYaxis()->SetTitle("Events");
f4->GetYaxis()->SetLabelFont(42);
f4->GetYaxis()->SetTitleOffset(1.19);
f4->GetYaxis()->SetTitleFont(42);
f4->SetLineWidth(4);
f1->SetLineColor(1);
f2->SetStats(kFALSE);
f2->SetLineColor(2);
f2->SetLineWidth(3);
f3->SetStats(kFALSE);
f3->SetLineColor(3);
f3->SetLineWidth(2);
f4->SetStats(kFALSE);
f4->SetLineColor(4);
f1->SetLineWidth(1);
int entries = f1->GetEntries();
double mean = f1->GetMean();
double RMS = f1->GetRMS();
int entries1 = f2->GetEntries();
double mean1 = f2->GetMean();
double RMS1 = f2->GetRMS();
int entries2 = f3->GetEntries();
double mean2 = f3->GetMean();
double RMS2 = f3->GetRMS();
int entries3 = f4->GetEntries();
double mean3 = f4->GetMean();
double RMS3 = f4->GetRMS();
TPaveStats *ptstats = new TPaveStats(0.8314943,0.7488136,0.9926437,0.8877119,"brNDC");
ptstats->SetName("stats");
ptstats->SetBorderSize(1);
ptstats->SetFillColor(0);
ptstats->SetTextAlign(12);
ptstats->SetTextFont(42);
ptstats->SetTextColor(1);
TPaveStats *ptstats1 = new TPaveStats(0.8314943,0.5988136,0.9926437,0.7377119,"brNDC");
ptstats1->SetName("stats");
ptstats1->SetBorderSize(1);
ptstats1->SetFillColor(0);
ptstats1->SetTextAlign(12);
ptstats1->SetTextFont(42);
ptstats1->SetTextColor(2);
TPaveStats *ptstats2 = new TPaveStats(0.8314943,0.4488136,0.9926437,0.5877119,"brNDC");
ptstats2->SetName("stats");
ptstats2->SetBorderSize(1);
ptstats2->SetFillColor(0);
ptstats2->SetTextAlign(12);
ptstats2->SetTextFont(42);
ptstats2->SetTextColor(3);
TPaveStats *ptstats3 = new TPaveStats(0.8314943,0.2988136,0.9926437,0.4377119,"brNDC");
ptstats3->SetName("stats");
ptstats3->SetBorderSize(1);
ptstats3->SetFillColor(0);
ptstats3->SetTextAlign(12);
ptstats3->SetTextFont(42);
ptstats3->SetTextColor(4);
#include <sstream>
std::string s,s1,s2;
//.........这里部分代码省略.........
示例9: MoveStatsAndDraw
//-------------------------------------------------------------------------------------
void MoveStatsAndDraw (TH1 *data, TH1 *mc, char *dataTitle, char* mcTitle, char* firstline, char* secondline, int log, int col, bool stat, TString cut1, TString cut2, bool movepave){
c->SetLogy(log);
mc->Draw();
data->Draw("pesames");
gStyle->SetOptStat(00000000);
stat=0;
if(stat) gStyle->SetOptStat(1111111111);
/* TPaveText *TITLE = new TPaveText(0.2,0.65,0.55,0.9,"blNDC");
TITLE->SetFillStyle(4000);
TITLE->SetFillColor(kWhite);
TITLE->SetBorderSize(0.1);
TITLE->SetTextFont(42);
TITLE->AddText(firstline);
TITLE->Draw(); */
if(!movepave) {
TPaveText *title = new TPaveText(0.2,0.7,0.55,0.93,"blNDC");
} else {
// TPaveText *title = new TPaveText(0.6,0.58,0.95,0.83,"blNDC");
TPaveText *title = new TPaveText(0.6,0.7,0.95,0.93,"blNDC");
}
title->SetFillStyle(4000);
title->SetFillColor(kWhite);
title->SetBorderSize(0.1);
title->SetTextFont(42);
title->AddText(firstline);
title->AddText(secondline);
title->AddText(cut1);
title->AddText(cut2);
title->Draw();
if(!movepave) {
TLegend *leg = new TLegend(0.65,0.83,1.,0.93);
} else {
TLegend *leg = new TLegend(0.65,0.60,1.,0.7);
}
leg->SetFillStyle(4000);
leg->SetFillColor(kWhite);
leg->SetBorderSize(0.1);
leg->SetTextFont(42);
leg->AddEntry(data,dataTitle,"p");
leg->AddEntry(mc,mcTitle,"f");
leg->Draw();
c->Modified();
c->Update();
if(stat){
TPaveStats * ps = (TPaveStats *) mc->GetListOfFunctions()->FindObject("stats");
TPaveStats * ps2 = (TPaveStats *) data->GetListOfFunctions()->FindObject("stats");
Int_t ci;
ci = TColor::GetColor(col);
if( ps ){
ps->SetTextColor(1);
ps->SetLineColor(col);
}
else std::cout << "Null pointer to TPaveStats: " << ps << std::endl;
ps->SetY1NDC(0.40);
ps->SetY2NDC(0.68);
if( ps2 ) ps2->SetTextColor(ci); else std::cout << "Null pointer to TPaveStats: " << ps2 << std::endl;
}
}
示例10: SinglePi
//.........这里部分代码省略.........
gStyle->SetOptStat(1111);
if(i > 2) myc->SetLogy();
f1_hist1[i]->SetStats(kTRUE); // stat box
f2_hist1[i]->SetStats(kTRUE);
f1_hist1[i]->SetTitle("");
f2_hist1[i]->SetTitle("");
f1_hist1[i]->SetLineWidth(2);
f2_hist1[i]->SetLineWidth(2);
// diffferent histo colors and styles
f1_hist1[i]->SetLineColor(41);
f1_hist1[i]->SetLineStyle(1);
f2_hist1[i]->SetLineColor(43);
f2_hist1[i]->SetLineStyle(2);
//Set maximum to the larger of the two
if (f1_hist1[i]->GetMaximum() < f2_hist1[i]->GetMaximum()) f1_hist1[i]->SetMaximum(1.05 * f2_hist1[i]->GetMaximum());
TLegend *leg = new TLegend(0.2, 0.91, 0.6, 0.99, "","brNDC");
leg->SetBorderSize(2);
// leg->SetFillColor(51); // see new color definition above
leg->SetFillStyle(1001); //
leg->AddEntry(f1_hist1[i],"CMSSW_"+ref_vers,"l");
leg->AddEntry(f2_hist1[i],"CMSSW_"+val_vers,"l");
TPaveStats *ptstats = new TPaveStats(0.85,0.86,0.98,0.98,"brNDC");
ptstats->SetTextColor(41);
f1_hist1[i]->GetListOfFunctions()->Add(ptstats);
ptstats->SetParent(f1_hist1[i]->GetListOfFunctions());
TPaveStats *ptstats2 = new TPaveStats(0.85,0.74,0.98,0.86,"brNDC");
ptstats2->SetTextColor(43);
f2_hist1[i]->GetListOfFunctions()->Add(ptstats2);
ptstats2->SetParent(f2_hist1[i]->GetListOfFunctions());
f1_hist1[i]->Draw(""); // "stat"
f2_hist1[i]->Draw("histsames");
leg->Draw();
myc->SaveAs(label1[i]);
if(myc) delete myc;
}
// Profiles
for (int i = 0; i < Nprof; i++){
TCanvas *myc = new TCanvas("myc","",800,600);
bool skipHisto = false;
if (fastsim && i>=6 && i<=8) skipHisto = true;
if (!skipHisto) {
f1_prof[i]->SetStats(kFALSE);
f2_prof[i]->SetStats(kFALSE);
f1_prof[i]->SetTitle("");
f2_prof[i]->SetTitle("");
示例11: many_plots2
//.........这里部分代码省略.........
p->Project(h[2][1], "gtDiff", !cVeto && cIso && cT10 && cGamma && cPe && cXYZ && cR);
printf("gtDiff.\n");
p->Project(h[3][0], "PositronX[0]+2", cVeto && cIso && cT20 && cGamma && cPe && cY && cZ && cR && "PositronX[0] >= 0");
p->Project(h[3][1], "PositronX[0]+2", !cVeto && cIso && cT20 && cGamma && cPe && cY && cZ && cR && "PositronX[0] >= 0");
printf("X.\n");
p->Project(h[4][0], "PositronX[1]+2", cVeto && cIso && cT20 && cGamma && cPe && cX && cZ && cR && "PositronX[1] >= 0");
p->Project(h[4][1], "PositronX[1]+2", !cVeto && cIso && cT20 && cGamma && cPe && cX && cZ && cR && "PositronX[1] >= 0");
printf("Y.\n");
p->Project(h[5][0], "PositronX[2]+0.5", cVeto && cIso && cT20 && cGamma && cPe && cX && cY && cR);
p->Project(h[5][1], "PositronX[2]+0.5", !cVeto && cIso && cT20 && cGamma && cPe && cX && cY && cR);
printf("Z.\n");
p->Project(h[6][0], "NeutronEnergy", cVeto && cIso && cT20 && cGamma && cPe && cY && cZ && cR);
p->Project(h[6][1], "NeutronEnergy", !cVeto && cIso && cT20 && cGamma && cPe && cY && cZ && cR);
printf("NE.\n");
p->Project(h[7][0], "NeutronHits", cVeto && cIso && cT20 && cGamma && cPe && cXYZ && cR);
p->Project(h[7][1], "NeutronHits", !cVeto && cIso && cT20 && cGamma && cPe && cXYZ && cR);
printf("NN.\n");
p->Project(h[8][0], "AnnihilationEnergy", cVeto && cIso && cT20 && cPe && cXYZ && cR);
p->Project(h[8][1], "AnnihilationEnergy", !cVeto && cIso && cT20 && cPe && cXYZ && cR);
printf("AE.\n");
p->Project(h[9][0], "AnnihilationGammas", cVeto && cIso && cT20 && cPe && cXYZ && cR);
p->Project(h[9][1], "AnnihilationGammas", !cVeto && cIso && cT20 && cPe && cXYZ && cR);
printf("AG.\n");
p->Project(h[10][0], "PositronEnergy", cVeto && cIso && cT20 && cGamma && cPe && cXYZ && cR);
p->Project(h[10][1], "PositronEnergy", !cVeto && cIso && cT20 && cGamma && cPe && cXYZ && cR);
p->Project(h[11][0], "PositronEnergy", cVeto && cIso && cT20 && cGamma && cPe && cXYZ && cR && cN4 && cT200);
p->Project(h[11][1], "PositronEnergy", !cVeto && cIso && cT20 && cGamma && cPe && cXYZ && cR && cN4 && cT200);
printf("Projections are done\n");
for (i=0; i<12; i++) {
for (j=0; j<2; j++) h[i][j]->SetLineWidth(4);
h[i][0]->SetLineColor(kGreen);
h[i][1]->SetLineColor(kRed);
h[i][0]->SetMinimum(0);
h[i][1]->SetMinimum(0);
}
// h[1][0]->Fit("gaus", "0");
// h[1][1]->Fit("gaus", "0");
// TF1 *fdec = new TF1("FDEC", "[0]*(exp(-x/[1]) - exp(-x/[2]))", 3);
// fdec->SetParNames("Const", "t_{CAPTURE}", "t_{THERM}");
// fdec->SetParameters(h[2][0]->Integral()/4, 15, 5);
// h[2][0]->Fit("FDEC", "0", "", 2, 50);
for (i=0; i<2; i++) {
sprintf(str, "CV%d", i);
cv[i] = new TCanvas(str, "Plots", 1800, 1200);
cv[i]->Divide(3, 2);
for (j=0; j<6; j++) {
cv[i]->cd(j+1);
h[6*i+j][0]->Draw();
h[6*i+j][1]->Draw("sames");
gPad->Update();
if (i == 0 && j == 1) {
st = (TPaveStats *) h[6*i+j][0]->FindObject("stats");
st->SetOptStat(1100);
st->SetLineColor(kGreen);
st->SetTextColor(kGreen);
y = st->GetY1NDC();
dy = st->GetY2NDC() - y;
st->SetX1NDC(0.72);
st = (TPaveStats *) h[6*i+j][1]->FindObject("stats");
st->SetOptStat(1100);
st->SetLineColor(kRed);
st->SetTextColor(kRed);
st->SetX1NDC(0.72);
st->SetY2NDC(y);
st->SetY1NDC(y - dy);
} else {
st = (TPaveStats *) h[6*i+j][0]->FindObject("stats");
st->SetLineColor(kGreen);
st->SetTextColor(kGreen);
y = st->GetY1NDC();
dy = st->GetY2NDC() - y;
st->SetX1NDC(0.72);
st->SetY1NDC(y + dy/2);
st = (TPaveStats *) h[6*i+j][1]->FindObject("stats");
st->SetLineColor(kRed);
st->SetTextColor(kRed);
st->SetX1NDC(0.72);
st->SetY2NDC(y + dy/2);
}
if (h[6*i+j][0]->GetMaximum() > h[6*i+j][1]->GetMaximum()) {
h[6*i+j][0]->Draw();
h[6*i+j][1]->Draw("sames");
} else {
h[6*i+j][1]->Draw();
h[6*i+j][0]->Draw("sames");
}
gPad->Update();
}
cv[i]->Update();
}
fRoot->cd();
for (i=0; i<12; i++) for (j=0; j<2; j++) h[i][j]->Write();
fRoot->Close();
}