10 ifstream
infile(
"hadoopmap.txt");
11 std::map<TString, TString> _map;
14 mapfile.open(
"hadoopmap.txt");
16 while (std::getline(mapfile,
line)) {
17 mapfile >> oldpath >> newpath;
18 TString oldpath_tstr = oldpath.c_str();
19 TString newpath_tstr = newpath.c_str();
20 _map[oldpath_tstr] = newpath_tstr;
26 if (
inputs.EndsWith(
"/")) {
31 TChain* chain =
new TChain(
name);
34 char hostnamestupid[100];
35 gethostname(hostnamestupid, 100);
36 TString hostname(hostnamestupid);
37 std::cout <<
">>> Hostname is " << hostname << std::endl;
38 bool useXrootd =
inputs.BeginsWith(
"/store/");
48 inputs.ReplaceAll(
"/store",
"root://cmsxrootd.fnal.gov//store");
53 if (_map.find(
ff) != _map.end())
64 std::map<TString, TH1*>
hists;
65 for (
int ikey = 0; ikey <
f->GetListOfKeys()->GetEntries(); ++ikey) {
66 TString histname =
f->GetListOfKeys()->At(ikey)->GetName();
67 hists[histname] = (TH1*)
f->Get(histname);
74 for (
auto&
hist : allhists)
80 std::vector<TString> rtn;
83 if ((
dir = opendir(dirpath.Data())) !=
NULL) {
85 while ((ent = readdir(
dir)) !=
NULL) {
86 if (!TString(ent->d_name).EqualTo(
".") && !TString(ent->d_name).EqualTo(
".."))
87 rtn.push_back(ent->d_name);
93 error(TString::Format(
"Could not open directory = %s", dirpath.Data()));
105 memset(&glob_result, 0,
sizeof(glob_result));
108 int return_value =
glob(
pattern.c_str(), GLOB_TILDE,
NULL, &glob_result);
109 if (return_value != 0) {
110 globfree(&glob_result);
112 ss <<
"glob() failed with return_value " << return_value << endl;
113 throw std::runtime_error(
ss.str());
117 vector<TString> filenames;
118 for (
size_t i = 0;
i < glob_result.gl_pathc; ++
i) {
119 filenames.push_back(
string(glob_result.gl_pathv[
i]));
123 globfree(&glob_result);
void print(TString msg="", const char *fname="", int flush_before=0, int flush_after=0)
vecTString split(TString in, TString separator=" ")
void saveAllHistograms(std::map< TString, TH1 *>, TFile *)
std::vector< TString > glob(const std::string &pattern)
std::map< TString, TH1 * > getAllHistograms(TFile *)
TString join(vecTString in, TString joiner=",", Int_t rm_blanks=1)
TChain * createTChain(TString, TString)
std::vector< TString > getFilePathsInDirectory(TString dirpath)