本文整理汇总了C++中TPaletteAxis类的典型用法代码示例。如果您正苦于以下问题:C++ TPaletteAxis类的具体用法?C++ TPaletteAxis怎么用?C++ TPaletteAxis使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TPaletteAxis类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: wfd_raw_fill_reset
void wfd_raw_fill_reset(const int run_nr = 0)
{
int i;
char name[256];
const int n_crates = WFD_NUMBER_OF_CRATES;
TH2D *h2[n_crates];
//=========================================================
// *** initialize style ***
//=========================================================
init();
gStyle->SetOptStat(11);
//=========================================================
// *** open canvas ***
//=========================================================
TCanvas *c1 = new TCanvas("c1","c1",0,0,800,1000);
c1->Draw();
c1->cd();
c1->Divide(2,3,0.001,0.001,10);
//=========================================================
// *** receive and plot histograms ***
//=========================================================
for (i=0; i<n_crates; i++) {
sprintf(name,"WFDrawFillHasResetBlock%s",wfd_crate_name[i]);
h2[i] = (TH2D*) get_hist(name, run_nr);
if ( !h2[i] ) continue;
int ipad = i+1;
c1->cd(ipad);
h2[i]->Draw("ColZ");
c1->GetPad(ipad)->Update();
h2[i]->SetXTitle("fill counter");
h2[i]->SetYTitle("(slot-1)*4 + chan.");
h2[i]->GetXaxis()->SetRangeUser(0.0,2000.0);
TPaletteAxis *palette = (TPaletteAxis*)h2[i]->GetListOfFunctions()->FindObject("palette");
if ( palette ) {
palette->SetX2NDC( palette->GetX1NDC()+0.01 );
palette->Draw();
}
}
c1->SaveAs("../png/wfd_raw_fill_reset.png");
}
开发者ID:alcap-org,项目名称:AlcapDAQ,代码行数:58,代码来源:wfd_raw_fill_reset.C
示例2: makeplots2D
// Make 2D efficiency plots
void makeplots2D( TH2& eff, TString name) {
gROOT->ProcessLine(".L ~/tdrstyle.C");
setTDRStyle();
const Int_t NRGBs = 5;
const Int_t NCont = 200;
Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
tdrStyle->SetNumberContours(NCont);
if(name.Contains("_Pt")) {
eff.GetXaxis()->SetTitle("p_{T} (GeV/c)");
eff.GetYaxis()->SetTitle("#eta ");
}
if(name.Contains("_Phi")) {
eff.GetXaxis()->SetTitle("#phi ");
eff.GetYaxis()->SetTitle("#eta ");
}
eff.GetYaxis()->SetTitleOffset(1);
tdrStyle->SetPadLeftMargin(0.08);
tdrStyle->SetPadRightMargin(0.1);
TCanvas canvas("canvas",name,600,600);
eff.Draw("colz");
gPad->Update();
TPaletteAxis* palette =
(TPaletteAxis*)eff.GetListOfFunctions()->FindObject("palette");
palette->SetLabelSize(0.02);
canvas.SaveAs(name + TString(".eps"));
canvas.SaveAs(name + TString(".gif"));
canvas.Close();
}
开发者ID:ajaykumar649,项目名称:scripts,代码行数:42,代码来源:CompareWithNikos_23Jun08.C
示例3: MovePaletteHorizontally
TPaletteAxis* MovePaletteHorizontally(TH1 *histo, Double_t step) {
TPaletteAxis *palette = (TPaletteAxis*)histo->GetListOfFunctions()->FindObject("palette");
if (palette) {
palette->SetX1NDC(palette->GetX1NDC()-step);
palette->SetX2NDC(palette->GetX2NDC()-step);
palette->GetAxis()->SetLabelOffset(0.01);
} else {
std::cout << "Palette not found!" << std::endl;
}
return palette;
}
开发者ID:FCALSW,项目名称:FCalClusterer,代码行数:11,代码来源:RootUtils.cpp
示例4: repositionPalette
void repositionPalette(std::string name)
{
// Reposition and resize palette
TH2F *h = (TH2F*)gDirectory->GetList()->FindObject(name.c_str());
TPaletteAxis *pal;
pal = (TPaletteAxis*)h->FindObject("palette");
pal->SetX1NDC(0.83);
pal->SetY1NDC(0.14);
pal->SetX2NDC(0.88);
pal->SetY2NDC(0.60);
pal->SetLabelSize(.04);
}
开发者ID:frmeier,项目名称:usercode,代码行数:12,代码来源:dataPlots01.C
示例5: repositionPalette
void repositionPalette(std::string name)
{
// Reposition and resize palette
TH2F *h = (TH2F*)gDirectory->GetList()->FindObject(name.c_str());
TPaletteAxis *pal;
pal = (TPaletteAxis*)h->FindObject("palette");
if (0==pal)
{
cout << "Palette not found - cannot reposition it" << endl;
return;
}
pal->SetX1NDC(0.83);
pal->SetY1NDC(0.14);
pal->SetX2NDC(0.88);
pal->SetY2NDC(0.60);
pal->SetLabelSize(.04);
cout << "Repo" << endl;
}
开发者ID:frmeier,项目名称:usercode,代码行数:18,代码来源:genPlots02.C
示例6: plot
//.........这里部分代码省略.........
TFile* f = new TFile(file_name.c_str(),"READ");
TDirectory* d = (TDirectory*)f->Get(dir.c_str());
TH2D* his = (TH1*)d->Get(histo.c_str());
if ( !his ) return;
//his->Rebin2D(2,2);
if ( true ) { gPad->SetLogz(); }
if ( scale ) his->Scale( lumi / 100. );
his->SetMaximum(1.e4);
his->SetMinimum(1.e-5);
//his->SetMinimum( his->GetMinimum(1.e-12) );
// his->SetMaximum( 20000. );
// his->SetMinimum( 2.e-4 );
// his->SetMaximum( 20000. );
// his->SetMinimum( 20. );
double xmin = his->GetXaxis()->GetXmin();
double xmax = his->GetXaxis()->GetXmax();
double ymin = his->GetYaxis()->GetXmin();
double ymax = his->GetYaxis()->GetXmax();
// Reset title
std::string title = ";" + std::string(his->GetXaxis()->GetTitle()) + ";" + std::string(his->GetYaxis()->GetTitle());
his->SetTitle(title.c_str());
his->GetXaxis()->SetTitle("x_{2}");
his->GetXaxis()->SetTitleOffset(1.2);
his->GetYaxis()->SetTitle("x_{1}");
his->GetYaxis()->SetTitleOffset(1.4);
his->Draw("COLZ");
gPad->Update();
// Lumi
if (1) {
std::stringstream ss;
ss << "#int L dt = " << lumi << " pb^{-1}";
double xpos = 0.05 * (xmax-xmin)+xmin;
double ypos = 0.25 * (ymax-ymin)+ymin;
TLatex* text1 = new TLatex(xpos,ypos,ss.str().c_str());
text1->SetTextAlign(12);
text1->SetTextSize(0.035);
text1->Draw();
}
// Jet type
if (1) {
double xpos = 0.05 * (xmax-xmin)+xmin;
double ypos = 0.15 * (ymax-ymin)+ymin;
TText* text2 = new TText(xpos,ypos,type.c_str());
text2->SetTextAlign(12);
text2->SetTextSize(0.035);
text2->Draw();
}
// Sample
if (1) {
double xpos = 0.05 * (xmax-xmin)+xmin;
double ypos = 0.10 * (ymax-ymin)+ymin;
TText* text3 = new TText(xpos,ypos,sample.c_str());
text3->SetTextAlign(12);
text3->SetTextSize(0.035);
text3->Draw();
}
// Stats
gStyle->SetOptStat("i");
his->SetStats(1);
TPaveStats* stats = (TPaveStats*)his->GetListOfFunctions()->FindObject("stats");
std::string stats_pos = "br";
if ( stats ) {
stats->SetFillColor(0);
stats->SetLineColor(0);
stats->SetShadowColor(0);
if ( stats_pos == "tr" ) {
stats->SetX1NDC(0.60); stats->SetY1NDC(0.68); stats->SetX2NDC(0.83); stats->SetY2NDC(0.88);
} else if ( stats_pos == "br" ) {
stats->SetX1NDC(0.60); stats->SetY1NDC(0.18); stats->SetX2NDC(0.83); stats->SetY2NDC(0.28);
} else {
stats->SetX1NDC(0.60); stats->SetY1NDC(0.68); stats->SetX2NDC(0.83); stats->SetY2NDC(0.88);
}
}
// Scale
gStyle->SetPalette(1);
TPaletteAxis* palette = (TPaletteAxis*)his->GetListOfFunctions()->FindObject("palette");
if ( palette ) {
palette->SetY1NDC(0.2);
palette->SetY2NDC(0.8);
}
canvas->Modified();
canvas->cd();
canvas->SetSelected(canvas);
canvas->SaveAs(std::string(canvas_name+".png").c_str());
//canvas->Write();
}
开发者ID:bainbrid,项目名称:usercode,代码行数:101,代码来源:plot_2d.C
示例7: makeEfficiency_74X_setBr
//.........这里部分代码省略.........
hRecoPt->Fill(ptreco,weightF);
hRecoRap->Fill(etareco,weightF);
hRecoLxy->Fill(lxy, weightF);
}
}
}// end of event loop
cout << "hGenPt integral = " << hGenPt->Integral() << endl;
cout << "hRecoPt integral = " << hRecoPt->Integral() << endl;
cout << "hGenRap integral = " << hGenRap->Integral() << endl;
cout << "hRecoRap integral = " << hRecoRap->Integral() << endl;
cout << "hGenLxy integral = " << hGenLxy->Integral() << endl;
cout << "hRecoLxy integral = " << hRecoLxy->Integral() << endl;
//calculate efficiency
hEffPtY->Divide(hRecoPtY,hGenPtY,1,1,"b");
hEffPt->Divide(hRecoPt,hGenPt,1,1,"b");
hEffRap->Divide(hRecoRap,hGenRap,1,1,"b");
hEffLxy->Divide(hRecoLxy,hGenLxy,1,1,"b");
//Legend
TLegend *legUR = new TLegend(0.56,0.68,0.90,0.90,NULL,"brNDC");
TLegend *legUL = new TLegend(0.17,0.68,0.51,0.90,NULL,"brNDC");
TLegend *legBM = new TLegend(0.40,0.20,0.75,0.35,NULL,"brNDC");
TLegend *legBR = new TLegend(0.56,0.20,0.90,0.42,NULL,"brNDC");
SetLegendStyle(legUR);
SetLegendStyle(legUL);
SetLegendStyle(legBM);
SetLegendStyle(legBR);
TCanvas *c1 = new TCanvas("c1","c1",600,600);
//draw 2D Pt-y
TPaletteAxis* pal;
hEffPtY->SetMinimum(0.0);
hEffPtY->SetMaximum(1.0);
if (isPair) hEffPtY->GetXaxis()->SetTitle("y");
else hEffPtY->GetXaxis()->SetTitle("#eta");
hEffPtY->GetXaxis()->CenterTitle();
hEffPtY->GetYaxis()->SetTitle("p_{T} (GeV)");
hEffPtY->Draw("colz");
c1->Update();
pal = (TPaletteAxis*)hEffPtY->GetListOfFunctions()->FindObject("palette");
pal->SetX2NDC(0.92);
c1->Modified();
c1->Update();
c1->SaveAs(Form("%s/EffPtY_isPtCut%d_doWeight%d_isEmbedded%d_%s_%s_%s.pdf",strDir.c_str(),(int)isPtCut,(int)doWeight,(int)isEmbedded,strPrompt.c_str(),strEmbd.c_str(),strPair.c_str()));
c1->Clear();
//draw EffPt
SetHistStyle(hEffPt,3,0);
hEffPt->SetMinimum(0.0);
hEffPt->SetMaximum(1.0);
if (isPair) hEffPt->GetXaxis()->SetTitle("Pair p_{T} (GeV)");
else hEffPt->GetXaxis()->SetTitle("Trk p_{T} (GeV)");
hEffPt->GetYaxis()->SetTitle("Efficiency");
hEffPt->Draw("pe");
c1->SaveAs(Form("%s/EffPt_isPtCut%d_doWeight%d_isEmbedded%d_%s_%s_%s.pdf",strDir.c_str(),(int)isPtCut,(int)doWeight,(int)isEmbedded,strPrompt.c_str(),strEmbd.c_str(),strPair.c_str()));
c1->Clear();
//draw EffRap
SetHistStyle(hEffRap,3,0);
hEffRap->SetMinimum(0.0);
hEffRap->SetMaximum(1.0);
if (isPair) hEffRap->GetXaxis()->SetTitle("y");
else hEffRap->GetXaxis()->SetTitle("#eta");
开发者ID:KiSooLee,项目名称:pPbJPsiAnalysis,代码行数:67,代码来源:makeEfficiency_74X_setBr.C
示例8: correlations
// input: - Input file (result from TMVA),
// - use of colors or grey scale
// - use of TMVA plotting TStyle
void correlations( TString fin = "TMVA.root",TString outputdir="plots", Bool_t isRegression = kFALSE,
Bool_t greyScale = kFALSE, Bool_t useTMVAStyle = kTRUE )
{
// set style and remove existing canvas'
TMVAGlob::Initialize( useTMVAStyle );
// checks if file with name "fin" is already open, and if not opens one
TFile* file = TMVAGlob::OpenFile( fin );
// signal and background or regression problem
Int_t ncls = (isRegression ? 1 : 2 );
TString hName[2] = { "CorrelationMatrixS", "CorrelationMatrixB" };
if (isRegression) hName[0]= "CorrelationMatrix";
const Int_t width = 600;
for (Int_t ic=0; ic<ncls; ic++) {
TH2* h2 = file->Get( hName[ic] );
if(!h2) {
cout << "Did not find histogram " << hName[ic] << " in " << fin << endl;
continue;
}
TCanvas* c = new TCanvas( hName[ic],
Form("Correlations between MVA input variables (%s)",
(isRegression ? "" : (ic==0 ? "signal" : "background"))),
ic*(width+5)+200, 0, width, width );
Float_t newMargin1 = 0.13;
Float_t newMargin2 = 0.15;
if (TMVAGlob::UsePaperStyle) newMargin2 = 0.13;
c->SetGrid();
c->SetTicks();
c->SetLeftMargin ( newMargin2 );
c->SetBottomMargin( newMargin2 );
c->SetRightMargin ( newMargin1 );
c->SetTopMargin ( newMargin1 );
gStyle->SetPalette( 1, 0 );
gStyle->SetPaintTextFormat( "3g" );
h2->SetMarkerSize( 1.5 );
h2->SetMarkerColor( 0 );
Float_t labelSize = 0.040;
h2->GetXaxis()->SetLabelSize( labelSize );
h2->GetYaxis()->SetLabelSize( labelSize );
h2->LabelsOption( "d" );
h2->SetLabelOffset( 0.011 );// label offset on x axis
h2->Draw("colz"); // color pads
c->Update();
// modify properties of paletteAxis
TPaletteAxis* paletteAxis = (TPaletteAxis*)h2->GetListOfFunctions()->FindObject( "palette" );
paletteAxis->SetLabelSize( 0.03 );
paletteAxis->SetX1NDC( paletteAxis->GetX1NDC() + 0.02 );
h2->Draw("textsame"); // add text
// add comment
TText* t = new TText( 0.53, 0.88, "Linear correlation coefficients in %" );
t->SetNDC();
t->SetTextSize( 0.026 );
t->AppendPad();
// TMVAGlob::plot_logo( );
c->Update();
TString fname = outputdir + TString("/");
fname += hName[ic];
TMVAGlob::imgconv( c, fname );
}
}
开发者ID:igormarfin,项目名称:TMA-Optimization,代码行数:76,代码来源:correlations.C
示例9: BinCovarianceHggRazor
//.........这里部分代码省略.........
corr->SetBinContent(412,-0.8086588);
corr->SetBinContent(413,2.505161);
corr->SetBinContent(414,8.661255);
corr->SetBinContent(415,0.5727072);
corr->SetBinContent(416,-1.17764);
corr->SetBinContent(417,-1.085029);
corr->SetBinContent(418,30.42);
corr->SetMinimum(-4000);
corr->SetMaximum(4000);
corr->SetEntries(361);
corr->SetStats(0);
corr->SetContour(20);
corr->SetContourLevel(0,-4000);
corr->SetContourLevel(1,-3600);
corr->SetContourLevel(2,-3200);
corr->SetContourLevel(3,-2800);
corr->SetContourLevel(4,-2400);
corr->SetContourLevel(5,-2000);
corr->SetContourLevel(6,-1600);
corr->SetContourLevel(7,-1200);
corr->SetContourLevel(8,-800);
corr->SetContourLevel(9,-400);
corr->SetContourLevel(10,0);
corr->SetContourLevel(11,400);
corr->SetContourLevel(12,800);
corr->SetContourLevel(13,1200);
corr->SetContourLevel(14,1600);
corr->SetContourLevel(15,2000);
corr->SetContourLevel(16,2400);
corr->SetContourLevel(17,2800);
corr->SetContourLevel(18,3200);
corr->SetContourLevel(19,3600);
TPaletteAxis *palette = new TPaletteAxis(19.11905,-0.7931685,20.2619,19.82922,corr);
palette->SetLabelColor(1);
palette->SetLabelFont(42);
palette->SetLabelOffset(0.005);
palette->SetLabelSize(0.035);
palette->SetTitleOffset(1);
palette->SetTitleSize(0.035);
Int_t ci; // for color index setting
TColor *color; // for color definition with alpha
ci = TColor::GetColor("#f9f90e");
palette->SetFillColor(ci);
palette->SetFillStyle(1001);
corr->GetListOfFunctions()->Add(palette,"br");
ci = TColor::GetColor("#000099");
corr->SetLineColor(ci);
corr->GetXaxis()->SetBinLabel(1,"Bin 0");
corr->GetXaxis()->SetBinLabel(2,"Bin 1");
corr->GetXaxis()->SetBinLabel(3,"Bin 2");
corr->GetXaxis()->SetBinLabel(4,"Bin 3");
corr->GetXaxis()->SetBinLabel(5,"Bin 4");
corr->GetXaxis()->SetBinLabel(6,"Bin 5");
corr->GetXaxis()->SetBinLabel(7,"Bin 6");
corr->GetXaxis()->SetBinLabel(8,"Bin 7");
corr->GetXaxis()->SetBinLabel(9,"Bin 8");
corr->GetXaxis()->SetBinLabel(10,"Bin 9 HighRes");
corr->GetXaxis()->SetBinLabel(11,"Bin 10 HighRes");
corr->GetXaxis()->SetBinLabel(12,"Bin 11 HighRes");
corr->GetXaxis()->SetBinLabel(13,"Bin 12 HighRes");
corr->GetXaxis()->SetBinLabel(14,"Bin 13 HighRes");
corr->GetXaxis()->SetBinLabel(15,"Bin 9 LowRes");
corr->GetXaxis()->SetBinLabel(16,"Bin 10 LowRes");
开发者ID:RazorCMS,项目名称:RazorEWKSUSYAnalysis,代码行数:67,代码来源:BinCovarianceHggRazor.C
示例10: PlotEvolutionsWIII
//.........这里部分代码省略.........
if(i>0) { // skip x axis labels except for the lowest one
hFrame[i]->GetXaxis()->SetLabelSize(0.0);
hFrame[i]->GetXaxis()->SetTitleSize(0.0);
}
if(opt.Contains("nomar")) {
hFrame[i]->GetYaxis()->SetTickLength(0.0);
hFrame[i]->GetXaxis()->SetTickLength(0.0);
}
// Labels for the frames
}
// Access to color Palettes
TExec *exPlasma = new TExec("exPlasma","plasmaPalette->cd();");
TExec *exElec = new TExec("exElec","electron0Palette->cd();");
TExec *exHot = new TExec("exHot","hotPalette->cd();");
TExec *exField = new TExec("exField","rbowwhitePalette->cd();");
TExec *exFieldT = new TExec("exFieldT","red0Palette->cd();");
TExec *exIonP = new TExec("exIonP","redelectron0Palette->cd();");
TExec *exPot = new TExec("exPot","rbowinvPalette->cd();");
// Actual Plotting!
// ------------------------------------------------------------
C->cd(0);
Float_t x1,x2,y1,y2;
Float_t gap = 0.01;
TPaletteAxis *palette = NULL;
UInt_t ip = NPad-1;
if(mask & 0x1) {
pad[ip]->Draw();
pad[ip]->cd();
if(opt.Contains("logz")) {
pad[ip]->SetLogz(1);
} else {
pad[ip]->SetLogz(0);
}
hFrame[ip]->Draw("col");
// hDen1DvsTime->GetZaxis()->SetNdivisions(503);
hDen1DvsTime->GetZaxis()->SetTitleFont(fonttype);
Float_t xFactor = pad[0]->GetAbsWNDC()/pad[ip]->GetAbsWNDC();
Float_t yFactor = pad[0]->GetAbsHNDC()/pad[ip]->GetAbsHNDC();
hDen1DvsTime->GetZaxis()->SetTickLength(xFactor*tylength/yFactor);
exElec->Draw();
hDen1DvsTime->Draw("colz same");
pad[ip]->Update();
y1 = pad[ip]->GetBottomMargin();
y2 = 1 - pad[ip]->GetTopMargin();
x1 = pad[ip]->GetLeftMargin();
x2 = 1 - pad[ip]->GetRightMargin();
palette = (TPaletteAxis*) hDen1DvsTime->GetListOfFunctions()->FindObject("palette");
if(palette) {
开发者ID:delaossa,项目名称:ptools,代码行数:67,代码来源:PlotEvolutionsWIII.C
示例11: PlotRakeInjection
//.........这里部分代码省略.........
hFrame[k]->SetTickLength(0.04,"xyz");
hFrame[k]->SetTickLength(0.04*vfactor,"y");
hFrame[k]->GetYaxis()->SetLabelSize(0.03/vfactor);
hFrame[k]->GetYaxis()->SetLabelOffset(0.02);
hFrame[k]->GetYaxis()->SetTitleSize(0.03/vfactor);
hFrame[k]->GetYaxis()->SetTitleOffset(999.0*vfactor);
if(k==0) {
hFrame[k]->GetXaxis()->SetLabelSize(0.10);
hFrame[k]->GetXaxis()->SetLabelOffset(0.02);
hFrame[k]->GetXaxis()->SetTitleSize(0.14);
hFrame[k]->GetXaxis()->SetTitleOffset(1.0);
} else {
hFrame[k]->GetXaxis()->SetLabelSize(0.0);
hFrame[k]->GetXaxis()->SetTitleSize(0.0);
}
hFrame[k]->Draw("axis");
exPlasma->Draw();
// Sum of histograms!
hDen2D[k][0]->Add(hDen2D[k][1]);
// hDen2D[k][0]->GetZaxis()->SetRangeUser(Min[1],Max[1]);
hDen2D[k][0]->Draw("colz same");
pad[k]->Update();
TPaletteAxis *palette = (TPaletteAxis*)hDen2D[k][0]->GetListOfFunctions()->FindObject("palette");
Float_t y1 = pad[k]->GetBottomMargin();
Float_t y2 = 1 - pad[k]->GetTopMargin();
Float_t x1 = pad[k]->GetLeftMargin();
Float_t x2 = 1 - pad[k]->GetRightMargin();
palette->SetY2NDC(y2 - 1*(y2-y1)/2.0 - 0.00);
palette->SetY1NDC(y1 + 0*(y2-y1)/2.0 + 0.00);
palette->SetX1NDC(x2 + 0.005);
palette->SetX2NDC(x2 + 0.03);
palette->SetLabelFont(42);
palette->SetLabelSize(0.03/vfactor);
palette->SetLabelOffset(-0.004);
palette->SetTitleSize(0.03/vfactor);
palette->SetTitleOffset(9999.0*vfactor);
palette->SetBorderSize(2);
palette->SetLineColor(1);
exHot->Draw();
hDen2D[k][2]->Draw("colz same");
pad[k]->Update();
palette = (TPaletteAxis*)hDen2D[k][2]->GetListOfFunctions()->FindObject("palette");
palette->SetY2NDC(y2 - 0*(y2-y1)/2.0 - 0.00);
palette->SetY1NDC(y1 + 1*(y2-y1)/2.0 + 0.00);
palette->SetX1NDC(x2 + 0.005);
palette->SetX2NDC(x2 + 0.03);
palette->SetLabelFont(42);
开发者ID:delaossa,项目名称:ptools,代码行数:67,代码来源:PlotRakeInjection.C
示例12: DrawIt
//------------------------------------------------------------------------------
// DrawIt
//------------------------------------------------------------------------------
void DrawIt(TString filename,
TString hname,
TString cname,
TString title)
{
TFile* inputfile = TFile::Open("../AuxiliaryFilesWZXS8TeV/" + filename + ".root");
TH2F* h = (TH2F*)inputfile->Get(hname)->Clone(cname);
h->SetDirectory(0);
inputfile->Close();
TString name = h->GetName();
TCanvas* canvas = new TCanvas(name, name, 600, 600);
if (name.Contains("PR")) canvas->SetLogx();
if (name.Contains("SF")) canvas->SetLogx();
canvas->SetLeftMargin (0.9 * canvas->GetLeftMargin());
canvas->SetRightMargin(3.5 * canvas->GetRightMargin());
canvas->SetTopMargin (1.2 * canvas->GetTopMargin());
TH2FAxisFonts(h, "x", "p_{T} [GeV]");
TH2FAxisFonts(h, "y", "#eta");
h->Draw("colz");
h->SetTitle("");
DrawTLatex(42, 0.940, 0.976, _bigLabelSize, 33, title);
if (!title.Contains("trigger")) {
Double_t hmin = h->GetMinimum();
Double_t hmax = h->GetMaximum();
for (Int_t i=1; i<=h->GetNbinsX(); i++) {
for (Int_t j=1; j<=h->GetNbinsY(); j++) {
Double_t value = h->GetBinContent(i,j);
Double_t ypos = h->GetYaxis()->GetBinCenter(j);
Double_t xpos = h->GetXaxis()->GetBinCenter(i);
if (gPad->GetLogx()) xpos = h->GetXaxis()->GetBinCenterLog(i);
TLatex* latex = new TLatex(xpos, ypos, Form("%.2f", value));
latex->SetTextAlign( 22);
latex->SetTextFont ( 42);
latex->SetTextSize (0.027);
if (value < hmin + 0.3*(hmax - hmin)) latex->SetTextColor(kWhite);
latex->Draw();
}
}
}
// Set the palette font
//----------------------------------------------------------------------------
canvas->Update();
TPaletteAxis* palette = (TPaletteAxis*)h->GetListOfFunctions()->FindObject("palette");
palette->SetLabelFont(42);
// Save the plot
//----------------------------------------------------------------------------
canvas->Update();
canvas->Modified();
canvas->GetFrame()->DrawClone();
canvas->SaveAs("pdf/scale_factors/" + name + ".pdf");
canvas->SaveAs("png/scale_factors/" + name + ".png");
}
开发者ID:piedraj,项目名称:usercode,代码行数:85,代码来源:drawScaleFactors.C
示例13: macro_2Dhisto
void macro_2Dhisto(TString channel, TString njmt, TString syst, TString region, TString BDT1_name, TString BDT2_name, TString lep){
if((lep=="electron"||lep=="electronantiiso")&& channel=="QCDMuPt20toInf") return;
if((lep=="muonantiiso"||lep=="electronantiiso") && channel=="TT_sd") return;
if((channel.Contains("hdamp")||channel.Contains("psq2"))&&((lep=="muonantiiso"||lep=="electronantiiso")||(syst!=""))) return;
TFile * f=TFile::Open("trees_lumi/"+lep+"/trees_"+channel+"_"+lep+".root");
TString treename, histoname;
TH2F * h2 = new TH2F("h2", "h2",10,-1,1,10,-1,1);
// Float_t BDT1, BDT2, etajprime, mtw, w, w_nominal, var_syst;
gStyle->SetOptStat(0);
TString outfilename, taglio, selection;
selection = "BDT_"+BDT1_name+":BDT_"+BDT2_name;
if(syst.EqualTo("jesUp")||syst.EqualTo("jesDown")||syst.EqualTo("jerUp")||syst.EqualTo("jerDown")) treename = "events_"+njmt+"_"+syst;
else treename = "events_"+njmt;
TTree * t =(TTree*)f->Get(treename);
if(region=="cr") taglio = "(mtw>50 && etajprime<2.4";
else taglio = "(mtw>50 && etajprime>2.4";
if(lep=="electronantiiso") taglio += " &&mlb>30";
if(syst.EqualTo("")){
histoname = "h2D_"+njmt+"_"+channel+"_"+region;
t->Project("h2",selection,taglio+")*w*w_nominal");
}
else{
if(syst.EqualTo("jesUp")||syst.EqualTo("jesDown")||syst.EqualTo("jerUp")||syst.EqualTo("jerDown")){
histoname = "h2D_"+njmt+"_"+channel+"_"+region+"_"+syst;
t->Project("h2",selection,taglio+")*w*w_nominal");
}
else{
histoname = "h2D_"+njmt+"_"+channel+"_"+region+"_"+syst;
t->Project("h2",selection,taglio+")*w*"+syst);
}
}
h2->SetName(histoname);
TCanvas * c = new TCanvas( "c1"," ");
Float_t newMargin1 = 0.13;
Float_t newMargin2 = 0.15;
c->SetGrid();
c->SetTicks();
c->SetLeftMargin ( newMargin2 );
c->SetBottomMargin( newMargin2 );
c->SetRightMargin ( newMargin1 );
c->SetTopMargin ( newMargin1 );
gStyle->SetPalette( 1, 0 );
gStyle->SetPaintTextFormat( "3g" );
h2->SetMarkerSize( 1.5 );
h2->SetMarkerColor( 0 );
Float_t labelSize = 0.040;
h2->GetXaxis()->SetLabelSize( labelSize );
h2->GetYaxis()->SetLabelSize( labelSize );
h2->GetXaxis()->SetTitle( "BDT_"+BDT1_name );
h2->GetYaxis()->SetTitle( "BDT_"+BDT2_name );
// h2->LabelsOption( "d" );
h2->SetLabelOffset( 0.011 );// label offset on x axis
h2->Draw("colz"); // color pads
c->Update();
// modify properties of paletteAxis
TPaletteAxis * paletteAxis = (TPaletteAxis*)h2->GetListOfFunctions()->FindObject( "palette" );
paletteAxis->SetLabelSize( 0.03 );
paletteAxis->SetX1NDC( paletteAxis->GetX1NDC() + 0.02 );
h2->Draw("textsame"); // add text
// TMVAGlob::plot_logo( );
c->Update();
outfilename = "Plot/histo2D_"+lep+".root";
TFile * fout = TFile::Open(outfilename, "UPDATE");
h2->Write();
c->SaveAs("Plot2D/"+histoname+"_"+lep+".pdf");
}
开发者ID:oiorio,项目名称:NAAnaFW,代码行数:68,代码来源:macro_2Dhisto.C
示例14: PlotPotential2D
//.........这里部分代码省略.........
}
{
TGraph *gr = (TGraph*) graphsI2D.At(1);
gr->Draw("C");
}
if(opt.Contains("1dline")) {
lineYzero->Draw();
lineYdown->Draw();
lineYup->Draw();
}
if(opt.Contains("sline")) {
if(zStartPlasma>xmin && zStartPlasma<xmax)
lineStartPlasma->Draw();
if(zStartNeutral>xmin && zStartNeutral<xmax)
lineStartNeutral->Draw();
if(zEndNeutral>xmin && zEndNeutral<xmax)
lineEndNeutral->Draw();
}
// lineYdown->Draw();
// lineYup->Draw();
// Palettes re-arrangement
pad[0]->Update();
Float_t y1 = pad[0]->GetBottomMargin();
Float_t y2 = 1 - pad[0]->GetTopMargin();
Float_t x1 = pad[0]->GetLeftMargin();
Float_t x2 = 1 - pad[0]->GetRightMargin();
TPaletteAxis *palette = NULL;
if(Nspecies>=3) {
if(hDen2D[2]) {
palette = (TPaletteAxis*)hDen2D[2]->GetListOfFunctions()->FindObject("palette");
}
}
if(palette) {
palette->SetY2NDC(y2 - 0.00);
palette->SetY1NDC(0.66*(y1+y2) + 0.00);
palette->SetX1NDC(x2 + 0.005);
palette->SetX2NDC(x2 + 0.03);
// palette->SetTitleFont(42);
// palette->SetTitleOffset(0.85);
palette->SetTitleOffset(999.9);
palette->SetTitleSize(0.075);
palette->SetLabelFont(42);
palette->SetLabelSize(0.075);
palette->SetLabelOffset(0.001);
palette->SetBorderSize(2);
palette->SetLineColor(1);
}
palette = (TPaletteAxis*)hDen2D[0]->GetListOfFunctions()->FindObject("palette");
if(palette) {
palette->SetY2NDC(0.66*(y1+y2) - 0.00);
palette->SetY1NDC(0.33*(y1+y2) + 0.00);
palette->SetX1NDC(x2 + 0.005);
palette->SetX2NDC(x2 + 0.03);
// palette->SetTitleFont(42);
palette->SetTitleOffset(0.80);
palette->SetTitleSize(0.075);
palette->SetLabelFont(42);
palette->SetLabelSize(0.075);
开发者ID:delaossa,项目名称:ptools,代码行数:67,代码来源:PlotPotential2D.C
示例15: draw_2D
void draw_2D(bool isPrompt = true, bool is8rap9pt2gev = true)
{
gROOT->Macro("./JpsiStyle2D.C");
gStyle->SetPaintTextFormat(".3f");
// --- read-in file
TFile * f2D;
char* sampleName;
char* strPrompt;
char* strBin;
if (isPrompt) { strPrompt = "PRMC";}
else { strPrompt = "NPMC";}
if (is8rap9pt2gev) { strBin = "8rap9pt2gev";}
else { strBin = "6rap3pt";}
// f2D = new TFile(Form("./EffCounting_%s_%spythia_Pbp_useCtErr_1_useDataDriven_1_useZvtxStep1_0_Step2_1.root",strBin,strPrompt));
f2D = new TFile(Form("./EffCounting_%s_%spythia_Pbp_useCtErr_1_useDataDriven_0_useZvtxStep1_0_Step2_1.root",strBin,strPrompt));
sampleName = Form("%s_%s",strBin,strPrompt);
cout << "sampleName = " << sampleName << endl;
// --- read-in 2D hist
TH2D* h2D_Den = (TH2D*)f2D->Get("h2D_Den_pt_y");
TH2D* h2D_Num = (TH2D*)f2D->Get("h2D_Num_pt_y");
TH2D* h2D_Eff = (TH2D*)f2D->Get("h2D_Eff_pt_y");
//latex box for beam, rapidity, pT info
TLatex* latex = new TLatex();
latex->SetNDC();
latex->SetTextAlign(12);
latex->SetTextSize(0.04);
//////////////////////////////////////////////////////////////////
// --- Draw histograms
TCanvas* c1 = new TCanvas("c1","c1",700,600);
TPaletteAxis* pal;
c1->cd();
/*
h2D_Den->GetXaxis()->SetTitle("y_{lab}");
h2D_Den->GetXaxis()->CenterTitle();
h2D_Den->GetYaxis()->SetTitle("p_{T} (GeV/c)");
h2D_Den->Draw("colz");
c1->Update();
pal = (TPaletteAxis*)h2D_Den->GetListOfFunctions()->FindObject("palette");
pal->SetX2NDC(0.92);
c1->Modified();
c1->Update();
c1->SaveAs(Form("acc2Dplots/h2D_Den_isPrompt%d.pdf",(int)isPrompt));
h2D_Num->GetXaxis()->SetTitle("y_{lab}");
h2D_Num->GetXaxis()->CenterTitle();
h2D_Num->GetYaxis()->SetTitle("p_{T} (GeV/c)");
h2D_Num->Draw("colz");
c1->Update();
pal = (TPaletteAxis*)h2D_Num->GetListOfFunctions()->FindObject("palette");
pal->SetX2NDC(0.92);
c1->Modified();
c1->Update();
c1->SaveAs(Form("acc2Dplots/h2D_Num_isPrompt%d.pdf",(int)isPrompt));
*/
h2D_Eff->GetXaxis()->SetTitle("y_{lab}");
h2D_Eff->GetXaxis()->CenterTitle();
h2D_Eff->GetYaxis()->SetTitle("p_{T} (GeV/c)");
h2D_Eff->SetMaximum(1.);
h2D_Eff->Draw("colz");
//h2D_Eff->SetMarkerSize(0.8);
//h2D_Eff->Draw("text e colz");
c1->Update();
pal = (TPaletteAxis*)h2D_Eff->GetListOfFunctions()->FindObject("palette");
pal->SetX2NDC(0.92);
c1->Modified();
c1->Update();
if (is8rap9pt2gev) {
dashedLine(-2.4,2.0,-1.97,2.0,1,4);
dashedLine(-1.97,2.0,-1.97,3.0,1,4);
dashedLine(-1.97,3.0,-1.37,3.0,1,4);
dashedLine(-1.37,3.0,-1.37,6.5,1,4);
dashedLine(-1.37,6.5,1.03,6.5,1,4);
dashedLine(1.03,5.0,1.03,6.5,1,4);
dashedLine(1.03,5.0,1.46,5.0,1,4);
dashedLine(1.46,3.0,1.46,5.0,1,4);
dashedLine(1.46,3.0,1.93,3.0,1,4);
dashedLine(1.93,2.0,1.93,3.0,1,4);
dashedLine(1.93,2.0,2.4,2.0,1,4);
dashedLine(2.4,2.0,2.4,30.0,1,4);
dashedLine(-2.4,30.0,2.4,30.0,1,4);
dashedLine(-2.4,2.0,-2.4,30.0,1,4);
}
else {
dashedLine(-2.4,5.0,-1.97,5.0,1,4);
dashedLine(-1.97,5.0,-1.97,6.5,1,4);
dashedLine(-1.97,6.5,1.03,6.5,1,4);
dashedLine(1.03,5.0,1.03,6.5,1,4);
dashedLine(1.03,5.0,1.46,5.0,1,4);
dashedLine(1.46,5.0,1.46,30.0,1,4);
dashedLine(-2.4,30.0,1.46,30.0,1,4);
dashedLine(-2.4,5.0,-2.4,30.0,1,4);
}
c1->SaveAs(Form("eff2Dplots/h2D_Eff_%s.pdf",sampleName));
//.........这里部分代码省略.........
开发者ID:CmsHI,项目名称:pPbJPsiAnalysis,代码行数:101,代码来源:draw_2D.C
示例16: EventDisplayForBaby
void EventDisplayForBaby(bool sig=false, bool truth=true, bool fatjet=true, int event=-1)
{
gInterpreter->ExecuteMacro("~/macros/rootlogon.C");
// chain
TChain *ch = new TChain("tree");
if(!sig) ch->Add("babies/small_quick_cfA_746p1_nleps1_trig0ON.root");
if(sig) ch->Add("~/scratch/plots/1d_2015d_13Jan2016/2d/48ipb/*.root");
InitBaby(ch);
Int_t nentries = (Int_t)ch->GetEntries();
for(int i = 0; i<nentries; i++)
{
ch->GetEntry(i);
// apply selections (event==-1 && mj_>xxx && ht_>yyy && ...)
// or
// select an event (event!=-1 && event_=xxxxxx)
// "event" is one of the arguments
if(event>0 && event_!=event) continue;
//
// Event Display
//
float start=0.62;
float nextline = start;
float increment = 0.04;
float offset=0.02;
int npert;
int LSPcol[2] = {kCyan+1,kOrange-4};
if(!sig) npert = 5;
else npert=3;
float xalign = 0.82;
vector<TMarker> constituents, genpart;
TEllipse *cone[fjets_pt_->size()];
TH2F *h_fatjets = new TH2F("h_fatjets","h_fatjets", 230, -5.0, 5.0, 144, -3.141592, 3.141592);
cout << event_ << endl;
for(int ifj = 0; ifj< (int)fjets_pt_->size(); ifj++)
{ if(ifj==0) cout << "... Fatjets info(pT, eta, phi, mj)" << endl;
h_fatjets->Fill(fjets_eta_->at(ifj),fjets_phi_->at(ifj), fjets_m_->at(ifj));
cout << fjets_pt_->at(ifj) << " " << fjets_eta_->at(ifj) << " "
<< fjets_phi_->at(ifj) << " " << fjets_m_->at(ifj) << endl;
}
TString cname = Form("Event_%lli_",event_);
TCanvas *c = new TCanvas(cname,cname,1640,760);
gPad->SetRightMargin(0.35);
h_fatjets->SetZTitle("m_{j} [GeV]");
h_fatjets->GetZaxis()->SetTitleSize(0.05);
h_fatjets->GetZaxis()->SetTitleOffset(0.55);
h_fatjets->GetYaxis()->SetTitleOffset(0.6);
h_fatjets->Draw("colz");
h_fatjets->GetZaxis()->SetRangeUser(0,1.1*h_fatjets->GetMaximum());
h_fatjets->Draw("colz");
gPad->Update();
TPaletteAxis *palette = (TPaletteAxis*)h_fatjets->GetListOfFunctions()->FindObject("palette");
for(int ifj = 0; ifj< (int)fjets_pt_->size(); ifj++)
{
cone[ifj] = new TEllipse(fjets_eta_->at(ifj),fjets_phi_->at(ifj), 1.2, 1.2);
// cone[ifj]->SetFillStyle(3003);
cone[ifj]->SetFillStyle(0);
Int_t binx,biny,binz;
h_fatjets->GetBinXYZ(h_fatjets->FindBin(fjets_eta_->at(ifj),fjets_phi_->at(ifj)),binx,biny,binz);
//cout<<"bin x bin y "<<binx<<" "<<biny<<endl;
//cout<<"content "<<h_fatjets->GetBinContent(binx,biny)<<endl;
//cout<<palette<<endl;
Int_t ci = palette->GetBinColor(binx,biny);
if(ifj==0) ci = palette->GetBinColor(binx,biny);
//cout<<"color"<<ci<<endl;
cone[ifj]->SetFillColor(kGray);
cone[ifj]->SetLineColor(ci);
}
float lepPt, lepEta, lepPhi;
if(nels_==1)
{
for(int i=0; i<(int)els_pt_->size(); i++)
{
if(els_miniso_->at(i)>0.1) continue;
if(els_sigid_->at(i)!=1) continue;
if(els_pt_->at(i)<20) continue;
lepPt =els_pt_->at(i);
lepEta =els_eta_->at(i);
lepPhi =els_phi_->at(i);
}
}
if(nmus_==1)
{
for(int i=0; i<(int)mus_pt_->size(); i++)
{
if(mus_miniso_->at(i)>0.2) continue;
if(mus_sigid_->at(i)!=1) continue;
if(mus_pt_->at(i)<20) continue;
lepPt =mus_pt_->at(i);
//.........这里部分代码省略.........
开发者ID:jaehyeok,项目名称:MJ,代码行数:101,代码来源:EventDisplay.C
示例17: printEff
void printEff(TTree* HltTree,const char *cut,const char *title, char *projectTitle)
{
cout <<" * "<<title<<":"<<endl;
cout <<" * Efficiencies:"<<endl;
double nEvt = HltTree->GetEntries(cut);
cout <<" | "<<setw(20)<<"HLT Path";
cout <<" | "<<setw(25)<<"Efficiency";
cout <<" | "<<endl;
triggers->clear();
triggerCuts->clear();
vector <double*> effs;
// calculate the efficiency //
effs.push_back(calcEff(HltTree,"L1Tech_BSC_OR",nEvt,Form("(%s)&&L1Tech_BSC_minBias_OR.v0==1",cut)));
effs.push_back(calcEff(HltTree,"L1Tech_BSC_thr1",nEvt,Form("(%s)&&L1Tech_BSC_minBias_threshold1.v0==1",cut)));
effs.push_back(calcEff(HltTree,"L1Tech_BSC_thr2",nEvt,Form("(%s)&&L1Tech_BSC_minBias_threshold2.v0==1",cut)));
effs.push_back(calcEff(HltTree,"L1Tech_BSC_inner_thr1",nEvt,Form("(%s)&&L1Tech_BSC_minBias_inner_threshold1.v0==1",cut)));
effs.push_back(calcEff(HltTree,"L1Tech_BSC_inner_thr2",nEvt,Form("(%s)&&L1Tech_BSC_minBias_inner_threshold2.v0==1",cut)));
effs.push_back(calcEff(HltTree,"L1Tech_HF_coinc_PM",nEvt,Form("(%s)&&L1Tech_HCAL_HF_coincidence_PM.v0==1",cut)));
effs.push_back(calcEff(HltTree,"HLT_MBPixel_1Track",nEvt,Form("(%s)&&HLT_MinBiasPixel_SingleTrack==1",cut)));
//effs.push_back(calcEff(HltTree,"L1Tech_BSC_splash_beam1.v0",nEvt,Form("(%s)&&L1Tech_BSC_splash_beam1.v0==1",cut)));
//effs.push_back(calcEff(HltTree,"L1Tech_BSC_splash_beam2.v0",nEvt,Form("(%s)&&L1Tech_BSC_splash_beam2.v0==1",cut)));
//effs.push_back(calcEff(HltTree,"All",nEvt,Form("(%s)&&(L1Tech_BSC_minBias_threshold1.v0||L1Tech_BSC_minBias_threshold2.v0||L1Tech_BSC_minBias_OR.v0||L1Tech_BSC_minBias_inner_threshold1.v0||L1Tech_BSC_minBias_inner_threshold2.v0||L1Tech_BSC_splash_beam1.v0||L1Tech_BSC_splash_beam2.v0)",cut)));
results->push_back(effs);
cout <<" * Correlation Matrix:"<<endl;
int tsize = (int)triggers->size();
TH2D *h = new TH2D(Form("h%s",title),"",tsize,0,tsize,tsize,0,tsize);
TH2D *hct = new TH2D(Form("h%s_ct",title),"",tsize,0,tsize,tsize,0,tsize);
for (int i=tsize-1;i>=0;i--){
int nEvtAfterCut = HltTree->GetEntries((*triggerCuts)[i].c_str());
h->GetXaxis()->SetBinLabel(i+1,(*triggers)[i].c_str());
|
请发表评论