本文整理汇总了C++中TH1D类的典型用法代码示例。如果您正苦于以下问题:C++ TH1D类的具体用法?C++ TH1D怎么用?C++ TH1D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TH1D类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: MeasureSmearing
void MeasureSmearing(TTree *Full, TTree *Fast,TString tag="",bool useElectrons=false) {
//TChain *Full = loadList("/home/amott/HggApp/Hgg_53X/Caltech/Reduced/GluGluToHToGG_M-125_8TeV-powheg-pythia6_Summer12_DR53X-PU_S10_STAR53_V7A-v1.list","HggReduce");
//TChain *Fast = loadList("/home/amott/HggApp/Hgg_53X/Caltech/Reduced/SMS-TChiHH_2b2g_2J_mChargino-130to500_mLSP-1to370_TuneZ2star_8TeV-madgraph-tauola__Summer12-START53_V19_FSIM-v1.list","HggReduce");
Full->SetBranchStatus("*",0);
if(useElectrons) Full->SetBranchStatus("Electrons.*",1);
else Full->SetBranchStatus("Photons.*",1);
Fast->SetBranchStatus("*",0);
if(useElectrons) Fast->SetBranchStatus("Electrons.*",1);
else Fast->SetBranchStatus("Photons.*",1);
TString var = "Photons.correctedEnergy/Photons.genMatch.energy-1";
if(useElectrons) var = "Electrons.correctedEnergy/Electrons.genMatch.energy-1";
TString epVar = "Electrons.EOverP";
// TString var_pho1 = "(pho1_pt*cosh(pho1_eta)-pho1_energyGen)/pho1_energyGen";
// TString var_pho2 = "(pho2_pt*cosh(pho2_eta)-pho2_energyGen)/pho2_energyGen";
TString FSIM_SCALE = "( (abs(Photons.SC.eta)<1.56)*1 + (abs(Photons.SC.eta)>=1.56 && abs(Photons.SC.eta)<2)*( (Photons.SC.r9>0.94)*1.0276 + (Photons.SC.r9<=0.94)*1.0195) + (abs(Photons.SC.eta)>=2. && abs(Photons.SC.eta)<2.5)*( (Photons.SC.r9>0.94)*1.0216 + (Photons.SC.r9<=0.94)*1.0330) )*";
const int nCats=8;
TString cats[nCats] = {
"Photons.genMatch.index!=-1 && Photons.correctedEnergy/cosh(Photons.eta)>25 && abs(Photons.SC.eta)<1 && Photons.SC.r9>0.94",
"Photons.genMatch.index!=-1 && Photons.correctedEnergy/cosh(Photons.eta)>25 && abs(Photons.SC.eta)>=1 && abs(Photons.SC.eta)<1.4442 && Photons.SC.r9>0.94",
"Photons.genMatch.index!=-1 && Photons.correctedEnergy/cosh(Photons.eta)>25 && abs(Photons.SC.eta)>=1.56 && abs(Photons.SC.eta)<2 && Photons.SC.r9>0.94",
"Photons.genMatch.index!=-1 && Photons.correctedEnergy/cosh(Photons.eta)>25 && abs(Photons.SC.eta)>=2 && abs(Photons.SC.eta)<2.5 && Photons.SC.r9>0.94",
"Photons.genMatch.index!=-1 && Photons.correctedEnergy/cosh(Photons.eta)>25 && abs(Photons.SC.eta)<1 && Photons.SC.r9<0.94",
"Photons.genMatch.index!=-1 && Photons.correctedEnergy/cosh(Photons.eta)>25 && abs(Photons.SC.eta)>=1 && abs(Photons.SC.eta)<1.4442 && Photons.SC.r9<0.94",
"Photons.genMatch.index!=-1 && Photons.correctedEnergy/cosh(Photons.eta)>25 && abs(Photons.SC.eta)>=1.56 && abs(Photons.SC.eta)<2 && Photons.SC.r9<0.94",
"Photons.genMatch.index!=-1 && Photons.correctedEnergy/cosh(Photons.eta)>25 && abs(Photons.SC.eta)>=2 && abs(Photons.SC.eta)<2.5 && Photons.SC.r9<0.94",
};
if(useElectrons) {
FSIM_SCALE.ReplaceAll("Photons","Electrons");
for(int i=0;i<nCats;i++) {
cats[i].ReplaceAll("Photons","Electrons");
std::cout << cats[i] << std::endl;
}
}
// TString cats_pho1[nCats] = {
// "pho1_genMatch==1 && pho1_pt>25 && abs(pho1_eta)>=0.00 && abs(pho1_eta)<1.000 && pho1_r9 > 0.94",
// "pho1_genMatch==1 && pho1_pt>25 && abs(pho1_eta)>=1.00 && abs(pho1_eta)<1.442 && pho1_r9 > 0.94",
// "pho1_genMatch==1 && pho1_pt>25 && abs(pho1_eta)>=1.56 && abs(pho1_eta)<2.000 && pho1_r9 > 0.94",
// "pho1_genMatch==1 && pho1_pt>25 && abs(pho1_eta)>=2.00 && abs(pho1_eta)<2.500 && pho1_r9 > 0.94",
// "pho1_genMatch==1 && pho1_pt>25 && abs(pho1_eta)>=0.00 && abs(pho1_eta)<1.000 && pho1_r9 <= 0.94",
// "pho1_genMatch==1 && pho1_pt>25 && abs(pho1_eta)>=1.00 && abs(pho1_eta)<1.442 && pho1_r9 <= 0.94",
// "pho1_genMatch==1 && pho1_pt>25 && abs(pho1_eta)>=1.56 && abs(pho1_eta)<2.000 && pho1_r9 <= 0.94",
// "pho1_genMatch==1 && pho1_pt>25 && abs(pho1_eta)>=2.00 && abs(pho1_eta)<2.500 && pho1_r9 <= 0.94",
// };
// TString cats_pho2[nCats] = {
// "pho2_genMatch==1 && pho2_pt>25 && abs(pho2_eta)>=0.00 && abs(pho2_eta)<1.000 && pho2_r9 > 0.94",
// "pho2_genMatch==1 && pho2_pt>25 && abs(pho2_eta)>=1.00 && abs(pho2_eta)<1.442 && pho2_r9 > 0.94",
// "pho2_genMatch==1 && pho2_pt>25 && abs(pho2_eta)>=1.56 && abs(pho2_eta)<2.000 && pho2_r9 > 0.94",
// "pho2_genMatch==1 && pho2_pt>25 && abs(pho2_eta)>=2.00 && abs(pho2_eta)<2.500 && pho2_r9 > 0.94",
// "pho2_genMatch==1 && pho2_pt>25 && abs(pho2_eta)>=0.00 && abs(pho2_eta)<1.000 && pho2_r9 <= 0.94",
// "pho2_genMatch==1 && pho2_pt>25 && abs(pho2_eta)>=1.00 && abs(pho2_eta)<1.442 && pho2_r9 <= 0.94",
// "pho2_genMatch==1 && pho2_pt>25 && abs(pho2_eta)>=1.56 && abs(pho2_eta)<2.000 && pho2_r9 <= 0.94",
// "pho2_genMatch==1 && pho2_pt>25 && abs(pho2_eta)>=2.00 && abs(pho2_eta)<2.500 && pho2_r9 <= 0.94",
// };
TString catNames[nCats] = {
"EBLow_Gold",
"EBHigh_Gold",
"EELow_Gold",
"EEHigh_Gold",
"EBLow_Bad",
"EBHigh_Bad",
"EELow_Bad",
"EEHigh_Bad",
};
TCanvas cv;
TH1D pt_full("pt_full","",80,0,400);
pt_full.SetXTitle("p_{T} [GeV]");
pt_full.SetYTitle("Events / 5 GeV");
//Full->Project("pt_full","Photons.energy/cosh(Photons.eta)","Photons.genMatch.index != -1");
TH1D pt_fast("pt_fast","",80,0,400);
pt_fast.SetXTitle("p_{T} [GeV]");
pt_fast.SetYTitle("Events / 5 GeV");
//Fast->Project("pt_fast","Photons.energy/cosh(Photons.eta)","Photons.genMatch.index != -1");
TH1D* ratio = (TH1D*)pt_fast.Clone("pt_ratio");
ratio->Divide(&pt_full);
TH1D h("h","",100,-0.2,0.2);
TH1D h_p2("h_p2","",100,-0.2,0.2);
h.SetXTitle("(E_{reco}-E_{MC})/E_{MC}");
//.........这里部分代码省略.........
开发者ID:CaltechHggApp,项目名称:HggApp,代码行数:101,代码来源:MeasureSmearing_Reduced.C
示例2: savePlots2
void savePlots2(const std::string& canvasName, TH1D& dataPlot, TH1D& fitPlot,
TH1D& signalPlot, TH1D& bkgPlot) {
TCanvas c(canvasName.c_str(), canvasName.c_str()) ;
TPad mainPad("mainPad", "mainPad", 0., 0.2, 1., 1.) ;
mainPad.Draw() ;
TPad pullPad("pullPad", "pullPad", 0., 0., 1., 0.2) ;
pullPad.Draw() ;
mainPad.cd() ;
dataPlot.SetStats(true) ;
//dataPlot.SetOptStat(111111111);
dataPlot.SetLineWidth(2) ;
dataPlot.Draw() ;
fitPlot.SetLineWidth(2) ;
fitPlot.SetLineColor(kBlue) ;
fitPlot.Draw("same") ;
signalPlot.SetLineWidth(2) ;
signalPlot.SetLineColor(kGreen) ;
signalPlot.Draw("same") ;
bkgPlot.SetLineColor(kRed) ;
bkgPlot.SetLineWidth(2) ;
bkgPlot.Draw("same") ;
TLegend leg(0.6, 0.7, 0.9, 0.9) ;
leg.AddEntry(&dataPlot, "Data") ;
leg.AddEntry(&fitPlot, "Fit") ;
leg.AddEntry(&signalPlot, "Signal") ;
leg.AddEntry(&bkgPlot, "Background") ;
leg.SetFillStyle(0) ;
leg.SetBorderSize(0) ;
leg.Draw() ;
pullPad.cd() ;
pullPad.SetGridy() ;
TH1D* h_residuals(NULL), *h_pulls(NULL), *h_pullDistribution(NULL) ;
FitterTools::makePullPlot(dataPlot, fitPlot, h_residuals, h_pulls, h_pullDistribution) ;
h_pulls->Draw() ;
c.Write() ;
h_pulls->Write() ;
delete h_pulls ;
h_residuals->Write() ;
delete h_residuals ;
h_pullDistribution->Write() ;
delete h_pullDistribution ;
dataPlot.Write() ;
fitPlot.Write() ;
}
开发者ID:MannyMoo,项目名称:baryon-lifetimes-run-I,代码行数:50,代码来源:Lambda_C_Mass_Fitter.C
示例3: TCanvas
// *************************************** //
// this is a function that takes a set of //
// histograms and draws them on a canvas //
// in a stack, returning the canvas. //
// It also plots the signal as a dashed //
// line and the data with a ratio at the //
// the bottom of data/allBackgrounds //
// *************************************** //
TCanvas* drawPlots::plotAll(std::vector<TH1D*> histos, std::vector<std::string> names, std::string axisName, TH1D* signal, TH1D* data, TH1D* errDown, TH1D* errUp, bool isSignalRegion, bool doLogAxis){
const unsigned int MAINPLOT_WIDTH = 800;
const unsigned int MAINPLOT_HEIGHT = 500;
const unsigned int RATIOPLOT_HEIGHT = 125;
const unsigned int OFFSET = 10;
//LUKE: Title offset and title size are proportional in
//root, so you have to change them together,
//this makes me a sad panda
const double RATIOPLOT_YAXIS_TITLE_OFFSET = 0.4;
const double RATIOPLOT_YAXIS_TITLE_SIZE = 0.14;
const double RATIOPLOT_YAXIS_TICK_LENGTH = 0.01;
const double RATIOPLOT_YAXIS_LABEL_SIZE = 0.15;
const double RATIOPLOT_XAXIS_TITLE_OFFSET = 0.9;
const double RATIOPLOT_XAXIS_TITLE_SIZE = 0.2;
const double RATIOPLOT_XAXIS_TICK_LENGTH = 0.05;
const double RATIOPLOT_XAXIS_LABEL_SIZE = 0.2;
const double CANVAS_HEIGHT = MAINPLOT_HEIGHT+RATIOPLOT_HEIGHT+OFFSET;
TCanvas* canvas = new TCanvas("canvas","canvas",0,0,MAINPLOT_WIDTH,CANVAS_HEIGHT);
canvas->SetMargin(0.,0.,0.,0.);
canvas->Clear();
canvas->cd();
// create main pad
const double mainPad_ylow = (CANVAS_HEIGHT - MAINPLOT_HEIGHT)/CANVAS_HEIGHT;
const double mainPad_yhigh = 1.;
const double pad_margin_left = 0.15;
const double pad_margin_right = 0.05;
double main_y_max = -99;
double main_y_min = -99;
double main_x_max = -99;
double main_x_min = -99;
for(int a=0; a<histos.size(); a++){
if(histos[a]){
if(histos[a]->GetEntries()> 0.){
GetAxisLimits(histos[a], main_x_min, main_x_max, main_y_min, main_y_max);
}
}
}
if(data){
int maxBinData = data->GetMaximumBin();
double dataYmax = data->GetBinContent(maxBinData);
if(dataYmax > main_y_max) main_y_max = dataYmax;
}
// create main pad
TPad* mainPad = new TPad("main","main",0.,mainPad_ylow,1.,mainPad_yhigh);
mainPad->SetMargin(pad_margin_left,pad_margin_right,0.,.05); // left, right, bottom, top
mainPad->Draw();
mainPad->cd();
SetAtlasStyle();
if(doLogAxis)mainPad->SetLogy();
// clone signal or data because one should exist for each plot
TH1D* allBackgrounds;
bool gotSomething=false;
if(signal)
allBackgrounds = (TH1D*)signal->Clone("all_backgrounds");
else if(data)
allBackgrounds = (TH1D*)data->Clone("all_backgrounds");
else{
for(int b=0; b<histos.size(); b++){
if(histos[b] && !gotSomething){
allBackgrounds = (TH1D*)histos[b]->Clone("all_backgrounds");
gotSomething=true;
}
}
}
// set all bins to zero so that you can add all histograms to it
for(int i=0; i<=allBackgrounds->GetNbinsX()+1; i++)
allBackgrounds->SetBinContent(i,0);
THStack* Stack = new THStack();
std::string title = std::string(";") + axisName + ";Events";
Stack->SetTitle(title.c_str());
for(int b=0; b<histos.size(); b++){
if(histos[b]){
if(histos[b]->GetEntries() > 0.){
histos[b]->SetLineColor(1);
histos[b]->SetFillColor(tools::setColor(names[b]));
//.........这里部分代码省略.........
开发者ID:clare-b,项目名称:VLQ,代码行数:101,代码来源:drawPlots.cpp
示例4: CalcEfficHadrons
TEfficiency* CalcEfficHadrons(const char* fileName, Bool_t makeDraw=kFALSE)
{
// open the input file
TFile *file = new TFile(fileName);
// ********************************************
// parameters to check before running the macro
// ********************************************
const Int_t NHISTS = 4; // Check the number of histograms for different particle species
const Int_t NOUTPUTS = 3;
const Int_t NHISTOUT[NOUTPUTS] = {1,1,1};
const Int_t IHISTOUT[NOUTPUTS][NHISTS] = {{0,-1,-1,-1},{1,-1,-1,-1},{2,-1,-1,-1}};
const Float_t CUT_RES = 0.02;
Int_t style[NOUTPUTS] = {20,21,22};
Int_t color[NOUTPUTS] = {1,2,4};
const Int_t fgNumOfPtBins = 111; // Check the number of eta bins in the histograms
const Int_t fgNumOfEtaBins = 16; // Check the number of E bins in the histograms
const Int_t fgNumOfRBins = 45;
Double_t fgPtAxis[117]= {0.0,0.01,0.02,0.03,0.04, 0.05, 0.06,0.07,0.08,0.09, 0.10,0.11, .12,0.13, .14,0.15, .16,0.17, .18,0.19,
0.2, .22, .24, .26, .28, 0.30, 0.32, .34, .36, .38, 0.40, .42, .44, .46, .48,
0.5, .52, .54, .56, .58, 0.60, 0.62, .64, .66, .68, 0.70, .72, .74, .76, .78,
.80, .82, .84, .86, .88, 0.90, 0.92, .94, .96, .98, 1.00,1.05, 1.1,1.15, 1.2,
1.25, 1.3,1.35,1.40,1.45, 1.50, 1.55, 1.6,1.65, 1.7, 1.75, 1.8,1.85, 1.9,1.95,
2.0, 2.2, 2.4, 2.6, 2.8, 3.00, 3.20, 3.4, 3.6, 3.8, 4.00, 4.2, 4.4, 4.6, 4.8,
5.0, 5.5, 6.0, 6.5, 7.0, 7.50, 8.00, 8.5, 9.0, 9.5, 10.0,12.0,14.0,16.0,18.0,
20.0,25.0,30.0,35.0,40.0, 45.0, 50.0};
// declare histograms and graphs
TH2F *histNum[NHISTS];
TH2F *histDen[NHISTS];
TGraphErrors *graph[NOUTPUTS];
TH1D* projYNum;
TEfficiency *effic[NOUTPUTS];
char efficName[50];
// retrieve the input list of histogram. Check the TList name in the input file.
TList *list = (TList*) file->Get("out1");
// retrieve the histograms in the list. Check the name of the histograms
histNum[0] = (TH2F*)list->FindObject("fHistPionRec_ResPt_EmcalMC");
histNum[1] = (TH2F*)list->FindObject("fHistKaonRec_ResPt_EmcalMC");
histNum[2] = (TH2F*)list->FindObject("fHistProtonRec_ResPt_EmcalMC");
histNum[3] = (TH2F*)list->FindObject("fHistMuonRec_ResPt_EmcalMC");
// retrieve the histograms in the list. Check the name of the histograms
histDen[0] = (TH2F*)list->FindObject("fHistPionAcc_EtaPt_EmcalMC");
histDen[1] = (TH2F*)list->FindObject("fHistKaonAcc_EtaPt_EmcalMC");
histDen[2] = (TH2F*)list->FindObject("fHistProtonAcc_EtaPt_EmcalMC");
histDen[3] = (TH2F*)list->FindObject("fHistMuonAcc_EtaPt_EmcalMC");
// ********************************************
Float_t x[fgNumOfPtBins]={0}, ex[fgNumOfPtBins]={0};
Float_t y[fgNumOfPtBins]={0}, ey[fgNumOfPtBins]={0};
Float_t num=0, den=0;
//Int_t num=0, den=0;
Float_t Res=0;
// loop over different desired outputs
for (int iOut=0; iOut<NOUTPUTS; iOut++)
{
sprintf(efficName,"effic_%d",iOut);
effic[iOut] = new TEfficiency(efficName,efficName,fgNumOfPtBins,fgPtAxis);
// loop over E bins
for (int ix=0; ix<fgNumOfPtBins; ix++)
{
// initialize ET variables for a new particle species
x[ix]=histNum[0]->GetXaxis()->GetBinCenter(ix+1);
y[ix]=0;
ex[ix]=0;
ey[ix]=0;
num = 0;
den = 0;
// loop over eta bins
for (int iy=0; iy<fgNumOfEtaBins; iy++)
{
for (int iHist=0; iHist<NHISTOUT[iOut]; iHist++)
{
den += histDen[IHISTOUT[iOut][iHist]]->GetBinContent(ix+1,iy+1); // sum over all E bins in order to get total ET
}
}
// loop over residual bins
for (int iHist=0; iHist<NHISTOUT[iOut]; iHist++)
{
projYNum = histNum[IHISTOUT[iOut][iHist]]->ProjectionY();
for (int iy=0; iy<fgNumOfRBins; iy++)
{
Res = projYNum->GetBinCenter(iy+1);
if (Res<CUT_RES)
num += histNum[IHISTOUT[iOut][iHist]]->GetBinContent(ix+1,iy+1); // sum over all E bins in order to get total ET
}
}
//.........这里部分代码省略.........
开发者ID:ktf,项目名称:AliPhysics,代码行数:101,代码来源:CalcEfficHadrons.C
示例5: fitDVariable
void fitDVariable(TString variable="DsvpvDistance/DsvpvDisErr",TString variableplot="d_{xy}/#sigma(d_{xy})", TString inputdata="/data/wangj/MC2015/Dntuple/pp/ntD_pp_Dzero_kpi/ntD_EvtBase_20160203_Dfinder_20160201_pp_Pythia8_prompt_D0_dPt0tkPt0p5_pthatweight.root", TString inputmc="/data/wangj/MC2015/Dntuple/pp/ntD_pp_Dzero_kpi/ntD_EvtBase_20160203_Dfinder_20160201_pp_Pythia8_prompt_D0_dPt0tkPt0p5_pthatweight.root", TString trgselection="1", TString cut="Dpt>20&&Dy>-1.&&Dy<1.&&Dtrk1highPurity&&Dtrk2highPurity&&Dtrk1Pt>2.0&&Dtrk2Pt>2.0&&(DsvpvDistance/DsvpvDisErr)>3&&(DlxyBS/DlxyBSErr)>1.5&&Dchi2cl>0.05&&Dalpha<0.12&&Dtrk1PtErr/Dtrk1Pt<0.1&&Dtrk2PtErr/Dtrk2Pt<0.1&&abs(Dtrk1Eta)<2.0&&abs(Dtrk2Eta)<2.0&&Dtrk1Algo>3&&Dtrk1Algo<8&&(Dtrk1PixelHit+Dtrk1StripHit)>=11", TString selmcgen="((GisSignal==1||GisSignal==2)&&(Gy>-1&&Gy<1))", int isMC=1, Double_t luminosity=26., int doweight=0, TString collsyst="PbPb", TString outputfile="mytest.root")
{
collisionsystem=collsyst;
seldata = Form("%s&&%s",trgselection.Data(),cut.Data());
selmc = Form("%s",cut.Data());
gStyle->SetTextSize(0.05);
gStyle->SetTextFont(42);
gStyle->SetPadRightMargin(0.043);
gStyle->SetPadLeftMargin(0.18);
gStyle->SetPadTopMargin(0.1);
gStyle->SetPadBottomMargin(0.145);
gStyle->SetTitleX(.0f);
void clean0 (TH1D* h);
TF1* fit (TString variable, TString variableplot, TTree* nt, TTree* ntMC, double ptmin, double ptmax, int isMC);
if(!doweight) weight="1";
TFile* inf = new TFile(inputdata.Data());
TFile* infMC = new TFile(inputmc.Data());
TTree* nt = (TTree*) inf->Get("ntDkpi");
TTree* HltTree= (TTree*) inf->Get("ntHlt");
HltTree->AddFriend(nt);
nt->AddFriend(HltTree);
TTree* ntHid = (TTree*) inf->Get("ntHi");
nt->AddFriend(ntHid);
TTree* ntMC = (TTree*)infMC->Get("ntDkpi");
TTree* ntGen = (TTree*)infMC->Get("ntGen");
TTree* ntHi = (TTree*)infMC->Get("ntHi");
ntGen->AddFriend(ntMC);
ntGen->AddFriend(ntHi);
ntMC->AddFriend(ntGen);
ntMC->AddFriend(ntHi);
ntHi->AddFriend(ntMC);
TH1D* hPt = new TH1D("hPt","",nBins,ptBins);
TH1D* hPtRecoTruth = new TH1D("hPtRecoTruth","",nBins,ptBins);
TH1D* hPtMC = new TH1D("hPtMC","",nBins,ptBins);
TH1D* hPtGen = new TH1D("hPtGen","",nBins,ptBins);
TH1D* hMean = new TH1D("hMean","",nBins,ptBins);
TH1D* hSigmaGaus1 = new TH1D("hSigmaGaus1","",nBins,ptBins);
TH1D* hSigmaGaus2 = new TH1D("hSigmaGaus2","",nBins,ptBins);
TH1D* hRelMagnGaus1Gaus2 = new TH1D("hRelMagnGaus1Gaus2","",nBins,ptBins);
for(int i=0;i<nBins;i++)
{
TF1* f = fit(variable,variableplot,nt,ntMC,ptBins[i],ptBins[i+1],isMC);
double yield = f->Integral(minhisto,maxhisto)/binwidthmass;
double yieldErr = f->Integral(minhisto,maxhisto)/binwidthmass*f->GetParError(0)/f->GetParameter(0);
hPt->SetBinContent(i+1,yield/(ptBins[i+1]-ptBins[i]));
hPt->SetBinError(i+1,yieldErr/(ptBins[i+1]-ptBins[i]));
hMean->SetBinContent(i+1,f->GetParameter(1));
hMean->SetBinError(i+1,f->GetParError(1));
hSigmaGaus1->SetBinContent(i+1,f->GetParameter(2));
hSigmaGaus1->SetBinError(i+1,f->GetParError(2));
hSigmaGaus2->SetBinContent(i+1,f->GetParameter(5));
hSigmaGaus2->SetBinError(i+1,f->GetParError(5));
hRelMagnGaus1Gaus2->SetBinContent(i+1,f->GetParameter(4));
hRelMagnGaus1Gaus2->SetBinError(i+1,f->GetParError(4));
}
ntMC->Project("hPtMC",variable.Data(),TCut(weight)*(TCut(selmc.Data())&&"(Dgen==23333)"));
divideBinWidth(hPtMC);
ntMC->Project("hPtRecoTruth",variable.Data(),TCut(selmc.Data())&&"(Dgen==23333)");
divideBinWidth(hPtRecoTruth);
ntGen->Project("hPtGen","Gpt",TCut(weight)*(TCut(selmcgen.Data())));
divideBinWidth(hPtGen);
TCanvas* cPt = new TCanvas("cPt","",600,600);
cPt->SetLogy();
hPt->SetXTitle(Form("D^{0} %s",variable.Data()));
hPt->SetYTitle("Uncorrected dN(D^{0})/dp_{T}");
hPt->Sumw2();
hPt->Draw();
if(isMC)
{
hPtMC->Draw("same hist");
TLegend* legPt = myLegend(0.55,0.80,0.90,0.94);
legPt->AddEntry(hPt,"Signal extraction","pl");
legPt->AddEntry(hPtMC,"Matched reco","lf");
legPt->Draw("same");
}
hPtMC->Sumw2();
TH1D* hEff = (TH1D*)hPtMC->Clone("hEff");
hEff->SetTitle(Form(";D^{0} %s",variable.Data()));
hEff->Sumw2();
hEff->Divide(hPtGen);
TCanvas* cEff = new TCanvas("cEff","",600,600);
hEff->Draw();
TH1D* hPtCor = (TH1D*)hPt->Clone("hPtCor");
hPtCor->SetTitle(Form(";D^{0} %s;Corrected dN(D^{0})/dp_{T}",variable.Data()));
hPtCor->Divide(hEff);
TCanvas* cPtCor= new TCanvas("cCorResult","",600,600);
cPtCor->SetLogy();
hPtCor->Draw();
//.........这里部分代码省略.........
开发者ID:jiansunpurdue,项目名称:DntupleRunII,代码行数:101,代码来源:fitDVariable.C
示例6: combinedFit
void combinedFit() {
TH1D * hB = new TH1D("hB","histo B",100,0,100);
TH1D * hSB = new TH1D("hSB","histo S+B",100, 0,100);
TF1 * fB = new TF1("fB","expo",0,100);
fB->SetParameters(1,-0.05);
hB->FillRandom("fB");
TF1 * fS = new TF1("fS","gaus",0,100);
fS->SetParameters(1,30,5);
hSB->FillRandom("fB",2000);
hSB->FillRandom("fS",1000);
// perform now global fit
TF1 * fSB = new TF1("fSB","expo + gaus(2)",0,100);
ROOT::Math::WrappedMultiTF1 wfB(*fB,1);
ROOT::Math::WrappedMultiTF1 wfSB(*fSB,1);
ROOT::Fit::DataOptions opt;
ROOT::Fit::DataRange rangeB;
// set the data range
rangeB.SetRange(10,90);
ROOT::Fit::BinData dataB(opt,rangeB);
ROOT::Fit::FillData(dataB, hB);
ROOT::Fit::DataRange rangeSB;
rangeSB.SetRange(10,50);
ROOT::Fit::BinData dataSB(opt,rangeSB);
ROOT::Fit::FillData(dataSB, hSB);
ROOT::Fit::Chi2Function chi2_B(dataB, wfB);
ROOT::Fit::Chi2Function chi2_SB(dataSB, wfSB);
GlobalChi2 globalChi2(chi2_B, chi2_SB);
ROOT::Fit::Fitter fitter;
const int Npar = 6;
double par0[Npar] = { 5,5,-0.1,100, 30,10};
// create before the parameter settings in order to fix or set range on them
fitter.Config().SetParamsSettings(6,par0);
// fix 5-th parameter
fitter.Config().ParSettings(4).Fix();
// set limits on the third and 4-th parameter
fitter.Config().ParSettings(2).SetLimits(-10,-1.E-4);
fitter.Config().ParSettings(3).SetLimits(0,10000);
fitter.Config().ParSettings(3).SetStepSize(5);
fitter.Config().MinimizerOptions().SetPrintLevel(0);
fitter.Config().SetMinimizer("Minuit2","Migrad");
// fit FCN function directly
// (specify optionally data size and flag to indicate that is a chi2 fit)
fitter.FitFCN(6,globalChi2,0,dataB.Size()+dataSB.Size(),true);
ROOT::Fit::FitResult result = fitter.Result();
result.Print(std::cout);
TCanvas * c1 = new TCanvas("Simfit","Simultaneous fit of two histograms",
10,10,700,700);
c1->Divide(1,2);
c1->cd(1);
gStyle->SetOptFit(1111);
fB->SetFitResult( result, iparB);
fB->SetRange(rangeB().first, rangeB().second);
fB->SetLineColor(kBlue);
hB->GetListOfFunctions()->Add(fB);
hB->Draw();
c1->cd(2);
fSB->SetFitResult( result, iparSB);
fSB->SetRange(rangeSB().first, rangeSB().second);
fSB->SetLineColor(kRed);
hSB->GetListOfFunctions()->Add(fSB);
hSB->Draw();
}
开发者ID:digideskio,项目名称:root,代码行数:83,代码来源:combinedFit.C
示例7: plotAngularResolution
void plotAngularResolution(){
TChain *resChain = new TChain("angResTree");
char resName[500];
char fName[200];
// int sec1[17] = {04, 04, 04, 04, 04, 04, 10, 10, 12, 12, 12, 14, 14, 14, 16, 16, 17};
// int sec2[17] = {51, 51, 57, 57, 57, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59};
int temp = -1;
// int sec1[25] = {24, 30, 30, 25, 25, 25, 26, 26, 25, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28, 29, 30, 30, 31};
// int sec1[17]={36, 36, 36, 36, 36, 33, 34, 34, 35, 36, 35, 36, 36, 37, 37, 37, 37};
int sec1[3]= {19,21,21};
for (int run=331;run<355;++run){ // 331-355 145-161 151-154
temp = run - 151;
// cout << sec1[temp] << endl;
// sprintf(fName,"VPOL_10kVSeavey_2015_11_05_time_19_47_53");// VPOL_10kVSeavey_2015_11_06_time_10_42_48
// sprintf(fName,"VPOL_10kVSeavey_2015_11_06_time_10_42_48");
// sprintf(fName,"LDBHPOL_10kVSeavey_2015_11_19_time_15_30_45");
// sprintf(fName,"VPOL_10kVSeavey_2015_11_19_time_11_49_04");
sprintf(fName,"HPOL_seavey_pulses_2015_11_25");
sprintf(resName,"/unix/anita3/treesForLinda/generateAngularResolutionTree_run%d-%dPlots.root",run,run);
// sprintf(resName,"/unix/anita3/strutt/antennaPositionCalibPlots/ldbPulses/%s/generateAngularResolutionTreeVPOLPlots_%d_2015-11-09_14-36-%02d.root",fName,run, sec2[temp]);
// sprintf(resName,"/unix/anita3/strutt/antennaPositionCalibPlots/newFittingOrder/newLindaNumbers_4steps_%s/generateAngularResolutionTreeVPOLPlots_%d_2015-11-23_12-42-%02d.root",fName,run, sec1[temp]);
//sprintf(resName,"/unix/anita3/strutt/antennaPositionCalibPlots/ldbPulses/%s/generateAngularResolutionTreeHPolLDBPlots_%d_2015-11-25_12-25-%02d.root",fName,run, sec1[temp]);
cout << resName << endl;
resChain->Add(resName);
}
TH1D *hPhi = new TH1D("hPhi", "", 400, -2, 2);
TH1D *hTheta = new TH1D("hTheta", "", 400, -2, 2);
resChain->Draw("deltaPhiDeg >> hPhi", "", "off");
resChain->Draw("deltaThetaDeg >> hTheta", "", "off");
gStyle->SetOptStat(0);
gStyle->SetOptFit(1);
TCanvas *c1 = new TCanvas("c1");
hPhi->SetTitle("#phi_{expected}-#phi_{zoom};#delta #phi (degrees);Events per bin");
hPhi->Draw("");
hPhi->Fit("gaus", "", "", -1, 1);
c1->Print(Form("AngularResolution_phi_4steps_%s.png", fName));
c1->Print(Form("AngularResolution_phi_4steps_%s.pdf", fName));
hTheta->SetTitle("#theta_{expected}-#theta_{zoom};#delta #theta (degrees);Events per bin");
hTheta->Draw("");
hTheta->Fit("gaus");
c1->Print(Form("AngularResolution_theta_4steps_%s.png", fName));
c1->Print(Form("AngularResolution_theta_4steps_%s.pdf", fName));
}
开发者ID:strutt,项目名称:antennaPositionCalib,代码行数:63,代码来源:plotAngularResolution.C
示例8: sqrtMethodSameSign
void sqrtMethodSameSign(int ptBin, double ptCutLo, double ptCutHi, int massBin, double mCutLo, double mCutHi, int etaBin, double etaCutLo, double etaCutHi){
//OPTIONS AND CUTS------------
bool useBlueBeam = true;
bool useYellowBeam = true;
bool randomizeSpin = false;
double PI = 3.14159265359;
cout << "\n";
if (useBlueBeam && useYellowBeam){cout << "using both beams-----" << endl;}
if (useBlueBeam && !useYellowBeam){cout << "using blue beam------" << endl;}
if (!useBlueBeam && useYellowBeam){cout << "using yellow beam----" << endl;}
cout << "\n";
if (randomizeSpin){cout << "randomizing spin-----" << endl;}
//PION PAIR CUTS:
/*
double ptCutLo = 4;
double ptCutHi = 10;
double mCutLo = .4;
double mCutHi = 1;
double etaCutLo = -1.4;
double etaCutHi = 1.4;
//*/
//double phiCutLo = -.5;
//double phiCutHi = .5;
//----------------------------
//LOAD LIBS
cout << "\n";
gROOT->Macro("StRoot/LoadLibs.C");
gSystem->Load("sameSignPair");
cout << " loading of sameSignPair library done" << endl;
//SET UP INPUT FILE
TFile* infile = new TFile("/star/u/klandry/ucladisk/2012IFF/schedOut_samesign_4_14/allSameSign_4_14.root");
//SET UP TREE TO RECEIVE INPUT
sameSignPair* pair1 = new sameSignPair();
TTree* pairTree = infile->Get("sameSignTree");
pairTree->SetBranchAddress("sameSignPair", &pair1);
//SET UP HISTOGRAMS
//event variable histograms
TH1D* hInvarM = new TH1D("invarM","invarM",80,0,2);
TH1D* hEtaTot = new TH1D("etaTot","etaTot",60,-1.5,1.5);
TH1D* hPhiR = new TH1D("hPhiR","hPhiR",60,-4,4);
TH1D* hPhiS = new TH1D("hPhiS","hPhiS",60,-4,4);
TH1D* hPhiSR = new TH1D("hPhiSR","hPhiSR",60,-4,4);
TH1D* hTheta = new TH1D("hTheta","hTheta",30,-0.85,4);
TH1D* hCosTheta = new TH1D("hCosTheta","hCosTheta",80,-1,1);
TH1D* hZ = new TH1D("hZ","hZ",80,0,1);
TH1D* hPtot = new TH1D("hPtot","hPtot",80,0,20);
TH1D* hPtTOT = new TH1D("hPt","hPt",80,0,15);
//histos for asym analysis
double histMin = -PI;
double histMax = PI;
const int binNumber = 16;
TH1D * hNumberUp = new TH1D("hNumberUp","hNumberUp",binNumber,histMin,histMax);
TH1D * hNumberDown = new TH1D("hNumberDown","hNumberDown",binNumber,histMin,histMax);
TH1D * hDiff = new TH1D("hNumberSum","hNumberSum",binNumber,histMin,histMax);
TH1D * hAut = new TH1D("Aut","Aut",binNumber,histMin,histMax);
//BEAM POLARIZATION
ifstream polFile;
polFile.open("/star/u/klandry/ucladisk/2012IFF/BeamPolarization2012.txt");
map<int, double> polarizationOfFill_Y;
map<int, double> polErrOfFill_Y;
map<int, double> polarizationOfFill_B;
map<int, double> polErrOfFill_B;
int fill;
int beamE;
int startT;
string plusminus;
double pAvrgBlue;
double pErrAvrgBlue;
//.........这里部分代码省略.........
开发者ID:keithdlandry,项目名称:2012IFF,代码行数:101,代码来源:sqrtMethodSameSign.C
示例9: draw_from_trees
void draw_from_trees(TString var, TCut other_cuts,
TString weights, TString title, int nbinsx,
double xlow, double xup,
TString options="plotSig:plotLog:plotData",
double cut_low=-1, double cut_high=-1,
TString plot_title="default")
{
bool plotSig = options.Contains("plotSig") && (!options.Contains("!plotSig"));
bool plotLog = options.Contains("plotLog") && (!options.Contains("!plotLog"));
bool plotData = options.Contains("plotData") && (!options.Contains("!plotData"));
bool plotT1tttt = options.Contains("T1tttt") && (!options.Contains("!T1tttt"));
// Book histograms
TH1D * httbar = new TH1D("ttbar" , title, nbinsx, xlow, xup);
TH1D * hqcd = new TH1D("qcd" , title, nbinsx, xlow, xup);
TH1D * hznn = new TH1D("znn" , title, nbinsx, xlow, xup);
TH1D * hwjets = new TH1D("wjets" , title, nbinsx, xlow, xup);
TH1D * hother = new TH1D("other" , title, nbinsx, xlow, xup);
TH1D * hmc_exp = new TH1D("mc_exp" , title, nbinsx, xlow, xup);
TH1D * hsingle_top = new TH1D("single_top" , title, nbinsx, xlow, xup);
TH1D * ht1bbbb_1500_100 = new TH1D("t1bbbb_1500_100" , title, nbinsx, xlow, xup);
TH1D * ht1bbbb_1000_900 = new TH1D("t1bbbb_1000_900" , title, nbinsx, xlow, xup);
TH1D * ht1tttt_1500_100 = new TH1D("t1tttt_1500_100" , title, nbinsx, xlow, xup);
TH1D * ht1tttt_1200_800 = new TH1D("t1tttt_1200_800" , title, nbinsx, xlow, xup);
// Format cuts
TCut cut(other_cuts);
cout << "Filling histograms for " << var.Data() << endl;
ttbar_ch->Project("ttbar",var,cut*weights);
qcd_ch->Project("qcd",var,cut*weights);
znn_ch->Project("znn",var,cut*weights);
wjets_ch->Project("wjets",var,cut*weights);
other_ch->Project("other",var,cut*weights);
single_top_ch->Project("single_top",var,cut*weights);
t1bbbb_1500_100_ch->Project("t1bbbb_1500_100",var,cut*weights);
t1bbbb_1000_900_ch->Project("t1bbbb_1000_900",var,cut*weights);
t1tttt_1500_100_ch->Project("t1tttt_1500_100",var,cut*weights);
t1tttt_1200_800_ch->Project("t1tttt_1200_800",var,cut*weights);
TH1D * hSMSLargeSplitting;
TH1D * hSMSCompressed;
if (plotT1tttt) {
hSMSLargeSplitting=ht1tttt_1500_100;
hSMSCompressed=ht1tttt_1200_800;
} else {
hSMSLargeSplitting=ht1bbbb_1500_100;
hSMSCompressed=ht1bbbb_1000_900;
}
bool addOverflow(true);
Double_t e_overflow(0.), i_overflow(0.);
if (addOverflow) {
i_overflow=httbar->IntegralAndError(nbinsx,nbinsx+1,e_overflow);
httbar->SetBinContent(nbinsx, i_overflow);
httbar->SetBinError(nbinsx, e_overflow);
i_overflow=hqcd->IntegralAndError(nbinsx,nbinsx+1,e_overflow);
hqcd->SetBinContent(nbinsx, i_overflow);
hqcd->SetBinError(nbinsx, e_overflow);
i_overflow=hznn->IntegralAndError(nbinsx,nbinsx+1,e_overflow);
hznn->SetBinContent(nbinsx, i_overflow);
hznn->SetBinError(nbinsx, e_overflow);
i_overflow=hwjets->IntegralAndError(nbinsx,nbinsx+1,e_overflow);
hwjets->SetBinContent(nbinsx, i_overflow);
hwjets->SetBinError(nbinsx, e_overflow);
i_overflow=hsingle_top->IntegralAndError(nbinsx,nbinsx+1,e_overflow);
hsingle_top->SetBinContent(nbinsx, i_overflow);
hsingle_top->SetBinError(nbinsx, e_overflow);
i_overflow=hother->IntegralAndError(nbinsx,nbinsx+1,e_overflow);
hother->SetBinContent(nbinsx, i_overflow);
hother->SetBinError(nbinsx, e_overflow);
i_overflow=hSMSLargeSplitting->IntegralAndError(nbinsx,nbinsx+1,e_overflow);
hSMSLargeSplitting->SetBinContent(nbinsx, i_overflow);
hSMSLargeSplitting->SetBinError(nbinsx, e_overflow);
i_overflow=hSMSCompressed->IntegralAndError(nbinsx,nbinsx+1,e_overflow);
hSMSCompressed->SetBinContent(nbinsx, i_overflow);
hSMSCompressed->SetBinError(nbinsx, e_overflow);
}
// Add up MC histograms
hmc_exp->Add(httbar);
hmc_exp->Add(hqcd);
hmc_exp->Add(hznn);
hmc_exp->Add(hwjets);
hmc_exp->Add(hsingle_top);
hmc_exp->Add(hother);
double binwidth = (xup - xlow) / nbinsx;
TString ytitle = Form("Events / %.3f", binwidth);
hmc_exp->GetXaxis()->SetTitle(httbar->GetXaxis()->GetTitle());
hmc_exp->GetYaxis()->SetTitle(ytitle);
cout << "... DONE: add all backgrounds to mc_exp." << endl;
Double_t ttbar_e(0.), qcd_e(0.), znn_e(0.), wjets_e(0.), other_e(0.), single_top_e(0.), bg_tot_e(0.), t1bbbb_1500_100_e(0.);
double ttbar_n(httbar->IntegralAndError(0,nbinsx+1, ttbar_e));
double qcd_n(hqcd->IntegralAndError(0,nbinsx+1, qcd_e));
double znn_n(hznn->IntegralAndError(0,nbinsx+1, znn_e));
double wjets_n(hwjets->IntegralAndError(0,nbinsx+1, wjets_e));
//.........这里部分代码省略.........
开发者ID:ald77,项目名称:csa14,代码行数:101,代码来源:draw_from_trees.cpp
示例10: SF_e
//.........这里部分代码省略.........
"Pt25to28",
"Pt28to31",
"Pt31to34",
"Pt34to37",
"Pt37to40",
"Pt40to45",
"Pt45to50",
"Pt50to60",
"Pt60to70",
"Pt70to100",
"PtGt100"};
int nPtBins = 16; if(what == "IdIso") nPtBins = 7;
float * ptBins = new float[nPtBins+1];
TString * PtBins = new TString[nPtBins];
if(what == "IdIso"){
for(int i=0; i<nPtBins; ++i){
ptBins[i] = ptBins_def[i];
PtBins[i] = PtBins_def [i];
}
ptBins[nPtBins] = ptBins_def[nPtBins];
} else {
for(int i=0; i<nPtBins; ++i){
ptBins[i] = ptBinsTrig_def[i];
PtBins[i] = PtBinsTrig_def[i];
}
ptBins[nPtBins] = ptBinsTrig_def[nPtBins];
}
// create eta histogram with eta ranges associated to their names (eg. endcap, barrel) ***** //
TH1D * etaBinsH = new TH1D("etaBinsH", "etaBinsH", nEtaBins, etaBins);
etaBinsH->Draw();
etaBinsH->GetXaxis()->Set(nEtaBins, etaBins);
for (int i=0; i<nEtaBins; i++){ etaBinsH->GetXaxis()->SetBinLabel(i+1, EtaBins[i]);}
etaBinsH->Draw();
// create pt histogram_s with pt ranges associated to their names (eg. Pt10to13, ..) ***** //
TH1D * ptBinsH = new TH1D("ptBinsH", "ptBinsH", nPtBins, ptBins);
ptBinsH->Draw();
ptBinsH->GetXaxis()->Set(nPtBins, ptBins);
for (int i=0; i<nPtBins; i++){ ptBinsH->GetXaxis()->SetBinLabel(i+1, PtBins[i]);}
ptBinsH->Draw();
float ptBins_edges[nPtBins+1];
for (int i=0; i<nPtBins; i++) { ptBins_edges[i]=ptBinsH->GetBinLowEdge(i+1); }
ptBins_edges[nPtBins]= ptBinsH->GetBinLowEdge(nPtBins+1);
// define if in the fit of failing probes
// the FSR component will be used in the
// signal function
bool fitWithFSR[nPtBins];
for (int i=0; i<nPtBins; i++) fitWithFSR[i] = false;
if(what == "IdIso"){
fitWithFSR[2]=true;
fitWithFSR[3]=true;
}
开发者ID:MaVour,项目名称:DesyTauAnalysesRun2_25ns,代码行数:66,代码来源:SF_e.C
示例11: phroc2ps
//----------------------------------------------------------------------
void phroc2ps( )
{
using namespace std;
gROOT->Time();
// set styles:
gStyle->SetTextFont(62); // 62 = Helvetica bold LaTeX
gStyle->SetTextAlign(11);
gStyle->SetTickLength( -0.02, "x" ); // tick marks outside
gStyle->SetTickLength( -0.02, "y" );
gStyle->SetTickLength( -0.02, "z" );
gStyle->SetLabelOffset( 0.022, "x" );
gStyle->SetLabelOffset( 0.022, "y" );
gStyle->SetLabelOffset( 0.022, "z" );
gStyle->SetLabelFont( 62, "X" );
gStyle->SetLabelFont( 62, "Y" );
gStyle->SetLabelFont( 62, "Z" );
gStyle->SetTitleOffset( 1.3, "x" );
gStyle->SetTitleOffset( 2.0, "y" );
gStyle->SetTitleOffset( 1.9, "z" );
gStyle->SetTitleFont( 62, "X" );
gStyle->SetTitleFont( 62, "Y" );
gStyle->SetTitleFont( 62, "Z" );
gStyle->SetTitleBorderSize(0); // no frame around global title
gStyle->SetTitleX( 0.20 ); // global title
gStyle->SetTitleY( 0.98 ); // global title
gStyle->SetTitleAlign(13); // 13 = left top align
gStyle->SetLineWidth(1);// frames
gStyle->SetHistLineColor(4); // 4=blau
gStyle->SetHistLineWidth(3);
gStyle->SetHistFillColor(5); // 5 = gelb
// gStyle->SetHistFillStyle(4050); // 4050 = half transparent
gStyle->SetHistFillStyle(1001); // 1001 = solid
gStyle->SetFrameLineWidth(2);
// statistics box:
gStyle->SetOptStat(11);
gStyle->SetStatFormat( "8.6g" ); // more digits, default is 6.4g
gStyle->SetStatFont(42); // 42 = Helvetica normal
// gStyle->SetStatFont(62); // 62 = Helvetica bold
gStyle->SetStatBorderSize(1); // no 'shadow'
gStyle->SetStatX(0.80); // cvsq
gStyle->SetStatY(0.90);
gStyle->SetPalette(1); // rainbow colors
gStyle->SetHistMinimumZero(); // no zero suppression
gStyle->SetOptDate();
gROOT->ForceStyle();
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// book new histos:
TH1D* hnpt = new TH1D( "hnpt", "data points;data points;pixels", 512, 0.5, 512.5 );
TH1D* hiter = new TH1D( "hiter", "fit iterations;fit iterations;pixels", 100, 0, 1000 );
TH1D* hchisq = new TH1D( "hchisq", "chisq/ndof;chisq/ndof;pixels", 100, 0, 10 );
TH1D* hmax = new TH1D( "hmax", "Amax;Amax [ADC];pixels", 256, 0, 256 );
TH1D* hoff = new TH1D( "hoff", "Weibull PH at 0;Weibull PH at 0 [ADC];pixels", 250, 0, 250 );
TH1D* htop = new TH1D( "htop", "top PH;maximum PH [ADC];pixels", 256, -0.5, 255.5 );
TH1D* hinf = new TH1D( "hinf", "inflection point;point of maximum gain [large Vcal DACs];pixels", 200, 0, 100 );
TH1D* hslp = new TH1D( "hslp", "max slope;Weibull max slope [ADC/DAC];pixels", 500, 0, 5 );
TH1D* hrat = new TH1D( "hrat", "large/small;large/small Vcal;pixels", 100, 6, 8 );
TProfile2D* h10 = new TProfile2D( "h10", "Weibull PH at 0 map;col;row;Weibull PH at 0 [ADC]", 52, -0.5, 51.5, 80, -0.5, 79.5, -100, 250 );
TProfile2D* h11 = new TProfile2D( "h11", "top PH map;col;row;maximum PH [ADC]", 52, -0.5, 51.5, 80, -0.5, 79.5, 0, 300 );
TProfile2D* h12 = new TProfile2D( "h12", "inflection point map;col;row;Weibull inflection point [large Vcal DAC]", 52, -0.5, 51.5, 80, -0.5, 79.5, 0, 250 );
TProfile2D* h13 = new TProfile2D( "h13", "maximum gain map;col;row;Weibull maximum gain [ADC/large Vcal DAC]", 52, -0.5, 51.5, 80, -0.5, 79.5, 0, 50 );
TProfile2D* h14 = new TProfile2D( "h14", "ratio map;col;row;large/small Vcal", 52, -0.5, 51.5, 80, -0.5, 79.5, 0, 20 );
TProfile2D* h15 = new TProfile2D( "h15", "chisq map;col;row;mpfit chisq", 52, -0.5, 51.5, 80, -0.5, 79.5, 0, 99 );
// open output file:
ofstream gainfile( "phroc.dat" );
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cout << "pwd: ";
gDirectory->pwd();
cout << "gDir " << gDirectory->GetName() << endl;
gDirectory->ls();
cout << "keys " << gDirectory->GetNkeys() << endl;
//.........这里部分代码省略.........
开发者ID:clseitz,项目名称:Psi46testDesy,代码行数:101,代码来源:phroc2ps.C
示例12: plot_BGEst_trigger
void plot_BGEst_trigger(string cutname="delphi", string histname="MHT"){
///////////////////////////////////////////////////////////////////////////////////////////
////Some cosmetic work for official documents.
//gROOT->LoadMacro("tdrstyle.C");
//setTDRStyle();
//gROOT->LoadMacro("CMS_lumi_v2.C");
gStyle->SetOptStat(0); ///to avoid the stat. on the plots
gStyle->SetPalette(1) ; // for better color output
char tempname[200];
char tempname2[200];
int W = 600;
int H = 600;
int H_ref = 600;
int W_ref = 800;
float T = 0.08*H_ref;
float B = 0.12*H_ref;
float L = 0.12*W_ref;
float R = 0.04*W_ref;
TCanvas* canvas = new TCanvas("name","name",10,10,W,H);
canvas->SetFillColor(0);
canvas->SetBorderMode(0);
canvas->SetFrameFillStyle(0);
canvas->SetFrameBorderMode(0);
canvas->SetLeftMargin( L/W );
canvas->SetRightMargin( R/W );
canvas->SetTopMargin( T/H );
canvas->SetBottomMargin( B/H );
canvas->SetTickx(0);
canvas->SetTicky(0);
canvas->Divide(1, 2);
//
// Define pads
//
TPad * canvas_up = (TPad*) canvas->GetListOfPrimitives()->FindObject("canvas_1");
TPad * canvas_dw = (TPad*) canvas->GetListOfPrimitives()->FindObject("canvas_2");
// set pad size
canvas_up->SetPad(0., .25, 0.97, 1.);
canvas_dw->SetPad(0., 0.07, 0.97, 0.25);
canvas_up->SetFrameFillColor(0);
canvas_up->SetFillColor(0);
canvas_dw->SetFillColor(0);
canvas_dw->SetFrameFillColor(0);
canvas_dw->SetBottomMargin(0.3);
// set top margin 0 for bottom figure
canvas_dw->SetTopMargin(0);
Float_t legendX1 = .20; //.50;
Float_t legendX2 = .90; //.70;
Float_t legendY1 = .70; //.65;
Float_t legendY2 = .90;
TLegend* catLeg1 = new TLegend(legendX1,legendY1,legendX2,legendY2);
catLeg1->SetTextSize(0.032);
catLeg1->SetTextFont(42);
catLeg1->SetFillColor(0);
catLeg1->SetLineColor(0);
catLeg1->SetBorderSize(0);
TFile *file_NoTrig = new TFile("InputRootFiles/HadTauEstimation_data_SingleMuon_v14c_.root","R");
TFile *file_Mu15 = new TFile("InputRootFiles/HadTauEstimation_data_SingleMuon_v14c_HLT_Mu15_IsoVVVL_PFHT350_PFMET70_v_.root","R");
TFile *file_Mu50 = new TFile("InputRootFiles/HadTauEstimation_data_SingleMuon_v14c_HLT_Mu50_v_.root","R");
TFile *file_Mu15ORMu50 = new TFile("InputRootFiles/HadTauEstimation_data_SingleMuon_v14c_HLT_Mu50_v_OR_HLT_Mu15_IsoVVVL_PFHT350_PFMET70_v_.root","R");
sprintf(tempname,"allEvents/%s/%s_%s_allEvents",cutname.c_str(),histname.c_str(),cutname.c_str());
TH1D * NoTrigHist = (TH1D*)file_NoTrig->Get(tempname)->Clone();
NoTrigHist->SetLineColor(41);
NoTrigHist->SetLineWidth(2);
TH1D * Mu15Hist = (TH1D*)file_Mu15->Get(tempname)->Clone();
Mu15Hist->SetLineColor(1);
Mu15Hist->SetLineWidth(2);
TH1D * Mu50Hist = (TH1D*)file_Mu50->Get(tempname)->Clone();
Mu50Hist->SetLineColor(2);
Mu50Hist->SetLineWidth(2);
TH1D * Mu15ORMu50Hist = (TH1D*)file_Mu15ORMu50->Get(tempname)->Clone();
Mu15ORMu50Hist->SetLineColor(4);
Mu15ORMu50Hist->SetLineWidth(2);
NoTrigHist->SetMaximum(10.);
if(histname=="MHT"){
NoTrigHist->SetMaximum(10.);
NoTrigHist->GetXaxis()->SetRangeUser(0.0,1000.);
}
if(histname=="HT"){
NoTrigHist->SetMaximum(10.);
NoTrigHist->GetXaxis()->SetRangeUser(0.0,1500.);
}
if(histname=="NJet"){
NoTrigHist->SetMaximum(10.);
NoTrigHist->GetXaxis()->SetRangeUser(3.0,10.);
}
if(histname=="NBtag"){
NoTrigHist->SetMaximum(15.);
NoTrigHist->GetXaxis()->SetRangeUser(0.0,4.);
//.........这里部分代码省略.........
开发者ID:hatakeyamak,项目名称:RA2-RA2b-2015,代码行数:101,
|
请发表评论