Changeset 9328 for trunk/MagicSoft/Mars/mfileio
- Timestamp:
- 02/12/09 20:07:51 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/mfileio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
r9318 r9328 192 192 // 193 193 // comp: Compression Level (see TFile, TBranch) 194 // rule: Rule to create output file name (see GetNewFileName())194 // rule: Rule to create output file name (see SubstituteName()) 195 195 // overwrite: Allow newly created file to overwrite old files ("RECREATE") 196 196 // ftitle: File title stored in the file (see TFile) … … 849 849 // "s/source/destination/" 850 850 // 851 // For more details on regular expression see a proper documentation. 851 // For more details on regular expression see a proper documentation, 852 // for example, "man 7 regex" if installed, or TPRegexp. 852 853 // 853 854 // Here is an example: … … 862 863 // your set in your program it must look \\/. 863 864 // 864 TString MWriteRootFile::GetNewFileName(const char *inname) const 865 // Note, that this function has been made static to allow your to 866 // test your split rules, i.e. regular expressions. 867 // 868 TString MWriteRootFile::SubstituteName(const char *regexp, TString fname) 865 869 { 866 870 // Remove the path from the filename 867 TString fname(inname);868 871 if (fname.Last('/')>=0) 869 872 fname.Remove(0, fname.Last('/')+1); … … 873 876 874 877 // Do splitting 875 TObjArray *subStrL = TPRegexp(sed).MatchS( fSplitRule);878 TObjArray *subStrL = TPRegexp(sed).MatchS(regexp); 876 879 if (subStrL->GetEntries()!=6) 877 880 { 878 *fLog << err << "ERROR - GetNewFileName: Evaluating split rule " << fSplitRule<< " failed." << endl;881 gLog << err << "ERROR - SubstituteName: Evaluating regexp " << regexp << " failed." << endl; 879 882 subStrL->Print(); 880 883 delete subStrL; … … 1045 1048 1046 1049 const TString oldname = read->GetFullFileName(); 1047 const TString newname = GetNewFileName(oldname);1050 const TString newname = SubstituteName(fSplitRule, oldname); 1048 1051 if (!ChangeFile(newname)) 1049 1052 return kFALSE; -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h
r8933 r9328 94 94 // File handling 95 95 void Close(); 96 TString GetNewFileName(const char *inname) const;97 96 Bool_t ChangeFile(const char *fname); 98 97 TFile *OpenFile(const char *name, Option_t *option, const char *title, Int_t comp); … … 145 144 void RecursiveRemove(TObject *obj); 146 145 146 static TString SubstituteName(const char *regexp, TString fname); 147 147 148 ClassDef(MWriteRootFile, 1) // Task to write data into a root file 148 149 };
Note:
See TracChangeset
for help on using the changeset viewer.