Changeset 13737 for fact/tools
- Timestamp:
- 05/15/12 14:47:27 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/PulseTemplates/rootfilehandler.C
r13660 r13737 6 6 using namespace std; 7 7 8 /* 9 POSSIBLE IMPROVEMENT: 10 11 creat files on the heap and handover pointers 12 13 */ 14 15 16 17 8 18 void 9 19 CreateRootFile( 10 20 TString loc_fname, 21 bool overwrite, 11 22 int verbosityLevel 12 23 ) 13 24 { 14 TFile output_rootfile(loc_fname,"UPDATE");25 TFile* output_rootfile; 15 26 16 if (output_rootfile.IsZombie()) 27 if(!overwrite) 28 { 29 output_rootfile = new TFile(loc_fname); 30 if (output_rootfile->IsZombie()) 31 { 32 cout << "file does not exist...creating file" << endl; 33 delete output_rootfile; 34 output_rootfile = new TFile(loc_fname,"NEW"); 35 } 36 else 37 { 38 cout << "file does exist and will be updated" << endl; 39 output_rootfile->OpenFile(loc_fname,"UPDATE"); 40 } 41 } 42 else if(overwrite) 43 { 44 cout << "overwriting file" << endl; 45 output_rootfile = new TFile(loc_fname,"RECREATE"); 46 } 47 48 if (output_rootfile->IsZombie()) 17 49 { 18 50 cout << "Error opening file" << endl; … … 21 53 else { 22 54 if (verbosityLevel > 1) cout << "creating root-file...successfull" << endl; 23 output_rootfile.pwd(); 24 output_rootfile.Close(); 55 output_rootfile->pwd(); 56 output_rootfile->Close(); 57 delete output_rootfile; 25 58 } 26 59 }
Note:
See TracChangeset
for help on using the changeset viewer.