Changeset 1809 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 03/08/03 14:00:30 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHHadronness.cc
r1668 r1809 235 235 } 236 236 237 return val1y - (val2y-val1y)/(val2x-val1x) * (val1x-0.5); 237 Float_t retValue; 238 if (val2x-val1x != 0.0) 239 retValue = val1y - (val2y-val1y)/(val2x-val1x) * (val1x-0.5); 240 else 241 retValue = 0.0; 242 243 return retValue; 238 244 } 239 245 … … 252 258 fQfac->Set(n); 253 259 254 const Stat_t sumg = fGhness->Integral(1, n+1); 255 const Stat_t sump = fPhness->Integral(1, n+1); 260 Stat_t sumg; 261 Stat_t sump; 262 263 sumg = fGhness->Integral(1, n); 264 sump = fPhness->Integral(1, n); 265 266 if (sumg == 0.0 || sump == 0.0) 267 { 268 *fLog << "MHHadronness::Finalize; sumg or sump is zero; sumg, sump = " 269 << sumg << ", " << sump << ". Cannot calculate hadronness" 270 << endl; 271 } 272 273 274 // Normalize photon distribution 275 Stat_t con; 276 if (sumg > 0.0) 277 for (Int_t i=1; i<=n; i++) 278 { 279 con = (fGhness->GetBinContent(i)) / sumg; 280 fGhness->SetBinContent(i, con); 281 } 282 283 // Normalize hadron distribution 284 if (sump > 0.0) 285 for (Int_t i=1; i<=n; i++) 286 { 287 con = (fPhness->GetBinContent(i)) / sump; 288 fPhness->SetBinContent(i, con); 289 } 290 291 // Calculate acceptances 292 sumg = fGhness->Integral(1, n); 293 sump = fPhness->Integral(1, n); 294 295 *fLog << "MHHadronness::Finalize; sumg, sump = " << sumg << ", " 296 << sump << endl; 256 297 257 298 Float_t max=0; … … 259 300 for (Int_t i=1; i<=n; i++) 260 301 { 261 const Stat_t ip = fPhness->Integral(1, i)/sump; 262 const Stat_t ig = fGhness->Integral(1, i)/sumg; 302 Stat_t ip; 303 if (sump != 0.0) 304 ip = fPhness->Integral(1, i)/sump; 305 else 306 ip = 0; 307 308 Stat_t ig; 309 if (sumg != 0.0) 310 ig = fGhness->Integral(1, i)/sumg; 311 else 312 ig = 0; 263 313 264 314 fIntPhness->SetBinContent(i, ip); … … 409 459 410 460 c.cd(1); 411 gStyle->SetOptStat(10);461 //gStyle->SetOptStat(10); 412 462 Getghness()->DrawCopy(); 413 463 Getphness()->SetLineColor(kRed); 414 464 Getphness()->DrawCopy("same"); 415 465 c.cd(2); 416 gStyle->SetOptStat(0);466 //gStyle->SetOptStat(0); 417 467 Getighness()->DrawCopy(); 418 468 Getiphness()->SetLineColor(kRed); … … 483 533 484 534 gPad->cd(1); 485 gStyle->SetOptStat(10);535 //gStyle->SetOptStat(10); 486 536 Getghness()->Draw(); 487 537 Getphness()->SetLineColor(kRed); 488 538 Getphness()->Draw("same"); 489 539 gPad->cd(2); 490 gStyle->SetOptStat(0);540 //gStyle->SetOptStat(0); 491 541 Getighness()->Draw(); 492 542 Getiphness()->SetLineColor(kRed); -
trunk/MagicSoft/Mars/mhist/MHMatrix.cc
r1772 r1809 504 504 } 505 505 506 // -------------------------------------------------------------------------- 507 // 506 508 void MHMatrix::Reassign() 507 509 { … … 691 693 // 692 694 // Define the reference matrix 693 // refcolumn number of the column containing the variable, for which a694 // target distribution may be given;695 // refcolumn number of the column (starting at 1)containing the variable, 696 // for which a target distribution may be given; 695 697 // if refcolumn is negative the target distribution will be set 696 698 // equal to the real distribution; the events in the reference … … 748 750 //--------------------------------------------------------- 749 751 // 750 // if refcol < 0 : select reference events randomly 751 // i.e. set the normaliztion factotrs equal to 1.0 752 // if refcolumn < 0 : select reference events randomly 753 // i.e. set the normaliztion factotrs equal to 1.0 754 // refcol is the column number starting at 0; it is >= 0 752 755 753 756 if (refcolumn<0) 754 757 { 755 frefcol = -refcolumn ;758 frefcol = -refcolumn - 1; 756 759 } 757 760 else 758 761 { 759 frefcol = refcolumn;762 frefcol = refcolumn - 1; 760 763 } 761 764 … … 790 793 // << ", " << fM(j-1,frefcol) << endl; 791 794 } 792 793 // if refcolumn<0 set target distribution equal to the real distribution794 // in order to obtain normalization factors = 1.0795 //if (refcolumn<0)796 //{797 // for (Int_t j=1; j<=fnbins; j++)798 // {799 // float cont = fHth-> GetBinContent(j);800 // fHthsh->SetBinContent(j, cont);801 // }802 //}803 795 804 796 //--------------------------------------------------------- … … 816 808 817 809 // if refcolumn < 0 set the correction factors equal to 1 818 if ( refcolumn>=0 .0)810 if ( refcolumn>=0 ) 819 811 b = fHthsh->GetBinContent(j); 820 812 else … … 948 940 { 949 941 *fLog <<ir <<" "; 950 for (Int_t ic=0; ic<13;ic++) cout<<Mnew(ir,ic)<<" ";942 for (Int_t ic=0; ic<Mnew.GetNcols(); ic++) cout<<Mnew(ir,ic)<<" "; 951 943 *fLog <<endl; 952 944 } … … 957 949 { 958 950 float a = fHthaft->GetBinContent(j); 959 if (a>0)*fLog << j << " "<< a << " ";951 *fLog << j << " "<< a << " "; 960 952 } 961 953 *fLog <<endl; … … 967 959 968 960 th1->cd(1); 969 ((TH1F*)fHthsh)->Draw (); // target961 ((TH1F*)fHthsh)->DrawCopy(); // target 970 962 971 963 th1->cd(2); 972 ((TH1F*)fHth)->Draw (); // real histogram before964 ((TH1F*)fHth)->DrawCopy(); // real histogram before 973 965 974 966 th1->cd(3); 975 ((TH1F*)fHthd) -> Draw();// correction factors967 ((TH1F*)fHthd)->DrawCopy(); // correction factors 976 968 977 969 th1->cd(4); 978 ((TH1F*)fHthaft) -> Draw(); // histogram after 979 980 //--------------------------------------------------------- 981 // --- write onto output file 982 // 983 //TFile *outfile = new TFile(fileNameout, "RECREATE", ""); 984 //Mnew.Write(fileNameout); 985 //outfile->Close(); 970 ((TH1F*)fHthaft)->DrawCopy(); // histogram after 971 972 //--------------------------------------------------------- 986 973 987 974 return kTRUE; -
trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc
r1785 r1809 224 224 TObject *MHSigmaTheta::DrawClone(Option_t *opt) 225 225 { 226 TCanvas &c = *MakeDefCanvas("SigmaTheta ", "Sigmabar vs. Theta",226 TCanvas &c = *MakeDefCanvas("SigmaThetaPlot", "Sigmabar vs. Theta", 227 227 900, 900); 228 228 c.Divide(3, 3); … … 236 236 c.cd(1); 237 237 h = ((TH2*)&fSigmaTheta)->ProjectionX("ProjX-Theta", -1, 9999, "E"); 238 h->SetDirectory(NULL); 238 239 h->SetTitle("Distribution of \\Theta"); 239 240 h->SetXTitle("\\Theta [\\circ]"); 240 241 h->SetYTitle("No.of events"); 241 242 242 h->Draw (opt);243 h->DrawCopy(opt); 243 244 h->SetBit(kCanDelete);; 244 245 gPad->SetLogy(); … … 246 247 c.cd(4); 247 248 h = ((TH2*)&fSigmaTheta)->ProjectionY("ProjY-sigma", -1, 9999, "E"); 249 h->SetDirectory(NULL); 248 250 h->SetTitle("Distribution of Sigmabar"); 249 251 h->SetXTitle("Sigmabar"); 250 252 h->SetYTitle("No.of events"); 251 253 252 h->Draw (opt);254 h->DrawCopy(opt); 253 255 h->SetBit(kCanDelete);; 254 256 … … 263 265 c.cd(2); 264 266 l = (TH2D*) ((TH3*)&fDiffPixTheta)->Project3D("zx"); 267 l->SetDirectory(NULL); 265 268 l->SetTitle("Sigma^2-Sigmabar^2 vs. \\Theta (all pixels)"); 266 269 l->SetXTitle("\\Theta [\\circ]"); 267 270 l->SetYTitle("Sigma^2-Sigmabar^2"); 268 271 269 l->Draw ("box");272 l->DrawCopy("box"); 270 273 l->SetBit(kCanDelete);; 271 274 272 275 c.cd(5); 273 276 l = (TH2D*) ((TH3*)&fDiffPixTheta)->Project3D("zy"); 277 l->SetDirectory(NULL); 274 278 l->SetTitle("Sigma^2-Sigmabar^2 vs. pixel number (all \\Theta)"); 275 279 l->SetXTitle("pixel"); 276 280 l->SetYTitle("Sigma^2-Sigmabar^2"); 277 281 278 l->Draw ("box");282 l->DrawCopy("box"); 279 283 l->SetBit(kCanDelete);; 280 284 … … 290 294 c.cd(3); 291 295 k = (TH2D*) ((TH3*)&fSigmaPixTheta)->Project3D("zx"); 296 k->SetDirectory(NULL); 292 297 k->SetTitle("Sigma vs. \\Theta (all pixels)"); 293 298 k->SetXTitle("\\Theta [\\circ]"); 294 299 k->SetYTitle("Sigma"); 295 300 296 k->Draw ("box");301 k->DrawCopy("box"); 297 302 k->SetBit(kCanDelete);; 298 303 299 304 c.cd(6); 300 305 k = (TH2D*) ((TH3*)&fSigmaPixTheta)->Project3D("zy"); 306 k->SetDirectory(NULL); 301 307 k->SetTitle("Sigma vs. pixel number (all \\Theta)"); 302 308 k->SetXTitle("pixel"); 303 309 k->SetYTitle("Sigma"); 304 310 305 k->Draw ("box");311 k->DrawCopy("box"); 306 312 k->SetBit(kCanDelete);; 307 313
Note:
See TracChangeset
for help on using the changeset viewer.