BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
HistsCompare.cpp
Go to the documentation of this file.
1// Compare all histograms in two root files with same structure.
2
3#include <iostream>
4#include <cstdlib> // For getenv
5#include "AutoHistoCompare.h"
6#include <TH1F.h>
7#include <TCanvas.h>
8
9int main(int argc, char** argv) {
10
11 const char* reffilename = std::getenv("REFFILE");
12 const char* curfilename = std::getenv("CURFILE");
13
14 if ( argc > 1 ) {
15 reffilename = argv[1];
16 }
17 if ( argc > 2 ) {
18 curfilename = argv[2];
19 }
20
21 if ( reffilename == nullptr ) {
22 std::cerr << "Error: reffilename should provide." << std::endl;
23 return 1;
24 }
25 if ( curfilename == nullptr ) {
26 std::cerr << "Error: curfilename should provide." << std::endl;
27 return 1;
28 }
29
30 TH1F *PvHisto = new TH1F("PV", "PV Distribution", 200, -0.1, 1.1);
31
32 AutoHistoCompare *myPV = new AutoHistoCompare(PvHisto, reffilename, curfilename, 2, 0);
33
34 TCanvas* canvas = new TCanvas("canvas", "Histogram Canvas", 800, 600);
35 myPV->DoCompare();
36 PvHisto->Draw();
37 canvas->SaveAs("PVdistribution.eps");
38
39 delete PvHisto;
40 delete myPV;
41 delete canvas;
42
43 return 0;
44}
int main()
Definition phokhara.cc:42