Changeset 4703 for trunk/MagicSoft/Mars/mhvstime
- Timestamp:
- 08/23/04 11:50:26 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mhvstime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc
r3858 r4703 18 18 ! Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 320 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! … … 27 27 // MHVsTime 28 28 // 29 // Preliminary: the docu may be wrong! 29 // Use this class if you want to display any rule vs time (or event number) 30 // 31 // eg. 32 // MHVsTime hist("MHillas.fAlpha"); 33 // MHVsTime hist("MPointintPos.GetAbsErr"); 34 // MHVsTime hist("MPointintPos.GetAbsErr*kRad2Deg"); 35 // 36 // To set a maximum number of data-points (eg. to display the last 20min 37 // only) call SetMaxPts(200) 38 // 39 // SetMaxPts(-1) disables this feature. 30 40 // 31 41 ///////////////////////////////////////////////////////////////////////////// … … 58 68 // -------------------------------------------------------------------------- 59 69 // 60 // Default constructor. 70 // Default constructor. For more informations about a valid rule 71 // see MDataChain. 61 72 // 62 73 MHVsTime::MHVsTime(const char *rule) 63 : fGraph(NULL), fData(NULL), fScale(1), f UseEventNumber(0)74 : fGraph(NULL), fData(NULL), fScale(1), fMaxPts(-1), fUseEventNumber(0) 64 75 { 65 76 fName = gsDefName; … … 98 109 // -------------------------------------------------------------------------- 99 110 // 100 // Setup the Binning for the histograms automatically if the correct 101 // instances of MBinning are found in the parameter list 102 // For a more detailed description see class description above. 111 // PreProcess the MDataChain. Create a new TGraph. Delete an old one if 112 // already allocated. 103 113 // 104 114 Bool_t MHVsTime::SetupFill(const MParList *plist) … … 127 137 // -------------------------------------------------------------------------- 128 138 // 129 // Set the name of the histogram antthe MHVsTime container139 // Set the name of the TGraph and the MHVsTime container 130 140 // 131 141 void MHVsTime::SetName(const char *name) … … 137 147 // -------------------------------------------------------------------------- 138 148 // 139 // Set the title of the histogram antthe MHVsTime container149 // Set the title of the TGraph and the MHVsTime container 140 150 // 141 151 void MHVsTime::SetTitle(const char *title) … … 147 157 // -------------------------------------------------------------------------- 148 158 // 149 // Fills the one, two or three data members into our histogram159 // Set the next data point. If the graph exceeds fMaxPts remove the first 150 160 // 151 161 Bool_t MHVsTime::Fill(const MParContainer *par, const Stat_t w) … … 165 175 return kFALSE; 166 176 } 177 // If the time is not valid skip this entry 167 178 if (!*tm) 168 179 return kTRUE; … … 172 183 const Double_t v = fData->GetValue()*fScale; 173 184 185 if (fMaxPts>0 && fGraph->GetN()>fMaxPts) 186 fGraph->RemovePoint(0); 187 174 188 fGraph->SetPoint(fGraph->GetN(), t, v); 175 189 … … 179 193 // -------------------------------------------------------------------------- 180 194 // 181 // Creates a new canvas and draws the histogram into it. 182 // 183 // Possible options are: 184 // PROFX: Draw a x-profile into the histogram (for 2D histograms only) 185 // PROFY: Draw a y-profile into the histogram (for 2D histograms only) 186 // ONLY: Draw the profile histogram only (for 2D histograms only) 187 // 188 // If the kIsLog?-Bit is set the axis is displayed lkogarithmically. 189 // eg this is set when applying a logarithmic MBinning 190 // 191 // Be careful: The histogram belongs to this object and won't get deleted 192 // together with the canvas. 195 // This displays the TGraph like you expect it to be (eg. time on the axis) 196 // It should also make sure, that the displayed time always is UTC and 197 // not local time... 193 198 // 194 199 void MHVsTime::Draw(Option_t *opt) … … 245 250 if (fUseEventNumber) 246 251 h->SetUseEventNumber(); 252 h->SetMaxPts(fMaxPts); 247 253 return h; 248 254 } -
trunk/MagicSoft/Mars/mhvstime/MHVsTime.h
r3394 r4703 14 14 // Could be const but root < 3.02/06 doesn't like this... 15 15 TGraph *fGraph; // Histogram to fill 16 MDataChain *fData; // Object from which the data is filled 17 Double_t fScale; // Scale for axis (eg unit) 16 MDataChain *fData; // Object from which the data is filled 17 Double_t fScale; // Scale for axis (eg unit) 18 Int_t fMaxPts; // Maximum number of data points 18 19 19 20 enum { 20 kIsLogy = BIT(18),21 kIsLogy = BIT(18), 21 22 kUseEventNumber = BIT(20) 22 23 }; … … 42 43 43 44 /* 44 //const TH1 *GetHist() const;45 //TH1 *GetHist();46 //TH1 *GetHistByName(const TString name="");47 */45 const TH1 *GetHist() const; 46 TH1 *GetHist(); 47 TH1 *GetHistByName(const TString name=""); 48 */ 48 49 const TGraph *GetGraph() const { return fGraph; } 49 50 TGraph *GetGraph() { return fGraph; } … … 55 56 MParContainer *New() const; 56 57 58 void SetMaxPts(Int_t n) { fMaxPts=n; } 59 57 60 ClassDef(MHVsTime, 1) // Generalized 1/2/3D-histogram for Mars variables 58 61 };
Note:
See TracChangeset
for help on using the changeset viewer.