Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:11

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 /*
0010  * compareHitHistograms.C
0011  *
0012  *  Created on: 15 Dec 2016
0013  *      Author: jhrdinka
0014  */
0015 
0016 #include <tuple>
0017 #include "TFile.h"
0018 #include "TH1F.h"
0019 #include "TROOT.h"
0020 #include "TTree.h"
0021 
0022 // This root script draws all histograms given in a vector into the same Canvas.
0023 // The information should be handed over as a vector of a tuple.
0024 // The first entry should be the Name of the file, where the histogram can be
0025 // found. The second entry should be the name of the histogram. The third entry
0026 // is the color in which the histogram should be printed.
0027 
0028 void
0029 compareHitHistograms(
0030     std::vector<std::tuple<std::string, std::string, int>> hist)
0031 {
0032   for (auto& i : hist) {
0033     std::cout << "Opening file: " << std::get<0>(i).c_str() << std::endl;
0034     TFile      inputFile(std::get<0>(i).c_str());
0035     TDirectory dir = outputFile.mkdir(layerName.c_str());
0036     dir->cd();
0037 
0038     std::cout << "Comparing Histogram: " << std::get<1>(i).c_str() << std::endl;
0039 
0040     TH2F* h = (TH2F*)inputFile.Get(std::get<1>(i).c_str());
0041     h->SetMarkerColor(std::get<2>(i));
0042     h->Draw("same");
0043     h->SetDirectory(0);
0044 
0045     inputFile.Close();
0046   }
0047 }