Changeset 7210 for trunk/MagicSoft/Mars/mhvstime
- Timestamp:
- 07/22/05 13:18:44 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mhvstime
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.cc
r6977 r7210 38 38 // YOU HAVE TWO SEMICOLON!) 39 39 // 40 // Example: 41 // -------- 42 // // Initialize histogram 43 // MHSectorVsTime hist1; 44 // hist1.SetNameTime("MTimeCurrents"); 45 // hist1.SetTitle("Title for your Graph;;Q [phe]"); 46 // 47 // // Define sectors you want to display the mean from 48 // TArrayI s0(3); 49 // s0[0] = 6; 50 // s0[1] = 1; 51 // s0[2] = 2; 52 // 53 // // Define area index [0=inner, 1=outer] 54 // TArrayI inner(1); 55 // inner[0] = 0; 56 // 57 // // Don't call this if you want to have all sectors 58 // hist1.SetSectors(s0); 59 // 60 // // Don't call this if you want to have all area indices 61 // hist1.SetAreaIndex(inner); 62 // 63 // // Task to fill the histogram 64 // MFillH fill1(&hist1, "MCameraDC"); 65 // 66 // 40 67 ///////////////////////////////////////////////////////////////////////////// 41 68 #include "MHSectorVsTime.h" … … 93 120 void MHSectorVsTime::SetName(const char *name) 94 121 { 95 fGraph->SetName(name); 122 if (fGraph) 123 fGraph->SetName(name); 96 124 MParContainer::SetName(name); 97 125 } … … 103 131 void MHSectorVsTime::SetTitle(const char *title) 104 132 { 105 fGraph->SetTitle(title); 133 if (fGraph) 134 fGraph->SetTitle(title); 106 135 MParContainer::SetTitle(title); 107 136 } … … 160 189 fGraph->SetName(fEvt ? dynamic_cast<TObject*>(fEvt)->GetName() : "MCamEvent"); 161 190 fGraph->SetTitle(fTitle==gsDefTitle?"Camera":fTitle.Data()); 191 fGraph->SetMarkerStyle(kFullDotMedium); 162 192 163 193 fMin = FLT_MAX; … … 191 221 const Double_t val0 = fHCamera.GetMeanSectors(fSectors, fAreaIndex); 192 222 193 if (TMath::IsNaN(val0) /* || TMath::IsNaN(rms0)*/)194 return k CONTINUE;223 if (TMath::IsNaN(val0)) 224 return kTRUE; 195 225 196 226 fGraph->SetPoint(fGraph->GetN(), t, val0); … … 200 230 const Double_t rms0 = fHCamera.GetRmsSectors(fSectors, fAreaIndex); 201 231 if (TMath::IsNaN(rms0)) 202 return k CONTINUE;232 return kTRUE; 203 233 ((TGraphErrors*)fGraph)->SetPointError(fGraph->GetN()-1, 0, rms0); 204 234 } … … 221 251 fGraph->SetMaximum(fMax+add); 222 252 223 *fLog << dbg << "Min=" << fMin << " " << fMin-add << endl;224 *fLog << dbg << "Max=" << fMax << " " << fMax+add << endl;225 226 253 return kTRUE; 227 254 } … … 236 263 } 237 264 238 void MHSectorVsTime:: Draw(Option_t *opt)265 void MHSectorVsTime::Paint(Option_t *opt) 239 266 { 240 267 if (!fGraph) … … 244 271 return; 245 272 246 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);247 pad->SetBorderMode(0);248 249 AppendPad("");250 251 273 TString str(opt); 252 253 274 if (!str.Contains("A")) 254 275 str += "A"; 255 if (!str.Contains("L")) 256 str += "L"; 257 276 if (!str.Contains("P")) 277 str += "P"; 258 278 if (str.Contains("same", TString::kIgnoreCase)) 259 279 { … … 269 289 { 270 290 TAxis *axe = h->GetXaxis(); 271 axe->SetTimeFormat("%H:%M :%S%F1995-01-01 00:00:00 GMT");291 axe->SetTimeFormat("%H:%M %F1995-01-01 00:00:00 GMT"); 272 292 axe->SetTimeDisplay(1); 273 axe->SetLabelSize(0.025); 274 } 275 276 fGraph->Draw(str); 277 } 293 axe->SetLabelSize(0.033); 294 h->GetYaxis()->SetTitleOffset(1.15); 295 } 296 297 // This is a workaround if the TGraph has only one point. 298 // Otherwise MStatusDisplay::Update hangs. 299 gPad->GetListOfPrimitives()->Remove(fGraph); 300 fGraph->Draw(fGraph->GetN()<2 ? "A" : str.Data()); 301 } 302 303 // -------------------------------------------------------------------------- 304 // 305 // This displays the TGraph like you expect it to be (eg. time on the axis) 306 // It should also make sure, that the displayed time always is UTC and 307 // not local time... 308 // 309 void MHSectorVsTime::Draw(Option_t *opt) 310 { 311 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph); 312 pad->SetBorderMode(0); 313 AppendPad(opt); 314 } -
trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.h
r6977 r7210 47 47 TArrayI fAreaIndex; 48 48 49 // MH 49 50 Bool_t SetupFill(const MParList *pList); 50 51 Bool_t Fill(const MParContainer *par, const Stat_t w=1); … … 55 56 ~MHSectorVsTime(); 56 57 57 void SetName(const char *name); 58 void SetTitle(const char *title); 59 58 // Setter 60 59 void SetNameEvt(const TString name) { fNameEvt = name; } 61 60 void SetNameTime(const TString name) { fNameTime = name; } … … 64 63 void SetAreaIndex(const TArrayI &a) { fAreaIndex=a; } 65 64 65 // Getter 66 66 TH1 *GetHistByName(const TString name="") const; 67 67 //TGraph *GetGraph() { return fGraph; } 68 68 69 // TObject 70 void SetName(const char *name); 71 void SetTitle(const char *title); 72 69 73 void Draw(Option_t *o=NULL); 74 void Paint(Option_t *o=NULL); 70 75 71 76 ClassDef(MHSectorVsTime, 1) // Histogram to sum camera events -
trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc
r7033 r7210 291 291 fGraph->GetHistogram()->SetXTitle("Time"); 292 292 fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033); 293 fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M :%S%F1995-01-01 00:00:00 GMT");293 fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M %F1995-01-01 00:00:00 GMT"); 294 294 fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1); 295 295 }
Note:
See TracChangeset
for help on using the changeset viewer.