/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Alignment/OfflineValidation/scripts/pullz0.C
142 строки
4 KB
Nicola De Filippis
root macro for pull distributions
26 ноя 2007, 17:31
26 ноя 2007, 17:31
77bb6c6
Код
Авторство
О чём код?
class Plots{ public: Plots(); void Legend(TString histoname1,TString histoname2,TString histoname3, TH1F *histo1, TH1F *histo2, TH1F *histo3); void Save(); float convert(float num); }; void Plots::Plots() { gROOT->Reset(); gROOT->Clear(); gStyle->SetNdivisions(10); gStyle->SetCanvasBorderMode(0); gStyle->SetPadBorderMode(1); gStyle->SetOptTitle(1); gStyle->SetStatFont(42); gStyle->SetCanvasColor(10); gStyle->SetPadColor(0); gStyle->SetTitleFont(62,"xy"); gStyle->SetLabelFont(62,"xy"); gStyle->SetTitleFontSize(0.05); gStyle->SetTitleSize(0.039,"xy"); gStyle->SetLabelSize(0.046,"xy"); // gStyle->SetTitleFillColor(0); gStyle->SetHistFillStyle(1001); gStyle->SetHistFillColor(0); gStyle->SetHistLineStyle(1); gStyle->SetHistLineWidth(2); gStyle->SetHistLineColor(2); gStyle->SetTitleXOffset(1.15); gStyle->SetTitleYOffset(1.15); gStyle->SetOptStat(1110); gStyle->SetOptStat(kFALSE); gStyle->SetOptFit(0111); gStyle->SetStatH(0.1); TCanvas *c1 = new TCanvas("c1","c1",129,17,926,703); c1->SetBorderSize(2); c1->SetFrameFillColor(0); c1->SetLogy(0); c1->cd(); TFile *f[4]; TTree *MyTree[4]; f[0]= new TFile("/tmp/ndefilip/ValidationMisalignedTracker_singlemu100_merged.root"); MyTree[0]=EffTracks; f[1]=new TFile("/tmp/ndefilip/ValidationMisalignedTracker_singlemu100_SurveyLASCosmics_merged.root"); MyTree[1]=EffTracks; f[2]=new TFile("/tmp/ndefilip/ValidationMisalignedTracker_singlemu100_10pb_merged.root"); MyTree[2]=EffTracks; f[3]=new TFile("/tmp/ndefilip/ValidationMisalignedTracker_singlemu100_100pb_merged.root"); MyTree[3]=EffTracks; ////&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& //&&&&&&&&&&&&&&&&&&&&&&&&&&&&& /// EFFICIENCIES VS ETA ALIGNED //&&&&&&&&&&&&&&&&&&&&&&&&&&&&& char histoname[128]; char name[128]; TH1F *pullz0[4]; for(int i=0; i<4; i++){ sprintf(name,"pullz0[%d]",i); pullz0[i] = new TH1F(name,name,140,-10,10); sprintf(histoname,"pullz0[%d]",i); MyTree[i]->Project(histoname,"pullz0","eff==1 && TrackID==13"); cout << "Entries " << pullz0[i]->GetEntries() <<endl; pullz0[i]->Scale(1/pullz0[i]->GetEntries()); pullz0[i]->SetTitle("pull(z_{0})"); pullz0[i]->SetXTitle("pull(z_{0}) "); pullz0[i]->SetYTitle("arb. units"); pullz0[i]->SetLineColor(i+2); pullz0[i]->SetLineStyle(i+1); pullz0[i]->SetLineWidth(i+2); if (i==0) pullz0[i]->Draw(); else pullz0[i]->Draw("same"); // c1->WaitPrimitive(); c1->Update(); } Legend("pullz0[0]","pullz0[1]","pullz0[2]","pullz0[3]",pullz0[0],pullz0[1],pullz0[2],pullz0[3]); c1->SaveAs("pullz0_mu.eps"); c1->SaveAs("pullz0_mu.gif"); gROOT->Reset(); gROOT->Clear(); delete c1; } void Plots::Legend(TString histoname1,TString histoname2,TString histoname3, TString histoname4, TH1F *histo1, TH1F *histo2, TH1F *histo3, TH1F *histo4) { TLegend *leg = new TLegend(0.45,0.88,1.,1.0); leg->SetTextAlign(32); leg->SetTextColor(1); leg->SetTextSize(0.020); char label[128]; sprintf(label,"perfect alignment; mean = %1.3f, RMS = %1.3f",convert(histo1->GetMean()),convert(histo1->GetRMS())); leg->AddEntry(histoname1, label, "l"); sprintf(label,"SurveyLASCosmics alignment; mean = %1.3f, RMS = %1.3f",convert(histo2->GetMean()),convert(histo2->GetRMS())); leg->AddEntry(histoname2, label, "l"); sprintf(label,"10 pb-1 alignment; mean = %1.3f, RMS = %1.3f",convert(histo3->GetMean()),convert(histo3->GetRMS())); leg->AddEntry(histoname3, label, "l"); sprintf(label,"100 pb-1 alignment; mean = %1.3f, RMS = %1.3f",convert(histo4->GetMean()),convert(histo4->GetRMS())); leg->AddEntry(histoname4, label, "l"); leg->Draw(); } float Plots::convert(float num){ int mean1 = num; float res = num - mean1; int res2 = res*1000; float res3 = res2*0.001; float mean2 = mean1 + res3; float res4 = res - res3; int res5 = res4*10000; if(res5>5) mean2 = mean2 + 0.001; return mean2; }