Changeset 1410 for trunk/MagicSoft/Mars
- Timestamp:
- 07/16/02 13:24:59 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/macros
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/comprob.C
r1337 r1410 25 25 \* ======================================================================== */ 26 26 27 // ------------------------------------------------------------------------- 28 // 29 // This macro demonstrates one way of gamma hadron separation using the 30 // composite probability method. To use it you need a star-file (which is 31 // a file ouput by the star.C macro containing image parameters) 32 // 27 33 void comprob() 28 34 { … … 37 43 plist.AddToList(&tlist); 38 44 39 // First task in list: read mars file45 // First task in list: read the star file (reference data) 40 46 MReadMarsFile read("Events", "star.root"); 41 47 read.DisableAutoScheme(); 42 48 tlist.AddToList(&read); 43 49 50 // 44 51 // Task to do the composite analysis of Hillas parameters: 52 // Add(rule, number of bins, lower limit, upper limit) 53 // For the meaning of the rule see MDataChain 54 // 45 55 MHCompProb compprob(500); 46 56 compprob.Add("MHillas.fWidth", 500, 0, 160); … … 59 69 MFillH fill(&compprob, "MMcEvt"); 60 70 61 // Energy filter:71 // Use this if you want to do it for a fixed energy range: 62 72 /* 63 73 MF filter("MMcEvt.fEnergy < 100"); … … 93 103 plist.Replace(&tlist2); 94 104 95 // First task in list: read mars file105 // First task in list: read star file (test data) 96 106 MReadMarsFile read2("Events", "star2.root"); 97 107 read2.DisableAutoScheme(); … … 110 120 return; 111 121 122 // 123 // Display the hadroness histograms and print some informations on 124 // the console window 125 // 112 126 plist.FindObject("MHHadroness")->DrawClone(); 113 127 plist.FindObject("MHHadroness")->Print(); -
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 } -
trunk/MagicSoft/Mars/macros/plot2.C
r1354 r1410 24 24 \* ======================================================================== */ 25 25 26 // ------------------------------------------------------------------------- 27 // 28 // plot.C 29 // 30 // This macro shows how to fill and display a 2D histogram using Mars 31 // 26 32 void plot2() 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 in a file created with star.C 50 49 MReadMarsFile read("Events", "star.root"); 51 50 read.DisableAutoScheme(); 52 51 tlist.AddToList(&read); 53 52 53 // Create a filter for the gamma events 54 54 MFParticleId fgamma("MMcEvt", '=', kGAMMA); 55 55 tlist.AddToList(&fgamma); 56 56 57 // Create a filter for the non-gamma events 57 58 MFParticleId fhadrons("MMcEvt", '!', kGAMMA); 58 59 tlist.AddToList(&fhadrons); … … 72 73 binsy.SetEdges(11, 0, 0.3); 73 74 binsx.SetEdges(11, 0, 0.6); 74 75 plist.AddToList(&binsx); 76 plist.AddToList(&binsy); 75 77 // 76 78 // ------------------------------------------------- 77 79 80 // Create two 2D histograms and add them to the list 78 81 MH3 h3g(varx, vary); 79 82 MH3 h3h(varx, vary); … … 82 85 plist.AddToList(&h3h); 83 86 84 plist.AddToList(&binsx); 85 plist.AddToList(&binsy); 86 87 // Create a task to fill one histogram with the gamma data 87 88 MFillH fillg(&h3g); 88 89 fillg.SetFilter(&fgamma); 89 90 tlist.AddToList(&fillg); 90 91 92 // Create a task to fill the other one with the non gamma data 91 93 MFillH fillh(&h3h); 92 94 fillh.SetFilter(&fhadrons); … … 107 109 tlist.PrintStatistics(); 108 110 111 // Create a default canvas 109 112 MH::MakeDefCanvas("Plot"); 113 114 // setup some style options 110 115 h3h.GetHist().SetMarkerColor(kRed); 111 116 h3h.GetHist().SetLineColor(kRed); 112 117 h3h.GetHist().SetFillStyle(4000); 118 119 // show a contour plot of both histograms 113 120 h3h.GetHist().DrawCopy("cont3"); 114 121 h3g.GetHist().DrawCopy("cont3same"); … … 116 123 return; 117 124 125 // 126 // Use this (or something similar) if you want to plot the profile 127 // histograms 128 // 118 129 TProfile *p = ((TH2&)h3g.GetHist()).ProfileX(); 119 130 p->Draw("same"); -
trunk/MagicSoft/Mars/macros/star.C
r1337 r1410 79 79 // --------------------------------- 80 80 // 81 // The first argument is the tree you want to read.82 // Events: Cosmic ray events83 // PedEvents: Pedestal Events84 // CalEvents: Calibration Events85 //86 81 MReadMarsFile read("Events"); 87 82 read.AddFile("~/data/Gamma_0_7_1011*.root");
Note:
See TracChangeset
for help on using the changeset viewer.