Changeset 8716
- Timestamp:
- 08/28/07 11:57:31 (17 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/NEWS
r8709 r8716 7 7 Also the old values seemed not exactly the PulsePos used for 8 8 teh check. 9 10 - general: Resource file now allow an Include-Resource, i.e. you can 11 read a resource file with default settings, include it in your 12 resource file and overwrite the settings in your file. More than 13 one include file is allowed. Inclusions can be iterative. 14 Include: mydefaults.rc yourdefaults.rc 15 The resources in the first file have higher priority than the 16 second file. 9 17 10 18 - general: Now the output files (calib*.root, etc) also contain the … … 105 113 analysis in star might not work as perfect as expected as long 106 114 as old files read in. 115 116 - callisto: The callibration constants of earlier updates got lost 117 somehow. All constants have been updated. 118 119 - star: The PSF is now determined from the profile of the ArcWidth 120 instead of arcwidth/radius. The old way gave to much weight 121 to the bins with low statistics. The reference lines have been 122 updated. 107 123 108 124 - star: For speed reasons events suitable for the muon analysis -
trunk/MagicSoft/Mars/mbase/MEnv.cc
r8695 r8716 31 31 // PrintUntouched() 32 32 // 33 // A new special resource is available. With the resource "Include" 34 // you can include resources from other files, for example 35 // 36 // Include: file1.rc file2.rc 37 // 38 // Including can be done recursively. Resources from the included files 39 // have lower priority. This allows to write a resource file with your 40 // default resources which then can be included in other files overwriting 41 // some of the resources. 42 // 33 43 ////////////////////////////////////////////////////////////////////////////// 34 44 #include "MEnv.h" … … 58 68 fChecked.SetOwner(); 59 69 70 // If TEnv::TEnv has not set fRcName 60 71 if (!IsValid()) 61 72 return; 62 73 74 // ExpandPathName (not done by TEnv::TEnv) and read again 63 75 TString fname(name); 64 76 gSystem->ExpandPathName(fname); 65 77 78 // Is file accessible 66 79 if (gSystem->AccessPathName(fname, kFileExists)) 67 80 fname = ""; … … 69 82 SetRcName(fname); 70 83 71 if (GetEntries()<=0 && !fname.IsNull() && fname!=name) 72 ReadFile(fname, kEnvLocal);; 84 // No file found 85 if (fname.IsNull()) 86 return; 87 88 // File has been already processed, but ReadInclude is part of a 89 // derived function, i.e. not yet executed. 90 if (GetEntries()>0 || fname==name) 91 { 92 if (ReadInclude()<0) 93 SetRcName(""); 94 return; 95 } 96 97 // File not yet processed. Reread file. 98 if (ReadFile(fname, kEnvLocal)<0) 99 SetRcName(""); 100 } 101 102 //--------------------------------------------------------------------------- 103 // 104 // Process an Include directive and read the corresponding contents 105 // 106 Int_t MEnv::ReadInclude() 107 { 108 // Check for "Include" resource 109 const TString incl = GetValue("Include", ""); 110 if (incl.IsNull()) 111 return 0; 112 113 // Tokenize the array into single files divided by a whitespace 114 TObjArray *arr = incl.Tokenize(" "); 115 116 // We have to rebuild the Include array from scratch to get the 117 // correct sorting for a possible rereading. 118 SetValue("Include", ""); 119 120 // FIXME: Make sure that recursions don't crash the system! 121 122 for (int i=0; i<arr->GetEntries(); i++) 123 { 124 // Get file name to include 125 const char *fenv = (*arr)[i]->GetName(); 126 127 // Read included file and check if its valid 128 const MEnv env(fenv); 129 if (!env.IsValid()) 130 { 131 delete arr; 132 return -1; 133 } 134 135 // Add file name before its childs 136 SetValue("+Include", fenv); 137 138 // If it is valid add entries from include without overwriting, 139 // i.e. the included resources have lower priority 140 AddEnv(env, kFALSE); 141 142 // Get a possible child include from env 143 const TString incl2 = const_cast<MEnv&>(env).GetValue("Include", ""); 144 if (!incl2.IsNull()) 145 SetValue("+Include", incl2); 146 } 147 148 delete arr; 149 150 // Get final compiled resource 151 TString inc = GetValue("Include", ""); 152 153 // Remove obsolete whitespaces for convinience 154 inc.ReplaceAll(" ", " "); 155 inc = inc.Strip(TString::kBoth); 156 157 // Set final resource, now as kEnvLocal (previously set as kEnvChnaged) 158 SetValue("Include", inc, kEnvLocal); 159 160 // FIXME: Remove douplets in the correct order 161 162 return 0; 163 } 164 165 //--------------------------------------------------------------------------- 166 // 167 // Read and parse the resource file for a certain level. 168 // Returns -1 on case of error, 0 in case of success. 169 // 170 // Check for an include directive 171 // 172 Int_t MEnv::ReadFile(const char *fname, EEnvLevel level) 173 { 174 // First read the file via TEnv 175 if (TEnv::ReadFile(fname, level)<0) 176 return -1; 177 178 return ReadInclude(); 73 179 } 74 180 -
trunk/MagicSoft/Mars/mbase/MEnv.h
r8675 r8716 22 22 23 23 TString Compile(TString str, const char *post) const; 24 Int_t ReadInclude(); 24 25 25 26 public: … … 67 68 void AddEnv(const TEnv &env, Bool_t overwrite=kTRUE); 68 69 70 Int_t ReadFile(const char *fname, EEnvLevel level); 71 69 72 void PrintEnv(EEnvLevel level = kEnvAll) const; 70 73 void Print(Option_t *option) const { TEnv::Print(option); }
Note:
See TracChangeset
for help on using the changeset viewer.