void ConfigDialog::_getTranslations(QStringList & _translationFiles) const { QDir pluginFolder(m_strIniPath); QStringList nameFilters("gliden64_*.qm"); _translationFiles = pluginFolder.entryList(nameFilters, QDir::Files, QDir::Name); }
void DimuonPlots(TString pluginSuffix = ""){ // Specify all input files TFile* a_file[nFiles]; for(size_t iFile=0; iFile<nFiles; ++iFile) a_file[iFile]=0; a_file[0]=new TFile(inpath->Copy().Append("data/allData.root")); //a_file[1]=new TFile(inpath->Copy().Append("mc/zmumu.root")); a_file[1]=new TFile(inpath->Copy().Append("mc/zmumuB.root")); a_file[2]=new TFile(inpath->Copy().Append("mc/zmumuUdsc.root")); a_file[3]=new TFile(inpath->Copy().Append("mc/zz.root")); a_file[4]=new TFile(inpath->Copy().Append("mc/wz.root")); a_file[5]=new TFile(inpath->Copy().Append("mc/ww.root")); a_file[6]=new TFile(inpath->Copy().Append("mc/ztautau.root")); a_file[7]=new TFile(inpath->Copy().Append("mc/wmunu.root")); a_file[8]=new TFile(inpath->Copy().Append("mc/wtaunu.root")); a_file[9]=new TFile(inpath->Copy().Append("mc/singletopTw.root")); a_file[10]=new TFile(inpath->Copy().Append("mc/ttbar.root")); a_file[11]=new TFile(inpath->Copy().Append("mc/qcd.root")); //Specify plugin name TString* pluginName(0); pluginName = new TString("DiMuonAnalyzer"); TString* pluginFolder(0); pluginFolder = new TString("OppositeCharge"); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Do not touch this area pluginName->Append(pluginSuffix); if(!pluginName->IsNull())pluginName->Append("/"); if(!pluginFolder->IsNull())pluginFolder->Append("/"); HistogramTools tools; tools.SetDefaultStyle(); TCanvas* canvas1(0); TLegend* legend1(0); TH1F* a_hist1[nFiles]; for(size_t iFile=0; iFile<nFiles; ++iFile) a_hist1[iFile]=0; TH1F* a_hist2[nFiles]; // For addition of histograms for(size_t iFile=0; iFile<nFiles; ++iFile) a_hist2[iFile]=0; THStack* stack1(0); TString* histName1(0); TString* histName2(0); // For addition of histograms TString* plotName1(0); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("h_nDimuon"); // Give base name of output plot plotName1 = new TString("nDimuon"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("h_deltaEta"); // Give base name of output plot plotName1 = new TString("deltaEta"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("h_deltaPhi"); // Give base name of output plot plotName1 = new TString("deltaPhi"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("h_diMass"); // Give base name of output plot plotName1 = new TString("diMass"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("h_diPt"); // Give base name of output plot plotName1 = new TString("diPt"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("h_diY"); // Give base name of output plot plotName1 = new TString("diY"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("h_etaHigh"); // Give base name of output plot plotName1 = new TString("etaHigh"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("h_etaLow"); // Give base name of output plot plotName1 = new TString("etaLow"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("h_etaLow"); // Give name of second input histogram for addition histName2 = new TString("h_etaHigh"); // Give base name of output plot plotName1 = new TString("etaBoth"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName2, a_hist2); tools.AddHistArrays(a_hist1, a_hist2); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->SetTitle("pseudorapidity of both muons"); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete histName2; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist2[iFile])a_hist2[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("h_ptHigh"); // Give base name of output plot plotName1 = new TString("ptHigh"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("h_ptLow"); // Give base name of output plot plotName1 = new TString("ptLow"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("h_ptLow"); // Give name of second input histogram for addition histName2 = new TString("h_ptHigh"); // Give base name of output plot plotName1 = new TString("ptBoth"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName2, a_hist2); tools.AddHistArrays(a_hist1, a_hist2); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->SetTitle("transverse momentum p_{t} of both muons"); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete histName2; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist2[iFile])a_hist2[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // again, no changes here delete pluginFolder; delete pluginName; for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_file[iFile])a_file[iFile]->Close(); } //delete inpath; //delete outpath; //delete outform; }
void MuonPlots(TString pluginSuffix = ""){ // Specify all input files TFile* a_file[nFiles]; for(size_t iFile=0; iFile<nFiles; ++iFile) a_file[iFile]=0; a_file[0]=new TFile(inpath->Copy().Append("data/allData.root")); //a_file[1]=new TFile(inpath->Copy().Append("mc/zmumu.root")); a_file[1]=new TFile(inpath->Copy().Append("mc/zmumuB.root")); a_file[2]=new TFile(inpath->Copy().Append("mc/zmumuUdsc.root")); a_file[3]=new TFile(inpath->Copy().Append("mc/zz.root")); a_file[4]=new TFile(inpath->Copy().Append("mc/wz.root")); a_file[5]=new TFile(inpath->Copy().Append("mc/ww.root")); a_file[6]=new TFile(inpath->Copy().Append("mc/ztautau.root")); a_file[7]=new TFile(inpath->Copy().Append("mc/wmunu.root")); a_file[8]=new TFile(inpath->Copy().Append("mc/wtaunu.root")); a_file[9]=new TFile(inpath->Copy().Append("mc/singletopTw.root")); a_file[10]=new TFile(inpath->Copy().Append("mc/ttbar.root")); a_file[11]=new TFile(inpath->Copy().Append("mc/qcd.root")); //Specify plugin name TString* pluginName(0); pluginName = new TString("MuonAnalyzer"); TString* pluginFolder(0); pluginFolder = new TString(""); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Do not touch this area pluginName->Append(pluginSuffix); if(!pluginName->IsNull())pluginName->Append("/"); if(!pluginFolder->IsNull())pluginFolder->Append("/"); HistogramTools tools; tools.SetDefaultStyle(); TCanvas* canvas1(0); TLegend* legend1(0); TH1F* a_hist1[nFiles]; for(size_t iFile=0; iFile<nFiles; ++iFile) a_hist1[iFile]=0; THStack* stack1(0); TString* histName1(0); TString* plotName1(0); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("EventProperties/h_nMuon"); // Give base name of output plot plotName1 = new TString("nMuon"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("MuonProperties/h_chi2"); // Give base name of output plot plotName1 = new TString("chi2"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("MuonProperties/h_d0Beamspot"); // Give base name of output plot plotName1 = new TString("d0Beamspot"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("MuonProperties/h_eta"); // Give base name of output plot plotName1 = new TString("eta"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("MuonProperties/h_isGlobal"); // Give base name of output plot plotName1 = new TString("isGlobal"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("MuonProperties/h_isTracker"); // Give base name of output plot plotName1 = new TString("isTracker"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("MuonProperties/h_nMatches"); // Give base name of output plot plotName1 = new TString("nMatches"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("MuonProperties/h_nMuonHitsGlobal"); // Give base name of output plot plotName1 = new TString("nMuonHitsGlobal"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("MuonProperties/h_nPixelHits"); // Give base name of output plot plotName1 = new TString("nPixelHits"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("MuonProperties/h_nTrackerHits"); // Give base name of output plot plotName1 = new TString("nTrackerHits"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("MuonProperties/h_pt"); // Give base name of output plot plotName1 = new TString("pt"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("MuonProperties/h_isoCombRel"); // Give base name of output plot plotName1 = new TString("isoCombRel"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); stack1->GetXaxis()->SetRangeUser(0.,3.); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("MuonProperties/h_isoTrk"); // Give base name of output plot plotName1 = new TString("isoTrk"); // Change position & size of legend legend1 = new TLegend(0.65,0.55,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArray(a_file, pluginName->Copy().Append(*pluginFolder), *histName1, a_hist1); tools.SetPlotFilling(a_hist1); tools.SetWeights(a_hist1, dataLumi); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1); // If you want to set maximum by hand, else use function and scale // stack1->SetMaximum(30); stack1->SetMaximum(tools.GetMaximumValue(stack1, a_hist1[0]) *1.2); tools.FillLegend(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); if(a_hist1[0]){ a_hist1[0]->Draw("same,e1"); } legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); stack1->SetMinimum(0.01); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_hist1[iFile])a_hist1[iFile]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // again, no changes here delete pluginFolder; delete pluginName; for(size_t iFile=0; iFile<nFiles; ++iFile){ if(a_file[iFile])a_file[iFile]->Close(); } //delete inpath; //delete outpath; //delete outform; }
void FUPluginManager::LoadPluginsInFolderName(const fstring& folderName, const fchar* _filter) { // Append the wanted extension for the plugins. FUStringBuilder pluginFolder(folderName); fchar lastChar = folderName[pluginFolder.length() - 1]; if (lastChar != '\\' && lastChar != '/') pluginFolder.append((fchar) '/'); pluginFolder.append(FC("Plugins/")); pluginFolderName = pluginFolder.ToString(); if (_filter == NULL || _filter[0] == 0) _filter = FC("*.*"); do { const fchar* nextFilter = fstrchr(_filter, '|'); fstring filter(_filter); if (nextFilter != NULL) { filter.erase(nextFilter - _filter); ++nextFilter; // skip the pipe. } _filter = nextFilter; // Windows-only for now. #if defined(WIN32) size_t filterLength = filter.length(); // Iterate over all the filtered files within the given folder. ffinddata folderIterator; fstring searchString = pluginFolderName + filter; intptr_t folderHandle = ffindfirst(searchString.c_str(), &folderIterator); if (folderHandle != -1L) { int32 isDone = FALSE; while (isDone == FALSE) { bool keep = false; PluginLibrary* library = new PluginLibrary(); library->filename = pluginFolderName + folderIterator.name; // work around for wildcards and 3 letter extensions that pick up 3+ letter extensions // e.g. "dir *.fvp" in command prompt on a directory with "a.fvp", "a.fvpa", and "a.dll" returns // "a.fvp" and "a.fvpa" bool checkModule = true; if (filterLength > 3) { if ((filter.at(filterLength-4) == FC('.')) && (filter.at(filterLength-3) != FC('*')) && (filter.at(filterLength-2) != FC('*')) && (filter.at(filterLength-1) != FC('*'))) { size_t filepathLength = fstrlen(folderIterator.name); checkModule = (folderIterator.name[filepathLength-4] == filter.at(filterLength-4)) && (folderIterator.name[filepathLength-3] == filter.at(filterLength-3)) && (folderIterator.name[filepathLength-2] == filter.at(filterLength-2)) && (folderIterator.name[filepathLength-1] == filter.at(filterLength-1)); } } library->module = LoadLibrary(library->filename.c_str()); if (checkModule && (library->module != NULL)) { // Retrieve the necessary callbacks library->getPluginCount = (GetPluginCount) GetProcAddress(library->module, "GetPluginCount"); library->getPluginType = (GetPluginType) GetProcAddress(library->module, "GetPluginType"); library->createPlugin = (CreatePlugin) GetProcAddress(library->module, "CreatePlugin"); keep = library->createPlugin != NULL && library->getPluginType != NULL && library->getPluginCount != NULL; } // This is a valid library. if (keep) loadedLibraries.push_back(library); else { SAFE_DELETE(library); } isDone = ffindnext(folderHandle, &folderIterator); } ffindclose(folderHandle); } #elif defined(__APPLE__) || defined(LINUX) fm::string s_filter = TO_STRING(filter); if (s_filter.length() > 0 && s_filter.front() == '*') s_filter.erase(0, 1); if (s_filter.length() > 0 && s_filter.back() == '*') s_filter.pop_back(); DIR* directory = opendir(TO_STRING(pluginFolderName).c_str()); if (directory == NULL) continue; dirent* directoryEntry; while ((directoryEntry = readdir(directory)) != NULL) { if (directoryEntry->d_type == DT_DIR) continue; // skip sub-folders. if (strstr((const char*) directoryEntry->d_name, s_filter.c_str()) != NULL) { // We have a match. bool keep = false; PluginLibrary* library = new PluginLibrary(); library->filename = pluginFolderName + TO_FSTRING((const char*) directoryEntry->d_name); fm::string libraryModuleFilename = TO_STRING(library->filename); DEBUG_OUT("Found dynamic library: %s\n", libraryModuleFilename.c_str()); library->module = dlopen(libraryModuleFilename.c_str(), RTLD_NOW); if (library->module != NULL) { // Retrieve the necessary callbacks library->getPluginCount = (GetPluginCount) dlsym(library->module, "GetPluginCount"); library->getPluginType = (GetPluginType) dlsym(library->module, "GetPluginType"); library->createPlugin = (CreatePlugin) dlsym(library->module, "CreatePlugin"); keep = library->createPlugin != NULL && library->getPluginType != NULL && library->getPluginCount != NULL; } // This is a valid library. if (keep) loadedLibraries.push_back(library); else { SAFE_DELETE(library); } } } closedir(directory); #endif // WIN32 } while (_filter != NULL); }
void GeneratorZmumuPlots(TString pluginSuffix = ""){ // Specify all input files TFile* file; file = new TFile(inpath->Copy().Append("simulation/generatorTopZmumu.root")); //file = new TFile(inpath->Copy().Append("generatorTopZmumuSelection.root")); //Specify plugin name TString* pluginName(0); pluginName = new TString("GeneratorZmumuAnalyzer"); TString* a_flavour[nFlavour]; for(size_t iFlavour=0; iFlavour<nFlavour; ++iFlavour) a_flavour[iFlavour]=0; a_flavour[1] = new TString(""); //a_flavour[2] = new TString("C"); //a_flavour[3] = new TString("B"); TString* pluginFolder(0); pluginFolder = new TString(""); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Do not touch this area if(!pluginFolder->IsNull())pluginFolder->Append("/"); TString* a_baseString[nFlavour]; for(size_t iFlavour=0; iFlavour<nFlavour; ++iFlavour) a_baseString[iFlavour]=0; for(size_t iFlavour=0; iFlavour<nFlavour; ++iFlavour){ // do not use array [0] if(!a_flavour[iFlavour])continue; const TString flavour(*a_flavour[iFlavour]); a_baseString[iFlavour] = new TString(pluginName->Copy().Append(flavour).Append(pluginSuffix).Append("/").Append(*pluginFolder)); } //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Do not touch this area HistogramTools tools; //tools.SetDefaultStyle(); // for publications tdr style is used setTDRStyle(); TGaxis::SetMaxDigits(3); TCanvas* canvas1(0); TLegend* legend1(0); TH1F* a_hist1[nFlavour]; // do not use array [0] for(size_t iFlavour=0; iFlavour<nFlavour; ++iFlavour) a_hist1[iFlavour]=0; TH1F* a_hist2[nFlavour]; // For addition of histograms for(size_t iFlavour=0; iFlavour<nFlavour; ++iFlavour) a_hist2[iFlavour]=0; THStack* stack1(0); TString* histName1(0); TString* histName2(0); // For addition of histograms TString* plotName1(0); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("GeneratedZ/h_zMass"); // Give base name of output plot plotName1 = new TString("Z_mass"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("GeneratedZ/h_zEta"); // Give base name of output plot plotName1 = new TString("Z_eta"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("GeneratedZ/h_zY"); // Give base name of output plot plotName1 = new TString("Z_y"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("GeneratedZ/h_zPt"); // Give base name of output plot plotName1 = new TString("Z_pt"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("GeneratedZ/h_zQuarkOrigin"); // Give base name of output plot plotName1 = new TString("Z_quarkOrigin"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("SingleMu/h_muEtaHigh"); // Give base name of output plot plotName1 = new TString("mu_etaHigh"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("SingleMu/h_muEtaLow"); // Give base name of output plot plotName1 = new TString("mu_etaLow"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("SingleMu/h_muEtaLow"); // Give name of second input histogram for addition histName2 = new TString("SingleMu/h_muEtaHigh"); // Give base name of output plot plotName1 = new TString("mu_etaBoth"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1, nFlavour); tools.GetHistArraySameFile(file, a_baseString, *histName2, a_hist2, nFlavour); tools.AddHistArrays(a_hist1, a_hist2, nFlavour); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->SetTitle("pseudorapidity #eta of both muons"); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete histName2; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist2[iHist])a_hist2[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("SingleMu/h_muPtHigh"); // Give base name of output plot plotName1 = new TString("mu_ptHigh"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("SingleMu/h_muPtLow"); // Give base name of output plot plotName1 = new TString("mu_ptLow"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("SingleMu/h_muPtLow"); // Give name of second input histogram for addition histName2 = new TString("SingleMu/h_muPtHigh"); // Give base name of output plot plotName1 = new TString("mu_ptBoth"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1, nFlavour); tools.GetHistArraySameFile(file, a_baseString, *histName2, a_hist2, nFlavour); tools.AddHistArrays(a_hist1, a_hist2, nFlavour); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->SetTitle("transverse momentum p_{t} of both muons"); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete histName2; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist2[iHist])a_hist2[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("DiMu/h_diMuMass"); // Give base name of output plot plotName1 = new TString("diMu_mass"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("DiMu/h_diMuEta"); // Give base name of output plot plotName1 = new TString("diMu_eta"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("DiMu/h_diMuPt"); // Give base name of output plot plotName1 = new TString("diMu_pt"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("Difference/h_diffMass"); // Give base name of output plot plotName1 = new TString("diff_mass"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("Difference/h_diffEta"); // Give base name of output plot plotName1 = new TString("diff_eta"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram histName1 = new TString("Difference/h_diffPt"); // Give base name of output plot plotName1 = new TString("diff_pt"); // Change position & size of legend legend1 = new TLegend(0.85,0.75,0.99,0.95); // Change only style here canvas1 = new TCanvas("plot", "plot", 800, 800); tools.GetHistArraySameFile(file, a_baseString, *histName1, a_hist1); tools.SetPlotFilling(a_hist1, nFlavour); stack1 = new THStack("stack","stack"); tools.FillStack(stack1, a_hist1, nFlavour); tools.FillLegendGenerator(legend1, a_hist1, "f"); canvas1->Clear(); stack1->Draw(); //legend1->Draw("same"); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append(*outform)); gPad->SetLogy(1); canvas1->Update(); canvas1->Print(outpath->Copy().Append(*plotName1).Append(pluginSuffix).Append("_log").Append(*outform)); delete histName1; delete plotName1; legend1->Delete(); stack1->Delete(); for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_hist1[iHist])a_hist1[iHist]->Delete(); } canvas1->Close(); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // Next few lines are only one to change for histo (except for individual style changes) // Give name of input histogram // histName1 = new TString("Difference/h2_zMassVsDiMuMass"); // Give base name of output plot // plotName1 = new TString("diff_2d_mass"); //++++++++++++++++++++++++++++++++++=====================================+++++++++++++++++++++++++++++++ // again, no changes here for(size_t iHist=0; iHist<nFlavour; ++iHist){ if(a_flavour[iHist])delete a_flavour[iHist]; } delete pluginFolder; delete pluginName; file->Close(); // do not delete as long as they are defined outside function //delete inpath; //delete outpath; //delete outform; }