Changeset 12880
- Timestamp:
- 02/09/12 11:04:57 (13 years ago)
- Location:
- trunk/Mars/mhvstime
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mhvstime/MHPixVsTime.cc
r9153 r12880 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz, 12/2002 <mailto:t bretz@astro.uni-wuerzburg.de>19 ! 20 ! Copyright: MAGIC Software Development, 2000-20 0418 ! Author(s): Thomas Bretz, 12/2002 <mailto:thomas.bretz@epfl.ch> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2012 21 21 ! 22 22 ! … … 214 214 void MHPixVsTime::Draw(Option_t *opt) 215 215 { 216 217 if (fGraph->GetN()==0)218 return;219 220 216 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); 221 217 pad->SetBorderMode(0); 218 pad->SetGrid(); 222 219 223 220 AppendPad(""); 224 225 TString str(opt);226 221 227 222 // This is not done automatically anymore since root 5.12/00 228 223 // and it is necessary to force a proper update of the axis. 229 224 TH1 *h = fGraph->GetHistogram(); 230 if (h)231 {232 delete h;233 fGraph->SetHistogram(0);234 h = fGraph->GetHistogram();235 }236 225 237 226 h->SetXTitle("Time"); 227 238 228 if (!fNameTime.IsNull()) 239 229 { … … 244 234 } 245 235 246 236 TString str(opt); 247 237 if (!str.Contains("A")) 248 238 str += "A"; … … 257 247 258 248 fGraph->Draw(str); 259 260 pad->Modified(); 261 pad->Update(); 262 } 249 } -
trunk/Mars/mhvstime/MHPixVsTime.h
r9153 r12880 61 61 62 62 #endif 63 64 65 -
trunk/Mars/mhvstime/MHSectorVsTime.cc
r10166 r12880 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz, 3/2004 <mailto:t bretz@astro.uni-wuerzburg.de>19 ! 20 ! Copyright: MAGIC Software Development, 2000-20 0618 ! Author(s): Thomas Bretz, 3/2004 <mailto:thomas.bretz@epfl.ch> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2012 21 21 ! 22 22 ! … … 282 282 } 283 283 284 void MHSectorVsTime::Paint(Option_t *opt) 285 { 286 if (!fGraph) 287 return; 288 289 if (fGraph->GetN()==0) 290 return; 284 // -------------------------------------------------------------------------- 285 // 286 // This displays the TGraph like you expect it to be (eg. time on the axis) 287 // It should also make sure, that the displayed time always is UTC and 288 // not local time... 289 // 290 void MHSectorVsTime::Draw(Option_t *opt) 291 { 292 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph); 293 pad->SetBorderMode(0); 294 pad->SetGrid(); 295 296 AppendPad(""); 297 298 // This is not done automatically anymore since root 5.12/00 299 // and it is necessary to force a proper update of the axis. 300 TH1 *h = fGraph->GetHistogram(); 301 302 h->SetXTitle("Time"); 303 304 if (!fNameTime.IsNull()) 305 { 306 TAxis *axe = h->GetXaxis(); 307 axe->SetTimeFormat("%H:%M %F1995-01-01 00:00:00 GMT"); 308 axe->SetTimeDisplay(1); 309 axe->SetLabelSize(0.033); 310 h->GetYaxis()->SetTitleOffset(1.15); 311 } 312 313 // If this is set to early the plot remains empty in root 5.12/00 314 if (fMinimum!=-1111) 315 fGraph->SetMinimum(fMinimum); 316 if (fMaximum!=-1111) 317 fGraph->SetMaximum(fMaximum); 291 318 292 319 TString str(opt); … … 301 328 } 302 329 303 // This is not done automatically anymore since root 5.12/00 304 // and it is necessary to force a proper update of the axis. 305 TH1 *h = fGraph->GetHistogram(); 306 if (h) 307 { 308 delete h; 309 fGraph->SetHistogram(0); 310 h = fGraph->GetHistogram(); 311 } 312 313 h->SetXTitle("Time"); 314 315 if (!fNameTime.IsNull()) 316 { 317 TAxis *axe = h->GetXaxis(); 318 axe->SetTimeFormat("%H:%M %F1995-01-01 00:00:00 GMT"); 319 axe->SetTimeDisplay(1); 320 axe->SetLabelSize(0.033); 321 h->GetYaxis()->SetTitleOffset(1.15); 322 } 323 324 // If this is set to early the plot remains empty in root 5.12/00 325 if (fMinimum!=-1111) 326 fGraph->SetMinimum(fMinimum); 327 if (fMaximum!=-1111) 328 fGraph->SetMaximum(fMaximum); 329 330 // This is a workaround if the TGraph has only one point. 331 // Otherwise MStatusDisplay::Update hangs. 332 gPad->GetListOfPrimitives()->Remove(fGraph); 333 fGraph->Draw(fGraph->GetN()<2 ? "A" : str.Data()); 334 } 335 336 // -------------------------------------------------------------------------- 337 // 338 // This displays the TGraph like you expect it to be (eg. time on the axis) 339 // It should also make sure, that the displayed time always is UTC and 340 // not local time... 341 // 342 void MHSectorVsTime::Draw(Option_t *opt) 343 { 344 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph); 345 pad->SetBorderMode(0); 346 pad->SetGridx(); 347 pad->SetGridy(); 348 AppendPad(opt); 330 fGraph->Draw(str.Data()); 349 331 } 350 332 -
trunk/Mars/mhvstime/MHSectorVsTime.h
r9303 r12880 85 85 86 86 void Draw(Option_t *o=NULL); 87 void Paint(Option_t *o=NULL);88 87 89 88 void RecursiveRemove(TObject *obj); -
trunk/Mars/mhvstime/MHVsTime.cc
r9369 r12880 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz, 11/2003 <mailto:t bretz@astro.uni-wuerzburg.de>19 ! 20 ! Copyright: MAGIC Software Development, 2000-20 0718 ! Author(s): Thomas Bretz, 11/2003 <mailto:thomas.bretz@epfl.ch> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2012 21 21 ! 22 22 ! … … 112 112 113 113 fGraph = error ? new TGraphErrors : new TGraph; 114 fGraph->SetPoint(0, 0, 0); // Dummy point!115 fGraph->SetEditable(); // Used as flag: First point? yes/no116 114 fGraph->SetMarkerStyle(kFullDotMedium); 117 115 } … … 161 159 if (fError && !fError->PreProcess(plist)) 162 160 return kFALSE; 163 164 fGraph->Set(1);165 fGraph->SetPoint(0, 0, 0); // Dummy point!166 fGraph->SetEditable(); // Used as flag: First point? yes/no167 161 168 162 TString title(fData ? GetRule() : (TString)"Graph"); … … 245 239 if (fN==fNumEvents) 246 240 { 241 /* 247 242 if ((fMaxPts>0 && fGraph->GetN()>fMaxPts) || fGraph->IsEditable()) 248 243 { 249 244 fGraph->RemovePoint(0); 250 245 fGraph->SetEditable(kFALSE); 251 } 246 }*/ 252 247 253 248 const Double_t val = fMean/fN*fScale; … … 284 279 } 285 280 286 void MHVsTime::Paint(Option_t *opt) 287 { 288 if (!fGraph) 289 return; 290 291 if (fGraph->GetN()==0) 292 return; 293 294 TString str(opt); 295 if (!str.Contains("A")) 296 str += "A"; 297 if (!str.Contains("P")) 298 str += "P"; 299 if (str.Contains("same", TString::kIgnoreCase)) 300 { 301 str.ReplaceAll("same", ""); 302 str.ReplaceAll("A", ""); 303 } 281 // -------------------------------------------------------------------------- 282 // 283 // This displays the TGraph like you expect it to be (eg. time on the axis) 284 // It should also make sure, that the displayed time always is UTC and 285 // not local time... 286 // 287 void MHVsTime::Draw(Option_t *opt) 288 { 289 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph); 290 pad->SetBorderMode(0); 291 pad->SetGrid(); 292 293 AppendPad(""); 304 294 305 295 // This is not done automatically anymore since root 5.12/00 306 296 // and it is necessary to force a proper update of the axis. 307 297 TH1 *h = fGraph->GetHistogram(); 308 if (h) 309 { 310 delete h; 311 fGraph->SetHistogram(0); 312 h = fGraph->GetHistogram(); 313 } 298 314 299 if (h) 315 300 { … … 336 321 fGraph->SetMaximum(fMaximum); 337 322 338 339 // This is a workaround if the TGraph has only one point. 340 // Otherwise MStatusDisplay::Update hangs. 341 gPad->GetListOfPrimitives()->Remove(fGraph); 342 fGraph->Draw(fGraph->GetN()<2 ? "A" : str.Data()); 343 } 344 345 // -------------------------------------------------------------------------- 346 // 347 // This displays the TGraph like you expect it to be (eg. time on the axis) 348 // It should also make sure, that the displayed time always is UTC and 349 // not local time... 350 // 351 void MHVsTime::Draw(Option_t *opt) 352 { 353 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph); 354 pad->SetBorderMode(0); 355 AppendPad(opt); 323 TString str(opt); 324 if (!str.Contains("A")) 325 str += "A"; 326 if (!str.Contains("P")) 327 str += "P"; 328 if (str.Contains("same", TString::kIgnoreCase)) 329 { 330 str.ReplaceAll("same", ""); 331 str.ReplaceAll("A", ""); 332 } 333 334 fGraph->Draw(str.Data()); 356 335 } 357 336 -
trunk/Mars/mhvstime/MHVsTime.h
r9153 r12880 82 82 83 83 void Draw(Option_t *opt=NULL); 84 void Paint(Option_t *opt=NULL);85 84 86 85 MParContainer *New() const;
Note:
See TracChangeset
for help on using the changeset viewer.