- Timestamp:
- 05/14/08 12:03:25 (17 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r8886 r8888 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2008/05/14 Thomas Bretz 22 23 * mhbase/MH3.[h,cc], mhbase/MHn.[h,cc]: 24 - enhanced to allow direct filling of Profile histograms 25 26 * mjobs/MDataSet.h: 27 - fixed a bug in Print() causing an infinite loop 28 29 * mjtrain/MJTrainDisp.cc, mjtrain/MJTrainSeparation.cc: 30 - write the dataset(s) to the output file 31 32 * mjtrain/MJTrainEnergy.cc 33 - write the dataset to the output file 34 - added new plots to show the resolution versus several different parameters 35 36 * mpedestal/MPedestalSubtract.[h,cc]: 37 - added an additional check to compate the number of hi-/lo-gain slices 38 in the run- and event-header 39 40 * mpointing/MPointingDevCalc.cc: 41 - added the 14th Jan 08 to the list of new pointing models 42 43 20 44 21 45 2008/05/07 Stefan Ruegamer … … 50 74 * mreport/MReportDrive.cc: 51 75 - implemented changes of Version 20080220 76 77 78 79 2008/03/19 Thomas Bretz 80 81 * mjobs/MJSpectrum.cc: 82 - fixed a bug introduced yesterday. The overflow bin was not 83 correctly referenced 52 84 53 85 -
trunk/MagicSoft/Mars/mhbase/MH3.cc
r8709 r8888 124 124 // Default constructor. 125 125 // 126 MH3::MH3(const unsigned int dim) 127 : fDimension(dim>3?3:dim), fHist(NULL), fStyleBits(0) 128 { 126 MH3::MH3(const Int_t dim, Type_t type) 127 : fDimension(dim), fHist(NULL), fStyleBits(0) 128 { 129 switch (type) 130 { 131 case kHistogram: 132 if (fDimension>3) 133 fDimension=3; 134 break; 135 case kProfile: 136 fDimension = -TMath::Abs(fDimension); 137 if (fDimension<-2) 138 fDimension = -2; 139 break; 140 } 141 129 142 switch (fDimension) 130 143 { … … 132 145 fHist = new TH1D; 133 146 fHist->SetYTitle("Counts"); 147 break; 148 case -1: 149 fHist = new TProfile; 150 fHist->SetYTitle("Average"); 134 151 break; 135 152 case 2: … … 137 154 fHist->SetZTitle("Counts"); 138 155 break; 156 case -2: 157 fHist = new TProfile2D; 158 fHist->SetZTitle("Average"); 159 break; 139 160 case 3: 140 161 fHist = new TH3D; … … 194 215 } 195 216 217 // -------------------------------------------------------------------------- 218 // 219 // Adapt a given histogram 220 // 196 221 MH3::MH3(const TH1 &h1) 197 222 : fDimension(1), fStyleBits(0) … … 237 262 // description above. 238 263 // 239 MH3::MH3(const char *memberx, const char *membery )240 : fDimension( 2), fStyleBits(0)241 { 242 fHist = new TH2D;264 MH3::MH3(const char *memberx, const char *membery, Type_t type) 265 : fDimension(type==kHistogram?2:-1), fStyleBits(0) 266 { 267 fHist = type==kHistogram ? static_cast<TH1*>(new TH2D) : static_cast<TH1*>(new TProfile); //new TH2D; 243 268 244 269 fData[0] = new MDataPhrase(memberx); … … 255 280 fHist->UseCurrentStyle(); 256 281 fHist->SetDirectory(NULL); 257 fHist->SetZTitle( "Counts");282 fHist->SetZTitle(fDimension>0?"Counts":"Average"); 258 283 259 284 fScale[0] = 1; … … 268 293 // description see the class description above. 269 294 // 270 MH3::MH3(const char *memberx, const char *membery, const char *memberz )271 : fDimension( 3), fStyleBits(0)272 { 273 fHist = new TH3D;295 MH3::MH3(const char *memberx, const char *membery, const char *memberz, Type_t type) 296 : fDimension(type==kHistogram?3:-2), fStyleBits(0) 297 { 298 fHist = type==kHistogram ? static_cast<TH1*>(new TH3D) : static_cast<TH1*>(new TProfile2D); //new TH2D; 274 299 275 300 fData[0] = new MDataPhrase(memberx); … … 357 382 MBinning *binsz = NULL; 358 383 359 switch ( fDimension)384 switch (TMath::Abs(fDimension)) 360 385 { 361 386 case 3: … … 366 391 return kFALSE; 367 392 } 368 if (fData[2] && !fData[2]->PreProcess(plist))369 return kFALSE;370 393 if (fData[2]) 371 394 fHist->SetZTitle(fData[2]->GetTitle()); … … 381 404 return kFALSE; 382 405 } 383 if (fData[1] && !fData[1]->PreProcess(plist))384 return kFALSE;385 406 if (fData[1]) 386 407 fHist->SetYTitle(fData[1]->GetTitle()); … … 402 423 } 403 424 } 404 if (fData[0] && !fData[0]->PreProcess(plist))405 return kFALSE;406 425 if (fData[0]!=NULL) 407 426 fHist->SetXTitle(fData[0]->GetTitle()); … … 412 431 } 413 432 414 TString title("Histogram for "); 433 // PreProcess existing fData members 434 for (int i=0; i<3; i++) 435 if (fData[i] && !fData[i]->PreProcess(plist)) 436 return kFALSE; 437 438 TString title(fDimension>0?"Histogram":"Profile"); 439 title += " for "; 415 440 title += name; 416 title += Form(" (%dD)", fDimension);441 title += Form(" (%dD)", TMath::Abs(fDimension)); 417 442 418 443 fHist->SetName(name); … … 420 445 fHist->SetDirectory(0); 421 446 422 switch ( fDimension)447 switch (TMath::Abs(fDimension)) 423 448 { 424 449 case 1: … … 433 458 } 434 459 435 *fLog << err << "ERROR - MH3 has " << fDimension<< " dimensions!" << endl;460 *fLog << err << "ERROR - MH3 has " << TMath::Abs(fDimension) << " dimensions!" << endl; 436 461 return kFALSE; 437 462 } … … 487 512 switch (fDimension) 488 513 { 489 case 3: 514 case -2: 515 case 3: 490 516 z = fData[2]->GetValue()*fScale[2]; 491 case 2: 517 case -1: 518 case 2: 492 519 y = fData[1]->GetValue()*fScale[1]; 493 case 1:520 case 1: 494 521 x = fData[0]->GetValue()*fScale[0]; 495 522 } … … 497 524 switch (fDimension) 498 525 { 499 case 3:500 ((TH3*)fHist)->Fill(x, y, z, w);526 case 3: 527 static_cast<TH3*>(fHist)->Fill(x, y, z, w); 501 528 return kTRUE; 502 case 2:503 ((TH2*)fHist)->Fill(x, y, w);529 case 2: 530 static_cast<TH2*>(fHist)->Fill(x, y, w); 504 531 return kTRUE; 505 532 case 1: 506 533 fHist->Fill(x, w); 507 534 return kTRUE; 535 case -1: 536 static_cast<TProfile*>(fHist)->Fill(x, y, w); 537 return kTRUE; 538 case -2: 539 static_cast<TProfile2D*>(fHist)->Fill(x, y, z, w); 540 return kTRUE; 508 541 } 509 542 … … 549 582 TProfile *p=0; 550 583 551 if ( fDimension==2)584 if (TMath::Abs(fDimension)==2) 552 585 MH::SetPalette("pretty"); 553 586 … … 629 662 str.ToLower(); 630 663 631 const Bool_t only = str.Contains("only") && fDimension==2;632 const Bool_t same = str.Contains("same") && fDimension<3;633 const Bool_t blue = str.Contains("blue") && fDimension==2;634 const Bool_t profx = str.Contains("profx") && fDimension==2;635 const Bool_t profy = str.Contains("profy") && fDimension==2;664 const Bool_t only = str.Contains("only") && TMath::Abs(fDimension)==2; 665 const Bool_t same = str.Contains("same") && TMath::Abs(fDimension)<3; 666 const Bool_t blue = str.Contains("blue") && TMath::Abs(fDimension)==2; 667 const Bool_t profx = str.Contains("profx") && TMath::Abs(fDimension)==2; 668 const Bool_t profy = str.Contains("profy") && TMath::Abs(fDimension)==2; 636 669 637 670 str.ReplaceAll("only", ""); … … 641 674 str.ReplaceAll(" ", ""); 642 675 643 if (same && fDimension==1)676 if (same && TMath::Abs(fDimension)==1) 644 677 { 645 678 fHist->SetLineColor(kBlue); … … 702 735 out << " MH3 " << name << "(\""; 703 736 out << fData[0]->GetRule() << "\""; 704 if (fDimension>1 )737 if (fDimension>1 || fDimension<0) 705 738 out << ", \"" << fData[1]->GetRule() << "\""; 706 if (fDimension>2 )739 if (fDimension>2 || fDimension<-1) 707 740 out << ", \"" << fData[2]->GetRule() << "\""; 708 741 … … 717 750 switch (fDimension) 718 751 { 752 case -2: 719 753 case 3: 720 754 if (fScale[2]!=1) 721 755 out << " " << name << ".SetScaleZ(" << fScale[2] << ");" << endl; 756 case -1: 722 757 case 2: 723 758 if (fScale[1]!=1) … … 749 784 h=new MH3(fData[0]->GetRule(), fData[1]->GetRule()); 750 785 break; 786 case -1: 787 h=new MH3(fData[0]->GetRule(), fData[1]->GetRule(), MH3::kProfile); 788 break; 751 789 case 3: 752 790 h=new MH3(fData[0]->GetRule(), fData[1]->GetRule(), fData[2]->GetRule()); 753 791 break; 792 case -2: 793 h=new MH3(fData[0]->GetRule(), fData[1]->GetRule(), fData[2]->GetRule(), MH3::kProfile); 794 break; 754 795 } 755 796 switch (fDimension) 756 797 { 798 case -2: 757 799 case 3: 758 800 h->SetScaleZ(fScale[2]); 759 801 case 2: 802 case -1: 760 803 h->SetScaleY(fScale[1]); 761 804 case 1: … … 789 832 Int_t num = 1; 790 833 791 switch ( fDimension)834 switch (TMath::Abs(fDimension)) 792 835 { 793 836 case 3: … … 820 863 { 821 864 case 3: 865 case -2: 822 866 binz = axez.FindFixBin(z); 823 867 if (binz>axez.GetLast() || binz<axez.GetFirst()) 824 868 return -1; 825 869 case 2: 870 case -1: 826 871 biny = axey.FindFixBin(y); 827 872 if (biny>axey.GetLast() || biny<axey.GetFirst()) -
trunk/MagicSoft/Mars/mhbase/MH3.h
r8709 r8888 28 28 Byte_t fStyleBits; // Set the range of a histogram automatically in Finalize 29 29 30 // TH1 *fHistDraw; //! 31 30 32 void HandleLogAxis(TAxis &axe) const; 31 33 … … 39 41 40 42 public: 41 MH3(const unsigned int dim=0); 43 enum Type_t { 44 kHistogram, 45 kProfile 46 }; 47 48 MH3(const Int_t dim=0, Type_t type=MH3::kHistogram); 42 49 MH3(const TH1 &h1); 43 50 MH3(const char *memberx); 44 MH3(const char *memberx, const char *membery );45 MH3(const char *memberx, const char *membery, const char *memberz );51 MH3(const char *memberx, const char *membery, Type_t type=MH3::kHistogram); 52 MH3(const char *memberx, const char *membery, const char *memberz, Type_t type=MH3::kHistogram); 46 53 ~MH3(); 47 54 … … 70 77 71 78 // Getter 72 Int_t GetDimension() const { return fDimension; }79 Int_t GetDimension() const { return TMath::Abs(fDimension); } 73 80 Int_t GetNbins() const; 74 81 Int_t FindFixBin(Double_t x, Double_t y=0, Double_t z=0) const; -
trunk/MagicSoft/Mars/mhbase/MHn.cc
r8719 r8888 213 213 // e.g. AddHist("MHillas.fLength", "MHillas.fSize") 214 214 // 215 Bool_t MHn::AddHist(const char *memberx, const char *membery )215 Bool_t MHn::AddHist(const char *memberx, const char *membery, MH3::Type_t type) 216 216 { 217 217 if (fNum==8) … … 221 221 } 222 222 223 fHist[fNum] = new MH3(memberx, membery );223 fHist[fNum] = new MH3(memberx, membery, type); 224 224 225 225 InitHist(); … … 236 236 // e.g. AddHist("MHillas.fWidth", "MHillas.fLength", "MHillas.fSize") 237 237 // 238 Bool_t MHn::AddHist(const char *memberx, const char *membery, const char *memberz )238 Bool_t MHn::AddHist(const char *memberx, const char *membery, const char *memberz, MH3::Type_t type) 239 239 { 240 240 if (fNum==8) … … 244 244 } 245 245 246 fHist[fNum] = new MH3(memberx, membery, memberz );246 fHist[fNum] = new MH3(memberx, membery, memberz, type); 247 247 248 248 InitHist(); -
trunk/MagicSoft/Mars/mhbase/MHn.h
r8700 r8888 2 2 #define MARS_MHn 3 3 4 #ifndef ROOT_TH15 #include <TH1.h>4 #ifndef MARS_MH3 5 #include "MH3.h" 6 6 #endif 7 #ifndef MARS_MH8 #include "MH.h"9 #endif10 11 class MH3;12 7 13 8 class MHn : public MH … … 39 34 40 35 Bool_t AddHist(const char *memberx); 41 Bool_t AddHist(const char *memberx, const char *membery );42 Bool_t AddHist(const char *memberx, const char *membery, const char *memberz );36 Bool_t AddHist(const char *memberx, const char *membery, MH3::Type_t type=MH3::kHistogram); 37 Bool_t AddHist(const char *memberx, const char *membery, const char *memberz, MH3::Type_t type=MH3::kHistogram); 43 38 44 39 void InitName(const char *n) -
trunk/MagicSoft/Mars/mjobs/MDataSet.h
r8780 r8888 168 168 // TObject 169 169 void Print(Option_t *o) const; 170 void Print() const { Print( ); } //*MENU*170 void Print() const { Print(""); } //*MENU* 171 171 172 172 ClassDef(MDataSet, 2) -
trunk/MagicSoft/Mars/mjtrain/MJTrainDisp.cc
r8719 r8888 493 493 DisplayResult(hdisp1, hdisp2); 494 494 495 TObjArray arr; 496 arr.Add(const_cast<MDataSet*>(&set)); 497 if (fDisplay) 498 arr.Add(fDisplay); 499 495 500 SetPathOut(out); 496 return Write Display(0, "UPDATE");501 return WriteContainer(arr, 0, "UPDATE"); 497 502 } 498 503 -
trunk/MagicSoft/Mars/mjtrain/MJTrainEnergy.cc
r8719 r8888 191 191 192 192 // ------------------------------------------------------------- 193 MBinning binsS(50, 10, 100000, "BinningSize", "log"); 194 MBinning binsE(70, 10, 31623, "BinningEnergy", "log"); 195 MBinning binsG(50,-10, 10, "BinningSlope", "lin"); 196 MBinning binsR(50, -1, 1, "BinningEnergyResidual", "lin"); 197 MBinning binsL(50, 0, 0.3, "BinningLeakage", "lin"); 198 MBinning binsT(51, -0.005, 0.505, "BinningTheta", "asin"); 199 MBinning binsD(50, 0, 1.6, "BinningDist", "lin"); 200 MBinning binsC(50, 1e-2, 1, "BinningConc", "log"); 193 MBinning binsS(50, 10, 100000, "BinningSize", "log"); 194 MBinning binsE(70, 10, 31623, "BinningEnergy", "log"); 195 MBinning binsF(35, 10, 31623, "BinningEnergyEst", "log"); 196 MBinning binsG(50, -10, 10, "BinningSlope", "lin"); 197 MBinning binsR(50, -1, 1, "BinningEnergyResidual", "lin"); 198 MBinning binsL(50, 0, 0.3, "BinningLeakage", "lin"); 199 MBinning binsT(51, -0.005, 0.505, "BinningTheta", "asin"); 200 MBinning binsD(50, 0, 1.6, "BinningDist", "lin"); 201 MBinning binsC(50, 1e-2, 1, "BinningConc", "log"); 202 MBinning binsI(16, 0, 800, "BinningImpact", "lin"); 201 203 202 204 plist.AddToList(&binsG); … … 204 206 plist.AddToList(&binsR); 205 207 plist.AddToList(&binsE); 208 plist.AddToList(&binsF); 206 209 plist.AddToList(&binsL); 207 210 plist.AddToList(&binsT); 208 211 plist.AddToList(&binsD); 209 212 plist.AddToList(&binsC); 213 plist.AddToList(&binsI); 210 214 211 215 MHEnergyEst hist; … … 252 256 hres2.SetDrawOption("colz profx"); 253 257 254 MFillH fillh(&hist); 258 MHn hres3("Resolution", "Energy Resolution"); 259 hres3.AddHist("MEnergyEst.fVal", "(MMcEvt.fEnergy/MEnergyEst.fVal-1)^2", MH3::kProfile); 260 hres3.InitName("ResEest;EnergyEst;"); 261 hres3.InitTitle(";E_{est} [GeV];Resolution (E_{mc}/E_{est}-1)^{2};"); 262 263 hres3.AddHist("MHillas.fSize", "(MMcEvt.fEnergy/MEnergyEst.fVal-1)^2", MH3::kProfile); 264 hres3.InitName("ResSize;Size;"); 265 hres3.InitTitle(";S [phe];Resolution (E_{mc}/E_{est}-1)^{2};"); 266 /* 267 hres3.AddHist("MMcEvt.fEnergy", "(MEnergyEst.fVal/MMcEvt.fEnergy-1)^2", MH3::kProfile); 268 hres3.InitName("ResEmc;EnergyEst;"); 269 hres3.InitTitle(";E_{mc} [GeV];Resolution (E_{est}/E_{mc}-1)^{2};"); 270 */ 271 hres3.AddHist("MPointingPos.fZd", "(MMcEvt.fEnergy/MEnergyEst.fVal-1)^2", MH3::kProfile); 272 hres3.InitName("ResTheta;Theta;"); 273 hres3.InitTitle(";\\Theta [\\circ];Resolution (E_{mc}/E_{est}-1)^{2};"); 274 hres3.AddHist("MMcEvt.fImpact/100", "(MMcEvt.fEnergy/MEnergyEst.fVal-1)^2", MH3::kProfile); 275 hres3.InitName("ResImpact;Impact;"); 276 hres3.InitTitle(";I [m];Resolution (E_{mc}/E_{est}-1)^{2};"); 277 278 MFillH fillh0(&hist); 255 279 MFillH fillh1(&hres1, "", "FillResiduals1"); 256 280 MFillH fillh2(&hres2, "", "FillResiduals2"); 281 MFillH fillh3(&hres3, "", "FillResolution"); 257 282 258 283 if (fEnableWeights) 259 284 { 260 fillh .SetWeight();285 fillh0.SetWeight(); 261 286 fillh1.SetWeight(); 262 287 fillh2.SetWeight(); 288 fillh3.SetWeight(); 263 289 } 264 290 … … 268 294 tlist.AddToList(&rf); 269 295 tlist.AddToList(fPostTasks); 270 tlist.AddToList(&fillh );296 tlist.AddToList(&fillh0); 271 297 tlist.AddToList(&fillh1); 272 298 tlist.AddToList(&fillh2); 299 tlist.AddToList(&fillh3); 273 300 tlist.AddToList(fTestTasks); 274 301 … … 283 310 return kFALSE; 284 311 312 TObjArray arr; 313 arr.Add(const_cast<MDataSet*>(&set)); 314 if (fDisplay) 315 arr.Add(fDisplay); 316 285 317 SetPathOut(out); 286 if (!WriteDisplay(0, "UPDATE")) 287 return kFALSE; 288 289 return kTRUE; 318 return WriteContainer(arr, 0, "UPDATE"); 290 319 } -
trunk/MagicSoft/Mars/mjtrain/MJTrainSeparation.cc
r8646 r8888 1047 1047 1048 1048 // Write the display 1049 TObjArray arr; 1050 arr.Add(const_cast<MDataSet*>(&fDataSetTrain)); 1051 arr.Add(const_cast<MDataSet*>(&fDataSetTest)); 1052 if (fDisplay) 1053 arr.Add(fDisplay); 1054 1049 1055 SetPathOut(out); 1050 if (!WriteDisplay(0, "UPDATE")) 1051 return kFALSE; 1052 1053 return kTRUE; 1056 return WriteContainer(arr, 0, "UPDATE"); 1054 1057 } 1055 1058 -
trunk/MagicSoft/Mars/mpedestal/MPedestalSubtract.cc
r8795 r8888 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MPedestalSubtract.cc,v 1. 9 2007-12-19 18:53:03tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MPedestalSubtract.cc,v 1.10 2008-05-14 11:03:24 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 20 20 ! Author(s): Thomas Bretz, 10/2006 <mailto:tbretz@astro.uni-wuerzburg.de> 21 21 ! 22 ! Copyright: MAGIC Software Development, 2000-200 622 ! Copyright: MAGIC Software Development, 2000-2008 23 23 ! 24 24 ! … … 51 51 #include "MArrayB.h" 52 52 53 #include "MRawRunHeader.h" 53 54 #include "MRawEvtData.h" 54 55 #include "MRawEvtPixelIter.h" … … 141 142 } 142 143 144 Bool_t MPedestalSubtract::ReInit(MParList *pList) 145 { 146 fRunHeader = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader")); 147 if (!fRunHeader) 148 { 149 *fLog << err << AddSerialNumber("MRawRunHeader") << " not found... aborting." << endl; 150 return kFALSE; 151 } 152 return kTRUE; 153 } 154 143 155 // -------------------------------------------------------------------------- 144 156 // … … 150 162 const Int_t numl = fRawEvt->GetNumLoGainSamples(); 151 163 164 // Check if event is empty (presumably MC event -- sanity check) 165 if (numh+numl==0) 166 return kCONTINUE; 167 168 // Check for consistency (our simulation can do weird things!) 169 if (numh!=fRunHeader->GetNumSamplesHiGain()) 170 { 171 *fLog << warn << "WARNING - Number of hi-gain samples (" << numh << ") "; 172 *fLog << " doesn't match run-header (" << fRunHeader->GetNumSamplesHiGain() << ")." << endl; 173 } 174 if (numl!=fRunHeader->GetNumSamplesLoGain()) 175 { 176 *fLog << warn << "WARNING - Number of lo-gain samples (" << numl << ") "; 177 *fLog << " doesn't match run-header (" << fRunHeader->GetNumSamplesLoGain() << ")." << endl; 178 } 179 180 // Get scale between FADC units and 256 ;-) 152 181 const UInt_t scale = fRawEvt->GetScale(); 153 182 -
trunk/MagicSoft/Mars/mpedestal/MPedestalSubtract.h
r8633 r8888 6 6 #endif 7 7 8 class MRawRunHeader; 8 9 class MRawEvtData; 9 10 class MPedestalCam; … … 16 17 static const TString fgNamePedestalSubtractedEvt; //! "MPedestalSubtractedEvt" 17 18 19 MRawRunHeader *fRunHeader; //! Run Header 18 20 MRawEvtData *fRawEvt; //! Input Raw data 19 21 MPedestalCam *fPedestals; //! Pedestals of all pixels in the camera … … 24 26 25 27 Int_t PreProcess(MParList *pList); 28 Bool_t ReInit(MParList *pList); 26 29 Int_t Process(); 27 30 -
trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.cc
r8882 r8888 158 158 // 17. Jun. 2007 ~248193 159 159 // 18. Oct. 2007 ~291039(?) 160 // 14. Jan. 2008 160 161 // 161 162 // From 2.2.2006 beginnig of the night (21:05h, run >=81855) to 24.2.2006
Note:
See TracChangeset
for help on using the changeset viewer.