Changeset 717 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 04/03/01 13:28:36 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHStarMap.cc
r712 r717 11 11 #include "MHStarMap.h" 12 12 13 #include <TH2.h> 14 #include <TStyle.h> 15 #include <TCanvas.h> 13 #include <TH2.h> // TH2F 14 #include <TStyle.h> // gStyle 15 #include <TColor.h> // SetRGB 16 #include <TCanvas.h> // TCanvas 16 17 17 18 #include "MHillas.h" … … 39 40 // 40 41 fStarMap = new TH2F("Star Map", "Counts", 41 50, -300, 300,42 50, -300, 300);42 150, -300, 300, 43 150, -300, 300); 43 44 } 44 45 … … 50 51 void MHStarMap::Draw(Option_t *) 51 52 { 53 // 54 // Creates a new canvas, creates a useful palette and 55 // draws the histogram in the new created canvas 56 // 57 52 58 TCanvas *c = new TCanvas("Star Map", "Star Map created from Hillas Parameters", 500, 500); 53 59 54 gStyle->SetPalette(1, 0); 60 // 61 // Set the palette you wanna use: 62 // - you could set the root "Pretty Palette Violet->Red" by 63 // gStyle->SetPalette(1, 0), but in some cases this may look 64 // confusing 65 // - The maximum colors root allowes us to set by ourself 66 // is 50 (idx: 51-100). This colors are set to a grayscaled 67 // palette 68 // - the number of contours must be two less than the number 69 // of palette entries 70 // 71 72 const Int_t numg = 32; // number of gray scaled colors 73 const Int_t numw = 32; // number of white 74 75 Int_t palette[numg+numw]; 76 77 // 78 // The first half of the colors are white. 79 // This is some kind of optical background supression 80 // 81 gROOT->GetColor(51)->SetRGB(1, 1, 1); 82 83 Int_t i; 84 for (i=0; i<numw; i++) 85 palette[i] = 51; 86 87 // 88 // now the (gray) scaled part is coming 89 // 90 for (;i<numw+numg; i++) 91 { 92 const Float_t gray = 1.0-(float)(i-numw)/(numg-1.0); 93 94 gROOT->GetColor(52+i)->SetRGB(gray, gray, gray); 95 palette[i] = 52+i; 96 } 97 98 // 99 // Set the palette and the number of contour levels 100 // 101 gStyle->SetPalette(numg+numw, palette); 102 fStarMap->SetContour(numg+numw-2); 103 104 // gStyle->SetPalette(1, 0); 55 105 fStarMap->Draw("colz"); 56 106 … … 68 118 const float t = dist*(sin(theta)-cos(theta)*m); 69 119 70 float y0 = -m*300+t;71 for (int i=-297; i<300; i+=3)72 {73 const float y1 = m*i+t;120 if (m>-1 && m<1) 121 for (int x=-298; x<298; x+=4) 122 { 123 const float y = m*x+t; 74 124 75 // if (y1<=y0-3 || y1>=y0+3) 76 // continue; 125 fStarMap->Fill(x, y); 126 } 127 else 128 for (int y=-298; y<298; y+=4) 129 { 130 const float x = (y-t)/m; 77 131 78 fStarMap->Fill(i, y1); 79 y0 = y1; 80 } 132 fStarMap->Fill(x, y); 133 } 81 134 } 82 135
Note:
See TracChangeset
for help on using the changeset viewer.