29 edm::LogInfo(
"AlignmentIORootBase") <<
"Write to new file; first iteration: " << iter ;
30 myFile = TFile::Open(filename,
"recreate");
32 if (iteration == -1) {
35 <<
"Write to existing file; highest iteration: " << iter;
37 if (iteration<=iterfile) {
39 <<
"Iteration " << iteration
40 <<
" invalid or already exists for tree " <<
treename;
44 edm::LogInfo(
"AlignmentIORootBase") <<
"Write to new iteration: " << iter;
46 myFile = TFile::Open(filename,
"update");
59 if ( iterfile == -1 ) {
60 edm::LogError(
"AlignmentIORootBase") <<
"File does not exist!";
62 }
else if ( iterfile == -2 ) {
64 <<
" does not exist in file " <<
filename;
67 if (iteration == -1) {
69 edm::LogInfo(
"AlignmentIORootBase") <<
"Read from highest iteration: " << iter;
71 if (iteration>iterfile) {
73 <<
"Iteration " << iteration <<
" does not exist for tree " <<
treename;
77 edm::LogInfo(
"AlignmentIORootBase") <<
"Read from specified iteration: " << iter;
79 myFile = TFile::Open(filename,
"read");
87 edm::LogError(
"AlignmentIORootBase") <<
"Tree does not exist in file!";
119 testFILE = fopen(filename,
"r");
120 if (testFILE ==
nullptr) {
125 TFile *aFile = TFile::Open(filename,
"read");
126 for (
int iter=0; iter<
itermax; iter++) {
127 if ((
nullptr != (TTree*)aFile->Get(
treeName(iter,tname)))
128 && (iter>ihighest)) ihighest=iter;
140 return TString(tname + Form(
"_%i",iter));
TString treeName(int iter, const TString &tname)
compose tree name
static char const * tname
int testFile(const char *filename, const TString &tname)
test if file is existing and if so, what the highest iteration is
virtual ~AlignmentIORootBase()
destructor
virtual void setBranchAddresses(void)=0
set root branches
int closeRoot(void)
close IO
int openRoot(const char *filename, int iteration, bool writemode)
open IO
virtual void createBranches(void)=0
create root branches