Changeset 8478 for trunk/MagicSoft/Mars/mhvstime
- Timestamp:
- 05/09/07 13:15:53 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/mhvstime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc
r8082 r8478 18 18 ! Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 420 ! Copyright: MAGIC Software Development, 2000-2007 21 21 ! 22 22 ! … … 58 58 // - MDataChain *fError; // Object from which the error is filled 59 59 // 60 // Class Version 3: 61 // ---------------- 62 // + Double_t fMinimum; // User defined minimum 63 // + Double_t fMaximum; // User defined maximum 64 // 60 65 ///////////////////////////////////////////////////////////////////////////// 61 66 #include "MHVsTime.h" … … 92 97 MHVsTime::MHVsTime(const char *rule, const char *error) 93 98 : fGraph(NULL), fData(NULL), fError(NULL), fScale(1), fMaxPts(-1), 94 fNumEvents(1), f UseEventNumber(0)99 fNumEvents(1), fMinimum(-1111), fMaximum(-1111), fUseEventNumber(0) 95 100 { 96 101 fName = gsDefName; … … 129 134 // -------------------------------------------------------------------------- 130 135 // 131 // Call SetMinimum of fGraph132 //133 void MHVsTime::SetMinimum(Double_t min)134 {135 if (fGraph)136 fGraph->SetMinimum(min);137 }138 139 // --------------------------------------------------------------------------140 //141 136 // Return the data members used by the data chain to be used in 142 137 // MTask::AddBranchToList … … 178 173 fMean = 0; 179 174 fN = 0; 175 176 fMin = FLT_MAX; 177 fMax = -FLT_MAX; 180 178 181 179 return kTRUE; … … 252 250 } 253 251 254 fGraph->SetPoint(fGraph->GetN(), t, fMean/fN*fScale); 252 const Double_t val = fMean/fN*fScale; 253 254 fGraph->SetPoint(fGraph->GetN(), t, val); 255 255 256 256 if (fError) 257 257 static_cast<TGraphErrors*>(fGraph)->SetPointError(fGraph->GetN()-1, 0, fMeanErr/fN*fScale); 258 259 fMin = TMath::Min(fMin, val); 260 fMax = TMath::Max(fMax, val); 258 261 259 262 fMean = 0; … … 265 268 } 266 269 270 // -------------------------------------------------------------------------- 271 // 272 // Set Minimum and Maximum; 273 Bool_t MHVsTime::Finalize() 274 { 275 const Double_t add = (fMax-fMin)*0.15; 276 277 if (fMinimum==-1111) 278 fGraph->SetMinimum(fMin-add); 279 if (fMaximum==-1111) 280 fGraph->SetMaximum(fMax+add); 281 282 return kTRUE; 283 } 284 267 285 void MHVsTime::Paint(Option_t *opt) 268 286 { 269 /*270 *fLog << all << fGraph << " " << gPad->GetName() << " ----> Paint " << opt << endl;271 TListIter Next(gPad->GetListOfPrimitives()); TObject *obj;272 while ((obj=Next())) *fLog << obj << " " << obj->GetName() << " " << obj->ClassName() << " " << Next.GetOption() << endl;273 */274 287 if (!fGraph) 275 288 return; 276 277 // *fLog << all << fGraph->GetN() << " " << opt << endl;278 289 279 290 if (fGraph->GetN()==0) … … 318 329 gPad->SetLogy(); 319 330 331 // If this is set to early the plot remains empty in root 5.12/00 332 if (fMinimum!=-1111) 333 fGraph->SetMinimum(fMinimum); 334 if (fMaximum!=-1111) 335 fGraph->SetMaximum(fMaximum); 336 337 320 338 // This is a workaround if the TGraph has only one point. 321 339 // Otherwise MStatusDisplay::Update hangs. 322 // gPad->GetListOfPrimitives()->Remove(fGraph); 323 // fGraph->Draw(fGraph->GetN()<2 ? "A" : str.Data()); 324 //gPad->GetListOfPrimitives()->Add(fGraph, fGraph->GetN()<2 ? "A" : opt); 325 // AppendPad(str); 326 // fGraph->Draw(str); 327 340 gPad->GetListOfPrimitives()->Remove(fGraph); 341 fGraph->Draw(fGraph->GetN()<2 ? "A" : str.Data()); 328 342 } 329 343 … … 339 353 pad->SetBorderMode(0); 340 354 AppendPad(opt); 341 342 fGraph->Draw("A");343 355 } 344 356 -
trunk/MagicSoft/Mars/mhvstime/MHVsTime.h
r8082 r8478 34 34 MTime fLast; //! For checks 35 35 36 Double_t fMinimum; // User defined minimum 37 Double_t fMaximum; // User defined maximum 38 39 Double_t fMin; //! Calculation of minimum 40 Double_t fMax; //! Calculation of maximum 41 36 42 enum { 37 43 kIsLogy = BIT(18) … … 40 46 Bool_t fUseEventNumber; 41 47 48 Bool_t Finalize(); 49 42 50 public: 43 51 MHVsTime(const char *rule=NULL, const char *ruleerr=NULL); … … 45 53 46 54 void SetScale(Double_t scale) { fScale = scale; } 47 void SetMinimum(Double_t min=-1111); 55 56 void SetMinimum(Double_t min=-1111) { fMinimum = min; } 57 void SetMaximum(Double_t max=-1111) { fMaximum = max; } 48 58 49 59 Int_t GetNbins() const; … … 78 88 void SetMaxPts(Int_t n) { fMaxPts=n; } 79 89 80 ClassDef(MHVsTime, 2) // Generalized 1/2/3D-histogram for Mars variables90 ClassDef(MHVsTime, 3) // Generalized 1/2/3D-histogram for Mars variables 81 91 }; 82 92
Note:
See TracChangeset
for help on using the changeset viewer.