Esempio n. 1
0
int main()
{
	Stack<char> stack(10),stack1(10);	 
    cout<<"******************************"<<endl;   
	cout<<"*selet an item        "<<endl;
	cout<<"*establish a stack,enter'1'  "<<endl;
	cout<<"*Output                 '2'  "<<endl;
	cout<<"*is or not recurve      '3'  "<<endl;
	cout<<"*quit,enter             '0'  "<<endl;
	cout<<"******************************"<<endl;
	int i;
	do
	{  
		cout<<"ÇëÊäÈëÄãµÄÑ¡Ôñ£º";
		cout<<"1---> establish¡¢2----Output¡¢3----is or not  recurve¡¢0--->quit¡¢"<<endl;
		cin>>i;  
	   switch(i)
	   { 
	      case 1:
			  stack.CreateStack();
			break;
		   case 2:
			   cout<<"the elements in the stack"<<endl; 
               stack.Output();
			   break;
		   case 3:
			   stack.Recurve();
			   break;
		   default:
			   cout<<"please enter a number between 0--3"<<endl;
	   }
	   }while(i!=0);
			return 0;
	
}
Esempio n. 2
0
int main() {

    //Example 1.

    Stack stack1(1000);
    Stack stack2;

    stack2 = stack1;

    return 0;
}
Esempio n. 3
0
int main(void)
{
    init((CELL *)malloc(1024), 256);

    start_ass(EP);
    ass(O_LESS); ass(O_LESS); ass(O_LESS); ass(O_LESS);
    ass(O_GREATER); ass(O_GREATER); ass(O_GREATER); ass(O_GREATER);
    ass(O_EQUAL); ass(O_EQUAL); ass(O_NEQUAL); ass(O_NEQUAL);
    ass(O_LESS0); ass(O_LESS0); ass(O_LESS0); ass(O_GREATER0);
    ass(O_GREATER0); ass(O_GREATER0); ass(O_EQUAL0); ass(O_EQUAL0);
    ass(O_ULESS); ass(O_ULESS); ass(O_ULESS); ass(O_ULESS);
    ass(O_UGREATER); ass(O_UGREATER); ass(O_UGREATER); ass(O_UGREATER);

    assert(single_step() == -259);   // load first instruction word

    stack1();       // set up the stack with four standard pairs to compare
    step(0, 5);     // do the < tests
    stack1();
    step(5, 10);     // do the > tests
    stack2();       // set up the stack with two standard pairs to compare
    step(10, 12);   // do the = tests
    stack2();
    step(12, 15);   // do the <> tests
    stack3();       // set up the stack with three standard values
    step(15, 18);   // do the 0< tests
    stack3();
    step(18, 22);   // do the 0> tests
    SP = S0;  PUSH(237); PUSH(0);	// set up the stack with two values
    step(22, 25);   // do the 0= tests
    stack1();       // set up the stack with four standard pairs to compare
    step(25, 30);   // do the U< tests
    stack1();
    step(30, 35);   // do the U> tests

    assert(exception == 0);
    printf("Comparison tests ran OK\n");
    return 0;
}
Esempio n. 4
0
TEST(Tstack, can_assign_stacks_of_different_size)
{
	Tstack <int> stack(5);
	Tstack <int> stack1(4);
	stack.Push(1);
	stack1 = stack;
	bool flag = true;
	for (int i = 0; i < 5; i++)
	{
		if (stack1.Top() != stack.Top())
		{
			flag = false;
			break;
		}
	}
	EXPECT_EQ(true, flag);
}
Esempio n. 5
0
int main(int argc, char *argv[])
{
	Stack<int> stack1(10);

	for (int i = 0; i < 10; i++)
	{
		stack1.push(i);
	}

	for (int i = 0; i < 10; i++)
	{
		int data;

		if (stack1.pop(data) >= 0)
		{
			cout << "data = " << data << endl;
		}
	}

	return 0;
}
Esempio n. 6
0
void tst_QUndoGroup::setActive()
{
    QUndoGroup group;
    QUndoStack stack1(&group), stack2(&group);

    QCOMPARE(group.activeStack(), (QUndoStack*)0);
    QCOMPARE(stack1.isActive(), false);
    QCOMPARE(stack2.isActive(), false);

    QUndoStack stack3;
    QCOMPARE(stack3.isActive(), true);

    group.addStack(&stack3);
    QCOMPARE(stack3.isActive(), false);

    stack1.setActive();
    QCOMPARE(group.activeStack(), &stack1);
    QCOMPARE(stack1.isActive(), true);
    QCOMPARE(stack2.isActive(), false);
    QCOMPARE(stack3.isActive(), false);

    group.setActiveStack(&stack2);
    QCOMPARE(group.activeStack(), &stack2);
    QCOMPARE(stack1.isActive(), false);
    QCOMPARE(stack2.isActive(), true);
    QCOMPARE(stack3.isActive(), false);

    group.removeStack(&stack2);
    QCOMPARE(group.activeStack(), (QUndoStack*)0);
    QCOMPARE(stack1.isActive(), false);
    QCOMPARE(stack2.isActive(), true);
    QCOMPARE(stack3.isActive(), false);

    group.removeStack(&stack2);
    QCOMPARE(group.activeStack(), (QUndoStack*)0);
    QCOMPARE(stack1.isActive(), false);
    QCOMPARE(stack2.isActive(), true);
    QCOMPARE(stack3.isActive(), false);
}
Esempio n. 7
0
void tst_QUndoGroup::addRemoveStack()
{
    QUndoGroup group;

    QUndoStack stack1(&group);
    QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack1);

    QUndoStack stack2;
    group.addStack(&stack2);
    QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack1 << &stack2);

    group.addStack(&stack1);
    QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack1 << &stack2);

    group.removeStack(&stack1);
    QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack2);

    group.removeStack(&stack1);
    QCOMPARE(group.stacks(), QList<QUndoStack*>() << &stack2);

    group.removeStack(&stack2);
    QCOMPARE(group.stacks(), QList<QUndoStack*>());
}
Esempio n. 8
0
void stack2() { stack1(); }
Esempio n. 9
0
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;
  
}
Esempio n. 10
0
/* mkentry - create base/def and nxt/chk entries for transition array
 *
 * synopsis
 *   int state[numchars + 1], numchars, statenum, deflink, totaltrans;
 *   mkentry( state, numchars, statenum, deflink, totaltrans );
 *
 * "state" is a transition array "numchars" characters in size, "statenum"
 * is the offset to be used into the base/def tables, and "deflink" is the
 * entry to put in the "def" table entry.  If "deflink" is equal to
 * "JAMSTATE", then no attempt will be made to fit zero entries of "state"
 * (i.e., jam entries) into the table.  It is assumed that by linking to
 * "JAMSTATE" they will be taken care of.  In any case, entries in "state"
 * marking transitions to "SAME_TRANS" are treated as though they will be
 * taken care of by whereever "deflink" points.  "totaltrans" is the total
 * number of transitions out of the state.  If it is below a certain threshold,
 * the tables are searched for an interior spot that will accommodate the
 * state array.
 */
void
mkentry(int *state, int numchars, int statenum, int deflink, int totaltrans)
{
    int minec, maxec, i, baseaddr;
    int tblbase, tbllast;

    if (totaltrans == 0) {	/* there are no out-transitions */
	if (deflink == JAMSTATE)
	    base[statenum] = JAMSTATE;
	else
	    base[statenum] = 0;

	def[statenum] = deflink;
	return;
    }

    for (minec = 1; minec <= numchars; ++minec) {
	if (state[minec] != SAME_TRANS)
	    if (state[minec] != 0 || deflink != JAMSTATE)
		break;
    }

    if (totaltrans == 1) {
	/* There's only one out-transition.  Save it for later to fill
	 * in holes in the tables.
	 */
	stack1(statenum, minec, state[minec], deflink);
	return;
    }

    for (maxec = numchars; maxec > 0; --maxec) {
	if (state[maxec] != SAME_TRANS)
	    if (state[maxec] != 0 || deflink != JAMSTATE)
		break;
    }

    /* Whether we try to fit the state table in the middle of the table
     * entries we have already generated, or if we just take the state
     * table at the end of the nxt/chk tables, we must make sure that we
     * have a valid base address (i.e., non-negative).  Note that
     * negative base addresses dangerous at run-time (because indexing
     * the nxt array with one and a low-valued character will access
     * memory before the start of the array.
     */

    /* Find the first transition of state that we need to worry about. */
    if (totaltrans * 100 <= numchars * INTERIOR_FIT_PERCENTAGE) {
	/* Attempt to squeeze it into the middle of the tables. */
	baseaddr = firstfree;

	while (baseaddr < minec) {
	    /* Using baseaddr would result in a negative base
	     * address below; find the next free slot.
	     */
	    for (++baseaddr; chk[baseaddr] != 0; ++baseaddr) ;
	}

	while (baseaddr + maxec - minec + 1 >= current_max_xpairs)
	    expand_nxt_chk();

	for (i = minec; i <= maxec; ++i)
	    if (state[i] != SAME_TRANS &&
		(state[i] != 0 || deflink != JAMSTATE) &&
		chk[baseaddr + i - minec] != 0) {	/* baseaddr unsuitable - find another */
		for (++baseaddr;
		     baseaddr < current_max_xpairs &&
		     chk[baseaddr] != 0; ++baseaddr) ;

		while (baseaddr + maxec - minec + 1 >=
		       current_max_xpairs)
		    expand_nxt_chk();

		/* Reset the loop counter so we'll start all
		 * over again next time it's incremented.
		 */

		i = minec - 1;
	    }
    }

    else {
	/* Ensure that the base address we eventually generate is
	 * non-negative.
	 */
	baseaddr = MAX(tblend + 1, minec);
    }

    tblbase = baseaddr - minec;
    tbllast = tblbase + maxec;

    while (tbllast + 1 >= current_max_xpairs)
	expand_nxt_chk();

    base[statenum] = tblbase;
    def[statenum] = deflink;

    for (i = minec; i <= maxec; ++i)
	if (state[i] != SAME_TRANS)
	    if (state[i] != 0 || deflink != JAMSTATE) {
		nxt[tblbase + i] = state[i];
		chk[tblbase + i] = statenum;
	    }

    if (baseaddr == firstfree)
	/* Find next free slot in tables. */
	for (++firstfree; chk[firstfree] != 0; ++firstfree) ;

    tblend = MAX(tblend, tbllast);
}
Esempio n. 11
0
void ntod (void)
{
	int    *accset, ds, nacc, newds;
	int     sym, hashval, numstates, dsize;
	int     num_full_table_rows=0;	/* used only for -f */
	int    *nset, *dset;
	int     targptr, totaltrans, i, comstate, comfreq, targ;
	int     symlist[CSIZE + 1];
	int     num_start_states;
	int     todo_head, todo_next;

	struct yytbl_data *yynxt_tbl = 0;
	flex_int32_t *yynxt_data = 0, yynxt_curr = 0;

	/* Note that the following are indexed by *equivalence classes*
	 * and not by characters.  Since equivalence classes are indexed
	 * beginning with 1, even if the scanner accepts NUL's, this
	 * means that (since every character is potentially in its own
	 * equivalence class) these arrays must have room for indices
	 * from 1 to CSIZE, so their size must be CSIZE + 1.
	 */
	int     duplist[CSIZE + 1], state[CSIZE + 1];
	int     targfreq[CSIZE + 1] = {0}, targstate[CSIZE + 1];

	/* accset needs to be large enough to hold all of the rules present
	 * in the input, *plus* their YY_TRAILING_HEAD_MASK variants.
	 */
	accset = allocate_integer_array ((num_rules + 1) * 2);
	nset = allocate_integer_array (current_max_dfa_size);

	/* The "todo" queue is represented by the head, which is the DFA
	 * state currently being processed, and the "next", which is the
	 * next DFA state number available (not in use).  We depend on the
	 * fact that snstods() returns DFA's \in increasing order/, and thus
	 * need only know the bounds of the dfas to be processed.
	 */
	todo_head = todo_next = 0;

	for (i = 0; i <= csize; ++i) {
		duplist[i] = NIL;
		symlist[i] = false;
	}

	for (i = 0; i <= num_rules; ++i)
		accset[i] = NIL;

	if (trace) {
		dumpnfa (scset[1]);
		fputs (_("\n\nDFA Dump:\n\n"), stderr);
	}

	inittbl ();

	/* Check to see whether we should build a separate table for
	 * transitions on NUL characters.  We don't do this for full-speed
	 * (-F) scanners, since for them we don't have a simple state
	 * number lying around with which to index the table.  We also
	 * don't bother doing it for scanners unless (1) NUL is in its own
	 * equivalence class (indicated by a positive value of
	 * ecgroup[NUL]), (2) NUL's equivalence class is the last
	 * equivalence class, and (3) the number of equivalence classes is
	 * the same as the number of characters.  This latter case comes
	 * about when useecs is false or when it's true but every character
	 * still manages to land in its own class (unlikely, but it's
	 * cheap to check for).  If all these things are true then the
	 * character code needed to represent NUL's equivalence class for
	 * indexing the tables is going to take one more bit than the
	 * number of characters, and therefore we won't be assured of
	 * being able to fit it into a YY_CHAR variable.  This rules out
	 * storing the transitions in a compressed table, since the code
	 * for interpreting them uses a YY_CHAR variable (perhaps it
	 * should just use an integer, though; this is worth pondering ...
	 * ###).
	 *
	 * Finally, for full tables, we want the number of entries in the
	 * table to be a power of two so the array references go fast (it
	 * will just take a shift to compute the major index).  If
	 * encoding NUL's transitions in the table will spoil this, we
	 * give it its own table (note that this will be the case if we're
	 * not using equivalence classes).
	 */

	/* Note that the test for ecgroup[0] == numecs below accomplishes
	 * both (1) and (2) above
	 */
	if (!fullspd && ecgroup[0] == numecs) {
		/* NUL is alone in its equivalence class, which is the
		 * last one.
		 */
		int     use_NUL_table = (numecs == csize);

		if (fulltbl && !use_NUL_table) {
			/* We still may want to use the table if numecs
			 * is a power of 2.
			 */
			int     power_of_two;

			for (power_of_two = 1; power_of_two <= csize;
			     power_of_two *= 2)
				if (numecs == power_of_two) {
					use_NUL_table = true;
					break;
				}
		}

		if (use_NUL_table)
			nultrans =
				allocate_integer_array (current_max_dfas);

		/* From now on, nultrans != nil indicates that we're
		 * saving null transitions for later, separate encoding.
		 */
	}


	if (fullspd) {
		for (i = 0; i <= numecs; ++i)
			state[i] = 0;

		place_state (state, 0, 0);
		dfaacc[0].dfaacc_state = 0;
	}

	else if (fulltbl) {
		if (nultrans)
			/* We won't be including NUL's transitions in the
			 * table, so build it for entries from 0 .. numecs - 1.
			 */
			num_full_table_rows = numecs;

		else
			/* Take into account the fact that we'll be including
			 * the NUL entries in the transition table.  Build it
			 * from 0 .. numecs.
			 */
			num_full_table_rows = numecs + 1;

		/* Begin generating yy_nxt[][]
		 * This spans the entire LONG function.
		 * This table is tricky because we don't know how big it will be.
		 * So we'll have to realloc() on the way...
		 * we'll wait until we can calculate yynxt_tbl->td_hilen.
		 */
		yynxt_tbl = calloc(1, sizeof (struct yytbl_data));
     
		yytbl_data_init (yynxt_tbl, YYTD_ID_NXT);
		yynxt_tbl->td_hilen = 1;
		yynxt_tbl->td_lolen = (flex_uint32_t) num_full_table_rows;
		yynxt_tbl->td_data = yynxt_data =
			calloc(yynxt_tbl->td_lolen *
					    yynxt_tbl->td_hilen,
					    sizeof (flex_int32_t));
		yynxt_curr = 0;

		buf_prints (&yydmap_buf,
			    "\t{YYTD_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n",
			    long_align ? "flex_int32_t" : "flex_int16_t");

		/* Unless -Ca, declare it "short" because it's a real
		 * long-shot that that won't be large enough.
		 */
		if (gentables)
			out_str_dec
				("static const %s yy_nxt[][%d] =\n    {\n",
				 long_align ? "flex_int32_t" : "flex_int16_t",
				 num_full_table_rows);
		else {
			out_dec ("#undef YY_NXT_LOLEN\n#define YY_NXT_LOLEN (%d)\n", num_full_table_rows);
			out_str ("static const %s *yy_nxt =0;\n",
				 long_align ? "flex_int32_t" : "flex_int16_t");
		}


		if (gentables)
			outn ("    {");

		/* Generate 0 entries for state #0. */
		for (i = 0; i < num_full_table_rows; ++i) {
			mk2data (0);
			yynxt_data[yynxt_curr++] = 0;
		}

		dataflush ();
		if (gentables)
			outn ("    },\n");
	}

	/* Create the first states. */

	num_start_states = lastsc * 2;

	for (i = 1; i <= num_start_states; ++i) {
		numstates = 1;

		/* For each start condition, make one state for the case when
		 * we're at the beginning of the line (the '^' operator) and
		 * one for the case when we're not.
		 */
		if (i % 2 == 1)
			nset[numstates] = scset[(i / 2) + 1];
		else
			nset[numstates] =
				mkbranch (scbol[i / 2], scset[i / 2]);

		nset = epsclosure (nset, &numstates, accset, &nacc,
				   &hashval);

		if (snstods (nset, numstates, accset, nacc, hashval, &ds)) {
			numas += nacc;
			totnst += numstates;
			++todo_next;

			if (variable_trailing_context_rules && nacc > 0)
				check_trailing_context (nset, numstates,
							accset, nacc);
		}
	}

	if (!fullspd) {
		if (!snstods (nset, 0, accset, 0, 0, &end_of_buffer_state))
			flexfatal (_
				   ("could not create unique end-of-buffer state"));

		++numas;
		++num_start_states;
		++todo_next;
	}


	while (todo_head < todo_next) {
		targptr = 0;
		totaltrans = 0;

		for (i = 1; i <= numecs; ++i)
			state[i] = 0;

		ds = ++todo_head;

		dset = dss[ds];
		dsize = dfasiz[ds];

		if (trace)
			fprintf (stderr, _("state # %d:\n"), ds);

		sympartition (dset, dsize, symlist, duplist);

		for (sym = 1; sym <= numecs; ++sym) {
			if (symlist[sym]) {
				symlist[sym] = 0;

				if (duplist[sym] == NIL) {
					/* Symbol has unique out-transitions. */
					numstates =
						symfollowset (dset, dsize,
							      sym, nset);
					nset = epsclosure (nset,
							   &numstates,
							   accset, &nacc,
							   &hashval);

					if (snstods
					    (nset, numstates, accset, nacc,
					     hashval, &newds)) {
						totnst = totnst +
							numstates;
						++todo_next;
						numas += nacc;

						if (variable_trailing_context_rules && nacc > 0)
							check_trailing_context
								(nset,
								 numstates,
								 accset,
								 nacc);
					}

					state[sym] = newds;

					if (trace)
						fprintf (stderr,
							 "\t%d\t%d\n", sym,
							 newds);

					targfreq[++targptr] = 1;
					targstate[targptr] = newds;
					++numuniq;
				}

				else {
					/* sym's equivalence class has the same
					 * transitions as duplist(sym)'s
					 * equivalence class.
					 */
					targ = state[duplist[sym]];
					state[sym] = targ;

					if (trace)
						fprintf (stderr,
							 "\t%d\t%d\n", sym,
							 targ);

					/* Update frequency count for
					 * destination state.
					 */

					i = 0;
					while (targstate[++i] != targ) ;

					++targfreq[i];
					++numdup;
				}

				++totaltrans;
				duplist[sym] = NIL;
			}
		}


		numsnpairs += totaltrans;

		if (ds > num_start_states)
			check_for_backing_up (ds, state);

		if (nultrans) {
			nultrans[ds] = state[NUL_ec];
			state[NUL_ec] = 0;	/* remove transition */
		}

		if (fulltbl) {

			/* Each time we hit here, it's another td_hilen, so we realloc. */
			yynxt_tbl->td_hilen++;
			yynxt_tbl->td_data = yynxt_data =
				realloc (yynxt_data,
						     yynxt_tbl->td_hilen *
						     yynxt_tbl->td_lolen *
						     sizeof (flex_int32_t));


			if (gentables)
				outn ("    {");

			/* Supply array's 0-element. */
			if (ds == end_of_buffer_state) {
				mk2data (-end_of_buffer_state);
				yynxt_data[yynxt_curr++] =
					-end_of_buffer_state;
			}
			else {
				mk2data (end_of_buffer_state);
				yynxt_data[yynxt_curr++] =
					end_of_buffer_state;
			}

			for (i = 1; i < num_full_table_rows; ++i) {
				/* Jams are marked by negative of state
				 * number.
				 */
				mk2data (state[i] ? state[i] : -ds);
				yynxt_data[yynxt_curr++] =
					state[i] ? state[i] : -ds;
			}

			dataflush ();
			if (gentables)
				outn ("    },\n");
		}

		else if (fullspd)
			place_state (state, ds, totaltrans);

		else if (ds == end_of_buffer_state)
			/* Special case this state to make sure it does what
			 * it's supposed to, i.e., jam on end-of-buffer.
			 */
			stack1 (ds, 0, 0, JAMSTATE);

		else {		/* normal, compressed state */

			/* Determine which destination state is the most
			 * common, and how many transitions to it there are.
			 */

			comfreq = 0;
			comstate = 0;

			for (i = 1; i <= targptr; ++i)
				if (targfreq[i] > comfreq) {
					comfreq = targfreq[i];
					comstate = targstate[i];
				}

			bldtbl (state, ds, totaltrans, comstate, comfreq);
		}
	}

	if (fulltbl) {
		dataend ();
		if (tablesext) {
			yytbl_data_compress (yynxt_tbl);
			if (yytbl_data_fwrite (&tableswr, yynxt_tbl) < 0)
				flexerror (_
					   ("Could not write yynxt_tbl[][]"));
		}
		if (yynxt_tbl) {
			yytbl_data_destroy (yynxt_tbl);
			yynxt_tbl = 0;
		}
	}

	else if (!fullspd) {
		cmptmps ();	/* create compressed template entries */

		/* Create tables for all the states with only one
		 * out-transition.
		 */
		while (onesp > 0) {
			mk1tbl (onestate[onesp], onesym[onesp],
				onenext[onesp], onedef[onesp]);
			--onesp;
		}

		mkdeftbl ();
	}

	free(accset);
	free(nset);
}
Esempio n. 12
0
File: main.c Progetto: 10jschen/acl
static void trace(void)
{
	stack1();
}
Esempio n. 13
0
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 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;
  
}
Esempio n. 15
0
TEST(Tstack, can_create_copied_stack)
{
	Tstack <int> stack(5);
	ASSERT_NO_THROW(Tstack <int> stack1(stack));
}