-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrootFuncs.cc
More file actions
executable file
·79 lines (62 loc) · 1.46 KB
/
rootFuncs.cc
File metadata and controls
executable file
·79 lines (62 loc) · 1.46 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
//
//
//
#include <iostream>
#include <TROOT.h>
#include <TSystem.h>
#include <TString.h>
#include <TChain.h>
#include <TFile.h>
#include <TTree.h>
#include <TH1.h>
#include "TF1.h"
TFile* OpenRootFile(const TString& rootfile) {
cout << "Rootfile: " << rootfile << endl;
TFile *file=0;
if( gSystem->AccessPathName(rootfile) ){
cout << endl << "File: " << rootfile << " not there!!!" << endl << endl;
file=0;
}
else
file = new TFile(rootfile);
return file;
}
bool hExist(TFile *file,const TString& hname){
bool retval=true;
TKey *key = file->FindKey(hname);
if (key ==0){
cout << "!!Histogram " << hname << " does not exist!!" << endl;
retval=false;
}
return retval;
}
TH1* GetHist(TFile* file,const TString& hname){
TH1* h=0;
if (hExist(file,hname)){
h=(TH1F*)file->Get(hname);
}
return h;
}
Int_t writeIt(Int_t ips=0)
{
std::cout << "Inside writeIt ips= " << ips << std::endl;
// printf("Inside writeIt\n");
return 0;
}
Int_t wait_fcn(Int_t iwait=0)
{
const int cLen = 40;
char cpause[cLen];
string answer;
std::cout << "Inside wait function iwait= " << iwait << std::endl;
if (iwait == 0) return 0;
string wait_string=
"Hit return to continue, q to quit, b to break out of loop";;
std::cout << wait_string << std::endl;
std::cin.getline(cpause, cLen);
std::cout << "Value: " << cpause << std::endl;
answer = cpause;
if (answer == "q") return 1;
if (answer == "b") return 2;
return 0;
}