-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutility.cc
More file actions
101 lines (76 loc) · 2.93 KB
/
utility.cc
File metadata and controls
101 lines (76 loc) · 2.93 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//Questo programma contiene funzioni utili all'esecuzione di analisi
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include "TH1D.h"
#include "TH1F.h"
#include "TH2D.h"
#include "TH2F.h"
#include "TCanvas.h"
//Questa funzione serve per creare spazio tra una stampa ed un'altra
void breakLine(){
std::cout<<""<<std::endl;
std::cout<<"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"<<std::endl;
std::cout<<""<<std::endl;
}
//Questa funzione stampa una stringa all'interno di un riquadro
void frame(std::string stringa){
std::cout<<""<<std::endl;
for (int i=0; i<(stringa.size()+6); ++i){
std::cout<<"+";
}
std::cout<<""<<std::endl;
std::cout<<"+ "<<stringa.c_str()<<" +"<<std::endl;
for(int i=0; i<(stringa.size()+6); ++i){
std::cout<<"+";
}
std::cout<<"\n"<<std::endl;
}
//Questa funzione implementa le caratteristiche di un istogramma TH1D
void TH1D_config(TH1D *histo, const char* title, const char* title_x, const char* title_y, int color){
std::string x="";
x+=title_x;
if(strcmp(x.c_str(),"Eta")==0)x="#eta";
if(strcmp(x.c_str(),"Phi")==0)x="#Phi";
if(strcmp(x.c_str(),"Pt")==0)x="Pt [GeV]";
histo->SetTitle(title);
histo->GetXaxis()->SetTitle(x.c_str());
histo->GetYaxis()->SetTitle(title_y);
histo->SetLineColor(color);
histo->SetMarkerColor(color);
}
//Questa funzione implementa le caratteristiche di un istogramma TH1F
void TH1F_config(TH1F *histo, const char* title, const char* title_x, const char* title_y, int color){
std::string x="";
if(strcmp(x.c_str(),"Eta")==0)x="#eta";
if(strcmp(x.c_str(),"Phi")==0)x="#Phi";
if(strcmp(x.c_str(),"Pt")==0)x="Pt [GeV]";
histo->SetTitle(title);
histo->GetXaxis()->SetTitle(x.c_str());
histo->GetYaxis()->SetTitle(title_y);
histo->SetLineColor(color);
histo->SetMarkerColor(color);
}
//Questa funzione implementa le caratteristiche di un istogramma TH2D
void TH2D_config(TH2D *histo, const char* title, const char* title_x, const char* title_y, int color){
histo->SetTitle(title);
histo->GetXaxis()->SetTitle(title_x);
histo->GetYaxis()->SetTitle(title_y);
histo->SetLineColor(color);
histo->SetMarkerColor(color);
}
//Questa funzione implementa le caratteristiche di un istogramma TH2F
void TH2F_config(TH2F *histo, const char* title, const char* title_x, const char* title_y, int color){
histo->SetTitle(title);
histo->GetXaxis()->SetTitle(title_x);
histo->GetYaxis()->SetTitle(title_y);
histo->SetLineColor(color);
histo->SetMarkerColor(color);
}
//Questa funzione analizza gli istogrammi all'interno di un file.root e li scrive su un file di output
void LS_config(std::string rootFile, std::string outfile){
std::cout<<"Removing old config file: "<<outfile.c_str()<<std::endl;
system(Form("rm -rf %s",outfile.c_str()));
std::cout<<"Root File analyzed: "<<rootFile.c_str()<<std::endl;
system(Form("./ls_script.sh %s | tee %s",rootFile.c_str(),outfile.c_str()));
}