void LoadStyle() { gROOT->Reset(); gStyle->SetLineStyleString(5,"[]"); gStyle->SetOptStat(0); gStyle->SetCanvasColor(0); gStyle->SetTitleColor(1); gStyle->SetStatColor(0); gStyle->SetFrameFillColor(0); gStyle->SetPadColor(0); gStyle->SetPadTickX(1); gStyle->SetPadTickY(1); gStyle->SetTitleSize(0.04); gStyle->SetLabelSize(0.04); gStyle->SetCanvasBorderMode(0); gStyle->SetFrameBorderMode(0); gStyle->SetFrameLineWidth(2); gStyle->SetPadBorderMode(0); TCanvas *c4 = new TCanvas("c4","",5,5,800,800); c4->SetLeftMargin(0.153226); c4->SetRightMargin(0.153226); c4->SetBottomMargin(0.153226); c4->SetTopMargin(0.153226); c4->SetRightMargin(0.153226); c4->SetFillColor(kWhite); } void ProducePlots( char * type , int start , int stop ) { LoadStyle(); int i = 0; stringstream ss; char * digi = ""; // 3x2 // TPad * pad11 = new TPad("pad11","", 0.01, 0.51, 0.32, 0.99); TPad * pad12 = new TPad("pad12","", 0.34, 0.51, 0.65, 0.99); TPad * pad13 = new TPad("pad13","", 0.67, 0.51, 0.99, 0.99); TPad * pad21 = new TPad("pad21","", 0.01, 0.01, 0.32, 0.49); TPad * pad22 = new TPad("pad22","", 0.34, 0.01, 0.65, 0.49); TPad * pad23 = new TPad("pad23","", 0.67, 0.01, 0.99, 0.49); pad11->Draw(); pad12->Draw(); pad13->Draw(); pad21->Draw(); pad22->Draw(); pad23->Draw(); for ( i = start ; i <= stop ; i++ ) { pad11->cd(); DoPlot( type, digi, i, "nt", 120); pad12->cd(); DoPlot( type, digi, i, "nb", 120); pad13->cd(); DoPlot( type, digi, i, "nw", 300); pad21->cd(); DoPlot( type, digi, i, "nhitac", 200); pad22->cd(); DoPlot( type, digi, i, "rmean", 3000 ); pad23->cd(); DoPlot( type, digi, i, "odq", 1000 ); ss.str(""); ss << "sk4."<< type << "." << i << ".tmc.gif"; c4->SaveAs( ss.str().c_str() ); } } void DoPlotXXX( char * type, char * digi, int instance, char * var, int bound) { LoadStyle(); TCut * tcuts[5]; tcuts[0] = new TCut(""); tcuts[1] = new TCut(""); tcuts[2] = new TCut("qismsk<65000"); tcuts[3] = new TCut("qismsk<65000&&fabs(entry[2])<500"); stringstream ss; int index = 0; ss << type; if ( ss.str() == "ttb") index = 1; if ( ss.str() == "st" ) index = 2; if ( ss.str() == "sw" ) index = 2; TCut * lCut = tcuts[0]; ss.str(""); ss << "sk3.data/sk3." << type << ".root"; cout << ss.str() << endl; TFile * _data = new TFile( ss.str().c_str() ); ss.str(""); ss << "sk4.data/sk4." << type << ".root"; TFile * _mc = new TFile( ss.str().c_str() ); TTree * Data = (TTree*) _data->Get("tuneTree"); TTree * MC = (TTree*) _mc->Get("tuneTree"); float lower = 0.0; stringstream ssComp; ssComp << var; if ( ssComp.str() == "nt" ) { ssComp.str(""); ssComp << "Top Tubes"; } if ( ssComp.str() == "nb" ) { ssComp.str(""); ssComp << "Bottom Tubes"; } if ( ssComp.str() == "nw" ) { ssComp.str(""); ssComp << "Barrel Tubes"; } if ( ssComp.str() == "nhitac" ) { ssComp.str(""); ssComp << "nhitac"; } if ( ssComp.str() == "rmean" ) { ssComp.str(""); ssComp << "OD rmean"; lower = 500.0; } if ( ssComp.str() == "odq" ) { ssComp.str(""); ssComp << "Total Charge [p.e.]"; ss.str(""); ss << type; if( ss.str() == "twb" ) bound = 2000.0; } TH1F * hData = new TH1F("hData","",60, lower, bound); TH1F * hMC = new TH1F("hMC","",60, lower, bound); hData->SetLineColor(kBlack); hMC->SetLineColor(kRed); hData->SetLineWidth(2); hMC->SetLineWidth(2); MC->Project("hMC", var, *lCut ); Data->Project("hData", var, *lCut ); cout << hMC->GetEntries() << " " << hData->GetEntries() << " " << index << endl; hMC->Scale( hData->GetEntries() / hMC->GetEntries() ); hMC->GetXaxis()->SetTitle( ssComp.str().c_str() ); hMC->SetNdivisions(507); hMC->GetXaxis()->SetTitleSize(0.055); hMC->GetXaxis()->SetTitleOffset(0.8); hMC->GetXaxis()->CenterTitle(1); hMC->Draw(""); hData->Draw("same"); } void DoCompare( char * type, int ref , int instance, int klog, char * var, int bound) { LoadStyle(); TCut * tcuts[5]; tcuts[0] = new TCut(""); tcuts[1] = new TCut(""); tcuts[2] = new TCut("qismsk<65000"); tcuts[3] = new TCut("qismsk<65000&&fabs(entry[2])<500"); stringstream ss; int index = 0; ss << type; if ( ss.str() == "ttb") index = 1; if ( ss.str() == "st" ) index = 2; if ( ss.str() == "sw" ) index = 2; TCut * lCut = tcuts[0]; ss.str(""); ss << "sk3.data/sk3." << type << ".root"; cout << ss.str() << endl; TFile * _data = new TFile( ss.str().c_str() ); ss.str(""); ss << "sk3.split/sk3." << type << "." << ref << ".root"; cout << ss.str() << endl; TFile * _ref = new TFile( ss.str().c_str() ); ss.str(""); ss << "sk3.split/sk3." << type <<"."<< instance << ".root"; TFile * _mc = new TFile( ss.str().c_str() ); TTree * Data = (TTree*) _data->Get("tuneTree"); TTree * MC = (TTree*) _mc->Get("tuneTree"); TTree * Ref = (TTree*) _ref->Get("tuneTree"); TH1F * hData = new TH1F("hData","",60, 0.0, bound); TH1F * hMC = new TH1F("hMC","",60, 0.0, bound); TH1F * hRef = new TH1F("hRef","",60, 0.0, bound); hData->SetLineColor(kBlack); hMC->SetLineColor(kRed); hRef->SetLineColor(kGreen); hData->SetLineWidth(2); hMC->SetLineWidth(2); hRef->SetLineWidth(2); MC->Project("hMC", var, *lCut ); Data->Project("hData", var, *lCut ); Ref->Project("hRef", var, *lCut ); cout << hMC->GetEntries() << " " << hData->GetEntries() << " " << index << endl; stringstream ssComp; ssComp << var; if ( ssComp.str() == "nt" ) { ssComp.str(""); ssComp << "Top Tubes"; } if ( ssComp.str() == "nb" ) { ssComp.str(""); ssComp << "Bottom Tubes"; } if ( ssComp.str() == "nw" ) { ssComp.str(""); ssComp << "Barrel Tubes"; } if ( ssComp.str() == "nhitac" ) { ssComp.str(""); ssComp << "nhitac"; } if ( ssComp.str() == "rmean" ) { ssComp.str(""); ssComp << "OD rmean"; } if ( ssComp.str() == "odq" ) { ssComp.str(""); ssComp << "Total Charge [p.e.]"; } // hMC->Scale( hData->GetEntries() / hMC->GetEntries() ); if( klog == 1 ) c4->SetLogy(1); hMC->GetXaxis()->SetTitle( ssComp.str().c_str() ); hMC->SetNdivisions(507); hMC->GetXaxis()->SetTitleSize(0.055); hMC->GetXaxis()->SetTitleOffset(0.8); hMC->GetXaxis()->CenterTitle(1); hMC->Draw(""); hData->Draw("same"); hRef->Draw("same"); } void TubeHits( char * type , int start , int stop ) { LoadStyle(); int i = 0; stringstream ss; char * digi = ""; // 3x2 // TPad * pad11 = new TPad("pad11","", 0.01, 0.51, 0.32, 0.99); TPad * pad12 = new TPad("pad12","", 0.34, 0.51, 0.65, 0.99); TPad * pad13 = new TPad("pad13","", 0.67, 0.51, 0.99, 0.99); TPad * pad21 = new TPad("pad21","", 0.01, 0.01, 0.32, 0.49); TPad * pad22 = new TPad("pad22","", 0.34, 0.01, 0.65, 0.49); TPad * pad23 = new TPad("pad23","", 0.67, 0.01, 0.99, 0.49); pad11->Draw(); pad12->Draw(); pad13->Draw(); pad21->Draw(); pad22->Draw(); pad23->Draw(); for ( i = start ; i <= stop ; i++ ) { pad11->cd(); DoPlot( type, digi, i, "n_old[2]", 200); pad12->cd(); DoPlot( type, digi, i, "n_old[1]", 200); pad13->cd(); DoPlot( type, digi, i, "n_old[0]", 300); pad21->cd(); DoPlot( type, digi, i, "n_new[2]", 200); pad22->cd(); DoPlot( type, digi, i, "n_new[1]", 200); pad23->cd(); DoPlot( type, digi, i, "n_new[0]", 300); } ss.str(""); ss << "tube.hit." << type << "." << i << ".gif"; c4->SaveAs( ss.str().c_str() ); } void DoPlot( char * type, char * digi, int instance, char * var, int bound) { TCut * tcuts[5]; tcuts[0] = new TCut("rmean>1600 &&entry[2]>1800 && exit[2]<-1800 && sqrt(entry[0]^2+entry[1]^2)< 1600 && sqrt(exit[0]^2+exit[1]^2)< 1600 "); //ttb tcuts[1] = new TCut(""); tcuts[2] = new TCut("qismsk<65000"); tcuts[3] = new TCut("qismsk<65000&&fabs(entry[2])<500"); stringstream ss; int index = 0; ss << type; if ( ss.str() == "ttb") index = 1; if ( ss.str() == "st" ) index = 2; if ( ss.str() == "sw" ) index = 2; TCut * lCut = tcuts[0]; ss.str(""); ss << "sk3.data/sk3." << type << ".root"; cout << ss.str() << endl; TFile * _data = new TFile( ss.str().c_str() ); ss.str(""); ss << "sk4.data/sk4." << type << ".root"; TFile * _mc = new TFile( ss.str().c_str() ); TTree * Data = (TTree*) _data->Get("tuneTree"); TTree * MC = (TTree*) _mc->Get("tuneTree"); float lower = 0.0; stringstream ssComp; ssComp << var; if ( ssComp.str() == "nt" ) { ssComp.str(""); ssComp << "Top Tubes"; } if ( ssComp.str() == "nb" ) { ssComp.str(""); ssComp << "Bottom Tubes"; } if ( ssComp.str() == "nw" ) { ssComp.str(""); ssComp << "Barrel Tubes"; } if ( ssComp.str() == "nhitac" ) { ssComp.str(""); ssComp << "nhitac"; } if ( ssComp.str() == "rmean" ) { ssComp.str(""); ssComp << "OD rmean"; lower = 500.0; } if ( ssComp.str() == "odq" ) { ssComp.str(""); ssComp << "Total Charge [p.e.]"; ss.str(""); ss << type; if( ss.str() == "twb" ) bound = 2000.0; } TH1F * hData = new TH1F("hData","",60, lower, bound); TH1F * hMC = new TH1F("hMC","",60, lower, bound); hData->SetLineColor(kBlack); hMC->SetLineColor(kRed); hData->SetLineWidth(2); hMC->SetLineWidth(2); MC->Project("hMC", var, *lCut ); Data->Project("hData", var, *lCut ); cout << hMC->GetEntries() << " " << hData->GetEntries() << " " << index << endl; hMC->Scale( hData->GetEntries() / hMC->GetEntries() ); hMC->GetXaxis()->SetTitle( ssComp.str().c_str() ); hMC->SetNdivisions(507); hMC->GetXaxis()->SetTitleSize(0.055); hMC->GetXaxis()->SetTitleOffset(0.8); hMC->GetXaxis()->CenterTitle(1); hMC->Draw(""); hData->Draw("same"); } void QGeography( char * type , int start , int stop ) { LoadStyle(); int i = 0; stringstream ss; char * digi = ""; // 3x2 // TPad * pad11 = new TPad("pad11","", 0.01, 0.51, 0.32, 0.99); TPad * pad12 = new TPad("pad12","", 0.34, 0.51, 0.65, 0.99); TPad * pad13 = new TPad("pad13","", 0.67, 0.51, 0.99, 0.99); TPad * pad21 = new TPad("pad21","", 0.01, 0.01, 0.32, 0.49); TPad * pad22 = new TPad("pad22","", 0.34, 0.01, 0.65, 0.49); TPad * pad23 = new TPad("pad23","", 0.67, 0.01, 0.99, 0.49); pad11->Draw(); pad12->Draw(); pad13->Draw(); pad21->Draw(); pad22->Draw(); pad23->Draw(); for ( i = start ; i <= stop ; i++ ) { pad11->cd(); DoPlot( type, digi, i, "q_tbw[2]", 1000); pad12->cd(); DoPlot( type, digi, i, "q_tbw[1]", 1000); pad13->cd(); DoPlot( type, digi, i, "q_tbw[0]", 1000); ss.str(""); ss << "q.geography." <SaveAs( ss.str().c_str() ); } void DoSingle( char * type , int instance, char * var, int bound) { LoadStyle(); TCut * tcuts[5]; tcuts[0] = new TCut(""); tcuts[1] = new TCut(""); tcuts[2] = new TCut("qismsk<65000"); tcuts[3] = new TCut("qismsk<65000&&fabs(entry[2])<500"); stringstream ss; int index = 0; ss << type; if ( ss.str() == "ttb") index = 1; if ( ss.str() == "st" ) index = 2; if ( ss.str() == "sw" ) index = 2; TCut * lCut = tcuts[0]; ss.str(""); ss << "sk3.data/sk3." << type << ".root"; cout << ss.str() << endl; TFile * _data = new TFile( ss.str().c_str() ); ss.str(""); ss << "sk4.data/sk4." << type <<"."<< instance << ".root"; TFile * _mc = new TFile( ss.str().c_str() ); TTree * Data = (TTree*) _data->Get("tuneTree"); TTree * MC = (TTree*) _mc->Get("tuneTree"); TH1F * hData = new TH1F("hData","",60, 0.0, bound); TH1F * hMC = new TH1F("hMC","",60, 0.0, bound); hData->SetLineColor(kBlack); hMC->SetLineColor(kRed); hData->SetLineWidth(2); hMC->SetLineWidth(2); MC->Project("hMC", var, *lCut ); Data->Project("hData", var, *lCut ); cout << hMC->GetEntries() << " " << hData->GetEntries() << " " << index << endl; stringstream ssComp; ssComp << var; if ( ssComp.str() == "nt" ) { ssComp.str(""); ssComp << "Top Tubes"; } if ( ssComp.str() == "nb" ) { ssComp.str(""); ssComp << "Bottom Tubes"; } if ( ssComp.str() == "nw" ) { ssComp.str(""); ssComp << "Barrel Tubes"; } if ( ssComp.str() == "nhitac" ) { ssComp.str(""); ssComp << "nhitac"; } if ( ssComp.str() == "rmean" ) { ssComp.str(""); ssComp << "OD rmean"; } if ( ssComp.str() == "odq" ) { ssComp.str(""); ssComp << "Total Charge [p.e.]"; } hMC->Scale( hData->GetEntries() / hMC->GetEntries() ); hMC->GetXaxis()->SetTitle( ssComp.str().c_str() ); hMC->SetNdivisions(507); hMC->GetXaxis()->SetTitleSize(0.055); hMC->GetXaxis()->SetTitleOffset(0.8); hMC->GetXaxis()->CenterTitle(1); hMC->Draw(""); hData->Draw("same"); } void DoCompareSK1( char * type, int instance, int klog, char * var, int bound) { LoadStyle(); TCut * tcuts[5]; tcuts[0] = new TCut(""); tcuts[1] = new TCut(""); tcuts[2] = new TCut("qismsk<65000"); tcuts[3] = new TCut("qismsk<65000&&fabs(entry[2])<500"); stringstream ss; int index = 0; ss << type; if ( ss.str() == "ttb") index = 1; if ( ss.str() == "st" ) index = 2; if ( ss.str() == "sw" ) index = 2; TCut * lCut = tcuts[0]; ss.str(""); ss << "sk3.data/sk3." << type << ".root"; cout << ss.str() << endl; TFile * _data = new TFile( ss.str().c_str() ); ss.str(""); ss << "sk1.data/sk1." << type << ".root"; cout << ss.str() << endl; TFile * _ref = new TFile( ss.str().c_str() ); ss.str(""); ss << "sk3.split/sk3." << type <<"."<< instance << ".root"; TFile * _mc = new TFile( ss.str().c_str() ); TTree * Data = (TTree*) _data->Get("tuneTree"); TTree * MC = (TTree*) _mc->Get("tuneTree"); TTree * Ref = (TTree*) _ref->Get("tuneTree"); TH1F * hData = new TH1F("hData","",60, 0.0, bound); TH1F * hMC = new TH1F("hMC","",60, 0.0, bound); TH1F * hRef = new TH1F("hRef","",60, 0.0, bound); hData->SetLineColor(kBlack); hMC->SetLineColor(kRed); hRef->SetLineColor(kGreen); hData->SetLineWidth(2); hMC->SetLineWidth(2); hRef->SetLineWidth(2); MC->Project("hMC", var, *lCut ); Data->Project("hData", var, *lCut ); Ref->Project("hRef", var, *lCut ); cout << hMC->GetEntries() << " " << hData->GetEntries() << " " << index << endl; stringstream ssComp; ssComp << var; if ( ssComp.str() == "nt" ) { ssComp.str(""); ssComp << "Top Tubes"; } if ( ssComp.str() == "nb" ) { ssComp.str(""); ssComp << "Bottom Tubes"; } if ( ssComp.str() == "nw" ) { ssComp.str(""); ssComp << "Barrel Tubes"; } if ( ssComp.str() == "nhitac" ) { ssComp.str(""); ssComp << "nhitac"; } if ( ssComp.str() == "rmean" ) { ssComp.str(""); ssComp << "OD rmean"; } if ( ssComp.str() == "odq" ) { ssComp.str(""); ssComp << "Total Charge [p.e.]"; } // hMC->Scale( hData->GetEntries() / hMC->GetEntries() ); if( klog == 1 ) c4->SetLogy(1); hMC->GetXaxis()->SetTitle( ssComp.str().c_str() ); hMC->SetNdivisions(507); hMC->GetXaxis()->SetTitleSize(0.055); hMC->GetXaxis()->SetTitleOffset(0.8); hMC->GetXaxis()->CenterTitle(1); hMC->Draw(""); hData->Draw("same"); hRef->Draw("same"); }