本文整理汇总了C++中TH1F类的典型用法代码示例。如果您正苦于以下问题:C++ TH1F类的具体用法?C++ TH1F怎么用?C++ TH1F使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TH1F类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: track_start
void track_start(char const * c) {
//gStyle->SetOptStat(0);
TFile * file = TFile::Open(c);
TTree * tree = (TTree*)file->Get("track_start");
TFile * ofile = TFile::Open("track_start_plot.root", "recreate");
TCanvas * temp = new TCanvas("startdist");
tree->Draw("startdist>>ht");
TH1F * h = dynamic_cast<TH1F *>(gDirectory->Get("ht"));
h->SetTitle("");
h->GetXaxis()->CenterTitle();
h->GetXaxis()->SetTitle("Reco - MC Track Start Distance [cm]");
temp->Write();
delete temp;
delete h;
TCanvas * temp2 = new TCanvas("startdistzoom");
tree->Draw("startdist>>htt(100, 0, 10)");
TH1F * h2 = dynamic_cast<TH1F *>(gDirectory->Get("htt"));
h2->SetTitle("");
h2->GetXaxis()->CenterTitle();
h2->GetXaxis()->SetTitle("Reco - MC Track Start Distance [cm]");
temp2->Write();
delete temp2;
delete h2;
TCanvas * dcx = new TCanvas("trackx");
tree->Draw("recostartx-truestartx>>hx(100, -5, 5)");
TH1F * hx = dynamic_cast<TH1F *>(gDirectory->Get("hx"));
hx->SetTitle("X-axis");
hx->GetXaxis()->CenterTitle();
hx->GetXaxis()->SetTitle("Reco - MC Track Start Distance [cm]");
dcx->Write();
delete dcx;
delete hx;
TCanvas * dcy = new TCanvas("tracky");
tree->Draw("recostarty-truestarty>>hy(100, -5, 5)");
TH1F * hy = dynamic_cast<TH1F *>(gDirectory->Get("hy"));
hy->SetTitle("Y-axis");
hy->GetXaxis()->CenterTitle();
hy->GetXaxis()->SetTitle("Reco - MC Track Start Distance [cm]");
dcy->Write();
delete dcy;
delete hy;
TCanvas * dcz = new TCanvas("trackz");
tree->Draw("recostartz-truestartz>>hz(100, -5, 5)");
TH1F * hz = dynamic_cast<TH1F *>(gDirectory->Get("hz"));
hz->SetTitle("Z-axis");
hz->GetXaxis()->CenterTitle();
hz->GetXaxis()->SetTitle("Reco - MC Track Start Distance [cm]");
dcz->Write();
delete dcz;
delete hz;
ofile->Close();
}
开发者ID:rmurrells,项目名称:VertexBuilderTest,代码行数:63,代码来源:track_start.C
示例2: compare_lf
void compare_lf(){
gStyle->SetErrorX(0);
//outputfile
TFile* nominalfile=new TFile("~/qcd_dijets/scalefactor_lf_nominal/scalefactor/result.root");
TFile* HFupfile=new TFile("~/qcd_dijets/scalefactor_lf_HFup/result_HFup.root");
TFile* HFdownfile=new TFile("~/qcd_dijets/scalefactor_lf_HFdown/result_HFdown.root");
TFile* JECupfile=new TFile("~/qcd_dijets/JEC-uncertainty/JEC_up/scalefactor_lf_JECup/scalefactor_JECup/result_JECup.root");
TFile* JECdownfile=new TFile("~/qcd_dijets/JEC-uncertainty/JEC_down/scalefactor_lf_JECdown/scalefactor_JECdown/result_JECdown.root");
int n_ptbins=10;
int n_etabins=4;
TString eta_counter="0";
TString pt_counter="0";
vector<vector<TH1F*>> nominal;
nominal.resize(n_ptbins, vector<TH1F*>(n_etabins, 0));
vector<vector<TH1F*>> nominaldots;
nominaldots.resize(n_ptbins, vector<TH1F*>(n_etabins, 0));
vector<vector<TH1D*>> staterror;
staterror.resize(n_ptbins, vector<TH1D*>(n_etabins, 0));
vector<vector<TH1F*>> JECup;
JECup.resize(n_ptbins, vector<TH1F*>(n_etabins, 0));
vector<vector<TH1F*>> JECdown;
JECdown.resize(n_ptbins, vector<TH1F*>(n_etabins, 0));
vector<vector<TH1F*>> HFup;
HFup.resize(n_ptbins, vector<TH1F*>(n_etabins, 0));
vector<vector<TH1F*>> HFdown;
HFdown.resize(n_ptbins, vector<TH1F*>(n_etabins, 0));
vector<vector<TH1F*>> uncover;
uncover.resize(n_ptbins, vector<TH1F*>(n_etabins, 0));
vector<vector<TH1F*>> unclower;
unclower.resize(n_ptbins, vector<TH1F*>(n_etabins, 0));
vector<vector<TH1F*>> JECover;
JECover.resize(n_ptbins, vector<TH1F*>(n_etabins, 0));
vector<vector<TH1F*>> JEClower;
JEClower.resize(n_ptbins, vector<TH1F*>(n_etabins, 0));
vector<vector<TH1F*>> HFover;
HFover.resize(n_ptbins, vector<TH1F*>(n_etabins, 0));
vector<vector<TH1F*>> HFlower;
HFlower.resize(n_ptbins, vector<TH1F*>(n_etabins, 0));
cout << "read histos" << endl;
for (int i=1; i<n_ptbins;++i){
if (i==0) pt_counter="0";
else if (i==1) pt_counter="1";
else if (i==2) pt_counter="2";
else if (i==3) pt_counter="3";
else if (i==4) pt_counter="4";
else if (i==5) pt_counter="5";
else if (i==6) pt_counter="6";
else if (i==7) pt_counter="7";
else if (i==8) pt_counter="8";
else if (i==9) pt_counter="9";
for ( int j=1; j<n_etabins;++j){
if (j==0) eta_counter="0";
else if (j==1) eta_counter="1";
else if (j==2) eta_counter="2";
else if (j==3) eta_counter="3";
TH1F* dots = (TH1F*)nominalfile->Get("clone_diff_lf_ptbin"+pt_counter+"_etabin"+eta_counter);
nominaldots[i][j]=dots;
nominaldots[i][j]->SetStats(0);
TH1D* h_stat = (TH1D*)nominalfile->Get("hint_ptbin"+pt_counter+"_etabin"+eta_counter);
staterror[i][j]=h_stat;
staterror[i][j]->SetStats(0);
TH1F* hist = (TH1F*)nominalfile->Get("LFSF_pt"+pt_counter+"_eta"+eta_counter);
nominal[i][j]=hist;
nominal[i][j]->SetStats(0);
TH1F* h_JECup = (TH1F*)JECupfile->Get("LFSF_pt"+pt_counter+"_eta"+eta_counter+"_JECup");
JECup[i][j]=h_JECup;
TH1F* h_JECdown = (TH1F*)JECdownfile->Get("LFSF_pt"+pt_counter+"_eta"+eta_counter+"_JECdown");
JECdown[i][j]=h_JECdown;
TH1F* h_hfup = (TH1F*)HFupfile->Get("LFSF_pt"+pt_counter+"_eta"+eta_counter+"_HFup");
HFup[i][j]=h_hfup;
TH1F* h_hfdown = (TH1F*)HFdownfile->Get("LFSF_pt"+pt_counter+"_eta"+eta_counter+"_HFdown");
HFdown[i][j]=h_hfdown;
cout << "histos read" << endl;
h_JECup->Add(hist,-1);
h_JECdown->Add(hist,-1);
h_hfup->Add(hist,-1);
h_hfdown->Add(hist,-1);
TH1F* tmpover=(TH1F*)HFup[i][j]->Clone();
TH1F* tmplower=(TH1F*)HFup[i][j]->Clone();
TH1F* tmpJECover=(TH1F*)JECup[i][j]->Clone();
//.........这里部分代码省略.........
开发者ID:sebwieland,项目名称:qcd_dijets,代码行数:101,代码来源:errors_lf.C
示例3: Calc
void Calc(TString Generatorfile,TString outfile) {
TFile *fin = TFile::Open(Generatorfile);
TFile *fout = TFile::Open(outfile,"RECREATE");
TH1F *hHFEnergy4 = new TH1F("hHFEnergy4","HFEnergy Distribution before Trigger selection",10000,0,100);
hHFEnergy4->Sumw2();
TH1F *hHFEnergy4_tr = new TH1F("hHFEnergy4_tr","HFEnergy Distribution after Trigger selection",10000,0,100);
hHFEnergy4_tr->Sumw2();
TH1F *hHFEnergy4_DS = new TH1F("hHFEnergy4_DS","HFEnergy Distribution after Doudle Side event selection",10000,0,100);
hHFEnergy4_DS->Sumw2();
TH1F *hHFEnergyPlus4 = new TH1F("hHFEnergyPlus4","HFEnergy Distribution before Trigger selection",10000,0,100);
hHFEnergyPlus4->Sumw2();
TH1F *hHFEnergyPlus4_tr = new TH1F("hHFEnergyPlus4_tr","HFEnergy Distribution after Trigger selection",10000,0,100);
hHFEnergyPlus4_tr->Sumw2();
TH1F *hHFEnergyPlus4_DS = new TH1F("hHFEnergyPlus4_DS","HFEnergy Distribution after Double Side event selection",10000,0,100);
hHFEnergyPlus4_DS->Sumw2();
TH1F *hHFEnergyPlus = new TH1F("hHFEnergyPlus","HFEnergy Distribution before Trigger selection",10000,0,100);
hHFEnergyPlus->Sumw2();
TH1F *hHFEnergyPlus_tr = new TH1F("hHFEnergyPlus_tr","HFEnergy Distribution after Trigger selection",10000,0,100);
hHFEnergyPlus_tr->Sumw2();
TH1F *hHFEnergyPlus_DS = new TH1F("hHFEnergyPlus_DS","HFEnergy Distribution after Double Side event selection",10000,0,100);
hHFEnergyPlus_DS->Sumw2();
TTree *tree;
fin->cd();
tree=(TTree*)hiEvtAnalyzer->Get("HiTree");
tree->AddFriend("skimTree=skimanalysis/HltTree");
tree->AddFriend("hltTree=hltanalysis/HltTree");
tree->AddFriend("genpartTree=genparticles/hi");
const int Maxmult=10000;
Float_t hiHF, vz, hiHFplus,eta[Maxmult];
Float_t hiHFminusEta4, hiHFplusEta4;
Long_t Ev,Nevent, Nevent_counter, Nleft;
Int_t n, HLT_PAZeroBiasPixel_SingleTrack_v1, pprimaryvertexFilter, pVertexFilterCutGplus, pPAcollisionEventSelectionPA, pHBHENoiseFilter,phfPosFilter1, phfNegFilter1,pBeamScrapingFilter;
Int_t Nskim=0;
double weight;
int mult, nDS=0, nPlus35, nMinus35;
int sta[Maxmult];
Nevent_counter=0;
Nleft=0;
Nevent=tree->GetEntries();
tree->SetBranchAddress("hiHF",&hiHF);//HF energy
tree->SetBranchAddress("hiHFplus",&hiHFplus);//HF energy positive
tree->SetBranchAddress("hiHFplusEta4",&hiHFplusEta4);//HF energy positive 4 to 5
tree->SetBranchAddress("hiHFminusEta4",&hiHFminusEta4);//HF energy negative -5 to -4
tree->SetBranchAddress("vz",&vz);
tree->SetBranchAddress("HLT_PAZeroBiasPixel_SingleTrack_v1",&HLT_PAZeroBiasPixel_SingleTrack_v1);
tree->SetBranchAddress("pprimaryvertexFilter",&pprimaryvertexFilter);
tree->SetBranchAddress("pVertexFilterCutGplus",&pVertexFilterCutGplus);
//tree->SetBranchAddress("pHBHENoiseFilter",&pHBHENoiseFilter);
tree->SetBranchAddress("pPAcollisionEventSelectionPA",&pPAcollisionEventSelectionPA);
tree->SetBranchAddress("phfPosFilter1",&phfPosFilter1);
tree->SetBranchAddress("phfNegFilter1",&phfNegFilter1);
tree->SetBranchAddress("pBeamScrapingFilter",&pBeamScrapingFilter);
tree->SetBranchAddress("eta",&eta);
tree->SetBranchAddress("sta",&sta);
tree->SetBranchAddress("mult",&mult);
TF1 * fVz = new TF1("fVx","[0]+[1]*x+[2]*TMath::Power(x,2)+[3]*TMath::Power(x,3)+[4]*TMath::Power(x,4)", -15., 15.);
fVz->SetParameters(1.60182e+00,1.08425e-03,-1.29156e-02,-7.24899e-06,2.80750e-05);
for(Ev=0; Ev<Nevent; Ev++) {
tree->GetEntry(Ev);
weight=1.;
//weight*=fVz->Eval(vz);
if(Ev%5000==0)
cout<<"Have run "<<Ev<<" Events"<<endl;
//cout<<"weight="<<weight<<endl;
hHFEnergy4->Fill(hiHFplusEta4+hiHFminusEta4,weight);
hHFEnergyPlus4->Fill(hiHFplusEta4,weight);
hHFEnergyPlus->Fill(hiHFplus,weight);
Nevent_counter++;
nPlus35=0;
nMinus35=0;
for(int j=0; j<mult; j++) {
if(eta[j]>3&&eta[j]<5&&sta[j]==1) nPlus35++;
if(eta[j]>-5&&eta[j]<-3&&sta[j]==1) nMinus35++;
}
if(nPlus35>=1 && nMinus35>=1 && TMath::Abs(vz)<15) {
hHFEnergy4_DS->Fill(hiHFplusEta4+hiHFminusEta4,weight);
hHFEnergyPlus4_DS->Fill(hiHFplusEta4,weight);
hHFEnergyPlus_DS->Fill(hiHFplus,weight);
nDS++;
}
if(!(HLT_PAZeroBiasPixel_SingleTrack_v1 && pVertexFilterCutGplus && pPAcollisionEventSelectionPA && pprimaryvertexFilter && TMath::Abs(vz)<15))
//if(!(HLT_PAZeroBiasPixel_SingleTrack_v1 && pVertexFilterCutGplus && pBeamScrapingFilter && phfPosFilter1 && phfNegFilter1 && pprimaryvertexFilter && TMath::Abs(vz)<15))
{
Nskim++;
continue;
}
hHFEnergy4_tr->Fill(hiHFplusEta4+hiHFminusEta4,weight);
hHFEnergyPlus4_tr->Fill(hiHFplusEta4,weight);
hHFEnergyPlus_tr->Fill(hiHFplus,weight);
//.........这里部分代码省略.........
开发者ID:XuQiao,项目名称:HI,代码行数:101,代码来源:Trig_eff_DS.C
示例4: bananaDeltaCut
void bananaDeltaCut(char* filename)
{
TFile *f = new TFile(filename);
TTree *t1 = (TTree*)f->Get("ntp1");
// Declare the variables we will need.
int nB;
// Note that these are arrays, because you may
// have multiple B-candidates.
float BpostFitMes[100];
float BpostFitDeltaE[100];
int Bd1Idx[100], Bd2Idx[100];
int Bd1Lund[100], Bd2Lund[100];
float DeltappMass[100];
float percentDiff;
float bestVal = 999.0;
int bestEntry = 0;
int signalpeak = 0;
int signaltail = 0;
// Initialize the addresses (?)
t1->SetBranchAddress("nB",&nB);
// Because these are arrays, we don't need the ampersand
// for the second argument.
t1->SetBranchAddress("BpostFitMes",BpostFitMes);
t1->SetBranchAddress("BpostFitDeltaE",BpostFitDeltaE);
t1->SetBranchAddress("Bd1Idx",Bd1Idx);
t1->SetBranchAddress("Bd2Idx",Bd2Idx);
t1->SetBranchAddress("Bd1Lund",Bd1Lund);
t1->SetBranchAddress("Bd2Lund",Bd2Lund);
t1->SetBranchAddress("DeltappMass",DeltappMass);
// Create some empty histograms
// TH1F *hnB = new TH1F("hnB","The number of B candidates",10,0,10);
TH1F *DelMCutbestCandMass = new TH1F("DelMCutbestCandMass","m_{ES}",40,5.2,5.3);
TH1F *DelMCutbestCandDelE = new TH1F("DelMCutbestCandDelE","#Delta E",40,-0.1,0.1);
TH2F *DelMCutmESvsDelE = new TH2F("DelMCutmESvsDelE","m_{ES} vs. #Delta E",40,5.2,5.3,40,-0.1,0.1);
TH1F *DelMCutmassDeltapp = new TH1F("DelMCutmassDeltapp","#Delta++ mass",40,1.0,1.7);
// Name the images
// Get the number of entries in this file.
Int_t nentries = (Int_t)t1->GetEntries();
// Loop over the entries
for (Int_t i=0;i<nentries;i++) {
t1->GetEntry(i);
if (nB == 1) {
if ( DeltappMass[Bd2Idx[0]] > 1.4 ) {
DelMCutbestCandMass->Fill(BpostFitMes[0]);
DelMCutbestCandDelE->Fill(BpostFitDeltaE[0]);
DelMCutmESvsDelE->Fill(BpostFitMes[0],BpostFitDeltaE[0]);
DelMCutmassDeltapp->Fill(DeltappMass[Bd2Idx[0]]);
if (BpostFitMes[0] < (5.279 + 0.008) && BpostFitMes[0] > (5.279-0.008)) signalpeak++;
if (BpostFitMes[0] < (5.279 - 0.008) || BpostFitMes[0] > (5.279+0.008)) signaltail++;
}
}
else {
for (Int_t j=0;j<nB;j++) {
percentDiff = fabs(BpostFitMes[j]-5.279);
if (percentDiff < bestVal) {
bestVal = percentDiff;
bestEntry = j;
}
}
if ( DeltappMass[Bd2Idx[bestEntry]] > 1.4 ) {
DelMCutbestCandMass->Fill(BpostFitMes[bestEntry]);
DelMCutbestCandDelE->Fill(BpostFitDeltaE[bestEntry]);
DelMCutmESvsDelE->Fill(BpostFitMes[bestEntry],BpostFitDeltaE[bestEntry]);
DelMCutmassDeltapp->Fill(DeltappMass[Bd2Idx[bestEntry]]);
if (BpostFitMes[bestEntry] < (5.279 + 0.008) && BpostFitMes[bestEntry] > (5.279-0.008)) signalpeak++;
if (BpostFitMes[bestEntry] < (5.279 - 0.008) || BpostFitMes[bestEntry] > (5.279+0.008)) signaltail++;
}
}
}
DelMCutbestCandMass->Draw();
// c1->SaveAs("DelMCutbestCandMassMulticand.png");
// c1->Clear();
// DelMCutbestCandDelE->Draw();
// c1->SaveAs("DelMCutbestCandDelEMulticand.png");
// c1->Clear();
// DelMCutmESvsDelE->Draw();
// c1->SaveAs("DelMCutmESvsDelEMulticand2.png");
// c1->Clear();
//.........这里部分代码省略.........
开发者ID:llencelyn,项目名称:banana_plots,代码行数:101,代码来源:bananaDeltaCut.C
示例5: v_beam_asymmetry
//.........这里部分代码省略.........
}
// Use the line below only for debugging purposes. It will only add the first file.
// thisHeRunNumberL=999999;
}
// ****************************************************************************************************************
gStyle->SetPalette(1);
// Defines Canvas
TCanvas *c1 = new TCanvas("c1","Asymmetry",1360,810); //x,y
pad1 = new TPad("pad1","pad1",0.0000,0.6666,0.2500,1.0000,0,0,0);
pad2 = new TPad("pad2","pad2",0.2500,0.6666,0.5000,1.0000,0,0,0);
pad3 = new TPad("pad3","pad3",0.5000,0.6666,0.7500,1.0000,0,0,0);
pad4 = new TPad("pad4","pad4",0.7500,0.6666,1.0000,1.0000,0,0,0);
pad5 = new TPad("pad5","pad5",0.0000,0.3333,0.2000,0.6666,0,0,0);
pad6 = new TPad("pad6","pad6",0.2000,0.3333,0.4000,0.6666,0,0,0);
pad7 = new TPad("pad7","pad7",0.4000,0.3333,0.6000,0.6666,0,0,0);
pad8 = new TPad("pad8","pad8",0.6000,0.3333,0.8000,0.6666,0,0,0);
pad9 = new TPad("pad9","pad9",0.8000,0.3333,1.0000,0.6666,0,0,0);
pad10 = new TPad("pad10","pad10",0.0000,0.0000,0.5000,0.3333,0,0,0);
pad11 = new TPad("pad11","pad11",0.5000,0.0000,1.0000,0.3333,0,0,0);
pad1->Draw();pad2->Draw();pad3->Draw();pad4->Draw();pad5->Draw();pad6->Draw();pad7->Draw();pad8->Draw();pad9->Draw();pad10->Draw();pad11->Draw();
// Everything below here makes graphs for each section of the canvas
pad1->cd();
TString titledp = "dp Cut";
cout << "Drawing " << titledp << "..." << endl;
TH1F *HedpNoCut = new TH1F("HedpNoCut",titledp,400,-0.08,0.08);
TH1F *HedpCut = new TH1F("HedpCut",titledp,400,-0.08,0.08);
chainHeR->Draw("ExTgtCor_R.dp>>HedpNoCutR(400,-0.08,0.08)", "", "");
chainHeR->Draw("ExTgtCor_R.dp>>HedpCutR(400,-0.08,0.08)", goldR, "");
chainHeL->Draw("ExTgtCor_L.dp>>HedpNoCutL(400,-0.08,0.08)", "", "");
chainHeL->Draw("ExTgtCor_L.dp>>HedpCutL(400,-0.08,0.08)", goldL, "");
HedpNoCut->Add(HedpNoCutR,HedpNoCutL);
HedpNoCut->SetTitle(titledp);
HedpNoCut->Draw();
HedpCut->Add(HedpCutR,HedpCutL);
HedpCut->SetLineColor(kBlack);
HedpCut->SetFillColor(kViolet);
HedpCut->Draw("same");
pad2->cd();
cout << "Drawing Target Cut..." << endl;
TString titleTarget = "Target Cut";
TH1F *HeReactZNoCut = new TH1F("HeReactZNoCut",titleTarget,400,-0.3,0.3);
TH1F *HeReactZCut = new TH1F("HeReactZCut",titleTarget,400,-0.3,0.3);
chainHeR->Draw("ReactPt_R.z>>HeReactZNoCutR(400,-0.3,0.3)", "", "");
chainHeR->Draw("ReactPt_R.z>>HeReactZCutR(400,-0.3,0.3)", targetR, "");
chainHeL->Draw("ReactPt_L.z>>HeReactZNoCutL(400,-0.3,0.3)", "", "");
chainHeL->Draw("ReactPt_L.z>>HeReactZCutL(400,-0.3,0.3)", targetL, "");
HeReactZNoCut->Add(HeReactZNoCutR,HeReactZNoCutL);
HeReactZNoCut->SetTitle(titleTarget);
HeReactZNoCut->Draw();
HeReactZCut->Add(HeReactZCutR,HeReactZCutL);
HeReactZCut->SetLineColor(kBlack);
HeReactZCut->SetFillColor(kViolet);
HeReactZCut->Draw("same");
pad3->cd();
cout << "Drawing Theta and Phi..." << endl;
开发者ID:ellie-long,项目名称:analysis-scripts,代码行数:67,代码来源:v_beam_asymmetry.C
示例6: ana_complete
void ana_complete(int nevts=0)
{
//-----User Settings:------------------------------------------------------
TString parAsciiFile = "all.par";
TString prefix = "evtcomplete";
TString input = "psi2s_Jpsi2pi_Jpsi_mumu.dec";
TString output = "ana";
TString friend1 = "pid";
TString friend2 = "";
TString friend3 = "";
TString friend4 = "";
// ----- Initial Settings --------------------------------------------
PndMasterRunAna *fRun= new PndMasterRunAna();
fRun->SetInput(input);
fRun->SetOutput(output);
fRun->SetFriend1(friend1);
fRun->SetFriend2(friend2);
fRun->SetFriend3(friend3);
fRun->SetFriend4(friend4);
fRun->SetParamAsciiFile(parAsciiFile);
fRun->Setup(prefix);
// *** some variables
int i=0,j=0, k=0, l=0;
gStyle->SetOptFit(1011);
fRun->Init();
// *** create an output file for all histograms
TFile *out = TFile::Open(prefix+"_output_ana.root","RECREATE");
// *** create some histograms
TH1F *hmomtrk = new TH1F("hmomtrk","track momentum (all)",200,0,5);
TH1F *hthttrk = new TH1F("hthttrk","track theta (all)",200,0,3.1415);
TH1F *hjpsim_all = new TH1F("hjpsim_all","J/#psi mass (all)",200,0,4.5);
TH1F *hpsim_all = new TH1F("hpsim_all","#psi(2S) mass (all)",200,0,5);
TH1F *hjpsim_lpid = new TH1F("hjpsim_lpid","J/#psi mass (loose pid)",200,0,4.5);
TH1F *hpsim_lpid = new TH1F("hpsim_lpid","#psi(2S) mass (loose pid)",200,0,5);
TH1F *hjpsim_tpid = new TH1F("hjpsim_tpid","J/#psi mass (tight pid)",200,0,4.5);
TH1F *hpsim_tpid = new TH1F("hpsim_tpid","#psi(2S) mass (tight pid)",200,0,5);
TH1F *hjpsim_trpid = new TH1F("hjpsim_trpid","J/#psi mass (true pid)",200,0,4.5);
TH1F *hpsim_trpid = new TH1F("hpsim_trpid","#psi(2S) mass (true pid)",200,0,5);
TH1F *hjpsim_ftm = new TH1F("hjpsim_ftm","J/#psi mass (full truth match)",200,0,4.5);
TH1F *hpsim_ftm = new TH1F("hpsim_ftm","#psi(2S) mass (full truth match)",200,0,5);
TH1F *hjpsim_nm = new TH1F("hjpsim_nm","J/#psi mass (no truth match)",200,0,4.5);
TH1F *hpsim_nm = new TH1F("hpsim_nm","#psi(2S) mass (no truth match)",200,0,5);
TH1F *hjpsim_diff = new TH1F("hjpsim_diff","J/#psi mass diff to truth",100,-2,2);
TH1F *hpsim_diff = new TH1F("hpsim_diff","#psi(2S) mass diff to truth",100,-2,2);
TH1F *hjpsim_vf = new TH1F("hjpsim_vf","J/#psi mass (vertex fit)",200,0,4.5);
TH1F *hjpsim_4cf = new TH1F("hjpsim_4cf","J/#psi mass (4C fit)",200,0,4.5);
TH1F *hjpsim_mcf = new TH1F("hjpsim_mcf","J/#psi mass (mass constraint fit)",200,0,4.5);
TH1F *hjpsi_chi2_vf = new TH1F("hjpsi_chi2_vf", "J/#psi: #chi^{2} vertex fit",100,0,10);
TH1F *hpsi_chi2_4c = new TH1F("hpsi_chi2_4c", "#psi(2S): #chi^{2} 4C fit",100,0,250);
TH1F *hjpsi_chi2_mf = new TH1F("hjpsi_chi2_mf", "J/#psi: #chi^{2} mass fit",100,0,10);
TH1F *hjpsi_prob_vf = new TH1F("hjpsi_prob_vf", "J/#psi: Prob vertex fit",100,0,1);
TH1F *hpsi_prob_4c = new TH1F("hpsi_prob_4c", "#psi(2S): Prob 4C fit",100,0,1);
TH1F *hjpsi_prob_mf = new TH1F("hjpsi_prob_mf", "J/#psi: Prob mass fit",100,0,1);
TH2F *hvpos = new TH2F("hvpos","(x,y) projection of fitted decay vertex",100,-2,2,100,-2,2);
//
// Now the analysis stuff comes...
//
// *** the data reader object
PndAnalysis* theAnalysis = new PndAnalysis();
if (nevts==0) nevts= theAnalysis->GetEntries();
// *** RhoCandLists for the analysis
RhoCandList chrg, muplus, muminus, piplus, piminus, jpsi, psi2s;
// *** Mass selector for the jpsi cands
double m0_jpsi = TDatabasePDG::Instance()->GetParticle("J/psi")->Mass(); // Get nominal PDG mass of the J/psi
RhoMassParticleSelector *jpsiMassSel=new RhoMassParticleSelector("jpsi",m0_jpsi,1.0);
// *** the lorentz vector of the initial psi(2S)
TLorentzVector ini(0, 0, 6.231552, 7.240065);
// ***
// the event loop
// ***
int cntdbltrk=0, cntdblmc=0, cntdblboth=0, cnttrk=0, cnt_dbl_jpsi=0, cnt_dbl_psip=0;
while (theAnalysis->GetEvent() && i++<nevts)
{
//.........这里部分代码省略.........
开发者ID:xyBlackWitch,项目名称:PhD,代码行数:101,代码来源:ana_complete.C
示例7: etaDependence_V2Ana
//.........这里部分代码省略.........
for(int jpt = pt_start; jpt < pt_end; jpt++)
{
cout<<" producing the TGraphs : "<<mcent<<" "<<iy<<" "<<jpt<<" "<<endl;
sprintf(gTmp,"rap%.1f-%.1f_cent%d-%d_pT%.1f-%.1f_%s",vraps1,vraps2,vcts1,vcts2,pts[jpt],pts[jpt+1],chosenSignal);
cout<<"TGraph name : "<<gTmp<<endl;
TGraphErrors *pgTemp = (TGraphErrors*)f1->Get(gTmp);
g[mcent][iy][jpt] = pgTemp;
if(!g[mcent][iy][jpt]) {cout<<"Warning: No graph found !!!!"<<endl;continue;}
cout<<g[mcent][iy][jpt]<<endl;
double b[4];
GetV2(g[mcent][iy][jpt], b);
pr[mcent][iy][jpt] = b[0];
ep[mcent][iy][jpt] = b[1];
chi[mcent][iy][jpt] = b[2];
ndf[mcent][iy][jpt] = b[3];
}//pt bin loop
}//rapidity loop
}//centrlaity loop
// ############################# Drawing:
TLatex *lt1 = new TLatex();
lt1->SetNDC();
for(int mcent = centrality_start; mcent < centrality_end; mcent++)
{
vcts1 = cts[mcent];
vcts2 = cts[mcent+1];
cout<<"Canvas Centrality: "<<vcts1<<"-"<<vcts2<<endl;
TCanvas *pc1 = new TCanvas("pc1",Form("pcV2_%d-%d",vcts1,vcts2),0,0,1200,750);
TH1F *pp = new TH1F("pp",
Form(";|#phi_{J/#psi} - #Psi_{RP}|;#frac{1}{N_{total J/#psi}} #frac{dN}{d#phi}"),
4,0,TMath::PiOver2());
pp->SetMaximum(1.2);
pp->SetMinimum(0.2);
makeMultiPanelCanvas(pc1,nPads,2,0.0,0.0,0.2,0.15,0.02);
int ind = 0;
for(int ky = 0; ky < 4; ky+=2)
{
vraps1 = raps[ky];
vraps2 = raps[ky+1];
cout << "Canvas Rapidity = "<< vraps1 << "\t"<<vraps2<<endl;
// if (ky==0) pt_start=1;
for(int lpt = pt_start; lpt < pt_end; lpt++)
{
pc1->cd(ind+1);
vpts1 = pts[lpt];
vpts2 = pts[lpt+1];
pp->Draw();
ind++;
lt1->SetTextSize(0.05);
if(ind == 1)
{
lt1->DrawLatex(0.75,0.8,Form("|y| < %.1f",vraps2)); // rapidity
lt1->DrawLatex(0.25,0.3,Form("%d - %d %%",vcts1, vcts2));
lt1->DrawLatex(0.25,0.15,Form("%s",eventPlane[1]));
}
if(ind == 3)
{
lt1->DrawLatex(0.75,0.8,Form("%.1f < |y| < %.1f",vraps1,vraps2)); // rapidity
}
开发者ID:cmironov,项目名称:UserCode,代码行数:67,代码来源:etaDependence_V2Ana.C
示例8: ootpu_comparison
void ootpu_comparison(TString files, TString var, TString title, int nbins, float low, float high, TString comments="") {
TChain* chain = new TChain("reduced_tree");
chain->Add(files);
TH1::SetDefaultSumw2();
TH1F* hA = new TH1F("hA",title, nbins, low, high);
TH1F* hB = new TH1F("hB",title, nbins, low, high);
TH1F* hC = new TH1F("hC",title, nbins, low, high);
TH1F* hD = new TH1F("hD",title, nbins, low, high);
hA->SetStats(0);
hA->GetYaxis()->SetLabelSize(0.04);
//hA->GetYaxis()->SetTitleOffset(1.3);
hA->GetXaxis()->SetTitleOffset(1.1);
hA->GetXaxis()->SetTitleFont(132);
hA->GetXaxis()->SetTitleSize(0.042);
hA->GetXaxis()->SetLabelSize(0.04);
hA->SetLineWidth(2);
// hA->StatOverflows(true);
// hB->StatOverflows(true);
// hC->StatOverflows(true);
// hD->StatOverflows(true);
int n1(0), n2(0), n3(0), n4(0), n5(0);
if (files.Contains("20bx25")) {
n1=5;
n2=17;
n3=21;
n4=25;
n5=40;
}
else if (files.Contains("S14")) {
n1=0;
n2=25;
n3=40;
n4=55;
n5=120;
}
else { // default: 8 TeV scenario
n1=0;
n2=15;
n3=22;
n4=32;
n5=70;
}
TString mu("num_gen_muons==1&&muon_reco_match>=0");
//if (files.Contains("PU_S10")) {
TString cuts = Form("(%s)&&(eoot_pu>=%d&&eoot_pu<%d)",mu.Data(),n1,n2);
cout << "Cuts: " << cuts.Data() << endl;
chain->Project("hA", var, cuts);
cuts = Form("(%s)&&(eoot_pu>=%d&&eoot_pu<%d)",mu.Data(),n2,n3);
cout << "Cuts: " << cuts.Data() << endl;
chain->Project("hB", var, cuts);
cuts = Form("(%s)&&(eoot_pu>=%d&&eoot_pu<%d)",mu.Data(),n3,n4);
cout << "Cuts: " << cuts.Data() << endl;
chain->Project("hC", var, cuts);
cuts = Form("(%s)&&(eoot_pu>=%d)",mu.Data(),n4);
cout << "Cuts: " << cuts.Data() << endl;
chain->Project("hD", var, cuts);
// }
// else {
// }
float avg1(hA->GetMean());
float avg2(hB->GetMean());
float avg3(hC->GetMean());
float avg4(hD->GetMean());
hA->Scale(1/hA->Integral());
hB->Scale(1/hB->Integral());
hC->Scale(1/hC->Integral());
hD->Scale(1/hD->Integral());
hA->SetLineColor(1);
hB->SetLineColor(2);
hC->SetLineColor(3);
hD->SetLineColor(4);
hA->SetLineWidth(2);
hB->SetLineWidth(2);
hC->SetLineWidth(2);
hD->SetLineWidth(2);
TCanvas* c1 = new TCanvas();
float max = TMath::Max(hA->GetMaximum(), hB->GetMaximum());
if (hC->GetMaximum()>max) max = hC->GetMaximum();
if (hD->GetMaximum()>max) max = hD->GetMaximum();
hA->SetMaximum(max*1.1);
hA->Draw("e1");
hB->Draw("e1,same");
hC->Draw("e1,same");
hD->Draw("e1,same");
TLegend* leg = new TLegend(0.42,0.6,0.9,0.9);
leg->SetFillStyle(0);
//.........这里部分代码省略.........
开发者ID:ald77,项目名称:csa14,代码行数:101,代码来源:EOOTPU_comparison.C
示例9: PlotDrmCorr
void PlotDrmCorr()
{
gROOT->LoadMacro("$LOCAL/include/TUntilsOpHisto.h");
gROOT->LoadMacro("$LOCAL/include/TUntilsAliFigs.h");
gROOT->LoadMacro("$LOCAL/include/TUntilsPlotStd.h"); SetStyle();
const TString sJetTag = "120<#it{p}_{T,jet}<150 GeV/#it{c}";
//=============================================================================
TFile *file = TFile::Open("data/mass/AnalysisOutputs_Dsm_py8_JetR05_SjeR01.root", "READ");
TH2D *h5py8 = (TH2D*)file->Get("hDfrDdm120"); h5py8->SetName("h5py8"); h5py8->SetDirectory(0);
file->Close();
file = TFile::Open("data/mass/AnalysisOutputs_Dsm_qpy_JetR05_SjeR01.root", "READ");
TH2D *h5qpy = (TH2D*)file->Get("hDfrDdm120"); h5qpy->SetName("h5qpy"); h5qpy->SetDirectory(0);
file->Close();
file = TFile::Open("data/mass/AnalysisOutputs_Dsm_med_JetR05_SjeR01.root", "READ");
TH2D *h5med = (TH2D*)file->Get("hDfrDdm120"); h5med->SetName("h5med"); h5med->SetDirectory(0);
file->Close();
file = TFile::Open("data/mass/AnalysisOutputs_Dsm_py8_JetR04_SjeR01.root", "READ");
TH2D *h4py8 = (TH2D*)file->Get("hDfrDdm120"); h4py8->SetName("h4py8"); h4py8->SetDirectory(0);
file->Close();
file = TFile::Open("data/mass/AnalysisOutputs_Dsm_qpy_JetR04_SjeR01.root", "READ");
TH2D *h4qpy = (TH2D*)file->Get("hDfrDdm120"); h4qpy->SetName("h4qpy"); h4qpy->SetDirectory(0);
file->Close();
file = TFile::Open("data/mass/AnalysisOutputs_Dsm_med_JetR04_SjeR01.root", "READ");
TH2D *h4med = (TH2D*)file->Get("hDfrDdm120"); h4med->SetName("h4med"); h4med->SetDirectory(0);
file->Close();
//=============================================================================
const Double_t dBin[] = { 0., 0.1, 0.3, 0.5, 0.8, 1.2 };
const Int_t nBin = sizeof(dBin) / sizeof(Double_t) -1;
h5py8->RebinX(50); h4py8->RebinX(50);
h5qpy->RebinX(50); h4qpy->RebinX(50);
h5med->RebinX(50); h4med->RebinX(50);
TH1D *h5py8M = SetRMS(h5py8,"h5py8M"); TH1D *h4py8M = SetRMS(h4py8,"h4py8M");
TH1D *h5qpyM = SetRMS(h5qpy,"h5qpyM"); TH1D *h4qpyM = SetRMS(h4qpy,"h4qpyM");
TH1D *h5medM = SetRMS(h5med,"h5medM"); TH1D *h4medM = SetRMS(h4med,"h4medM");
TGraph *g5py8 = new TGraph(h5py8M); TGraph *g4py8 = new TGraph(h4py8M);
TGraph *g5qpy = new TGraph(h5qpyM); TGraph *g4qpy = new TGraph(h4qpyM);
TGraph *g5med = new TGraph(h5medM); TGraph *g4med = new TGraph(h4medM);
//=============================================================================
TH1F *hfm = 0;
TCanvas *can = 0;
TLegend *leg = 0;
TLatex *tex = 0;
TLine *line = 0;
const Float_t dflx = 0.2, dfux = 1.;
const Float_t dfly = 2., dfuy = 15.;
const Float_t dlsx = 0.05, dlsy = 0.05;
const Float_t dtsx = 0.06, dtsy = 0.06;
const Float_t dtox = 1.10, dtoy = 1.00;
const TString stnx = "#it{R}(sj^{1st},sj^{2nd})";
const TString stny = "#sigma(m_{jet}-m_{sj}) (GeV/#it{c}^{2})";
TH1D *hSE = new TH1D("hSE", "", 10., 0., 10.);
hSE->SetLineWidth(2);
hSE->SetLineColor(wcl[0]);
hSE->SetMarkerStyle(wmk[0]);
hSE->SetMarkerColor(wcl[0]);
TH1D *hME = new TH1D("hME", "", 10., 0., 10.);
hME->SetLineWidth(2);
hME->SetLineColor(wcl[0]);
hME->SetMarkerStyle(wmk[2]);
hME->SetMarkerColor(wcl[0]);
//=============================================================================
can = MakeCanvas("Jet5py8DrmRMS"); can->SetGridx(); can->SetGridy();
hfm = can->DrawFrame(dflx, dfly, dfux, dfuy); SetupFrame(hfm, dlsx, dlsy, dtsx, dtsy, dtox, dtoy, stnx, stny);
hfm->GetXaxis()->SetNdivisions(510);
hfm->GetYaxis()->SetNdivisions(510);
DrawGraph(g5py8, wcl[3], "C");
DrawGraph(g5qpy, wcl[1], "C");
DrawGraph(g5med, wcl[5], "C");
leg = new TLegend(0.62, 0.64, 0.98, 0.88); SetupLegend(leg);
leg->AddEntry(g5py8, "PYTHIA 8", "L")->SetTextSizePixels(24);
leg->AddEntry(g5qpy, "Q-PYTHIA", "L")->SetTextSizePixels(24);
leg->AddEntry(g5med, "JEWEL+PYTHIA", "L")->SetTextSizePixels(24);
leg->Draw();
tex = new TLatex();
tex->SetNDC();
tex->SetTextSizePixels(24);
tex->DrawLatex(0.16, 0.92, "2.76 TeV, Jet #it{R}=0.5, anti-#it{k}_{T}, |#eta_{jet}|<1");
tex->DrawLatex(0.16, 0.84, sJetTag.Data());
//.........这里部分代码省略.........
开发者ID:xcheung,项目名称:AnaSubjetsMC,代码行数:101,代码来源:PlotDrmCorr.C
示例10: PlotBackground
void PlotBackground(string filename)
{
heatmapgradient();
gStyle->SetOptStat(0);
TFile* file = TFile::Open(filename.c_str());
TTree* tree = (TTree*)file->Get("DecayTree");
TCanvas* can[4];
string bra[4] = {"cos_theta1"
,"cos_theta2"
,"Phi_angle"
,"KK_M"};
string tit[4] = {"cos#theta_{1}"
,"cos#theta_{2}"
,"#Phi"
,"m(K^{#plus}K^{#minus})"};
string opt[4] = {"10,-1,1"
,"10,-1,1"
,"10,-3.142,3.142"
,"10,988,1800"};
for(int i = 0; i < 4; i++)
{
can[i] = new TCanvas(("projection"+bra[i]).c_str(),"",500,500);
can[i]->Draw();
can[i]->cd();
tree->Draw((bra[i]+">>htemp("+opt[i]+")").c_str());
TH1F* graph = (TH1F*)can[i]->GetPrimitive("htemp");
graph->SetTitle("");
graph->GetXaxis()->SetTitle(tit[i].c_str());
graph->SetMinimum(0);
can[i]->SaveAs((bra[i]+".pdf").c_str());
}
TCanvas* canv[6];
string comb[6] = {"cos_theta1:cos_theta2"
,"cos_theta1:Phi_angle"
,"cos_theta2:Phi_angle"
,"Phi_angle:KK_M"
,"cos_theta1:KK_M"
,"cos_theta2:KK_M"};
string opts[6] = {"5,-1,1,5,-1,1"
,"5,-3.142,3.142,5,-1,1"
,"5,-3.142,3.142,5,-1,1"
,"5,988,1800,5,-3.142,3.142"
,"5,988,1800,5,-1,1"
,"5,988,1800,5,-1,1"};
string ytit[6] = {"cos#theta_{1}"
,"cos#theta_{1}"
,"cos#theta_{2}"
,"#Phi"
,"cos#theta_{1}"
,"cos#theta_{2}"};
string xtit[6] = {"cos#theta_{2}"
,"#Phi"
,"#Phi"
,"m(K^{#plus}K^{#minus})"
,"m(K^{#plus}K^{#minus})"
,"m(K^{#plus}K^{#minus})"};
for(int lego = 0; lego < 2; lego++)
{
for(int i = 0; i < 6; i++)
{
canv[i] = new TCanvas(("projection"+comb[i]).c_str(),"",500,500);
canv[i]->Draw();
canv[i]->cd();
tree->Draw((comb[i]+">>htemp("+opts[i]+")").c_str(),"", (lego ? "LEGO" : "COLZ"));
TH2F* graph = (TH2F*)canv[i]->GetPrimitive("htemp");
graph->SetTitle("");
graph->GetXaxis()->SetTitle(xtit[i].c_str());
graph->GetYaxis()->SetTitle(ytit[i].c_str());
graph->SetMinimum(0);
cout << "Fetched graph" << endl;
string outname = comb[i];
std::replace(outname.begin(),outname.end(), ':', '-');
canv[i]->SaveAs((outname + (lego ? "lego.pdf" : ".pdf")).c_str());
}
}
// tree->Draw();
}
开发者ID:abmorris,项目名称:BsphiKK,代码行数:79,代码来源:PlotBackground.cpp
示例11: EvtSel_Q2Pmiss
void EvtSel_Q2Pmiss(){
Styles style2; style2.setPadsStyle(2); style2.applyStyle();
TString NameTrees[3] = {"AWG82/ntuples/small/RAll_RunAll.root",
"AWG82/ntuples/small/uds_RunAll.root", "AWG82/ntuples/small/ccbar_RunAll.root"};
TChain gen("ntp1"), cont("ntp1");
gen.Add(NameTrees[0]);
for(int t=1; t<3; t++) cont.Add(NameTrees[t]);
double totMCB = 0, totuds = 0, totccbar = 0, totdata = 0, totOffdata = 0;
getNumberB(NameTrees[0], "All", totMCB, totdata, totuds, totccbar, totOffdata);
double wuds = totMCB/totuds*2.09/1.05;
TH1F *hCount = new TH1F("hCount","",100,-4,12);
gen.Draw("candM2>>hCount","weight");
double nTotal = hCount->Integral();
cont.Draw("candM2>>hCount","weight");
nTotal += hCount->Integral()*wuds;
TLine line; line.SetLineStyle(2); line.SetLineColor(28); line.SetLineWidth(2);
TArrow arrow; arrow.SetLineColor(28); arrow.SetFillColor(28); arrow.SetLineWidth(2);
TCanvas can("can","Pmiss and q2 cuts");
can.Divide(2,1); TPad *cPad = (TPad *)can.cd(1);
int bins[] = {42,40}, colors[2][4] = {{8,4,1,3},{8,2,4,1}};
double xrange[2][2] = {{0,4.2},{-3,13}}, yield[2][4], maxi[] = {-99,-99};
TString Variable[] = {"candPMiss","candQ2"};
TString labels[2][4] = {{"Signal (", "Normaliz. (","Had. bkg. (",""},
{"Signal (", "D l #nu (", "D* l #nu (", "Bkg. ("}};
// TString labels[2][4] = {{"Signal", "Normaliz.","Had. Bkg.",""},
// {"Signal", "D l #nu", "D* l #nu", "Bkg."}};
TString cuts[2][4] = {{"(candType<3&&MCType>4&&MCType<7||candType>2&&MCType>10&&MCType<13)*weight",
"(candType<3&&MCType>0&&MCType<5||candType>2&&MCType>6&&MCType<11)*weight",
"(MCType==0&&MCCombmode==12)*weight", ""},
{"(candType<3&&MCType>4&&MCType<7||candType>2&&MCType>10&&MCType<13)*weight",
"(candType<3&&(MCType==1||MCType==3)||candType>2&&(MCType==7||MCType==9))*weight",
"(candType<3&&(MCType==2||MCType==4)||candType>2&&(MCType==8||MCType==10))*weight",
"(!(candType<3&&MCType>0&&MCType<7||candType>2&&MCType>6&&MCType<13))*weight"}};
double legW = 0.4, legH = 0.225;
double legX = 1-style2.PadRightMargin-0.02, legY = 1-style2.PadTopMargin-0.02;
TLegend *leg[2];
leg[0] = new TLegend(legX-legW, legY-legH, legX, legY);
legW = 0.24; legH = 0.285; legX = 0.47;
leg[1] = new TLegend(legX-legW, legY-legH, legX, legY);
TH1F* h[2][4];
for(int pad=0; pad<2; pad++){
leg[pad]->SetTextSize(style2.LabelSize); leg[pad]->SetFillColor(0);
leg[pad]->SetTextFont(style2.nFont); leg[pad]->SetBorderSize(0);
for(int i=0; i<4; i++) {
if(pad==0 && i==3) continue;
TString hname = "h"; hname += pad; hname += i;
h[pad][i] = new TH1F(hname,"",bins[pad],xrange[pad][0],xrange[pad][1]);
h[pad][i]->SetLineWidth(2); h[pad][i]->SetLineColor(colors[pad][i]);
TString vari = Variable[pad]; vari += ">>"; vari += hname;
gen.Draw(vari,cuts[pad][i]);
if(i==3){
hname = "hCont"; hname += pad; hname += i;
TH1F *hCont = new TH1F(hname,"",bins[pad],xrange[pad][0],xrange[pad][1]);
TString vari = Variable[pad]; vari += ">>"; vari += hname;
cont.Draw(vari,cuts[pad][i]);
hCont->Scale(wuds);
h[pad][i]->Add(hCont);
hCont->Delete();
}
yield[pad][i] = h[pad][i]->Integral();
h[pad][i]->Scale(1000/h[pad][i]->Integral());
if(h[pad][i]->GetMaximum()>maxi[pad]) maxi[pad] = h[pad][i]->GetMaximum();
labels[pad][i] += RoundNumber(yield[pad][i]*100,0,nTotal); labels[pad][i] += "%)";
leg[pad]->AddEntry(h[pad][i],labels[pad][i]);
}
h[pad][0]->SetMaximum(maxi[pad]*1.22);
}
h[0][0]->Draw();
style2.fixYAxis(h[0][0],cPad);
style2.setTitles(h[0][0],"|p_{miss}| (GeV)","Entries/(100 MeV)","a)");
h[0][1]->Draw("same");h[0][2]->Draw("same");
leg[0]->Draw();
line.DrawLine(0.2,h[0][0]->GetMinimum(), 0.2,maxi[0]/1.45);
arrow.DrawArrow(0.2,maxi[0]/1.65,0.5,maxi[0]/1.65,0.01,"|>");
cPad = (TPad *)can.cd(2);
h[1][0]->Draw();
style2.fixYAxis(h[1][0],cPad);
style2.setTitles(h[1][0],"q^{2} (GeV^{2})","Entries/(0.4 GeV^{2})","b)");
h[1][1]->Draw("same"); h[1][2]->Draw("same"); h[1][3]->Draw("same");
leg[1]->Draw();
line.DrawLine(4,h[1][0]->GetMinimum(), 4,maxi[1]/1.45);
arrow.DrawArrow(4,maxi[1]/1.65,5.4,maxi[1]/1.65,0.01,"|>");
TString pName = "public_html/EvtSel_Q2Pmiss.eps";
can.SaveAs(pName);
for(int pad=0; pad<2; pad++){
leg[pad]->Delete();
for(int i=0; i<4; i++){
if(pad==0 && i==3) continue;
h[pad][i]->Delete();
}
}
hCount->Delete();
}
开发者ID:manuelfs,项目名称:babar_code,代码行数:100,代码来源:EvtSel_Q2Pmiss.C
示例12: EflowCASTOR
void EflowCASTOR()
{
NCanvas(1,2,"data");
TH1F * HDat;
TH1F * HZ2;
// TFile *fzee = new TFile("ZDiffOutputfile_73Weight2010.root");
TFile *fzee = new TFile("ZDiffOutputfile.root");
// TFile *fzee = new TFile("ZDiffOutputfile.root");
HDat = (TH1F*)fzee->Get("NVTX1_EnergyCastorModule_DATA");
HZ2 = (TH1F*)fzee->Get("NVTX1_EnergyCastorModule_Z2PY6");
data->cd(1);
NHSetMarker(HDat,2,20,0.8);
HDat->SetMinimum(10);
HDat->Draw();
NStat(HDat,0);
NSetTitle(HDat,"CASTOR Modules", "Entries");
HDat->SetTitle("CASTOR Module Energy 2010");
HZ2->Draw("SAME HIST");
NHSetMarker(HDat,2,20,0.4);
TLegend *legend = new TLegend(0.6,0.7,0.9,0.8);
legend->SetTextFont(72);
legend->SetTextSize(0.06);
legend->SetBorderSize(0);
legend->AddEntry(HDat,"Data2010","p");
legend->AddEntry(HZ2,"Z2","l");
legend->Draw();
TH1F * Hra = (TH1F * ) HDat->Clone();
// Hra->GetXaxis->SetRange(0,12);
NStat(Hra,0);
NHSetMarker(Hra,4,20,0.8);
Hra->SetMinimum(1);
Hra->Divide(HZ2);
NLogAxis(0,0);
data->cd(2);
Hra->Draw();
Hra->SetTitle("Ratio DATA/MC");
Hra->Fit("pol0");
NSetTitle(Hra,"CASTOR Modules", "Ratio");
NLogAxis(0,1);
}
开发者ID:dfigueiredo,项目名称:Torino,代码行数:49,代码来源:ZAnalysis_2011.C
示例13: FindMCPUWeight
void FindMCPUWeight(){
NCanvas(1,2,"data");
TH1F * Data;
TH1F * DataVtx;
TH1F * PytZ2;
TH1F * PytZ2_Vis;
TFile *fzee = new TFile("ZDiffOutputfile.root");
Data = (TH1F*)fzee->Get("NoCuts_InstLumiPerBx_DATA10");
DataVtx = (TH1F*)fzee->Get("NoCuts_GoodVtx_DATA10");
PytZ2 = (TH1F*)fzee->Get("Gen_PUVtx_Z2PY6");
PytZ2_Vi
|
请发表评论