Changeset 1867 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 03/25/03 13:30:32 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHStarMap.cc
r1715 r1867 152 152 const float delta = h.GetDelta(); 153 153 154 const float m = tan(delta); 154 const float m = tan(delta); 155 const float cosd = 1.0/sqrt(1.0+m*m); 156 const float sind = sqrt(1.0-cosd*cosd); 157 155 158 156 159 float t = h.GetMeanY() - m*h.GetMeanX(); … … 159 162 t *= fMm2Deg; 160 163 164 // get step size ds along the main axis of the ellipse 165 TAxis &axe = *fStarMap->GetXaxis(); 166 const int N = axe.GetNbins(); 167 const float xmin = axe.GetBinLowEdge(1); 168 const float xmax = axe.GetBinLowEdge(N+1); 169 const float ds = (xmax-xmin) / 200.0; 170 161 171 if (m>-1 && m<1) 162 172 { 163 TAxis &axe = *fStarMap->GetXaxis(); 164 165 const int N = axe.GetXbins()->GetSize(); 166 for (int i=0; i<N; i++) 173 float dx = ds * cosd; 174 float x = xmin + dx/2.0; 175 int N1 = (int) ((xmax-xmin)/dx+1.0); 176 177 for (int i=0; i<N1; i++) 167 178 { 168 const float x = axe.GetBinCenter(i);169 179 const float y = m*x+t; 170 171 180 fStarMap->Fill(x, y); 181 x += dx; 172 182 } 173 183 } … … 175 185 { 176 186 TAxis &axe = *fStarMap->GetYaxis(); 177 178 const int N = axe.GetXbins()->GetSize(); 179 for (int i=0; i<N; i++) 187 const int M = axe.GetNbins(); 188 const float ymin = axe.GetBinLowEdge(1); 189 const float ymax = axe.GetBinLowEdge(M+1); 190 191 float dy = ds * sind; 192 float y = ymin + dy/2.0; 193 int M1 = (int) ((ymax-ymin)/dy+1.0); 194 195 for (int i=0; i<M1; i++) 180 196 { 181 const float y = axe.GetBinCenter(i);182 197 const float x = (y-t)/m; 183 184 198 fStarMap->Fill(x, y); 199 y += dy; 185 200 } 186 201 }
Note:
See TracChangeset
for help on using the changeset viewer.