void DrawClus(bool Flag_err,TTree* tree,Double_t *errx,char* varToPlot, char* cond, Int_t kColor, Int_t kMarker, char* Title,char* xTitle,char* yTitle, TLegend *leg, char* cLeg,Double_t downlim,Double_t uplim){ TGraphErrors* g; tree->Draw(varToPlot, cond,"goff"); cout << tree->GetSelectedRows() << endl; if(tree->GetSelectedRows()){ if(Flag_err) g=new TGraphErrors(tree->GetSelectedRows(),tree->GetV1(),tree->GetV2(),errx,tree->GetV3()); else g=new TGraphErrors(tree->GetSelectedRows(),tree->GetV1(),tree->GetV2(),errx,errx); g->SetMarkerStyle(kMarker); g->SetMarkerSize(0.9); g->SetMarkerColor(kColor); g->SetTitle(Title); g->GetXaxis()->SetTitle(xTitle); g->GetXaxis()->CenterTitle(); g->GetYaxis()->SetTitle(yTitle); g->GetYaxis()->CenterTitle(); g->GetYaxis()->SetRangeUser(downlim,uplim); g->Draw("Ap"); leg->AddEntry(g, cLeg,"p"); }else{ cout << "NO rows selected for leave " << varToPlot << endl; } }
void DrawSame(char* varToPlot, char* cond, Int_t kColor,TLegend* leg,char* cLeg) { TGraphErrors *g; TIFTree->Draw(varToPlot,cond,"goff"); Int_t nSel=TIFTree->GetSelectedRows(); if ( nSel ) { Double_t *ErrX= new Double_t[nSel]; for ( Int_t i=0; i<nSel; i++) ErrX[i]=0; g = new TGraphErrors(TIFTree->GetSelectedRows(), TIFTree->GetV1(), TIFTree->GetV2(), ErrX, TIFTree->GetV3()); g->SetMarkerStyle(21); g->SetMarkerSize(0.5); g->SetMarkerColor(kColor); g->SetLineColor(kColor); g->Draw("SP"); //draw graph in current pad // g->GetYaxis()->SetRangeUser(40., 100.); leg->AddEntry(g,cLeg); leg->Draw(); delete[] ErrX; } else { cout << "NO rows selected " << endl; } }
void plotV2vstheta(){ gStyle->SetOptFit(1); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); gStyle->SetErrorX(0); int xbin = 0; TFile *f = new TFile("mergedV_Prod.root"); TVectorD *vecV = (TVectorD*)f->Get(Form("D_%d/V")); TVectorD *vecdeltaV = (TVectorD*)f->Get(Form("D_%d/deltaV")); TVectorD *vecVmean = (TVectorD*)f->Get(Form("Vmean")); double *V = vecV->GetMatrixArray(); double *deltaV = vecdeltaV->GetMatrixArray(); double *Vmean = vecVmean->GetMatrixArray(); double theta[ntheta]; for(int itheta=0;itheta<ntheta;itheta++){ theta[itheta]=itheta*TMath::Pi()/ntheta/nn; } TH1D *hFrame = new TH1D("","",300,-1,2); hFrame->GetXaxis()->SetTitle("#theta"); hFrame->GetYaxis()->SetTitle("referenceV_{2}"); hFrame->GetXaxis()->SetTitleSize(0.04); hFrame->GetYaxis()->SetTitleSize(0.04); hFrame->GetXaxis()->SetRangeUser(-0.1,1.5); hFrame->SetMaximum(0.055); hFrame->SetMinimum(0.045); hFrame->Draw(); TGraphErrors *gr = new TGraphErrors(ntheta,theta,V,0,deltaV); gr->SetMarkerSize(1.2); gr->SetMarkerStyle(20); gr->Draw("Psame"); TLine *l = new TLine(0,inV2,1.4,inV2); l->SetLineStyle(2); l->Draw("same"); c1->Print("V2vstheta.png"); }
void draw() { gStyle->SetOptStat(0000); TGraphErrors* gr = new TGraphErrors("papel_um.txt", "%lg %lg %lg %lg"); gr->Draw("A"); gr->GetXaxis()->SetTitle("Diametro (mm)"); gr->GetYaxis()->SetTitle("Massa (u.m.)"); gr->SetTitle("Dimensao Fractal - Papel"); gr->SetMarkerStyle(20); gr->SetMarkerSize(gr->GetMarkerSize()/2.); TCanvas* c1 = new TCanvas(); gr->Draw("AP"); c1->Print("gr1.png"); TGraphErrors* grlog = new TGraphErrors(); for (int i=0; i<gr->GetN(); i++) { grlog->SetPoint(i, TMath::Log(gr->GetX()[i]), TMath::Log(gr->GetY()[i])); grlog->SetPointError(i, gr->GetEX()[i]/gr->GetX()[i], 0.0); } grlog->Draw("A"); grlog->GetXaxis()->SetTitle("Logaritmo do diametro (diametro em mm)"); grlog->GetYaxis()->SetTitle("Logaritmo da massa (massa em unidade arbitraria)"); grlog->SetTitle("Dimensao Fractal - Papel"); grlog->SetMarkerStyle(20); // grlog->SetMarkerSize(gr->GetMarkerSize()/2.); grlog->Fit("pol1"); TCanvas* c2 = new TCanvas(); grlog->Draw("AP"); c2->Print("gr2.png"); }
void ExpManager::GetSim1DGraphZ(TString NameTitle, double xmin, double xmax, double ymin, double ymax, TString grid ){ // do the same thing as for the polar interpolation TGraphErrors *fGraph = new TGraphErrors(); //= new TGraph2DErrors(np, x_array, y_array, bz_array, ex, ey, ez); fGraph->SetTitle("Simulated Data;Z (mm);Magnetic Field (mT)"); fGraph->SetMarkerSize(1.2); fGraph->SetMarkerStyle(20); fGraph->SetMarkerColor(kBlue); fGraph->SetLineColor(kBlue); fGraph->SetLineWidth(2); int graph_counter = 0 ; for (unsigned i=0; i< fExpY.size(); i++) { //cout << " X " << fExpX.at(i) ; if( (fExpX.at(i) >= xmin && fExpX.at(i) <= xmax) && (fExpY.at(i) >= ymin && fExpY.at(i) <= ymax) && fGrid.at(i)==grid ){ fGraph->SetPoint(graph_counter,fExpZ.at(i),fSimB.at(i)); fGraph->SetPointError(graph_counter,fExpZErr.at(i),0); graph_counter++; } } fGraph->SetTitle(NameTitle+Form(" Simulated Data : %.2f < X < %.2f mm __ %.2f < Y < %.2f mm;Z (mm);Magnetic Field (mT)",xmin,xmax,ymin,ymax)); fGraph->SetName(NameTitle+Form("_Sim_X_%.2f_%.2fmm_Y_%.2f_%.2fmm",xmin,xmax,ymin,ymax)); fGraph->Write(); }
void ExpManager::GetExp1DGraphX(TString NameTitle, double zmin, double zmax, double ymin, double ymax, TString grid){ // do the same thing as for the polar interpolation TGraphErrors *fGraph = new TGraphErrors(); //= new TGraph2DErrors(np, x_array, y_array, bz_array, ex, ey, ez); fGraph->SetTitle("Experimental Data;X (mm);Magnetic Field (mT)"); fGraph->SetMarkerSize(1.2); fGraph->SetMarkerStyle(20); fGraph->SetMarkerColor(kBlue); fGraph->SetLineColor(kBlue); fGraph->SetLineWidth(2); int graph_counter = 0 ; for (unsigned i=0; i< fExpY.size(); i++) { //cout << " X " << fExpX.at(i) ; if( (fExpY.at(i) >= ymin && fExpY.at(i) <= ymax) && (fExpZ.at(i) >= zmin && fExpZ.at(i) <= zmax) && fGrid.at(i)== grid ){ cout << " < ----- " ; fGraph->SetPoint(graph_counter,fExpX.at(i),fExpB.at(i)); // CHECK, add new the stuff for emag fGraph->SetPointError(graph_counter,fExpXErr.at(i),fExpBErr.at(i)); // CHECK, add new the stuff for emag graph_counter++; } cout << endl ; } fGraph->SetTitle(NameTitle+Form(" Experimental Data : %.2f < Depth < %.2f mm __ %.2f < Y < %.2f mm;X (mm);Magnetic Field (mT)",zmin,zmax,ymin,ymax)); fGraph->SetName(NameTitle+Form("_Exp_Depth_%.2f_%.2fmm_Y_%.2f_%.2fmm",zmin,zmax,ymin,ymax)); fGraph->Write(); }
//______________________________________________________________________________ // Construct a graph from vectors and y error vector TGraphErrors *LoadGraphFromVectorsWithError(vector<double> xVector, vector<double> yVector, vector<double> yErrorVector, string xTitle, string yTitle) { int n = xVector.size(); if ((xVector.size() == yVector.size()) && (yVector.size() == yErrorVector.size())) { //Create a graph TGraphErrors *gr = new TGraphErrors(n, &xVector[0], &yVector[0], 0, &yErrorVector[0]); gr->SetTitle(""); gr->SetMarkerStyle(20); gr->SetMarkerSize(1.2); gr->SetLineWidth(2); gr->GetXaxis()->SetTitle(xTitle.c_str()); gr->GetXaxis()->CenterTitle(); gr->GetYaxis()->SetTitle(yTitle.c_str()); gr->GetYaxis()->CenterTitle(); return gr; delete gr; } else { TGraphErrors *gr0 = new TGraphErrors(); return gr0; delete gr0; } }
//========================================== //========================================== void createTgr(TString fname) { outH=new TFile(fname,"RECREATE"); assert(outH->IsOpen()); printf("save outH -->%s\n", fname.Data()); char *ampTit[mxAmp]={"An", "AnYell", "A#Sigma", "A#Delta"}; int ampCol[mxAmp]={kBlue, kYellow, kGreen, kMagenta}; int ic,iam; for (ic=0;ic<totC;ic++) { for (iam=0;iam<mxAmp;iam++) { char name[100]; sprintf(name,"%s*%s",ampL[iam],tCutL[ic]); //printf("ic=%d iam=%d name=%s=\n",ic,iam,name); TGraphErrors *gr =new TGraphErrors; gr->SetName(name); gr->SetTitle(ampTit[iam]); gr->SetMarkerColor(ampCol[iam]); gr->SetMarkerSize(0.8); gr->SetMarkerStyle(21); assert(nGr<mxGr); grL[nGr++]=gr; } } }
instrAsy() { gStyle->SetOptStat(0); gStyle->SetOptFit(0); TGraphErrors *gr =new TGraphErrors; gr->SetName("insyAsy"); gr->SetTitle("Instrumental Asymmetries"); //gr->SetMarkerColor(ampCol[iam]); gr->SetMarkerSize(0.8); gr->SetMarkerStyle(21); TGraphErrors *gr1=gr; TString wrkDir="final/"; TString fname=wrkDir+"defaultB-H/asyVer1.hist.root"; TFile *inpH=new TFile(fname); assert(inpH->IsOpen()); //inpH->ls(); const int nSel=5; char *selL[nSel]={ "a0*All","b0*All","a2*All","b2*All","c1*All"}; int isel; for (isel=0;isel<nSel;isel++) { TGraphErrors *gr =(TGraphErrors *) inpH->Get(selL[isel]); assert(gr); //gr->Print(); //gr->Draw("AP"); float x1=0; if(isel<2) x1=2189; gr->Fit("pol0","","",x1,3000); TF1 *ff=gr->GetFunction("pol0"); if(ff==0) continue; // no fit was made float val=ff->GetParameter(0); float err=ff->GetParError(0); printf("pol0= %f +/- %f\n",val,err); int n=gr1->GetN(); float x=isel+1; gr1->SetPoint(n,x,val); gr1->SetPointError(n,0,err); } gr1->Print(); // return; gr1->Draw("AP"); // save Tgraph TString fname=wrkDir+"instAsy.hist.root"; TFile *outH=new TFile(fname,"RECREATE"); assert(outH->IsOpen()); printf("save outH -->%s\n", fname.Data()); gr1->Write(); outH->ls(); outH->Write(); return; }
std::pair<double,double> plotVelocity(std::vector<double> positions, std::vector<double> means, int strip, std::vector<double> errors, char thresholdLabel) { TCanvas* c = new TCanvas(); TGraphErrors* vGraph = new TGraphErrors(positions.size(), &means[0], &positions[0], 0, &errors[0] ); vGraph->SetMarkerStyle(20); vGraph->SetMarkerSize(1); vGraph->Draw("AP"); vGraph->Fit("pol1"); TF1* fit = vGraph->GetFunction("pol1"); std::stringstream buf; buf << strip << "_" << thresholdLabel; c->SaveAs( (buf.str() + ".png").c_str() ); std::pair<double,double> resultOfFit = std::make_pair<double,double> ( (fit->GetParameter(1))*-0.2, (fit->GetParError(1))*-0.2 ); return resultOfFit; }
void ExpManager::DrawMap(TString NameTitle, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) { TMultiGraph *mg = new TMultiGraph(); //Draw a cross TGraphErrors *frame = new TGraphErrors(); //= new TGraph2DErrors(np, x_array, y_array, bz_array, ex, ey, ez); frame->SetPoint(0,+0,+100); frame->SetPoint(1,+0,-100); frame->SetPoint(2,0,0); frame->SetPoint(3,-100,0); frame->SetPoint(4,+100,0); frame->SetPoint(5,+0,+0); frame->SetPoint(6,+0,-100); frame->SetMarkerColor(kWhite); frame->SetDrawOption("ap"); //Draw the map TGraphErrors *fGraph = new TGraphErrors(); //= new TGraph2DErrors(np, x_array, y_array, bz_array, ex, ey, ez); fGraph->SetMarkerSize(1.2); fGraph->SetMarkerStyle(20); fGraph->SetMarkerColor(kBlue); fGraph->SetLineColor(kBlue); fGraph->SetLineWidth(1); //fGraph->SetDrawOption("ap"); int graph_counter = 0 ; for (unsigned i=0; i< fExpY.size(); i++) { if( (fExpX.at(i) >= xmin && fExpX.at(i) <= xmax) && (fExpY.at(i) >= ymin && fExpY.at(i) <= ymax) && (fExpZ.at(i) >= zmin && fExpZ.at(i) <= zmax) ) { fGraph->SetPoint(graph_counter,fExpX.at(i),fExpY.at(i)); fGraph->SetPointError(graph_counter,fExpXErr.at(i),fExpYErr.at(i)); graph_counter++; } } //fGraph->Write(); mg->SetTitle(NameTitle+Form(" Map : %.2f < X < %.2f mm %.2f < Y < %.2f mm %.2f < Z < %.2f mm;X (mm);Y (mm)",xmin,xmax,ymin,ymax,zmin,zmax)); mg->SetName(NameTitle+Form("_Map__X_%.2f_%.2fmm__Y_%.2f_%.2fmm__Z_%.2f_%.2fmm",xmin,xmax,ymin,ymax,zmin,zmax)); mg->Add(frame); mg->Add(fGraph); mg->Write(); }
void DrawSame(bool Flag_err,TTree *tree,Double_t *errx, char* varToPlot, char* cond, Int_t kColor,Int_t kMarker,TLegend* leg,char* cLeg){ TGraphErrors *g; tree->Draw(varToPlot,cond,"goff"); if (tree->GetSelectedRows()) { if(Flag_err) g = new TGraphErrors(tree->GetSelectedRows(), tree->GetV1(), tree->GetV2(), errx, tree->GetV3()); else g=new TGraphErrors(tree->GetSelectedRows(),tree->GetV1(),tree->GetV2(),errx,errx); g->SetMarkerStyle(kMarker); g->SetMarkerSize(0.9); g->SetMarkerColor(kColor); g->Draw("SP"); //draw graph in current pad leg->AddEntry(g,cLeg,"p"); leg->Draw(); }else{ cout << "NO rows selected for leave " << varToPlot << endl; } }
TGraphErrors* getDataMcResponseRatio(TGraphErrors* gData, TGraphErrors* gMc, int aNumberOfPtBins, string XTitle) { Double_t x[aNumberOfPtBins]; Double_t ex[aNumberOfPtBins]; for(int j=0;j<aNumberOfPtBins; j++) { ex[j] = 0.; } Double_t xratio[aNumberOfPtBins]; Double_t ydata[aNumberOfPtBins]; Double_t ymc[aNumberOfPtBins]; Double_t yr[aNumberOfPtBins]; Double_t eydata[aNumberOfPtBins]; Double_t eymc[aNumberOfPtBins]; Double_t eyr[aNumberOfPtBins]; int nBins = 0; for(int i=0; i<aNumberOfPtBins; i++) { gMc->GetPoint(i,x[i],ymc[i]); gData->GetPoint(i,x[i],ydata[i]); eymc[i] = gMc->GetErrorY(i); eydata[i] = gData->GetErrorY(i); if (ymc[i] == 0 || ydata[i] == 0) continue; xratio[nBins] = x[i]; yr[nBins] = ydata[i]/ymc[i]; std::cout << yr[nBins] << std::endl; eyr[nBins] = sqrt(pow(eydata[i]/ymc[i],2)+pow(eymc[i]*ydata[i]/(pow(ymc[i],2)),2)); nBins++; } TGraphErrors *gDataMcResponseratio = new TGraphErrors(nBins,xratio,yr,ex,eyr); gDataMcResponseratio->SetMarkerStyle(20); gDataMcResponseratio->SetMarkerColor(1); gDataMcResponseratio->SetLineColor(1); gDataMcResponseratio->SetMarkerSize(1.0); //gDataMcResponseratio->SetMaximum(1.08); //gDataMcResponseratio->SetMinimum(0.90); gDataMcResponseratio->GetXaxis()->SetTitle(XTitle.c_str()); return gDataMcResponseratio; }
void ExpManager::GetExp1DGraphPolar(TString NameTitle, double zmin, double zmax, double anglemin, double anglemax, TString grid) { TGraphErrors *fGraph = new TGraphErrors(); //= new TGraph2DErrors(np, x_array, y_array, bz_array, ex, ey, ez); fGraph->SetTitle("Experimental Data;Radius (mm);Magnetic Field (mT)"); fGraph->SetMarkerSize(1.2); fGraph->SetMarkerStyle(20); fGraph->SetMarkerColor(kBlue); fGraph->SetLineColor(kBlue); fGraph->SetLineWidth(2); int graph_counter = 0 ; for (unsigned i=0; i< fExpR.size(); i++) { if( (fExpTheta.at(i) >= anglemin && fExpTheta.at(i) <= anglemax) && (fExpZ.at(i) >= zmin && fExpZ.at(i) <= zmax) && fGrid.at(i)== grid ){ fGraph->SetPoint(graph_counter,fExpR.at(i),fExpB.at(i)); fGraph->SetPointError(graph_counter,fExpRErr.at(i),fExpBErr.at(i)); graph_counter++; } } fGraph->SetTitle(NameTitle+Form(" Experimental Data : %.2f < Depth < %.2f mm __ %.2f#circ < Angle < %.2f#circ;Radius (mm);Magnetic Field (mT)",zmin,zmax,anglemin,anglemax)); fGraph->SetName(NameTitle+Form("_Exp_Depth_%.2f_%.2fmm_Angle_%.2f_%.2fdeg",zmin,zmax,anglemin,anglemax)); fGraph->Write(); }
void paraPull_alpha_MUON_ISO_SYS_2TeV_2Lep_plots_All() { //=========Macro generated from canvas: c1/alpha_MUON_ISO_SYS //========= (Sun Nov 22 20:21:56 2015) by ROOT version6.02/12 TCanvas *c1 = new TCanvas("c1", "alpha_MUON_ISO_SYS",0,22,1000,600); gStyle->SetOptStat(0); c1->Range(-4.125,-0.9777052,37.125,1.049159); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetBorderSize(2); c1->SetGridx(); c1->SetGridy(); c1->SetFrameBorderMode(0); c1->SetFrameBorderMode(0); TH1F *NuisanceParameterFreed33 = new TH1F("NuisanceParameterFreed33","alpha_MUON_ISO_SYS",33,0,33); NuisanceParameterFreed33->SetMinimum(-0.7750188); NuisanceParameterFreed33->SetMaximum(0.8464727); NuisanceParameterFreed33->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); NuisanceParameterFreed33->SetLineColor(ci); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(1,"XS_ttbar"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(2,"EG_SCALE_ALL"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(3,"FT_EFF_Eigen_C_0"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(4,"Luminosity"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(5,"XS_st"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(6,"FT_EFF_Eigen_B_1"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(7,"XS_Zc"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(8,"MUONS_ID"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(9,"FT_EFF_Eigen_C_1"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(10,"FT_EFF_Eigen_C_3"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(11,"MUON_EFF_TrigSystUncertainty"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(12,"XS_Zl"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(13,"EL_EFF_ID_TotalCorrUncertainty"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(14,"FT_EFF_Eigen_B_0"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(15,"FT_EFF_Eigen_B_2"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(16,"EL_EFF_Iso_TotalCorrUncertainty"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(17,"EL_EFF_Reco_TotalCorrUncertainty"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(18,"MUONS_SCALE"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(19,"MUON_ISO_STAT"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(20,"FT_EFF_extrapolation"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(21,"MUON_EFF_STAT"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(22,"MUON_EFF_SYS"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(23,"MUON_EFF_TrigStatUncertainty"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(24,"FT_EFF_Eigen_Light_2"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(25,"FT_EFF_Eigen_Light_1"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(26,"EG_RESOLUTION_ALL"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(27,"XS_diboson"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(28,"FT_EFF_Eigen_Light_4"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(29,"FT_EFF_Eigen_Light_3"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(30,"MUONS_MS"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(31,"XS_Zb"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(32,"FT_EFF_Eigen_C_2"); NuisanceParameterFreed33->GetXaxis()->SetBinLabel(33,"FT_EFF_Eigen_Light_0"); NuisanceParameterFreed33->GetXaxis()->SetLabelFont(42); NuisanceParameterFreed33->GetXaxis()->SetLabelSize(0.035); NuisanceParameterFreed33->GetXaxis()->SetTitleSize(0.035); NuisanceParameterFreed33->GetXaxis()->SetTitleFont(42); NuisanceParameterFreed33->GetYaxis()->SetTitle("#theta_{fit} - #theta_{initial}/#Delta#theta"); NuisanceParameterFreed33->GetYaxis()->SetLabelFont(42); NuisanceParameterFreed33->GetYaxis()->SetLabelSize(0.035); NuisanceParameterFreed33->GetYaxis()->SetTitleSize(0.035); NuisanceParameterFreed33->GetYaxis()->SetTitleFont(42); NuisanceParameterFreed33->GetZaxis()->SetLabelFont(42); NuisanceParameterFreed33->GetZaxis()->SetLabelSize(0.035); NuisanceParameterFreed33->GetZaxis()->SetTitleSize(0.035); NuisanceParameterFreed33->GetZaxis()->SetTitleFont(42); NuisanceParameterFreed33->Draw("hist"); Double_t _fx1033[35] = { 1.22802e-312, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, 24.5, 25.5, 26.5, 27.5, 28.5, 29.5, 30.5, 31.5, 32.5, 0}; Double_t _fy1033[35] = { 1.22802e-312, -0.7750188, -0.3925669, -0.2928498, -0.2070924, -0.1830524, -0.1280032, -0.1262679, -0.1096289, -0.06558224, -0.05681625, -0.05340132, -0.04752113, -0.03756, -0.03159065, -0.03113199, -0.02395544, -0.01709673, -0.001375576, 0.0001640258, 0.01017132, 0.01056379, 0.01803238, 0.01953954, 0.02015159, 0.02033505, 0.0231812, 0.04061694, 0.04275862, 0.04588616, 0.04795404, 0.05347781, 0.05730227, 0.8464727, 0}; Double_t _fex1033[35] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t _fey1033[35] = { 0, 0, 0.6105177, 1.072963, 1.274131, 0.9350411, 0.9915346, 0.9862834, 0.9243374, 0.769056, 0.9864216, 0.9937953, 0.9917567, 0.9969205, 0.9819024, 0.9371645, 0.9926625, 0.9931845, 0.9925671, 1.004991, 0.9933467, 0.9551202, 0.9932281, 0.9929675, 0.9926546, 0.9909755, 0.9913131, 1.098392, 0.9868992, 0.9931708, 0.9930622, 0.7376817, 0.7516033, 0.9909095, 0.7841002}; TGraphErrors *gre = new TGraphErrors(35,_fx1033,_fy1033,_fex1033,_fey1033); gre->SetName(""); gre->SetTitle(""); gre->SetFillColor(1); gre->SetMarkerStyle(20); gre->SetMarkerSize(1.2); TH1F *Graph_Graph1033 = new TH1F("Graph_Graph1033","",100,0,35.75); Graph_Graph1033->SetMinimum(-1.813084); Graph_Graph1033->SetMaximum(2.169243); Graph_Graph1033->SetDirectory(0); Graph_Graph1033->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1033->SetLineColor(ci); Graph_Graph1033->GetXaxis()->SetLabelFont(42); Graph_Graph1033->GetXaxis()->SetLabelSize(0.035); Graph_Graph1033->GetXaxis()->SetTitleSize(0.035); Graph_Graph1033->GetXaxis()->SetTitleFont(42); Graph_Graph1033->GetYaxis()->SetLabelFont(42); Graph_Graph1033->GetYaxis()->SetLabelSize(0.035); Graph_Graph1033->GetYaxis()->SetTitleSize(0.035); Graph_Graph1033->GetYaxis()->SetTitleFont(42); Graph_Graph1033->GetZaxis()->SetLabelFont(42); Graph_Graph1033->GetZaxis()->SetLabelSize(0.035); Graph_Graph1033->GetZaxis()->SetTitleSize(0.035); Graph_Graph1033->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1033); gre->Draw("p"); TLegend *leg = new TLegend(0.1,0.4,0.4,0.95,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextFont(72); leg->SetTextSize(0.015); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(0); leg->Draw(); TPaveText *pt = new TPaveText(0.3293574,0.9341608,0.6706426,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextFont(42); TText *AText = pt->AddText("alpha_MUON_ISO_SYS"); pt->Draw(); c1->Modified(); c1->cd(); c1->SetSelected(c1); }
void paraPull_alpha_EL_EFF_Iso_TotalCorrUncertainty_2TeV_2Lep_plots_All() { //=========Macro generated from canvas: c1/alpha_EL_EFF_Iso_TotalCorrUncertainty //========= (Sun Nov 22 20:14:54 2015) by ROOT version6.02/12 TCanvas *c1 = new TCanvas("c1", "alpha_EL_EFF_Iso_TotalCorrUncertainty",0,22,1000,600); gStyle->SetOptStat(0); c1->Range(-4.125,-0.9750892,37.125,1.047955); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetBorderSize(2); c1->SetGridx(); c1->SetGridy(); c1->SetFrameBorderMode(0); c1->SetFrameBorderMode(0); TH1F *NuisanceParameterFreed9 = new TH1F("NuisanceParameterFreed9","alpha_EL_EFF_Iso_TotalCorrUncertainty",33,0,33); NuisanceParameterFreed9->SetMinimum(-0.7727848); NuisanceParameterFreed9->SetMaximum(0.8456503); NuisanceParameterFreed9->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); NuisanceParameterFreed9->SetLineColor(ci); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(1,"XS_ttbar"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(2,"EG_SCALE_ALL"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(3,"FT_EFF_Eigen_C_0"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(4,"Luminosity"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(5,"XS_st"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(6,"FT_EFF_Eigen_B_1"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(7,"XS_Zc"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(8,"MUONS_ID"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(9,"FT_EFF_Eigen_C_1"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(10,"FT_EFF_Eigen_C_3"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(11,"MUON_EFF_TrigSystUncertainty"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(12,"XS_Zl"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(13,"EL_EFF_ID_TotalCorrUncertainty"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(14,"FT_EFF_Eigen_B_0"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(15,"FT_EFF_Eigen_B_2"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(16,"EL_EFF_Reco_TotalCorrUncertainty"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(17,"MUONS_SCALE"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(18,"MUON_ISO_STAT"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(19,"FT_EFF_extrapolation"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(20,"MUON_EFF_STAT"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(21,"MUON_EFF_SYS"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(22,"MUON_EFF_TrigStatUncertainty"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(23,"FT_EFF_Eigen_Light_1"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(24,"FT_EFF_Eigen_Light_2"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(25,"EG_RESOLUTION_ALL"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(26,"XS_diboson"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(27,"FT_EFF_Eigen_Light_4"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(28,"FT_EFF_Eigen_Light_3"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(29,"MUON_ISO_SYS"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(30,"XS_Zb"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(31,"MUONS_MS"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(32,"FT_EFF_Eigen_C_2"); NuisanceParameterFreed9->GetXaxis()->SetBinLabel(33,"FT_EFF_Eigen_Light_0"); NuisanceParameterFreed9->GetXaxis()->SetLabelFont(42); NuisanceParameterFreed9->GetXaxis()->SetLabelSize(0.035); NuisanceParameterFreed9->GetXaxis()->SetTitleSize(0.035); NuisanceParameterFreed9->GetXaxis()->SetTitleFont(42); NuisanceParameterFreed9->GetYaxis()->SetTitle("#theta_{fit} - #theta_{initial}/#Delta#theta"); NuisanceParameterFreed9->GetYaxis()->SetLabelFont(42); NuisanceParameterFreed9->GetYaxis()->SetLabelSize(0.035); NuisanceParameterFreed9->GetYaxis()->SetTitleSize(0.035); NuisanceParameterFreed9->GetYaxis()->SetTitleFont(42); NuisanceParameterFreed9->GetZaxis()->SetLabelFont(42); NuisanceParameterFreed9->GetZaxis()->SetLabelSize(0.035); NuisanceParameterFreed9->GetZaxis()->SetTitleSize(0.035); NuisanceParameterFreed9->GetZaxis()->SetTitleFont(42); NuisanceParameterFreed9->Draw("hist"); Double_t _fx1009[35] = { 1.22802e-312, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, 24.5, 25.5, 26.5, 27.5, 28.5, 29.5, 30.5, 31.5, 32.5, 0 }; Double_t _fy1009[35] = { 1.22802e-312, -0.7727848, -0.3922476, -0.2907829, -0.2050988, -0.1826652, -0.1278621, -0.1246447, -0.1083822, -0.06587814, -0.05693349, -0.05334209, -0.04676047, -0.03729371, -0.03207689, -0.03107143, -0.01702517, -0.001380258, 0.0001641211, 0.01041877, 0.01060027, 0.01810894, 0.01987367, 0.02024918, 0.02038876, 0.02749887, 0.0401174, 0.04268003, 0.04584905, 0.05094516, 0.05434531, 0.05598196, 0.05756905, 0.8456503, 0 }; Double_t _fex1009[35] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Double_t _fey1009[35] = { 0, 0, 0.6107702, 1.073131, 1.266362, 0.9365976, 0.9916527, 0.9863054, 0.9267238, 0.7691165, 0.9864524, 0.9937947, 0.9917419, 0.9970684, 0.9817834, 0.9376065, 0.9926703, 0.9925594, 1.005011, 0.9933467, 0.9551198, 0.9932276, 0.9929662, 0.9927806, 0.9913159, 0.9909915, 1.097968, 0.9870135, 0.9931711, 0.9930639, 0.9855126, 0.7540343, 0.738039, 0.9909039, 0.7858475 }; TGraphErrors *gre = new TGraphErrors(35,_fx1009,_fy1009,_fex1009,_fey1009); gre->SetName(""); gre->SetTitle(""); gre->SetFillColor(1); gre->SetMarkerStyle(20); gre->SetMarkerSize(1.2); TH1F *Graph_Graph1009 = new TH1F("Graph_Graph1009","",100,0,35.75); Graph_Graph1009->SetMinimum(-1.802262); Graph_Graph1009->SetMaximum(2.167356); Graph_Graph1009->SetDirectory(0); Graph_Graph1009->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1009->SetLineColor(ci); Graph_Graph1009->GetXaxis()->SetLabelFont(42); Graph_Graph1009->GetXaxis()->SetLabelSize(0.035); Graph_Graph1009->GetXaxis()->SetTitleSize(0.035); Graph_Graph1009->GetXaxis()->SetTitleFont(42); Graph_Graph1009->GetYaxis()->SetLabelFont(42); Graph_Graph1009->GetYaxis()->SetLabelSize(0.035); Graph_Graph1009->GetYaxis()->SetTitleSize(0.035); Graph_Graph1009->GetYaxis()->SetTitleFont(42); Graph_Graph1009->GetZaxis()->SetLabelFont(42); Graph_Graph1009->GetZaxis()->SetLabelSize(0.035); Graph_Graph1009->GetZaxis()->SetTitleSize(0.035); Graph_Graph1009->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1009); gre->Draw("p"); TLegend *leg = new TLegend(0.1,0.4,0.4,0.95,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextFont(72); leg->SetTextSize(0.015); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(0); leg->Draw(); TPaveText *pt = new TPaveText(0.2068675,0.9341608,0.7931325,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextFont(42); TText *AText = pt->AddText("alpha_EL_EFF_Iso_TotalCorrUncertainty"); pt->Draw(); c1->Modified(); c1->cd(); c1->SetSelected(c1); }
void v2ExpOpen_pt(bool bSavePlots = true, float rangeYAxis = 0.6, float rangeXAxis = 30, bool bDrawCh = true, const char* inputDir= "../macro_v2/outRoot", // the place where the input root files, with the histograms are const char* figNamePrefix="v2ExpOpen_pt") { gSystem->mkdir(Form("./figs/png"), kTRUE); gSystem->mkdir(Form("./figs/pdf"), kTRUE); setTDRStyle(); // gStyle->SetCanvasPreferGL(1); // read CMS graphs TFile *pfV2Cms_cent = new TFile(Form("%s/NPrp_v2_pt_plotter.root",inputDir)); TGraphAsymmErrors *pgV2Low = (TGraphAsymmErrors *)pfV2Cms_cent->Get("pgV2_low"); TGraphErrors *pgV2LowSyst = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_low_sys"); TGraphErrors *pgV2LowP = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_low_cont"); TGraphAsymmErrors *pgV2High = (TGraphAsymmErrors *)pfV2Cms_cent->Get("pgV2"); TGraphErrors *pgV2HighSyst = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_sys"); TGraphErrors *pgV2HighP = (TGraphErrors *)pfV2Cms_cent->Get("pgV2_cont"); pgV2Low->SetName("pgV2Low"); pgV2LowSyst->SetFillColorAlpha(kViolet-9,0.5); pgV2High->SetName("pgV2High"); pgV2HighSyst->SetFillColorAlpha(kOrange-9,0.5); // ----------------------------------------------------------------------------------------- // ----- charged hadrons TGraphErrors *gChar = new TGraphErrors(19, pTChar, v2Char, chxerr, v2CharSt); TGraphErrors *gChar2 = new TGraphErrors(19, pTChar, v2Char, chxerr, v2CharSt2); TGraphErrors *gCharSys = new TGraphErrors(19, pTChar, v2Char, chxerr2, v2CharSys); gChar->SetName("gChar"); gChar->SetMarkerStyle(20); gChar->SetMarkerColor(kTeal+3); gChar->SetLineColor(kTeal+3); gChar->SetMarkerSize(1.3); gChar2->SetMarkerStyle(24); gChar2->SetMarkerColor(kTeal+4); gChar2->SetLineColor(kTeal+4); gChar2->SetMarkerSize(1.3); gCharSys->SetFillColor(kTeal-9); //----------- D from ALICE TGraphErrors *pgAlice = new TGraphErrors(6, v2AliceX_pt, v2Alice_pt, v2AliceXl, v2AliceStat_pt); TGraphErrors *pgAliceSys = new TGraphErrors(6, v2AliceX_pt, v2Alice_pt, v2AliceXl, v2AliceSyst_pt); TGraphAsymmErrors *pgAliceSysB = new TGraphAsymmErrors(6, v2AliceX_pt, v2Alice_pt, v2AliceXl2, v2AliceXl2, v2AliceSystBLow_pt, v2AliceSystBHigh_pt); pgAlice->SetName("pgAlice"); pgAlice->SetMarkerStyle(kOpenSquare); pgAlice->SetMarkerColor(kGray+2); pgAlice->SetLineColor(kGray+2); pgAlice->SetMarkerSize(1.0); pgAliceSys->SetFillStyle(0); pgAliceSys->SetMarkerStyle(27); pgAliceSys->SetMarkerColor(kGray+2); pgAliceSys->SetLineColor(kGray+2); pgAliceSys->SetMarkerSize(1.7); pgAliceSysB->SetFillColor(kGray); // drawing //------------------------------------------------------------------------ // put everything on one plot TH1D *phAxis_v2 = new TH1D("phAxis_v2",";p_{T} (GeV/c);v_{2}",1,0,rangeXAxis); phAxis_v2->SetDirectory(0); phAxis_v2->GetXaxis()->CenterTitle(true); phAxis_v2->GetXaxis()->LabelsOption("h"); phAxis_v2->GetYaxis()->SetRangeUser(-0.01,rangeYAxis); phAxis_v2->GetYaxis()->SetTitleOffset(1.25); TCanvas *pcCombi = new TCanvas("pcCombi","pcCombi"); phAxis_v2->Draw(); CMS_lumi(pcCombi,12001000,0); pgAliceSysB->Draw("2"); pgAliceSys->Draw("2"); pgAlice->Draw("pz"); if (bDrawCh) { gCharSys->Draw("2"); gChar->Draw("pz"); gChar2->Draw("p"); } pgV2LowSyst->Draw("2"); pgV2Low->Draw("PZ"); pgV2LowP->Draw("P"); pgV2HighSyst->Draw("2"); pgV2High->Draw("PZ"); pgV2HighP->Draw("P"); // --------- legends ---- TLegend *leg = new TLegend(0.2,0.77,0.7,0.89,NULL,"brNDC"); // at top center leg->SetBorderSize(0); leg->SetTextFont(132); leg->SetTextSize(ltxSetTextSize3); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(19); leg->SetFillStyle(0); TLegendEntry *entry, *entry11; entry=leg->AddEntry("cmspr","Open beauty: nonprompt J/#psi",""); entry->SetTextSize(ltxSetTextSize3); entry=leg->AddEntry("pgV2Low", "1.6 < |y| < 2.4","p"); entry->SetTextFont(42); entry->SetTextSize(entrySize); entry=leg->AddEntry("pgV2High", "|y| < 2.4","P"); entry->SetTextFont(42); entry->SetTextSize(entrySize); //--------------------------- TLegend *leg1 = new TLegend(0.2,0.685,0.7,0.765,NULL,"brNDC"); leg1->SetBorderSize(0); leg1->SetTextFont(132); leg1->SetTextSize(ltxSetTextSize3); if (bDrawCh) { TLegendEntry *entry1; entry1=leg1->AddEntry("hpm","Charged hadron",""); entry1->SetTextFont(132); entry1->SetTextSize(ltxSetTextSize3); entry1=leg1->AddEntry("gChar","|#eta| < 0.8","P"); entry1->SetTextFont(42); entry1->SetTextSize(entrySize); } TLegend *leg_alice; if (bDrawCh) { leg_alice = new TLegend(0.2,0.60,0.7,0.68,NULL,"brNDC"); } else { leg_alice = new TLegend(0.2,0.685,0.7,0.765,NULL,"brNDC"); } leg_alice->SetBorderSize(0); leg_alice->SetTextFont(132); leg_alice->SetTextSize(ltxSetTextSize3); leg_alice->SetLineColor(1); leg_alice->SetLineStyle(1); leg_alice->SetLineWidth(1); leg_alice->SetFillColor(19); leg_alice->SetFillStyle(0); TLegendEntry *entry_alice=leg_alice->AddEntry("pgAlice","Open charm: prompt D (ALICE)",""); entry_alice=leg_alice->AddEntry("pgAlice","|y| < 0.8, Cent. 30-50\%","P"); entry_alice->SetTextFont(42); entry_alice->SetTextSize(entrySize); TLatex *lat = new TLatex(); lat->SetNDC(); lat->SetTextFont(42); lat->SetTextSize(ltxSetTextSize2); if (bDrawCh) lat->DrawLatex(0.63,0.52,"Cent. 10-60%"); else lat->DrawLatex(0.63,0.58,"Cent. 10-60%"); leg->Draw(); if (bDrawCh) leg1->Draw(); leg_alice->Draw(); gPad->RedrawAxis(); pcCombi->Update(); if(bSavePlots) { pcCombi->SaveAs(Form("figs/pdf/%s_RaaCh%d.pdf",figNamePrefix,bDrawCh)); pcCombi->SaveAs(Form("figs/png/%s_RaaCh%d.png",figNamePrefix,bDrawCh)); } return; }
chi7223pt_compare() { gROOT->Reset(); gROOT->SetStyle("MyStyle"); // gROOT->LoadMacro("v2pt_12cen_MyDef.C"); // gROOT->LoadMacro("MyDef.C"); gStyle->SetTextFont(43); gStyle->SetLabelFont(43,"x"); gStyle->SetLabelFont(43,"y"); gStyle->SetLabelFont(43,"z"); gStyle->SetTitleFont(43,"x"); gStyle->SetTitleFont(43,"y"); gStyle->SetTitleFont(43,"z"); gStyle->SetEndErrorSize(0); double textsize = 19; //int mcol[8]={kRed,kMagenta,kBlue,kCyan,kGreen,kYellow,kOrange,kGray}; int mcol[8]={kRed,kOrange+1,kBlue,kGreen+1,kCyan,kYellow,kOrange,kGray}; int mcol2[4]={6,2,4,8}; //int msty[8][2]={{20,20},{25,24},{22,22},{28,26},{29,30},{33,27},{34,28},{20,24}}; int msty[8][2]={{20,20},{21,24},{22,29},{23,30},{24,30},{25,27},{28,28},{30,24}}; //float msiz[8]={1.11,0.9,1.2,1.24,1.5,1,1,1}; float msiz[8]={1.11,1.0,1.5,1.2,1.2,1.2,1.2,1.6}; float msiz2[4]={1.5,1.5,1.5,1.5}; // // arrays // const int Mfiles=50; int ndp[Mfiles]; char *cfn[Mfiles]; char *cft[Mfiles]; const int Mpoints=40; double xa[Mfiles][Mpoints],xe[Mfiles][Mpoints]; double ya[Mfiles][Mpoints],ye[Mfiles][Mpoints]; double nxa[Mfiles][Mpoints],nxe[Mfiles][Mpoints]; double nya[Mfiles][Mpoints],nye[Mfiles][Mpoints]; double aexl[Mfiles][Mpoints],aexh[Mfiles][Mpoints]; double aeyl[Mfiles][Mpoints],aeyh[Mfiles][Mpoints]; double ra[Mfiles][Mpoints],re[Mfiles][Mpoints]; const int Mpads=14; char *htit[Mpads]; char *atit[Mpads][3]; double ptit[Mpads][2]; double hxmin[Mpads],hxmax[Mpads]; double hymin[Mpads],hymax[Mpads]; double lxmin[Mpads],lxmax[Mpads]; double lymin[Mpads],lymax[Mpads]; // // Data input // char *cjob="v2pt_12cen_4x3"; int i=-1; // histogram parameter htit[0]="0-5%"; htit[1]="5-10%"; htit[2]="10-15%"; htit[3]="15-20%"; htit[4]="20-25%"; htit[5]="25-30%"; htit[6]="30-35%"; htit[7]="35-40%"; htit[8]="40-50%"; htit[9]="50-60%"; htit[10]="60-70%"; htit[11]="70-80%"; for (int ip=0;ip<Mpads;ip++) { // hxmin[ip]=0.0; hxmax[ip]=11.9; hxmin[ip]=0.0001; hxmax[ip]=10.8; hymin[ip]=0.0001; hymax[ip]=100.099; lxmin[ip]=0.08; lxmax[ip]=0.35; lymin[ip]=0.4; lymax[ip]=0.65; ptit[ip][0]=5.0; ptit[ip][1]=80.08;// position legends atit[ip][0]="p_{T} (GeV/c)"; atit[ip][1]="#chi_{7}{#Psi_{223}}"; } // // Read data and create vector files // double tmp; const int nw=12; const int npt=16; ifstream inEP; inEP.open("../../tight/outchi7223_corrFlow.txt"); for(int i=0; i<nw; i++){ inEP>>tmp; inEP>>tmp; for(int j=0; j<npt+4; j++){ inEP>>tmp; inEP>>tmp; inEP>>xa[i][j]; inEP>>tmp; inEP>>ya[i][j]; inEP>>ye[i][j]; xe[i][j]=0.0; } } inEP.close(); ifstream inSP; inSP.open("../../loose/outchi7223_corrFlow.txt"); for(int i=0; i<nw; i++){ inSP>>tmp; inSP>>tmp; for(int j=0; j<npt+4; j++){ inSP>>tmp; inSP>>tmp; inSP>>nxa[i][j]; inSP>>tmp; inSP>>nya[i][j]; inSP>>nye[i][j]; nxe[i][j]=0.0; } } inSP.close(); for(int i=0; i<nw-1; i++){ cout<<"sys for cent: "<<i<<endl; for(int j=0; j<10; j++){ cout<<nxa[i][j]<<" "<<fabs(ya[i][j]-nya[i][j])/fabs(ya[i][j])<<" "<<fabs(ye[i][j])/fabs(ya[i][j])<<endl; } } TCanvas *can=new TCanvas("can","can",10,10,1050*0.9,800*0.85); can->Divide(4,3,0,0); //sticks the pads with no space inbetween TH1D *h1[nw]; for (int iw=0;iw<nw;iw++) { can->cd(iw+1); if(iw==3||iw==7||iw==11) gPad->SetRightMargin(0.02); char ch1[8]; sprintf(ch1,"h1_%d",iw); h1[iw] = new TH1D(ch1,"",500,hxmin[iw],hxmax[iw]); h1[iw]->SetMinimum(hymin[iw]); h1[iw]->SetMaximum(hymax[iw]); h1[iw]->SetXTitle(atit[iw][0]); h1[iw]->SetYTitle(atit[iw][1]); h1[iw]->GetXaxis()->CenterTitle(1); h1[iw]->GetYaxis()->CenterTitle(1); // futz with the axes h1[iw]->GetYaxis()->SetNdivisions(606); h1[iw]->GetXaxis()->SetNdivisions(606); h1[iw]->GetYaxis()->SetTitleSize(textsize); h1[iw]->GetYaxis()->SetTitleOffset(3.0); h1[iw]->GetYaxis()->SetLabelSize(textsize); h1[iw]->GetXaxis()->SetTitleSize(textsize); h1[iw]->GetXaxis()->SetTitleOffset(3.0); h1[iw]->GetXaxis()->SetLabelSize(textsize); // h1[iw]->GetXaxis()->SetLabelOffset(1.2); h1[iw]->Draw(); } // // Draw! // cout << "Now Draw!" << endl; TGraphErrors *ge; for (int iw=0;iw<nw;iw++) { can->cd(iw+1); // if (iw==0) { tex=new TLatex(1.5,80.08,"CMS PbPb #sqrt{s_{NN}}=2.76TeV"); tex->SetTextSize(textsize); //tex->Draw(); tex=new TLatex(1.5,70.07,"|#eta|<0.8"); tex->SetTextSize(textsize); tex->Draw(); } if (iw < 4) tex=new TLatex(ptit[iw][0]+2,70.07,htit[iw]); else tex=new TLatex(ptit[iw][0],ptit[iw][1],htit[iw]); if ( iw == 0) tex->SetTextSize(textsize); else if (iw == 8) tex->SetTextSize(textsize); else tex->SetTextSize(textsize); tex->Draw(); // // Legend // TLegend *leg = new TLegend(lxmin[iw],lymin[iw],lxmax[iw],lymax[iw]); leg->SetTextSize(textsize); // // Read data // for (int im=0;im<1;im++) { int j=im*12+iw; int col=1; //if (ndp[j]==0) continue; ge=new TGraphErrors(19,&xa[j][0],&ya[j][0],&xe[j][0],&ye[j][0]); ge->SetTitle(""); ge->SetMarkerStyle(msty[im][1]); // ge->SetMarkerStyle(msty[im]); ge->SetMarkerSize(msiz[im]); ge->SetMarkerColor(col); ge->SetLineWidth(1.2); ge->SetLineColor(col); ge->Draw("pe"); leg->AddEntry(ge,"#chi_{7223} (tight)","p"); } if (iw==1) leg->Draw(); for (int im=0;im<1;im++) { int j=im*12+iw; int col=2; //if (ndp[j]==0) continue; ge=new TGraphErrors(19,&nxa[j][0],&nya[j][0],&nxe[j][0],&nye[j][0]); ge->SetTitle(""); ge->SetMarkerStyle(25); // ge->SetMarkerStyle(msty[im]); ge->SetMarkerSize(msiz[im]); ge->SetMarkerColor(col); ge->SetLineWidth(1.2); ge->SetLineColor(col); ge->Draw("pe"); leg->AddEntry(ge,"#chi_{7223} (loose)","p"); } } cout << "end of process" << endl; can->cd(); can->Print("./figures/chi7223_pt_10cen_sysTrackCuts2760gev.png"); can->Print("./figures/chi7223_pt_10cen_sysTrackCuts2760gev.pdf"); }
void drawResults() { // Syst error: take the max difference double dataSystErrEB[nEtaBins][nPtBinsEB]; for (int ii=0; ii<nPtBinsEB; ii++ ) { if ( fabs(dataEB[0][ii]-dataSystSigEB[0][ii]) > fabs(dataEB[0][ii]-dataSystBackEB[0][ii]) ) dataSystErrEB[0][ii] = fabs(dataEB[0][ii]-dataSystSigEB[0][ii]); else dataSystErrEB[0][ii] = fabs(dataEB[0][ii]-dataSystBackEB[0][ii]); } double dataSystErrEE[nEtaBins][nPtBinsEE]; for (int ii=0; ii<nPtBinsEE; ii++ ) { if ( fabs(dataEE[0][ii]-dataSystSigEE[0][ii]) > fabs(dataEE[0][ii]-dataSystBackEE[0][ii]) ) dataSystErrEE[0][ii] = fabs(dataEE[0][ii]-dataSystSigEE[0][ii]); else dataSystErrEE[0][ii] = fabs(dataEE[0][ii]-dataSystBackEE[0][ii]); } // Tot error: stat + syst double dataErrEB[nEtaBins][nPtBinsEB]; double dataErrEE[nEtaBins][nPtBinsEE]; if (wantSyst) { cout << "systematics added" << endl; for (int ii=0; ii<nPtBinsEB; ii++ ) { dataErrEB[0][ii] = sqrt( dataSystErrEB[0][ii]*dataSystErrEB[0][ii] + dataErrStatEB[0][ii]*dataErrStatEB[0][ii] ); } for (int ii=0; ii<nPtBinsEE; ii++ ) { dataErrEE[0][ii] = sqrt( dataSystErrEE[0][ii]*dataSystErrEE[0][ii] + dataErrStatEE[0][ii]*dataErrStatEE[0][ii] ); } } else { cout << "only statistical error" << endl; for (int ii=0; ii<nPtBinsEB; ii++ ) { dataErrEB[0][ii] = dataErrStatEB[0][ii]; } for (int ii=0; ii<nPtBinsEE; ii++ ) { dataErrEE[0][ii] = dataErrStatEE[0][ii]; } } cout << "================================" << endl; cout << "EB" << endl; for (int ii=0; ii<nPtBinsEB; ii++ ) cout << ii << ", nominal = " << dataEB[0][ii] << ", forSigSyst = " << dataSystSigEB[0][ii] << ", forBkgSyst = " << dataSystBackEB[0][ii] << ", statErr = " << dataErrStatEB[0][ii] << ", systErr = " <<dataSystErrEB[0][ii] << endl; cout << "================================" << endl; cout << "EE" << endl; for (int ii=0; ii<nPtBinsEE; ii++ ) cout << ii << ", nominal = " << dataEE[0][ii] << ", forSigSyst = " << dataSystSigEE[0][ii] << ", forBkgSyst = " << dataSystBackEE[0][ii] << ", statErr = " << dataErrStatEE[0][ii] << ", systErr = " <<dataSystErrEE[0][ii] << endl; cout << "================================" << endl; // Scale factors and errors double sfEB[nEtaBins][nPtBinsEB]; double sfErrTotEB[nEtaBins][nPtBinsEB]; for (int iEta=0; iEta<nEtaBins; iEta++) { for (int iPt=0; iPt<nPtBinsEB; iPt++) { sfEB[iEta][iPt] = dataEB[iEta][iPt]/mcEB[iEta][iPt]; float sigmaDoDEB = dataErrEB[iEta][iPt]/dataEB[iEta][iPt]; float sigmaMCoMCEB = mcErrEB[iEta][iPt]/mcEB[iEta][iPt]; sfErrTotEB[iEta][iPt] = sfEB[iEta][iPt]*sqrt( (sigmaDoDEB*sigmaDoDEB) + (sigmaMCoMCEB*sigmaMCoMCEB) ); } } double sfEE[nEtaBins][nPtBinsEE]; double sfErrTotEE[nEtaBins][nPtBinsEE]; for (int iEta=0; iEta<nEtaBins; iEta++) { for (int iPt=0; iPt<nPtBinsEE; iPt++) { sfEE[iEta][iPt] = dataEE[iEta][iPt]/mcEE[iEta][iPt]; float sigmaDoDEE = dataErrEE[iEta][iPt]/dataEE[iEta][iPt]; float sigmaMCoMCEE = mcErrEE[iEta][iPt]/mcEE[iEta][iPt]; sfErrTotEE[iEta][iPt] = sfEE[iEta][iPt]*sqrt( (sigmaDoDEE*sigmaDoDEE) + (sigmaMCoMCEE*sigmaMCoMCEE) ); } } // Draw all canvases for(int ieta = 0; ieta<nEtaBins; ieta++) { TString cname = "sfEff_"; TCanvas *c1 = new TCanvas(cname, cname, 10,10,700,700); c1->SetFillColor(kWhite); c1->Draw(); TPad *pad1 = new TPad("main","",0, 0.3, 1.0, 1.0); pad1->SetTopMargin(0.20); pad1->SetBottomMargin(0.02); pad1->SetGrid(); TPad *pad2 = new TPad("ratio", "", 0, 0, 1.0, 0.3); pad2->SetTopMargin(0.05); pad2->SetBottomMargin(0.30); pad2->SetGrid(); pad1->Draw(); pad2->Draw(); // Create and fill arrays for graphs for this eta bin double *dataSliceEB = new double[nPtBinsEB]; double *dataSliceErrEB = new double[nPtBinsEB]; double *mcSliceEB = new double[nPtBinsEB]; double *mcSliceErrEB = new double[nPtBinsEB]; double *sfSliceEB = new double[nPtBinsEB]; double *sfSliceErrEB = new double[nPtBinsEB]; for(int ipt = 0; ipt<nPtBinsEB; ipt++) { dataSliceEB [ipt] = dataEB [ieta][ipt]; dataSliceErrEB[ipt] = dataErrEB [ieta][ipt]; mcSliceEB [ipt] = mcEB [ieta][ipt]; mcSliceErrEB [ipt] = mcErrEB [ieta][ipt]; sfSliceEB [ipt] = sfEB [ieta][ipt]; sfSliceErrEB [ipt] = sfErrTotEB [ieta][ipt]; } double *dataSliceEE = new double[nPtBinsEE]; double *dataSliceErrEE = new double[nPtBinsEE]; double *mcSliceEE = new double[nPtBinsEE]; double *mcSliceErrEE = new double[nPtBinsEE]; double *sfSliceEE = new double[nPtBinsEE]; double *sfSliceErrEE = new double[nPtBinsEE]; for(int ipt = 0; ipt<nPtBinsEE; ipt++) { dataSliceEE [ipt] = dataEE [ieta][ipt]; dataSliceErrEE[ipt] = dataErrEE [ieta][ipt]; mcSliceEE [ipt] = mcEE [ieta][ipt]; mcSliceErrEE [ipt] = mcErrEE [ieta][ipt]; sfSliceEE [ipt] = sfEE [ieta][ipt]; sfSliceErrEE [ipt] = sfErrTotEE [ieta][ipt]; } // Create and configure the graphs TGraphErrors *grDataEB = new TGraphErrors(nPtBinsEB, ptBinCentersEB, dataSliceEB, ptBinHalfWidthEB, dataSliceErrEB); TGraphErrors *grMcEB = new TGraphErrors(nPtBinsEB, ptBinCentersEB, mcSliceEB, ptBinHalfWidthEB, mcSliceErrEB); TGraphErrors *grSfEB = new TGraphErrors(nPtBinsEB, ptBinCentersEB, sfSliceEB, ptBinHalfWidthEB, sfSliceErrEB); TGraphErrors *grDataEE = new TGraphErrors(nPtBinsEE, ptBinCentersEE, dataSliceEE, ptBinHalfWidthEE, dataSliceErrEE); TGraphErrors *grMcEE = new TGraphErrors(nPtBinsEE, ptBinCentersEE, mcSliceEE, ptBinHalfWidthEE, mcSliceErrEE); TGraphErrors *grSfEE = new TGraphErrors(nPtBinsEE, ptBinCentersEE, sfSliceEE, ptBinHalfWidthEE, sfSliceErrEE); grDataEB->SetLineColor(kBlack); grDataEB->SetMarkerColor(kBlack); grDataEB->SetMarkerStyle(20); grDataEB->SetMarkerSize(1.); grDataEE->SetLineColor(kBlack); grDataEE->SetMarkerColor(kBlack); grDataEE->SetMarkerStyle(20); grDataEE->SetMarkerSize(1.); int ci = TColor::GetColor("#99ccff"); grMcEB->SetFillColor(kGreen-8); ci = TColor::GetColor("#3399ff"); grMcEB->SetLineColor(kGreen+4); grMcEB->SetMarkerStyle(22); grMcEB->SetMarkerColor(kGreen+4); grMcEB->SetMarkerSize(1.); ci = TColor::GetColor("#99ccff"); grMcEE->SetFillColor(kGreen-8); ci = TColor::GetColor("#3399ff"); grMcEE->SetLineColor(kGreen+4); grMcEE->SetMarkerStyle(22); grMcEE->SetMarkerColor(kGreen+4); grMcEE->SetMarkerSize(1.); ci = TColor::GetColor("#99ccff"); grSfEB->SetFillColor(kGreen-8); ci = TColor::GetColor("#3399ff"); grSfEB->SetLineColor(kGreen+4); grSfEB->SetMarkerStyle(20); grSfEB->SetMarkerColor(kGreen+4); grSfEB->SetMarkerSize(1.); ci = TColor::GetColor("#99ccff"); grSfEE->SetFillColor(kGreen-8); ci = TColor::GetColor("#3399ff"); grSfEE->SetLineColor(kGreen+4); grSfEE->SetMarkerStyle(20); grSfEE->SetMarkerColor(kGreen+4); grSfEE->SetMarkerSize(1.); // Create and configure the dummy histograms on which to draw the graphs TH2F *h1 = new TH2F("dummy1","", 100, 0, 500, 100, 0.6, 1.1); h1->GetYaxis()->SetTitle("Efficiency"); h1->SetStats(0); h1->GetXaxis()->SetLabelSize(0); h1->GetXaxis()->SetNdivisions(505); h1->GetXaxis()->SetDecimals(); h1->GetYaxis()->SetTitleOffset(0.8); h1->GetYaxis()->SetTitleSize(0.05); TH2F *h2 = new TH2F("dummy2","", 100, 0, 500, 100, 0.8, 1.2); h2->GetXaxis()->SetTitle("p_{T} [GeV]"); h2->GetYaxis()->SetTitle("Scale Factor"); h2->GetXaxis()->SetTitleOffset(1.0); h2->GetXaxis()->SetTitleSize(0.1); h2->GetYaxis()->SetTitleOffset(0.4); h2->GetYaxis()->SetTitleSize(0.1); h2->GetXaxis()->SetLabelSize(0.08); h2->GetYaxis()->SetLabelSize(0.08); h2->GetYaxis()->SetNdivisions(505); h2->GetYaxis()->SetDecimals(); h2->SetStats(0); TLegend *leg = new TLegend(0.65,0.1,0.9,0.25); leg->SetFillColor(kWhite); leg->SetFillStyle(0); leg->SetBorderSize(0); leg->AddEntry(grDataEB, "Data", "pl"); leg->AddEntry(grMcEB, "Simulation DY", "pFlE"); TLatex *latLumi = new TLatex(0, 1.15, lumiString); TLatex *latEtaEB = new TLatex(60.0, 0.5, etaLimitsStringArrayEB[ieta]); TLatex *latEtaEE = new TLatex(60.0, 0.5, etaLimitsStringArrayEE[ieta]); // -------------------------------------- // EB // Draw the efficiencies pad1->cd(); h1->Draw(); grMcEB ->Draw("2same"); grMcEB ->Draw("pZ,same"); grDataEB->Draw("PEZ,same"); leg->Draw("same"); latEtaEB->Draw("same"); latLumi->Draw("same"); // Draw the scale factors pad2->cd(); h2->Draw(); grSfEB ->Draw("2same"); grSfEB ->Draw("pEZ,same"); // Save into a file TString fname = cname; fname += "_EB.pdf"; c1->Print(fname); // -------------------------------------- // EE // Draw the efficiencies pad1->cd(); h1->Draw(); grMcEE ->Draw("2same"); grMcEE ->Draw("pZ,same"); grDataEE->Draw("PEZ,same"); leg->Draw("same"); latEtaEE->Draw("same"); latLumi->Draw("same"); // Draw the scale factors pad2->cd(); h2->Draw(); grSfEE ->Draw("2same"); grSfEE ->Draw("pEZ,same"); // Save into a file fname = cname; fname += "_EE.pdf"; c1->Print(fname); } }
void AnalyzeData(char *DataFile = "drs4_peds_5buffers.dat", Int_t nevt, Int_t startEv = 1, char *PedFile, Int_t DrawExtraGraphs = 0) { // Redefine DOMINO Depth in ADC counts const Float_t DominoDepthADC = pow(2, DOMINO_DEPTH); // open file FILE *fdata = OpenDataFile(DataFile); struct channel_struct *p; struct channel_struct *dep; // create histograms // create list of histograms for channels and distribution TList *DistChList = new TList(); TH1F *distch; // histo with distribution of cell-charge, for each channel TList *DistChSubList = new TList(); TH1F *distchsub; // histo with distribution of cell-charge, pedestals subtracted, for each channel TList *DistCh0SubList = new TList(); TH1F *distch0sub; // histo with distribution of cell-charge, pedestals subtracted, // channel 0 subtracted for each channel TList *grPedList = new TList(); TGraphErrors *grPed; // for each channel, pedestal value and RMS for each cell is plotted TList *hCellList = new TList(); TH1F *hCell; // charge distribution for each cell (DOMINO_NCELL x DOMINO_NCH histos) TList *hCellSubList = new TList(); TH1F *hCellSub; // charge distribution for each cell (DOMINO_NCELL x DOMINO_NCH histos), pedestal subtracted TList *hRMSList = new TList(); TH1F *hRMSdist; // histo with RMS distribution (statistical RMS of distribution) TList *hRMSFitList = new TList(); TH1F *hRMSFitdist; // histo with RMS distribution (RMS of Gaussian fit) TList *grDataList = new TList(); TGraphErrors *grData; // charge-cell and RMS for each cell is plotted TList *grDataSubList = new TList(); TGraphErrors *grDataSub; // pedestal subtracted charge-cell and RMS for each cell is plotted for (int h = 0; h < DOMINO_NCH; h++) { // TString title = "Data Dist channel"; title += h; distch = new TH1F(title, title, DominoDepthADC, 0., DominoDepthADC); DistChList->Add(distch); // TString title = "Data Dist Ped Sub channel"; title += h; distchsub = new TH1F(title, title, DominoDepthADC, -DominoDepthADC/2, DominoDepthADC/2); DistChSubList->Add(distchsub); // TString title = "Data Dist Ped Ch0 Sub channel"; title += h; distch0sub = new TH1F(title, title, DominoDepthADC, -DominoDepthADC/2, DominoDepthADC/2); DistCh0SubList->Add(distch0sub); // TString title = "Pedestal ch"; title += h; grPed = new TGraphErrors(DOMINO_NCELL); grPed->SetTitle(title); grPedList->Add(grPed); // TString title = "Data ch"; title += h; grData = new TGraphErrors(DOMINO_NCELL); grData->SetTitle(title); grDataList->Add(grData); // // Mean data and RMS for each channel and cell TString title = "Data PedSubtracted ch"; title += h; grDataSub = new TGraphErrors(DOMINO_NCELL); grDataSub->SetTitle(title); grDataSubList->Add(grDataSub); // for (int ch = 0; ch < DOMINO_NCELL; ch++) { // data distribution histos TString title = "Data ch"; title += h; title += " cell"; title += ch; hCell = new TH1F(title, title, DominoDepthADC, 0., DominoDepthADC); hCellList->Add(hCell); // data (ped subtracted) distribution histos TString title = "Data PedSub ch"; title += h; title += " cell "; title += ch; hCellSub = new TH1F(title, title, 2 * DominoDepthADC, -1 * DominoDepthADC, DominoDepthADC); hCellSubList->Add(hCellSub); } // Data-RMS distribution histos TString title = "RMSDist channel"; title += h; hRMSdist = new TH1F(title, title, 100, 0, 20.); hRMSList->Add(hRMSdist); // Data-RMS (calculated through a fit) distribution histos TString title = "RMSFitDist channel"; title += h; hRMSFitdist = new TH1F(title, title, 100, 0, 20.); hRMSFitList->Add(hRMSFitdist); } //-------------- // // calculate or read pedestals from file grPedList = OpenPedestals(PedFile); // return; // // ====== Read data file and subtract the pedestals // // Count number of events in data file int nevtDataMax = 0; while (!feof(fdata)) { fread((void *) &event_data, 1, sizeof(event_data), fdata); nevtDataMax++; } printf("nevtDataMax: %d\n", nevtDataMax); if (nevt > (nevtDataMax - startEv) || nevt == 0) nevt = nevtDataMax - startEv; cout << endl << "==>> Processing " << nevt << " events from file " << DataFile << endl; rewind(fdata); Int_t ievt = 1; // go to first event (startEv) while (ievt < startEv) { fread((void *) &event_data, 1, sizeof(event_data), fdata); if (feof(fdata)) break; ievt++; } // filling ievt = 1; Int_t flagEnd = 0; Double_t chtmp; Double_t PedVal, itmp, Ch0Val; // loop on events cout << endl << " --- read DATA file:" << fdata << endl; while (ievt <= nevt && !flagEnd) { fread((void *) &event_data, 1, sizeof(event_data), fdata); if (feof(fdata)) flagEnd = 1; if (ievt % (nevt / 10 + 1) == 0) cout << "*" << endl; p = (struct channel_struct *) &event_data.ch[0]; // read bunch of data dep = (struct channel_struct *) &event_data.ch[1]; // read bunch of data TGraphErrors *grCh0 = new TGraphErrors(DOMINO_NCELL); // loop on channels for (int h = 0; h < DOMINO_NCH; h++) { // loop on cells distch = (TH1F *) DistChList->At(h); distchsub = (TH1F *) DistChSubList->At(h); grPed = (TGraphErrors *) grPedList->At(h); distch0sub = (TH1F *) DistCh0SubList->At(h); if(h==0) { for(i = 0; i < DOMINO_NCELL;i++) { grPed->GetPoint(i, itmp, PedVal); chtmp = (Double_t)(p->data[i]); chtmp = chtmp - PedVal; grCh0->SetPoint(i,itmp, chtmp); } } for (int i = 0; i < DOMINO_NCELL; i++) { // Read pedestal value for this cell grPed->GetPoint(i, itmp, PedVal); grCh0->GetPoint(i, itmp, Ch0Val); // cout << itmp << ", " << PedVal << endl; // Read calibration correction for this cell // CalFact = //charge distribution for each cell, pedestal subtracted chtmp = (Double_t)(p->data[i]); // data value // cout << "tcell, tcell, depth: " << chtmp << "," << p->data[i] << "," << deptmp << endl; distch->Fill(chtmp); // Check data value: must be within DOMINO Depth // if(chtmp > DominoDepthADC) // cout << " === WARNING!!! Channel " << h << " Cell " << i << " has value " << chtmp << endl; // cout << "Charge: " << p->data[i] << endl; ((TH1 *) hCellList->At(h * DOMINO_NCELL + i))->Fill(chtmp); // Now the pedestal is subtracted chtmp = chtmp - PedVal; distchsub->Fill(chtmp); ((TH1 *) hCellSubList->At(h * DOMINO_NCELL + i))->Fill(chtmp); chtmp = chtmp - Ch0Val; distch0sub->Fill(chtmp); } p++; // next channel } ievt++; // next event } cout << endl; // now mean and RMS for each cell are computed and save in histos and graphs cout << " --- filling data histos and grphs " << endl; TF1 *fgauss = new TF1("fgauss", Gauss, -10., 10., 3); fgauss->SetParLimits(0, 0.1, 10000.); fgauss->SetParLimits(1, 0., 4096.); fgauss->SetParLimits(2, 0.1, 20.); Float_t mean, rms, meansub, rmssub; for (int h = 0; h < DOMINO_NCH; h++) { // for (int h=5; h<6; h++){ cout << " Channel:" << h << endl; hRMSdist = (TH1F *) hRMSList->At(h); hRMSFitdist = (TH1F *) hRMSFitList->At(h); grData = (TGraphErrors *) grDataList->At(h); grDataSub = (TGraphErrors *) grDataSubList->At(h); for (int ch = 0; ch < DOMINO_NCELL; ch++) { // data distribution histos // cout << "cell:" << ch << " index:" << h*DOMINO_NCELL+ch << " Mean,RMS:"<<hCell->GetMean()<< "," << hCell->GetRMS()<<endl; hCell = (TH1F *) hCellList->At(h * DOMINO_NCELL + ch); mean = hCell->GetMean(); rms = hCell->GetRMS(); hCellSub = (TH1F *) hCellSubList->At(h * DOMINO_NCELL + ch); meansub = hCellSub->GetMean(); rmssub = hCellSub->GetRMS(); fgauss->SetParameter(0, (Double_t) nevt / 4.); fgauss->SetParameter(1, mean); fgauss->SetParameter(2, rms); // hCell->Fit("fgauss","QN0"); grData->SetPoint(ch, ch, mean); grData->SetPointError(ch, 0, rms); grDataSub->SetPoint(ch, ch, meansub); // grDataSub->SetPointError(ch,0.5,rmssub); grDataSub->SetPointError(ch, 0.5, 2.1); hRMSdist->Fill(rms); hRMSFitdist->Fill(fgauss->GetParameter(2)); // cout << "cell:" << ch << " index:" << h*DOMINO_NCELL+ch << " Mean,RMS:"<< mean << "," << rms<<endl; } } Double_t x, y, chtmp, x1, x2, y1, y2; /*TList *grCellCalibList = OpenCalibFile("CalibrationData1000events.root"); TGraphErrors *grCellCalib; TGraphErrors *grDataSubCalib = new TGraphErrors(DOMINO_NCELL); grDataSubCalib->SetTitle("Data after calibration correction"); grDataSub = (TGraphErrors *) grDataSubList->At(anaChannel); for(ch = 0; ch < DOMINO_NCELL; ch++) { grCellCalib = ((TGraphErrors *) grCellCalibList->At(ch)); grCellCalib->Fit("pol3", "Q"); TF1 *pol3fit = ((TF1 *) grCellCalib->GetFunction("pol3")); grDataSub->GetPoint(ch, x, y); chtmp = y - (Double_t)(pol3fit->Eval(y/3.25)); grDataSubCalib->SetPoint(ch, x, chtmp); } TCanvas *cGrTest = new TCanvas("grTest", "test per vedere i dati", 1000,1000); grDataSubCalib->Draw("APEL");*/ TString Title = "Charge Distribution per channel"; gStyle->SetOptFit(111); TCanvas *cdistch = new TCanvas("cdistch", Title, 1000, 1000); cdistch->Divide(3, 3); for (int i = 0; i < DOMINO_NCH; i++) { cdistch->cd(i + 1); TH1 *dhist = (TH1 *) DistChList->At(i); dhist->DrawCopy(); dhist->SetLineWidth(1); dhist->Fit("gaus", "Q"); dhist->GetFunction("gaus")->SetLineColor(4); dhist->GetFunction("gaus")->SetLineWidth(2); } TString Title = "Charge Distribution Pedestals Subtracted per channel"; TCanvas *cdistchsub = new TCanvas("cdistchsub", Title, 1000, 1000); cdistchsub->Divide(3, 3); for (int i = 0; i < DOMINO_NCH; i++) { cdistchsub->cd(i + 1); TH1 *dsubhist = (TH1 *) DistChSubList->At(i); dsubhist->DrawCopy(); dsubhist->SetLineWidth(1); dsubhist->Fit("gaus", "Q"); dsubhist->GetFunction("gaus")->SetLineColor(4); dsubhist->GetFunction("gaus")->SetLineWidth(2); } TString Title = "Charge Distribution Pedestals and Ch0 Subtracted per channel"; TCanvas *cdistch0sub = new TCanvas("cdistch0sub", Title, 1000, 1000); cdistch0sub->Divide(3, 3); for (int i = 0; i < DOMINO_NCH; i++) { cdistch0sub->cd(i + 1); TH1 *dch0subhist = (TH1 *) DistCh0SubList->At(i); dch0subhist->DrawCopy(); dch0subhist->SetLineWidth(1); dch0subhist->Fit("gaus", "Q"); dch0subhist->GetFunction("gaus")->SetLineColor(4); dch0subhist->GetFunction("gaus")->SetLineWidth(2); } TCanvas *cDataSubTest = new TCanvas("cDataSubTest", "Data after pedestal subtraction", 1000, 1000); cDataSubTest->Divide(1,8); for (h = 0; h< DOMINO_NCH; h++) { grDataSub = (TGraphErrors *) grDataSubList->At(h); cDataSubTest->cd(h+1); grDataSub->GetYaxis()->SetLabelSize(0.06); grDataSub->GetXaxis()->SetLabelSize(0.06); grDataSub->Draw("APE"); } TCanvas *cDataSubTestCh5 = new TCanvas("cDataSubTestCh5", "Data after pedestal subtraction Ch5", 1200, 800); grDataSub = (TGraphErrors *) grDataSubList->At(anaChannel); grDataSub->GetYaxis()->SetLabelSize(0.06); grDataSub->GetYaxis()->SetTitle("ADC Counts"); grDataSub->GetXaxis()->SetTitle("Cell"); grDataSub->GetXaxis()->SetLabelSize(0.06); TLine *refval = new TLine(0,350,1024,350); refval->SetLineWidth(3); refval->SetLineStyle(2); refval->SetLineColor(2); TLine *i1 = new TLine(121,-50,121,800); i1->SetLineStyle(2); TLine *i2 = new TLine(291,-50,291,800); i2->SetLineStyle(2); TLine *i3 = new TLine(461,-50,461,800); i3->SetLineStyle(2); TLine *i4 = new TLine(632,-50,632,800); i4->SetLineStyle(2); TLine *i5 = new TLine(803,-50,803,800); i5->SetLineStyle(2); TLine *i6 = new TLine(975,-50,975,800); i6->SetLineStyle(2); TLine *ireal1 = new TLine(121+20,600,121+20,800); ireal1->SetLineWidth(3); ireal1->SetLineColor(4); TLine *ireal2 = new TLine(291-20,600,291-20,800); ireal2->SetLineWidth(3); ireal2->SetLineColor(4); TLine *ireal3 = new TLine(461+20,600,461+20,800); ireal3->SetLineWidth(3); ireal3->SetLineColor(4); TLine *ireal4 = new TLine(632-20,600,632-20,800); ireal4->SetLineWidth(3); ireal4->SetLineColor(4); TLine *ireal5 = new TLine(803+20,600,803+20,800); ireal5->SetLineWidth(3); ireal5->SetLineColor(4); TLine *ireal6 = new TLine(975-20,600,975-20,800); ireal6->SetLineWidth(3); ireal6->SetLineColor(4); grDataSub->Draw("APE"); refval->Draw("SAME"); i1->Draw("SAME"); i2->Draw("SAME"); i3->Draw("SAME"); i4->Draw("SAME"); i5->Draw("SAME"); i6->Draw("SAME"); ireal1->Draw("SAME"); ireal2->Draw("SAME"); ireal3->Draw("SAME"); ireal4->Draw("SAME"); ireal5->Draw("SAME"); ireal6->Draw("SAME"); TCanvas *cDataTest = new TCanvas("cDataTest", "Raw Data", 1000,1000); cDataTest->Divide(1,8); for(h = 0; h < DOMINO_NCH; h++) { cDataTest->cd(h+1); grData = (TGraphErrors *) grDataList->At(h); grData->SetMarkerStyle(20); grData->SetMarkerSize(0.5); grData->Draw("APE"); } // save root file with graph containing channel 5 data after pedestals subtraction. /* cout << "test" << endl; TString OutFile = DataSubFile; TFile *f = new TFile(OutFile,"RECREATE"); int h = anaChannel; TString key="DataSubGraph"; key += h; ((TGraphErrors*)grDataSubList->At(h))->Write(key); f->Close(); cout << " ---- Write data on file " << endl; */ // =======================================================// // =====================Matteo's Code=====================// // =======================================================// /* Int_t cht, incCht, decCht, xflag, nPeriods, iMax, iMin; Double_t xdiff, incDiff, decDiff, incDiffTemp, decDiffTemp, incXDiff, decXDiff; Double_t fitMax, fitMin, fitPeriod, chisquare; Double_t DominoXval[DOMINO_NCELL]; Double_t DominoYval[DOMINO_NCELL]; Double_t FitXval[DOMINO_NCELL]; Double_t FitYval[DOMINO_NCELL]; // opens grDataSub.root TString FileName = DataSubFile; TGraphErrors *grDataSub; int h = anaChannel; TFile *f = new TFile(FileName); TString key = "DataSubGraph"; key += h; grDataSub = (TGraphErrors *) f->Get(key); f->Close(); // Create a new graph with channel 5 data TGraphErrors *grDataSubAnaCh; int h = anaChannel; grDataSubAnaCh = (TGraphErrors *) grDataSubList->At(h); TGraphErrors *grDataSubFix = grDataSubAnaCh->Clone(); TGraphErrors *grRes = new TGraphErrors(DOMINO_NCELL); TList *grResPeriodList = new TList(); Double_t xtemp, ytemp, DominoMax, DominoMin; for (int ch = 0; ch < DOMINO_NCELL; ch++){ // get domino-output point and save in array grDataSubAnaCh->GetPoint(ch, DominoXval[ch], DominoYval[ch]); } // find the domino point with max y-value iMax = 0; for(int ch = 0; ch < DOMINO_NCELL; ch++) { if(DominoYval[ch] > DominoYval[iMax]) { DominoMax = DominoYval[ch]; iMax = ch; } } cout << "DominoMax e': " << DominoMax << endl; // find the domino point with min y-value iMin = 0; for (int ch = 0; ch < DOMINO_NCELL; ch++) { if(DominoYval[ch] < DominoYval[iMin]) { DominoMin = DominoYval[ch]; iMin = ch; } } cout << "DominoMin e': " << DominoMin << endl; // remove points from the graph that will be used for fit for (int ch = 0; ch < DOMINO_NCELL; ch++){ grDataSubFix->GetPoint(ch, xtemp, ytemp); if(ytemp > 0.8*DominoMax || ytemp < 0.2*DominoMin) grDataSubFix->RemovePoint(ch); } TF1 *fsin = new TF1("fsin", sigSin, 0., 1024., 4); fsin->SetParameters(600., DOMINO_NCELL / 4., 150., 150.); fsin->SetParNames("amplitude", "Period", "Phase", "DC-Offset"); grDataSubFix->Fit("fsin"); TF1 *fsinFit = grDataSubFix->GetFunction("fsin"); fsinFit->SetParNames("amplitude", "Period", "Phase", "DC-Offset"); chisquare = grDataSub->Chisquare(fsinFit); cout << "il chi quadro della funzione di fit e' : " << chisquare << endl; for (int ch = 0; ch < DOMINO_NCELL; ch++) { // get Fit-value and save in array FitXval[ch] = DominoXval[ch]; FitYval[ch] = fsinFit->Eval(FitXval[ch]); } fitPeriod = fsinFit->GetParameter("Period"); cout << "il periodo della funzione e': " << fitPeriod << endl; nPeriods = (Int_t) (DOMINO_NCELL/fitPeriod); cout << "il numero di periodi della funzione e': " << nPeriods << endl; fitMax = fsinFit->GetMaximum(); cout << "il massimo della funzione e': " << fitMax << endl; fitMin = fsinFit->GetMinimum(); cout << "il minimo della funzione e': " << fitMin << endl; // computes the y difference between the ch-domino point and the i-fit point // and stops when the difference changes sign // // first and last points are not included in the cicle // // if the fit point y-value is bigger or smaller than the fit function max*0.8 or min*0.2 // the point is removed for (int ch = 1; ch < DOMINO_NCELL - 1; ch++) { if(FitYval[ch] > 0.8*fitMax || FitYval[ch] < 0.2*fitMin) { grRes->RemovePoint(ch); continue; } incDiff = DominoYval[ch] - FitYval[ch]; incDiffTemp = DominoYval[ch] - FitYval[ch + 1]; decDiff = DominoYval[ch] - FitYval[ch]; decDiffTemp = DominoYval[ch] - FitYval[ch - 1]; if(abs(incDiffTemp) < abs(incDiff) || (sign(incDiff) != sign(incDiffTemp) && abs(decDiffTemp) > abs(decDiff))) { for (int i = ch; i < DOMINO_NCELL; i++, incDiff = incDiffTemp) { incDiffTemp = DominoYval[ch] - FitYval[i]; if (sign(incDiff) != sign(incDiffTemp)) { if(abs(incDiffTemp) < abs(incDiff)) incCht = i; else incCht = i - 1; break; } } xflag = 1; } else if(abs(decDiffTemp) < abs(decDiff) || (sign(decDiff) != sign(decDiffTemp) && abs(incDiffTemp) > abs(incDiff))) { for (int j = ch; j >= 0 ; j--, decDiff = decDiffTemp) { decDiffTemp = DominoYval[ch] - FitYval[j]; if (sign(decDiff) != sign(decDiffTemp)) { if(abs(decDiffTemp) < abs(decDiff)) decCht = j; else decCht = j + 1; break; } } xflag = -1; } if(xflag == 1) xdiff = FitXval[incCht] - DominoXval[ch]; else xdiff = FitXval[decCht] - DominoXval[ch]; grRes->SetPoint(ch, (Double_t) ch, xdiff); } cout << "Draw Time Residuals" << endl; TString Title = "Time Residuals"; TCanvas *timeres = new TCanvas("timeres", Title, 1200, 780); grRes->SetMarkerStyle(20); grRes->SetMarkerSize(0.3); grRes->GetYaxis()->SetLabelSize(0.12); grRes->GetXaxis()->SetLabelSize(0.12); grRes->Draw("APE"); // The previous graph is now split in N graphs, where N is the number of fit periods // this will be needed to set the function phase // // iMax = 0; // // for(ch = 0; ch < fitPeriod - 1; ch++) { // if(FitYval[ch] > FitYval[iMax]) iMax = ch; // } cout << "il primo massimo ha l'indice : " << iMax << endl; for (i = 0; i < nPeriods; i++) { TGraphErrors *grResPeriod = new TGraphErrors((Int_t) fitPeriod); grResPeriodList->Add(grResPeriod); for(ch = i*fitPeriod + 1; ch < fitPeriod + (i*fitPeriod); ch++) { if(FitYval[ch] > 0.8*fitMax || FitYval[ch] < 0.2*fitMin) { grResPeriod->RemovePoint(ch); continue; } incDiff = DominoYval[ch] - FitYval[ch]; incDiffTemp = DominoYval[ch] - FitYval[ch + 1]; decDiff = DominoYval[ch] - FitYval[ch]; decDiffTemp = DominoYval[ch] - FitYval[ch - 1]; if(abs(incDiffTemp) < abs(incDiff) || (sign(incDiff) != sign(incDiffTemp) && abs(decDiffTemp) > abs(decDiff))) { for (int k = ch; k < k*fitPeriod + fitPeriod; k++, incDiff = incDiffTemp) { incDiffTemp = DominoYval[ch] - FitYval[k]; if (sign(incDiff) != sign(incDiffTemp)) { if(abs(incDiffTemp) < abs(incDiff)) incCht = k; else incCht = k - 1; break; } } xflag = 1; } else if(abs(decDiffTemp) < abs(decDiff) || (sign(decDiff) != sign(decDiffTemp) && abs(incDiffTemp) > abs(incDiff))) { for (int j = ch; j > i*fitPeriod; j--, decDiff = decDiffTemp) { decDiffTemp = DominoYval[ch] - FitYval[j]; if (sign(decDiff) != sign(decDiffTemp)) { if(abs(decDiffTemp) < abs(decDiff)) decCht = j; else decCht = j + 1; break; } } xflag = -1; } if(xflag == 1) xdiff = FitXval[incCht] - DominoXval[ch]; else xdiff = FitXval[decCht] - DominoXval[ch]; grResPeriod->SetPoint(ch - i*fitPeriod, (Double_t) (ch - i*fitPeriod), xdiff); } } TCanvas *timeresperiod = new TCanvas("timeresperiod", "Time Residuals Period", 1200, 780); for(i = 0; i < nPeriods; i++) { grResPeriod = ((TGraphErrors *) grResPeriodList->At(i)); grResPeriod->SetMarkerStyle(20); grResPeriod->SetMarkerSize(0.3); grResPeriod->GetYaxis()->SetLabelSize(0.12); grResPeriod->GetXaxis()->SetLabelSize(0.12); grResPeriod->Draw("APEsame"); } cout << "Draw Data - Pedestals Subtracted" << endl; TString Title = "Average Charge - Pedestal subtracted"; TCanvas *csubdata = new TCanvas("csubdata", Title, 1200, 780); grDataSubAnaCh->SetMarkerStyle(20); grDataSubAnaCh->SetMarkerSize(0.3); grDataSubAnaCh->GetYaxis()->SetLabelSize(0.12); grDataSubAnaCh->GetXaxis()->SetLabelSize(0.12); grDataSubAnaCh->Draw("APE"); fsinFit->Draw("same"); */ // draw extra graphs if (DrawExtraGraphs == 1) { cout << " ----- DRAW Results ------" << endl; //================ DRAW Results ================== TCanvas *c = new TCanvas("ctmp", "test", 800, 800); c->Divide(3, 3); for (int pad = 1; pad < 10; pad++) { c->cd(pad); ((TH1 *) hCellList->At(pad * 512 + 219))->DrawCopy(); hCellSub = (TH1F *) hCellSubList->At(pad * 512 + 219); hCellSub->SetLineColor(2); hCellSub->DrawCopy("same"); } cout << "Draw RMS distributions" << endl; TString Title = "RMS distributions per channel"; TCanvas *c4 = new TCanvas("c4", Title, 700, 700); c4->Divide(3, 3); for (int i = 0; i < DOMINO_NCH; i++) { c4->cd(i + 2); hRMSdist = (TH1F *) hRMSList->At(i); hRMSFitdist = (TH1F *) hRMSFitList->At(i); hRMSFitdist->SetLineColor(2); hRMSFitdist->DrawCopy(); hRMSdist->DrawCopy("same"); } TList *grDataCh0SubList = new TList(); TGraphErrors *grDataCh0Sub; for(h = 0; h< DOMINO_NCELL; h++) { grDataCh0Sub = new TGraphErrors(DOMINO_NCELL); grDataCh0SubList->Add(grDataCh0Sub); } TGraphErrors *grDataSubCh0 = (TGraphErrors *) grDataSubList->At(6); for(h = 0; h < DOMINO_NCH; h++) { grDataSub = (TGraphErrors *) grDataSubList->At(h); grDataCh0Sub = (TGraphErrors *) grDataCh0SubList->At(h); for(ch = 0; ch < DOMINO_NCELL; ch++) { grDataSubCh0->GetPoint(ch, x1, y1); grDataSub->GetPoint(ch, x2, y2); grDataCh0Sub->SetPoint(ch, x1 , y2 - y1); } } TCanvas *cDataCH0Sub = new TCanvas("cDataCH0Sub","cDataCH0Sub", 1000,1000); cDataCH0Sub->Divide(1,8); for(h = 0; h < DOMINO_NCH; h++) { cDataCH0Sub->cd(h+1); grDataCh0Sub = (TGraphErrors *) grDataCh0SubList->At(h); grDataCh0Sub->GetYaxis()->SetLabelSize(0.12); grDataCh0Sub->GetXaxis()->SetLabelSize(0.12); grDataCh0Sub->Draw("APEL"); } cout << "Draw Data - Pedestals Subtracted" << endl; TString Title = "Average Charge - Pedestal subtracted"; TCanvas *csubdata = new TCanvas("csubdata", Title, 1000, 1000); csubdata->Divide(3,3); for(h = 0; h < DOMINO_NCH; h++) { csubdata->cd(h+1); TString title = "DataSub channel "; title += h; TH1F *hCellDataSub = new TH1F(title, title, 100, -20, 20); grDataSub = (TGraphErrors *) grDataSubList->At(h); for(ch = 0; ch < DOMINO_NCELL; ch++) { grDataSub->GetPoint(ch, x, y); hCellDataSub->Fill(y); } hCellDataSub->Fit("gaus", "Q"); hCellDataSub->GetXaxis()->SetTitle("ADC Counts"); hCellDataSub->GetFunction("gaus")->SetLineColor(4); hCellDataSub->DrawCopy(); } cout << "breakpoint" << endl; TCanvas *csubdata2 = new TCanvas("csubdata2", "DataSub for every channel", 1000, 1000); TString title = "DataSub every channel "; TH1F *hCellChDataSubTot = new TH1F(title, title, 100, -20, 20); for(h = 0; h < DOMINO_NCH; h++) { grDataSub = (TGraphErrors *) grDataSubList->At(h); for(ch = 0; ch < DOMINO_NCELL; ch++) { grDataSub->GetPoint(ch, x, y); hCellChDataSubTot->Fill(y); } hCellChDataSubTot->Fit("gaus", "Q"); hCellChDataSubTot->GetXaxis()->SetTitle("ADC Counts"); hCellChDataSubTot->GetFunction("gaus")->SetLineColor(4); hCellChDataSubTot->Draw(); } cout << "Draw Pedestals" << endl; TString Title = "Pedestals"; TCanvas *c2 = new TCanvas("c2", Title, 1050, 780); c2->SetBorderMode(0); c2->SetBorderSize(0.); c2->Divide(1, 8); // gStyle->SetCanvasBorderMode(0.); // gStyle->SetCanvasBorderSize(0.); Double_t x, y; for (int h = 0; h < DOMINO_NCH; h++) { c2->cd(h + 1); grPed = ((TGraphErrors *) grPedList->At(h)); grPed->SetMarkerStyle(20); grPed->SetMarkerSize(0.5); grPed->GetYaxis()->SetLabelSize(0.12); grPed->GetXaxis()->SetLabelSize(0.12); // cout << " err:" << grPed->GetErrorY(102) << " " ; // cout << x << "--" << y << endl; grPed->Draw("APE"); } cout << "Draw Data - Average charge" << endl; TString Title = "Average_Charge"; TCanvas *cdata = new TCanvas("cdata", Title, 1050, 780); cdata->Divide(1, 8); Double_t x, y; for (int h = 0; h < DOMINO_NCH; h++) { cdata->cd(h + 1); grData = ((TGraphErrors *) grDataList->At(h)); grData->SetMarkerStyle(20); grData->SetMarkerSize(0.3); grData->GetYaxis()->SetLabelSize(0.12); grData->GetXaxis()->SetLabelSize(0.12); grData->GetPoint(10, x, y); // cout << x << "-" << y << endl; grData->Draw("APE"); } cout << "Draw Data - Pedestals Subtracted" << endl; TString Title = "Average Charge - Pedestal subtracted"; TCanvas *csubdata = new TCanvas("csubdata", Title, 1200, 780); csubdata->Divide(1, 8); TF1 *fsin = new TF1("fsin", sigSin, 0., 1024., 4); TH1D *resDist = new TH1D("resDist", "Residuals Signal", 100, -100., 100.); cout << "Draw Data - Pedestals Subtracted" << endl; TString Title = "Residuals"; TCanvas *residuals = new TCanvas("residuals", Title, 1200, 780); resDist->DrawCopy(); } fclose(fdata); hCellList->Delete(); hCellSubList->Delete(); hRMSList->Delete(); hRMSFitList->Delete(); }
void acceptance_mass() { //=========Macro generated from canvas: c2/c2 //========= (Mon Oct 26 11:11:00 2015) by ROOT version6.02/05 TCanvas *c2 = new TCanvas("c2", "c2",20,42,700,500); gStyle->SetOptStat(0); c2->Range(-1.3125,-0.025,9.8125,0.225); c2->SetFillColor(0); c2->SetBorderMode(0); c2->SetBorderSize(2); c2->SetFrameBorderMode(0); c2->SetFrameBorderMode(0); TH2F *dummy42 = new TH2F("dummy42","dummy4",178,-0.2,8.7,100,0,0.2); dummy42->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); dummy42->SetLineColor(ci); dummy42->GetXaxis()->SetTitle("Mass [GeV]"); dummy42->GetXaxis()->SetLabelFont(42); dummy42->GetXaxis()->SetLabelSize(0.035); dummy42->GetXaxis()->SetTitleSize(0.035); dummy42->GetXaxis()->SetTitleFont(42); dummy42->GetYaxis()->SetTitle("#epsilon_{rec} = N_{rec}/N_{tot}"); dummy42->GetYaxis()->SetLabelFont(42); dummy42->GetYaxis()->SetLabelSize(0.035); dummy42->GetYaxis()->SetTitleSize(0.035); dummy42->GetYaxis()->SetTitleFont(42); dummy42->GetZaxis()->SetLabelFont(42); dummy42->GetZaxis()->SetLabelSize(0.035); dummy42->GetZaxis()->SetTitleSize(0.035); dummy42->GetZaxis()->SetTitleFont(42); dummy42->Draw(""); Double_t Graph0_fx1006[5] = { 0.25, 0.275, 0.3, 2, 8.5}; Double_t Graph0_fy1006[5] = { 0.0865404, 0.08208333, 0.0749858, 0.05958333, 0.1375897}; Double_t Graph0_fex1006[5] = { 0, 0, 0, 0, 0}; Double_t Graph0_fey1006[5] = { 0.0009990599, 0.0009753636, 0.0009926071, 0.0008541653, 0.001244048}; TGraphErrors *gre = new TGraphErrors(5,Graph0_fx1006,Graph0_fy1006,Graph0_fex1006,Graph0_fey1006); gre->SetName("Graph0"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1006 = new TH1F("Graph_Graph1006","Graph",100,0,9.325); Graph_Graph1006->SetMinimum(0.05071871); Graph_Graph1006->SetMaximum(0.1468442); Graph_Graph1006->SetDirectory(0); Graph_Graph1006->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1006->SetLineColor(ci); Graph_Graph1006->GetXaxis()->SetLabelFont(42); Graph_Graph1006->GetXaxis()->SetLabelSize(0.035); Graph_Graph1006->GetXaxis()->SetTitleSize(0.035); Graph_Graph1006->GetXaxis()->SetTitleFont(42); Graph_Graph1006->GetYaxis()->SetLabelFont(42); Graph_Graph1006->GetYaxis()->SetLabelSize(0.035); Graph_Graph1006->GetYaxis()->SetTitleSize(0.035); Graph_Graph1006->GetYaxis()->SetTitleFont(42); Graph_Graph1006->GetZaxis()->SetLabelFont(42); Graph_Graph1006->GetZaxis()->SetLabelSize(0.035); Graph_Graph1006->GetZaxis()->SetTitleSize(0.035); Graph_Graph1006->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1006); gre->Draw(" pl"); Double_t Graph1_fx1007[4] = { 0.25, 0.275, 2, 8.5}; Double_t Graph1_fy1007[4] = { 0.08294682, 0.07862374, 0.06207908, 0.137474}; Double_t Graph1_fex1007[4] = { 0, 0, 0, 0}; Double_t Graph1_fey1007[4] = { 0.0009899688, 0.000956385, 0.0008617826, 0.001242555}; gre = new TGraphErrors(4,Graph1_fx1007,Graph1_fy1007,Graph1_fex1007,Graph1_fey1007); gre->SetName("Graph1"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(2); gre->SetMarkerColor(2); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1007 = new TH1F("Graph_Graph1007","Graph",100,0,9.325); Graph_Graph1007->SetMinimum(0.05346738); Graph_Graph1007->SetMaximum(0.1464664); Graph_Graph1007->SetDirectory(0); Graph_Graph1007->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1007->SetLineColor(ci); Graph_Graph1007->GetXaxis()->SetLabelFont(42); Graph_Graph1007->GetXaxis()->SetLabelSize(0.035); Graph_Graph1007->GetXaxis()->SetTitleSize(0.035); Graph_Graph1007->GetXaxis()->SetTitleFont(42); Graph_Graph1007->GetYaxis()->SetLabelFont(42); Graph_Graph1007->GetYaxis()->SetLabelSize(0.035); Graph_Graph1007->GetYaxis()->SetTitleSize(0.035); Graph_Graph1007->GetYaxis()->SetTitleFont(42); Graph_Graph1007->GetZaxis()->SetLabelFont(42); Graph_Graph1007->GetZaxis()->SetLabelSize(0.035); Graph_Graph1007->GetZaxis()->SetTitleSize(0.035); Graph_Graph1007->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1007); gre->Draw(" pl"); Double_t Graph2_fx1008[5] = { 0.25, 0.275, 0.3, 2, 8.5}; Double_t Graph2_fy1008[5] = { 0.06949495, 0.06748737, 0.0642268, 0.06051768, 0.1364046}; Double_t Graph2_fex1008[5] = { 0, 0, 0, 0, 0}; Double_t Graph2_fey1008[5] = { 0.0009035941, 0.000891407, 0.0008800606, 0.000847272, 0.00123208}; gre = new TGraphErrors(5,Graph2_fx1008,Graph2_fy1008,Graph2_fex1008,Graph2_fey1008); gre->SetName("Graph2"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(3); gre->SetMarkerColor(3); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1008 = new TH1F("Graph_Graph1008","Graph",100,0,9.325); Graph_Graph1008->SetMinimum(0.05187377); Graph_Graph1008->SetMaximum(0.1454334); Graph_Graph1008->SetDirectory(0); Graph_Graph1008->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1008->SetLineColor(ci); Graph_Graph1008->GetXaxis()->SetLabelFont(42); Graph_Graph1008->GetXaxis()->SetLabelSize(0.035); Graph_Graph1008->GetXaxis()->SetTitleSize(0.035); Graph_Graph1008->GetXaxis()->SetTitleFont(42); Graph_Graph1008->GetYaxis()->SetLabelFont(42); Graph_Graph1008->GetYaxis()->SetLabelSize(0.035); Graph_Graph1008->GetYaxis()->SetTitleSize(0.035); Graph_Graph1008->GetYaxis()->SetTitleFont(42); Graph_Graph1008->GetZaxis()->SetLabelFont(42); Graph_Graph1008->GetZaxis()->SetLabelSize(0.035); Graph_Graph1008->GetZaxis()->SetTitleSize(0.035); Graph_Graph1008->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1008); gre->Draw(" pl"); Double_t Graph3_fx1009[5] = { 0.25, 0.275, 0.3, 2, 8.5}; Double_t Graph3_fy1009[5] = { 0.04645202, 0.04597222, 0.04502717, 0.05941919, 0.1359975}; Double_t Graph3_fex1009[5] = { 0, 0, 0, 0, 0}; Double_t Graph3_fey1009[5] = { 0.000747844, 0.0007441589, 0.0007643529, 0.0008400378, 0.001218037}; gre = new TGraphErrors(5,Graph3_fx1009,Graph3_fy1009,Graph3_fex1009,Graph3_fey1009); gre->SetName("Graph3"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(4); gre->SetMarkerColor(4); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1009 = new TH1F("Graph_Graph1009","Graph",100,0,9.325); Graph_Graph1009->SetMinimum(0.03496755); Graph_Graph1009->SetMaximum(0.1465108); Graph_Graph1009->SetDirectory(0); Graph_Graph1009->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1009->SetLineColor(ci); Graph_Graph1009->GetXaxis()->SetLabelFont(42); Graph_Graph1009->GetXaxis()->SetLabelSize(0.035); Graph_Graph1009->GetXaxis()->SetTitleSize(0.035); Graph_Graph1009->GetXaxis()->SetTitleFont(42); Graph_Graph1009->GetYaxis()->SetLabelFont(42); Graph_Graph1009->GetYaxis()->SetLabelSize(0.035); Graph_Graph1009->GetYaxis()->SetTitleSize(0.035); Graph_Graph1009->GetYaxis()->SetTitleFont(42); Graph_Graph1009->GetZaxis()->SetLabelFont(42); Graph_Graph1009->GetZaxis()->SetLabelSize(0.035); Graph_Graph1009->GetZaxis()->SetTitleSize(0.035); Graph_Graph1009->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1009); gre->Draw(" pl"); Double_t Graph4_fx1010[5] = { 0.25, 0.275, 0.3, 2, 8.5}; Double_t Graph4_fy1010[5] = { 0.0157633, 0.01659091, 0.01693182, 0.05516582, 0.1364646}; Double_t Graph4_fex1010[5] = { 0, 0, 0, 0, 0}; Double_t Graph4_fey1010[5] = { 0.0004493916, 0.0004538785, 0.0004584384, 0.0008153701, 0.001219797}; gre = new TGraphErrors(5,Graph4_fx1010,Graph4_fy1010,Graph4_fex1010,Graph4_fey1010); gre->SetName("Graph4"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(6); gre->SetMarkerColor(6); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1010 = new TH1F("Graph_Graph1010","Graph",100,0,9.325); Graph_Graph1010->SetMinimum(0.003076858); Graph_Graph1010->SetMaximum(0.1499215); Graph_Graph1010->SetDirectory(0); Graph_Graph1010->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1010->SetLineColor(ci); Graph_Graph1010->GetXaxis()->SetLabelFont(42); Graph_Graph1010->GetXaxis()->SetLabelSize(0.035); Graph_Graph1010->GetXaxis()->SetTitleSize(0.035); Graph_Graph1010->GetXaxis()->SetTitleFont(42); Graph_Graph1010->GetYaxis()->SetLabelFont(42); Graph_Graph1010->GetYaxis()->SetLabelSize(0.035); Graph_Graph1010->GetYaxis()->SetTitleSize(0.035); Graph_Graph1010->GetYaxis()->SetTitleFont(42); Graph_Graph1010->GetZaxis()->SetLabelFont(42); Graph_Graph1010->GetZaxis()->SetLabelSize(0.035); Graph_Graph1010->GetZaxis()->SetTitleSize(0.035); Graph_Graph1010->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1010); gre->Draw(" pl"); Double_t Graph5_fx1011[4] = { 0.25, 0.275, 2, 8.5}; Double_t Graph5_fy1011[4] = { 0.005542929, 0.005892857, 0.04303571, 0.132096}; Double_t Graph5_fex1011[4] = { 0, 0, 0, 0}; Double_t Graph5_fey1011[4] = { 0.0002638154, 0.0002733515, 0.0007247769, 0.001203145}; gre = new TGraphErrors(4,Graph5_fx1011,Graph5_fy1011,Graph5_fex1011,Graph5_fey1011); gre->SetName("Graph5"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(7); gre->SetMarkerColor(7); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1011 = new TH1F("Graph_Graph1011","Graph",100,0,9.325); Graph_Graph1011->SetMinimum(0); Graph_Graph1011->SetMaximum(0.1461011); Graph_Graph1011->SetDirectory(0); Graph_Graph1011->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1011->SetLineColor(ci); Graph_Graph1011->GetXaxis()->SetLabelFont(42); Graph_Graph1011->GetXaxis()->SetLabelSize(0.035); Graph_Graph1011->GetXaxis()->SetTitleSize(0.035); Graph_Graph1011->GetXaxis()->SetTitleFont(42); Graph_Graph1011->GetYaxis()->SetLabelFont(42); Graph_Graph1011->GetYaxis()->SetLabelSize(0.035); Graph_Graph1011->GetYaxis()->SetTitleSize(0.035); Graph_Graph1011->GetYaxis()->SetTitleFont(42); Graph_Graph1011->GetZaxis()->SetLabelFont(42); Graph_Graph1011->GetZaxis()->SetLabelSize(0.035); Graph_Graph1011->GetZaxis()->SetTitleSize(0.035); Graph_Graph1011->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1011); gre->Draw(" pl"); Double_t Graph6_fx1012[5] = { 0.25, 0.275, 0.3, 2, 8.5}; Double_t Graph6_fy1012[5] = { 0.00155303, 0.001868687, 0.002222281, 0.02356061, 0.1211862}; Double_t Graph6_fex1012[5] = { 0, 0, 0, 0, 0}; Double_t Graph6_fey1012[5] = { 0.0001399232, 0.0001534615, 0.0001707546, 0.000538956, 0.001165513}; gre = new TGraphErrors(5,Graph6_fx1012,Graph6_fy1012,Graph6_fex1012,Graph6_fey1012); gre->SetName("Graph6"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(8); gre->SetMarkerColor(8); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1012 = new TH1F("Graph_Graph1012","Graph",100,0,9.325); Graph_Graph1012->SetMinimum(0); Graph_Graph1012->SetMaximum(0.1344456); Graph_Graph1012->SetDirectory(0); Graph_Graph1012->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1012->SetLineColor(ci); Graph_Graph1012->GetXaxis()->SetLabelFont(42); Graph_Graph1012->GetXaxis()->SetLabelSize(0.035); Graph_Graph1012->GetXaxis()->SetTitleSize(0.035); Graph_Graph1012->GetXaxis()->SetTitleFont(42); Graph_Graph1012->GetYaxis()->SetLabelFont(42); Graph_Graph1012->GetYaxis()->SetLabelSize(0.035); Graph_Graph1012->GetYaxis()->SetTitleSize(0.035); Graph_Graph1012->GetYaxis()->SetTitleFont(42); Graph_Graph1012->GetZaxis()->SetLabelFont(42); Graph_Graph1012->GetZaxis()->SetLabelSize(0.035); Graph_Graph1012->GetZaxis()->SetTitleSize(0.035); Graph_Graph1012->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1012); gre->Draw(" pl"); Double_t Graph7_fx1013[4] = { 0.25, 0.275, 2, 8.5}; Double_t Graph7_fy1013[4] = { 0.0009974747, 0.0009974747, 0.01513298, 0.1061111}; Double_t Graph7_fex1013[4] = { 0, 0, 0, 0}; Double_t Graph7_fey1013[4] = { 0.0001121687, 0.0001121687, 0.0004451866, 0.001147773}; gre = new TGraphErrors(4,Graph7_fx1013,Graph7_fy1013,Graph7_fex1013,Graph7_fey1013); gre->SetName("Graph7"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(9); gre->SetMarkerColor(9); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1013 = new TH1F("Graph_Graph1013","Graph",100,0,9.325); Graph_Graph1013->SetMinimum(0); Graph_Graph1013->SetMaximum(0.1178962); Graph_Graph1013->SetDirectory(0); Graph_Graph1013->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1013->SetLineColor(ci); Graph_Graph1013->GetXaxis()->SetLabelFont(42); Graph_Graph1013->GetXaxis()->SetLabelSize(0.035); Graph_Graph1013->GetXaxis()->SetTitleSize(0.035); Graph_Graph1013->GetXaxis()->SetTitleFont(42); Graph_Graph1013->GetYaxis()->SetLabelFont(42); Graph_Graph1013->GetYaxis()->SetLabelSize(0.035); Graph_Graph1013->GetYaxis()->SetTitleSize(0.035); Graph_Graph1013->GetYaxis()->SetTitleFont(42); Graph_Graph1013->GetZaxis()->SetLabelFont(42); Graph_Graph1013->GetZaxis()->SetLabelSize(0.035); Graph_Graph1013->GetZaxis()->SetTitleSize(0.035); Graph_Graph1013->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1013); gre->Draw(" pl"); Double_t Graph8_fx1014[5] = { 0.25, 0.275, 0.3, 2, 8.5}; Double_t Graph8_fy1014[5] = { 0.0002651515, 0.0004419192, 0.0003815789, 0.006989796, 0.07766414}; Double_t Graph8_fex1014[5] = { 0, 0, 0, 0, 0}; Double_t Graph8_fey1014[5] = { 5.785313e-05, 7.468147e-05, 7.084391e-05, 0.0002975439, 0.0009510256}; gre = new TGraphErrors(5,Graph8_fx1014,Graph8_fy1014,Graph8_fex1014,Graph8_fey1014); gre->SetName("Graph8"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineColor(40); gre->SetMarkerColor(40); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1014 = new TH1F("Graph_Graph1014","Graph",100,0,9.325); Graph_Graph1014->SetMinimum(0); Graph_Graph1014->SetMaximum(0.08645595); Graph_Graph1014->SetDirectory(0); Graph_Graph1014->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1014->SetLineColor(ci); Graph_Graph1014->GetXaxis()->SetLabelFont(42); Graph_Graph1014->GetXaxis()->SetLabelSize(0.035); Graph_Graph1014->GetXaxis()->SetTitleSize(0.035); Graph_Graph1014->GetXaxis()->SetTitleFont(42); Graph_Graph1014->GetYaxis()->SetLabelFont(42); Graph_Graph1014->GetYaxis()->SetLabelSize(0.035); Graph_Graph1014->GetYaxis()->SetTitleSize(0.035); Graph_Graph1014->GetYaxis()->SetTitleFont(42); Graph_Graph1014->GetZaxis()->SetLabelFont(42); Graph_Graph1014->GetZaxis()->SetLabelSize(0.035); Graph_Graph1014->GetZaxis()->SetTitleSize(0.035); Graph_Graph1014->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1014); gre->Draw(" pl"); Double_t Graph9_fx1015[2] = { 0.25, 2}; Double_t Graph9_fy1015[2] = { 6.47017e-05, 0.002367956}; Double_t Graph9_fex1015[2] = { 0, 0}; Double_t Graph9_fey1015[2] = { 1.3794e-05, 6.810597e-05}; gre = new TGraphErrors(2,Graph9_fx1015,Graph9_fy1015,Graph9_fex1015,Graph9_fey1015); gre->SetName("Graph9"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1015 = new TH1F("Graph_Graph1015","Graph",100,0.075,2.175); Graph_Graph1015->SetMinimum(0); Graph_Graph1015->SetMaximum(0.002674577); Graph_Graph1015->SetDirectory(0); Graph_Graph1015->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1015->SetLineColor(ci); Graph_Graph1015->GetXaxis()->SetLabelFont(42); Graph_Graph1015->GetXaxis()->SetLabelSize(0.035); Graph_Graph1015->GetXaxis()->SetTitleSize(0.035); Graph_Graph1015->GetXaxis()->SetTitleFont(42); Graph_Graph1015->GetYaxis()->SetLabelFont(42); Graph_Graph1015->GetYaxis()->SetLabelSize(0.035); Graph_Graph1015->GetYaxis()->SetTitleSize(0.035); Graph_Graph1015->GetYaxis()->SetTitleFont(42); Graph_Graph1015->GetZaxis()->SetLabelFont(42); Graph_Graph1015->GetZaxis()->SetLabelSize(0.035); Graph_Graph1015->GetZaxis()->SetTitleSize(0.035); Graph_Graph1015->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1015); gre->Draw(" pl"); Double_t Graph10_fx1016[2] = { 0.25, 2}; Double_t Graph10_fy1016[2] = { 2.397917e-05, 0.0007142042}; Double_t Graph10_fex1016[2] = { 0, 0}; Double_t Graph10_fey1016[2] = { 9.063167e-06, 4.035479e-05}; gre = new TGraphErrors(2,Graph10_fx1016,Graph10_fy1016,Graph10_fex1016,Graph10_fey1016); gre->SetName("Graph10"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetMarkerStyle(7); gre->SetMarkerSize(5); TH1F *Graph_Graph1016 = new TH1F("Graph_Graph1016","Graph",100,0.075,2.175); Graph_Graph1016->SetMinimum(0); Graph_Graph1016->SetMaximum(0.0008285233); Graph_Graph1016->SetDirectory(0); Graph_Graph1016->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1016->SetLineColor(ci); Graph_Graph1016->GetXaxis()->SetLabelFont(42); Graph_Graph1016->GetXaxis()->SetLabelSize(0.035); Graph_Graph1016->GetXaxis()->SetTitleSize(0.035); Graph_Graph1016->GetXaxis()->SetTitleFont(42); Graph_Graph1016->GetYaxis()->SetLabelFont(42); Graph_Graph1016->GetYaxis()->SetLabelSize(0.035); Graph_Graph1016->GetYaxis()->SetTitleSize(0.035); Graph_Graph1016->GetYaxis()->SetTitleFont(42); Graph_Graph1016->GetZaxis()->SetLabelFont(42); Graph_Graph1016->GetZaxis()->SetLabelSize(0.035); Graph_Graph1016->GetZaxis()->SetTitleSize(0.035); Graph_Graph1016->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1016); gre->Draw(" pl"); TLegend *leg = new TLegend(0.158046,0.5369979,0.5071839,0.8372093,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextSize(0.045); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("Graph0","c#Tau=0.00 mm","PL"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph1","c#Tau=0.05 mm","PL"); entry->SetLineColor(2); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(2); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph2","c#Tau=0.10 mm","PL"); entry->SetLineColor(3); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(3); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph3","c#Tau=0.20 mm","PL"); entry->SetLineColor(4); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(4); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph4","c#Tau=0.50 mm","PL"); entry->SetLineColor(6); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(6); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph5","c#Tau=1.00 mm","PL"); entry->SetLineColor(7); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(7); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph6","c#Tau=2.00 mm","PL"); entry->SetLineColor(8); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(8); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph7","c#Tau=3.00 mm","PL"); entry->SetLineColor(9); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(9); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); entry=leg->AddEntry("Graph8","c#Tau=5.00 mm","PL"); entry->SetLineColor(40); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(40); entry->SetMarkerStyle(7); entry->SetMarkerSize(5); entry->SetTextFont(42); leg->Draw(); TPaveText *pt = new TPaveText(0.4195977,0.9339831,0.5804023,0.995,"blNDC"); pt->SetName("title"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetFillStyle(0); pt->SetTextFont(42); TText *AText = pt->AddText("dummy4"); pt->Draw(); c2->Modified(); c2->cd(); c2->SetSelected(c2); }
void minuitFit() { TH1F::SetDefaultSumw2(); TH1D::SetDefaultSumw2(); cout << "Must Use Same Binning as previous Analysis!" << endl; gStyle->SetOptFit(1111); gStyle->SetOptStat(0); haveName = kFALSE; char fname[100]; TFile* file; Bool_t makePDF = checkMakePDF(); Bool_t makeROOT = checkMakeRoot(); if(makeROOT){ sprintf(fname,"/Users/zach/Research/pythia/200GeVTemplate/FFOutput/%s_FIT.root",FileNameR); file = new TFile(fname,"RECREATE"); if (file->IsOpen()==kFALSE) { std::cout << "!!! Outfile Not Opened !!!" << std::endl; makeROOT = kFALSE; } } char name[1000]; sprintf(name,"/Users/zach/Research/pythia/200GeVTemplate/currentTemplate.root"); TFile *fT = new TFile(name,"READ"); sprintf(name,"/Users/zach/Research/rootFiles/run12NPEhPhi/currentData.root"); TFile *fD = new TFile(name,"READ"); if (fT->IsOpen()==kFALSE || fD->IsOpen()==kFALSE) { std::cout << "!!!!!! Either B,C, or Data File not found !!!!!!" << std::endl << "Looking for currentB.root, currentC.root, and currentData.root" << std::endl; exit(1); } // Set constants and projection bins (from header file anaConst, analysis constants) Float_t lowpt[numPtBins],highpt[numPtBins]; for(Int_t c=0; c< numPtBins; c++){ lowpt[c] = anaConst::lpt[c]; highpt[c] = anaConst::hpt[c]; } Float_t hptCut=anaConst::hptCut; // Make Canvases TCanvas* deltaPhi = new TCanvas("deltaPhi","Pythia Delta Phi",150,0,1150,1000); TCanvas* deltaPhi2 = new TCanvas("deltaPhi2","Pythia Delta Phi",150,0,1150,1000); TCanvas* fitResult0 = new TCanvas("fitResult0","RB Extraction HT0",150,0,1150,1000); TCanvas* fitResult2 = new TCanvas("fitResult2","RB Extraction HT2",150,0,1150,1000); TCanvas* fitResultC = new TCanvas("fitResultC","RB Extraction Combined Trigs",150,0,1150,1000); TCanvas* fitResultP = new TCanvas("fitResultP","RB Previous Analysis",150,0,1150,1000); TCanvas* scaleCheck = new TCanvas("scaleCheck","Check scale diff",150,0,1150,1000); TCanvas* prettyPlot = new TCanvas("prettyPlot","PrettyPlot",150,0,1150,1000); deltaPhi ->Divide(3,3); deltaPhi2 ->Divide(3,3); fitResult0->Divide(3,4); fitResult2->Divide(3,4); fitResultC->Divide(3,4); fitResultP->Divide(2,2); scaleCheck->Divide(1,2); // Get and Draw histos TPaveText* lbl[numPtBins]; TPaveText* stat[4][numPtBins]; char statLabel[100]; char textLabel[100]; Int_t plotbin; Double_t norm0,norm2,normB,normC; // Get ptbin independent hists histoNorms = (TH2F*)fD->Get("histoNorms"); // Get Previous Analysis TFile *file3 = new TFile("/Users/zach/Research/previousNPEhFigures/Chi2_25_35.root"); Hdphi[0] = (TH1D*)file3->Get("fit_25_35"); HpphiD[0] = (TH1D*)file3->Get("De_25_35"); HpphiB[0] = (TH1D*)file3->Get("Be_25_35"); TFile *file4 = new TFile("/Users/zach/Research/previousNPEhFigures/Chi2_55_65.root"); Hdphi[1] = (TH1D*)file4->Get("fit_55_65"); HpphiD[1] = (TH1D*)file4->Get("De_55_65"); HpphiB[1] = (TH1D*)file4->Get("Be_55_65"); for(Int_t ptbin=0; ptbin<numPtBins; ptbin++) { bPtNorms[ptbin] = (TH1F*)fT->Get(Form("beEventTally_%i",ptbin)); cPtNorms[ptbin] = (TH1F*)fT->Get(Form("ceEventTally_%i",ptbin)); norm0 = histoNorms->GetBinContent(histoNorms->GetBin(1,ptbin+1)); norm2 = histoNorms->GetBinContent(histoNorms->GetBin(3,ptbin+1)); normB = bPtNorms[ptbin]->GetBinContent(1); normC = cPtNorms[ptbin]->GetBinContent(1); cout << ptbin << "; 0: " << norm0 << " 2: " << norm2 << endl; if( norm0 == 0) { cout << ptbin << " For this bin, some norm0 = 0" << endl; continue; } if( norm2 == 0 ) { cout << ptbin << " For this bin, some norm2 = 0" << endl; continue; } if( normB == 0 ) { cout << ptbin << " For this bin, some normB = 0" << endl; continue; } if( normC == 0) { cout << ptbin << " For this bin, some normC = 0" << endl; continue; } plotbin = ptbin; // Init necessary plotting tools lbl[ptbin] = new TPaveText(.15,.15,.35,.23,Form("NB NDC%i",ptbin)); sprintf(textLabel,"%.1f < P_{T,e} < %.1f",lowpt[ptbin],highpt[ptbin]); lbl[ptbin]->AddText(textLabel); lbl[ptbin]->SetFillColor(kWhite); projB[ptbin] = (TH1D*)fT->Get(Form("hdPhiRawbe_%i",ptbin)); projC[ptbin] = (TH1D*)fT->Get(Form("hdPhiRawce_%i",ptbin)); projData0[ptbin]= (TH1D*)fD->Get(Form("NPEhDelPhi_0_%i",ptbin)); projData2[ptbin]= (TH1D*)fD->Get(Form("NPEhDelPhi_2_%i",ptbin)); pileupCorrect[ptbin][0] = (TH1D*)fD->Get(Form("pileupCorrection_%i_0",ptbin)); pileupCorrect[ptbin][1] = (TH1D*)fD->Get(Form("pileupCorrection_%i_2",ptbin)); pileupCorrect[ptbin][0]->Sumw2(); pileupCorrect[ptbin][1]->Sumw2(); // Do any rebinning Int_t RB = 1; projB[ptbin]->Rebin(RB); projC[ptbin]->Rebin(RB); projData0[ptbin]->Rebin(RB); projData2[ptbin]->Rebin(RB); // Clone to make plots without effecting fits plotD0[ptbin] = (TH1D*) projData0[ptbin]->Clone(); plotD2[ptbin] = (TH1D*) projData2[ptbin]->Clone(); plotB[ptbin] = (TH1D*) projB[ptbin]->Clone(); plotC[ptbin] = (TH1D*) projC[ptbin]->Clone(); // Set features that are the same in plots projData0[ptbin]->SetLineColor(kBlue); projData2[ptbin]->SetLineColor(kGreen+3); projB[ptbin]->SetLineColor(kRed); projC[ptbin]->SetLineColor(kBlack); projC[ptbin]->GetXaxis()->SetRangeUser(-3.5,3.5); plotD0[ptbin]->SetLineColor(kBlue); plotD2[ptbin]->SetLineColor(kGreen+3); plotD0[ptbin]->SetMarkerStyle(20); plotD0[ptbin]->SetMarkerColor(kBlue); plotD0[ptbin]->SetMarkerSize(0.4); plotB[ptbin]->SetLineColor(kRed); plotC[ptbin]->SetLineColor(kBlack); plotC[ptbin]->GetXaxis()->SetRangeUser(-3.5,3.5); combData[ptbin] = (TH1D*) projData0[ptbin]->Clone(); combData[ptbin] -> Add(projData2[ptbin]); combData[ptbin]->SetLineColor(kBlue); combData[ptbin]->SetMarkerStyle(20); combData[ptbin]->SetMarkerColor(kBlue); combData[ptbin]->SetMarkerSize(0.4); combData[ptbin]->SetTitle(""); // Normalize projB[ptbin] -> Scale(1./normB); projC[ptbin] -> Scale(1./normC); projData0[ptbin] -> Scale(1./norm0); projData2[ptbin] -> Scale(1./norm2); plotD0[ptbin] -> Scale(1./norm0); plotD2[ptbin] -> Scale(1./norm2); plotB[ptbin] -> Scale(1./normB); plotC[ptbin] -> Scale(1./normC); combData[ptbin] -> Scale(1./(norm0+norm2)); // Subtract Pileup correction (data only) projData0[ptbin]->Sumw2();projData2[ptbin]->Sumw2(); //projData0[ptbin]->Add(pileupCorrect[ptbin][0],-1); //projData2[ptbin]->Add(pileupCorrect[ptbin][1],-1); // Draw Templates on own plots if(ptbin+1 <= 9) deltaPhi->cd(plotbin+1); if(ptbin+1 > 9) deltaPhi2->cd(ptbin-8); plotC[ptbin]->GetYaxis()->SetRangeUser(-.1,0.8); plotC[ptbin] -> Draw("hist"); plotB[ptbin] -> Draw("same hist"); plotD0[ptbin] -> Draw("same"); plotD2[ptbin] -> Draw("same"); lbl[ptbin] -> Draw("same"); TLegend* leg = new TLegend(0.65,0.6,0.85,0.85); leg->AddEntry(projB[ptbin],"b#bar{b}->NPE","lpe"); leg->AddEntry(projC[ptbin],"c#bar{c}->NPE","lpe"); leg->AddEntry(projData0[ptbin],"HT0","lpe"); leg->AddEntry(projData2[ptbin],"HT2","lpe"); leg->Draw(); deltaPhi->cd(1); Hdphi[0]->Draw("same"); deltaPhi->cd(4); Hdphi[1]->Draw("same"); if(ptbin == 1) { prettyPlot->cd(); plotC[ptbin]->GetYaxis()->SetRangeUser(0,0.35); plotC[ptbin]->SetMarkerStyle(20); plotC[ptbin]->SetMarkerSize(0.6); plotB[ptbin]->SetMarkerStyle(21); plotB[ptbin]->SetMarkerSize(0.6); plotB[ptbin]->SetMarkerColor(kRed); plotD0[ptbin]->SetMarkerStyle(22); plotD0[ptbin]->SetMarkerSize(0.9); plotC[ptbin]->GetXaxis()->SetTitle("#Delta#phi_{NPE-h} (rad)"); plotC[ptbin]->GetYaxis()->SetTitle("#frac{1}{N_{NPE}} #frac{dN}{d(#Delta#phi)}"); plotC[ptbin]->DrawClone("P"); plotB[ptbin]->DrawClone("same P"); plotD0[ptbin]->DrawClone("same P"); TLegend* legPret = new TLegend(0.65,0.6,0.85,0.85); legPret->AddEntry(plotB[ptbin],"B #rightarrow NPE-h, Monte Carlo","LPE"); legPret->AddEntry(plotC[ptbin],"D #rightarrow NPE-h, Monte Carlo","LPE"); legPret->AddEntry(plotD0[ptbin],"NPE-h 2012 STAR Data","LPE"); lbl[ptbin]->Draw("same"); legPret->Draw("same"); } /*// Draw Scale Check scaleCheck->cd(1); TH1F* HT0 = (TH1F*) plotD0[0]->Clone(); HT0->Divide(HT0,Hdphi[0],1,1); HT0->Draw(); scaleCheck->cd(2); TH1F* HT2 = (TH1F*) plotD2[3]->Clone(); HT2->Divide(HT2,Hdphi[1],1,1); HT0->GetXaxis()->SetRangeUser(-3.5,3.5); HT2->GetXaxis()->SetRangeUser(-3.5,3.5); HT2->Draw(); lbl[ptbin]->Draw("same"); TLegend* legSC = new TLegend(0.65,0.6,0.85,0.85); legSC->AddEntry(HT0,"HT0/prevdata","lpe"); legSC->AddEntry(HT2,"HT2/prevdata","lpe"); legSC->Draw();*/ ///////////////////// // Do the actual fits ///////////////////// currentPtBin = ptbin; cout << "!!!!!!! HT0 ptbin: " << highpt[ptbin] << "-" << lowpt[ptbin] <<" !!!!!!!"<< endl; TMinuit* gMinuit = new TMinuit(1); gMinuit->SetFCN(chi2_0); currentPtBin = ptbin; doFit(gMinuit,p01[ptbin],p00[ptbin],e01[ptbin],e00[ptbin]); // assign to plotting variables if(highpt[ptbin] < 6) { pT[ptbin] = (lowpt[ptbin]+highpt[ptbin])/2.; dx[plotCount0] = 0.; ptOFF1[plotCount0] = pT[ptbin]; Rb0[plotCount0] = p01[ptbin];///(p01[ptbin]+p00[ptbin]); eb0[plotCount0] = e01[ptbin]; plotCount0++; } // Plot results fitResult0->cd(ptbin+1); TH1D* dClone = (TH1D*) projData0[ptbin]->Clone(); TH1D* cClone = (TH1D*) projC[ptbin]->Clone(); TH1D* bClone = (TH1D*) projB[ptbin]->Clone(); stat[0][ptbin] = new TPaveText(.4,.75,.85,.85,Form("NB NDC%i",ptbin)); sprintf(statLabel,"Chi2/NDF: %.2f/%.0f",curChi2,curNDF); stat[0][ptbin]->InsertText(statLabel); stat[0][ptbin]->SetFillColor(kWhite); cClone->Scale((1.-p01[ptbin])*p00[ptbin]); bClone->Scale(p00[ptbin]*p01[ptbin]); // scale by contribution param cClone->Add(bClone); //cClone->Scale(dClone->GetMaximum()/cClone->GetMaximum()); dClone->GetXaxis()->SetRangeUser(anaConst::lowPhi,anaConst::highPhi); dClone->GetYaxis()->SetRangeUser(-0.1,0.6); dClone->Draw(); cClone->Draw("same"); stat[0][ptbin]->Draw("same"); lbl[ptbin]->Draw("same"); cout << "!!!!!!! HT2 ptbin: " << highpt[ptbin] << "-" << lowpt[ptbin] <<" !!!!!!!"<< endl; gMinuit->SetFCN(chi2_2); doFit(gMinuit,p21[ptbin],p20[ptbin],e21[ptbin],e20[ptbin]); // assign to plotting variables if(highpt[ptbin] > 3.6) { pT[ptbin] = (lowpt[ptbin]+highpt[ptbin])/2.; ptOFF2[plotCount2] = pT[ptbin]; Rb2[plotCount2] = p21[ptbin];///(p21[ptbin]+p20[ptbin]); eb2[plotCount2] = e21[ptbin]; plotCount2++; } // Plot results fitResult2->cd(ptbin+1); dClone = (TH1D*) projData2[ptbin]->Clone(); cClone = (TH1D*) projC[ptbin]->Clone(); bClone = (TH1D*) projB[ptbin]->Clone(); stat[2][ptbin] = new TPaveText(.4,.75,.85,.85,Form("NB NDC%i",ptbin)); sprintf(statLabel,"Chi2/NDF: %.2f/%.2f",curChi2,curNDF); stat[2][ptbin]->InsertText(statLabel); stat[2][ptbin]->SetFillColor(kWhite); cClone->Scale((1.-p21[ptbin])*p20[ptbin]); bClone->Scale(p20[ptbin]*p21[ptbin]); // scale by contribution param cClone->Add(bClone); // cClone->Scale(dClone->GetMaximum()/cClone->GetMaximum()); dClone->GetXaxis()->SetRangeUser(anaConst::lowPhi,anaConst::highPhi); dClone->GetYaxis()->SetRangeUser(-0.1,0.6); dClone->Draw(); cClone->Draw("same"); stat[2][ptbin]->Draw("same"); lbl[ptbin]->Draw("same"); cout << "!!!!!!! HTC ptbin: " << highpt[ptbin] << "-" << lowpt[ptbin] <<" !!!!!!!"<< endl; gMinuit->SetFCN(chi2_C); doFit(gMinuit,pC1[ptbin],pC0[ptbin],eC1[ptbin],eC0[ptbin]); // assign to plotting variables pT[ptbin] = (lowpt[ptbin]+highpt[ptbin])/2.; RbC[plotCount] = pC1[ptbin];///(p21[ptbin]+p20[ptbin]); ebC[plotCount] = eC1[ptbin]; plotCount++; } cout << "!!!!!!! Previous Data: 0"<<" !!!!!!!"<< endl; ////////// // 2.5-3.5 GeV Bin ////////// gMinuit->SetFCN(chi2_P0); doFit(gMinuit,RbP[0],SF[0],EbP[0],eSF[0]); // assign plotting variables pTP[0] = 3.; // Plot results fitResultP->cd(1); /*TH1D* dClone = (TH1D*) Hdphi[0]->Clone(); TH1D* cClone = (TH1D*) projC[0]->Clone(); TH1D* bClone = (TH1D*) projB[0]->Clone();*/ TH1D* dClone = (TH1D*) projData0[0]->Clone(); TH1D* cClone = (TH1D*) HpphiD[0]->Clone(); TH1D* bClone = (TH1D*) HpphiB[0]->Clone(); stat[3][0] = new TPaveText(.4,.75,.85,.85,Form("NB NDC%iP",0)); sprintf(statLabel,"Chi2/NDF: %.2f/%.2f",curChi2,curNDF); stat[3][0]->InsertText(statLabel); stat[3][0]->SetFillColor(kWhite); cClone->Scale((1.-RbP[0])*SF[0]); bClone->Scale(RbP[0]*SF[0]); // scale by contribution param cClone->Add(bClone); // cClone->Scale(dClone->GetMaximum()/cClone->GetMaximum()); dClone->GetXaxis()->SetRangeUser(anaConst::lowPhi,anaConst::highPhi); dClone->GetYaxis()->SetRangeUser(-0.1,0.6); cClone->SetLineColor(kRed); dClone->Draw(); cClone->Draw("same"); stat[3][0]->Draw("same"); //////// // 5.5-6.5 GeV Bin //////// gMinuit->SetFCN(chi2_P1); doFit(gMinuit,RbP[1],SF[1],EbP[1],eSF[1]); // assign plotting variables pTP[1] = 6.; // Plot results fitResultP->cd(2); /*dClone = (TH1D*) Hdphi[1]->Clone(); cClone = (TH1D*) projC[3]->Clone(); bClone = (TH1D*) projB[3]->Clone();*/ dClone = (TH1D*) projData2[3]->Clone(); cClone = (TH1D*) HpphiD[1]->Clone(); bClone = (TH1D*) HpphiB[1]->Clone(); stat[3][1] = new TPaveText(.4,.75,.85,.85,Form("NB NDC%iP",0)); sprintf(statLabel,"Chi2/NDF: %.2f/%.2f",curChi2,curNDF); stat[3][1]->InsertText(statLabel); stat[3][1]->SetFillColor(kWhite); cClone->Scale((1.-RbP[1])*SF[1]); bClone->Scale(RbP[1]*SF[1]); // scale by contribution param cClone->Add(bClone); // cClone->Scale(dClone->GetMaximum()/cClone->GetMaximum()); dClone->GetXaxis()->SetRangeUser(anaConst::lowPhi,anaConst::highPhi); dClone->GetYaxis()->SetRangeUser(-0.1,0.6); cClone->SetLineColor(kRed); dClone->Draw(); cClone->Draw("same"); stat[3][1]->Draw("same"); //////// // Old Data, Old Template /////// gMinuit->SetFCN(chi2_PP); doFit(gMinuit,RbPP[0],SFPP[0],EbPP[0],eSFPP[0]); // assign plotting variables pTPP[0] = 3.; // Plot results fitResultP->cd(3); dClone = (TH1D*) Hdphi[0]->Clone(); cClone = (TH1D*) HpphiD[0]->Clone(); bClone = (TH1D*) HpphiB[0]->Clone(); stat[3][2] = new TPaveText(.4,.75,.85,.85,Form("NB NDC%iP",0)); sprintf(statLabel,"Chi2/NDF: %.2f/%.2f",curChi2,curNDF); stat[3][2]->InsertText(statLabel); stat[3][2]->SetFillColor(kWhite); cClone->Scale((1.-RbPP[0])*SFPP[0]); bClone->Scale(RbPP[0]*SFPP[0]); // scale by contribution param cClone->Add(bClone); // cClone->Scale(dClone->GetMaximum()/cClone->GetMaximum()); dClone->GetXaxis()->SetRangeUser(anaConst::lowPhi,anaConst::highPhi); dClone->GetYaxis()->SetRangeUser(-0.1,0.6); cClone->SetLineColor(kRed); dClone->Draw(); cClone->Draw("same"); stat[3][2]->Draw("same"); // Bin at 6 GeV gMinuit->SetFCN(chi2_PP1); doFit(gMinuit,RbPP[1],SFPP[1],EbPP[1],eSFPP[1]); // assign plotting variables pTPP[1] = 6.; // Plot results fitResultP->cd(4); dClone = (TH1D*) Hdphi[1]->Clone(); cClone = (TH1D*) HpphiD[1]->Clone(); bClone = (TH1D*) HpphiB[1]->Clone(); stat[3][3] = new TPaveText(.4,.75,.85,.85,Form("NB NDC%iP",0)); sprintf(statLabel,"Chi2/NDF: %.2f/%.2f",curChi2,curNDF); stat[3][3]->InsertText(statLabel); stat[3][3]->SetFillColor(kWhite); cClone->Scale((1.-RbPP[1])*SFPP[1]); bClone->Scale(RbPP[1]*SFPP[1]); // scale by contribution param cClone->Add(bClone); // cClone->Scale(dClone->GetMaximum()/cClone->GetMaximum()); dClone->GetXaxis()->SetRangeUser(anaConst::lowPhi,anaConst::highPhi); dClone->GetYaxis()->SetRangeUser(-0.1,0.6); cClone->SetLineColor(kRed); dClone->Draw(); cClone->Draw("same"); stat[3][3]->Draw("same"); // Get FONLL Calc Int_t l=0; char line[1000]; Float_t xF[100],yF[100],minF[100],maxF[100]; ifstream fp("/Users/zach/Research/pythia/200GeVTemplate/FONLL.txt",ios::in); while (!fp.eof()){ fp.getline(line,1000); sscanf(line,"%f %f %f %f",&xF[l],&yF[l],&minF[l],&maxF[l]); // printf("L: %f %f\n",xF[l],yF[l]); l++; } fp.close(); // Get Previous Analysis Int_t p=0; Float_t xP[100],yP[100],dyP[100]; ifstream fp1("/Users/zach/Research/pythia/200GeVTemplate/run5_6.txt",ios::in); while (!fp1.eof()){ fp1.getline(line,1000); sscanf(line,"%f %f %f",&xP[p],&yP[p],&dyP[p]); // printf("L: %f %f\n",xF[l],yF[l]); p++; } fp1.close(); //cout << "at bottom contrib plot" << endl; TCanvas* c1 = new TCanvas("c1","Bottom Contribution",150,0,1150,1000); TGraphErrors *gr0 = new TGraphErrors(plotCount0-1,ptOFF1,Rb0,dx,eb0); TGraphErrors *gr2 = new TGraphErrors(plotCount2-1,ptOFF2,Rb2,dx,eb2); TGraphErrors *grC = new TGraphErrors(plotCount-1,pT,RbC,dx,ebC); TGraphErrors *grF = new TGraphErrors(l-1,xF,yF); TGraphErrors *grFmax = new TGraphErrors(l-1,xF,maxF); TGraphErrors *grFmin = new TGraphErrors(l-1,xF,minF); TGraphErrors *grP = new TGraphErrors(p-1,xP,yP,0,dyP); TGraphErrors *grPr = new TGraphErrors(2,pTP,RbP,0,EbP); TGraphErrors *grPPr = new TGraphErrors(2,pTPP,RbPP,0,EbPP); c1->cd(1); grP->SetTitle(""); grP->GetXaxis()->SetTitle("NPE p_{T} (GeV/c)"); grP->GetYaxis()->SetTitle("r_{B}"); gr0->SetMarkerStyle(20); gr0->SetMarkerSize(1); gr0->SetLineColor(kBlue); gr0->SetMarkerColor(kBlue); gr2->SetMarkerStyle(22); gr2->SetMarkerSize(1); gr2->SetLineColor(kRed); gr2->SetMarkerColor(kRed); grC->SetMarkerStyle(21); grC->SetMarkerSize(1); grC->SetLineColor(kRed); grC->SetMarkerColor(kRed); grP->GetXaxis()->SetLimits(0,10); grP->GetYaxis()->SetRangeUser(0,1); grF->SetLineStyle(1); grFmax->SetLineStyle(2); grFmin->SetLineStyle(2); grP->SetMarkerStyle(33); grP->SetMarkerColor(kBlack); grPr->SetMarkerStyle(29); grPr->SetMarkerColor(9); grPr->SetLineColor(9); grPPr->SetMarkerStyle(29); grPPr->SetMarkerColor(49); grPPr->SetLineColor(49); grP->Draw("AP"); //grC->Draw("same P"); gr2->Draw("same P"); grF->Draw("same"); grFmax->Draw("same"); grFmin->Draw("same"); gr0->Draw("same P"); // grPr->Draw("same P"); //grPPr->Draw("same P"); TLegend* leg2 = new TLegend(0.15,0.68,0.48,0.85); leg2->AddEntry(gr0,"STAR Run 12 - Low p_{T} Analysis","pe"); leg2->AddEntry(gr2,"STAR Run 12 - High p_{T} Analysis","pe"); //leg2->AddEntry(grC,"Combined Trigs","pe"); leg2->AddEntry(grP,"STAR Run 6 Analysis (Stat. Uncertainty)","pe"); // leg2->AddEntry(grPr,"Run 12 Data, Run 5/6 Templates)","pe"); //leg2->AddEntry(grPPr,"Run 5/6 Refit (prev Template)","pe"); leg2->AddEntry(grF,"FONLL Calculation","l"); leg2->Draw("same"); // Write to Root File if open if(makeROOT){ file3->Close(); file4->Close(); file->cd(); grP->Write("PreviousData"); //grC->Write("same P"); gr2->Write("HT2"); grF->Write("FONLL"); grFmax->Write("FONLLmax"); grFmin->Write("FONLLmin"); gr0->Write("HT0"); // grPr->Write("PrevTempMyData"); //grPPr->Write("PrevTempPreData"); } // Make PDF with output canvases if(makePDF) { //Set front page TCanvas* fp = new TCanvas("fp","Front Page",100,0,1000,900); fp->cd(); TBox *bLabel = new TBox(0.01, 0.88, 0.99, 0.99); bLabel->SetFillColor(38); bLabel->Draw(); TLatex tl; tl.SetNDC(); tl.SetTextColor(kWhite); tl.SetTextSize(0.033); char tlName[100]; char tlName2[100]; TString titlename = FileName; int found = titlename.Last('/'); if(found >= 0){ titlename.Replace(0, found+1, ""); } sprintf(tlName, "RUN 12 NPE-h #Delta#phi Correlations"); tl.SetTextSize(0.05); tl.SetTextColor(kWhite); tl.DrawLatex(0.05, 0.92,tlName); TBox *bFoot = new TBox(0.01, 0.01, 0.99, 0.12); bFoot->SetFillColor(38); bFoot->Draw(); tl.SetTextColor(kWhite); tl.SetTextSize(0.05); tl.DrawLatex(0.05, 0.05, (new TDatime())->AsString()); tl.SetTextColor(kBlack); tl.SetTextSize(0.03); tl.DrawLatex(0.1, 0.14, titlename); sprintf(tlName,"TEST"); tl.DrawLatex(0.1, 0.8,tlName); // Place canvases in order TCanvas* temp = new TCanvas(); sprintf(name, "FFOutput/%s.pdf[", FileName); temp->Print(name); sprintf(name, "FFOutput/%s.pdf", FileName); temp = deltaPhi; temp->Print(name); temp = fitResult0; temp->Print(name); temp = fitResult2; temp->Print(name); // temp = fitResultC; // temp->Print(name); temp = c1; temp->Print(name); sprintf(name, "FFOutput/%s.pdf]", FileName); temp->Print(name); } if(makeROOT) { file->Write(); file->Close(); } }
void Draw_Phenix_JPsi_RaaVspT(TLegend *legend_ratio) { //================= Phenix Forward Rapidity Raa Vs Pt ===================================// //r_aa at forward rapidity (|y| in [1.2,2.2]) //"J/psi Production vs Centrality, Transverse Momentum, and Rapidity in Au+Au Collisions at s(NN)**(1/2) = 200-GeV" //Preprint: nucl-ex/0611020 inSPIRE, Citations //Submitted: 2006-11-12 //Published: Phys. Rev. Lett. 98, 232301 (2007) , 2007-06-07 Double_t PtPhenix[7]={0.50,1.50,2.50,3.50,4.50}; Double_t ErrPtPhenix[7]={0}; // 0-20% //int nbinsPtPhenix=6; //Double_t RaaPtPhenix[7] = {0.18,0.18,0.19,0.17,0.60,0.26}; //Double_t RaaPtStatErrPhenix[7] = {0.03,0.03,0.04,0.07,0.17,0.06}; //Double_t RaaPtSystErrPhenix[7] = {0.03,0.02,0.03,0.02,0.08,0.05}; // 0-93% int nbinsPtPhenix=5; Double_t RaaPtPhenix[7] = {0.152,0.207,0.352,0.323,0.499}; Double_t RaaPtStatErrPhenix[7] = {0.016,0.016,0.024,0.036,0.071}; Double_t RaaPtSystErrPhenix[7] = {0.015,0.020,0.035,0.032,0.049}; TGraphErrors *grRaaPtPhenix = new TGraphErrors(nbinsPtPhenix, PtPhenix, RaaPtPhenix, ErrPtPhenix, RaaPtStatErrPhenix); grRaaPtPhenix->SetMarkerStyle(34); grRaaPtPhenix->SetMarkerColor(kGreen+2); grRaaPtPhenix->SetMarkerSize(1.3); grRaaPtPhenix->SetLineColor(1); TLine *lh4 = new TLine(0.0,1.0,7.6,1.0); lh4->SetLineColor(1); lh4->SetLineStyle(1); lh4->SetLineWidth(1.5); //lh4->Draw("same"); TLatex *tb= new TLatex; tb->SetNDC(); tb->SetTextAlign(12); tb->SetTextColor(1); tb->SetTextSize(0.040); TBox *RaaPtJPsiPhenixSys[12]; for(int j=0;j<nbinsPtPhenix;j++){ RaaPtJPsiPhenixSys[j] = new TBox(PtPhenix[j]-0.4, RaaPtPhenix[j]-RaaPtSystErrPhenix[j], PtPhenix[j]+0.4, RaaPtPhenix[j]+RaaPtSystErrPhenix[j]); } for(int j=0;j<nbinsPtPhenix;j++){ RaaPtJPsiPhenixSys[j]->SetFillStyle(1001); RaaPtJPsiPhenixSys[j]->SetFillColor(kGreen+6); RaaPtJPsiPhenixSys[j]->SetLineColor(1); } TBox *PhenixGlobalSysJPsiPtFor; PhenixGlobalSysJPsiPtFor = new TBox(28.42,0.88,29.0,1.16); PhenixGlobalSysJPsiPtFor->SetFillStyle(3001); PhenixGlobalSysJPsiPtFor->SetLineColor(1); PhenixGlobalSysJPsiPtFor->SetFillColor(1); grRaaPtPhenix->Draw("sameP"); for(int j=0;j<nbinsPtPhenix;j++) RaaPtJPsiPhenixSys[j]->Draw("sameL"); grRaaPtPhenix->Draw("Psame"); //PhenixGlobalSysJPsiPtFor->Draw("sameL"); //tb->DrawLatex(0.22,0.16,"J/#psi #rightarrow #mu^{+} #mu^{-}, p_{T}^{J/#psi} > 0.0 GeV/c"); legend_ratio->SetTextColor(1); //legend_ratio->AddEntry(grRaaPtPhenix,"PHENIX: J/#psi #rightarrow #mu^{+} #mu^{-}, 1.2 < |y| < 2.2 & p_{T}^{J/#psi} > 0.0 GeV/c", "P"); legend_ratio->AddEntry(grRaaPtPhenix,"Au+Au #sqrt{s_{NN}} = 200 GeV, J/#psi PHENIX: 1.2 < |y| < 2.2", "P"); }
void Draw_ALICEFor_JPsi_RaaVspT(TLegend *legend_ratio) { // Centrality, rapidity and transverse momentum dependence of // J/psi suppression in Pb-Pb collisions at sqrt{s} = 2.76 TeV ALICE // arxiv.1311.0214v1 //================= ALICE Forward Rapidity Raa Vs Pt ===================================// int nbinsPtALICEFor=7; Double_t PtALICEFor[7]={0.50,1.50,2.50,3.50,4.50,5.50,7.0}; Double_t ErrPtALICEFor[7]={0}; //Double_t RaaPtALICEFor[7] = {0.61,0.53,0.45,0.38,0.37,0.34,0.35}; //Double_t RaaPtStatErrALICEFor[7] = {0.06,0.04,0.03,0.04,0.05,0.06,0.07}; //Double_t RaaPtSystErrALICEFor[7] = {0.08,0.07,0.06,0.05,0.05,0.05,0.04}; Double_t RaaPtALICEFor[7] = {0.78,0.68,0.52,0.43,0.41,0.32,0.36}; Double_t RaaPtStatErrALICEFor[7] = {0.08,0.05,0.04,0.04,0.05,0.05,0.08}; Double_t RaaPtSystErrALICEFor[7] = {0.11,0.08,0.06,0.05,0.05,0.04,0.04}; TGraphErrors *grRaaPtALICEFor = new TGraphErrors(nbinsPtALICEFor, PtALICEFor, RaaPtALICEFor, ErrPtALICEFor, RaaPtStatErrALICEFor); grRaaPtALICEFor->SetMarkerStyle(20); grRaaPtALICEFor->SetMarkerColor(4); grRaaPtALICEFor->SetMarkerSize(1.3); grRaaPtALICEFor->SetLineColor(1); grRaaPtALICEFor->GetYaxis()->SetRangeUser(0,1.5); grRaaPtALICEFor->GetXaxis()->SetTitle("p_{T}(GeV/c)"); grRaaPtALICEFor->GetYaxis()->SetTitle("R_{AA}"); TLine *lh4 = new TLine(0.0,1.0,7.6,1.0); lh4->SetLineColor(1); lh4->SetLineStyle(1); lh4->SetLineWidth(1.5); //lh4->Draw("same"); TLatex *tb= new TLatex; tb->SetNDC(); tb->SetTextAlign(12); tb->SetTextColor(1); tb->SetTextSize(0.040); TBox *RaaPtJPsiALICEForSys[12]; for(int j=0;j<7;j++){ RaaPtJPsiALICEForSys[j] = new TBox(PtALICEFor[j]-0.4, RaaPtALICEFor[j]-RaaPtSystErrALICEFor[j], PtALICEFor[j]+0.4, RaaPtALICEFor[j]+RaaPtSystErrALICEFor[j]); } for(int j=0;j<7;j++){ RaaPtJPsiALICEForSys[j]->SetFillStyle(1001); RaaPtJPsiALICEForSys[j]->SetFillColor(kAzure-4); RaaPtJPsiALICEForSys[j]->SetLineColor(1); } TBox *ALICEGlobalSysJPsiPtFor; //ALICEGlobalSysJPsiPtFor = new TBox(7.2-0.2, 1 - 0.14, 7.2+0.2, 1 + 0.14); //ALICEGlobalSysJPsiPtFor = new TBox(18.424,0.858,19.165,1.137); // By Abd ALICEGlobalSysJPsiPtFor = new TBox(18.424,1.0-0.08,19.165,1.0+0.08); // By Abd ALICEGlobalSysJPsiPtFor->SetFillStyle(3001); ALICEGlobalSysJPsiPtFor->SetLineColor(4); ALICEGlobalSysJPsiPtFor->SetFillColor(4); grRaaPtALICEFor->Draw("sameP"); for(int j=0;j<7;j++) RaaPtJPsiALICEForSys[j]->Draw("sameL"); grRaaPtALICEFor->Draw("Psame"); ALICEGlobalSysJPsiPtFor->Draw("sameL"); legend_ratio->SetTextColor(4); //tb->DrawLatex(0.22,0.16,"J/#psi #rightarrow #mu^{+} #mu^{-}, p_{T}^{J/#psi} > 0.0 GeV/c"); //legend_ratio->AddEntry(grRaaPtALICEFor,"ALICE: J/#psi #rightarrow #mu^{+} #mu^{-}, 2.5 < |y| < 2.4 & p_{T}^{J/#psi} > 0.0 GeV/c", "P"); legend_ratio->AddEntry(grRaaPtALICEFor,"J/#psi ALICE: 2.5 < |y| < 2.4", "P"); }
void replotSimpleMpT(){ string type = "Embed"; string ajLabel[3] = {"ALL","A_{J} > 0.24","A_{J} < 0.24"}; int version = 0; int ajindex = 0; TH1::SetDefaultSumw2(); // int color[10] = {1,kGray,kBlue-3,38,kOrange-8,kRed-6,8,9,2}; int color[10] = {1,1,kBlue-3,38,kOrange-8,kRed-6,8,9,2}; string fname; if(type == "DATA"){ fname = "data_cutOnly_05.root"; } if(type == "Pythia"){ fname = "pythia_cutOnly_05.root"; } if(type == "Embed"){ fname = "embed_cutOnly_05.root"; } TFile* inf = new TFile(fname.data()); TH1D* h[10][20]; TH1D* hx[10][20]; TH1D* hy[10][20]; TH1D* hwx[10][20]; TH1D* hwy[10][20]; bool upperBounded = false; int rebin = 4; int nHbins = 20; int nPtBins = 5; double trackPtMin[20] = {0.5,0.5,1.5,4,8.,20}; double trackPtMax[20] = {500,1.5,4,8.,20,500}; TGraphErrors* g = new TGraphErrors(nPtBins); g->SetMarkerColor(1); g->SetMarkerStyle(20); g->SetMarkerSize(1.5); for(int j = 0; j < 5; j++){ for(int i = 0; i < nPtBins; i++){ h[j][i] = (TH1D*)inf->Get(Form("h%d_%d",j,i)); h[j][i]->SetLineColor(color[i]); h[j][i]->SetMarkerColor(color[i]); hx[j][i] = (TH1D*)inf->Get(Form("hx%d_%d",j,i)); hx[j][i]->SetLineColor(color[i]); hx[j][i]->SetMarkerColor(color[i]); hy[j][i] = (TH1D*)inf->Get(Form("hy%d_%d",j,i)); hy[j][i]->SetLineColor(color[i]); hy[j][i]->SetMarkerColor(color[i]); hwx[j][i] = (TH1D*)inf->Get(Form("hwx%d_%d",j,i)); hwx[j][i]->SetLineColor(color[i]); hwx[j][i]->SetMarkerColor(color[i]); hwy[j][i] = (TH1D*)inf->Get(Form("hwy%d_%d",j,i)); hwy[j][i]->SetLineColor(color[i]); hwy[j][i]->SetMarkerColor(color[i]); hy[j][i]->SetTitle(";#slash{p}_{T}^{#perp} (GeV/c);Event Fraction"); hy[j][i]->GetXaxis()->CenterTitle(); hy[j][i]->GetYaxis()->CenterTitle(); hx[j][i]->SetTitle(";#slash{p}_{T}^{#parallel} (GeV/c);Event Fraction"); hx[j][i]->GetXaxis()->CenterTitle(); hx[j][i]->GetYaxis()->CenterTitle(); hy[j][i]->Rebin(rebin); hy[j][i]->SetMarkerSize(0); hy[j][i]->SetLineWidth(2.); hx[j][i]->Rebin(rebin); hx[j][i]->SetMarkerSize(0); hx[j][i]->SetLineWidth(2.); if(hx[j][i]->Integral() > 0) hx[j][i]->Scale(1./hx[j][i]->Integral()); if(hy[j][i]->Integral() > 0) hy[j][i]->Scale(1./hy[j][i]->Integral()); // hx[j][i]->Fit("gaus"); if(hx[j][i]->GetFunction("gaus"))hx[j][i]->GetFunction("gaus")->SetLineColor(color[i]); } } TLegend *leg=new TLegend(0.67,0.64,0.91,0.93); leg->SetFillColor(0); leg->SetBorderSize(0); leg->SetFillStyle(0); leg->SetTextFont(63); leg->SetTextSize(15); for(int i = 0; i < nPtBins; ++i){ if(upperBounded){ leg->AddEntry(hx[ajindex][i],Form("%0.1f<p_{T}^{Track}<%0.1f GeV/c",trackPtMin[i],trackPtMax[i]),"pl"); }else if(i > 0){ leg->AddEntry(hx[ajindex][i],Form("p_{T}^{Track}>%0.1f GeV/c",trackPtMin[i]),"pl"); } } for(int i = 0; i < nPtBins; i++){ g->SetPoint(i,hx[ajindex][i]->GetMean(),i); g->SetPointError(i,hx[ajindex][i]->GetMeanError(),0); } TCanvas* c3 = new TCanvas("c3","",600,600); c3->SetLogy(); hx[ajindex][(int)(nPtBins-1)]->SetMaximum(520); hx[ajindex][(int)(nPtBins-1)]->Draw(); for(int i = 0; i < nPtBins; ++i){ hx[ajindex][i]->Draw("same"); hx[ajindex][i]->Draw("same hist"); } leg->Draw(); TLatex *cms = new TLatex(0.2,0.88,"CMS"); TLatex *snn = new TLatex(0.2,0.80,"PbPb #sqrt{s}_{_{NN}}=2.76 TeV"); TLatex *lum = new TLatex(0.2,0.72,"#intL dt = 6.7 #mub^{-1}"); TLatex *cent = new TLatex(0.2,0.64,"0-30%"); if(ajindex > 0){ TLatex *ajtxt = new TLatex(0.2,0.56,ajLabel[ajindex].data()); ajtxt->SetNDC(); ajtxt->SetTextFont(63); ajtxt->SetTextSize(22); } TLatex *pythia = new TLatex(0.2,0.88,"PYTHIA"); TLatex *embedded = new TLatex(0.2,0.88,"Hydjet+PYTHIA"); cms->SetNDC(); cms->SetTextFont(63); cms->SetTextSize(22); snn->SetNDC(); snn->SetTextFont(63); snn->SetTextSize(22); lum->SetNDC(); lum->SetTextFont(63); lum->SetTextSize(22); cent->SetNDC(); cent->SetTextFont(63); cent->SetTextSize(22); pythia->SetNDC(); pythia->SetTextFont(63); pythia->SetTextSize(22); embedded->SetNDC(); embedded->SetTextFont(63); embedded->SetTextSize(22); if(type == "DATA"){ cms->Draw(); snn->Draw(); lum->Draw(); cent->Draw(); } if(type == "Pythia"){ pythia->Draw(); } if(type == "Embed"){ embedded->Draw(); cent->Draw(); } if(ajindex > 0){ ajtxt->Draw(); } c3->Print(Form("MpTpllEvtByEvt_%d_%s_%d.gif",ajindex,type.data(),version)); c3->Print(Form("MpTpllEvtByEvt_%d_%s_%d.eps",ajindex,type.data(),version)); c3->Print(Form("MpTpllEvtByEvt_%d_%s_%d.C",ajindex,type.data(),version)); TCanvas* c4 = new TCanvas("c4","",600,600); c4->SetLogy(); hy[ajindex][nPtBins-1]->SetMaximum(520); hy[ajindex][nPtBins-1]->Draw(); for(int i = 0; i < nPtBins; ++i){ hy[ajindex][i]->Draw("same"); hy[ajindex][i]->Draw("same hist"); } leg->Draw(); if(type == "DATA"){ cms->Draw(); snn->Draw(); lum->Draw(); cent->Draw(); } if(type == "Pythia"){ pythia->Draw(); } if(type == "Embed"){ embedded->Draw(); cent->Draw(); } if(ajindex > 0){ ajtxt->Draw(); } c4->Print(Form("MpTtrsEvtByEvt_%d_%s_%d.gif",ajindex,type.data(),version)); c4->Print(Form("MpTtrsEvtByEvt_%d_%s_%d.eps",ajindex,type.data(),version)); c4->Print(Form("MpTtrsEvtByEvt_%d_%s_%d.C",ajindex,type.data(),version)); }
void all(int channels=0, int categ=-1, int sample=2012 /*,bool doSfLepton=true*/){ double bwSigma[40]; int mass[40]; int id[40]; double xLow[40]; double xHigh[40]; int maxMassBin; float masses[1] = {125}; for(int i=0;i<1;++i) { mass[i] = masses[i]; id[i]=masses[i]; xLow[i] = 105.; // getFitEdge(masses[i],width,true); xHigh[i] = 140.; // getFitEdge(masses[i],width,false); //cout << "For mass = " << masses[i] << " width = " << width << "; => Fit Range = [" << xLow[i] << "," << xHigh[i] << "]" << endl; bwSigma[i] = 0.004; } maxMassBin = 1; // 29; // ----------------------- double massV[40],massE[40]; for(int i=0; i<maxMassBin;++i){ massV[i]=mass[i]; massE[i]=0; } double A1Val[40],A1Err[40]; double A2Val[40],A2Err[40]; double a1Val[40],a1Err[40]; double a2Val[40],a2Err[40]; double n1Val[40],n1Err[40]; double n2Val[40],n2Err[40]; double meanCBVal[40],meanCBErr[40]; double sigmaCBVal[40],sigmaCBErr[40]; double meanBWVal[40],meanBWErr[40]; double covQualVal[40]; double fitValues[10]; double fitErrors[10]; double covQual[1]; for(int i=0; i<maxMassBin;++i){ fitSignalShapeW(mass[i],id[i],channels,categ, sample,/* 10.,doSfLepton,*/xLow[i],xHigh[i],bwSigma[i], fitValues,fitErrors,covQual); cout << "a1 value,error: " << fitValues[0] << " , " << fitErrors[0] << endl; a1Val[i]=fitValues[0]; a1Err[i]=fitErrors[0]; cout << "a2 value,error: " << fitValues[1] << " , " << fitErrors[1] << endl; a2Val[i]=fitValues[1]; a2Err[i]=fitErrors[1]; cout << "n1 value,error: " << fitValues[4] << " , " << fitErrors[4] << endl; n1Val[i]=fitValues[4]; n1Err[i]=fitErrors[4]; cout << "n2 value,error: " << fitValues[5] << " , " << fitErrors[5] << endl; n2Val[i]=fitValues[5]; n2Err[i]=fitErrors[5]; cout << "meanCB value,error: " << fitValues[2] << " , " << fitErrors[2] << endl; meanCBVal[i]=fitValues[2]; meanCBErr[i]=fitErrors[2]; cout << "sigmaCB value,error: " << fitValues[6] << " , " << fitErrors[6] << endl; sigmaCBVal[i]=fitValues[6]; sigmaCBErr[i]=fitErrors[6]; cout << "meanBW value,error: " << fitValues[3] << " , " << fitErrors[3] << endl; meanBWVal[i]=fitValues[3]; meanBWErr[i]=fitErrors[3]; cout << "A1 value,error: " << fitValues[7] << " , " << fitErrors[7] << endl; A1Val[i]=fitValues[7]; A1Err[i]=fitErrors[7]; cout << "A2 value,error: " << fitValues[8] << " , " << fitErrors[8] << endl; A2Val[i]=fitValues[8]; A2Err[i]=fitErrors[8]; cout << "covQual of the fit: " << covQual[0] << endl; covQualVal[i] = covQual[0]; } stringstream namefile; namefile << "parameters_channel" << channels<< categ << ".root"; TFile *resultfile = TFile::Open(namefile.str().c_str(),"RECREATE"); TGraphErrors* gA1 = new TGraphErrors(maxMassBin,massV,a1Val,massE,a1Err); TGraphErrors* gA2 = new TGraphErrors(maxMassBin,massV,a2Val,massE,a2Err); TGraphErrors* gN1 = new TGraphErrors(maxMassBin,massV,n1Val,massE,n1Err); TGraphErrors* gN2 = new TGraphErrors(maxMassBin,massV,n2Val,massE,n2Err); TGraphErrors* gMeanCB = new TGraphErrors(maxMassBin,massV,meanCBVal,massE,meanCBErr); TGraphErrors* gSigmaCB = new TGraphErrors(maxMassBin,massV,sigmaCBVal,massE,sigmaCBErr); TGraphErrors* gMeanBW = new TGraphErrors(maxMassBin,massV,meanBWVal,massE,meanBWErr); TGraphErrors* gAA1 = new TGraphErrors(maxMassBin,massV,A1Val,massE,A1Err); TGraphErrors* gAA2 = new TGraphErrors(maxMassBin,massV,A2Val,massE,A2Err); TGraph* gCovQual = new TGraph(maxMassBin,massV,covQualVal); gA1->SetName("gA1"); gA1->SetMarkerStyle(20); gA1->SetMarkerSize(1); gA2->SetName("gA2"); gA2->SetMarkerStyle(20); gA2->SetMarkerSize(1); gN1->SetName("gN1"); gN1->SetMarkerStyle(20); gN1->SetMarkerSize(1); gN2->SetName("gN2"); gN2->SetMarkerStyle(20); gN2->SetMarkerSize(1); gMeanCB->SetName("gMeanCB"); gMeanCB->SetMarkerStyle(20); gMeanCB->SetMarkerSize(1); gSigmaCB->SetName("gSigmaCB"); gSigmaCB->SetMarkerStyle(20); gSigmaCB->SetMarkerSize(1); gMeanBW->SetName("gMeanBW"); gMeanBW->SetMarkerStyle(20); gMeanBW->SetMarkerSize(1); gAA1->SetName("gAA1"); gAA1->SetMarkerStyle(20); gAA1->SetMarkerSize(1); gAA2->SetName("gAA2"); gAA2->SetMarkerStyle(20); gAA2->SetMarkerSize(1); gCovQual->SetName("gCovQual"); gCovQual->SetMarkerStyle(20); gCovQual->SetMarkerSize(1); gA1->SetTitle(""); gA1->GetXaxis()->SetTitle("mass (GeV)"); gA1->GetYaxis()->SetTitle("CB a-parameter"); gA2->SetTitle(""); gA2->GetXaxis()->SetTitle("mass (GeV)"); gA2->GetYaxis()->SetTitle("CB a-parameter"); gN1->SetTitle(""); gN1->GetXaxis()->SetTitle("mass (GeV)"); gN1->GetYaxis()->SetTitle("CB n-parameter"); gN2->SetTitle(""); gN2->GetXaxis()->SetTitle("mass (GeV)"); gN2->GetYaxis()->SetTitle("CB n-parameter"); gMeanCB->SetTitle(""); gMeanCB->GetXaxis()->SetTitle("mass (GeV)"); gMeanCB->GetYaxis()->SetTitle("CB mean"); gSigmaCB->SetTitle(""); gSigmaCB->GetXaxis()->SetTitle("mass (GeV)"); gSigmaCB->GetYaxis()->SetTitle("CB sigma"); gMeanBW->SetTitle(""); gMeanBW->GetXaxis()->SetTitle("mass (GeV)"); gMeanBW->GetYaxis()->SetTitle("BW mean"); gAA1->SetTitle(""); gAA1->GetXaxis()->SetTitle("mass (GeV)"); gAA1->GetYaxis()->SetTitle("Chebyshev a1-parameter"); gAA2->SetTitle(""); gAA2->GetXaxis()->SetTitle("mass (GeV)"); gAA2->GetYaxis()->SetTitle("Chebyshev a2-parameter"); gCovQual->SetTitle(""); gCovQual->GetXaxis()->SetTitle("mass (GeV)"); gCovQual->GetYaxis()->SetTitle("cov. matrix qual."); resultfile->cd(); gA1->Fit("pol0"); gA1->Draw("Ap"); gA1->Write(); gA2->Fit("pol0"); gA2->Draw("Ap"); gA2->Write(); gN1->Fit("pol1"); gN1->Draw("Ap"); gN1->Write(); gN2->Fit("pol1"); gN2->Draw("Ap"); gN2->Write(); gMeanCB->Fit("pol1"); gMeanCB->Draw("Ap"); gMeanCB->Write(); gSigmaCB->Fit("pol1"); gSigmaCB->Draw("Ap"); gSigmaCB->Write(); gAA1->Fit("pol0"); gAA1->Draw("Ap"); gAA1->Write(); gAA2->Fit("pol0"); gAA2->Draw("Ap"); gAA2->Write(); gCovQual->Write(); resultfile->Close(); }
void makeV2_DataOnly_Cen(const int flag=0) { gROOT->Reset(); const Double_t MassD = 1.865; const Double_t MassKs = 0.498; const Double_t MassPhi = 1.019; const Double_t MassLa = 1.1156; const Double_t MassXi = 1.3217; const Double_t MassOmega = 1.672; ifstream inData; // new data TFile *fin = new TFile("Systematics_D0vn_SL16d_2016-10-14.ME.root"); TGraphErrors *gr_data_0_80 = (TGraphErrors *)(fin->Get("vnStat_0_80")); gr_data_0_80->RemovePoint(0); TGraphErrors *gr_data_0_80_sys = (TGraphErrors *)(fin->Get("vnSyst_0_80")); gr_data_0_80_sys->RemovePoint(0); cout << gr_data_0_80->GetN() << endl; cout << gr_data_0_80_sys->GetN() << endl; const Double_t scale_w_Ks = 1.0; const Int_t n_data_new = 8; ////////////////////////////////////////////// // Read-in data points for 0-80% centrality ////////////////////////////////////////////// Double_t nonflow[n_data_new] = { 0.032629 , 0.0336555 , 0.0336555 , 0.033947 , 0.0346236 , 0.0353009 , 0.0361988 , 0.0382869}; // full range 0-80% Double_t x_data_new[n_data_new], y_data_new[n_data_new], ye_data_new[n_data_new], yes_data_new[n_data_new], yesL_data_new[n_data_new]; Double_t yeL_data_new[n_data_new], yeU_data_new[n_data_new]; Double_t x_mTScaled_data_new[n_data_new], yScaled_data_new[n_data_new], yeScaled_data_new[n_data_new], yesScaled_data_new[n_data_new], yesLScaled_data_new[n_data_new]; Double_t yeLScaled_data_new[n_data_new], yeUScaled_data_new[n_data_new]; for(int i=0;i<gr_data_0_80->GetN();i++) { cout << i << endl; x_data_new[i] = gr_data_0_80->GetX()[i]; y_data_new[i] = gr_data_0_80->GetY()[i]; ye_data_new[i] = gr_data_0_80->GetEY()[i]; yes_data_new[i] = gr_data_0_80_sys->GetEY()[i]; yesL_data_new[i] = nonflow[i]; x_mTScaled_data_new[i] = (sqrt(x_data_new[i]*x_data_new[i] + MassD*MassD) - MassD)/2; yScaled_data_new[i] = y_data_new[i]/2 * scale_w_Ks; yeScaled_data_new[i] = ye_data_new[i]/2 * scale_w_Ks; yesScaled_data_new[i] = yes_data_new[i]/2 * scale_w_Ks; yesLScaled_data_new[i] = yesL_data_new[i]/2 * scale_w_Ks; yeL_data_new[i] = sqrt(ye_data_new[i]**2+yes_data_new[i]**2+yesL_data_new[i]**2) * scale_w_Ks; yeU_data_new[i] = sqrt(ye_data_new[i]**2+yes_data_new[i]**2) * scale_w_Ks; yeLScaled_data_new[i] = yeL_data_new[i]/2 * scale_w_Ks; yeUScaled_data_new[i] = yeU_data_new[i]/2 * scale_w_Ks; } ////////////////////////////// // different centrality bins ////////////////////////////// const Int_t NCen = 3; TGraphErrors *gr_data_cen[NCen]; TGraphErrors *gr_data_cen_sys[NCen]; TGraphErrors *gr_data_mT_cen[NCen]; const Char_t *CenName[NCen] = {"40_80","10_40","0_10"}; for(int i=0;i<NCen;i++) { gr_data_cen[i] = (TGraphErrors *)(fin->Get(Form("vnStat_%s",CenName[i]))); gr_data_cen[i]->RemovePoint(0); gr_data_cen_sys[i] = (TGraphErrors *)(fin->Get(Form("vnSyst_%s",CenName[i]))); gr_data_cen_sys[i]->RemovePoint(0); } const Int_t n_data_cen = 8; Double_t nonflow_cen[NCen][n_data_cen] = {{ 0.115456 , 0.118967 , 0.118967 , 0.120065 , 0.122454 , 0.124808 , 0.128025 , 0.135539}, { 0.0210766 , 0.0217398 , 0.0217398 , 0.0219309 , 0.0223667 , 0.0228055 , 0.0233849 , 0.0247439}, { 0.0202398 , 0.0208774 , 0.0208774 , 0.0210541 , 0.0214741 , 0.021893 , 0.0224473 , 0.0237127}}; Double_t x_data_cen[NCen][n_data_cen], y_data_cen[NCen][n_data_cen], ye_data_cen[NCen][n_data_cen], yes_data_cen[NCen][n_data_cen], yesL_data_cen[NCen][n_data_cen]; Double_t yeL_data_cen[NCen][n_data_cen], yeU_data_cen[NCen][n_data_cen]; Double_t x_mTScaled_data_cen[NCen][n_data_cen], yScaled_data_cen[NCen][n_data_cen], yeScaled_data_cen[NCen][n_data_cen], yesScaled_data_cen[NCen][n_data_cen], yesLScaled_data_cen[NCen][n_data_cen]; Double_t yeLScaled_data_cen[NCen][n_data_cen], yeUScaled_data_cen[NCen][n_data_cen]; for(int ic=0;ic<NCen;ic++) { for(int i=0;i<gr_data_cen[ic]->GetN();i++) { x_data_cen[ic][i] = gr_data_cen[ic]->GetX()[i]; y_data_cen[ic][i] = gr_data_cen[ic]->GetY()[i]; ye_data_cen[ic][i] = gr_data_cen[ic]->GetEY()[i]; yes_data_cen[ic][i] = gr_data_cen_sys[ic]->GetEY()[i]; yesL_data_cen[ic][i] = nonflow_cen[ic][i]; x_mTScaled_data_cen[ic][i] = (sqrt(x_data_cen[ic][i]*x_data_cen[ic][i] + MassD*MassD) - MassD)/2; yScaled_data_cen[ic][i] = y_data_cen[ic][i]/2 * scale_w_Ks; yeScaled_data_cen[ic][i] = ye_data_cen[ic][i]/2 * scale_w_Ks; yesScaled_data_cen[ic][i] = yes_data_cen[ic][i]/2 * scale_w_Ks; yesLScaled_data_cen[ic][i] = yesL_data_cen[ic][i]/2 * scale_w_Ks; yeL_data_cen[ic][i] = sqrt(ye_data_cen[ic][i]**2+yes_data_cen[ic][i]**2+yesL_data_cen[ic][i]**2) * scale_w_Ks; yeU_data_cen[ic][i] = sqrt(ye_data_cen[ic][i]**2+yes_data_cen[ic][i]**2) * scale_w_Ks; yeLScaled_data_cen[ic][i] = yeL_data_cen[ic][i]/2 * scale_w_Ks; yeUScaled_data_cen[ic][i] = yeU_data_cen[ic][i]/2 * scale_w_Ks; } gr_data_mT_cen[ic] = new TGraphErrors(n_data_cen, x_mTScaled_data_cen[ic], yScaled_data_cen[ic], 0, yeScaled_data_cen[ic]); } cout << " Read-in D0 data done ..." << endl; /* const Int_t n_ks_cen = 19; const Int_t n_la_cen = 18; Double_t x_ks_cen[n_ks_cen], y_ks_cen[NCen][n_ks_cen], ye_ks_cen[NCen][n_ks_cen], yes_ks_cen[NCen][n_ks_cen]; Double_t x_la_cen[n_la_cen], y_la_cen[NCen][n_la_cen], ye_la_cen[NCen][n_la_cen], yes_la_cen[NCen][n_la_cen]; Double_t x_mTScaled_ks_cen[n_ks_cen], yScaled_ks_cen[NCen][n_ks_cen], yeScaled_ks_cen[NCen][n_ks_cen], yesScaled_ks_cen[NCen][n_ks_cen]; Double_t x_mTScaled_la_cen[n_la_cen], yScaled_la_cen[NCen][n_la_cen], yeScaled_la_cen[NCen][n_la_cen], yesScaled_la_cen[NCen][n_la_cen]; inData.open("Run14/ks_v2_cen_PRC77.txt"); for(int i=0;i<n_ks_cen;i++) { double a, b, c; inData >> x_ks_cen[i] >> a >> b >> c >> y_ks_cen[0][i] >> ye_ks_cen[0][i] >> yes_ks_cen[0][i] >> y_ks_cen[1][i] >> ye_ks_cen[1][i] >> yes_ks_cen[1][i] >> y_ks_cen[2][i] >> ye_ks_cen[2][i] >> yes_ks_cen[2][i]; x_mTScaled_ks_cen[i] = (sqrt(x_ks_cen[i]*x_ks_cen[i]+MassKs*MassKs)-MassKs)/2; for(int ic=0;ic<NCen;ic++) { yScaled_ks_cen[ic][i] = y_ks_cen[ic][i]/2.; yeScaled_ks_cen[ic][i] = ye_ks_cen[ic][i]/2.; yesScaled_ks_cen[ic][i] = yes_ks_cen[ic][i]/2.; } } inData.close(); TGraphErrors *gr_ks_cen[NCen], *gr_ks_mT_cen[NCen]; for(int ic=0;ic<NCen;ic++) { gr_ks_cen[ic] = new TGraphErrors(n_ks_cen, x_ks_cen, y_ks_cen[ic], 0, ye_ks_cen[ic]); gr_ks_mT_cen[ic] = new TGraphErrors(n_ks_cen, x_mTScaled_ks_cen, yScaled_ks_cen[ic], 0, yeScaled_ks_cen[ic]); // gr_ks_mT_cen[ic]->Print(); } cout << " Read-in Ks data points done ... " << endl; inData.open("Run14/lambda_v2_cen_PRC77.txt"); for(int i=0;i<n_la_cen;i++) { double a, b, c; inData >> x_la_cen[i] >> a >> b >> c >> y_la_cen[0][i] >> ye_la_cen[0][i] >> yes_la_cen[0][i] >> y_la_cen[1][i] >> ye_la_cen[1][i] >> yes_la_cen[1][i] >> y_la_cen[2][i] >> ye_la_cen[2][i] >> yes_la_cen[2][i]; x_mTScaled_la_cen[i] = (sqrt(x_la_cen[i]*x_la_cen[i]+MassLa*MassLa)-MassLa)/3; for(int ic=0;ic<NCen;ic++) { yScaled_la_cen[ic][i] = y_la_cen[ic][i]/3.; yeScaled_la_cen[ic][i] = ye_la_cen[ic][i]/3.; yesScaled_la_cen[ic][i] = yes_la_cen[ic][i]/3.; } } inData.close(); TGraphErrors *gr_la_cen[NCen], *gr_la_mT_cen[NCen]; for(int ic=0;ic<NCen;ic++) { gr_la_cen[ic] = new TGraphErrors(n_la_cen, x_la_cen, y_la_cen[ic], 0, ye_la_cen[ic]); gr_la_mT_cen[ic] = new TGraphErrors(n_la_cen, x_mTScaled_la_cen, yScaled_la_cen[ic], 0, yeScaled_la_cen[ic]); } cout << " Read-in Lambda data points done ... " << endl; // Xi data points, format is a bit different const Int_t n_xi_cenMax = 9; Int_t n_xi_cen[NCen]; Double_t x_xi_cen[NCen][n_xi_cenMax], y_xi_cen[NCen][n_xi_cenMax], ye_xi_cen[NCen][n_xi_cenMax]; Double_t x_mTScaled_xi_cen[NCen][n_xi_cenMax], yScaled_xi_cen[NCen][n_xi_cenMax], yeScaled_xi_cen[NCen][n_xi_cenMax]; TGraphErrors *gr_xi_cen[NCen]; TGraphErrors *gr_xi_mT_cen[NCen]; for(int ic=0;ic<NCen;ic++) { gr_xi_cen[ic] = new TGraphErrors(Form("Run14/xi_v2_%s.txt",CenName[ic]),"%lg %lg %lg"); n_xi_cen[ic] = gr_xi_cen[ic]->GetN(); for(int i=0;i<gr_xi_cen[ic]->GetN();i++) { x_xi_cen[ic][i] = gr_xi_cen[ic]->GetX()[i]; y_xi_cen[ic][i] = gr_xi_cen[ic]->GetY()[i]; ye_xi_cen[ic][i] = gr_xi_cen[ic]->GetEY()[i]; x_mTScaled_xi_cen[ic][i] = (sqrt(x_xi_cen[ic][i]*x_xi_cen[ic][i]+MassXi*MassXi)-MassXi)/3; yScaled_xi_cen[ic][i] = y_xi_cen[ic][i]/3.; yeScaled_xi_cen[ic][i] = ye_xi_cen[ic][i]/3.; } gr_xi_mT_cen[ic] = new TGraphErrors(n_xi_cen[ic], x_mTScaled_xi_cen[ic], yScaled_xi_cen[ic], 0, yeScaled_xi_cen[ic]); } cout << " Read-in Xi data points done ... " << endl; const Int_t n_phi_cenMax = 7; Int_t n_phi_cen[NCen]; Double_t x_phi_cen[NCen][n_phi_cenMax], y_phi_cen[NCen][n_phi_cenMax], ye_phi_cen[NCen][n_phi_cenMax], yes_phi_cen[NCen][n_phi_cenMax]; Double_t x_mTScaled_phi_cen[NCen][n_phi_cenMax], yScaled_phi_cen[NCen][n_phi_cenMax], yeScaled_phi_cen[NCen][n_phi_cenMax], yesScaled_phi_cen[NCen][n_phi_cenMax]; TGraphErrors *gr_phi_cen[NCen]; TGraphErrors *gr_phi_mT_cen[NCen]; const Char_t *CenName_Phi[NCen] = {"40_80","10_40","0_5"}; for(int ic=0;ic<NCen;ic++) { gr_phi_cen[ic] = new TGraphErrors(Form("Run14/phi_v2_%s_PRC.txt",CenName_Phi[ic]),"%lg %lg %lg"); n_phi_cen[ic] = gr_phi_cen[ic]->GetN(); inData.open(Form("Run14/phi_v2_%s_PRC.txt",CenName_Phi[ic])); for(int i=0;i<gr_phi_cen[ic]->GetN();i++) { x_phi_cen[ic][i] = gr_phi_cen[ic]->GetX()[i]; y_phi_cen[ic][i] = gr_phi_cen[ic]->GetY()[i]; ye_phi_cen[ic][i] = gr_phi_cen[ic]->GetEY()[i]; double a, b, c, d; inData >> a >> b >> c >> d; yes_phi_cen[ic][i] = d; x_mTScaled_phi_cen[ic][i] = (sqrt(x_phi_cen[ic][i]*x_phi_cen[ic][i]+MassPhi*MassPhi)-MassPhi)/2.; yScaled_phi_cen[ic][i] = y_phi_cen[ic][i]/2.; yeScaled_phi_cen[ic][i] = ye_phi_cen[ic][i]/2.; yesScaled_phi_cen[ic][i] = yes_phi_cen[ic][i]/2.; } gr_phi_mT_cen[ic] = new TGraphErrors(n_phi_cen[ic], x_mTScaled_phi_cen[ic], yScaled_phi_cen[ic], 0, yeScaled_phi_cen[ic]); } cout << " Read-in Phi data points done ... " << endl;*/ TCanvas *c1 = new TCanvas("c1", "c1",0,0,1600,900); gStyle->SetOptFit(0); gStyle->SetOptStat(0); gStyle->SetEndErrorSize(0); gStyle->SetTitleBorderSize(0); c1->SetFillColor(10); c1->SetFillStyle(0); c1->SetBorderMode(0); c1->SetBorderSize(0); c1->SetFrameFillColor(10); c1->SetFrameFillStyle(0); c1->SetFrameBorderMode(0); /*TPad* p1 = new TPad("p1","p1",0.,0.5,1.0,1.0); p1->SetFillColor(10); p1->SetFillStyle(0); p1->SetBorderMode(0); p1->SetBorderSize(0); p1->SetFrameFillColor(10); p1->SetFrameFillStyle(0); p1->SetFrameBorderMode(0); //p1->SetLogy(); p1->SetGridx(0); p1->SetGridy(0); p1->SetLeftMargin(0.16); p1->SetBottomMargin(0.15); p1->SetTopMargin(0.02); p1->SetRightMargin(0.02); p1->Draw(); //p1->cd();*/ double x1 = 0.0; double x2 = 6.8; double y1 = -0.05; double y2 = 0.38; TH1 *h0 = new TH1D("h0","",1,x1, x2); h0->SetMinimum(y1); h0->SetMaximum(y2); h0->GetXaxis()->SetNdivisions(208); h0->GetXaxis()->CenterTitle(); h0->GetXaxis()->SetTitle("p_{T} (GeV/c)"); h0->GetXaxis()->SetTitleOffset(.9); h0->GetXaxis()->SetTitleSize(0.05); h0->GetXaxis()->SetLabelOffset(0.005); h0->GetXaxis()->SetLabelSize(0.04); h0->GetXaxis()->SetLabelFont(42); h0->GetXaxis()->SetTitleFont(42); h0->GetYaxis()->SetNdivisions(505); h0->GetYaxis()->CenterTitle(); h0->GetYaxis()->SetTitle("Anisotropy Parameter, v_{2}"); h0->GetYaxis()->SetTitleOffset(.9); h0->GetYaxis()->SetTitleSize(0.05); h0->GetYaxis()->SetLabelOffset(0.005); h0->GetYaxis()->SetLabelSize(0.04); h0->GetYaxis()->SetLabelFont(42); h0->GetYaxis()->SetTitleFont(42); h0->Draw("c"); double pt[2] = {1.766, 4.459}; double pt1Bin[1] = {1.866}; double v2[2] = {0.08329931, 0.126231279}; double eptLow[2] = {.766, .459}; double eptHigh[2] = {2.234, 2.341}; double eptSyst[2] = { 0.0, 0.0}; double eptSyst1Bin[1] = { 0.0}; double ev2Low[2] = { 0.00736501, 0.012241649}; double ev2High[2] = { 0.00736501, 0.012241649}; double ev2Syst[2] = {.0124948965, .02145931743 }; TGraphAsymmErrors *AlexData = new TGraphAsymmErrors(2, pt, v2, eptLow, eptHigh, ev2Low, ev2High); AlexData->SetMarkerColor(2); AlexData->SetMarkerStyle(21); AlexData->SetMarkerSize(2); AlexData->SetLineColor(2); AlexData->SetLineWidth(3); TGraphErrors *AlexDataSyst = new TGraphErrors(2, pt, v2, eptSyst, ev2Syst); AlexDataSyst->SetMarkerColor(2); AlexDataSyst->SetMarkerStyle(21); AlexDataSyst->SetMarkerSize(1.1); AlexDataSyst->SetLineColor(2); AlexDataSyst->SetLineWidth(33); // 8 data points double weights[6] = {0.4034, .3058, .1696, .0778, .0316, .0119}; double avgV2[1] = {0}; double avgV2StatErrorSquared[1] = {0}; double avgV2SystErrorSquared[1] = {0}; double avgV2StatError[1] = {0}; double avgV2SystError[1] = {0}; for(int i = 0; i < 6; i++){ cout << "V2: " << y_data_cen[1][i] << endl; avgV2[0] = avgV2[0] + (weights[i]*y_data_cen[1][i]); avgV2StatErrorSquared[0] = avgV2StatErrorSquared[0] + (weights[i]*weights[i])*(ye_data_cen[1][i]*ye_data_cen[1][i]); avgV2SystErrorSquared[0] = avgV2SystErrorSquared[0] + (weights[i]*weights[i])*(yes_data_cen[1][i]*yes_data_cen[1][i]); } avgV2StatError[0] = TMath::Sqrt(avgV2StatErrorSquared[0]); avgV2SystError[0] = TMath::Sqrt(avgV2SystErrorSquared[0]); TGraphErrors *AvgV2Data = new TGraphErrors(1, pt1Bin, avgV2, eptSyst1Bin, avgV2StatError); AvgV2Data->SetMarkerColor(4); AvgV2Data->SetMarkerStyle(22); AvgV2Data->SetMarkerSize(2.5); AvgV2Data->SetLineColor(4); //AvgV2Data->SetLineWidth(15); TGraphErrors *AvgV2DataSyst = new TGraphErrors(1, pt1Bin, avgV2, eptSyst1Bin, avgV2SystError); AvgV2DataSyst->SetMarkerColor(4); AvgV2DataSyst->SetMarkerStyle(22); AvgV2DataSyst->SetMarkerSize(2.5); AvgV2DataSyst->SetLineColor(4); AvgV2DataSyst->SetLineWidth(29); /*TH1 *hAlex1 = new TH1D("","", 7, 0, 6.8); hAlex1->SetMarkerStyle(20); hAlex1->SetMarkerColor(2); hAlex1->SetMarkerSize(1.5); //hAlex->SetBinContent(3, 0.0801251); //hAlex->SetBinError(3, 0.00244519); hAlex1->SetBinContent(1, 0.122872); hAlex1->SetBinError(1, 0.0149516); // hAlex1->SetBinContent(5, 0.0789727); //hAlex1->SetBinError(5, 0.00444987); TH1 *hAlex2 = new TH1D("","", 1, 1, 4); hAlex2->SetMarkerStyle(20); hAlex2->SetMarkerColor(2); hAlex2->SetMarkerSize(1.5); hAlex2->SetBinContent(1, 0.0801251); hAlex2->SetBinError(1, 0.00244519); TH1 *hAlex3 = new TH1D("","", 1, 4, 6.8); hAlex3->SetMarkerStyle(20); hAlex3->SetMarkerColor(2); hAlex3->SetMarkerSize(1.5); hAlex3->SetBinContent(1, 0.0789727); hAlex3->SetBinError(1, 0.00444987); ////////////////////////////////////////////////////////////////// TH1 *hAlex1Syst = new TH1D("","", 7, 0, 6.8); hAlex1Syst->SetMarkerStyle(20); hAlex1Syst->SetMarkerColor(2); hAlex1Syst->SetMarkerSize(1.5); //hAlex1Syst->SetEndErrorSize(2); hAlex1Syst->SetBinContent(1, 0.122872); hAlex1Syst->SetBinError(1, 0.02); TH1 *hAlex2Syst = new TH1D("","", 1, 1, 4); hAlex2Syst->SetMarkerStyle(20); hAlex2Syst->SetMarkerColor(2); hAlex2Syst->SetMarkerSize(1.5); hAlex2Syst->SetBinContent(1, 0.0801251); hAlex2Syst->SetBinError(1, 0.006172166); TH1 *hAlex3Syst = new TH1D("","", 1, 4, 6.8); hAlex3Syst->SetMarkerStyle(20); hAlex3Syst->SetMarkerColor(2); hAlex3Syst->SetMarkerSize(1.5); hAlex3Syst->SetBinContent(1, 0.0789727); hAlex3Syst->SetBinError(1, 0.004869332);*/ /*TLine *l1 = new TLine(x1,y1,x2,y1); l1->SetLineWidth(2); l1->Draw("same"); TLine *l2 = new TLine(x1,y2,x2,y2); l2->SetLineWidth(2); l2->Draw("same"); TLine *l3 = new TLine(x1,y1,x1,y2); l3->SetLineWidth(2); l3->Draw("same"); TLine *l4 = new TLine(x2,y1,x2,y2); l4->SetLineWidth(2); l4->Draw("same"); TLine *l0 = new TLine(x1, 0, x2, 0); l0->SetLineWidth(2); l0->SetLineStyle(2); l0->Draw("same");*/ /*for(int i=0;i<n_ks_cen;i++) { double x1 = x_ks_cen[i]-0.08; double x2 = x_ks_cen[i]+0.08; double y1 = y_ks_cen[1][i]-yes_ks_cen[1][i]; double y2 = y_ks_cen[1][i]+yes_ks_cen[1][i]; TLine *la = new TLine(x1, y1, x1, y1+0.003); la->Draw("same"); TLine *lb = new TLine(x2, y1, x2, y1+0.003); lb->Draw("same"); TLine *lc = new TLine(x1, y2, x1, y2-0.003); lc->Draw("same"); TLine *ld = new TLine(x2, y2, x2, y2-0.003); ld->Draw("same"); TLine *le = new TLine(x1, y1, x2, y1); le->SetLineWidth(2); le->Draw("same"); TLine *lf = new TLine(x1, y2, x2, y2); lf->SetLineWidth(2); lf->Draw("same"); }*/ /*gr_ks_cen[1]->Print(); gr_ks_cen[1]->SetMarkerStyle(25); gr_ks_cen[1]->SetMarkerColor(1); gr_ks_cen[1]->SetMarkerSize(1.2); gr_ks_cen[1]->SetLineColor(1); gr_ks_cen[1]->SetLineWidth(2); gr_ks_cen[1]->Draw("p");*/ /* for(int i=0;i<n_la_cen;i++) { double x1 = x_la_cen[i]-0.08; double x2 = x_la_cen[i]+0.08; double y1 = y_la_cen[1][i]-yes_la_cen[1][i]; double y2 = y_la_cen[1][i]+yes_la_cen[1][i]; TLine *la = new TLine(x1, y1, x1, y1+0.003); la->Draw("same"); TLine *lb = new TLine(x2, y1, x2, y1+0.003); lb->Draw("same"); TLine *lc = new TLine(x1, y2, x1, y2-0.003); lc->Draw("same"); TLine *ld = new TLine(x2, y2, x2, y2-0.003); ld->Draw("same"); TLine *le = new TLine(x1, y1, x2, y1); le->SetLineWidth(2); le->Draw("same"); TLine *lf = new TLine(x1, y2, x2, y2); lf->SetLineWidth(2); lf->Draw("same"); } gr_la_cen[1]->Print(); gr_la_cen[1]->SetMarkerStyle(24); gr_la_cen[1]->SetMarkerColor(1); gr_la_cen[1]->SetMarkerSize(1.2); gr_la_cen[1]->SetLineColor(1); gr_la_cen[1]->SetLineWidth(2); gr_la_cen[1]->Draw("p"); gr_xi_cen[1]->Print(); gr_xi_cen[1]->SetMarkerStyle(26); gr_xi_cen[1]->SetMarkerColor(1); gr_xi_cen[1]->SetMarkerSize(1.2); gr_xi_cen[1]->SetLineColor(1); gr_xi_cen[1]->SetLineWidth(2); gr_xi_cen[1]->Draw("p"); gr_phi_cen[1]->Print(); gr_phi_cen[1]->SetMarkerStyle(25); gr_phi_cen[1]->SetMarkerColor(1); gr_phi_cen[1]->SetMarkerSize(1.2); gr_phi_cen[1]->SetLineColor(1); gr_phi_cen[1]->SetLineWidth(2); // gr_phi_cen[1]->Draw("p");*/ for(int i=0;i<n_data_cen[1];i++) { double x1 = x_data_cen[1][i]-0.08; double x2 = x_data_cen[1][i]+0.08; double y1 = y_data_cen[1][i]-yes_data_cen[1][i]; double y2 = y_data_cen[1][i]+yes_data_cen[1][i]; double y3 = y_data_cen[1][i] - yesL_data_cen[1][i]; double y4 = y_data_cen[1][i]; TBox *box = new TBox(x1, y3, x2, y4); box->SetLineColor(16); box->SetFillColor(16); box->Draw("same"); TLine *la = new TLine(x1, y1, x1, y1+0.003); la->SetLineColor(4); la->Draw("same"); TLine *lb = new TLine(x2, y1, x2, y1+0.003); lb->SetLineColor(4); lb->Draw("same"); TLine *lc = new TLine(x1, y2, x1, y2-0.003); lc->SetLineColor(4); lc->Draw("same"); TLine *ld = new TLine(x2, y2, x2, y2-0.003); ld->SetLineColor(4); ld->Draw("same"); TLine *le = new TLine(x1, y1, x2, y1); le->SetLineWidth(2); le->SetLineColor(4); le->Draw("same"); TLine *lf = new TLine(x1, y2, x2, y2); lf->SetLineWidth(2); lf->SetLineColor(4); lf->Draw("same"); } gr_data_cen[1]->SetMarkerStyle(20); //gr_data_cen[1]->SetMarkerColorAlpha(4, 0.35); gr_data_cen[1]->SetMarkerColor(4); gr_data_cen[1]->SetMarkerSize(1.5); gr_data_cen[1]->SetLineWidth(2); gr_data_cen[1]->SetLineColor(4); gr_data_cen[1]->Draw("p"); /////MY DATA HERE//////////////////////// for(int i = 0; i < 2; i++) { double x1 = pt[i]-0.08; double x2 = pt[i]+0.08; double y1 = v2[i]-ev2Syst[i]; double y2 = v2[i]+ev2Syst[i]; TLine *la = new TLine(x1, y1, x1, y1+0.003); la->SetLineColor(2); la->Draw("same"); TLine *lb = new TLine(x2, y1, x2, y1+0.003); lb->SetLineColor(2); lb->Draw("same"); TLine *lc = new TLine(x1, y2, x1, y2-0.003); lc->SetLineColor(2); lc->Draw("same"); TLine *ld = new TLine(x2, y2, x2, y2-0.003); ld->SetLineColor(2); ld->Draw("same"); TLine *le = new TLine(x1, y1, x2, y1); le->SetLineWidth(2); le->SetLineColor(2); le->Draw("same"); TLine *lf = new TLine(x1, y2, x2, y2); lf->SetLineWidth(2); lf->SetLineColor(2); lf->Draw("same"); } //TLatex *tex = new TLatex(5.5, 0.28, "10-40%"); //tex->SetTextFont(42); //tex->SetTextSize(0.055); //tex->Draw(); TLegend *leg = new TLegend(0.1, 0.72, 0.55, 0.9); leg->SetFillStyle(0); leg->SetLineStyle(4000); leg->SetLineColor(10); //leg->SetLineWidth(1.0); leg->SetBorderSize(0.0); leg->SetTextSize(0.045); leg->AddEntry(gr_data_cen[1], "D^{0} Event Plane, 10-40% ", "p"); leg->AddEntry(AlexData, "D^{0}-Hadron Angular Corr, 20-50%", "p"); //leg->AddEntry(AvgV2Data, "D^{0} Event Plane Avg. of 1 GeV/c < p_{t} < 4 GeV/c", "p"); //leg->AddEntry(gr_xi_cen[1], "#Xi^{-}", "p"); //leg->AddEntry(gr_la_cen[1], "#Lambda", "p"); //leg->AddEntry(gr_ks_cen[1], "K_{S}", "p"); // leg->AddEntry(gr_phi_cen[1], "#phi", "p"); leg->Draw(); AlexData->Draw("SAME P"); //AlexDataSyst->Draw("SAME []"); //AvgV2Data->Draw("SAME P"); //AvgV2DataSyst->Draw("SAME []"); TString starPrelim = "STAR Preliminary"; TPaveText *starPrelimTextBox = new TPaveText(0.7, 0.7, .8, .77, "NB NDC"); starPrelimTextBox->SetFillColor(0); starPrelimTextBox->AddText(starPrelim); starPrelimTextBox->GetLine(0)->SetTextSize(.055); starPrelimTextBox->GetLine(0)->SetTextColor(2); starPrelimTextBox->Draw("SAME"); TLatex *tex = new TLatex(4.2, 0.345, "STAR Au+Au @ 200 GeV"); tex->SetTextFont(42); tex->SetTextSize(0.05); tex->Draw(); //hAlex2->Draw("SAME"); //hAlex3->Draw("SAME"); //hAlex1Syst->Draw("SAME E1"); //hAlex2Syst->Draw("SAME E1"); //hAlex3Syst->Draw("SAME E1"); // tex = new TLatex(0.2, 0.34, "a)"); //tex->SetTextFont(42); //tex->SetTextSize(0.065); //tex->Draw(); //p1->Modified(); //c1->Update(); //c1->cd(); /*TPad* p2 = new TPad("p2","",0.,0.,1.0,0.5); p2->SetFillColor(10); p2->SetFillStyle(0); p2->SetBorderMode(0); p2->SetBorderSize(0); p2->SetFrameFillColor(10); p2->SetFrameFillStyle(0); p2->SetFrameBorderMode(0); //p2->SetLogy(); p2->SetGridx(0); p2->SetGridy(0); p2->SetLeftMargin(0.16); p2->SetBottomMargin(0.18); p2->SetTopMargin(0.01); p2->SetRightMargin(0.02); p2->Draw(); p2->cd();*/ /* double x1 = 0.; double x2 = 2.8; double y1 = -0.025; double y2 = 0.18; TH1 *h0 = new TH1D("h0","",1,x1, x2); h0->SetMinimum(y1); h0->SetMaximum(y2); h0->GetXaxis()->SetNdivisions(208); h0->GetXaxis()->CenterTitle(); h0->GetXaxis()->SetTitle("(m_{T} - m_{0}) / n_{q} (GeV/c^{ 2})"); h0->GetXaxis()->SetTitleOffset(1.1); h0->GetXaxis()->SetTitleSize(0.065); h0->GetXaxis()->SetLabelOffset(0.01); h0->GetXaxis()->SetLabelSize(0.055); h0->GetXaxis()->SetLabelFont(42); h0->GetXaxis()->SetTitleFont(42); h0->GetYaxis()->SetNdivisions(505); h0->GetYaxis()->CenterTitle(); h0->GetYaxis()->SetTitle("Anisotropy Parameter, v_{2} / n_{q}"); h0->GetYaxis()->SetTitleOffset(1.1); h0->GetYaxis()->SetTitleSize(0.065); h0->GetYaxis()->SetLabelOffset(0.015); h0->GetYaxis()->SetLabelSize(0.055); h0->GetYaxis()->SetLabelFont(42); h0->GetYaxis()->SetTitleFont(42); h0->Draw("c"); TLine *l1 = new TLine(x1,y1,x2,y1); l1->SetLineWidth(2); l1->Draw("same"); TLine *l2 = new TLine(x1,y2,x2,y2); l2->SetLineWidth(2); l2->Draw("same"); TLine *l3 = new TLine(x1,y1,x1,y2); l3->SetLineWidth(2); l3->Draw("same"); TLine *l4 = new TLine(x2,y1,x2,y2); l4->SetLineWidth(2); l4->Draw("same"); TLine *l0 = new TLine(x1, 0, x2, 0); l0->SetLineWidth(2); l0->SetLineStyle(2); l0->Draw("same");*/ /*for(int i=0;i<n_ks_cen;i++) { double x1 = x_mTScaled_ks_cen[i]-0.04; double x2 = x_mTScaled_ks_cen[i]+0.04; double y1 = yScaled_ks_cen[1][i]-yesScaled_ks_cen[1][i]; double y2 = yScaled_ks_cen[1][i]+yesScaled_ks_cen[1][i]; TLine *la = new TLine(x1, y1, x1, y1+0.0015); la->Draw("same"); TLine *lb = new TLine(x2, y1, x2, y1+0.0015); lb->Draw("same"); TLine *lc = new TLine(x1, y2, x1, y2-0.0015); lc->Draw("same"); TLine *ld = new TLine(x2, y2, x2, y2-0.0015); ld->Draw("same"); TLine *le = new TLine(x1, y1, x2, y1); le->SetLineWidth(2); le->Draw("same"); TLine *lf = new TLine(x1, y2, x2, y2); lf->SetLineWidth(2); lf->Draw("same"); } gr_ks_mT_cen[1]->Print(); gr_ks_mT_cen[1]->SetMarkerStyle(25); gr_ks_mT_cen[1]->SetMarkerColor(1); gr_ks_mT_cen[1]->SetMarkerSize(1.2); gr_ks_mT_cen[1]->SetLineColor(1); gr_ks_mT_cen[1]->SetLineWidth(2); gr_ks_mT_cen[1]->Draw("p"); for(int i=0;i<n_la_cen;i++) { double x1 = x_mTScaled_la_cen[i]-0.04; double x2 = x_mTScaled_la_cen[i]+0.04; double y1 = yScaled_la_cen[1][i]-yesScaled_la_cen[1][i]; double y2 = yScaled_la_cen[1][i]+yesScaled_la_cen[1][i]; TLine *la = new TLine(x1, y1, x1, y1+0.0015); la->Draw("same"); TLine *lb = new TLine(x2, y1, x2, y1+0.0015); lb->Draw("same"); TLine *lc = new TLine(x1, y2, x1, y2-0.0015); lc->Draw("same"); TLine *ld = new TLine(x2, y2, x2, y2-0.0015); ld->Draw("same"); TLine *le = new TLine(x1, y1, x2, y1); le->SetLineWidth(2); le->Draw("same"); TLine *lf = new TLine(x1, y2, x2, y2); lf->SetLineWidth(2); lf->Draw("same"); } gr_la_mT_cen[1]->Print(); gr_la_mT_cen[1]->SetMarkerStyle(24); gr_la_mT_cen[1]->SetMarkerColor(1); gr_la_mT_cen[1]->SetMarkerSize(1.2); gr_la_mT_cen[1]->SetLineColor(1); gr_la_mT_cen[1]->SetLineWidth(2); gr_la_mT_cen[1]->Draw("p"); gr_xi_mT_cen[1]->Print(); gr_xi_mT_cen[1]->SetMarkerStyle(26); gr_xi_mT_cen[1]->SetMarkerColor(1); gr_xi_mT_cen[1]->SetMarkerSize(1.2); gr_xi_mT_cen[1]->SetLineColor(1); gr_xi_mT_cen[1]->SetLineWidth(2); gr_xi_mT_cen[1]->Draw("p"); gr_phi_mT_cen[1]->Print(); gr_phi_mT_cen[1]->SetMarkerStyle(25); gr_phi_mT_cen[1]->SetMarkerColor(1); gr_phi_mT_cen[1]->SetMarkerSize(1.2); gr_phi_mT_cen[1]->SetLineColor(1); gr_phi_mT_cen[1]->SetLineWidth(2); // gr_phi_mT_cen[1]->Draw("p");*/ /* for(int i=0;i<n_data_cen[1];i++) { double x1 = x_mTScaled_data_cen[1][i]-0.04; double x2 = x_mTScaled_data_cen[1][i]+0.04; double y1 = yScaled_data_cen[1][i]-yesScaled_data_cen[1][i]; double y2 = yScaled_data_cen[1][i]+yesScaled_data_cen[1][i]; double y3 = yScaled_data_cen[1][i] - yesLScaled_data_cen[1][i]; double y4 = yScaled_data_cen[1][i]; TBox *box = new TBox(x1, y3, x2, y4); box->SetLineColor(16); box->SetFillColor(16); box->Draw("same"); TLine *la = new TLine(x1, y1, x1, y1+0.0015); la->SetLineColor(4); la->Draw("same"); TLine *lb = new TLine(x2, y1, x2, y1+0.0015); lb->SetLineColor(4); lb->Draw("same"); TLine *lc = new TLine(x1, y2, x1, y2-0.0015); lc->SetLineColor(4); lc->Draw("same"); TLine *ld = new TLine(x2, y2, x2, y2-0.0015); ld->SetLineColor(4); ld->Draw("same"); TLine *le = new TLine(x1, y1, x2, y1); le->SetLineColor(4); le->SetLineWidth(2); le->Draw("same"); TLine *lf = new TLine(x1, y2, x2, y2); lf->SetLineColor(4); lf->SetLineWidth(2); lf->Draw("same"); }*/ //gr_data_mT_cen[1]->SetMarkerStyle(20); //gr_data_mT_cen[1]->SetMarkerColor(4); //gr_data_mT_cen[1]->SetMarkerSize(1.5); //gr_data_mT_cen[1]->SetLineWidth(2); //gr_data_mT_cen[1]->SetLineColor(4); //gr_data_mT_cen[1]->Draw("p"); //TLegend *leg = new TLegend(0.22, 0.66, 0.5, 0.96); //leg->SetFillStyle(0); //leg->SetLineStyle(4000); //leg->SetLineColor(-1); //leg->SetLineWidth(0); //leg->SetTextSize(0.06); //leg->AddEntry(gr_data_mT_cen[1], "D^{0}", "p"); //leg->AddEntry(gr_xi_mT_cen[1], "#Xi^{-}", "p"); //leg->AddEntry(gr_la_mT_cen[1], "#Lambda", "p"); //leg->AddEntry(gr_ks_mT_cen[1], "K_{S}", "p"); // leg->AddEntry(gr_phi_mT_cen[1], "#phi", "p"); //leg->Draw(); //TLatex *tex = new TLatex(1.2, 0.155, "STAR Au+Au @ 200 GeV"); // tex->SetTextFont(42); //tex->SetTextSize(0.065); //tex->Draw(); //TLatex *tex = new TLatex(2.27, 0.13, "10-40%"); //tex->SetTextFont(42); //tex->SetTextSize(0.065); //tex->Draw(); //tex = new TLatex(0.08, 0.155, "b)"); //tex->SetTextFont(42); //tex->SetTextSize(0.065); //tex->Draw(); //p2->Modified(); //c1->Update(); //c1->cd(); //c1->SaveAs("v2CompareWithData.eps"); c1->SaveAs("v2_plot.png"); }
TGraphErrors *ReadMWGraph(const char *name, Int_t flag) { Double_t xreject = 0.49; TGraphErrors *g = new TGraphErrors(name); if (g->IsZombie()) return 0; while (g->GetX()[0] < xreject) g->RemovePoint(0); TGraphErrors *g2 = new TGraphErrors(name); if (g2->IsZombie()) return 0; while (g2->GetX()[0] < xreject) g2->RemovePoint(0); g2->SetMarkerStyle(4); g2->SetMarkerSize(1.00); g2->SetMarkerColor(kBlack); g2->SetLineColor(kBlack); TGraphErrors *gsys = new TGraphErrors(name, "%lg %lg %lg %*lg %lg"); if (gsys->IsZombie()) return 0; while (gsys->GetX()[0] < xreject) gsys->RemovePoint(0); for (Int_t i = 0; i < gsys->GetN(); i++) gsys->SetPointError(i, gsys->GetErrorX(i)*0.75, gsys->GetErrorY(i)); gsys->SetFillColor(kGray+2); gsys->SetLineColor(kGray+2); gsys->SetFillStyle(3000); if (flag == 1 || flag == 3) { TGraphErrors *gt = new TGraphErrors(Form("%s_%s", name, "trues")); if (gt->IsZombie()) return 0; while (gt->GetX()[0] < xreject) gt->RemovePoint(0); gt->SetMarkerStyle(20); gt->SetMarkerSize(0.75); gt->SetMarkerColor(kGreen+1); gt->SetLineColor(kGreen+1); TGraphErrors *gbw = new TGraphErrors(Form("%s_%s", name, "gen")); if (gbw->IsZombie()) return 0; while (gbw->GetX()[0] < xreject) gbw->RemovePoint(0); gbw->SetMarkerStyle(20); gbw->SetMarkerSize(0.75); gbw->SetMarkerColor(kBlue+1); gbw->SetLineColor(kBlue+1); for (Int_t i = 0; i < g->GetN(); i++) { g->SetPointError(i, g->GetEX()[i], 0.); gt->SetPointError(i, gt->GetEX()[i], 0.); gbw->SetPointError(i, gbw->GetEX()[i], 0.); } for (Int_t i = 0; i < g2->GetN(); i++) { g2->SetPoint(i, g2->GetX()[i], g2->GetY()[i] - gt->GetY()[i] + gbw->GetY()[i]); g2->SetPointError(i, g2->GetEX()[i], TMath::Sqrt(g2->GetEY()[i]*g2->GetEY()[i] + gt->GetEY()[i]*gt->GetEY()[i] + gbw->GetEY()[i]*gbw->GetEY()[i])); // g2->SetPoint(i, g2->GetX()[i], g2->GetY()[i] - gt->GetY()[i] + 1.01947); // g2->SetPointError(i, g2->GetEX()[i], TMath::Sqrt(g2->GetEY()[i]*g2->GetEY()[i] + gt->GetEY()[i]*gt->GetEY()[i] + // 7.78680e-06*7.78680e-06)); gsys->SetPoint(i, gsys->GetX()[i], g2->GetY()[i]); } } g->SetTitle(); g->SetName(name); g->GetXaxis()->SetTitle("p_{T}, GeV/c"); g->SetMarkerStyle(20); g->SetMarkerSize(0.95); g->SetMarkerColor(kRed+1); g->SetLineColor(kRed+1); const Double_t mass = 1.019455; const Double_t mass_delta = 0.000020; const Double_t width = 0.00426; const Double_t width_delta = 0.00004; if (flag == 1) { // mass g->GetYaxis()->SetTitleOffset(1.50); g->GetYaxis()->SetTitle("mass, GeV/c^{2}"); g->SetMaximum(mass+0.0015); g->SetMinimum(mass-0.0015); TBox *box = new TBox(g->GetXaxis()->GetXmin(), mass - mass_delta, g->GetXaxis()->GetXmax(), mass + mass_delta); box->SetFillColor(kGray+1); box->SetFillStyle(3001); g->GetListOfFunctions()->Add(box); g->GetListOfFunctions()->Add(g2, "CP"); g->GetListOfFunctions()->Add(gt, "CP"); g->GetListOfFunctions()->Add(gbw, "CP"); } else if (flag == 3) { // mass simple g2->SetTitle(); g2->SetName(Form("%s_only", name)); g2->GetXaxis()->SetTitle("p_{T}, GeV/c"); g2->SetMarkerStyle(20); g2->SetMarkerSize(0.75); g2->SetMarkerColor(kBlack); g2->SetLineColor(kBlack); g2->GetYaxis()->SetTitleOffset(1.50); g2->GetYaxis()->SetTitle("mass, GeV/c^{2}"); g2->SetMaximum(mass+0.0015); g2->SetMinimum(mass-0.0015); TBox *box = new TBox(g->GetXaxis()->GetXmin(), mass - mass_delta, g2->GetXaxis()->GetXmax(), mass + mass_delta); box->SetFillColor(kGray+1); box->SetFillStyle(3001); g2->GetListOfFunctions()->Add(box); g2->GetListOfFunctions()->Add(gsys, "E5"); return g2; } else if (flag == 2) { // width g->SetTitle(); g->SetName(name); g->GetXaxis()->SetTitle("p_{T}, GeV/c"); g->SetMarkerStyle(20); g->SetMarkerSize(0.75); g->SetMarkerColor(kBlack); g->SetLineColor(kBlack); g->GetYaxis()->SetTitleOffset(1.50); g->GetYaxis()->SetTitle("width, GeV/c^{2}"); g->SetMaximum(0.01); g->SetMinimum(0.0); TBox *box = new TBox(g->GetXaxis()->GetXmin(), width - width_delta, g->GetXaxis()->GetXmax(), width + width_delta); box->SetFillColor(kGray+1); box->SetFillStyle(3001); g->GetListOfFunctions()->Add(box); g->GetListOfFunctions()->Add(gsys, "E5"); } return g; }
v523pt_compareZb() { gROOT->Reset(); gROOT->SetStyle("MyStyle"); // gROOT->LoadMacro("v2pt_12cen_MyDef.C"); // gROOT->LoadMacro("MyDef.C"); gStyle->SetTextFont(43); gStyle->SetLabelFont(43,"x"); gStyle->SetLabelFont(43,"y"); gStyle->SetLabelFont(43,"z"); gStyle->SetTitleFont(43,"x"); gStyle->SetTitleFont(43,"y"); gStyle->SetTitleFont(43,"z"); gStyle->SetEndErrorSize(0); double textsize = 19; //int mcol[8]={kRed,kMagenta,kBlue,kCyan,kGreen,kYellow,kOrange,kGray}; int mcol[8]={kRed,kOrange+1,kBlue,kGreen+1,kCyan,kYellow,kOrange,kGray}; int mcol2[4]={6,2,4,8}; //int msty[8][2]={{20,20},{25,24},{22,22},{28,26},{29,30},{33,27},{34,28},{20,24}}; int msty[8][2]={{20,20},{21,24},{22,29},{23,30},{24,30},{25,27},{28,28},{30,24}}; //float msiz[8]={1.11,0.9,1.2,1.24,1.5,1,1,1}; float msiz[8]={1.11,1.0,1.5,1.2,1.2,1.2,1.2,1.6}; float msiz2[4]={1.5,1.5,1.5,1.5}; // // arrays // const int Mfiles=50; int ndp[Mfiles]; char *cfn[Mfiles]; char *cft[Mfiles]; const int Mpoints=40; double xa[Mfiles][Mpoints],xe[Mfiles][Mpoints]; double ya[Mfiles][Mpoints],ye[Mfiles][Mpoints]; double nxa[Mfiles][Mpoints],nxe[Mfiles][Mpoints]; double nya[Mfiles][Mpoints],nye[Mfiles][Mpoints]; double mxa[Mfiles][Mpoints],mxe[Mfiles][Mpoints]; double mya[Mfiles][Mpoints],mye[Mfiles][Mpoints]; double xesys[Mfiles][Mpoints], yesys[Mfiles][Mpoints]; double mxesys[Mfiles][Mpoints], myesys[Mfiles][Mpoints]; double aexl[Mfiles][Mpoints],aexh[Mfiles][Mpoints]; double aeyl[Mfiles][Mpoints],aeyh[Mfiles][Mpoints]; double ra[Mfiles][Mpoints],re[Mfiles][Mpoints]; const int Mpads=14; char *htit[Mpads]; char *atit[Mpads][3]; double ptit[Mpads][2]; double hxmin[Mpads],hxmax[Mpads]; double hymin[Mpads],hymax[Mpads]; double lxmin[Mpads],lxmax[Mpads]; double lymin[Mpads],lymax[Mpads]; // // Data input // char *cjob="v2pt_12cen_4x3"; int i=-1; // histogram parameter htit[0]="0-5%"; htit[1]="5-10%"; htit[2]="10-15%"; htit[3]="15-20%"; htit[4]="20-25%"; htit[5]="25-30%"; htit[6]="30-35%"; htit[7]="35-40%"; htit[8]="40-50%"; htit[9]="50-60%"; htit[10]="60-70%"; htit[11]="70-80%"; for (int ip=0;ip<Mpads;ip++) { // hxmin[ip]=0.0; hxmax[ip]=11.9; hxmin[ip]=0.0001; hxmax[ip]=4.3; hymin[ip]=-0.002; hymax[ip]=0.0219; lxmin[ip]=0.08; lxmax[ip]=0.35; lymin[ip]=0.4; lymax[ip]=0.65; ptit[ip][0]=4.0; ptit[ip][1]=0.06;// position legends atit[ip][0]="p_{T} (GeV/c)"; atit[ip][1]="v_{5}{#Psi_{23}}"; } // // Read data and create vector files // double sysXYZ[12]; double sysEach[12]; double tmp; const int nw=12; const int npt=20; ifstream inEP; inEP.open("../outv523_corrFlow.txt"); for(int i=0; i<nw-2; i++){ sysXYZ[i]=6; sysEach[i]=0.0002; inEP>>tmp; inEP>>tmp; for(int j=0; j<npt; j++){ inEP>>tmp; inEP>>tmp; inEP>>xa[i][j]; inEP>>tmp; inEP>>ya[i][j]; inEP>>ye[i][j]; //inEP>>xa[i][j]; inEP>>ya[i][j]; inEP>>ye[i][j]; inEP>>tmp; xe[i][j]=0.0; xesys[i][j]=0.2; yesys[i][j]=sqrt(sysEach[i]*sysEach[i] + (ya[i][j]*sysXYZ[i]*0.01)*(ya[i][j]*sysXYZ[i]*0.01)); } } inEP.close(); ifstream inSP; inSP.open("/Users/shengquantuo/Downloads/tmp3/figures_-0.8_00.8/outv523steve.txt"); for(int i=0; i<nw-2; i++){ for(int j=0; j<npt-2; j++){ inSP>>mxa[i][j]; inSP>>mya[i][j]; inSP>>mye[i][j]; mxe[i][j]=0.0; mxesys[i][j]=0.2; myesys[i][j]=sqrt(sysEach[i]*sysEach[i] + (mya[i][j]*sysXYZ[i]*0.01)*(mya[i][j]*sysXYZ[i]*0.01)); } } inSP.close(); for(int i=0; i<nw-2; i++){ cout<<"sys for cent: "<<i<<endl; for(int j=0; j<10; j++){ cout<<nxa[i][j]<<" "<<fabs(ya[i][j]-nya[i][j])/fabs(ya[i][j])<<endl; } } TCanvas *can=new TCanvas("can","can",10,10,1050*0.9,800*0.85); can->Divide(4,3,0,0); //sticks the pads with no space inbetween TH1D *h1[nw]; for (int iw=0;iw<nw;iw++) { can->cd(iw+1); if(iw==3||iw==7||iw==11) gPad->SetRightMargin(0.02); char ch1[8]; sprintf(ch1,"h1_%d",iw); h1[iw] = new TH1D(ch1,"",500,hxmin[iw],hxmax[iw]); h1[iw]->SetMinimum(hymin[iw]); h1[iw]->SetMaximum(hymax[iw]); h1[iw]->SetXTitle(atit[iw][0]); h1[iw]->SetYTitle(atit[iw][1]); h1[iw]->GetXaxis()->CenterTitle(1); h1[iw]->GetYaxis()->CenterTitle(1); // futz with the axes h1[iw]->GetYaxis()->SetNdivisions(606); h1[iw]->GetXaxis()->SetNdivisions(606); h1[iw]->GetYaxis()->SetTitleSize(textsize); h1[iw]->GetYaxis()->SetTitleOffset(3.5); h1[iw]->GetYaxis()->SetLabelSize(textsize); h1[iw]->GetXaxis()->SetTitleSize(textsize); h1[iw]->GetXaxis()->SetTitleOffset(3.0); h1[iw]->GetXaxis()->SetLabelSize(textsize); // h1[iw]->GetXaxis()->SetLabelOffset(1.2); h1[iw]->Draw(); } // // Draw! // cout << "Now Draw!" << endl; TGraphErrors *ge; for (int iw=0;iw<nw;iw++) { can->cd(iw+1); // if (iw==0) { tex=new TLatex(0.7,0.05,"HIN11005 is 2.76TeV, EP"); tex->SetTextSize(textsize*0.9); //tex->Draw(); tex=new TLatex(1.5,0.07,"|#eta|<0.8"); tex->SetTextSize(textsize); //tex->Draw(); } if (iw < 4) tex=new TLatex(ptit[iw][0]*1.2,ptit[iw][1]*1.27,htit[iw]); else tex=new TLatex(ptit[iw][0]*1.2,ptit[iw][1]*1.27,htit[iw]); if ( iw == 0) tex->SetTextSize(textsize); else if (iw == 8) tex->SetTextSize(textsize); else tex->SetTextSize(textsize); tex->Draw(); // // Legend // TLegend *leg = new TLegend(lxmin[iw]*3.99,lymin[iw]*1.1,lxmax[iw]*1.99,lymax[iw]*1.2); leg->SetFillColor(0); leg->SetTextSize(textsize); // // Read data // for (int im=0;im<1;im++) { int j=im*12+iw; int col=2; //if (ndp[j]==0) continue; ge=new TGraphErrors(16,&mxa[j][0],&mya[j][0],&mxe[j][0],&mye[j][0]); drawSysBoxValue(ge,16,0.2, myesys[j]); ge->SetTitle(""); ge->SetMarkerStyle(25); // ge->SetMarkerStyle(msty[im]); ge->SetMarkerSize(msiz[im]); ge->SetMarkerColor(col); ge->SetLineWidth(1.2); ge->SetLineColor(col); ge->Draw("pe"); leg->AddEntry(ge,"v_{5}{#Psi_{23}} Steve","p"); } for (int im=0;im<1;im++) { int j=im*12+iw; int col=1; //if (ndp[j]==0) continue; ge=new TGraphErrors(19,&xa[j][0],&ya[j][0],&xe[j][0],&ye[j][0]); //drawSysBoxValue(ge,16,0.2, yesys[j]); ge->SetTitle(""); ge->SetMarkerStyle(msty[im][1]); // ge->SetMarkerStyle(msty[im]); ge->SetMarkerSize(msiz[im]); ge->SetMarkerColor(col); ge->SetLineWidth(1.2); ge->SetLineColor(col); ge->Draw("pe"); leg->AddEntry(ge,"v_{5}{#Psi_{23}} Shengquan","p"); } if (iw==0) leg->Draw(); } cout << "end of process" << endl; can->cd(); can->Print("./figures/v523_pt_ShengquanSteveb.png"); can->Print("./figures/v523_pt_ShengquanSteveb.pdf"); }
void Draw_CMS_JPsi_RaaVspT(TLegend *legend_ratio) { int nbinsPtCMS=4; Double_t PtCMSD[4]={7.31,8.97,11.32,16.52}; Double_t ErrPtCMS[4]={0}; Double_t RaaPtCMS[4] = {0.35,0.34,0.34,0.29}; Double_t RaaPtStatErrCMS[4] = {0.09,0.03,0.03,0.04}; Double_t RaaPtSystErrCMS[4] = {0.04,0.04,0.03,0.03}; TGraphErrors *grRaaPtCMS = new TGraphErrors(nbinsPtCMS, PtCMSD, RaaPtCMS, ErrPtCMS, RaaPtStatErrCMS); grRaaPtCMS->SetMarkerStyle(21); grRaaPtCMS->SetMarkerColor(kRed+1); grRaaPtCMS->SetMarkerSize(1.3); //grRaaPtCMS->SetFillColor(kRed); grRaaPtCMS->SetLineColor(1); grRaaPtCMS->GetYaxis()->SetRangeUser(0,1.5); grRaaPtCMS->GetXaxis()->SetTitle("p_{T}(GeV/c)"); grRaaPtCMS->GetYaxis()->SetTitle("R_{AA}"); TLine *lh5 = new TLine(0.0,1.0,20.0,1.0); lh5->SetLineColor(1); lh5->SetLineStyle(1); lh5->SetLineWidth(1.5); TLatex *tb= new TLatex; tb->SetNDC(); tb->SetTextAlign(12); tb->SetTextColor(1); tb->SetTextSize(0.040); TBox *RaaPtJPsiCMSSys[4]; for(int j=0;j<4;j++){ RaaPtJPsiCMSSys[j] = new TBox(PtCMSD[j]-0.4, RaaPtCMS[j]-RaaPtSystErrCMS[j], PtCMSD[j]+0.4, RaaPtCMS[j]+RaaPtSystErrCMS[j]); } for(int j=0;j<4;j++){ RaaPtJPsiCMSSys[j]->SetFillStyle(1001); RaaPtJPsiCMSSys[j]->SetFillColor(kPink+1); RaaPtJPsiCMSSys[j]->SetLineColor(1); } TBox *CMSGlobalSysJPsiPt; //CMSGlobalSysJPsiPt = new TBox(27.0-1.0, 1 - 0.075, 27.0+1.0, 1 + 0.075); CMSGlobalSysJPsiPt = new TBox(19.165,0.923,19.948,1.067); CMSGlobalSysJPsiPt->SetFillStyle(3001); CMSGlobalSysJPsiPt->SetLineColor(2); CMSGlobalSysJPsiPt->SetFillColor(2); TAxis *XaxisgrRaaPtCMS = grRaaPtCMS->GetXaxis(); XaxisgrRaaPtCMS->SetLimits(0.0,20.0); grRaaPtCMS->Draw("AP"); for(int j=0;j<4;j++) RaaPtJPsiCMSSys[j]->Draw("same"); grRaaPtCMS->Draw("Psame"); CMSGlobalSysJPsiPt->Draw("same"); tb->SetTextSize(0.030); //tb->DrawLatex(0.20,0.20,"PbPb #sqrt{s_{NN}} = 2.76 TeV"); tb->DrawLatex(0.71476,0.91289,"J/#psi #rightarrow #mu^{+} #mu^{-}"); lh5->Draw("same"); //legend_ratio->AddEntry(grRaaPtCMS,"PbPb #sqrt{s_{NN}} = 2.76 TeV and Au-Au #sqrt{s_{NN}} = 0.2 TeV", ""); legend_ratio->AddEntry(grRaaPtCMS,"Pb+Pb #sqrt{s_{NN}} = 2.76 TeV", ""); legend_ratio->AddEntry(grRaaPtCMS,"Prompt J/#psi CMS: |y| < 2.4", "P"); //legend_ratio->AddEntry(grRaaPtCMS,"PbPb #sqrt{s_{NN}} = 2.76 TeV and Au-Au #sqrt{s_{NN}} = 0.2 TeV", ""); //legend_ratio->AddEntry(grRaaPtCMS,"CMS: J/#psi #rightarrow #mu^{+} #mu^{-}, |y| < 2.4 & p_{T}^{J/#psi} > 6.5 GeV/c", "P"); //legend_ratio->AddEntry(grRaaPtCMS,"CMS: J/#psi #rightarrow #mu^{+} #mu^{-}, |y| < 2.4 & p_{T}^{J/#psi} > 6.5 GeV/c", "P"); }