forked from acts-project/acts
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcompareHitHistograms.C
More file actions
47 lines (40 loc) · 1.4 KB
/
compareHitHistograms.C
File metadata and controls
47 lines (40 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// This file is part of the ACTS project.
//
// Copyright (C) 2016 CERN for the benefit of the ACTS project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
/*
* compareHitHistograms.C
*
* Created on: 15 Dec 2016
* Author: jhrdinka
*/
#include <tuple>
#include "TFile.h"
#include "TH1F.h"
#include "TROOT.h"
#include "TTree.h"
// This root script draws all histograms given in a vector into the same Canvas.
// The information should be handed over as a vector of a tuple.
// The first entry should be the Name of the file, where the histogram can be
// found. The second entry should be the name of the histogram. The third entry
// is the color in which the histogram should be printed.
void
compareHitHistograms(
std::vector<std::tuple<std::string, std::string, int>> hist)
{
for (auto& i : hist) {
std::cout << "Opening file: " << std::get<0>(i).c_str() << std::endl;
TFile inputFile(std::get<0>(i).c_str());
TDirectory dir = outputFile.mkdir(layerName.c_str());
dir->cd();
std::cout << "Comparing Histogram: " << std::get<1>(i).c_str() << std::endl;
TH2F* h = (TH2F*)inputFile.Get(std::get<1>(i).c_str());
h->SetMarkerColor(std::get<2>(i));
h->Draw("same");
h->SetDirectory(0);
inputFile.Close();
}
}