本文整理汇总了C++中TH2D::GetMaximum方法的典型用法代码示例。如果您正苦于以下问题:C++ TH2D::GetMaximum方法的具体用法?C++ TH2D::GetMaximum怎么用?C++ TH2D::GetMaximum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH2D
的用法示例。
在下文中一共展示了TH2D::GetMaximum方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Plot_2D
//.........这里部分代码省略.........
Ny, Ymin, Ymax);
for(int i = 0; i < N; i++){
base->GetEntry(i);
if(base->VMM != 0)
continue;
if(base->CHword == 24)
continue;
if(base->Delay != 30)
continue;
// hist->Fill(base->CHpulse,base->CHword,base->PDO);
//histN->Fill(base->CHpulse,base->CHword);
histN->Fill(base->CHpulse,base->BCID);
// if(base->CHpulse != 5)
// continue;
// base->CHpulse = base->CHword;
hist->Fill(base->VMM,base->CHpulse,base->PDO);
hist2->Fill(base->VMM,base->CHpulse,base->PDO*base->PDO);
// if(histN->GetBinContent(base->VMM,base->CHpulse) <= 0)
// histN->SetBinContent(base->VMM,base->CHpulse,base->BCID);
// else
// if(histN->GetBinContent(base->VMM,base->CHpulse) > base->BCID)
// histN->SetBinContent(base->VMM,base->CHpulse,base->BCID);
// histN->Fill(base->VMM,base->CHpulse);
}
for(int x = 0; x < Nx; x++){
for(int y = 0; y < Ny; y++){
double v = hist->GetBinContent(x+1,y+1);
double v2 = hist2->GetBinContent(x+1,y+1);
double N = histN->GetBinContent(x+1,y+1);
double vbar = v/max(int(N),1);
double v2bar = v2/max(int(N),1);
//hist->SetBinContent(x+1,y+1,sqrt(v2bar-vbar*vbar)/vbar);
hist->SetBinContent(x+1,y+1,vbar);
}
}
TCanvas* can = new TCanvas("can","can",600,500);
can->SetLeftMargin(0.15);
can->SetRightMargin(0.22);
can->SetBottomMargin(0.15);
can->SetTopMargin(0.08);
can->Draw();
can->SetGridx();
can->SetGridy();
can->cd();
hist = histN;
hist->Draw("COLZ");
hist->GetXaxis()->CenterTitle();
hist->GetXaxis()->SetTitleFont(132);
hist->GetXaxis()->SetTitleSize(0.06);
hist->GetXaxis()->SetTitleOffset(1.06);
hist->GetXaxis()->SetLabelFont(132);
hist->GetXaxis()->SetLabelSize(0.05);
hist->GetXaxis()->SetTitle(varXname.c_str());
hist->GetYaxis()->CenterTitle();
hist->GetYaxis()->SetTitleFont(132);
hist->GetYaxis()->SetTitleSize(0.06);
hist->GetYaxis()->SetTitleOffset(1.12);
hist->GetYaxis()->SetLabelFont(132);
hist->GetYaxis()->SetLabelSize(0.05);
hist->GetYaxis()->SetTitle(varYname.c_str());
hist->GetZaxis()->CenterTitle();
hist->GetZaxis()->SetTitleFont(132);
hist->GetZaxis()->SetTitleSize(0.06);
hist->GetZaxis()->SetTitleOffset(1.3);
hist->GetZaxis()->SetLabelFont(132);
hist->GetZaxis()->SetLabelSize(0.05);
hist->GetZaxis()->SetTitle(varZname.c_str());
hist->GetZaxis()->SetRangeUser(0.9*hist->GetMinimum(),1.1*hist->GetMaximum());
TLatex l;
l.SetTextFont(132);
l.SetNDC();
l.SetTextSize(0.05);
l.SetTextFont(132);
l.DrawLatex(0.5,0.943,"MMFE8 Analysis");
l.SetTextSize(0.04);
l.SetTextFont(42);
l.DrawLatex(0.15,0.943,"#bf{#it{ATLAS}} Internal");
l.SetTextSize(0.06);
l.SetTextFont(132);
l.DrawLatex(0.80,0.04, "VMM #6");
}
示例2: runDkl
void pidFitter::runDkl( TH2D* h, reporter * rp, string optPath ){
gStyle->SetOptStat( 1 );
int nS = config->getInt( optPath + ".dkl:nSpecies", 1 );
int nIt = config->getInt( optPath + ".dkl:nRuns", 1 );
double angle = config->getDouble( optPath + ".dkl:angle", 0 );
if ( nS <= 0 )
return;
if ( nIt <= 0 )
return;
if ( NULL == h || NULL == rp )
return;
double axisMin = config->getDouble( "binning.nSig:min", 0 );
double axisMax = config->getDouble( "binning.nSig:max", 0 );
dklMinimizer *dkl = new dklMinimizer( h, nS, angle );
dkl->run( nIt );
rp->newPage( 1, 2 );
rp->cd( 1, 1);
gPad->SetLogz(1);
dkl->viewInput( )->Draw("colz");
rp->cd( 2, 1);
gPad->SetLogz(1);
//TH2D* ap = dkl->viewApproximation( axisMin, axisMax, axisMin, axisMax );
TH2D* ap = dkl->viewApproximation( );
double min = 0.01;//ap->GetMinimum() * 0.1;
double max = ap->GetMaximum();
ap->Draw("colz");
rp->savePage();
rp->newPage( 1, 3 );
rp->cd( 1, 1);
gPad->SetLogz(1);
TH2D* s1 = NULL, *s2 = NULL, *s3 = NULL;
s1 = dkl->viewSpecies( 0 );
s1->GetZaxis()->SetRangeUser( min, max );
s1->Draw("colz");
if ( nS >= 2 ){
rp->cd( 1, 2);
gPad->SetLogz(1);
s2 = dkl->viewSpecies( 1 );
s2->GetZaxis()->SetRangeUser( min, max );
s2->Draw("colz");
}
if ( nS >= 3 ){
rp->cd( 1, 3);
gPad->SetLogz(1);
s3 = dkl->viewSpecies( 2 );
s3->GetZaxis()->SetRangeUser( min, max );
s3->Draw("colz");
}
rp->savePage();
rp->newPage();
uint ciS = dklMinimizer::speciesClosestTo( 0, 0, s1, s2, s3 );
//TH2 * cSpecies = dklMinimizer::viewSpeciesClosestTo( 0, 0, s1, s2, s3 );
//TH2D* ps1 = (TH2D*)cSpecies->Clone( "probabilityS1" );
TH2D * ps1 = (TH2D*) dkl->speciesProbabilityMap( ciS );
cout << " Input Yield: " << dkl->inputYield( ) << endl;;
cout << " Species Yield: " << dkl->speciesYield( ciS ) << endl;;
cout << " Total Approx Yield: " << dkl->approximationYield( ) << endl;;
makeSquareCuts( ps1, "K_Fit.dklPostFitCut" );
//ps1->Divide( ap );
ps1->Draw( "colz" );
ps1->GetZaxis()->SetRangeUser( 0, 1 );
rp->savePage();
//sDelete( s1 );
//sDelete( s2 );
//sDelete( s3 );
}
示例3: chipSummary
//.........这里部分代码省略.........
c1->cd(2);
hw->Draw();
tl->DrawLatex(0.1, 0.92, "S-Curve widths: Noise (e^{-})");
/* c1->cd(15);
hd->SetLineColor(kRed);
hd->Draw();
tl->DrawLatex(0.1, 0.92, "S-Curve widths of dead bumps");
if ( hd->GetEntries() > 0 ) {
ts->DrawLatex(0.55, 0.82, Form("entries: %4.0f", hd->GetEntries()));
ts->DrawLatex(0.55, 0.74, Form("#mu:%4.2f", hd->GetMean()));
ts->DrawLatex(0.55, 0.66, Form("#sigma: %4.2f", hd->GetRMS()));
}
*/
mN = hw->GetMean();
sN = hw->GetRMS();
nN = hw->Integral(hw->GetXaxis()->GetFirst(), hw->GetXaxis()->GetLast());
nN_entries = hw->GetEntries();
under = hw->GetBinContent(0);
over = hw->GetBinContent(hw->GetNbinsX()+1);
ts->DrawLatex(0.65, 0.82, Form("N: %4.0f", nN));
ts->DrawLatex(0.65, 0.74, Form("#mu: %4.1f", mN));
ts->DrawLatex(0.65, 0.66, Form("#sigma: %4.1f", sN));
if ( under ) ts->DrawLatex(0.15, 0.55, Form("<= %i", under));
if ( over ) ts->DrawLatex(0.75, 0.55, Form("%i =>", over ));
c1->cd(3);
if ( ht->GetMaximum() < htmax ) {
htmax = ht->GetMaximum();
}
if ( ht->GetMinimum() > htmin ) {
htmin = ht->GetMinimum();
}
ht->GetZaxis()->SetRangeUser(htmin,htmax);
ht->Draw("colz");
tl->DrawLatex(0.1, 0.92, "Vcal Threshold Untrimmed");
}
// -- Noise level map
c1->cd(4);
gPad->SetLogy(1);
gStyle->SetOptStat(1);
float mV(0.), sV(0.), nV(0.), nV_entries(0.);
over = 0.; under = 0.;
if (!g->IsZombie())
{
h1 = (TH1D*)g->Get(Form("VcalThresholdMap_C%iDistribution;7", chipId));
if (h1) {
h1->SetTitle("");
h1->SetAxisRange(0., 100.);
h1->Draw();
mV = h1->GetMean();
sV = h1->GetRMS();
nV = h1->Integral(h1->GetXaxis()->GetFirst(), h1->GetXaxis()->GetLast());
nV_entries = h1->GetEntries();
示例4: moduleSummary
//.........这里部分代码省略.........
fit[ifit] = new TH1D(Form("%s", fitNames[ifit].Data()),"", nChips, float(startChip), float(startChip+nChips));
fitEntries[ifit] = new TH1D(Form("n%s", fitNames[ifit].Data()),"", nChips, float(startChip), float(startChip+nChips));
fit[ifit]->SetLineColor(EColor[ifit]);
fit[ifit]->SetMarkerColor(EColor[ifit]);
fit[ifit]->SetMarkerStyle(EMarkerStyle[ifit]);
fit[ifit]->SetMarkerSize(0.5);
}
for (int i = startChip; i < startChip+nChips; i++) { addVcalThreshold(dirName, i, mThreshold); }
for (int i = startChip; i < startChip+nChips; i++) { addChip("vcals_xtalk", i, mBumps); }
TFile *f1 = new TFile(Form("%s/%s", dirName, adFileName));
for (int i = startChip; i < startChip+nChips; i++) { addChip("AddressDecoding", i, mAddr);}
if ( nChips < 16 && startChip == 0 ) {
for (int i = 8; i < nChips+8; i++) { removeChip(i, mThreshold, -99); }
for (int i = 8; i < nChips+8; i++) { removeChip(i, mBumps, -99); }
for (int i = 8; i < nChips+8; i++) { removeChip(i, mAddr, -99); }
}
if ( nChips < 16 && startChip == 8 ) {
for (int i = 0; i < nChips; i++) { removeChip(i, mThreshold, -99); }
for (int i = 0; i < nChips; i++) { removeChip(i, mBumps, -99); }
for (int i = 0; i < nChips; i++) { removeChip(i, mAddr, -99); }
}
TString noslash(dirName);
noslash.ReplaceAll("/", "");
noslash.ReplaceAll("..", "");
c1->cd(1);
if ( mThreshold->GetMaximum() < mThresholdmax ) {
mThresholdmax = mThreshold->GetMaximum();
}
if ( mThreshold->GetMinimum() > mThresholdmin ) {
mThresholdmin = mThreshold->GetMinimum();
}
mThreshold->GetZaxis()->SetRangeUser(mThresholdmin,mThresholdmax);
mThreshold->DrawCopy("colz");
tl->DrawLatex(0.1, 0.92, "Vcal threshold");
tl->DrawLatex(0.75, 0.92, Form("%s",noslash.Data()));
if ( nChips < 16 && startChip == 0 ) {
box->SetFillColor(29);
box->DrawBox( 0, 0, 416, 80);
}
if ( nChips < 16 && startChip == 8 ) {
box->SetFillColor(29);
box->DrawBox( 0, 80, 416, 160);
}
c1->cd(2);
mBumps->SetMaximum(2.);
mBumps->SetMinimum(-2.);
mBumps->DrawCopy("colz");
tl->DrawLatex(0.1, 0.92, "Bump bonding map");
if ( nChips < 16 && startChip == 0 ) {
示例5: plotXY
//.........这里部分代码省略.........
pad->cd();
Double_t low = his->GetMean()-w*his->GetRMS();
Double_t up = his->GetMean()+w*his->GetRMS();
his->Fit("gaus","Q0","",low,up);
his2->Draw("colz");
module->Draw("same");
TF1 *fit = his->GetFunction("gaus");
// cout << "sensor " << i << " axial mean : " << his->GetMean()*1000. << " - RMS : " << his->GetRMS()*1000. << " (um) " << " " << his->GetEntries() << endl;
// cout << "sensor " << i << " axial mu : " << fit->GetParameter(1)*1000. << " - sigma : " << fit->GetParameter(2)*1000. << " (um) " << endl;
// outf << layer.Data() << " " << fit->GetParameter(1)*1000. << " " << fit->GetParameter(2)*1000. << " " << his->GetEntries() << endl;
hisname = "h_xy_module_L"; hisname += i;
hisname += "t_halfmodule_stereo_sensor0";
layer = "L"; layer+=i; layer+= "TS";
his2 = (TH2D*) f->Get(hisname.Data());
his = (TH1D*)his2->ProjectionY();
ipad++;
pd = "tp"; pd+=ipad;
pad = (TPad*) cTop->GetListOfPrimitives()->FindObject(pd.Data());
pad->cd();
low = his->GetMean()-w*his->GetRMS();
up = his->GetMean()+w*his->GetRMS();
his->Fit("gaus","Q","",low,up); his2->Draw("colz");
module->Draw("same");
fit = his->GetFunction("gaus");
}
// ic = 19;
for(Int_t i=4; i<7; i++){
TString hisname = "h_xy_module_L"; hisname += i;
TString hisname2 = hisname;
hisname += "t_halfmodule_axial_hole_sensor0";
hisname2 += "t_halfmodule_axial_slot_sensor0";
TH2D *hisOther = (TH2D*) f->Get(hisname2.Data());
Double_t norma2 = hisOther->GetMaximum();
TString layer = "L"; layer+=i; layer+= "TAHo";
TH2D *his2 = (TH2D*) f->Get(hisname.Data());
TH1D *his = (TH1D*)his2->ProjectionY();
Double_t norma1 = his2->GetMaximum();
Double_t normamax = TMath::Max(norma1,norma2);
his2->SetMaximum(normamax);
ipad++;
TString pd = "tp"; pd+=ipad;
TPad *pad = (TPad*) cTop->GetListOfPrimitives()->FindObject(pd.Data());
pad->cd();
Double_t low = his->GetMean()-w*his->GetRMS();
Double_t up = his->GetMean()+w*his->GetRMS();
his->Fit("gaus","Q0","",low,up); his2->Draw("colz");
module->Draw("same");
TF1 *fit = his->GetFunction("gaus");
hisname = "h_xy_module_L"; hisname += i;
hisname2 = hisname;
hisname += "t_halfmodule_stereo_hole_sensor0";
hisname2 += "t_halfmodule_stereo_slot_sensor0";
TH2D *hisOther = (TH2D*) f->Get(hisname2.Data());
norma2 = hisOther->GetMaximum();
TString layer = "L"; layer+=i; layer+= "TAHo";
TH2D *his2 = (TH2D*) f->Get(hisname.Data());
TH1D *his = (TH1D*)his2->ProjectionY();
norma1 = his2->GetMaximum();
normamax2 = TMath::Max(norma1,norma2);
his2->SetMaximum(normamax2);
layer = "L"; layer+=i; layer+= "TSHo";
his2 = (TH2D*) f->Get(hisname.Data());
his = (TH1D*)his2->ProjectionY();
ipad++; ipad++;
pd = "tp"; pd+=ipad;
示例6: talk
//.........这里部分代码省略.........
if (draw) pad = new TPad(TString("Pad"+ss.str()),"",0.,0.,1.,1.);
if (pad) {
pad->SetGrid();
pad->Draw();
pad->cd();
pad->SetLogz();
}
TH1F* hr = 0;
if (draw) hr = pad->DrawFrame(0.,0.,1.,1.);
// Histo title
if (hr) {
std::stringstream sss;
sss << "H_{T}=" << ht_min[iht]
<< "(p_{T1},p_{T2},p_{T3})="
<< pt1_min[iht] << ","
<< pt2_min[iht] << ","
<< pt3_min[iht] << ")"
<< ", (x_{1},x_{2},x_{3})="
<< x1_min[iht] << ","
<< x2_min[iht] << ","
<< x3_max[iht] << ")";
hr->SetTitle( sss.str().c_str() );
hr->GetXaxis()->SetTitle( "x_{2}" );
hr->GetYaxis()->SetTitle( "x_{1}" );
}
// Create 2D cross-section plot
TH2D* his = 0;
if (draw) his = new TH2D(TString("Histo"+ss.str()),"",
xbins,xmin,xmax,
ybins,ymin,ymax);
// Fill 2D cross-section plot
for ( int xbin = 0; xbin < xbins; ++xbin ) {
for ( int ybin = 0; ybin < ybins; ++ybin ) {
double x2 = ( ( xmax - xmin ) / xbins ) * xbin + xmin;
double x1 = ( ( ymax - ymin ) / ybins ) * ybin + ymin;
double val = ( x1*x1 + x2*x2 ) / ( ( 1 - x1 ) * ( 1 - x2 ) );
if ( !constrain( x1, x2, x3 ) ) { continue; }
if ( x1 < x1_cut[ix1] ) { continue; }
double alpha_t = x2 / ( 2 * sqrt(x1+x2-1) );
if (his) his->Fill( x2+xbin_centre, x1+ybin_centre, val );
}
}
// Draw 2D cross-section plot
gStyle->SetPalette(1);
if (his) {
his->SetMaximum( his->GetMaximum() );
his->SetMinimum( his->GetMinimum(1.e-12) );
his->Draw("COLZsame");
}
// Pad for AlphaT contours
if (c1) c1->cd();
TPad* overlay = 0;
if (draw) overlay = new TPad(TString("Overlay"+ss.str()),"",0.,0.,1.,1.);
if (overlay) {
overlay->SetFillStyle(4000);
overlay->SetFillColor(0);
overlay->SetFrameFillStyle(4000);
overlay->Draw();
overlay->cd();
}
TH1F* hframe = 0;
if (draw) overlay->DrawFrame(pad->GetUxmin(),
pad->GetUymin(),
pad->GetUxmax(),
pad->GetUymax());
// Graphs of AlphaT contours
TMultiGraph* mg = 0;
if (draw) {
mg = new TMultiGraph();
for ( Int_t iat = 0; iat < nat; iat++ ) {
Double_t alpha_t = at[iat];
const Int_t n_ = 100;
Double_t x1_[n_];
Double_t x2_[n_];
for ( Int_t j = 0; j < 100; j++ ) {
x2_[j] = j*0.01;
Double_t temp = ( x2_[j] - 2. * alpha_t * alpha_t ) / ( 2. * alpha_t );
x1_[j] = temp * temp + 1 - alpha_t * alpha_t;
}
TGraph* gr = new TGraph(n_,x2_,x1_);
mg->Add(gr,"l");
}
mg->Draw();
}
if (c1) c1->cd();
if (c1) c1->SaveAs(TString(ss.str()+".png"));
}
}
示例7: rob
//.........这里部分代码省略.........
pad->SetLogz(1);
TH1F* hr = pad->DrawFrame(0.,0.,1.,1.);
const int nx = 3;
const int ny = 10;
double pt[nx] = { 30., 50., 100. };
double ht[ny];
for ( int ii = 0; ii < ny; ++ii ) { ht[ii] = 150. + ii * 50.; }
double ratio[nx][ny];
double xbin_centre = ( ( xmax - xmin ) / xbins ) / 2.;
double ybin_centre = ( ( ymax - ymin ) / ybins ) / 2.;
TH2D* his = new TH2D("Contours","",xbins,xmin,xmax,ybins,ymin,ymax);
for ( int ii = 0; ii < nx; ++ii ) {
for ( int jj = 0; jj < ny; ++jj ) {
double x3 = ( 2. * pt[ii] ) / ( ht[jj] + pt[ii] );
double n = 0.;
double d = 0.;
for ( int xbin = 0; xbin < xbins; ++xbin ) {
for ( int ybin = 0; ybin < ybins; ++ybin ) {
double x2 = ( ( xmax - xmin ) / xbins ) * xbin + xmin;
double x1 = ( ( ymax - ymin ) / ybins ) * ybin + ymin;
double val = ( x1*x1 + x2*x2 ) / ( ( 1 - x1 ) * ( 1 - x2 ) );
if ( x1 < x2 || // jet ordering by Pt
x1 + x2 > 2. || // from relation "x1 + x2 + x3 = 2"
x1 > 1.0 || // from "lost jet" and relation "xmiss = -x1 -x2"
x1 + x2 < 1. // from "lost jet" and relation "xmiss = -x1 -x2"
) { continue; }
if ( ( x1 + x2 ) < ( 2 - x3 ) ) { continue; }
d += val;
double alpha_t = x2 / ( 2 * sqrt(x1+x2-1) );
if ( alpha_t > 0.5 ) n+= val;
if ( ii == 2 && jj == 9 ) { his->Fill( x2+xbin_centre, x1+ybin_centre, val ); }
}
}
double r = 0.;
if ( d > 0. ) { r = n/d; }
ratio[ii][jj] = r;
std::cout << " Pt: " << pt[ii]
<< " ht: " << ht[jj]
<< " x3: " << x3
<< " r: " << r
<< " n: " << n
<< " d: " << d
<< std::endl;
}
}
gStyle->SetPalette(1);
his->SetMaximum( his->GetMaximum() );
his->SetMinimum( his->GetMinimum(1.e-12) );
his->Draw("COLZsame");
// c1->cd();
// TPad* overlay = new TPad("overlay","",0.,0.,1.,1.);
// overlay->SetFillStyle(4000);
// overlay->SetFillColor(0);
// overlay->SetFrameFillStyle(4000);
// overlay->Draw();
// overlay->cd();
// Double_t pxmin = pad->GetUxmin();
// Double_t pymin = pad->GetUymin();
// Double_t pxmax = pad->GetUxmax();
// Double_t pymax = pad->GetUymax();
// TH1F* hframe = overlay->DrawFrame(pxmin,pymin,pxmax,pymax);
// TMultiGraph* mg = new TMultiGraph();
// for ( Int_t i = 0; i < 10; i++ ) {
// Double_t alpha_t = 0.5 + i*0.01;
// const Int_t n_ = 100;
// Double_t x1_[n_];
// Double_t x2_[n_];
// for ( Int_t j = 0; j < 100; j++ ) {
// x2_[j] = j*0.01;
// Double_t temp = ( x2_[j] - 2. * alpha_t * alpha_t ) / ( 2. * alpha_t );
// x1_[j] = temp * temp + 1 - alpha_t * alpha_t;
// }
// TGraph* gr = new TGraph(n_,x2_,x1_);
// mg->Add(gr,"l");
// }
// mg->Draw();
// TCanvas* c2 = new TCanvas( "Contours1", "" );
// c2->cd();
// TMultiGraph* mg2 = new TMultiGraph();
// for ( Int_t ii = 0; ii < 3; ii++ ) {
// TGraph* gr = new TGraph(ny,ht,ratio[ii]);
// mg2->Add(gr,"l");
// }
// mg2->Draw("a");
// c1->cd();
// c1->SaveAs("c1.png");
// c2->cd();
// c2->SaveAs("c2.png");
}
示例8: main
int main(int argc, char *argv[])
{
ApplyLHCbStyle();
double maxrate;
switch(argc)
{
case 2:
maxrate=-1;
break;
case 3:
if(atoi(argv[2]))
maxrate=atoi(argv[2]);
else
{
cout << "Argument not a number" << endl;
return 1;
}
break;
default:
cout << "Usage: " << argv[0] << " <Filename> [<Max rate>]" << endl;
return 1;
}
if(system("[ -a figs ]") != 0)
{
cout << "Directory ./figs/ does not exist" << endl;
const int mkdirerr = system("mkdir figs");
if(mkdirerr != 0)
{
cout << "Error code " << mkdirerr << " while creating ./figs/" << endl;
}
else
{
cout << "Directory ./figs/ created" << endl;
}
}
TFile* file = new TFile(argv[1]);
if(!file->IsOpen())
{
cout << "Exiting" << endl;
return 1;
}
TTree* tree = (TTree*)file->Get("metatree");
int iHV; tree->SetBranchAddress("HV", &iHV);
vector<int> HVs;
string HV;
int n = tree->GetEntries();
TCanvas* mapscan, * histcan, * graphcan, * indivgraphcan[4];
TPad* mapspad[4], * histpad[4];
TH1D* hist;
TH2D* map;
string title[4] = {"JB", "JT", "ST", "SB"};
// string title[4] = {"FA0026", "DA0024", "FA0019", "FA0006"};
TGraphErrors* graph[4];
TMultiGraph* mg;
TLegend* lg;
float xlo, xhi, ylo, yhi;
// rainbowgradient();
heatmapgradient();
// DarkBodyRadiator();
// DarkBodyRadiator2();
// redbluegradient();
// heatmapRB();
string plotname;
stringstream plotnamestream;
double* x[4], * y[4], * xe[4], * ye[4];
for(int j = 0; j < 4; j++)
{
x[j] = new double[n];
y[j] = new double[n];
xe[j] = new double[n];
ye[j] = new double[n];
}
Double_t maxima[4];
cout << "Entering loop of " << n << " events." << endl;
for(int i = 0; i < n; i++)
{
tree->GetEntry(i);
HVs.push_back(iHV);
HV = itoa(iHV);
for(int j = 0; j < 4; j++)
{
map = (TH2D*)file->Get(("DarkMap"+HV+"V"+itoa(j)).c_str());
maxima[j] = map->GetMaximum();
}
}
sort(HVs.begin(), HVs.end());
if(maxrate==-1)
{
for(int i = 1; i < 4; i++)
{
maxrate = TMath::Max(maxima[i-1], maxima[i]);
maxima[i]=maxrate;
}
}
// cout << "Plotting with a maximum rate of " << maxrate << endl;
for(int i = 0; i < n; i++)
{
HV = itoa(HVs[i]);
plotnamestream << "DarkRate" << setfill('0') << setw(4) << HVs[i];
//.........这里部分代码省略.........
示例9: chipSummary
//.........这里部分代码省略.........
c1->cd(2);
hw->Draw();
tl->DrawLatex(0.1, 0.92, "S-Curve widths: Noise (e^{-})");
/* c1->cd(15);
hd->SetLineColor(kRed);
hd->Draw();
tl->DrawLatex(0.1, 0.92, "S-Curve widths of dead bumps");
if ( hd->GetEntries() > 0 ) {
ts->DrawLatex(0.55, 0.82, Form("entries: %4.0f", hd->GetEntries()));
ts->DrawLatex(0.55, 0.74, Form("#mu:%4.2f", hd->GetMean()));
ts->DrawLatex(0.55, 0.66, Form("#sigma: %4.2f", hd->GetRMS()));
}
*/
mN = hw->GetMean();
sN = hw->GetRMS();
nN = hw->Integral(hw->GetXaxis()->GetFirst(), hw->GetXaxis()->GetLast());
nN_entries = hw->GetEntries();
under = hw->GetBinContent(0);
over = hw->GetBinContent(hw->GetNbinsX()+1);
ts->DrawLatex(0.65, 0.82, Form("N: %4.0f", nN));
ts->DrawLatex(0.65, 0.74, Form("#mu: %4.1f", mN));
ts->DrawLatex(0.65, 0.66, Form("#sigma: %4.1f", sN));
if ( under ) ts->DrawLatex(0.15, 0.55, Form("<= %i", under));
if ( over ) ts->DrawLatex(0.75, 0.55, Form("%i =>", over ));
c1->cd(3);
if ( ht->GetMaximum() < htmax ) {
htmax = ht->GetMaximum();
}
if ( ht->GetMinimum() > htmin ) {
htmin = ht->GetMinimum();
}
ht->GetZaxis()->SetRangeUser(htmin,htmax);
ht->Draw("colz");
tl->DrawLatex(0.1, 0.92, "Vcal Threshold from SCurve");
}
// -- Noise level map
c1->cd(4);
gPad->SetLogy(1);
gStyle->SetOptStat(1);
float mV(0.), sV(0.), nV(0.), nV_entries(0.);
over = 0.; under = 0.;
if (!g->IsZombie())
{
h1 = (TH1D*)g->Get(Form("VcalThresholdMap_C%iDistribution;7", chipId));
if (h1) {
h1->SetTitle("");
h1->SetAxisRange(0., 100.);
h1->Draw();
mV = h1->GetMean();
sV = h1->GetRMS();
nV = h1->Integral(h1->GetXaxis()->GetFirst(), h1->GetXaxis()->GetLast());
nV_entries = h1->GetEntries();
under = h1->GetBinContent(0);
示例10: plotXY
void plotXY(){
gROOT->Reset();
gROOT->SetStyle("Plain");
gStyle->SetHistMinimumZero(kFALSE);
Int_t status = gSystem->Load("../rootils_C.so");
std::cout << "status: " << status << std::endl;
// TString dir("allStat_6hits/");
// TString dir("allStat_noWeiBug/");
TString dir("./");
//Agguanta gli istogrammi
TFile * SimF = new TFile(dir+"Sim_XY.root");
TH2D * SimH = (TH2D*) SimF->Get("Sim_XY");;
//
TFile * MCF = new TFile(dir+"MC_XY.root");
TH2D * MCH = (TH2D*) MCF->Get("MC_XY");;
//
// TFile * MCFsF = new TFile(dir+"rMCFs_XY.root");
// TH2D * MCFsH = (TH2D*) MCFsF->Get("rMCFs_XY");;
//
TFile * FakeF = new TFile(dir+"MCFake_XY.root");
TH2D * FakeH = (TH2D*) FakeF->Get("MCFake_XY");;
//
TFile * DataF = new TFile(dir+"Data_XY.root");
TH2D * DataH = (TH2D*) DataF->Get("Data_XY");;
//
// TFile * DataFsF = new TFile(dir+"rDataFs_XY.root");
// TH2D * DataFsH = (TH2D*) DataFsF->Get("rDataFs_XY");;
//
cout << MCH->GetEntries() << " " << MCH->GetEffectiveEntries() << " " << MCH->Integral() << endl;
cout << DataH->GetEntries() << " " << DataH->GetEffectiveEntries() << " " << DataH->Integral() << endl;
//Normalize to plot entries
SimH->Scale(1./SimH->Integral());
MCH->Scale(1./MCH->Integral());
FakeH->Scale(1./FakeH->Integral());
DataH->Scale(1./DataH->Integral());
cout << MCH->GetEntries() << " " << MCH->GetEffectiveEntries() << " " << MCH->Integral() << endl;
cout << DataH->GetEntries() << " " << DataH->GetEffectiveEntries() << " " << DataH->Integral() << endl;
//Max
Double_t simMax=SimH->GetMaximum();
Double_t simPxlMax=GetMaxWithinRadius(SimH, 15.);
Double_t simPxlInt=GetIntWithinRZ(SimH, 15., 0.);
Double_t MCMax=MCH->GetMaximum();
Double_t MCPxlMax=GetMaxWithinRadius(MCH, 15.);
Double_t MCPxlInt=GetIntWithinRZ(MCH, 15., 0.);
Double_t DataMax=DataH->GetMaximum();
Double_t DataPxlMax=GetMaxWithinRadius(DataH, 15.);
Double_t DataPxlInt=GetIntWithinRZ(DataH, 15., 0.);
Double_t mAx=max(MCMax,DataMax);
std::cout << " max >>>> mc " << MCMax << " data " << DataMax << " Sim " << simMax << std::endl;
std::cout << " pxl max >>>> mc " << MCPxlMax << " data " << DataPxlMax << " Sim " << simPxlMax << std::endl;
std::cout << " pxl int >>>> mc " << MCPxlInt << " data " << DataPxlInt << " Sim " << simPxlInt << std::endl;
// This would be need to normalize SimH to the pixel region material (taking into account that SimH and DataH/MCH have different binning!)
//
// SimH->Scale(DataPxlInt*(DataH->GetXaxis()->GetBinWidth(1)*DataH->GetYaxis()->GetBinWidth(1))/simPxlInt/(SimH->GetXaxis()->GetBinWidth(1)*SimH->GetYaxis()->GetBinWidth(1)));
// I prefer to have Sim plots and Data/MC plot to look similar by appropriately scaling the SimH range, not by scaling the histo
mAx=0.001;
// mAx=0.011;
// mAx=0.15*0.5*(MCPxlMax+DataPxlMax);
Double_t simRangeScale = 1./(DataPxlInt*(DataH->GetXaxis()->GetBinWidth(1)*DataH->GetYaxis()->GetBinWidth(1))/simPxlInt/(SimH->GetXaxis()->GetBinWidth(1)*SimH->GetYaxis()->GetBinWidth(1)));
std::cout << simRangeScale << endl;
std::cout << (DataH->GetXaxis()->GetBinWidth(1)*DataH->GetYaxis()->GetBinWidth(1)) << endl;
std::cout << (SimH->GetXaxis()->GetBinWidth(1)*SimH->GetYaxis()->GetBinWidth(1)) << endl;
SimH->SetMaximum(mAx*simRangeScale);
MCH->SetMaximum(mAx);
DataH->SetMaximum(mAx);
//
makeColorTable();
Plot2D(SimH, "#gamma conv., MC Truth", dir);
Plot2D(MCH, "#gamma conv., MC Reco #sqrt{s}=8TeV", dir);
Plot2D(DataH, "#gamma conv., Data #sqrt{s}=8TeV", dir);
//
/*
TH2D *MCCoarse = MCH->Rebin2D(2,2,"MCCoarse");
TH2D *DataCoarse = DataH->Rebin2D(2,2,"DataCoarse");
*/
/*
cout << MCCoarse->GetEntries() << " " << MCCoarse->GetEffectiveEntries() << endl;
cout << DataCoarse->GetEntries() << " " << DataCoarse->GetEffectiveEntries() << endl;
*/
//.........这里部分代码省略.........