Changeset 1299 for trunk/MagicSoft/Mars
- Timestamp:
- 04/24/02 18:02:11 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1298 r1299 17 17 - added usage of Data-Chains 18 18 - added a profiling option to the draw functions 19 - use the title (rule) of the data-chain as axis title 19 20 20 21 * mhist/Makefile: 21 22 - added mdata-path 23 24 * mbase/MParContainer.h: 25 - changed some output in GetterFunction 22 26 23 27 -
trunk/MagicSoft/Mars/NEWS
r1283 r1299 3 3 *** Version 0.7 4 4 5 - added a bugfix to MCerPhotCalc. In older camera versions (<=40) 6 the pedestal mean value was saved incorrectly. For files from 7 this versions we substract 0.5 from the pedestal mean. 8 WARNING: This may effect your results, so don't wonder... 9 5 10 - Ascii Output can now also be used for parameter containers which 6 11 doesn't overload MParCointainer::AsciiWrite -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r1283 r1299 325 325 if (!cls) 326 326 { 327 *fLog << err << "No (base) class containing '" << name << "'." << endl; 327 *fLog << err << "'" << name << "' is neither a member of "; 328 *fLog << GetDescriptor() << " nor one of its base classes." << endl; 328 329 return NULL; 329 330 } -
trunk/MagicSoft/Mars/mdata/MDataChain.cc
r1287 r1299 46 46 { 47 47 fName = name ? name : "MDataChain"; 48 fTitle = title ? title : "MDataChain";48 fTitle = title ? title : rule; 49 49 50 50 *fLog << inf << "Trying to resolve rule..." << endl; -
trunk/MagicSoft/Mars/mhist/MH3.cc
r1284 r1299 63 63 #include <TH2.h> 64 64 #include <TH3.h> 65 #include <TProfile.h> 66 #include <TProfile2D.h> 65 67 #include <TPad.h> 66 68 #include <TCanvas.h> … … 73 75 #include "MParList.h" 74 76 77 #include "MDataChain.h" 78 75 79 ClassImp(MH3); 76 80 … … 80 84 // description see the class description above. 81 85 // 82 MH3::MH3(const char *memberx) : fDimension(1) 86 MH3::MH3(const char *memberx) 87 : fDimension(1) 83 88 { 84 89 fHist = new TH1F; 85 90 86 fDataMember[0] = memberx; 91 fData[0] = new MDataChain(memberx); 92 fData[1] = NULL; 93 fData[2] = NULL; 87 94 88 95 fName = "MH3"; … … 103 110 // description above. 104 111 // 105 MH3::MH3(const char *memberx, const char *membery) : fDimension(2) 112 MH3::MH3(const char *memberx, const char *membery) 113 : fDimension(2) 106 114 { 107 115 fHist = new TH2F; 108 116 109 fDataMember[0] = memberx; 110 fDataMember[1] = membery; 117 fData[0] = new MDataChain(memberx); 118 fData[1] = new MDataChain(membery); 119 fData[2] = NULL; 111 120 112 121 fName = "MH3"; … … 127 136 // description see the class description above. 128 137 // 129 MH3::MH3(const char *memberx, const char *membery, const char *memberz) : fDimension(3) 138 MH3::MH3(const char *memberx, const char *membery, const char *memberz) 139 : fDimension(3) 130 140 { 131 141 fHist = new TH3F; 132 142 133 fData Member[0] = memberx;134 fData Member[1] = membery;135 fData Member[2] = memberz;143 fData[0] = new MDataChain(memberx); 144 fData[1] = new MDataChain(membery); 145 fData[2] = new MDataChain(memberz); 136 146 137 147 fName = "MH3"; 138 148 fTitle = "Container for a 3D Mars Histogram"; 149 150 fHist->SetDirectory(NULL); 139 151 140 152 fScale[0] = 1; … … 150 162 { 151 163 delete fHist; 152 } 153 154 // -------------------------------------------------------------------------- 155 // 156 // Trys to determin the TMethodCall corresponding to the num-axis 157 // corresponding data member. 158 // 159 Bool_t MH3::GetMethodCall(const MParList *plist, Int_t num) 160 { 161 TString cname(fDataMember[num]); 162 TString mname(fDataMember[num]); 163 164 const char *dot = strrchr(cname, '.'); 165 166 if (dot) 167 { 168 const int pos = dot-cname; 169 170 cname.Remove(pos); 171 mname.Remove(0, pos+1); 172 } 173 174 fObject[num] = (MParContainer*)plist->FindObject(cname); 175 if (!fObject[num]) 176 { 177 *fLog << err << "Object '" << cname << "' not in parameter list... aborting." << endl; 178 return kFALSE; 179 } 180 181 fMethodCall[num] = fObject[num]->GetterMethod(mname); 182 183 return fMethodCall[num] ? kTRUE : kFALSE; 184 } 185 164 165 for (int i=0; i<3; i++) 166 if (fData[i]) 167 delete fData[i]; 168 } 186 169 187 170 // -------------------------------------------------------------------------- … … 208 191 return kFALSE; 209 192 } 210 fHist->SetZTitle(f Name+"Z");211 if (! GetMethodCall(plist, 2))193 fHist->SetZTitle(fData[2]->GetTitle()); 194 if (!fData[2]->PreProcess(plist)) 212 195 return kFALSE; 213 196 case 2: … … 218 201 return kFALSE; 219 202 } 220 fHist->SetYTitle(f Name+"Y");221 if (! GetMethodCall(plist, 1))203 fHist->SetYTitle(fData[1]->GetTitle()); 204 if (!fData[1]->PreProcess(plist)) 222 205 return kFALSE; 223 206 case 1: … … 228 211 return kFALSE; 229 212 } 230 fHist->SetXTitle(f Name+"X");231 if (! GetMethodCall(plist, 0))213 fHist->SetXTitle(fData[0]->GetTitle()); 214 if (!fData[0]->PreProcess(plist)) 232 215 return kFALSE; 233 216 } … … 279 262 // -------------------------------------------------------------------------- 280 263 // 281 // Returns the value corresponding to the data member of the given object282 //283 Bool_t MH3::GetValue(Int_t num, Double_t &v)284 {285 switch (fMethodCall[num]->ReturnType())286 {287 case TMethodCall::kLong:288 Long_t l;289 fMethodCall[num]->Execute(fObject[num], l); // FIXME: const, root290 v = fScale[num]*l;291 return kTRUE;292 293 case TMethodCall::kDouble:294 fMethodCall[num]->Execute(fObject[num], v); // FIXME: const, root295 v *= fScale[num];296 return kTRUE;297 298 default:299 *fLog << err << "DataMember " << fDataMember[num] << " of ";300 *fLog << fObject[num]->GetName() << " neither int nor float... abort." << endl;301 return kFALSE;302 }303 }304 305 // --------------------------------------------------------------------------306 //307 264 // Fills the one, two or three data members into our histogram 308 265 // 309 266 Bool_t MH3::Fill(const MParContainer *par) 310 267 { 311 Double_t x, y, z; 268 Double_t x=0; 269 Double_t y=0; 270 Double_t z=0; 312 271 313 272 switch (fDimension) 314 273 { 315 274 case 3: 316 if (!GetValue(2, z)) 317 return kFALSE; 275 z = fData[2]->GetValue()*fScale[2]; 318 276 case 2: 319 if (!GetValue(1, y)) 320 return kFALSE; 277 y = fData[1]->GetValue()*fScale[1]; 321 278 case 1: 322 if (!GetValue(0, x)) 323 return kFALSE; 279 x = fData[0]->GetValue()*fScale[0]; 324 280 } 325 281 … … 359 315 fHist->DrawCopy(opt); 360 316 317 TString str(opt); 318 if (str.Contains("PROFX", TString::kIgnoreCase) && fDimension==2) 319 { 320 TProfile *p = ((TH2*)fHist)->ProfileX(); 321 p->Draw("same"); 322 p->SetBit(kCanDelete); 323 } 324 if (str.Contains("PROFY", TString::kIgnoreCase) && fDimension==2) 325 { 326 TProfile *p = ((TH2*)fHist)->ProfileY(); 327 p->Draw("same"); 328 p->SetBit(kCanDelete); 329 } 330 361 331 c.Modified(); 362 332 c.Update(); … … 378 348 fHist->Draw(opt); 379 349 350 TString str(opt); 351 if (str.Contains("PROFX", TString::kIgnoreCase) && fDimension==2) 352 { 353 TProfile *p = ((TH2*)fHist)->ProfileX(); 354 p->Draw("same"); 355 p->SetBit(kCanDelete); 356 } 357 if (str.Contains("PROFY", TString::kIgnoreCase) && fDimension==2) 358 { 359 TProfile *p = ((TH2*)fHist)->ProfileY(); 360 p->Draw("same"); 361 p->SetBit(kCanDelete); 362 } 363 380 364 gPad->Modified(); 381 365 gPad->Update(); -
trunk/MagicSoft/Mars/mhist/MH3.h
r1283 r1299 11 11 class TH1; 12 12 class TMethodCall; 13 class MDataChain; 13 14 14 15 class MH3 : public MH … … 21 22 TString fDataMember[3]; // Data member which should be filled into the histogram x 22 23 23 MParContainer *fObject[3]; // Object from which the data is filled 24 TMethodCall *fMethodCall[3]; // Method call to get the data from the object 24 MDataChain *fData[3]; // Object from which the data is filled 25 25 26 26 Double_t fScale[3]; 27 28 Bool_t GetValue(Int_t num, Double_t &v);29 Bool_t GetMethodCall(const MParList *plist, Int_t num);30 27 31 28 public: -
trunk/MagicSoft/Mars/mhist/Makefile
r1283 r1299 22 22 # connect the include files defined in the config.mk file 23 23 # 24 INCLUDES = -I. -I../mbase -I../mraw -I../manalysis -I../mmc -I../mgui 24 INCLUDES = -I. -I../mbase -I../mraw -I../manalysis -I../mmc -I../mgui -I../mdata 25 25 26 26 #------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.