Changeset 1295 for trunk/MagicSoft/Mars/mhist/MHTimeDiffTime.cc
- Timestamp:
- 04/24/02 14:10:54 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHTimeDiffTime.cc
r1265 r1295 28 28 // MHTimeDiffTime // 29 29 // // 30 // calculates the 2D-histogram time-difference vs. time // 31 // // 30 32 // // 31 33 ////////////////////////////////////////////////////////////////////////////// … … 48 50 // -------------------------------------------------------------------------- 49 51 // 50 // Default Constructor. It sets name and title only. Typically you won't 51 // need to change this. 52 // Default Constructor. It sets name and title of the histogram 52 53 // 53 54 MHTimeDiffTime::MHTimeDiffTime(const char *name, const char *title) … … 62 63 fHist.SetDirectory(NULL); 63 64 64 fHist. GetXaxis()->SetTitle("\\Delta t [s]");65 fHist. GetYaxis()->SetTitle("t [s]");65 fHist.SetXTitle("\\Delta t [s]"); 66 fHist.SetYTitle("t [s]"); 66 67 } 67 68 69 // -------------------------------------------------------------------------- 70 // 71 // Set the binnings and prepare the filling of the histogram 72 // 68 73 Bool_t MHTimeDiffTime::SetupFill(const MParList *plist) 69 74 { 70 fTime = (MTime*)plist->FindObject("MTime");71 if (!fTime)72 {73 *fLog << err << dbginf << "MTime not found... aborting." << endl;74 return kFALSE;75 }75 fTime = (MTime*)plist->FindObject("MTime"); 76 if (!fTime) 77 { 78 *fLog << err << dbginf << "MTime not found... aborting." << endl; 79 return kFALSE; 80 } 76 81 77 const MBinning* binsdtime = (MBinning*)plist->FindObject("BinningTimeDiff");78 const MBinning* binstime = (MBinning*)plist->FindObject("BinningTime");79 if (!binstime || !binsdtime)80 {81 *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;82 return kFALSE;83 }82 const MBinning* binsdtime = (MBinning*)plist->FindObject("BinningTimeDiff"); 83 const MBinning* binstime = (MBinning*)plist->FindObject("BinningTime"); 84 if (!binstime || !binsdtime) 85 { 86 *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl; 87 return kFALSE; 88 } 84 89 85 SetBinning(&fHist, binsdtime, binstime);90 SetBinning(&fHist, binsdtime, binstime); 86 91 87 return kTRUE;92 return kTRUE; 88 93 } 89 94 95 // -------------------------------------------------------------------------- 96 // 97 // Draw a copy of the histogram 98 // 90 99 TObject *MHTimeDiffTime::DrawClone(Option_t *opt) const 91 100 { 92 TCanvas *c = MakeDefCanvas("DiffTimeTime", "Distrib of dt, t"); 93 c->Divide(2, 2); 101 102 TCanvas &c = *MakeDefCanvas("DiffTimeTime", "Distrib of \\Delta t, time"); 103 104 c.Divide(2, 2); 94 105 95 106 gROOT->SetSelectedPad(NULL); 96 107 97 //98 // FIXME: ProjectionX,Y is not const within root99 //100 108 TH1D *h; 101 109 102 c->cd(1); 103 h = ((TH2*)&fHist)->ProjectionX("ProX", -1, 9999, "E"); 110 c.cd(1); 111 h = ((TH2*)&fHist)->ProjectionX("ProjX-sumtime", -1, 9999, "E"); 112 113 h->SetTitle("Distribution of \\Delta t [s]"); 114 h->SetXTitle("\\Delta t [s]"); 115 h->SetYTitle("Counts"); 116 104 117 h->Draw(opt); 105 118 h->SetBit(kCanDelete); 106 119 gPad->SetLogy(); 107 120 108 c->cd(2); 109 h = ((TH2*)&fHist)->ProjectionY("ProY", -1, 9999, "E"); 121 c.cd(2); 122 h = ((TH2*)&fHist)->ProjectionY("ProjY-sumtimediff", -1, 9999, "E"); 123 124 h->SetTitle("Distribution of time [s]"); 125 h->SetXTitle("time [s]"); 126 h->SetYTitle("Counts"); 127 110 128 h->Draw(opt); 111 129 h->SetBit(kCanDelete); 112 130 113 c ->cd(3);131 c.cd(3); 114 132 ((TH2*)&fHist)->DrawCopy(opt); 115 133 116 c ->Modified();117 c ->Update();134 c.Modified(); 135 c.Update(); 118 136 119 return c;137 return &c; 120 138 } 121 139 140 // -------------------------------------------------------------------------- 141 // 142 // Draw the histogram 143 // 122 144 void MHTimeDiffTime::Draw(Option_t *opt) 123 145 { 124 146 if (!gPad) 125 MakeDefCanvas("DiffTimeTime", "Distrib of dt, t");147 MakeDefCanvas("DiffTimeTime", "Distrib of \\Delta t, time"); 126 148 127 149 gPad->Divide(2,2); … … 130 152 131 153 gPad->cd(1); 132 h = fHist.ProjectionX("ProX", -1, 9999, "E"); 154 h = fHist.ProjectionX("ProjX_sumtime", -1, 9999, "E"); 155 156 h->SetTitle("Distribution of \\Delta t [s]"); 157 h->SetXTitle("\\Delta t [s]"); 158 h->SetYTitle("Counts"); 159 133 160 h->Draw(opt); 134 161 h->SetBit(kCanDelete); … … 136 163 137 164 gPad->cd(2); 138 h = fHist.ProjectionY("ProY", -1, 9999, "E"); 165 h = fHist.ProjectionY("ProjY_sumtimediff", -1, 9999, "E"); 166 167 h->SetTitle("Distribution of time [s]"); 168 h->SetXTitle("time [s]"); 169 h->SetYTitle("Counts"); 170 139 171 h->Draw(opt); 140 172 h->SetBit(kCanDelete); … … 145 177 gPad->Modified(); 146 178 gPad->Update(); 179 147 180 } 148 181 182 // -------------------------------------------------------------------------- 183 // 184 // Fill the histogram 185 // 149 186 Bool_t MHTimeDiffTime::Fill(const MParContainer *par) 150 187 { … … 158 195 } 159 196 197 198 199
Note:
See TracChangeset
for help on using the changeset viewer.