Changeset 7252 for trunk/MagicSoft/Mars/mmuon
- Timestamp:
- 08/02/05 13:41:41 (19 years ago)
- Location:
- trunk/MagicSoft/Mars/mmuon
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mmuon/MHMuonPar.cc
r7068 r7252 65 65 using namespace std; 66 66 67 const Float_t MHMuonPar::fgIntegralLoLim = 0.7; 68 const Float_t MHMuonPar::fgIntegralUpLim = 1.2; 69 67 70 // -------------------------------------------------------------------------- 68 71 // … … 79 82 fHistRadius.SetXTitle("R [\\circ]"); 80 83 fHistRadius.SetYTitle("Counts"); 84 fHistRadius.GetXaxis()->SetTitleOffset(1.2); 81 85 fHistRadius.SetDirectory(NULL); 82 86 fHistRadius.UseCurrentStyle(); … … 86 90 fHistArcWidth.SetTitle("Distribution of ArcWidth"); 87 91 fHistArcWidth.SetXTitle("W [\\circ]"); 92 fHistArcWidth.GetXaxis()->SetTitleOffset(1.2); 88 93 fHistArcWidth.SetYTitle("Counts"); 89 94 fHistArcWidth.SetDirectory(NULL); … … 95 100 fHistBroad.SetXTitle("R [\\circ]"); 96 101 fHistBroad.SetYTitle("W/R [1]"); 102 fHistBroad.GetXaxis()->SetTitleOffset(1.2); 97 103 fHistBroad.SetDirectory(NULL); 98 104 fHistBroad.UseCurrentStyle(); … … 103 109 fHistSize.SetXTitle("R [\\circ]"); 104 110 fHistSize.SetYTitle("S [phe]"); 111 fHistSize.GetXaxis()->SetTitleOffset(1.2); 105 112 fHistSize.SetDirectory(NULL); 106 113 fHistSize.UseCurrentStyle(); … … 204 211 fHistSize.Draw(); 205 212 206 AppendPad("pad3"); 207 208 pad->cd(4); 209 gPad->SetBorderMode(0); 210 fHistBroad.Draw(); 211 212 TF1 ref("RefShape", "0.112*x*x - 0.413*x + 0.404", 0.7, 1.2); 213 TText txt; 214 txt.SetTextColor(kBlue); 215 216 TF1 ref("RefShape100%", "573*x + 430", fgIntegralLoLim, fgIntegralUpLim); 213 217 ref.SetLineColor(kBlue); 214 218 ref.SetLineWidth(1); 215 219 ref.SetLineStyle(kDashed); 216 ref.DrawCopy("same"); 220 gROOT->GetListOfFunctions()->Remove(ref.DrawCopy("same")); 221 222 txt.SetTextAlign(31); 223 txt.DrawText(fgIntegralLoLim, ref.Eval(fgIntegralLoLim+0.05), "100%"); 224 225 AppendPad("pad3"); 226 227 pad->cd(4); 228 gPad->SetBorderMode(0); 229 fHistBroad.Draw(); 230 231 ref.SetName("RefShape12mm"); 232 ref.Compile("0.0766*x*x - 0.250*x + 0.239"); 233 gROOT->GetListOfFunctions()->Remove(ref.DrawCopy("same")); 234 235 txt.SetTextAlign(11); 236 txt.DrawText(fgIntegralLoLim, ref.Eval(fgIntegralLoLim-0.05), "12mm"); 217 237 218 238 AppendPad("pad4"); 219 239 } 220 240 241 Double_t MHMuonPar::Integral(const TProfile &p, Int_t a, Int_t b) const 242 { 243 Float_t numerator = 0; 244 Float_t denominator = 0; 245 246 for (Int_t i=a; i<b; i++) 247 { 248 numerator += p.GetBinContent(i)*p.GetBinEntries(i); 249 denominator += p.GetBinEntries(i); 250 } 251 252 return denominator==0 ? 0 : numerator/denominator; 253 } 254 255 Double_t MHMuonPar::Integral(const TProfile &p, Float_t a, Float_t b) const 256 { 257 const Int_t bin1 = p.GetXaxis()->FindFixBin(a); 258 const Int_t bin2 = p.GetXaxis()->FindFixBin(b); 259 260 return Integral(p, bin1, bin2); 261 } 262 221 263 void MHMuonPar::Paint(Option_t *opt) 222 264 { 223 265 if (TString(opt)==TString("pad4")) 224 266 { 225 const Double_t lolim = 0.7; 226 const Double_t uplim = 1.2; 227 228 const Int_t bin1 = fHistBroad.GetXaxis()->FindFixBin(lolim); 229 const Int_t bin2 = fHistBroad.GetXaxis()->FindFixBin(uplim); 230 231 const TString txt = Form("\\Sigma_{%.2f\\circ}^{%.2f\\circ} = %.3f", lolim, 232 uplim, fHistBroad.Integral(bin1, bin2)); 267 const TString txt = Form("\\Sigma_{%.2f\\circ}^{%.2f\\circ} = %.3f", 268 fgIntegralLoLim, fgIntegralUpLim, Integral(fHistBroad)); 233 269 234 270 TLatex text(0.57, 0.93, txt); … … 240 276 if (TString(opt)==TString("pad3")) 241 277 { 242 const Double_t lolim = 0.7; 243 const Double_t uplim = 1.2; 244 245 const Int_t bin1 = fHistSize.GetXaxis()->FindFixBin(lolim); 246 const Int_t bin2 = fHistSize.GetXaxis()->FindFixBin(uplim); 247 248 const TString txt = Form("\\Sigma_{%.2f\\circ}^{%.2f\\circ} = %.f", lolim, 249 uplim, fHistSize.Integral(bin1, bin2)); 278 const TString txt = Form("\\Sigma_{%.2f\\circ}^{%.2f\\circ} = %.f", 279 fgIntegralLoLim, fgIntegralUpLim, Integral(fHistSize)); 250 280 251 281 TLatex text(0.47, 0.93, txt); -
trunk/MagicSoft/Mars/mmuon/MHMuonPar.h
r7015 r7252 19 19 { 20 20 private: 21 TH1F fHistRadius; // Radius 22 TH1F fHistArcWidth; // ArcWidth 23 24 TProfile fHistBroad; // ArcWidth/Radius Vs Radius 25 TProfile fHistSize; // MuonSize Vs Radius 21 static const Float_t fgIntegralLoLim; // lower limit of integral 22 static const Float_t fgIntegralUpLim; // upper limit of integral 26 23 27 24 MMuonSearchPar *fMuonSearchPar; //! 28 25 MMuonCalibPar *fMuonCalibPar; //! 29 26 27 TH1F fHistRadius; // Radius 28 TH1F fHistArcWidth; // ArcWidth 29 30 TProfile fHistBroad; // ArcWidth/Radius Vs Radius 31 TProfile fHistSize; // MuonSize Vs Radius 32 30 33 Float_t fMm2Deg; 34 35 Double_t Integral(const TProfile &p, Int_t a, Int_t b) const; 36 Double_t Integral(const TProfile &p, Float_t a=fgIntegralLoLim, Float_t b=fgIntegralUpLim) const; 31 37 32 38 public: … … 41 47 const TProfile& GetHistSize() const { return fHistSize; } 42 48 49 Double_t GetMeanSize() const { return Integral(fHistSize); } 50 Double_t GetMeanWidth() const { return Integral(fHistBroad); } 51 Stat_t GetEntries() const { return fHistBroad.GetEntries(); } 52 43 53 void Draw(Option_t *opt=""); 44 54 void Paint(Option_t *opt="");
Note:
See TracChangeset
for help on using the changeset viewer.