Changeset 4891 for trunk/MagicSoft/Mars/mhvstime
- Timestamp:
- 09/09/04 10:51:39 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mhvstime
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhvstime/MHPixVsTime.cc
r4889 r4891 18 18 ! Author(s): Thomas Bretz, 12/2002 <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 ! … … 28 28 // 29 29 // Display the pixel content versus time or event number 30 // 31 // Axis titles 32 // =========== 33 // 34 // 1) If no other title is given the rule for the y-axis is used. 35 // 2) If the MH3 has a non-default title (MH3::SetTitle called) 36 // this title is set as the histogram title. It can be used to overwrite 37 // the axis titles. For more information see TH1::SetTitle, eg. 38 // SetTitle("MyGraph;;Counts"); 39 // The title for the x-axis is ignored and set automatically (MAKE SURE 40 // YOU HAVE TWO SEMICOLON!) 30 41 // 31 42 ///////////////////////////////////////////////////////////////////////////// … … 48 59 49 60 using namespace std; 61 62 const TString MHPixVsTime::gsDefName = "MHPixVsTime"; 63 const TString MHPixVsTime::gsDefTitle = "Graph of pixel content vs. time"; 50 64 51 65 // -------------------------------------------------------------------------- … … 59 73 // set the name and title of this object 60 74 // 61 fName = name ? name : "MHPixVsTime";62 fTitle = title ? title : "Average of MPixVsTimes";75 fName = name ? name : gsDefName.Data(); 76 fTitle = title ? title : gsDefTitle.Data(); 63 77 64 78 TString t("Pixel Index #"); … … 77 91 MHPixVsTime::~MHPixVsTime() 78 92 { 79 if(fGraph) 80 delete fGraph; 93 if (fGraph) 94 delete fGraph; 95 } 96 97 // -------------------------------------------------------------------------- 98 // 99 // Set the name of the TGraph and the MHPixVsTime container 100 // 101 void MHPixVsTime::SetName(const char *name) 102 { 103 fGraph->SetName(name); 104 MParContainer::SetName(name); 105 } 106 107 // -------------------------------------------------------------------------- 108 // 109 // Set the title of the TGraph and the MHPixVsTime container 110 // 111 void MHPixVsTime::SetTitle(const char *title) 112 { 113 fGraph->SetTitle(title); 114 MParContainer::SetTitle(title); 81 115 } 82 116 … … 124 158 } 125 159 160 if (fTitle!=gsDefTitle) 161 fGraph->SetTitle(fTitle); 162 126 163 return kTRUE; 127 164 } … … 190 227 191 228 h->SetXTitle("Time"); 192 h->SetYTitle("");193 229 if (!fNameTime.IsNull()) 194 230 { -
trunk/MagicSoft/Mars/mhvstime/MHPixVsTime.h
r3394 r4891 20 20 { 21 21 private: 22 static const TString gsDefName; 23 static const TString gsDefTitle; 24 22 25 TGraphErrors *fGraph; 23 26 Int_t fIndex; … … 46 49 void SetType(Int_t type, Int_t e=-1) { fType = type; fTypeErr=e; } 47 50 51 void SetName(const char *name); 52 void SetTitle(const char *title); 53 48 54 TH1 *GetHistByName(const TString name=""); 49 55 TGraph *GetGraph() { return fGraph; } -
trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.cc
r4889 r4891 30 30 // single sector 31 31 // 32 // 1) If no other title is given the rule for the y-axis is used. 33 // 2) If the MH3 has a non-default title (MH3::SetTitle called) 34 // this title is set as the histogram title. It can be used to overwrite 35 // the axis titles. For more information see TH1::SetTitle, eg. 36 // SetTitle("MyGraph;;Counts"); 37 // The title for the x-axis is ignored and set automatically (MAKE SURE 38 // YOU HAVE TWO SEMICOLON!) 39 // 32 40 ///////////////////////////////////////////////////////////////////////////// 33 41 #include "MHSectorVsTime.h" … … 50 58 51 59 using namespace std; 60 61 const TString MHSectorVsTime::gsDefName = "MSectorHVsTime"; 62 const TString MHSectorVsTime::gsDefTitle = "Graph of sector mean vs. time"; 52 63 53 64 // -------------------------------------------------------------------------- … … 62 73 // set the name and title of this object 63 74 // 64 fName = name ? name : "MHSectorVsTime";65 fTitle = title ? title : "Sector mean vs time";75 fName = name ? name : gsDefName.Data(); 76 fTitle = title ? title : gsDefTitle.Data(); 66 77 } 67 78 … … 75 86 delete fGraph; 76 87 } 88 89 // -------------------------------------------------------------------------- 90 // 91 // Set the name of the TGraph and the MHVsTime container 92 // 93 void MHSectorVsTime::SetName(const char *name) 94 { 95 fGraph->SetName(name); 96 MParContainer::SetName(name); 97 } 98 99 // -------------------------------------------------------------------------- 100 // 101 // Set the title of the TGraph and the MHVsTime container 102 // 103 void MHSectorVsTime::SetTitle(const char *title) 104 { 105 fGraph->SetTitle(title); 106 MParContainer::SetTitle(title); 107 } 108 77 109 78 110 // -------------------------------------------------------------------------- … … 127 159 fGraph = fTypeErr<0 ? new TGraph : new TGraphErrors; 128 160 fGraph->SetName(fEvt ? dynamic_cast<TObject*>(fEvt)->GetName() : "MCamEvent"); 129 fGraph->SetTitle( "Camera");161 fGraph->SetTitle(fTitle==gsDefTitle?"Camera":fTitle); 130 162 131 163 fMin = FLT_MAX; … … 206 238 void MHSectorVsTime::Draw(Option_t *opt) 207 239 { 208 /* 240 if (!fGraph) 241 return; 242 209 243 if (fGraph->GetN()==0) 210 244 return; 211 */212 213 if (fGraph->GetN()==0)214 return;215 245 216 246 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this); … … 220 250 221 251 TString str(opt); 222 /* 223 fGraph->GetHistogram()->SetXTitle("Time"); 224 fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S %F1995-01-01 00:00:00"); 225 fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1); 226 fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033); 227 228 fGraph->GetHistogram()->SetYTitle(""); 229 */ 252 230 253 if (!str.Contains("A")) 231 254 str += "A"; … … 242 265 243 266 h->SetXTitle("Time"); 244 h->SetYTitle("");245 267 246 268 if (!fNameTime.IsNull()) … … 252 274 } 253 275 254 *fLog << dbg << "Draw: " << str << endl;255 276 fGraph->Draw(str); 256 /* 257 str.ReplaceAll("same", ""); 258 str.ReplaceAll("A", ""); 259 260 Int_t i=-1; 261 Int_t col=kRed; 262 while ((g=(TGraphErrors*)Next())) 263 { 264 i++; 265 *fLog << dbg << "Check" << i << ": " << str << endl; 266 267 while ((fMinSector>=0 && i<fMinSector) || (fMaxSector>=0 && i>fMaxSector)) 268 i++; 269 270 h = g->GetHistogram(); 271 g->SetLineColor(col++); 272 273 *fLog << dbg << "Draw" << i << ": " << g->GetTitle() << endl; 274 g->Draw(str); 275 276 } 277 278 pad->Modified(); 279 pad->Update();*/ 280 } 277 } -
trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.h
r3394 r4891 20 20 class MHSectorVsTime : public MH 21 21 { 22 private: 23 static const TString gsDefName; 24 static const TString gsDefTitle; 25 22 26 private: 23 27 TGraph *fGraph; … … 51 55 ~MHSectorVsTime(); 52 56 57 void SetName(const char *name); 58 void SetTitle(const char *title); 59 53 60 void SetNameEvt(const TString name) { fNameEvt = name; } 54 61 void SetNameTime(const TString name) { fNameTime = name; } -
trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc
r4889 r4891 29 29 // Use this class if you want to display any rule vs time (or event number) 30 30 // 31 // Axis titles 32 // =========== 33 // 34 // 1) If no other title is given the rule for the y-axis is used. 35 // 2) If the MH3 has a non-default title (MH3::SetTitle called) 36 // this title is set as the histogram title. It can be used to overwrite 37 // the axis titles. For more information see TH1::SetTitle, eg. 38 // SetTitle("MyGraph;;Counts"); 39 // The title for the x-axis is ignored and set automatically (MAKE SURE 40 // YOU HAVE TWO SEMICOLON!) 41 // 31 42 // eg. 32 43 // MHVsTime hist("MHillas.fAlpha"); … … 63 74 using namespace std; 64 75 65 static const TStringgsDefName = "MHVsTime";66 static const TStringgsDefTitle = "Container for a graph vs time/evtnumber";76 const TString MHVsTime::gsDefName = "MHVsTime"; 77 const TString MHVsTime::gsDefTitle = "Container for a graph vs time/evtnumber"; 67 78 68 79 // -------------------------------------------------------------------------- … … 89 100 fGraph->SetPoint(0, 0, 0); // Dummy point! 90 101 fGraph->SetEditable(); // Used as flag: First point? yes/no 102 fGraph->SetMarkerStyle(kFullDotMedium); 91 103 } 92 104 … … 137 149 fGraph->SetEditable(); // Used as flag: First point? yes/no 138 150 139 TString title(fData ? GetRule() : (TString)"Histogram"); 151 152 TString title(fData ? GetRule() : (TString)"Graph"); 140 153 title += " vs "; 141 154 title += fUseEventNumber ? "Event Number" : "Time"; 142 155 143 fGraph->SetNameTitle(fName, title);156 fGraph->SetNameTitle(fName, fTitle==gsDefTitle?title:fTitle); 144 157 145 158 fMean = 0; … … 245 258 } 246 259 247 fGraph->GetHistogram()->SetMarkerStyle(kFullDotMedium);248 fGraph->GetHistogram()->SetYTitle(fAxisTitle.IsNull() ? GetRule() : fAxisTitle);249 if (fTitle!=gsDefTitle)250 fGraph->GetHistogram()->SetTitle(fTitle);251 252 260 if (TestBit(kIsLogy)) 253 261 gPad->SetLogy(); -
trunk/MagicSoft/Mars/mhvstime/MHVsTime.h
r4889 r4891 15 15 class MHVsTime : public MH 16 16 { 17 private: 18 static const TString gsDefName; 19 static const TString gsDefTitle; 20 17 21 protected: 18 22 // Could be const but root < 3.02/06 doesn't like this... … … 29 33 Int_t fN; //! Number of entries in fMean 30 34 MTime fLast; //! For checks 31 32 TString fAxisTitle;33 35 34 36 enum { … … 50 52 51 53 void SetLogy(Bool_t b=kTRUE) { b ? SetBit(kIsLogy) : ResetBit(kIsLogy); } 52 void SetAxisTitle(const char *y) { fAxisTitle=y; }53 54 54 55 Bool_t SetupFill(const MParList *pList);
Note:
See TracChangeset
for help on using the changeset viewer.