- Timestamp:
- 11/25/02 09:12:47 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 65 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1667 r1668 1 1 -*-*- END -*-*- 2 2002/11/25: Thomas Bretz 3 4 * macros/multidimdist2.C: 5 - renamed eventloops (instances had same names) 6 - fixed a type in PrintStatistics (the gamma statistics 7 were printed two times) 8 9 * mbase/MEvtLoop.cc: 10 - take the lowest value (entries from MRead or user input) 11 for the progress bar 12 - reset the progress bar 13 14 * mbase/MFilter.h: 15 - added 'private' 16 17 * meventdisp/MGCamDisplay.[h,cc], meventdisp/MGEvtDisplay.[h,cc], 18 meventdisp/MGFadcDisp.[h,cc], mmain/MMonteCarlo.[h,cc], 19 mmain/MAnalysis.[h,cc], mmain/MBrowser.[h,cc], 20 mmain/MCameraDisplay.[h,cc], mmain/MDataCheck.[h,cc], 21 mmain/MEvtDisp.[h,cc], mmain/MMars.cc: 22 - changed from TTransientFrame to TMainFrame (with this I 23 get decorations, eg. Close Button) 24 25 * meventdisp/MGEvtDisplay.cc: 26 - Update the layout each time the fEvtInfo has changed 27 28 * mfileio/MCT1ReadAscii.cc, mfileio/MCT1ReadPreProc.cc: 29 - delete return of gSystem->ExpandPathName 30 31 * mfileio/MCT1ReadPreProc.[h,cc]: 32 - added output of Time 33 - added usage of Selector 34 - changed MTask basics to be private 35 36 * mfileio/MRead.[h,cc]: 37 - added comment about selector 38 - added Selector-stuff 39 40 * mfileio/MReadMarsFile.[h,cc], mfileio/MReadTree.[h,cc]: 41 - added 'entries' argument to AddFile 42 43 * mfileio/MReadTree.[h,cc]: 44 - added workaround for a root bug when a file doesn't exist 45 - changed AddFiles to use Add(TChain*) 46 - changed to use Selector 47 48 * mfilter/MF.cc: 49 - Set debug level to suppress output when MFDataChain is created 50 51 * mfilter/MFEventSelector.h: 52 - changed Pre//PostProcess to private 53 54 * mfilter/MF.cc, mfilter/MFilterList.cc: 55 - changed the use of Pre//PostProcess to CallPre//PostProcess 56 57 * mhist/MBinning.[h,cc]: 58 - changed comments 59 - added SetEdgesCos 60 61 * mhist/MFillH.[h,cc]: 62 - added GetBinCenterLog 63 64 * mhist/MH3.h: 65 - added default argument to GetHistByName 66 67 * mhist/MHAlphaEnergyTheta.[h,cc], mhist/MHAlphaEnergyTime.h, 68 mhist/MHEffOnTime.[h,cc], mhist/MHEffOnTimeTheta.h, 69 mhist/MHEffOnTimeTime.h, mhist/MHFlux.[h,cc], mhist/MHGamma.[h,cc], 70 mhist/MHMcEnergyMigration.h, mhist/MHThetabarTheta.[h,cc], 71 mhist/MHThetabarTime.h: 72 - changed the output 73 - changed the algorithms to be more modular (more usage of member 74 function) 75 - changed ClassDef to 0 76 - fixed some small bugs (access of TArray[n]) 77 78 * mhist/MHHadronness.[h,cc]: 79 - removed shortest distance to (0,1) stuff 80 81 * mhist/MHMcCollectionArea.h: 82 - changed Fill to Double_t 83 84 * mhist/MHTimeDiffTheta.[h,cc], mhist/MHTimeDiffTime.[h,cc]: 85 - in a first draft changed to use 200ns timing of CT1 86 - changed ClassDef to 0 87 88 2 89 3 90 2002/11/22: Thomas Bretz -
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r1657 r1668 208 208 if (fProgress) 209 209 { 210 fProgress->Reset(); 211 212 Int_t entries = INT_MAX; 213 214 #ifdef __MARS__ 215 // limits.h 216 MRead *read = (MRead*)fTaskList->FindObject("MRead"); 217 if (read && read->GetEntries()>0) 218 entries = read->GetEntries(); 219 #endif 220 210 221 if (maxcnt>0) 211 fProgress->SetRange(0, maxcnt); 212 #ifdef __MARS__ 222 fProgress->SetRange(0, TMath::Min(maxcnt, entries)); 213 223 else 214 { 215 MRead *read = (MRead*)fTaskList->FindObject("MRead"); 216 if (read && read->GetEntries()>0) 217 fProgress->SetRange(0, read->GetEntries()); 218 } 219 #endif 224 if (entries!=INT_MAX) 225 fProgress->SetRange(0, entries); 220 226 } 221 227 -
trunk/MagicSoft/Mars/mbase/MFilter.h
r1481 r1668 10 10 class MFilter : public MTask 11 11 { 12 private: 13 virtual Bool_t PreProcess(MParList *pList); 14 virtual Bool_t Process(); 15 virtual Bool_t PostProcess(); 16 12 17 public: 13 18 MFilter(const char *name=NULL, const char *title=NULL); 14 19 15 20 virtual Bool_t IsExpressionTrue() const = 0; 16 17 virtual Bool_t PreProcess(MParList *pList);18 virtual Bool_t Process();19 virtual Bool_t PostProcess();20 21 21 virtual TString GetRule() const; 22 22 -
trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc
r1540 r1668 148 148 // 149 149 MGCamDisplay::MGCamDisplay(const char *filename, 150 const TGWindow *p, const TGWindow *main,150 const TGWindow *p, /*const TGWindow *main,*/ 151 151 UInt_t w, UInt_t h) 152 : MGEvtDisplay(filename, "Events", p, main,w, h), fDisplay(NULL)152 : MGEvtDisplay(filename, "Events", p, /*main,*/ w, h), fDisplay(NULL) 153 153 { 154 154 // -
trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.h
r1540 r1668 32 32 public: 33 33 MGCamDisplay(const char *filename, 34 const TGWindow *p, const TGWindow *main,34 const TGWindow *p, /*const TGWindow *main,*/ 35 35 UInt_t w, UInt_t h); 36 36 -
trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc
r1600 r1668 141 141 fEvtInfo = new TGLabel(top2, new TGString("")); 142 142 fList->Add(fEvtInfo); 143 144 143 top2->AddFrame(fEvtInfo, laystd); 145 144 … … 393 392 394 393 MGEvtDisplay::MGEvtDisplay(const char *fname, const char *tname, 395 const TGWindow *p, const TGWindow *main,394 const TGWindow *p, /*const TGWindow *main,*/ 396 395 UInt_t w, UInt_t h) 397 : TGTransientFrame(p, main, w, h), fInitOk(kFALSE) 396 // : TGTransientFrame(p, main, w, h), fInitOk(kFALSE) 397 : TGMainFrame(p, w, h), fInitOk(kFALSE) 398 398 { 399 399 // … … 472 472 break; 473 473 default: 474 txt += "Unknown Particle Id"; 474 txt += "Unknown Particle Id#"; 475 txt += evt->GetPartId(); 475 476 } 476 477 … … 493 494 494 495 fEvtInfo->SetText(txt); 496 497 // 498 // Seems to be necessary to newly layout the upper part to display 499 // the whole line of text 500 // 501 TGFrame &f = *(TGFrame*)fEvtInfo->GetParent()->GetParent(); 502 f.Layout(); 503 f.MapSubwindows(); 495 504 } 496 505 -
trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.h
r1540 r1668 21 21 class MReadTree; 22 22 23 class MGEvtDisplay : public TG TransientFrame23 class MGEvtDisplay : public TGMainFrame/*TGTransientFrame*/ 24 24 { 25 25 private: … … 74 74 public: 75 75 MGEvtDisplay(const char *fname, const char *tname, 76 const TGWindow *p, const TGWindow *main,76 const TGWindow *p, /*const TGWindow *main,*/ 77 77 UInt_t w, UInt_t h); 78 78 -
trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc
r1172 r1668 113 113 // 114 114 MGFadcDisp::MGFadcDisp(const char *filename, const char *treename, 115 const TGWindow *p, const TGWindow *main,115 const TGWindow *p, /*const TGWindow *main,*/ 116 116 UInt_t w, UInt_t h) 117 : MGEvtDisplay(filename, treename, p, main,w, h)117 : MGEvtDisplay(filename, treename, p, /*main,*/ w, h) 118 118 { 119 119 // -
trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h
r1172 r1668 23 23 24 24 MGFadcDisp(const char *filename, const char *treename, 25 const TGWindow *p, const TGWindow *main,UInt_t w, UInt_t h);25 const TGWindow *p, /*const TGWindow *main,*/ UInt_t w, UInt_t h); 26 26 27 27 virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2); -
trunk/MagicSoft/Mars/mfileio/MCT1ReadAscii.cc
r1583 r1668 127 127 const char *name = file->GetName(); 128 128 129 fIn = new ifstream(gSystem->ExpandPathName(name)); 129 const char *expname = gSystem->ExpandPathName(name); 130 fIn = new ifstream(expname); 131 delete [] expname; 130 132 131 133 const Bool_t noexist = !(*fIn); -
trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc
r1666 r1668 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@uni-sw.gwdg.de> 19 ! Author(s): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de) 18 ! Author(s): Thomas Bretz 11/2002 <mailto:tbretz@astro.uni-wuerzburg.de> 20 19 ! 21 ! Copyright: MAGIC Software Development, 2000-200 120 ! Copyright: MAGIC Software Development, 2000-2002 22 21 ! 23 22 ! … … 29 28 // 30 29 // Reads a output file of the CT1 preproc. 30 // 31 // Implements usage of a selector (see MRead) Use such a filter to skip 32 // events before reading! But never use a filter which needs read data 33 // as input... 31 34 // 32 35 // Input Containers: … … 58 61 #include "MLogManip.h" 59 62 63 #include "MTime.h" 64 #include "MFilter.h" 65 60 66 #include "MParList.h" 61 67 #include "MCerPhotEvt.h" … … 112 118 void MCT1ReadPreProc::AddFile(const char *txt) 113 119 { 114 const TString fname = gSystem->ExpandPathName(txt); 120 const char *name = gSystem->ExpandPathName(txt); 121 TString fname(name); 122 delete [] name; 115 123 116 124 if (!CheckHeader(fname)) … … 502 510 // open the file which is the first one in the chain 503 511 // 504 const TString name = file->GetName(); 505 const TString fname = gSystem->ExpandPathName(name); 512 const TString name = file->GetName(); 513 514 const char *expname = gSystem->ExpandPathName(name); 515 const TString fname(expname); 516 delete [] expname; 506 517 507 518 // … … 648 659 649 660 // 661 // look for the time class in the plist 662 // 663 fTime = (MTime*)pList->FindCreateObj("MTime"); 664 if (!fTime) 665 return kFALSE; 666 667 // 650 668 // look for the pedestal class in the plist 651 669 // … … 685 703 fNumRuns = 0; 686 704 687 return kTRUE;705 return GetSelector() ? GetSelector()->CallPreProcess(pList) : kTRUE; 688 706 } 689 707 … … 695 713 void MCT1ReadPreProc::ProcessEvent(const struct eventrecord &event) 696 714 { 715 // int isecs_since_midday; // seconds passed since midday before sunset (JD of run start) 716 // int isecfrac_200ns; // fractional part of isecs_since_midday 717 fTime->SetTime(event.isecfrac_200ns, event.isecs_since_midday); 718 fTime->SetReadyToSave(); 719 697 720 /* 698 721 --- USEFULL? NEEDED? --- 699 int isecs_since_midday; // seconds passed since midday before sunset (JD of run start)700 int isecfrac_200ns; // fractional part of isecs_since_midday701 722 short snot_ok_flags; // the bits in these two bytes are flags for additional information on the event: Everything OK =: all Bits = 0 702 723 … … 862 883 return kFALSE; 863 884 885 // 886 // Check for a selector. If one is given and returns kFALSE 887 // skip this event. 888 // 889 if (GetSelector()) 890 { 891 // 892 // Make sure selector is processed 893 // 894 if (!GetSelector()->CallProcess()) 895 { 896 *fLog << err << dbginf << "Processing Selector failed." << endl; 897 return kFALSE; 898 } 899 900 // 901 // Skip Event 902 // 903 if (!GetSelector()->IsExpressionTrue()) 904 { 905 fIn->seekg(sizeof(struct eventrecord), ios::cur); 906 907 fNumEvents++; 908 fNumEventsInRun++; 909 910 return kCONTINUE; 911 } 912 } 913 864 914 // event data to be read from the file 865 915 struct eventrecord event; … … 890 940 } 891 941 892 return kTRUE;893 } 942 return GetSelector() ? GetSelector()->CallPostProcess() : kTRUE; 943 } -
trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.h
r1664 r1668 7 7 8 8 class TList; 9 class MTime; 9 10 class MMcEvt; 10 11 class MMcTrig; … … 27 28 MCerPhotEvt *fNphot; // the data container for all data. 28 29 MPedestalCam *fPedest; // ct1 pedestals 30 MTime *fTime; // event time 29 31 MMcEvt *fMcEvt; // monte carlo data container for MC files 30 32 MMcTrig *fMcTrig; // mc data container for trigger information … … 52 54 void ProcessEvent(const struct eventrecord &event); 53 55 56 Bool_t PreProcess(MParList *pList); 57 Bool_t Process(); 58 Bool_t PostProcess(); 59 54 60 public: 55 61 MCT1ReadPreProc(const char *filename=NULL, … … 61 67 void AddFile(const char *fname); 62 68 63 Bool_t PreProcess(MParList *pList);64 Bool_t Process();65 Bool_t PostProcess();66 67 69 UInt_t GetEntries() { return fEntries; } 68 70 -
trunk/MagicSoft/Mars/mfileio/MRead.cc
r1600 r1668 29 29 // Base class for all reading tasks // 30 30 // // 31 // You can set a selector. Depending on the impelementation in the derived // 32 // class it can be used to skip events, if the filter return kFALSE. // 33 // Make sure that the selector (filter) doesn't need information which // 34 // doesn't exist before reading an event! // 35 // // 31 36 ///////////////////////////////////////////////////////////////////////////// 32 37 #include "MRead.h" -
trunk/MagicSoft/Mars/mfileio/MRead.h
r1600 r1668 6 6 #endif 7 7 8 class MFilter; 9 8 10 class MRead : public MTask 9 11 { 12 private: 13 MFilter *fSelector; 14 10 15 public: 16 MRead() : fSelector(NULL) {} 11 17 12 18 virtual UInt_t GetEntries() = 0; 19 20 void SetSelector(MFilter *f) { fSelector = f; } 21 MFilter *GetSelector() { return fSelector; } 13 22 14 23 ClassDef(MRead, 0) // Base class for a reading task -
trunk/MagicSoft/Mars/mfileio/MReadMarsFile.cc
r1667 r1668 98 98 // chains -1 is returned, otherwise the number of files which were added. 99 99 // 100 Int_t MReadMarsFile::AddFile(const char *fname )100 Int_t MReadMarsFile::AddFile(const char *fname, Int_t entries) 101 101 { 102 102 // … … 107 107 // 108 108 Int_t n1 = fRun->AddFile(fname); 109 Int_t n2 = MReadTree::AddFile(fname );109 Int_t n2 = MReadTree::AddFile(fname, entries); 110 110 111 111 return n1 != n2 ? -1 : n1; -
trunk/MagicSoft/Mars/mfileio/MReadMarsFile.h
r1664 r1668 24 24 ~MReadMarsFile(); 25 25 26 Int_t AddFile(const char *fname );26 Int_t AddFile(const char *fname, Int_t entries=-1); 27 27 28 28 ClassDef(MReadMarsFile, 1) // Reads a tree from file(s) and the information from the 'RunHeader'-tree -
trunk/MagicSoft/Mars/mfileio/MReadTree.cc
r1664 r1668 191 191 // AddFile returns the number of files added to the chain. 192 192 // 193 Int_t MReadTree::AddFile(const char *fname) 194 { 193 // For more information see TChain::Add 194 // 195 Int_t MReadTree::AddFile(const char *fname, Int_t entries) 196 { 197 #if ROOT_VERSION_CODE < ROOT_VERSION(3,03,01) 198 // 199 // This is a workaround to get rid of crashed if the file doesn't 200 // exist due to non initialized TFile::fProcessIDs 201 // 202 // (Code taken from TFile::TFile 203 // 204 const char *name; 205 206 TString newname; 207 208 if ((name = gSystem->ExpandPathName(fname))) 209 { 210 newname = name; 211 delete [] name; 212 } 213 214 if (newname.IsNull()) 215 { 216 *fLog << err << dbginf << "Error expanding path " << fname << "." << endl; 217 return 0; 218 } 219 220 if (gSystem->AccessPathName(newname, kFileExists)) 221 { 222 *fLog << err << "ERROR - File '" << fname << "' does not exist." << endl; 223 return 0; 224 } 225 226 fname = newname.Data(); 227 #endif 228 195 229 // 196 230 // FIXME! A check is missing whether the file already exists or not. 197 231 // 198 // 199 // returns the number of file which were added 200 // 201 202 const Int_t numfiles = fChain->Add(fname); 232 const Int_t numfiles = fChain->Add(fname, entries); 203 233 204 234 if (numfiles>0) … … 208 238 } 209 239 240 /* 241 // -------------------------------------------------------------------------- 242 // 243 // 244 Int_t MReadTree::AddFile(const TChainElement &obj) 245 { 246 return AddFile(obj.GetTitle(), obj.GetEntries()); 247 } 248 */ 249 210 250 // -------------------------------------------------------------------------- 211 251 // … … 216 256 Int_t MReadTree::AddFiles(const MReadTree &read) 217 257 { 218 Int_t rc = 0; 219 220 TIter Next(read.fChain->GetListOfFiles()); 221 TObject *obj = NULL; 222 while ((obj=Next())) 223 rc += AddFile(obj->GetTitle()); 258 const Int_t rc = fChain->Add(read.fChain); 224 259 225 260 if (rc>0) 226 261 SetBit(kChainWasChanged); 262 263 /* 264 Int_t rc = 0; 265 266 TIter Next(read.fChain->GetListOfFiles()); 267 TObject *obj = NULL; 268 while ((obj=Next())) 269 rc += AddFile(*(TChainElement*)obj); 270 */ 227 271 228 272 return rc; … … 241 285 return; 242 286 243 *fLog << inf << GetDescriptor() << ": Branch choosing methodenabled (only enabled branches are read)." << endl;287 *fLog << inf << GetDescriptor() << ": Branch choosing enabled (only enabled branches are read)." << endl; 244 288 fChain->SetBranchStatus("*", kFALSE); 245 289 fBranchChoosing = kTRUE; … … 255 299 void MReadTree::EnableBranch(const char *name) 256 300 { 301 if (fChain->GetListOfFiles()->GetEntries()==0) 302 { 303 *fLog << err << "Chain contains no file... Branch '"; 304 *fLog << name << "' ignored." << endl; 305 return; 306 } 307 257 308 EnableBranchChoosing(); 258 309 … … 449 500 // root environment) the branch is skipped and an error message is printed 450 501 // out. 502 // If a selector is specified it is preprocessed after the 503 // MReadTree::PreProcess 451 504 // 452 505 Bool_t MReadTree::PreProcess(MParList *pList) … … 576 629 fChain->SetNotify(this); 577 630 578 return kTRUE;631 return GetSelector() ? GetSelector()->CallPreProcess(pList) : kTRUE; 579 632 } 580 633 … … 626 679 // (Remark: The position can also be set by some member functions 627 680 // If the end of the file is reached the Eventloop is stopped. 681 // In case an event selector is given its value is checked before 682 // reading the event. If it returns kAFLSE the event is skipped. 628 683 // 629 684 #if ROOT_VERSION_CODE < ROOT_VERSION(3,02,06) … … 658 713 #endif 659 714 660 Bool_t rc = fChain->GetEntry(fNumEntry++) != 0; 715 if (GetSelector()) 716 { 717 // 718 // Make sure selector is processed 719 // 720 if (!GetSelector()->CallProcess()) 721 { 722 *fLog << err << dbginf << "Processing Selector failed." << endl; 723 return kFALSE; 724 } 725 726 // 727 // Skip Event 728 // 729 if (!GetSelector()->IsExpressionTrue()) 730 { 731 fNumEntry++; 732 return kCONTINUE; 733 } 734 } 735 736 const Bool_t rc = fChain->GetEntry(fNumEntry++) != 0; 661 737 662 738 if (rc) … … 664 740 665 741 return rc; 742 } 743 744 // -------------------------------------------------------------------------- 745 // 746 // If a selector is given the selector is post processed 747 // 748 Bool_t MReadTree::PostProcess() 749 { 750 return GetSelector() ? GetSelector()->CallPostProcess() : kTRUE; 666 751 } 667 752 -
trunk/MagicSoft/Mars/mfileio/MReadTree.h
r1600 r1668 64 64 virtual void Print(Option_t *opt="") const; 65 65 66 virtual Int_t AddFile(const char *fname );66 virtual Int_t AddFile(const char *fname, Int_t entries=-1); 67 67 virtual Int_t AddFiles(const MReadTree &read); 68 68 69 69 virtual Bool_t PreProcess(MParList *pList); 70 70 virtual Bool_t Process(); 71 virtual Bool_t PostProcess(); 71 72 72 73 virtual Bool_t Notify(); -
trunk/MagicSoft/Mars/mfilter/MF.cc
r1666 r1668 244 244 if (isrule) 245 245 { 246 Int_t lvl = gLog.GetDebugLevel(); 247 gLog.SetDebugLevel(1); 246 248 newfilter = new MFDataChain(text.Data(), c, num); 247 249 newfilter->SetName(Form("Chain%02d%c%f", level, c, num)); 250 gLog.SetDebugLevel(lvl); 248 251 } 249 252 else … … 407 410 } 408 411 409 if (!fFilter-> PreProcess(plist))412 if (!fFilter->CallPreProcess(plist)) 410 413 { 411 414 *fLog << err << dbginf << "PreProcessing filters in "; … … 423 426 Bool_t MF::Process() 424 427 { 425 return fFilter-> Process();428 return fFilter->CallProcess(); 426 429 } 427 430 … … 432 435 Bool_t MF::PostProcess() 433 436 { 434 return fFilter-> PostProcess();437 return fFilter->CallPostProcess(); 435 438 } 436 439 -
trunk/MagicSoft/Mars/mfilter/MFDataChain.cc
r1666 r1668 58 58 // 59 59 MFDataChain::MFDataChain(const char *member, const char type, const Double_t val, 60 60 const char *name, const char *title) 61 61 : fData(member), fValue(val) 62 62 { -
trunk/MagicSoft/Mars/mfilter/MFEventSelector.cc
r1600 r1668 147 147 Bool_t MFEventSelector::Process() 148 148 { 149 Float_t evt = gRandom->Uniform();149 const Float_t evt = gRandom->Uniform(); 150 150 151 151 if (fNumSelectEvts>0) -
trunk/MagicSoft/Mars/mfilter/MFEventSelector.h
r1600 r1668 27 27 void StreamPrimitive(ofstream &out) const; 28 28 29 Bool_t PreProcess(MParList *pList); 30 Bool_t Process(); 31 Bool_t PostProcess(); 32 29 33 enum { kNumTotalFromFile = BIT(14) }; 30 34 /* … … 47 51 */ 48 52 49 Bool_t PreProcess(MParList *pList);50 Bool_t Process();51 Bool_t PostProcess();52 53 53 ClassDef(MFEventSelector, 0) // A Filter to select events from files 54 54 }; -
trunk/MagicSoft/Mars/mfilter/MFilterList.cc
r1493 r1668 188 188 // 189 189 while ((filter=(MFilter*)Next())) 190 if (!filter-> PreProcess(pList))190 if (!filter->CallPreProcess(pList)) 191 191 { 192 192 *fLog << err << "Error - Preprocessing Filter "; … … 212 212 // 213 213 while ((filter=(MFilter*)Next())) 214 if (!filter-> Process())214 if (!filter->CallProcess()) 215 215 return kFALSE; 216 216 … … 232 232 // 233 233 while ((filter=(MFilter*)Next())) 234 if (!filter-> PostProcess())234 if (!filter->CallPostProcess()) 235 235 return kFALSE; 236 236 -
trunk/MagicSoft/Mars/mhist/MBinning.cc
r1487 r1668 64 64 // -------------------------------------------------------------------------- 65 65 // 66 // Specify the number of bins (not the number of edges), the lowest and67 // highest Edge.66 // Specify the number of bins <nbins> (not the number of edges), the 67 // lowest <lo> and highest <up> Edge (of your histogram) 68 68 // 69 69 void MBinning::SetEdges(const Int_t nbins, const Axis_t lo, Axis_t up) … … 79 79 // -------------------------------------------------------------------------- 80 80 // 81 // Specify the number of bins (not the number of edges), the lowest and82 // highest Edge.81 // Specify the number of bins <nbins> (not the number of edges), the 82 // lowest <lo> and highest <up> Edge (of your histogram) 83 83 // 84 84 void MBinning::SetEdgesLog(const Int_t nbins, const Axis_t lo, Axis_t up) … … 92 92 93 93 fType = kIsLogarithmic; 94 } 95 96 // -------------------------------------------------------------------------- 97 // 98 // Specify the number of bins <nbins> (not the number of edges), the 99 // lowest [deg] <lo> and highest [deg] <up> Edge (of your histogram) 100 // 101 void MBinning::SetEdgesCos(const Int_t nbins, const Axis_t lo, Axis_t up) 102 { 103 // if (lo==0) ... 104 const Axis_t ld = lo/kRad2Deg; 105 const Axis_t ud = up/kRad2Deg; 106 107 const Double_t binsize = (cos(ld)-cos(ud))/nbins; 108 fEdges.Set(nbins+1); 109 for (int i=0; i<=nbins; i++) 110 fEdges[i] = (acos(binsize*i) + ld)*kRad2Deg; 111 112 fType = kIsCosinic; 94 113 } 95 114 … … 132 151 return; 133 152 134 if (IsLinear() || IsLogarithmic() )153 if (IsLinear() || IsLogarithmic() || IsCosinic()) 135 154 { 136 155 out << " " << GetUniqueName() << ".SetEdges"; 137 156 if (IsLogarithmic()) 138 157 out << "Log"; 158 if (IsCosinic()) 159 out << "Cos"; 139 160 out << "(" << GetNumBins() << ", " << GetEdgeLo() << ", " << GetEdgeHi() << ");" << endl; 140 161 return; -
trunk/MagicSoft/Mars/mhist/MBinning.h
r1572 r1668 25 25 kIsLinear, 26 26 kIsLogarithmic, 27 kIsCosinic, 27 28 kIsUserArray 28 29 }; … … 39 40 void SetEdges(const Int_t nbins, const Axis_t lo, Axis_t up); 40 41 void SetEdgesLog(const Int_t nbins, const Axis_t lo, Axis_t up); 42 void SetEdgesCos(const Int_t nbins, const Axis_t lo, Axis_t up); 41 43 42 44 // FIXME: ROOT workaround: "operator[] const" missing … … 51 53 Bool_t IsLinear() const { return fType==kIsLinear; } 52 54 Bool_t IsLogarithmic() const { return fType==kIsLogarithmic; } 55 Bool_t IsCosinic() const { return fType==kIsCosinic; } 53 56 Bool_t IsDefault() const { return fType==kIsDefault; } 54 57 Bool_t IsUserArray() const { return fType==kIsUserArray; } -
trunk/MagicSoft/Mars/mhist/MFillH.cc
r1629 r1668 354 354 { 355 355 if (cls==name) 356 *fLog << inf << "Object '" << fHName << "' not found in parlist... trying to create one." << endl;356 *fLog << inf << "Object '" << fHName << "' not found in parlist... creating." << endl; 357 357 obj = pList->FindCreateObj(cls, name); 358 358 } -
trunk/MagicSoft/Mars/mhist/MH.cc
r1648 r1668 546 546 // -------------------------------------------------------------------------- 547 547 // 548 // Returns the bin center in a logarithmic scale. If the given bin 549 // number is <1 it is set to 1. If it is =GetNbins() it is set to 550 // GetNbins() 551 // 552 Double_t MH::GetBinCenterLog(const TAxis &axe, Int_t nbin) 553 { 554 if (nbin>axe.GetNbins()) 555 nbin = axe.GetNbins(); 556 557 if (nbin<1) 558 nbin = 1; 559 560 const Double_t lo = axe.GetBinLowEdge(nbin); 561 const Double_t hi = axe.GetBinUpEdge(nbin); 562 563 const Double_t val = log10(lo) + log10(hi); 564 565 return pow(10, val/2); 566 } 567 568 // -------------------------------------------------------------------------- 569 // 548 570 // Draws a copy of the two given histograms. Uses title as the pad title. 549 571 // Also layout the two statistic boxes and a legend. -
trunk/MagicSoft/Mars/mhist/MH.h
r1574 r1668 54 54 static void ScaleAxis(TH1 *bins, Double_t fx=1, Double_t fy=1, Double_t fz=1); 55 55 56 static Double_t GetBinCenterLog(const TAxis &axe, Int_t nbin); 57 56 58 static void DrawCopy(const TH1 &hist1, const TH1 &hist2, const TString title); 57 59 static void Draw(TH1 &hist1, TH1 &hist2, const TString title); -
trunk/MagicSoft/Mars/mhist/MH3.h
r1574 r1668 56 56 const TH1 &GetHist() const { return *fHist; } 57 57 58 TH1 *GetHistByName(const TString name ) { return fHist; }58 TH1 *GetHistByName(const TString name="") { return fHist; } 59 59 60 60 void SetColors() const; -
trunk/MagicSoft/Mars/mhist/MHAlphaEnergyTheta.cc
r1415 r1668 64 64 fHist.SetDirectory(NULL); 65 65 66 fHist.SetTitle("3D-plot of alpha, E -est, Theta");66 fHist.SetTitle("3D-plot of alpha, E_{est}, Theta"); 67 67 fHist.SetXTitle("\\alpha [\\circ]"); 68 fHist.SetYTitle("E -est [GeV]");68 fHist.SetYTitle("E_{est} [GeV]"); 69 69 fHist.SetZTitle("\\Theta [\\circ]"); 70 70 } … … 79 79 if (!fEnergy) 80 80 { 81 *fLog << err << dbginf << "M HAlphaEnergyTheta : MEnergyEst not found... aborting." << endl;81 *fLog << err << dbginf << "MEnergyEst not found... aborting." << endl; 82 82 return kFALSE; 83 83 } … … 86 86 if (!fMcEvt) 87 87 { 88 *fLog << err << dbginf << "M HAlphaEnergyTheta : MMcEvt not found... aborting." << endl;88 *fLog << err << dbginf << "MMcEvt not found... aborting." << endl; 89 89 return kFALSE; 90 90 } … … 95 95 if (!binsenergy || !binsalphaflux || !binstheta) 96 96 { 97 *fLog << err << dbginf << " MHAlphaEnergyTheta :At least one MBinning not found... aborting." << endl;97 *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl; 98 98 return kFALSE; 99 99 } … … 103 103 fHist.Sumw2(); 104 104 105 fHist.Sumw2();106 107 105 return kTRUE; 108 106 } … … 116 114 MHillasSrc &hil = *(MHillasSrc*)par; 117 115 118 fHist.Fill(fabs(hil.GetAlpha()), fEnergy->GetEnergy(), fMcEvt->GetTheta()*kRad2Deg); 116 fHist.Fill(fabs(hil.GetAlpha()), fEnergy->GetEnergy(), 117 fMcEvt->GetTelescopeTheta()*kRad2Deg); 119 118 120 119 return kTRUE; … … 148 147 149 148 h->SetTitle("Distribution of E-est [GeV]"); 150 h->SetXTitle("E -est [GeV]");149 h->SetXTitle("E_{est} [GeV]"); 151 150 h->SetYTitle("Counts"); 152 151 … … 186 185 187 186 c.cd(1); 188 h = ((TH3*)(&fHist))->Project3D( "expro");187 h = ((TH3*)(&fHist))->Project3D(fName+"_expro"); 189 188 190 189 h->SetTitle("Distribution of \\alpha [\\circ]"); … … 196 195 197 196 c.cd(2); 198 h = ((TH3*)(&fHist))->Project3D( "eypro");197 h = ((TH3*)(&fHist))->Project3D(fName+"_eypro"); 199 198 200 199 h->SetTitle("Distribution of E-est [GeV]"); 201 h->SetXTitle("E -est [GeV]");200 h->SetXTitle("E_{est} [GeV]"); 202 201 h->SetYTitle("Counts"); 203 202 … … 207 206 208 207 c.cd(3); 209 h = ((TH3*)(&fHist))->Project3D( "ezpro");208 h = ((TH3*)(&fHist))->Project3D(fName+"_ezpro"); 210 209 211 210 h->SetTitle("Distribution of \\Theta [\\circ]"); -
trunk/MagicSoft/Mars/mhist/MHAlphaEnergyTheta.h
r1574 r1668 44 44 TObject *DrawClone(Option_t *option="") const; 45 45 46 ClassDef(MHAlphaEnergyTheta, 1) //3D-histogram in alpha, Energy and theta46 ClassDef(MHAlphaEnergyTheta, 0) //3D-histogram in alpha, Energy and theta 47 47 }; 48 48 -
trunk/MagicSoft/Mars/mhist/MHAlphaEnergyTime.h
r1574 r1668 47 47 TH1D *IntegrateEestTime(const char *title, Bool_t Draw); 48 48 49 ClassDef(MHAlphaEnergyTime, 1) //3D-histogram in alpha, Energy and time49 ClassDef(MHAlphaEnergyTime, 0) //3D-histogram in alpha, Energy and time 50 50 }; 51 51 -
trunk/MagicSoft/Mars/mhist/MHEffOnTime.cc
r1411 r1668 54 54 #include "MLogManip.h" 55 55 56 #include "MHTimeDiffTheta.h" 57 56 58 ClassImp(MHEffOnTime); 57 59 … … 68 70 fUnit = unit; 69 71 70 TString strg(fVarname); 71 strg += " "; 72 strg += fUnit; 72 TString strg = fVarname + " " + fUnit; 73 73 74 74 // 75 75 // set the name and title of this object 76 76 // 77 TString strg1("MHEffOnTime-"); 78 strg1 += fVarname; 79 fName = strg1; 80 fTitle = "1-D histogram of Eff On Time"; 77 fName = TString("MHEffOnTime-")+fVarname; 78 fTitle = "1-D histogram of Eff On Time"; 81 79 82 80 // effective on time versus Var 83 81 fHEffOn.SetName("EffOn"); 84 TString strg2("effective On Time vs. "); 85 strg2 += fVarname; 86 fHEffOn.SetTitle(strg2); 82 fHEffOn.SetTitle(TString("T_{on, eff} vs. ")+fVarname); 87 83 88 84 fHEffOn.SetDirectory(NULL); 89 85 90 86 fHEffOn.SetXTitle(strg); 91 fHEffOn.SetYTitle(" effective ontime[s]");87 fHEffOn.SetYTitle("T_{on, eff} [s]"); 92 88 93 89 // chi2-probability versus Var 94 90 fHProb.SetName("Chi2-prob"); 95 TString strg3(" Chi2-prob of OnTimeFit vs. ");91 TString strg3("\\chi^{2}-prob of OnTimeFit vs. "); 96 92 strg3 += fVarname; 97 93 fHProb.SetTitle(strg3); … … 100 96 101 97 fHProb.SetXTitle(strg); 102 fHProb.SetYTitle(" chi2-probability");98 fHProb.SetYTitle("\\chi^{2}-probability"); 103 99 104 100 // lambda versus Var 105 101 fHLambda.SetName("lambda"); 106 TString strg4("lambda from OnTimeFit vs. "); 107 strg4 += fVarname; 108 fHLambda.SetTitle(strg4); 102 fHLambda.SetTitle(TString("\\lambda from OnTimeFit vs. ")+fVarname); 109 103 110 104 fHLambda.SetDirectory(NULL); … … 116 110 // Rdead is the fraction from real time lost by the dead time 117 111 fHRdead.SetName("Rdead"); 118 TString strg5("Rdead of OnTimeFit vs. "); 119 strg5 += fVarname; 120 fHRdead.SetTitle(strg5); 112 113 fHRdead.SetTitle(TString("Rdead of OnTimeFit vs. ")+fVarname); 121 114 122 115 fHRdead.SetDirectory(NULL); … … 127 120 } 128 121 122 // -------------------------------------------------------------------- 123 // 124 // determine range (yq[0], yq[1]) of time differences 125 // where fit should be performed; 126 // require a fraction >=min of all entries to lie below yq[0] 127 // and a fraction <=max of all entries to lie below yq[1]; 128 // within the range (yq[0], yq[1]) there must be no empty bin; 129 // 130 void MHEffOnTime::GetQuantiles(const TH1 &h, Double_t min, Double_t max, Double_t yq[2]) const 131 { 132 #if ROOT_VERSION_CODE < ROOT_VERSION(3,02,07) 133 // WOrkaround for missing const qualifier of TH1::Integral 134 TH1 &h1 = (TH1&)h; 135 136 // choose pedestrian approach as long as GetQuantiles is 137 // not available 138 const Int_t jbins = h1.GetNbinsX(); 139 const Double_t Nm = h1.Integral(); 140 141 const Double_t xq[2] = { 0.15*Nm, 0.98*Nm }; 142 143 yq[0] = yq[1] = h1.GetBinLowEdge(jbins+1); 144 145 for (int j=1; j<=jbins; j++) 146 if (h1.Integral(2, j) >= xq[0]) 147 { 148 yq[0] = h1.GetBinLowEdge(j); 149 break; 150 } 151 152 for (int j=1; j<=jbins; j++) 153 if (h1.Integral(1, j) >= xq[1] || h1.GetBinContent(j)==0) 154 { 155 yq[1] = h1.GetBinLowEdge(j); 156 break; 157 } 158 #else 159 // GetQuantiles doesn't seem to be available in root 3.01/06 160 Double_t xq[2] = { min, max }; 161 h.GetQuantiles(2, yq, xq); 162 #endif 163 } 164 165 void MHEffOnTime::DrawBin(TH1 &h, Int_t i) const 166 { 167 TString strg1 = fVarname+"-bin #"; 168 strg1 += i; 169 170 new TCanvas(strg1, strg1); 171 172 gPad->SetLogy(); 173 gStyle->SetOptFit(1011); 174 175 TString name="Bin_"; 176 name += i; 177 178 h.SetName(name); 179 h.SetXTitle("\\Delta t [s]"); 180 h.SetYTitle("Counts"); 181 h.DrawCopy(); 182 } 183 184 Bool_t MHEffOnTime::CalcResults(const TF1 &func, Double_t Nm, Int_t i) 185 { 186 const Double_t lambda = func.GetParameter(0); 187 const Double_t N0 = func.GetParameter(1); 188 const Double_t prob = func.GetProb(); 189 const Int_t NDF = func.GetNDF(); 190 191 Double_t xmin, xmax; 192 ((TF1&)func).GetRange(xmin, xmax); 193 194 *fLog << inf; 195 *fLog << "Fitted bin #" << i << " from " << xmin << " to " << xmax; 196 *fLog << ", got: lambda=" << lambda << "Hz N0=" << N0 << endl; 197 198 if (prob<=0.01) 199 { 200 *fLog << warn << "WARN - Fit bin#" << i << " gives:"; 201 *fLog << " Chi^2-Probab(" << prob << ")<0.01"; 202 *fLog << " NoFitPts=" << func.GetNumberFitPoints(); 203 *fLog << " Chi^2=" << func.GetChisquare(); 204 } 205 206 // was fit successful ? 207 if (NDF<=0 || /*prob<=0.001 ||*/ lambda<=0 || N0<=0) 208 { 209 *fLog << warn << dbginf << "Fit failed bin #" << i << ": "; 210 if (NDF<=0) 211 *fLog << " NDF(Number of Degrees of Freedom)=0"; 212 if (lambda<=0) 213 *fLog << " Parameter#0(lambda)=0"; 214 if (N0<=0) 215 *fLog << " Parameter#1(N0)=0"; 216 *fLog << endl; 217 218 return kFALSE; 219 } 220 221 // 222 // -------------- start error calculation ---------------- 223 // 224 Double_t emat[2][2]; 225 gMinuit->mnemat(&emat[0][0], 2); 226 227 // 228 // Rdead : fraction of real time lost by the dead time 229 // kappa = number of observed events (Nm) divided by 230 // the number of genuine events (N0) 231 // Teff : effective on-time 232 // 233 const Double_t Teff = Nm/lambda; 234 const Double_t kappa = Nm/N0; 235 const Double_t Rdead = 1.0 - kappa; 236 237 const Double_t dldl = emat[0][0]; 238 const Double_t dN0dN0 = emat[1][1]; 239 240 const Double_t dTeff = Teff * sqrt(dldl/(lambda*lambda) + 1.0/Nm); 241 const Double_t dl = sqrt(dldl); 242 const Double_t dRdead = kappa * sqrt(dN0dN0/(N0*N0) + 1.0/Nm); 243 // 244 // -------------- end error calculation ---------------- 245 // 246 247 // the effective on time is Nm/lambda 248 fHEffOn.SetBinContent(i, Teff); 249 fHEffOn.SetBinError (i, dTeff); 250 251 // plot chi2-probability of fit 252 fHProb.SetBinContent(i, prob); 253 254 // lambda from fit 255 fHLambda.SetBinContent(i, lambda); 256 fHLambda.SetBinError (i, dl); 257 258 // Rdead from fit 259 fHRdead.SetBinContent(i, Rdead); 260 fHRdead.SetBinError (i,dRdead); 261 262 return kTRUE; 263 } 264 265 void MHEffOnTime::ResetBin(Int_t i) 266 { 267 fHEffOn.SetBinContent (i, 1.e-20); 268 fHProb.SetBinContent (i, 1.e-20); 269 fHLambda.SetBinContent(i, 1.e-20); 270 fHRdead.SetBinContent (i, 1.e-20); 271 } 272 129 273 // ----------------------------------------------------------------------- 130 274 // … … 132 276 // time differences 133 277 // 134 void MHEffOnTime::Calc(TH2D *hist, const Bool_t Draw) 135 { 136 // Draw != 0 means the distribution of time differences should be drawn 137 278 void MHEffOnTime::Calc(const TH2D *hist, const Bool_t draw) 279 { 138 280 // nbins = number of Var bins 139 281 const Int_t nbins = hist->GetNbinsY(); 140 282 141 // start of 'for' loop ---------------------------142 283 for (int i=1; i<=nbins; i++) 143 284 { 144 TString strg0("Calc-"); 145 strg0 += fVarname; 146 TH1D &h = *hist->ProjectionX(strg0, i, i, "E"); 285 TH1D &h = *((TH2D*)hist)->ProjectionX(TString("Calc-")+fVarname, 286 i, i, "E"); 287 if (draw) 288 DrawBin(h, i); 289 290 ResetBin(i); 147 291 148 292 // Nmdel = Nm * binwidth, with Nm = number of observed events 293 const Double_t Nm = h.Integral(); 149 294 const Double_t Nmdel = h.Integral("width"); 150 const Double_t Nm = h.Integral(); 151 152 //................................................... 153 // determine range (yq[0], yq[1]) of time differences 154 // where fit should be performed; 155 // require a fraction >=xq[0] of all entries to lie below yq[0] 156 // and a fraction <=xq[1] of all entries to lie below yq[1]; 157 // within the range (yq[0], yq[1]) there must be no empty bin; 158 // choose pedestrian approach as long as GetQuantiles is not available 159 160 Double_t xq[2] = { 0.15, 0.95 }; 295 if (Nm <= 0) 296 { 297 *fLog << warn << dbginf << "Nm<0 for bin #" << i << endl; 298 delete &h; 299 continue; 300 } 301 161 302 Double_t yq[2]; 162 163 // GetQuantiles doesn't seem to be available in root 3.01/06 164 // h.GetQuantiles(2,yq,xq); 165 166 const Int_t jbins = h.GetNbinsX(); 167 168 fHEffOn.SetBinContent (i, 1.e-20); 169 fHProb.SetBinContent (i, 1.e-20); 170 fHLambda.SetBinContent(i, 1.e-20); 171 fHRdead.SetBinContent (i, 1.e-20); 172 173 // start of 'if' loop --------------------------- 174 if (Nm > 0.0) 175 { 176 // del is bin width in time difference 177 const Double_t del = Nmdel/Nm; 178 179 Double_t sum1 = 0.0; 180 yq[0] = h.GetBinLowEdge(jbins+1); 181 for (int j=1; j<=jbins; j++) 182 { 183 if (sum1 >= xq[0]*Nm) 184 { 185 yq[0] = h.GetBinLowEdge(j); 186 break; 187 } 188 sum1 += h.GetBinContent(j); 189 } 190 191 Double_t sum2 = 0.0; 192 yq[1] = h.GetBinLowEdge(jbins+1); 193 for (int j=1; j<=jbins; j++) 194 { 195 const Double_t content = h.GetBinContent(j); 196 sum2 += content; 197 if (sum2 >= xq[1]*Nm || content == 0.0) 198 { 199 yq[1] = h.GetBinLowEdge(j); 200 break; 201 } 202 } 203 204 //................................................... 205 206 // parameter 0 = lambda 207 // parameter 1 = N0 with N0 = ideal number of events 208 // parameter 2 = del (fixed) with del = bin width of time difference 209 210 TF1 func("Poisson", " [1]*[2] * [0] * exp(-[0] *x)", yq[0], yq[1]); 211 func.FixParameter(2, del); 212 213 func.SetParameter(0, 100); // [Hz] 214 func.SetParameter(1, Nm); 215 216 func.SetParLimits(0, 0, 1000); // [Hz] 217 func.SetParLimits(1, 0, 10*Nm); 218 219 func.SetParName(0, "lambda"); 220 func.SetParName(1, "N0"); 221 func.SetParName(2, "del"); 222 223 // options : 0 (=zero) do not plot the function 224 // I use integral of function in bin rather than value at bin center 225 // R use the range specified in the function range 226 // Q quiet mode 227 h.Fit("Poisson", "0IRQ"); 228 229 const Double_t lambda = func.GetParameter(0); 230 const Double_t N0 = func.GetParameter(1); 231 // const Double_t chi2 = func.GetChisquare(); 232 const Double_t Prob = func.GetProb(); 233 const Int_t NDF = func.GetNDF(); 234 235 // was fit successful ? 236 if (NDF>0 && Prob>0.01 && lambda>0.0 && N0>0.0) 237 { 238 // start error calculation ..................... 239 240 Double_t emat[2][2]; 241 // Double_t eplus, eminus, eparab, gcc; 242 gMinuit->mnemat(&emat[0][0], 2); 243 244 // for (int m=0; m<2; m++) 245 // { 246 // *fLog << "emat[" << m << "][n] = "; 247 // for (int n=0; n<2; n++) 248 // { 249 // *fLog << emat[m][n] << " "; 250 // } 251 // *fLog << endl; 252 // } 253 254 // *fLog << "eplus, eminus, eparab, gcc :" << endl; 255 // for (int k=0; k<2; k++) 256 // { 257 // gMinuit->mnerrs(k, eplus, eminus, eparab, gcc); 258 // *fLog << eplus << " " << eminus << " " << eparab << " " 259 // << gcc << endl; 260 // } 261 262 // Rdead : fraction of real time lost by the dead time 263 // kappa = number of observed events (Nm) divided by 264 // the number of genuine events (N0) 265 // Teff : effective on-time 266 267 Double_t Rdead, kappa, Teff, dTeff, dldl, dl, dRdead; 268 Double_t dN0dN0; 269 //Double_t dldN0,lN0corr; 270 Teff = Nm/lambda; 271 kappa = Nm/N0; 272 Rdead = 1.0 - kappa; 273 274 dldl = emat[0][0]; 275 dN0dN0 = emat[1][1]; 276 // dldN0 = emat[0][1]; 277 278 dTeff = Teff * sqrt(dldl/(lambda*lambda) + 1.0/Nm); 279 dl = sqrt(dldl); 280 dRdead = kappa * sqrt(dN0dN0/(N0*N0) + 1.0/Nm); 281 282 // lN0corr = dldN0 / sqrt(dldl * dN0dN0); 283 // *fLog << "MHEffOnTime : correlation between lambda and N0 = " 284 // << lN0corr << endl; 285 286 // end error calculation ..................... 287 288 // the effective on time is Nm/lambda 289 fHEffOn.SetBinContent(i, Teff); 290 fHEffOn.SetBinError (i, dTeff); 291 292 // plot chi2-probability of fit 293 fHProb.SetBinContent(i, Prob); 294 295 // lambda from fit 296 fHLambda.SetBinContent(i, lambda); 297 fHLambda.SetBinError (i, dl); 298 299 // Rdead from fit 300 fHRdead.SetBinContent(i, Rdead); 301 fHRdead.SetBinError (i,dRdead); 302 } 303 304 //........................ 305 // draw the distribution of time differences if requested 306 // 307 if (Draw == kTRUE) 308 { 309 char txt[100]; 310 TString strg1(fVarname); 311 strg1 += "-bin %d"; 312 sprintf(txt, strg1, i); 313 new TCanvas(txt, txt); 314 // TCanvas &c = *MakeDefCanvas(txt, txt); 315 // gROOT->SetSelectedPad(NULL); 316 317 gPad->SetLogy(); 318 gStyle->SetOptFit(1011); 319 // gStyle->SetOptStat(1); 320 321 h.SetName(txt); 322 h.SetXTitle("time difference [s]"); 323 h.SetYTitle("Counts"); 324 h.DrawCopy(); 325 326 func.SetRange(yq[0], yq[1]); // Range of Drawing 327 func.DrawCopy("same"); 328 329 // c.Modified(); 330 // c.Update(); 331 } 332 //........................ 333 } 334 // end of 'if' loop --------------------------- 303 GetQuantiles(h, 0.15, 0.95, yq); 304 305 // 306 // Setup Poisson function for the fit: 307 // lambda [Hz], N0 = ideal no of evts, del = bin width of dt 308 // 309 TF1 func("Poisson", " [1]*[2] * [0] * exp(-[0] *x)", yq[0], yq[1]); 310 func.SetParNames("lambda", "N0", "del"); 311 312 func.SetParameter(0, 1); 313 func.SetParameter(1, Nm); 314 func.FixParameter(2, Nmdel/Nm); 315 316 // For me (TB) it seems that setting parameter limits isn't necessary 317 318 // For a description of the options see TH1::Fit 319 h.Fit("Poisson", "0IRQ"); 320 321 // Calc and fill results of fit into the histograms 322 const Bool_t rc = CalcResults(func, Nm, i); 323 324 // draw the distribution of time differences if requested 325 if (rc && draw) 326 func.DrawCopy("same"); 335 327 336 328 delete &h; 337 329 } 338 // end of 'for' loop ---------------------------339 // gStyle->SetOptStat(1111);340 341 330 } 342 331 … … 347 336 Bool_t MHEffOnTime::SetupFill(const MParList *plist) 348 337 { 349 TString strg0("Binning"); 350 strg0 += fVarname; 351 352 const MBinning* binsVar = (MBinning*)plist->FindObject(strg0); 338 TString bn = "Binning"+fVarname; 339 340 const MBinning* binsVar = (MBinning*)plist->FindObject(bn); 353 341 354 342 if (!binsVar) 355 343 { 356 *fLog << err << dbginf << strg0 357 << " [MBinning] not found... aborting." << endl; 344 *fLog << err << dbginf << bn << " [MBinning] not found... aborting." << endl; 358 345 return kFALSE; 359 346 } … … 387 374 TObject *MHEffOnTime::DrawClone(Option_t *opt) const 388 375 { 389 TString strg0("EffOnTime"); 390 strg0 += fVarname; 391 TString strg1("Results from on time fit vs. "); 392 strg1 += fVarname; 393 394 TCanvas &c = *MakeDefCanvas(strg0, strg1); 376 TCanvas &c = *MakeDefCanvas(TString("EffOnTime")+fVarname, 377 TString("Results from on time fit vs. ")+fVarname); 395 378 c.Divide(2, 2); 396 379 … … 421 404 void MHEffOnTime::Draw(Option_t *opt) 422 405 { 423 TString strg0("EffOnTime");424 strg0 += fVarname;425 TString strg1("Results from on time fit vs. ");426 strg1 += fVarname;427 428 406 if (!gPad) 429 MakeDefCanvas(strg0, strg1); 407 MakeDefCanvas(TString("EffOnTime")+fVarname, 408 TString("Results from on time fit vs. ")+fVarname); 430 409 431 410 gPad->Divide(2,2); … … 447 426 } 448 427 449 450 451 452 453 428 void MHEffOnTime::Calc(const MHTimeDiffTheta &hist, const Bool_t Draw) 429 { 430 Calc(hist.GetHist(), Draw); 431 } 432 -
trunk/MagicSoft/Mars/mhist/MHEffOnTime.h
r1411 r1668 10 10 11 11 class TH2D; 12 class MHTimeDiffTheta; 12 13 class MParList; 13 14 … … 20 21 TH1D fHRdead; 21 22 22 const char *fVarname; 23 const char *fUnit; 23 TString fVarname; 24 TString fUnit; 25 26 void ResetBin(Int_t i); 27 Bool_t CalcResults(const TF1 &func, Double_t Nm, Int_t i); 28 void DrawBin(TH1 &h, Int_t i) const; 29 void GetQuantiles(const TH1 &h, Double_t min, Double_t max, Double_t yq[2]) const; 24 30 25 31 public: … … 32 38 const TH1D *GetHist() const { return &fHEffOn; } 33 39 34 void Calc(TH2D *hist, const Bool_t Draw); 40 void Calc(const TH2D *hist, const Bool_t Draw); 41 void Calc(const MHTimeDiffTheta &hist, const Bool_t Draw); 35 42 36 43 void Draw(Option_t *option=""); 37 44 TObject *DrawClone(Option_t *option="") const; 38 45 39 ClassDef(MHEffOnTime, 1) //1D-plot of Delta t vs. Var46 ClassDef(MHEffOnTime, 0) //1D-plot of Delta t vs. Var 40 47 }; 41 48 -
trunk/MagicSoft/Mars/mhist/MHEffOnTimeTheta.h
r1292 r1668 35 35 TObject *DrawClone(Option_t *option="") const; 36 36 37 ClassDef(MHEffOnTimeTheta, 1) //1D-plot of Delta t vs. Theta37 ClassDef(MHEffOnTimeTheta, 0) //1D-plot of Delta t vs. Theta 38 38 }; 39 39 -
trunk/MagicSoft/Mars/mhist/MHEffOnTimeTime.h
r1294 r1668 35 35 TObject *DrawClone(Option_t *option="") const; 36 36 37 ClassDef(MHEffOnTimeTime, 1) //1D-plot of Delta t vs. time37 ClassDef(MHEffOnTimeTime, 0) //1D-plot of Delta t vs. time 38 38 }; 39 39 -
trunk/MagicSoft/Mars/mhist/MHFlux.cc
r1604 r1668 42 42 #include <TProfile.h> 43 43 44 45 44 #include <TCanvas.h> 46 45 … … 53 52 #include "MLogManip.h" 54 53 54 #include "MHThetabarTheta.h" 55 #include "MHEffOnTime.h" 56 #include "MHGamma.h" 57 55 58 ClassImp(MHFlux); 56 59 60 MHFlux::MHFlux(const MHGamma &hist, const TString varname, const TString unit) 61 : fHOrig(), fHUnfold(), fHFlux() 62 { 63 const TH2D &h2d = *hist.GetProject(); 64 65 if (varname.IsNull() || unit.IsNull()) 66 *fLog << warn << dbginf << "varname or unit not defined" << endl; 67 68 fVarname = varname; 69 fUnit = unit; 70 71 // char txt[100]; 72 73 // original distribution of E-est for different bins 74 // of the variable (Theta or time) 75 // sprintf(txt, "gammas vs. E-est and %s",varname); 76 77 ((TH2D&)h2d).Copy(fHOrig); 78 79 fHOrig.SetName("E_est"); 80 fHOrig.SetTitle(TString("No.of gammas vs. E-est and ")+fVarname); 81 82 fHOrig.SetDirectory(NULL); 83 fHOrig.SetXTitle("E_{est} [GeV]"); 84 fHOrig.SetYTitle(fVarname+fUnit); 85 //fHOrig.Sumw2(); 86 87 SetBinning((TH2*)&fHOrig, (TH2*)&h2d); 88 89 fHOrig.Copy(fHUnfold); 90 91 // unfolded distribution of E-unfold for different bins 92 // of the variable (Theta or time) 93 // sprintf(txt, "gammas vs. E-unfold and %s",varname); 94 fHUnfold.SetName("E-unfolded"); 95 fHUnfold.SetTitle(TString("No.of gammas vs. E-unfold and ")+fVarname); 96 97 fHUnfold.SetDirectory(NULL); 98 fHUnfold.SetXTitle("E_{unfold} [GeV]"); 99 fHUnfold.SetYTitle(fVarname+fUnit); 100 //fHUnfold.Sumw2(); 101 102 SetBinning((TH2*)&fHUnfold, (TH2*)&fHOrig); 103 104 105 // absolute photon flux vs. E-unfold 106 // for different bins of the variable (Theta or time) 107 // 108 // sprintf(txt, "gamma flux [1/(s m2 GeV) vs. E-unfold and %s",varname); 109 fHFlux.SetName("photon flux"); 110 fHFlux.SetTitle(TString("Gamma flux [1/(s m^2 GeV) vs. E-unfold and ")+fVarname); 111 112 fHFlux.SetDirectory(NULL); 113 fHFlux.SetXTitle("E_{unfold} [GeV]"); 114 fHFlux.SetYTitle(fVarname+fUnit); 115 fHFlux.Sumw2(); 116 117 SetBinning((TH2*)&fHFlux, (TH2*)&fHUnfold); 118 } 57 119 58 120 // -------------------------------------------------------------------------- … … 61 123 // and the units for the variable 62 124 // 63 MHFlux::MHFlux(const TH2D &h2d, const Bool_t Draw, 64 const TString varname, const TString unit) 125 MHFlux::MHFlux(const TH2D &h2d, const TString varname, const TString unit) 65 126 : fHOrig(), fHUnfold(), fHFlux() 66 127 { … … 70 131 fVarname = varname; 71 132 fUnit = unit; 72 73 TString strg(varname);74 strg += unit;75 133 76 134 // char txt[100]; … … 80 138 // sprintf(txt, "gammas vs. E-est and %s",varname); 81 139 82 TString strg1 = "no.of gammas vs. E-est and ";83 strg1 += varname;84 85 140 ((TH2D&)h2d).Copy(fHOrig); 86 141 87 fHOrig.SetName("E -est");88 fHOrig.SetTitle( strg1);142 fHOrig.SetName("E_est"); 143 fHOrig.SetTitle(TString("No.of gammas vs. E-est and ")+fVarname); 89 144 90 145 fHOrig.SetDirectory(NULL); 91 fHOrig.SetXTitle("E-est [GeV]"); 92 fHOrig.SetYTitle(strg); 93 fHOrig.Sumw2(); 146 fHOrig.SetXTitle("E_{est} [GeV]"); 147 fHOrig.SetYTitle(fVarname+fUnit); 148 //fHOrig.Sumw2(); 149 150 // copy fHOrig into fHUnfold in case no unfolding is done 151 fHOrig.Copy(fHUnfold); 94 152 95 153 SetBinning((TH2*)&fHOrig, (TH2*)&h2d); … … 99 157 // of the variable (Theta or time) 100 158 // sprintf(txt, "gammas vs. E-unfold and %s",varname); 101 TString strg2 = "no.of gammas vs. E-unfold and ";102 strg2 += varname;103 104 159 fHUnfold.SetName("E-unfolded"); 105 fHUnfold.SetTitle( strg2);160 fHUnfold.SetTitle(TString("No.of gammas vs. E-unfold and ")+fVarname); 106 161 107 162 fHUnfold.SetDirectory(NULL); 108 fHUnfold.SetXTitle("E -unfold[GeV]");109 fHUnfold.SetYTitle( strg);110 fHUnfold.Sumw2();163 fHUnfold.SetXTitle("E_{unfold} [GeV]"); 164 fHUnfold.SetYTitle(fVarname+fUnit); 165 //fHUnfold.Sumw2(); 111 166 112 167 SetBinning((TH2*)&fHUnfold, (TH2*)&fHOrig); … … 117 172 // 118 173 // sprintf(txt, "gamma flux [1/(s m2 GeV) vs. E-unfold and %s",varname); 119 TString strg3 = "gamma flux [1/(s m2 GeV) vs. E-unfold and ";120 strg3 += varname;121 122 174 fHFlux.SetName("photon flux"); 123 fHFlux.SetTitle( strg3);175 fHFlux.SetTitle(TString("Gamma flux [1/(s m^{2} GeV)] vs. E-unfold and ")+fVarname); 124 176 125 177 fHFlux.SetDirectory(NULL); 126 fHFlux.SetXTitle("E -unfold[GeV]");127 fHFlux.SetYTitle( strg);178 fHFlux.SetXTitle("E_{unfold} [GeV]"); 179 fHFlux.SetYTitle(fVarname+fUnit); 128 180 fHFlux.Sumw2(); 129 181 130 182 SetBinning((TH2*)&fHFlux, (TH2*)&fHUnfold); 131 132 133 // copy fHOrig into fHUnfold in case no unfolding is done134 const Int_t nEunf = fHUnfold.GetNbinsX();135 const Int_t nVar = fHUnfold.GetNbinsY();136 for (int m=1; m<=nEunf; m++)137 {138 for (int n=1; n<=nVar; n++)139 {140 Double_t cont = fHOrig.GetBinContent(m,n);141 Double_t dcont = fHOrig.GetBinError(m,n);142 fHUnfold.SetBinContent(m,n,cont);143 fHUnfold.SetBinError(m,n,dcont);144 }145 }146 //..............................................147 // draw the No.of photons vs. E-est148 // for the individual bins of the variable Var149 150 if (Draw == kTRUE)151 {152 const Int_t nVar = fHOrig.GetNbinsY();153 154 for (int n=1; n<=nVar; n++)155 {156 TString strg0("Orig-");157 strg0 += fVarname;158 TH1D &h = *fHOrig.ProjectionX(strg0, n, n, "E");159 160 strg0 = fVarname;161 strg0 += "-bin ";162 strg0 += n;163 164 TString strg1("No.of photons vs. E-est for ");165 strg1 += strg0;166 167 new TCanvas(strg0, strg1);168 // TCanvas &c = *MakeDefCanvas(txt0, strg1);169 // gROOT->SetSelectedPad(NULL);170 171 gPad->SetLogx();172 173 h.SetName(strg0);174 h.SetTitle(strg1);175 h.SetXTitle("E-est [GeV]");176 h.SetYTitle("No.of photons");177 h.DrawCopy();178 179 // c.Modified();180 // c.Update();181 }182 }183 //........................184 183 } 185 184 … … 200 199 Bool_t MHFlux::Fill(const MParContainer *par) 201 200 { 202 return kTRUE;201 return kTRUE; 203 202 } 204 203 … … 208 207 // Unfold the distribution in E-est 209 208 // 210 void MHFlux::Unfold(const Bool_t Draw) 211 { 212 //.............................................. 213 // draw the No.of photons vs. E-unfold 214 // for the individual bins of the variable Var 215 216 if (Draw == kTRUE) 217 { 218 const Int_t nVar = fHUnfold.GetNbinsY(); 219 220 for (int n=1; n<=nVar; n++) 221 { 222 TString strg0("Unfold-"); 223 strg0 += fVarname; 224 TH1D &h = *fHUnfold.ProjectionX(strg0, n, n, "E"); 225 strg0 = fVarname; 226 strg0 += "-bin "; 227 strg0 += n; 228 229 TString strg1("No.of photons vs. E-unfold for "); 230 strg1 += strg0; 231 232 new TCanvas(strg0, strg1); 233 234 // TCanvas &c = *MakeDefCanvas(txt0, strg1); 235 // gROOT->SetSelectedPad(NULL); 236 237 gPad->SetLogx(); 238 239 h.SetName(strg0); 240 h.SetTitle(strg1); 241 h.SetXTitle("E-unfold [GeV]"); 242 h.SetYTitle("No.of photons"); 243 h.DrawCopy(); 244 245 // c.Modified(); 246 // c.Update(); 247 } 248 } 249 //........................ 250 } 251 209 void MHFlux::Unfold() 210 { 211 } 212 213 void MHFlux::CalcFlux(const MHEffOnTime &teff, const MHThetabarTheta &thetabar, 214 const TH2D *aeff) 215 { 216 CalcFlux(teff.GetHist(), thetabar.GetHist(), aeff); 217 } 218 219 Double_t MHFlux::ParabInterpolLog(const TAxis &axe, Int_t j, 220 Double_t y[], Double_t Ebar) const 221 { 222 const double t1 = log10(axe.GetBinLowEdge(j-1)) + log10(axe.GetBinUpEdge(j-1)); 223 const double t2 = log10(axe.GetBinLowEdge(j)) + log10(axe.GetBinUpEdge(j)); 224 const double t3 = log10(axe.GetBinLowEdge(j+1)) + log10(axe.GetBinUpEdge(j+1)); 225 226 const Double_t lebar = log10(Ebar); 227 228 return Parab(t1/2, t2/2, t3/2, y[j-2], y[j-1], y[j], lebar); 229 } 230 231 // -------------------------------------------------------------------- 232 // 233 // determine bins for interpolation (k3 is the middle one) in bar. 234 // k0 denotes the bin from which the error is copied 235 // 236 void MHFlux::FindBins(const TAxis &axe, const Double_t bar, Int_t &k3, Int_t &k0) const 237 { 238 const Int_t n = axe.GetNbins(); 239 240 k3 = axe.FindFixBin(bar); 241 k0 = k3; 242 243 if (k3<2) 244 { 245 k3 = 2; 246 if (bar<axe.GetBinLowEdge(2)) 247 k0 = 1; 248 } 249 250 if (k3>n-1) 251 { 252 k3 = n-1; 253 if (bar>axe.GetBinLowEdge(n)) 254 k0 = n; 255 } 256 257 if (bar>=axe.GetBinLowEdge(1) && bar<=axe.GetBinUpEdge(n)) 258 return; 259 260 *fLog << dbginf << "extrapolation: bar = " << bar; 261 *fLog << ", min =" << axe.GetBinLowEdge(1); 262 *fLog << ", max =" << axe.GetBinUpEdge(n) << endl; 263 } 264 265 Double_t MHFlux::ParabInterpolCos(const TAxis &axe, const TH2D *aeff, Int_t j, Int_t k3, Double_t val) const 266 { 267 const double t1 = cos( axe.GetBinCenter (k3-1) ); 268 const double t2 = cos( axe.GetBinCenter (k3) ); 269 const double t3 = cos( axe.GetBinCenter (k3+1) ); 270 271 const double a1 = aeff->GetBinContent(j, k3-1); 272 const double a2 = aeff->GetBinContent(j, k3); 273 const double a3 = aeff->GetBinContent(j, k3+1); 274 275 return Parab(t1, t2, t3, a1, a2, a3, val); 276 } 252 277 253 278 // ------------------------------------------------------------------------- … … 259 284 // 260 285 void MHFlux::CalcFlux(const TH1D *teff, const TProfile *thetabar, 261 const TH2D *aeff, const Bool_t Draw) 262 { 263 // Note that fHUnfold has bins in Eunf and Var 264 // *teff has bins in Var (the same bins in Var as fHUnfold) 265 // *thetabar has bins in Var (the same bins in Var as fHUnfold) 266 // *aeff has bins in Etru and Theta 267 // (where in general the binning in Etru is different 268 // from the binning in Eunf) 269 // The variable Var may be 'time' or 'Theta' 270 271 // Draw = kTRUE means the differential flux vs E-unf should be drawn 272 // for the individual bins of the variable Var 286 const TH2D *aeff) 287 { 288 // 289 // Note that fHUnfold has bins in Eunf and Var 290 // *teff has bins in Var (the same bins in Var as fHUnfold) 291 // *thetabar has bins in Var (the same bins in Var as fHUnfold) 292 // *aeff has bins in Etru and Theta 293 // (where in general the binning in Etru is different 294 // from the binning in Eunf) 295 // The variable Var may be 'time' or 'Theta' 273 296 274 297 const TAxis &axex = *((TH2*)aeff)->GetXaxis(); 275 298 const TAxis &axey = *((TH2*)aeff)->GetYaxis(); 276 299 277 //.................................... 278 // define dummy histogram *aeff 279 ((TH1*)aeff)->Sumw2(); 280 MBinning binsetru("BinningEtru"); 281 binsetru.SetEdgesLog(10, 10, 1e3); 282 283 MBinning binsthetatru("BinningThetatru"); 284 binsthetatru.SetEdges(7, -2.5, 32.5); 285 //SetBinning((TH1*)aeff, &binsetru, &binsthetatru); 286 SetBinning((TH2*)aeff, &binsetru, &binsthetatru); 287 288 const Int_t netru = aeff->GetNbinsX(); 289 const Int_t ntheta = aeff->GetNbinsY(); 290 291 for (int j=1; j<=netru; j++) 292 { 293 for (int k=1; k<=ntheta; k++) 294 { 295 Double_t cont = 10000.0; 296 ((TH1*)aeff)->SetBinContent(j, k, cont); 297 298 Double_t dcont = 100.0; 299 ((TH1*)aeff)->SetBinError(j, k, dcont); 300 } 301 } 302 // *fLog << "Dummy aeff : netru =" << netru << ", ntheta = " << ntheta << endl; 303 //.................................... 304 305 // number of Eunf and Var bins (histograms : fHUnfold, fHFlux) 306 const Int_t nEunf = fHFlux.GetNbinsX(); 307 const Int_t nVar = fHFlux.GetNbinsY(); 308 309 // number of Etru and Theta bins (histogram *aeff of collection area) 310 311 const Int_t nEtru = aeff->GetNbinsX(); 312 const Int_t nTheta = aeff->GetNbinsY(); 313 314 //*fLog << "nEunf =" << nEunf << ", nVar = " << nVar << endl; 315 //*fLog << "nEtru =" << nEtru << ", nTheta = " << nTheta << endl; 316 317 //................................................................... 318 // calculate effective collection area 319 // for the Eunf and Var bins of the histogram fHUnfold 320 // from the histogram *aeff, which has bins in Etru and Theta 321 // the result is the histogram fHAeff 322 // 323 324 TH2D fHAeff; 325 fHAeff.Sumw2(); 326 SetBinning((TH2*)&fHAeff, (TH2*)&fHUnfold); 327 328 Double_t *aeffbar = new Double_t[nEtru]; 329 Double_t *daeffbar = new Double_t[nEtru]; 330 331 Double_t aeffEunfVar; 332 Double_t daeffEunfVar; 333 334 //------ start n loop ------ 335 for (int n=1; n<=nVar; n++) 336 { 337 Double_t Thetabar = thetabar->GetBinContent(n); 338 Double_t cosThetabar = cos(Thetabar); 339 340 // determine Theta bins (k1, k2, k3) for interpolation in Theta 341 // k0 denotes the Theta bin from whicvh the error is copied 342 Int_t k0=0; 343 Int_t k1=0; 344 Int_t k2=0; 345 Int_t k3=0; 346 347 for (int k=3; k<=nTheta; k++) 348 { 349 Double_t Thetalow = axey.GetBinLowEdge(k); 350 if (Thetabar < Thetalow) 300 if (axex.GetNbins()<3) 301 { 302 *fLog << err << "ERROR - Number of Energy bins <3 not implemented!" << endl; 303 return; 304 } 305 306 if (axey.GetNbins()<3) 307 *fLog << warn << "WARNING - Less than 3 theta-bins not supported very well!" << endl; 308 309 // 310 // calculate effective collection area 311 // for the Eunf and Var bins of the histogram fHUnfold 312 // from the histogram *aeff, which has bins in Etru and Theta 313 // the result is the histogram fHAeff 314 // 315 TH2D fHAeff; 316 SetBinning((TH2*)&fHAeff, (TH2*)&fHUnfold); 317 fHAeff.Sumw2(); 318 319 // 320 // ------ start loops ------ 321 // 322 const Int_t nEtru = aeff->GetNbinsX(); 323 324 Double_t *aeffbar = new Double_t[nEtru]; 325 Double_t *daeffbar = new Double_t[nEtru]; 326 327 const Int_t nVar = fHFlux.GetNbinsY(); 328 for (int n=1; n<=nVar; n++) 329 { 330 const Double_t tbar = thetabar->GetBinContent(n); 331 const Double_t costbar = cos(tbar/kRad2Deg); 332 333 // determine bins for interpolation (k3, k0) 334 Int_t kv, ke; 335 FindBins(axey, tbar, kv, ke); 336 337 // 338 // calculate effective collection area at Theta = Thetabar 339 // by quadratic interpolation in cos(Theta); 340 // do this for each bin of Etru 341 // 342 for (int j=1; j<=nEtru; j++) 351 343 { 352 k1 = k-2; 353 k2 = k-1; 354 k3 = k; 355 k0 = k2; 356 break; 357 } 358 } 359 360 if (k3 == 0) 361 { 362 k1 = nTheta-2; 363 k2 = nTheta-1; 364 k3 = nTheta; 365 k0 = k2; 366 } 367 368 if (Thetabar < axey.GetBinLowEdge(2)) 369 k0 = 1; 370 else 371 if (Thetabar > axey.GetBinLowEdge(nTheta)) 372 k0 = nTheta; 373 374 Double_t Thetamin = axey.GetBinLowEdge(1); 375 Double_t Thetamax = axey.GetBinLowEdge(nTheta+1); 376 if (Thetabar < Thetamin || Thetabar > Thetamax) 377 { 378 *fLog << "MHFlux.cc : extrapolation in Theta; Thetabar = " << Thetabar 379 << ", Thetamin =" << Thetamin 380 << ", Thetamax =" << Thetamax << endl; 381 } 382 383 //*fLog << "Var bin " << n << ":" << endl; 384 //*fLog << "Thetabar= " << Thetabar 385 // << ", k0= " << k0 386 // << ", k1= " << k1 387 // << ", k2= " << k2 388 // << ", k3= " << k3 << endl; 389 390 391 // calculate effective collection area at Theta = Thetabar 392 // by quadratic interpolation in cos(Theta); 393 // do this for each bin of Etru 394 // 395 396 for (int j=1; j<=nEtru; j++) 397 { 398 double c0 = 0; 399 double c1 = 0; 400 double c2 = 0; 401 402 const double t1 = cos( axey.GetBinCenter (k1) ); 403 const double t2 = cos( axey.GetBinCenter (k2) ); 404 const double t3 = cos( axey.GetBinCenter (k3) ); 405 406 const double a1 = aeff->GetBinContent(j, k1); 407 const double a2 = aeff->GetBinContent(j, k2); 408 const double a3 = aeff->GetBinContent(j, k3); 409 410 Parab(t1, t2, t3, a1, a2, a3, &c0, &c1, &c2); 411 aeffbar[j] = c0 + c1*cosThetabar + c2*cosThetabar*cosThetabar; 412 daeffbar[j] = aeff->GetBinError(j,k0); 413 414 //*fLog << "Etru bin " << j << ": tbar= " << Thetabar 415 // << ", abar= " << aeffbar[j] 416 // << ", dabar= " << daeffbar[j] << endl; 417 } 418 419 //--- start m loop --- 420 // calculate effective collection area at (E = Ebar, Theta = Thetabar) 421 // by quadratic interpolation in log10(Etru) 422 // do this for each bin of Eunf 423 // 424 for (int m=1; m<=nEunf; m++) 425 { 426 Double_t log10Ebar = 0.5 * ( log10( fHUnfold.GetXaxis()->GetBinLowEdge(m) )+ 427 log10( fHUnfold.GetXaxis()->GetBinLowEdge(m+1)) ); 428 Double_t Ebar = pow(10.0, log10Ebar); 429 430 // determine Etru bins (j1, j2, j3) for interpolation in E 431 // j0 denotes the Etru bin from which the error is copied 432 Int_t j0=0; 433 Int_t j1=0; 434 Int_t j2=0; 435 Int_t j3=0; 436 437 for (int j=3; j<=nEtru; j++) 438 { 439 Double_t Elow = axex.GetBinLowEdge(j); 440 if (Ebar < Elow) 344 if (axey.GetNbins()<3) 441 345 { 442 j1 = j-2; 443 j2 = j-1; 444 j3 = j; 445 j0 = j2; 446 break; 346 // FIXME: Other interpolation? 347 aeffbar[j-1] = aeff->GetBinContent(j, n); 348 daeffbar[j-1] = aeff->GetBinError(j, n); 349 } 350 else 351 { 352 aeffbar[j-1] = ParabInterpolCos(axey, aeff, j, kv, costbar); 353 daeffbar[j-1] = aeff->GetBinError(j, ke); 447 354 } 448 355 } 449 356 450 if (j3 == 0) 357 // 358 // calculate effective collection area at (E = Ebar, Theta = Thetabar) 359 // by quadratic interpolation in log10(Etru) 360 // do this for each bin of Eunf 361 // 362 CalcEffCol(axex, fHAeff, n, aeffbar, daeffbar); 363 } 364 365 delete aeffbar; 366 delete daeffbar; 367 368 // 369 // now calculate the absolute gamma flux 370 // 371 CalcAbsGammaFlux(*teff, fHAeff); 372 } 373 374 // -------------------------------------------------------------------- 375 // 376 // calculate effective collection area at (E = Ebar, Theta = Thetabar) 377 // by quadratic interpolation in log10(Etru) 378 // do this for each bin of Eunf 379 // 380 void MHFlux::CalcEffCol(const TAxis &axex, TH2D &fHAeff, Int_t n, Double_t aeffbar[], Double_t daeffbar[]) 381 { 382 const Int_t nEunf = fHFlux.GetNbinsX(); 383 384 const TAxis &unfx = *fHUnfold.GetXaxis(); 385 386 for (int m=1; m<=nEunf; m++) 387 { 388 const Double_t Ebar = GetBinCenterLog(unfx, m); 389 390 Int_t j0, j3; 391 FindBins(axex, Ebar, j3, j0); 392 393 const Double_t v = ParabInterpolLog(axex, j3, aeffbar, Ebar); 394 395 fHAeff.SetBinContent(m,n, v); 396 fHAeff.SetBinError(m,n, daeffbar[j0-1]); 397 } 398 } 399 400 // -------------------------------------------------------------------- 401 // 402 // calculate the absolute gamma flux 403 // 404 void MHFlux::CalcAbsGammaFlux(const TH1D &teff, const TH2D &fHAeff) 405 { 406 const Int_t nEunf = fHFlux.GetNbinsX(); 407 const Int_t nVar = fHFlux.GetNbinsY(); 408 409 for (int m=1; m<=nEunf; m++) 410 { 411 const Double_t DeltaE = fHFlux.GetXaxis()->GetBinWidth(m); 412 413 for (int n=1; n<=nVar; n++) 451 414 { 452 j1 = nEtru-2; 453 j2 = nEtru-1; 454 j3 = nEtru; 455 j0 = j2; 415 const Double_t Ngam = fHUnfold.GetBinContent(m,n); 416 const Double_t Aeff = fHAeff.GetBinContent(m,n); 417 const Double_t Effon = teff.GetBinContent(n); 418 419 const Double_t c1 = fHUnfold.GetBinError(m,n)/Ngam; 420 const Double_t c2 = teff.GetBinError(n) /Effon; 421 const Double_t c3 = fHAeff.GetBinError(m,n) /Aeff; 422 423 const Double_t cont = Ngam / (DeltaE * Effon * Aeff); 424 const Double_t dcont = sqrt(c1*c1 + c2*c2 + c3*c3); 425 426 // 427 // Out of Range 428 // 429 const Bool_t oor = Ngam<=0 || DeltaE<=0 || Effon<=0 || Aeff<=0; 430 431 if (oor) 432 *fLog << warn << "MHFlux::CalcAbsGammaFlux(" << m << "," << n << ") "; 433 434 if (Ngam<=0) 435 *fLog << " Ngam=0"; 436 if (DeltaE<=0) 437 *fLog << " DeltaE=0"; 438 if (Effon<=0) 439 *fLog << " Effon=0"; 440 if (Aeff<=0) 441 *fLog << " Aeff=0"; 442 443 if (oor) 444 *fLog << endl; 445 446 fHFlux.SetBinContent(m,n, oor ? 1e-20 : cont); 447 fHFlux.SetBinError(m,n, oor ? 1e-20 : dcont*cont); 456 448 } 457 458 if (Ebar < axex.GetBinLowEdge(2)) 459 j0 = 1; 460 else 461 if (Ebar > axex.GetBinLowEdge(nEtru)) 462 j0 = nEtru; 463 464 Double_t Etrumin = axex.GetBinLowEdge(1); 465 Double_t Etrumax = axex.GetBinLowEdge(nEtru+1); 466 if (Ebar < Etrumin || Ebar > Etrumax) 467 { 468 *fLog << "MHFlux.cc : extrapolation in Energy; Ebar = " << Ebar 469 << ", Etrumin =" << Etrumin 470 << ", Etrumax =" << Etrumax << endl; 471 } 472 473 //*fLog << "Var bin " << n << ":" << endl; 474 //*fLog << "Ebar= " << Ebar 475 // << ", j1= " << j1 476 // << ", j2= " << j2 477 // << ", j3= " << j3 << endl; 478 479 480 double c0=0.0; 481 double c1=0.0; 482 double c2=0.0; 483 484 const double t1 = 0.5 * ( log10( axex.GetBinLowEdge (j1) )+ 485 log10( axex.GetBinLowEdge (j1+1)) ); 486 const double t2 = 0.5 * ( log10( axex.GetBinLowEdge (j2) )+ 487 log10( axex.GetBinLowEdge (j2+1)) ); 488 const double t3 = 0.5 * ( log10( axex.GetBinLowEdge (j3) )+ 489 log10( axex.GetBinLowEdge (j3+1)) ); 490 491 const double a1 = aeffbar[j1]; 492 const double a2 = aeffbar[j2]; 493 const double a3 = aeffbar[j3]; 494 495 Parab(t1, t2, t3, a1, a2, a3, &c0, &c1, &c2); 496 aeffEunfVar = c0 + c1*log10(Ebar) + c2*log10(Ebar)*log10(Ebar); 497 daeffEunfVar = daeffbar[j0]; 498 499 //*fLog << "Eunf bin " << m << ": Ebar= " << Ebar 500 // << ", aeffEunfVar = " << aeffEunfVar 501 // << ", daeffEunfVar = " << daeffEunfVar << endl; 502 503 fHAeff.SetBinContent(m,n,aeffEunfVar); 504 fHAeff.SetBinError(m,n,daeffEunfVar); 505 } 506 //--- end m loop --- 507 } 508 //------ end n loop ------ 509 delete aeffbar; 510 511 //................................................................... 512 // now calculate the absolute gamma flux 513 // 514 for (int m=1; m<=nEunf; m++) 515 { 516 Double_t DeltaE = fHFlux.GetXaxis()->GetBinWidth(m); 517 518 for (int n=1; n<=nVar; n++) 519 { 520 Double_t Ngam = fHUnfold.GetBinContent(m,n); 521 Double_t dNgam = fHUnfold.GetBinError(m,n); 522 523 Double_t Aeff = fHAeff.GetBinContent(m,n); 524 Double_t dAeff = fHAeff.GetBinError(m,n); 525 526 Double_t Effon = teff->GetBinContent(n); 527 Double_t dEffon = teff->GetBinError(n); 528 529 Double_t Cont, dCont; 530 if (Ngam>0 && DeltaE>0 && Effon>0 && Aeff>0) 531 { 532 Cont = Ngam / (DeltaE * Effon * Aeff); 533 dCont = Cont * sqrt( dNgam *dNgam / (Ngam*Ngam) + 534 dEffon*dEffon / (Effon*Effon) + 535 dAeff *dAeff / (Aeff*Aeff) ); 536 } 537 else 538 { 539 Cont = 1.e-20; 540 dCont = 1.e-20; 541 } 542 543 fHFlux.SetBinContent(m,n,Cont); 544 fHFlux.SetBinError(m,n,dCont); 545 546 //*fLog << "Eunf bin " << m << ", Var bin " << n 547 // << ": Ngam = " << Ngam << ", Flux = " 548 // << Cont << ", dFlux = " << dCont << endl; 549 //*fLog << ", DeltaE = " << DeltaE << ", Effon = " << Effon 550 // << ", Aeff = " << Aeff << endl; 551 } 552 } 553 554 //.............................................. 555 // draw the differential photon flux vs. E-unf 556 // for the individual bins of the variable Var 557 558 if (Draw == kTRUE) 559 { 560 for (int n=1; n<=nVar; n++) 561 { 562 TString strg0("Flux-"); 563 strg0 += fVarname; 564 565 TH1D &h = *fHFlux.ProjectionX(strg0, n, n, "E"); 566 567 TString strg1("Photon flux vs. E-unfold for "); 568 TString strg2 = fVarname; 569 570 strg2 += "-bin "; 571 strg2 += n; 572 573 TString strg3 = strg1 + strg2; 574 new TCanvas(strg2, strg3); 575 // TCanvas &c = *MakeDefCanvas(txt, txt); 576 // gROOT->SetSelectedPad(NULL); 577 578 gPad->SetLogx(); 579 580 h.SetName(strg2); 581 h.SetTitle(strg3); 582 h.SetXTitle("E-unfold [GeV] "); 583 h.SetYTitle("photons / (s m2 GeV)"); 584 h.DrawCopy(); 585 586 // c.Modified(); 587 // c.Update(); 588 } 589 } 590 //........................ 449 } 450 } 451 452 // -------------------------------------------------------------------- 453 // 454 // draw the differential photon flux vs. E-unf 455 // for the individual bins of the variable Var 456 // 457 void MHFlux::DrawFluxProjectionX(Option_t *opt) const 458 { 459 const Int_t nVar = fHFlux.GetNbinsY(); 460 461 for (int n=1; n<=nVar; n++) 462 { 463 TString strg0("Flux-"); 464 465 TH1D &h = *((TH2D)fHFlux).ProjectionX(strg0+fVarname, n, n, "E"); 466 467 TString strg1 = "Photon flux vs. E_{unfold} for "; 468 TString strg2 = fVarname+"-bin #"; 469 strg2 += n; 470 471 new TCanvas(strg2, strg1+strg2); 472 gPad->SetLogx(); 473 gPad->SetLogy(); 474 475 TString name = fVarname+"bin_"; 476 name += n; 477 478 h.SetName(name); 479 h.SetTitle(strg1+strg2); 480 h.SetXTitle("E_{unfold} [GeV]"); 481 h.SetYTitle("photons / (s m^{2} GeV)"); 482 h.GetXaxis()->SetLabelOffset(-0.025); 483 h.GetXaxis()->SetTitleOffset(1.1); 484 h.GetXaxis()->SetNdivisions(1); 485 h.GetYaxis()->SetTitleOffset(1.25); 486 h.DrawCopy(); 487 } 488 } 489 490 void MHFlux::DrawOrigProjectionX(Option_t *opt) const 491 { 492 const Int_t nVar = fHOrig.GetNbinsY(); 493 494 for (int n=1; n<=nVar; n++) 495 { 496 TString strg0 = "Orig-"; 497 strg0 += fVarname; 498 strg0 += "_"; 499 strg0 += n; 500 501 TH1D &h = *((TH2D)fHOrig).ProjectionX(strg0, n, n, "E"); 502 503 TString strg1("No.of photons vs. E-est for "); 504 strg1 += fVarname+"-bin "; 505 strg1 += n; 506 507 new TCanvas(strg0, strg1); 508 509 gPad->SetLogx(); 510 gPad->SetLogy(); 511 512 h.SetName(strg0); 513 h.SetTitle(strg1); 514 h.SetXTitle("E_{est} [GeV]"); 515 h.GetXaxis()->SetLabelOffset(-0.025); 516 h.GetXaxis()->SetTitleOffset(1.1); 517 h.GetXaxis()->SetNdivisions(1); 518 h.SetYTitle("No.of photons"); 519 h.DrawCopy(); 520 } 591 521 } 592 522 593 523 // ------------------------------------------------------------------------- 594 524 // 595 // Draw copies of the histograms525 // Draw copies of the histograms 596 526 // 597 527 TObject *MHFlux::DrawClone(Option_t *opt) const … … 622 552 // ------------------------------------------------------------------------- 623 553 // 624 // Draw the histograms554 // Draw the histograms 625 555 // 626 556 void MHFlux::Draw(Option_t *opt) … … 642 572 gPad->Modified(); 643 573 gPad->Update(); 574 } 575 576 Double_t MHFlux::Parab(Double_t x1, Double_t x2, Double_t x3, 577 Double_t y1, Double_t y2, Double_t y3, 578 Double_t val) 579 { 580 Double_t c0, c1, c2; 581 Parab(x1, x2, x3, y1, y2, y3, &c0, &c1, &c2); 582 return c0 + c1*val + c2*val*val; 644 583 } 645 584 … … 660 599 - x2*x1*x1 - x3*x2*x2 - x1*x3*x3; 661 600 662 if (det == 0.0)601 if (det==0) 663 602 { 664 603 *a = 0; … … 686 625 *c = (ai31*y1 + ai32*y2 + ai33*y3) * det1; 687 626 688 //yt1 = *a + *b * x1 + *c * x1*x1;689 //yt2 = *a + *b * x2 + *c * x2*x2;690 //yt3 = *a + *b * x3 + *c * x3*x3;691 692 //*fLog << "x1 = " << x1 << ", x2 = " << x2 << ", x3 = " << x3 << endl;693 //*fLog << "y1 = " << y1 << ", y2 = " << y2 << ", y3 = " << y3 << endl;694 //*fLog << "yt1 = " << yt1 << ", yt2 = " << yt2695 // << ", yt3 = " << yt3 << endl;696 //*fLog << "*a = " << *a << ", *b = " << *b << ", *c= " << *c697 // << ", *errflag = " << *errflag << endl;698 699 627 return kTRUE; 700 628 } -
trunk/MagicSoft/Mars/mhist/MHFlux.h
r1604 r1668 20 20 class TH2D; 21 21 22 class MHGamma; 23 class MHEffOnTime; 24 class MHThetabarTheta; 25 22 26 // base class MH is used because it defines "MakeDefCanvas" 23 27 // if base class MH is used one has to define the member function Fill … … 35 39 // all these plots for different bins of the variable (Theta or time) 36 40 41 void CalcEffCol(const TAxis &axex, TH2D &aeff, Int_t n, Double_t aeffbar[], Double_t daeffbar[]); 42 Double_t ParabInterpolCos(const TAxis &axe, const TH2D *aeff, Int_t j, Int_t k3, Double_t val) const; 43 void FindBins(const TAxis &axe, const Double_t bar, Int_t &k3, Int_t &k0) const; 44 void CalcAbsGammaFlux(const TH1D &teff, const TH2D &fHAeff); 45 Double_t ParabInterpolLog(const TAxis &axe, Int_t j, 46 Double_t y[], Double_t Ebar) const; 47 37 48 public: 38 MHFlux(const TH2D &h2d, const Bool_t Draw,39 49 MHFlux(const TH2D &h2d, const TString varname, const TString unit); 50 MHFlux(const MHGamma &h2d, const TString varname, const TString unit); 40 51 41 52 Bool_t Fill(const MParContainer *par); 42 53 43 void Unfold( const Bool_t Draw);54 void Unfold(); 44 55 void CalcFlux(const TH1D *teff, const TProfile *thetabar, 45 const TH2D *aeff, const Bool_t Draw); 56 const TH2D *aeff); 57 58 void CalcFlux(const MHEffOnTime &teff, 59 const MHThetabarTheta &thetabar, 60 const TH2D *aeff); 46 61 47 62 void Draw(Option_t *option=""); 48 63 TObject *DrawClone(Option_t *option="") const; 64 void DrawFluxProjectionX(Option_t *opt="") const; 65 void DrawOrigProjectionX(Option_t *opt="") const; 49 66 50 67 const TH2D *GetHOrig() { return &fHOrig; } … … 56 73 double *a, double *b, double *c); 57 74 58 ClassDef(MHFlux, 1) //2D-plots (original, unfolded, flux) 75 static Double_t Parab(double x1, double x2, double x3, 76 double y1, double y2, double y3, 77 double val); 78 79 ClassDef(MHFlux, 0) //2D-plots (original, unfolded, flux) 59 80 }; 60 81 -
trunk/MagicSoft/Mars/mhist/MHGamma.cc
r1422 r1668 38 38 #include <math.h> 39 39 40 #include <TH1.h>41 40 #include <TH2.h> 42 41 #include <TH3.h> 43 42 43 #include "MHAlphaEnergyTheta.h" 44 44 45 #include "MLog.h" 45 46 #include "MLogManip.h" … … 52 53 // Default Constructor. 53 54 // 54 MHGamma::MHGamma() 55 { 55 MHGamma::MHGamma(const TString &name, const TString &title) 56 : fHist(NULL), fProject(NULL) 57 { 58 fName = name.IsNull() ? (TString)"MHGamma" : name; 59 fTitle = title.IsNull() ? (TString)"3D-histogram of Alpha, E_est, Theta (Gamma sample)" : title; 56 60 } 57 61 … … 64 68 return kTRUE; 65 69 } 70 71 TH3D *MHGamma::Subtract(const MHAlphaEnergyTheta &h1, const MHAlphaEnergyTheta &h2) 72 { 73 return Subtract(h1.GetHist(), h2.GetHist()); 74 } 75 76 TObject *MHGamma::DrawClone(Option_t *opt="") const 77 { 78 DrawClone1(); 79 DrawClone2(); 80 81 return NULL; 82 } 83 84 void MHGamma::DrawClone1() const 85 { 86 if (!fHist) 87 return; 88 89 // 90 // ------------- Part 1 --------------------- 91 // 92 TString titlex = fHist->GetXaxis()->GetTitle(); 93 TString titley = fHist->GetYaxis()->GetTitle(); 94 TString titlez = fHist->GetYaxis()->GetTitle(); 95 96 TString canvtitle = "3D-plot "; //of "; 97 /* 98 canvtitle += titlex; 99 canvtitle += ", "; 100 canvtitle += titley; 101 canvtitle += ", "; 102 canvtitle += titlez+" "; 103 */ 104 canvtitle += "for \'gamma\' sample"; 105 106 TCanvas &c = *MakeDefCanvas("Alpha", canvtitle); 107 108 c.Divide(2, 2); 109 110 gROOT->SetSelectedPad(NULL); 111 112 TH1 *h; 113 114 c.cd(1); 115 h = ((TH3D*)(fHist))->Project3D(fName+"_ex"); 116 117 TString title= "Source-Antisource: "; 118 h->SetTitle(title + titlex); 119 h->SetXTitle(titlex); 120 h->SetYTitle("Counts"); 121 122 h->Draw(); 123 h->SetBit(kCanDelete); 124 125 c.cd(2); 126 h = ((TH3D*)(fHist))->Project3D(fName+"_ey"); 127 128 h->SetTitle(title + titley); 129 h->SetXTitle(titley); 130 h->SetYTitle("Counts"); 131 132 h->Draw(); 133 h->SetBit(kCanDelete); 134 gPad->SetLogx(); 135 136 c.cd(3); 137 h = ((TH3D*)(fHist))->Project3D(fName+"_ez"); 138 139 h->SetTitle(title + titlez); 140 h->SetXTitle(titlez); 141 h->SetYTitle("Counts"); 142 143 h->Draw(); 144 h->SetBit(kCanDelete); 145 146 c.cd(4); 147 ((TH3D*)fHist)->DrawCopy(); 148 149 c.Modified(); 150 c.Update(); 151 } 152 66 153 67 154 // -------------------------------------------------------------------------- … … 70 157 // fHist(gamma) = h1(source) - h2(antisource) 71 158 // 72 TH3D *MHGamma::Subtract(const TH3D *h1, const TH3D *h2, 73 const char *name, const char *title, 74 Bool_t Draw) 75 { 76 TH3D *fHist; 77 fHist = new TH3D(); 78 fHist->SetName(name); 79 fHist->SetTitle(title); 80 159 TH3D *MHGamma::Subtract(const TH3D *h1, const TH3D *h2) 160 { 161 if (fHist) 162 delete fHist; 163 164 fHist = new TH3D; 165 fHist->SetName(fName); 166 fHist->SetTitle(fTitle); 81 167 fHist->SetDirectory(NULL); 82 168 83 // SetBinning((TH3D*)fHist, (TH3D*)h1);84 169 SetBinning((TH1*)fHist, (TH1*)h1); 85 170 86 TString strg1 = (((TH1*)h1)->GetXaxis())->GetTitle(); 87 TString strg2 = (((TH1*)h1)->GetYaxis())->GetTitle(); 88 TString strg3 = (((TH1*)h1)->GetZaxis())->GetTitle(); 89 fHist->SetXTitle(strg1); 90 fHist->SetYTitle(strg2); 91 fHist->SetZTitle(strg3); 171 fHist->SetXTitle((((TH1*)h1)->GetXaxis())->GetTitle()); 172 fHist->SetYTitle((((TH1*)h1)->GetYaxis())->GetTitle()); 173 fHist->SetZTitle((((TH1*)h1)->GetZaxis())->GetTitle()); 92 174 93 175 fHist->Add((TH1*)h1, (TH1*)h2, 1, -1); // ROOT: FIXME! 94 95 //...........................................................96 // draw histogram97 if (Draw == kTRUE)98 {99 TString strg7 = "3D-plot of ";100 strg7 += strg1;101 strg7 += ",";102 strg7 += strg2;103 strg7 += ",";104 strg7 += strg3;105 strg7 += " for \'gamma\' sample";106 107 TCanvas &c = *MakeDefCanvas("Alpha", strg7);108 109 c.Divide(2, 2);110 111 gROOT->SetSelectedPad(NULL);112 113 TH1 *h;114 115 c.cd(1);116 h = ((TH3D*)(fHist))->Project3D("ex");117 118 TString strg0 = "SRC-ASRC : ";119 TString strg4 = strg0 + strg1;120 h->SetTitle(strg4);121 h->SetXTitle(strg1);122 h->SetYTitle("Counts");123 124 h->Draw();125 h->SetBit(kCanDelete);126 127 c.cd(2);128 h = ((TH3D*)(fHist))->Project3D("ey");129 130 TString strg5 = strg0 + strg2;131 h->SetTitle(strg5);132 h->SetXTitle(strg2);133 h->SetYTitle("Counts");134 135 h->Draw();136 h->SetBit(kCanDelete);137 gPad->SetLogx();138 139 c.cd(3);140 h = ((TH3D*)(fHist))->Project3D("ez");141 142 TString strg6 = strg0 + strg3;143 h->SetTitle(strg6);144 h->SetXTitle(strg3);145 h->SetYTitle("Counts");146 147 h->Draw();148 h->SetBit(kCanDelete);149 150 c.cd(4);151 ((TH3D*)fHist)->DrawCopy();152 153 c.Modified();154 c.Update();155 }156 176 157 177 return fHist; … … 162 182 // Integrate fHist(gamma) in the alpha range (lo, up) 163 183 // 164 TH2D *MHGamma::GetAlphaProjection(TH3D *fHist, Axis_t lo, Axis_t up, 165 Bool_t Drawp) 184 TH2D *MHGamma::GetAlphaProjection(Axis_t lo, Axis_t up) 166 185 { 167 186 if (up < lo) … … 204 223 axe.SetRange(ilo, iup); 205 224 206 TH2D &h2D = *(TH2D *)fHist->Project3D("ezy"); 207 208 TString strg0 = "2D-plot of "; 209 TString strg1 = (fHist->GetYaxis())->GetTitle(); 210 TString strg2 = (fHist->GetZaxis())->GetTitle(); 211 strg0 += strg2; 212 strg0 += " vs. "; 213 strg0 += strg1; 214 h2D.SetTitle(strg0); 215 h2D.SetXTitle(strg1); 216 h2D.SetYTitle(strg2); 217 218 219 //........................................................... 220 // draw histogram 221 if (Drawp == kTRUE) 222 { 223 char txt[100]; 224 TString strg3 = "No.of Gammas vs. "; 225 strg3 += strg1; 226 strg3 += " and "; 227 strg3 += strg2; 228 sprintf(txt, " (%.1f < alpha < %.1f deg)", lo, up); 229 strg3 += txt; 230 231 TCanvas &c = *MakeDefCanvas("Gamma", strg3); 232 233 c.Divide(2, 2); 234 235 gROOT->SetSelectedPad(NULL); 236 237 TH1 *h; 238 239 c.cd(1); 240 h = h2D.ProjectionX("xpro", -1, 9999, "E"); 241 TString strg0 = "No.of gammas : "; 242 TString strg7 = strg0 + strg1; 243 h->SetTitle(strg7); 244 h->SetXTitle(strg1); 245 h->SetYTitle("Counts"); 246 247 h->Draw(); 248 h->SetBit(kCanDelete); 249 gPad->SetLogx(); 250 251 c.cd(2); 252 h = h2D.ProjectionY("ypro", -1, 9999, "E"); 253 TString strg8 = strg0 + strg2; 254 h->SetTitle(strg8); 255 h->SetXTitle(strg2); 256 h->SetYTitle("Counts"); 257 258 h->Draw(); 259 h->SetBit(kCanDelete); 260 261 c.cd(3); 262 263 h2D.DrawCopy(); 264 gPad->SetLogx(); 265 266 c.Modified(); 267 c.Update(); 268 } 269 //........................................................... 270 271 return &h2D; 272 } 225 fLo = lo; 226 fHi = up; 227 228 if (fProject) 229 delete fProject; 230 fProject = (TH2D*)fHist->Project3D(fName+"_ezy"); 231 232 const TString title = "2D-plot of "; 233 const TString titley = fHist->GetYaxis()->GetTitle(); 234 const TString titlez = fHist->GetZaxis()->GetTitle(); 235 236 fProject->SetTitle(title + titley + " vs. " + titlez); 237 fProject->SetXTitle(titley); 238 fProject->SetYTitle(titlez); 239 240 return fProject; 241 } 242 243 void MHGamma::DrawClone2() const 244 { 245 if (!fProject) 246 return; 247 248 const TString titley = fHist->GetYaxis()->GetTitle(); 249 const TString titlez = fHist->GetZaxis()->GetTitle(); 250 251 TString canvtitle = "No.of Gammas ";//vs. "; 252 /* 253 canvtitle += titley; 254 canvtitle += " and "; 255 canvtitle += titlez; 256 */ 257 canvtitle += Form("(%.1f < alpha < %.1f deg)", fLo, fHi); 258 259 TCanvas &c = *MakeDefCanvas("Gamma", canvtitle); 260 261 c.Divide(2, 2); 262 263 gROOT->SetSelectedPad(NULL); 264 265 TH1 *h; 266 267 c.cd(1); 268 h = fProject->ProjectionX(fName+"_xpro", -1, 9999, "E"); 269 TString title = "No.of gammas: "; 270 h->SetTitle(title+titley); 271 h->SetXTitle(titley); 272 h->SetYTitle("Counts"); 273 274 h->Draw(); 275 h->SetBit(kCanDelete); 276 gPad->SetLogx(); 277 278 c.cd(2); 279 h = fProject->ProjectionY(fName+"_ypro", -1, 9999, "E"); 280 h->SetTitle(title+titlez); 281 h->SetXTitle(titlez); 282 h->SetYTitle("Counts"); 283 284 h->Draw(); 285 h->SetBit(kCanDelete); 286 287 c.cd(3); 288 289 fProject->DrawCopy(); 290 gPad->SetLogx(); 291 292 c.Modified(); 293 c.Update(); 294 } -
trunk/MagicSoft/Mars/mhist/MHGamma.h
r1413 r1668 6 6 #endif 7 7 8 #ifndef ROOT_TH39 #include "TH3.h"10 #endif11 12 #ifndef ROOT_TH213 #include "TH2.h"14 #endif15 16 8 class TH2D; 17 9 class TH3D; 18 10 11 class MHAlphaEnergyTheta; 12 19 13 class MHGamma : public MH 20 14 { 15 private: 16 TH3D *fHist; //! 17 TH2D *fProject; //! 18 19 Axis_t fLo; //! 20 Axis_t fHi; //! 21 21 22 public: 22 MHGamma( );23 MHGamma(const TString &name="", const TString &title=""); 23 24 24 25 Bool_t Fill(const MParContainer *par); 25 26 26 TH3D *Subtract(const TH3D *h1, const TH3D *h2, 27 const char *name, const char *title, Bool_t Draw=kFALSE); 27 TH3D *Subtract(const TH3D *h1, const TH3D *h2); 28 28 29 TH2D *GetAlphaProjection(TH3D *fHist, Axis_t lo, Axis_t up, 30 Bool_t Drawp=kFALSE); 29 TH3D *Subtract(const MHAlphaEnergyTheta &h1, const MHAlphaEnergyTheta &h2); 31 30 31 TH2D *GetAlphaProjection(Axis_t lo, Axis_t up); 32 32 33 ClassDef(MHGamma, 1) // manipulation of alpha distributions 33 TObject *DrawClone(Option_t *opt="") const; 34 void DrawClone1() const; 35 void DrawClone2() const; 36 37 const TH2D *GetProject() const { return fProject; } 38 39 ClassDef(MHGamma, 0) // manipulation of alpha distributions 34 40 }; 35 41 -
trunk/MagicSoft/Mars/mhist/MHHadronness.cc
r1610 r1668 45 45 // - black: acceptance of gammas (Ag) vs. the hadroness 46 46 // - red: acceptance of non gammas (Ah) vs. the hadroness 47 // - blue: 2D distance of (acceptance_hadrons, acceptances_gammas)48 // to optimum (0, 1)49 // 1-sqrt(Ag*Ag + (1-Ah)*(1-Ah))50 47 // * Bottom Left Corner: 51 48 // Naive quality factor: Ag/sqrt(Ah) … … 56 53 //////////////////////////////////////////////////////////////////////////// 57 54 #include "MHHadronness.h" 55 56 /* 57 // - blue: 2D distance of (acceptance_hadrons, acceptances_gammas) 58 // to optimum (0, 1): 1-sqrt(Ag*Ag + (1-Ah)*(1-Ah)) 59 */ 58 60 59 61 #include <TPad.h> … … 113 115 fQfac->SetTitle(" Naive Quality factor "); 114 116 115 fMinDist = new TH1D("MinDist", "Minimum Dist to (0, 1)", nbins, 0, 1); 116 fMinDist->SetXTitle("Hadronness"); 117 fMinDist->SetYTitle("Distance"); 117 /* 118 fMinDist = new TH1D("MinDist", "Minimum Dist to (0, 1)", nbins, 0, 1); 119 fMinDist->SetXTitle("Hadronness"); 120 fMinDist->SetYTitle("Distance"); 121 */ 118 122 119 123 //fQfac->SetDirectory(NULL); 120 124 fGhness->SetDirectory(NULL); 121 125 fPhness->SetDirectory(NULL); 122 fMinDist->SetDirectory(NULL);126 //fMinDist->SetDirectory(NULL); 123 127 fIntGhness->SetDirectory(NULL); 124 128 fIntPhness->SetDirectory(NULL); … … 136 140 delete fIntPhness; 137 141 delete fQfac; 138 delete fMinDist;142 // delete fMinDist; 139 143 delete fGraph; 140 144 } … … 266 270 continue; 267 271 268 fMinDist->SetBinContent(i, 1-sqrt(ip*ip + (ig-1)*(ig-1)));269 270 Double_t val = ig/sqrt(ip);272 //fMinDist->SetBinContent(i, 1-sqrt(ip*ip + (ig-1)*(ig-1))); 273 274 const Double_t val = ig/sqrt(ip); 271 275 fQfac->SetPoint(i, ig, val); 272 276 … … 360 364 361 365 *fLog << "Used " << fGhness->GetEntries() << " Gammas and " << fPhness->GetEntries() << " Hadrons." << endl; 362 *fLog << " acc(hadron) acc(gamma)" << endl <<endl;363 364 *fLog << " 0.005 " << Form("%6.3f", GetGammaAcceptance(0.005)) << endl;365 *fLog << " 0.02 " << Form("%6.3f", GetGammaAcceptance(0.02))<< endl;366 *fLog << " 0.05 " << Form("%6.3f", GetGammaAcceptance(0.05))<< endl;367 *fLog << " 0.1 " << Form("%6.3f", GetGammaAcceptance(0.1 ))<< endl;368 *fLog << " 0.2 " << Form("%6.3f", GetGammaAcceptance(0.2 ))<< endl;369 *fLog << " 0.3 " << Form("%6.3f", GetGammaAcceptance(0.3 ))<< endl;370 *fLog << Form("%6.3f", GetHadronAcceptance(0.1)) << " 0.1 " << endl;371 *fLog << Form("%6.3f", GetHadronAcceptance(0.2)) << " 0.2 " << endl;372 *fLog << Form("%6.3f", GetHadronAcceptance(0.3)) << " 0.3 " << endl;373 *fLog << Form("%6.3f", GetHadronAcceptance(0.4)) << " 0.4 " << endl;374 *fLog << Form("%6.3f", GetHadronAcceptance(0.5)) << " 0.5 " << endl;375 *fLog << Form("%6.3f", GetHadronAcceptance(0.6)) << " 0.6 " << endl;376 *fLog << Form("%6.3f", GetHadronAcceptance(0.7)) << " 0.7 " << endl;377 *fLog << Form("%6.3f", GetHadronAcceptance(0.8)) << " 0.8 " << endl;366 *fLog << "acc(hadron) acc(gamma) acc(g)/acc(h)" << endl <<endl; 367 368 *fLog << " 0.005 " << Form("%6.3f", GetGammaAcceptance(0.005)) << " " << Form("%6.3f", GetGammaAcceptance(0.005)/0.005) << endl; 369 *fLog << " 0.02 " << Form("%6.3f", GetGammaAcceptance(0.02)) << " " << Form("%6.3f", GetGammaAcceptance(0.02)/0.02) << endl; 370 *fLog << " 0.05 " << Form("%6.3f", GetGammaAcceptance(0.05)) << " " << Form("%6.3f", GetGammaAcceptance(0.05)/0.05) << endl; 371 *fLog << " 0.1 " << Form("%6.3f", GetGammaAcceptance(0.1 )) << " " << Form("%6.3f", GetGammaAcceptance(0.1)/0.1) << endl; 372 *fLog << " 0.2 " << Form("%6.3f", GetGammaAcceptance(0.2 )) << " " << Form("%6.3f", GetGammaAcceptance(0.2)/0.2) << endl; 373 *fLog << " 0.3 " << Form("%6.3f", GetGammaAcceptance(0.3 )) << " " << Form("%6.3f", GetGammaAcceptance(0.3)/0.3) << endl; 374 *fLog << Form("%6.3f", GetHadronAcceptance(0.1)) << " 0.1 " << endl; 375 *fLog << Form("%6.3f", GetHadronAcceptance(0.2)) << " 0.2 " << endl; 376 *fLog << Form("%6.3f", GetHadronAcceptance(0.3)) << " 0.3 " << endl; 377 *fLog << Form("%6.3f", GetHadronAcceptance(0.4)) << " 0.4 " << endl; 378 *fLog << Form("%6.3f", GetHadronAcceptance(0.5)) << " 0.5 " << endl; 379 *fLog << Form("%6.3f", GetHadronAcceptance(0.6)) << " 0.6 " << endl; 380 *fLog << Form("%6.3f", GetHadronAcceptance(0.7)) << " 0.7 " << endl; 381 *fLog << Form("%6.3f", GetHadronAcceptance(0.8)) << " 0.8 " << endl; 378 382 *fLog << endl; 379 383 380 const Int_t h = fMinDist->GetMaximumBin(); 381 *fLog << "Minimum Distance to (0, 1): " << Form("%.2f", 1-fMinDist->GetMaximum()) << " @ H=" << fMinDist->GetBinCenter(h) << endl; 382 *fLog << " Acc Gammas = " << Form("%3.0f", fIntGhness->GetBinContent(h)*100) << "%, "; 383 *fLog << "Acc Hadrons = " << Form("%3.0f", fIntPhness->GetBinContent(h)*100) << "%" << endl; 384 /* 385 const Int_t h = fMinDist->GetMaximumBin(); 386 *fLog << "Minimum Distance to (0, 1): " << Form("%.2f", 1-fMinDist->GetMaximum()) << " @ H=" << fMinDist->GetBinCenter(h) << endl; 387 *fLog << " Acc Gammas = " << Form("%3.0f", fIntGhness->GetBinContent(h)*100) << "%, "; 388 *fLog << "Acc Hadrons = " << Form("%3.0f", fIntPhness->GetBinContent(h)*100) << "%" << endl; 389 */ 384 390 385 391 *fLog << "Q-Factor @ Acc Gammas=0.5: Q(0.5)=" << Form("%.1f", GetQ05()) << endl; … … 412 418 Getiphness()->SetLineColor(kRed); 413 419 Getiphness()->DrawCopy("same"); 414 fMinDist->SetLineColor(kBlue); 415 fMinDist->DrawCopy("same"); 420 /* 421 fMinDist->SetLineColor(kBlue); 422 fMinDist->DrawCopy("same"); 423 */ 416 424 c.cd(3); 417 425 //GetQfac()->DrawCopy(); … … 449 457 gPad->Update(); 450 458 } 459 /* 451 460 const Int_t h = fMinDist->GetMaximumBin(); 452 461 TMarker *m = new TMarker(fIntPhness->GetBinContent(h), … … 455 464 m->SetBit(kCanDelete); 456 465 m->Draw(); 466 */ 457 467 return &c; 458 468 } … … 482 492 Getiphness()->SetLineColor(kRed); 483 493 Getiphness()->Draw("same"); 484 fMinDist->SetLineColor(kBlue); 485 fMinDist->Draw("same"); 494 /* 495 fMinDist->SetLineColor(kBlue); 496 fMinDist->Draw("same"); 497 */ 486 498 gPad->cd(3); 487 499 //GetQfac()->Draw(); … … 516 528 gPad->Update(); 517 529 } 530 /* 518 531 const Int_t h = fMinDist->GetMaximumBin(); 519 532 TMarker *m = new TMarker(fIntPhness->GetBinContent(h), … … 522 535 m->SetBit(kCanDelete); 523 536 m->Draw(); 524 } 537 */ 538 } -
trunk/MagicSoft/Mars/mhist/MHHadronness.h
r1574 r1668 15 15 { 16 16 private: 17 const MMcEvt *fMcEvt; 18 const MHadronness *fHadronness; 17 const MMcEvt *fMcEvt; //! 18 const MHadronness *fHadronness; //! 19 19 20 TH1D* fPhness; 21 TH1D* fGhness; //-> GammasHadronness22 TH1D* fIntPhness; 23 TH1D* fIntGhness; //-> GammasAcceptance24 TH1D* fMinDist;//-> Minimum Distance to optimum acceptance20 TH1D* fPhness; //-> Hadrons Hadronness 21 TH1D* fGhness; //-> Gammas Hadronness 22 TH1D* fIntPhness; //-> Hadrons Acceptance 23 TH1D* fIntGhness; //-> Gammas Acceptance 24 //TH1D* fMinDist; //-> Minimum Distance to optimum acceptance 25 25 26 TGraph *fQfac; 27 TGraph *fGraph; 26 TGraph *fQfac; //-> Quality factor 27 TGraph *fGraph; //-> gamma acceptance vs. hadron acceptance 28 28 29 29 public: -
trunk/MagicSoft/Mars/mhist/MHMcCollectionArea.cc
r1642 r1668 112 112 // Fill data into the histogram which contains all showers 113 113 // 114 void MHMcCollectionArea::FillAll( Float_t energy, Float_t radius)114 void MHMcCollectionArea::FillAll(Double_t energy, Double_t radius) 115 115 { 116 116 fHistAll->Fill(energy, radius); … … 121 121 // Fill data into the histogram which contains the selected showers 122 122 // 123 void MHMcCollectionArea::FillSel( Float_t energy, Float_t radius)123 void MHMcCollectionArea::FillSel(Double_t energy, Double_t radius) 124 124 { 125 125 fHistSel->Fill(energy, radius); -
trunk/MagicSoft/Mars/mhist/MHMcCollectionArea.h
r1610 r1668 26 26 ~MHMcCollectionArea(); 27 27 28 void FillAll( Float_t energy, Float_t radius);29 void FillSel( Float_t energy, Float_t radius);28 void FillAll(Double_t energy, Double_t radius); 29 void FillSel(Double_t energy, Double_t radius); 30 30 31 31 void DrawAll(Option_t *option=""); -
trunk/MagicSoft/Mars/mhist/MHMcEnergyMigration.h
r1574 r1668 40 40 TObject *DrawClone(Option_t *option="") const; 41 41 42 ClassDef(MHMcEnergyMigration, 1) //3D-histogram E-true E-est Theta42 ClassDef(MHMcEnergyMigration, 0) //3D-histogram E-true E-est Theta 43 43 44 44 }; -
trunk/MagicSoft/Mars/mhist/MHThetabarTheta.cc
r1412 r1668 99 99 gROOT->SetSelectedPad(NULL); 100 100 101 ((TProfile *)&fHist)->DrawCopy(opt);101 ((TProfile)fHist).DrawCopy(opt); 102 102 103 103 c.Modified(); … … 128 128 Bool_t MHThetabarTheta::Fill(const MParContainer *par) 129 129 { 130 fHist.Fill(fMcEvt->GetTheta()*kRad2Deg, fMcEvt->GetTheta()*kRad2Deg); 130 const Double_t theta = fMcEvt->GetTelescopeTheta()*kRad2Deg; 131 132 fHist.Fill(theta, theta); 131 133 132 134 return kTRUE; 133 135 } 134 135 136 137 138 139 140 141 142 143 144 145 146 -
trunk/MagicSoft/Mars/mhist/MHThetabarTheta.h
r1574 r1668 17 17 { 18 18 private: 19 MTime *fTime; //!20 MMcEvt *fMcEvt; //!19 MTime *fTime; //! 20 MMcEvt *fMcEvt; //! 21 21 22 TProfile 22 TProfile fHist; 23 23 24 24 public: … … 36 36 TObject *DrawClone(Option_t *option="") const; 37 37 38 ClassDef(MHThetabarTheta, 1) //Profile histogram Thetabar vs. time38 ClassDef(MHThetabarTheta, 0) //Profile histogram Thetabar vs. time 39 39 40 40 }; -
trunk/MagicSoft/Mars/mhist/MHThetabarTime.h
r1574 r1668 39 39 TObject *DrawClone(Option_t *option="") const; 40 40 41 ClassDef(MHThetabarTime, 1) //Profile histogram Thetabar vs. time41 ClassDef(MHThetabarTime, 0) //Profile histogram Thetabar vs. time 42 42 43 43 }; -
trunk/MagicSoft/Mars/mhist/MHTimeDiffTheta.cc
r1295 r1668 187 187 gPad->Modified(); 188 188 gPad->Update(); 189 190 189 } 191 190 … … 196 195 Bool_t MHTimeDiffTheta::Fill(const MParContainer *par) 197 196 { 198 const Int_t time = fTime->GetTimeLo();199 200 fHist.Fill( 0.0001*(time-fLastTime), fMcEvt->GetTheta()*kRad2Deg);197 const Double_t time = 200e-9*fTime->GetTimeLo() + fTime->GetTimeHi(); 198 199 fHist.Fill(time-fLastTime, fMcEvt->GetTelescopeTheta()*kRad2Deg); 201 200 fLastTime = time; 202 201 -
trunk/MagicSoft/Mars/mhist/MHTimeDiffTheta.h
r1574 r1668 19 19 MTime *fTime; //! 20 20 MMcEvt *fMcEvt; //! 21 Int_tfLastTime;21 Double_t fLastTime; 22 22 23 23 TH2D fHist; … … 37 37 TObject *DrawClone(Option_t *option="") const; 38 38 39 ClassDef(MHTimeDiffTheta, 1) //2D-histogram time-diff vs. Theta39 ClassDef(MHTimeDiffTheta, 0) //2D-histogram time-diff vs. Theta 40 40 }; 41 41 -
trunk/MagicSoft/Mars/mhist/MHTimeDiffTime.cc
r1295 r1668 100 100 { 101 101 102 TCanvas &c = *MakeDefCanvas("DiffTimeTime", "Distrib of \\Delta t, time");102 TCanvas &c = *MakeDefCanvas("DiffTimeTime", "Distrib of dt and t"); 103 103 104 104 c.Divide(2, 2); … … 186 186 Bool_t MHTimeDiffTime::Fill(const MParContainer *par) 187 187 { 188 const Int_t time = fTime->GetTimeLo();188 const Double_t time = 200e-9*fTime->GetTimeLo() + fTime->GetTimeHi(); 189 189 190 fHist.Fill(0.0001*(time-fLastTime), 0.0001*time); 191 190 fHist.Fill(time-fLastTime, time); 192 191 fLastTime = time; 193 192 -
trunk/MagicSoft/Mars/mhist/MHTimeDiffTime.h
r1574 r1668 17 17 private: 18 18 MTime *fTime; //! 19 Int_t fLastTime;19 Double_t fLastTime; 20 20 21 21 TH2D fHist; … … 35 35 TObject *DrawClone(Option_t *option="") const; 36 36 37 ClassDef(MHTimeDiffTime, 1) //2D-histogram time-diff vs. time37 ClassDef(MHTimeDiffTime, 0) //2D-histogram time-diff vs. time 38 38 }; 39 39 -
trunk/MagicSoft/Mars/mmain/MAnalysis.cc
r1656 r1668 100 100 } 101 101 102 MAnalysis::MAnalysis( const TGWindow *main,const TGWindow *p,102 MAnalysis::MAnalysis(/*const TGWindow *main,*/ const TGWindow *p, 103 103 const UInt_t w, const UInt_t h) 104 : MBrowser( main,p, w, h)104 : MBrowser(/*main,*/ p, w, h) 105 105 { 106 106 AddButtons(); -
trunk/MagicSoft/Mars/mmain/MAnalysis.h
r1076 r1668 28 28 29 29 public: 30 MAnalysis( const TGWindow *main=NULL,const TGWindow *p=NULL,30 MAnalysis(/*const TGWindow *main=NULL,*/ const TGWindow *p=NULL, 31 31 const UInt_t w=500, const UInt_t h=500) ; 32 32 -
trunk/MagicSoft/Mars/mmain/MBrowser.cc
r1172 r1668 275 275 } 276 276 277 MBrowser::MBrowser(const TGWindow *main, const TGWindow *p, 278 const UInt_t w, const UInt_t h) 279 : TGTransientFrame(p?p:gClient->GetRoot(), 280 main?main:gClient->GetRoot(), w, h) 277 MBrowser::MBrowser(/*const TGWindow *main,*/ const TGWindow *p, 278 const UInt_t w, const UInt_t h) 279 //: TGTransientFrame(p?p:gClient->GetRoot(), 280 // main?main:gClient->GetRoot(), w, h) 281 : TGMainFrame(p?p:gClient->GetRoot(), w, h) 281 282 { 282 283 fList = new MGList; … … 291 292 fList->Add(linesep); 292 293 AddFrame(linesep, laylinesep); 293 294 294 295 295 // -
trunk/MagicSoft/Mars/mmain/MBrowser.h
r1172 r1668 19 19 class TGFileContainer; 20 20 21 class MBrowser : public TG TransientFrame21 class MBrowser : public TGMainFrame/*TGTransientFrame*/ 22 22 { 23 23 private: … … 62 62 63 63 public: 64 MBrowser( const TGWindow *main=NULL,const TGWindow *p=NULL,65 64 MBrowser(/*const TGWindow *main=NULL,*/ const TGWindow *p=NULL, 65 const UInt_t w=500, const UInt_t h=500) ; 66 66 67 67 virtual ~MBrowser(); -
trunk/MagicSoft/Mars/mmain/MCameraDisplay.cc
r1086 r1668 43 43 // 'new MCameraDisplay()' 44 44 // 45 MCameraDisplay::MCameraDisplay( const TGWindow *main,const TGWindow *p,46 const UInt_t w, const UInt_t h)47 : MBrowser( main,p, w, h)45 MCameraDisplay::MCameraDisplay(/*const TGWindow *main,*/ const TGWindow *p, 46 const UInt_t w, const UInt_t h) 47 : MBrowser(/*main,*/ p, w, h) 48 48 { 49 49 TGTextButton *disp = new TGTextButton(fTop2, "Display Events", kButDisplay); … … 91 91 case kButDisplay: 92 92 new MGCamDisplay(fInputFile, 93 fClient->GetRoot(), this,600, 500);93 fClient->GetRoot(), /*this,*/ 600, 500); 94 94 return kTRUE; 95 95 } -
trunk/MagicSoft/Mars/mmain/MCameraDisplay.h
r1016 r1668 9 9 { 10 10 public: 11 MCameraDisplay( const TGWindow *main=NULL,const TGWindow *p=NULL,11 MCameraDisplay(/*const TGWindow *main=NULL,*/ const TGWindow *p=NULL, 12 12 const UInt_t w=500, const UInt_t h=500) ; 13 13 -
trunk/MagicSoft/Mars/mmain/MDataCheck.cc
r1652 r1668 54 54 // 'new MDataCheck()' 55 55 // 56 MDataCheck::MDataCheck( const TGWindow *main,const TGWindow *p,56 MDataCheck::MDataCheck(/*const TGWindow *main,*/ const TGWindow *p, 57 57 const UInt_t w, const UInt_t h) 58 : MBrowser( main,p, w, h)58 : MBrowser(/*main,*/ p, w, h) 59 59 { 60 60 TGTextButton *pedadc = new TGTextButton(fTop1, "ADC Spectra of Pedestals", kButPedAdc); -
trunk/MagicSoft/Mars/mmain/MDataCheck.h
r1652 r1668 16 16 17 17 public: 18 MDataCheck( const TGWindow *main=NULL,const TGWindow *p=NULL,18 MDataCheck(/*const TGWindow *main=NULL,*/ const TGWindow *p=NULL, 19 19 const UInt_t w=500, const UInt_t h=500) ; 20 20 -
trunk/MagicSoft/Mars/mmain/MEvtDisp.cc
r1086 r1668 39 39 }; 40 40 41 MEvtDisp::MEvtDisp( const TGWindow *main,const TGWindow *p,41 MEvtDisp::MEvtDisp(/*const TGWindow *main,*/ const TGWindow *p, 42 42 const UInt_t w, const UInt_t h) 43 : MBrowser( main,p, w, h)43 : MBrowser(/*main,*/ p, w, h) 44 44 { 45 45 TGTextButton *fadcevt = new TGTextButton(fTop1, "FADC Disp for Events", kButDispEvt); … … 96 96 case kButDispEvt: 97 97 new MGFadcDisp(fInputFile, "Events", 98 fClient->GetRoot(), this,600, 500);98 fClient->GetRoot(), /*this,*/ 600, 500); 99 99 return kTRUE; 100 100 101 101 case kButDispPedestal: 102 102 new MGFadcDisp(fInputFile , "PedEvts", 103 fClient->GetRoot(), this,600, 500);103 fClient->GetRoot(), /*this,*/ 600, 500); 104 104 return kTRUE; 105 105 106 106 case kButDispCalibration: 107 107 new MGFadcDisp(fInputFile , "CalEvts", 108 fClient->GetRoot(), this,600, 500);108 fClient->GetRoot(), /*this,*/ 600, 500); 109 109 return kTRUE; 110 110 } -
trunk/MagicSoft/Mars/mmain/MEvtDisp.h
r1016 r1668 9 9 { 10 10 public: 11 MEvtDisp( const TGWindow *main=NULL,const TGWindow *p=NULL,11 MEvtDisp(/*const TGWindow *main=NULL,*/ const TGWindow *p=NULL, 12 12 const UInt_t w=500, const UInt_t h=500) ; 13 13 -
trunk/MagicSoft/Mars/mmain/MMars.cc
r1644 r1668 277 277 278 278 case kButEvtDisplay: 279 new MEvtDisp( this);279 new MEvtDisp(/*this*/); 280 280 return kTRUE; 281 281 282 282 case kButDataCheck: 283 new MDataCheck( this);283 new MDataCheck(/*this*/); 284 284 return kTRUE; 285 285 286 286 case kButAnalysis: 287 new MAnalysis( this);287 new MAnalysis(/*this*/); 288 288 return kTRUE; 289 289 290 290 case kButMonteCarlo: 291 new MMonteCarlo( this);291 new MMonteCarlo(/*this*/); 292 292 return kTRUE; 293 293 294 294 case kButCameraDisplay: 295 new MCameraDisplay( this);295 new MCameraDisplay(/*this*/); 296 296 return kTRUE; 297 297 -
trunk/MagicSoft/Mars/mmain/MMonteCarlo.cc
r1646 r1668 162 162 } 163 163 164 MMonteCarlo::MMonteCarlo( const TGWindow *main,const TGWindow *p,164 MMonteCarlo::MMonteCarlo(/*const TGWindow *main,*/ const TGWindow *p, 165 165 const UInt_t w, const UInt_t h) 166 : MBrowser( main,p, w, h)166 : MBrowser(/*main,*/ p, w, h) 167 167 { 168 168 AddButtons(); -
trunk/MagicSoft/Mars/mmain/MMonteCarlo.h
r1030 r1668 28 28 29 29 public: 30 MMonteCarlo( const TGWindow *main=NULL,const TGWindow *p=NULL,30 MMonteCarlo(/*const TGWindow *main=NULL,*/ const TGWindow *p=NULL, 31 31 const UInt_t w=500, const UInt_t h=500); 32 32
Note:
See TracChangeset
for help on using the changeset viewer.