Changeset 1410 for trunk/MagicSoft/Mars/macros/plot.C
- Timestamp:
- 07/16/02 13:24:59 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/plot.C
r1353 r1410 24 24 \* ======================================================================== */ 25 25 26 // ------------------------------------------------------------------------- 27 // 28 // plot.C 29 // 30 // This macro shows how to fill and display a histogram using Mars 31 // 26 32 void plot() 27 33 { 28 //29 // This is a demonstration program which calculates the Hillas30 // parameter out of a Magic root file.31 32 34 // 33 35 // Create a empty Parameter List and an empty Task List … … 43 45 // --------------------------------- 44 46 // 45 // The first argument is the tree you want to read. 46 // Events: Cosmic ray events 47 // PedEvents: Pedestal Events 48 // CalEvents: Calibration Events 49 // 47 48 // First Task: Read file with image parameters 49 // (created with the star.C macro) 50 50 MReadMarsFile read("Events", "star.root"); 51 51 read.DisableAutoScheme(); 52 52 tlist.AddToList(&read); 53 53 54 // Create a filter for Gammas 54 55 MFParticleId fgamma("MMcEvt", '=', kGAMMA); 55 56 tlist.AddToList(&fgamma); 56 57 58 // Create a filter for Non-Gammas 57 59 MFParticleId fhadrons("MMcEvt", '!', kGAMMA); 58 60 tlist.AddToList(&fhadrons); … … 66 68 MBinning bins("BinningMH3X"); 67 69 bins.SetEdgesLog(50, 100, 20000); 70 plist.AddToList(&bins); 68 71 // 69 // ------------------------------------------------- 72 // ------------------------------------------------------- 70 73 74 // Create a histogram for the data from gammas and from non-gammas 71 75 MH3 h3g(var); 72 76 MH3 h3h(var); 73 77 78 // Add the histograms to the parameter container list 74 79 plist.AddToList(&h3g); 75 80 plist.AddToList(&h3h); 76 81 77 plist.AddToList(&bins); 78 82 // Create a task which fills one histogram with the gamma-data 79 83 MFillH fillg(&h3g); 80 84 fillg.SetFilter(&fgamma); 81 85 tlist.AddToList(&fillg); 82 86 87 // Create a task which fills the other histogram with the non-gamma-data 83 88 MFillH fillh(&h3h); 84 89 fillh.SetFilter(&fhadrons); … … 99 104 tlist.PrintStatistics(); 100 105 106 // Create a default canvas called Plot and set the 107 // x-axis to logarithmic scale 101 108 MH::MakeDefCanvas("Plot"); 109 gPad->SetLogx(); 110 111 // Setup some style options of the two histograms 112 // and draw a copy of both 102 113 h3h.GetHist().SetLineColor(kRed); 103 114 h3h.GetHist().SetFillStyle(4000); … … 105 116 h3h.GetHist().DrawCopy("same"); 106 117 118 // Now create a new histogram, fill it with the division of the 119 // two histograms and draw also a copy of it 107 120 TH1D h; 108 121 MH::SetBinning(&h, &bins); … … 111 124 h.SetFillStyle(4000); 112 125 h.DrawCopy("same"); 113 114 gPad->SetLogx();115 126 }
Note:
See TracChangeset
for help on using the changeset viewer.