Changeset 14705
- Timestamp:
- 11/27/12 10:33:18 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/makeplots.cc
r14450 r14705 54 54 ("date-time", var<string>(), "SQL time (UTC)") 55 55 ("source-database", var<string>(""), "Database link as in\n\tuser:password@server[:port]/database.") 56 ("max-current", var<double>(75), "Maximum current to display in other plots.") 57 ("max-zd", var<double>(75), "Maximum zenith distance to display in other plots") 58 ("no-limits", po_switch(), "Switch off limits in plots") 56 59 ; 57 60 … … 102 105 time.SetFromStr(conf.Get<string>("date-time")); 103 106 107 const double max_current = conf.Get<double>("max-current"); 108 const double max_zd = conf.Get<double>("max-zd"); 109 const double no_limits = conf.Get<bool>("no-limits"); 110 104 111 ln_rst_time sun_astronomical; 105 112 ln_get_solar_rst_horizon(time.JD(), &observer, -12, &sun_astronomical); … … 140 147 hframe.SetStats(kFALSE); 141 148 hframe.GetXaxis()->SetTimeFormat("%Hh%M'"); 142 hframe.GetXaxis()->SetTitle("Time ");149 hframe.GetXaxis()->SetTitle("Time [UTC]"); 143 150 hframe.GetXaxis()->CenterTitle(); 144 151 hframe.GetYaxis()->CenterTitle(); 145 152 hframe.GetXaxis()->SetTimeDisplay(true); 146 hframe.GetXaxis()->SetLabelSize(0.025); 153 hframe.GetYaxis()->SetTitleSize(0.040); 154 hframe.GetXaxis()->SetTitleSize(0.040); 155 hframe.GetXaxis()->SetTitleOffset(1.1); 156 hframe.GetYaxis()->SetLabelSize(0.040); 157 hframe.GetXaxis()->SetLabelSize(0.040); 147 158 148 159 TCanvas c1; 160 gPad->SetLeftMargin(0.085); 149 161 gPad->SetRightMargin(0.01); 150 162 gPad->SetTopMargin(0.03); … … 156 168 157 169 TCanvas c2; 170 gPad->SetLeftMargin(0.085); 158 171 gPad->SetRightMargin(0.01); 159 172 gPad->SetTopMargin(0.03); … … 164 177 hframe.DrawCopy(); 165 178 179 TCanvas c3; 180 gPad->SetLeftMargin(0.085); 181 gPad->SetRightMargin(0.01); 182 gPad->SetTopMargin(0.03); 183 gPad->SetGrid(); 184 gPad->SetLogy(); 185 hframe.GetYaxis()->SetTitle("Estimated relative threshold"); 186 hframe.SetMinimum(0.9); 187 hframe.SetMaximum(180); 188 hframe.DrawCopy(); 189 166 190 Int_t color[] = { kBlack, kRed, kBlue, kGreen, kCyan, kMagenta }; 167 191 Int_t style[] = { kSolid, kDashed, kDotted }; … … 182 206 183 207 // Create graphs 184 TGraph g1, g2 ;208 TGraph g1, g2, g3; 185 209 g1.SetName(name.data()); 186 210 g2.SetName(name.data()); 211 g3.SetName(name.data()); 187 212 g1.SetLineWidth(2); 188 213 g2.SetLineWidth(2); 214 g3.SetLineWidth(2); 189 215 g1.SetLineStyle(style[cnt/6]); 190 216 g2.SetLineStyle(style[cnt/6]); 217 g3.SetLineStyle(style[cnt/6]); 191 218 g1.SetLineColor(color[cnt%6]); 192 219 g2.SetLineColor(color[cnt%6]); 220 g3.SetLineColor(color[cnt%6]); 193 221 194 222 // Loop over 24 hours … … 204 232 ln_get_hrz_from_equ(&pos, &observer, jd+h, &hrz); 205 233 206 // Check if source is visible 207 if (hrz.alt<15) 208 continue; 209 210 // Add point to curve 211 const double axis = (mjd+h)*24*3600; 212 g1.SetPoint(g1.GetN(), axis, hrz.alt); 213 214 // Get moon properties and estimate current 234 // Get moon properties and 215 235 ln_equ_posn moon = fMoonCoords[i].first; 216 236 const double disk = fMoonCoords[i].second; 217 237 218 ln_get_hrz_from_equ(&moon, &observer, jd+h, &hrz); 219 238 ln_hrz_posn hrzm; 239 ln_get_hrz_from_equ(&moon, &observer, jd+h, &hrzm); 240 241 // Distance between source and moon 220 242 const double angle = Angle(moon.ra, moon.dec, pos.ra, pos.dec); 221 243 222 const double lc = angle*hrz.alt*pow(disk, 6)/360/360; 223 224 // Add point to curve 225 g2.SetPoint(g2.GetN(), axis, lc>0 ? 7.7+4942*lc : 7.7); 244 // Current prediction 245 const double lc = angle*hrzm.alt*pow(disk, 6)/360/360; 246 const double cur = lc>0 ? 7.7+4942*lc : 7.7; 247 248 // Relative energy threshold prediction 249 const double cs = cos((90+hrz.alt)*M_PI/180); 250 const double ratio = (10.*sqrt(409600.*cs*cs+9009.) + 6400.*cs - 60.)/10.; 251 252 // Add points to curve 253 const double axis = (mjd+h)*24*3600; 254 255 // If there is a gap of more than one bin, start a new curve 256 if (g1.GetN()>0 && axis-g1.GetX()[g1.GetN()-1]>450) 257 { 258 c1.cd(); 259 ((TGraph*)g1.DrawClone("C"))->SetBit(kCanDelete); 260 while (g1.GetN()) 261 g1.RemovePoint(0); 262 } 263 264 if (g2.GetN()>0 && axis-g2.GetX()[g2.GetN()-1]>450) 265 { 266 c2.cd(); 267 ((TGraph*)g2.DrawClone("C"))->SetBit(kCanDelete); 268 while (g2.GetN()) 269 g2.RemovePoint(0); 270 } 271 272 if (g3.GetN()>0 && axis-g3.GetX()[g3.GetN()-1]>450) 273 { 274 c3.cd(); 275 ((TGraph*)g3.DrawClone("C"))->SetBit(kCanDelete); 276 while (g3.GetN()) 277 g3.RemovePoint(0); 278 } 279 280 // Add data 281 if (no_limits || cur<max_current) 282 g1.SetPoint(g1.GetN(), axis, hrz.alt); 283 284 if (no_limits || 90-hrz.alt<max_zd) 285 g2.SetPoint(g2.GetN(), axis, cur); 286 287 if (no_limits || (cur<max_current && 90-hrz.alt<max_zd)) 288 g3.SetPoint(g3.GetN(), axis, ratio*cur/7.7); 226 289 } 227 290 … … 237 300 g->SetBit(kCanDelete); 238 301 302 c3.cd(); 303 g = (TGraph*)g3.DrawClone("C"); 304 g->SetBit(kCanDelete); 305 239 306 leg.AddEntry(g, name.data(), "l"); 240 307 } 241 308 242 309 // Save three plots 243 TCanvas c 3;310 TCanvas c4; 244 311 leg.Draw(); 245 312 246 313 c1.SaveAs("test1.eps"); 247 314 c2.SaveAs("test2.eps"); 248 c3.SaveAs("legend.eps"); 315 c3.SaveAs("test3.eps"); 316 c4.SaveAs("legend.eps"); 249 317 250 318 c1.SaveAs("test1.root"); 251 319 c2.SaveAs("test2.root"); 320 c3.SaveAs("test3.root"); 252 321 253 322 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.