1 TChain *
CreateChainFromList_opt(std::string ListFileName, std::string ChainName, std::string BaseDirectory,
bool DoCheck=
false);
2 void MakeCombinedFile(std::string FileList, std::string BaseDirectory, std::string OutputName);
5 void AssembleSingleFile(std::string FileList, std::string BaseDirectory, std::string OutputName)
8 TFile *
f = TFile::Open(OutputName.c_str(),
"RECREATE");
9 TChain * ch =
CreateChainFromList_opt(FileList.c_str(),BaseDirectory.c_str(),
"pmtresponse/PhotonLibraryData",
false);
11 Int_t Voxel, OpChannel;
13 ch->SetBranchAddress(
"Voxel", &Voxel);
14 ch->SetBranchAddress(
"OpChannel", &OpChannel);
15 ch->SetBranchAddress(
"Visibility", &Visibility);
17 TTree *
tt =
new TTree(
"PhotonLibraryData",
"PhotonLibraryData");
18 tt->Branch(
"Voxel", &Voxel,
"Voxel/I");
19 tt->Branch(
"OpChannel", &OpChannel,
"OpChannel/I");
20 tt->Branch(
"Visibility", &Visibility,
"Visibility/F");
22 for(
int i=0; i!=ch->GetEntries(); ++i)
35 TChain *
CreateChainFromList_opt(std::string ListFileName, std::string BaseDirectory, std::string ChainName,
bool DoCheck)
37 std::ifstream InputFile(ListFileName.c_str());
40 TChain * TheChain =
new TChain(ChainName.c_str());
43 while(getline(InputFile, FileName))
45 FileName=BaseDirectory+FileName;
46 std::cout<<FileName.c_str()<<std::endl;
47 TheChain->Add(FileName.c_str());
52 while(getline(InputFile, FileName))
54 FileName=BaseDirectory+FileName;
55 TFile*
f=TFile::Open(FileName.c_str());
56 if(f->Get(ChainName.c_str()))
58 std::cout<<FileName.c_str()<<std::endl;
59 TheChain->Add(FileName.c_str());
61 else std::cout<<
"Chain " <<ChainName <<
" not found in file " << FileName<<std::endl;
TChain * CreateChainFromList_opt(std::string ListFileName, std::string ChainName, std::string BaseDirectory, bool DoCheck=false)
void AssembleSingleFile(std::string FileList, std::string BaseDirectory, std::string OutputName)
void MakeCombinedFile(std::string FileList, std::string BaseDirectory, std::string OutputName)