Changeset 1215 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 01/23/02 19:37:56 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MBinning.h
r1205 r1215 20 20 void SetEdges(const TArrayD &arr) 21 21 { 22 fEdges = arr;/* 22 23 const Int_t nbins = arr.GetSize(); 23 24 fEdges.Set(nbins); 24 for (int i=0; i< =nbins; i++)25 fEdges[i] = (*(TArrayD*)(&arr))[i]; 25 for (int i=0; i<nbins; i++) 26 fEdges[i] = (*(TArrayD*)(&arr))[i];*/ 26 27 } 27 28 -
trunk/MagicSoft/Mars/mhist/MH.cc
r1211 r1215 197 197 void MH::SetBinning(TH1 *h, const TAxis *binsx) 198 198 { 199 MBinning bx; 200 bx.SetEdges(*((TAxis*)binsx)->GetXbins()); // FIXME: Root! 199 const Int_t nx = binsx->GetNbins(); 200 201 TArrayD bx(nx+1); 202 for (int i=0; i<nx; i++) bx[i] = binsx->GetBinLowEdge(i+1); 203 bx[nx] = binsx->GetXmax(); 204 201 205 SetBinning(h, &bx); 202 206 } … … 204 208 void MH::SetBinning(TH1 *h, const TAxis *binsx, const TAxis *binsy) 205 209 { 206 MBinning bx; 207 MBinning by; 208 bx.SetEdges(*((TAxis*)binsx)->GetXbins()); // FIXME: Root! 209 by.SetEdges(*((TAxis*)binsy)->GetXbins()); // FIXME: Root! 210 const Int_t nx = binsx->GetNbins(); 211 const Int_t ny = binsy->GetNbins(); 212 213 TArrayD bx(nx+1); 214 TArrayD by(ny+1); 215 for (int i=0; i<nx; i++) bx[i] = binsx->GetBinLowEdge(i+1); 216 for (int i=0; i<ny; i++) by[i] = binsy->GetBinLowEdge(i+1); 217 bx[nx] = binsx->GetXmax(); 218 by[ny] = binsy->GetXmax(); 219 210 220 SetBinning(h, &bx, &by); 211 221 } … … 213 223 void MH::SetBinning(TH1 *h, const TAxis *binsx, const TAxis *binsy, const TAxis *binsz) 214 224 { 215 MBinning bx; 216 MBinning by; 217 MBinning bz; 218 bx.SetEdges(*((TAxis*)binsx)->GetXbins()); // FIXME: Root! 219 by.SetEdges(*((TAxis*)binsy)->GetXbins()); // FIXME: Root! 220 bz.SetEdges(*((TAxis*)binsz)->GetXbins()); // FIXME: Root! 225 const Int_t nx = binsx->GetNbins(); 226 const Int_t ny = binsy->GetNbins(); 227 const Int_t nz = binsz->GetNbins(); 228 229 TArrayD bx(nx+1); 230 TArrayD by(ny+1); 231 TArrayD bz(nz+1); 232 for (int i=0; i<nx; i++) bx[i] = binsx->GetBinLowEdge(i+1); 233 for (int i=0; i<ny; i++) by[i] = binsy->GetBinLowEdge(i+1); 234 for (int i=0; i<nz; i++) bz[i] = binsz->GetBinLowEdge(i+1); 235 bx[nx] = binsx->GetXmax(); 236 by[ny] = binsy->GetXmax(); 237 bz[nz] = binsz->GetXmax(); 238 221 239 SetBinning(h, &bx, &by, &bz); 222 240 } -
trunk/MagicSoft/Mars/mhist/MHAlphaEnergyTheta.cc
r1211 r1215 102 102 103 103 fHist.Fill(hil.GetAlpha(), fEnergy->GetEnergy(), fMcEvt->GetTheta()*kRad2Deg); 104 104 105 return kTRUE; 105 106 } … … 108 109 { 109 110 if (!gPad) 110 MakeDefCanvas("AlphaEnergyTheta", "Distrib of \\alpha, E, \\Theta");111 MakeDefCanvas("AlphaEnergyTheta", "Distrib of alpha, E, Theta"); 111 112 112 113 gPad->Divide(2,2); 113 114 115 TH1 *h; 116 114 117 gPad->cd(1); 115 fHist.Project3D("x")->Draw(opt); 118 h = fHist.Project3D("x"); 119 h->Draw(opt); 120 h->SetBit(kCanDelete); 116 121 117 122 gPad->cd(2); 118 fHist.Project3D("y")->Draw(opt); 123 h = fHist.Project3D("y"); 124 h->Draw(opt); 125 h->SetBit(kCanDelete); 119 126 120 127 gPad->cd(3); 121 fHist.Project3D("z")->Draw(opt); 128 h = fHist.Project3D("z"); 129 h->Draw(opt); 130 h->SetBit(kCanDelete); 122 131 123 132 gPad->cd(4); … … 130 139 TObject *MHAlphaEnergyTheta::DrawClone(Option_t *opt) const 131 140 { 132 TCanvas *c = MakeDefCanvas(" DiffTimeTheta", "Distrib of \\Delta t, \\Theta");141 TCanvas *c = MakeDefCanvas("AlphaEnergyTheta", "Distrib of alpha, E, Theta"); 133 142 c->Divide(2, 2); 134 143 … … 138 147 // FIXME: ProjectionX,Y is not const within root 139 148 // 149 TH1 *h; 150 140 151 c->cd(1); 141 ((TH3*)(&fHist))->Project3D("x")->DrawCopy(opt); 152 h = ((TH3*)(&fHist))->Project3D("x"); 153 h->Draw(opt); 154 h->SetBit(kCanDelete); 142 155 143 156 c->cd(2); 144 ((TH3*)(&fHist))->Project3D("y")->DrawCopy(opt); 157 h = ((TH3*)(&fHist))->Project3D("y"); 158 h->Draw(opt); 159 h->SetBit(kCanDelete); 145 160 146 161 c->cd(3); 147 ((TH3*)(&fHist))->Project3D("z")->DrawCopy(opt); 162 h = ((TH3*)(&fHist))->Project3D("z"); 163 h->Draw(opt); 164 h->SetBit(kCanDelete); 148 165 149 166 c->cd(4); … … 158 175 void MHAlphaEnergyTheta::Substract(const TH3D *h1, const TH3D *h2) 159 176 { 160 MH::SetBinning(&fHist, h1);177 MH::SetBinning(&fHist, (TH1*)h1); 161 178 162 179 fHist.Sumw2(); -
trunk/MagicSoft/Mars/mhist/MHAlphaEnergyTime.cc
r1211 r1215 113 113 { 114 114 if (!gPad) 115 MakeDefCanvas("AlphaEnergyTime", "Distrib of \\alpha, E, t");115 MakeDefCanvas("AlphaEnergyTime", "Distrib of alpha, E, t"); 116 116 117 117 gPad->Divide(2,2); 118 118 119 TH1 *h; 120 119 121 gPad->cd(1); 120 fHist.Project3D("x")->Draw(opt); 122 h = fHist.Project3D("x"); 123 h->Draw(opt); 124 h->SetBit(kCanDelete); 121 125 122 126 gPad->cd(2); 123 fHist.Project3D("y")->Draw(opt); 127 h = fHist.Project3D("y"); 128 h->Draw(opt); 129 h->SetBit(kCanDelete); 124 130 125 131 gPad->cd(3); 126 fHist.Project3D("z")->Draw(opt); 132 h = fHist.Project3D("z"); 133 h->Draw(opt); 134 h->SetBit(kCanDelete); 127 135 128 136 gPad->cd(4); … … 135 143 TObject *MHAlphaEnergyTime::DrawClone(Option_t *opt) const 136 144 { 137 TCanvas *c = MakeDefCanvas(" DiffTimeTheta", "Distrib of \\Delta t, t");145 TCanvas *c = MakeDefCanvas("AlphaEnergyTime", "Distrib of alpha, E, t"); 138 146 c->Divide(2, 2); 139 147 … … 143 151 // FIXME: ProjectionX,Y is not const within root 144 152 // 153 TH1 *h; 154 145 155 c->cd(1); 146 ((TH3D*)(&fHist))->Project3D("x")->DrawCopy(opt); 156 h = ((TH3D*)(&fHist))->Project3D("x"); 157 h->Draw(opt); 158 h->SetBit(kCanDelete); 147 159 148 160 c->cd(2); 149 ((TH3D*)(&fHist))->Project3D("y")->DrawCopy(opt); 161 h = ((TH3D*)(&fHist))->Project3D("y"); 162 h->Draw(opt); 163 h->SetBit(kCanDelete); 150 164 151 165 c->cd(3); 152 ((TH3D*)(&fHist))->Project3D("z")->DrawCopy(opt); 166 h = ((TH3D*)(&fHist))->Project3D("z"); 167 h->Draw(opt); 168 h->SetBit(kCanDelete); 153 169 154 170 c->cd(4); … … 163 179 void MHAlphaEnergyTime::Substract(const TH3D *h1, const TH3D *h2) 164 180 { 165 MH::SetBinning(&fHist, h1);181 MH::SetBinning(&fHist, (TH1*)h1); 166 182 167 183 fHist.Sumw2(); -
trunk/MagicSoft/Mars/mhist/MHEffOnTimeTheta.cc
r1213 r1215 81 81 //new TCanvas(txt, "Title"); 82 82 83 TH1D *h =hist->ProjectionX("dTime-Distribution for fixed Time", i, i);83 TH1D &h = *hist->ProjectionX("dTime-Distribution for fixed Time", i, i); 84 84 85 85 //hist->Draw(); 86 86 //gPad->SetLogy(); 87 87 88 Double_t Nmdel = h ->Integral("width");89 Double_t mean = h ->GetMean();88 Double_t Nmdel = h.Integral("width"); 89 Double_t mean = h.GetMean(); 90 90 91 91 TF1 func("Poisson", "[1] * [0] * exp(-[0] *x)", … … 101 101 func.SetParName(1, "Nmdel"); 102 102 103 h ->Fit("Poisson", "RN");103 h.Fit("Poisson", "RN"); 104 104 105 105 //func.SetRange(0, 0.1); // Range of Drawing … … 113 113 //cout << "t_eff = " << h->Integral()/lambda << " T(last)=" << time.GetTimeLo()*0.0001 << endl; 114 114 115 fHist.SetBinContent(i, h->Integral()/lambda); 115 fHist.SetBinContent(i, h.Integral()/lambda); 116 117 delete &h; 116 118 } 117 119 } … … 133 135 TObject *MHEffOnTimeTheta::DrawClone(Option_t *opt) const 134 136 { 135 TCanvas *c = MakeDefCanvas("EffOnTimeTheta", "t_ {eff} vs. \\Theta");137 TCanvas *c = MakeDefCanvas("EffOnTimeTheta", "t_eff vs. Theta"); 136 138 137 139 gROOT->SetSelectedPad(NULL); … … 148 150 { 149 151 if (!gPad) 150 MakeDefCanvas("EffOnTimeTheta", "t_ {eff} vs. \\Theta");152 MakeDefCanvas("EffOnTimeTheta", "t_eff vs. Theta"); 151 153 152 154 fHist.Draw(opt); -
trunk/MagicSoft/Mars/mhist/MHEffOnTimeTime.cc
r1213 r1215 26 26 ////////////////////////////////////////////////////////////////////////////// 27 27 // // 28 // MHEffOnTimeTime //28 // MHEffOnTimeTime // 29 29 // // 30 30 // // … … 63 63 64 64 fHist.SetName("EffOn"); 65 fHist.SetTitle("Effective On Time Vs. T heta");65 fHist.SetTitle("Effective On Time Vs. Time"); 66 66 67 67 … … 74 74 TObject *MHEffOnTimeTime::DrawClone(Option_t *opt) const 75 75 { 76 TCanvas *c = MakeDefCanvas("EffOnTimeTheta", "t_ {eff}vs. t");76 TCanvas *c = MakeDefCanvas("EffOnTimeTheta", "t_eff vs. t"); 77 77 78 78 gROOT->SetSelectedPad(NULL); … … 89 89 { 90 90 if (!gPad) 91 MakeDefCanvas("EffOnTimeTheta", "t_ {eff}vs. t");91 MakeDefCanvas("EffOnTimeTheta", "t_eff vs. t"); 92 92 93 93 fHist.Draw(opt); … … 108 108 //new TCanvas(txt, "Title"); 109 109 110 TH1D *h =hist->ProjectionX("dTime-Distribution for fixed Theta", i, i);110 TH1D &h = *hist->ProjectionX("dTime-Distribution for fixed Theta", i, i); 111 111 112 112 //hist->Draw(); 113 113 //gPad->SetLogy(); 114 114 115 Double_t Nmdel = h ->Integral("width");116 Double_t mean = h ->GetMean();115 Double_t Nmdel = h.Integral("width"); 116 Double_t mean = h.GetMean(); 117 117 118 118 TF1 func("Poisson", "[1] * [0] * exp(-[0] *x)", … … 128 128 func.SetParName(1, "Nmdel"); 129 129 130 h ->Fit("Poisson", "RN");130 h.Fit("Poisson", "RN"); 131 131 132 132 //func.SetRange(0, 0.1); // Range of Drawing … … 140 140 //cout << "t_eff = " << h->Integral()/lambda << " T(last)=" << time.GetTimeLo()*0.0001 << endl; 141 141 142 fHist.SetBinContent(i, h->Integral()/lambda); 142 fHist.SetBinContent(i, h.Integral()/lambda); 143 144 delete &h; 143 145 } 144 146 } -
trunk/MagicSoft/Mars/mhist/MHTimeDiffTheta.cc
r1214 r1215 26 26 ////////////////////////////////////////////////////////////////////////////// 27 27 // // 28 // MHTimeDiffTheta //28 // MHTimeDiffTheta // 29 29 // // 30 30 // // … … 98 98 TObject *MHTimeDiffTheta::DrawClone(Option_t *opt) const 99 99 { 100 TCanvas *c = MakeDefCanvas("DiffTimeTheta", "Distrib \\Delta t, \\Theta");100 TCanvas *c = MakeDefCanvas("DiffTimeTheta", "Distrib of Delta t, Theta"); 101 101 c->Divide(2, 2); 102 102 … … 106 106 // FIXME: ProjectionX,Y is not const within root 107 107 // 108 TH1 *h; 109 108 110 c->cd(1); 109 ((TH2*)&fHist)->ProjectionX("ProX", -1, 9999, "E")->DrawCopy(opt); 111 h = ((TH2*)&fHist)->ProjectionX("ProX", -1, 9999, "E"); 112 h->DrawCopy(opt); 113 delete h; 110 114 gPad->SetLogy(); 111 115 112 116 c->cd(2); 113 ((TH2*)&fHist)->ProjectionY("ProY", -1, 9999, "E")->DrawCopy(opt); 117 h = ((TH2*)&fHist)->ProjectionY("ProY", -1, 9999, "E"); 118 h->DrawCopy(opt); 119 delete h; 114 120 115 121 c->cd(3); … … 125 131 { 126 132 if (!gPad) 127 MakeDefCanvas("DiffTimeTheta", "Distrib \\Delta t, \\Theta");133 MakeDefCanvas("DiffTimeTheta", "Distrib of Delta t, Theta"); 128 134 129 135 TH1 *h; -
trunk/MagicSoft/Mars/mhist/MHTimeDiffTime.cc
r1214 r1215 26 26 ////////////////////////////////////////////////////////////////////////////// 27 27 // // 28 // MHTimeDiffTime //28 // MHTimeDiffTime // 29 29 // // 30 30 // // … … 98 98 // FIXME: ProjectionX,Y is not const within root 99 99 // 100 TH1 *h; 101 100 102 c->cd(1); 101 ((TH2*)&fHist)->ProjectionX("ProX", -1, 9999, "E")->DrawCopy(opt); 103 h = ((TH2*)&fHist)->ProjectionX("ProX", -1, 9999, "E"); 104 h->Draw(opt); 105 h->SetBit(kCanDelete); 102 106 gPad->SetLogy(); 103 107 104 108 c->cd(2); 105 ((TH2*)&fHist)->ProjectionY("ProY", -1, 9999, "E")->DrawCopy(opt); 109 h = ((TH2*)&fHist)->ProjectionY("ProY", -1, 9999, "E"); 110 h->Draw(opt); 111 h->SetBit(kCanDelete); 106 112 107 113 c->cd(3); … … 121 127 gPad->Divide(2,2); 122 128 129 TH1 *h; 130 123 131 gPad->cd(1); 124 fHist.ProjectionX("ProX", -1, 9999, "E")->DrawCopy(opt); 132 h = fHist.ProjectionX("ProX", -1, 9999, "E"); 133 h->Draw(opt); 134 h->SetBit(kCanDelete); 125 135 gPad->SetLogy(); 126 136 127 137 gPad->cd(2); 128 fHist.ProjectionY("ProY", -1, 9999, "E")->DrawCopy(opt); 138 h = fHist.ProjectionY("ProY", -1, 9999, "E"); 139 h->Draw(opt); 140 h->SetBit(kCanDelete); 129 141 130 142 gPad->cd(3);
Note:
See TracChangeset
for help on using the changeset viewer.