Changeset 9335 for trunk/MagicSoft
- Timestamp:
- 02/15/09 13:15:29 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/mjobs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MJSpectrum.cc
r9261 r9335 99 99 // (i.e. removed via RecursiveRemove if closed) 100 100 gROOT->GetListOfCleanups()->Add(this); 101 SetBit(kMustCleanup); 101 102 } 102 103 … … 244 245 } 245 246 247 //arr.EnableTH1Workaround(); 248 246 249 TH1D *vstime = (TH1D*)arr.FindObjectInCanvas("Theta", "TH1D", "OnTime"); 247 250 TH1D *size = (TH1D*)arr.FindObjectInCanvas("Excess", "TH1D", "Hist"); … … 404 407 h.SetXTitle("\\Theta [\\circ]"); 405 408 h.SetYTitle("E [GeV]"); 406 h.SetZTitle( Form("Counts normalized to r=%.0fm", impactmax/100));409 h.SetZTitle(MString::Format("Counts normalized to r=%.0fm", impactmax/100)); 407 410 } 408 411 else … … 410 413 h.SetNameTitle("ThetaMC", "Event-Distribution vs Theta for MC (produced)"); 411 414 h.SetXTitle("\\Theta [\\circ]"); 412 h.SetYTitle( Form("Counts normalized to r=%.0fm", impactmax/100));415 h.SetYTitle(MString::Format("Counts normalized to r=%.0fm", impactmax/100)); 413 416 } 414 417 h.SetDirectory(0); … … 682 685 } 683 686 687 TString MJSpectrum::GetHAlpha() const 688 { 689 TString cls("MHAlpha"); 690 if (!fDisplay) 691 return cls; 692 693 TCanvas *c = fDisplay->GetCanvas("Hist"); 694 if (!c) 695 return cls; 696 697 TIter Next(c->GetListOfPrimitives()); 698 TObject *obj=0; 699 while ((obj=Next())) 700 if (obj->InheritsFrom(MHAlpha::Class())) 701 break; 702 703 return obj ? TString(obj->ClassName()) : cls; 704 } 705 684 706 // -------------------------------------------------------------------------- 685 707 // … … 691 713 Bool_t MJSpectrum::Refill(MParList &plist, TH1D &h2)/*const*/ 692 714 { 693 // Try to find the class used to determine the signal!694 TString cls("MHAlpha");695 if (fDisplay)696 {697 TCanvas *c = fDisplay->GetCanvas("Hist");698 if (c)699 {700 TIter Next(c->GetListOfPrimitives());701 TObject *obj=0;702 while ((obj=Next()))703 if (obj->InheritsFrom(MHAlpha::Class()))704 break;705 if (obj)706 cls = obj->ClassName();707 }708 }709 710 715 // Now fill the histogram 711 716 *fLog << endl; … … 737 742 fCutS = cont; 738 743 744 // Try to find the class used to determine the signal! 745 const TString cls = GetHAlpha(); 746 739 747 // FIXME: Create HistE and HistEOff to be able to modify it from 740 748 // the resource file. 741 742 749 MFillH fill1(Form("HistEOff [%s]", cls.Data()), "", "FillHistEOff"); 743 750 MFillH fill2(Form("HistE [%s]", cls.Data()), "", "FillHistE"); … … 1615 1622 PrintSetup(fit); 1616 1623 1624 1617 1625 // ------------------------- Final loop -------------------------- 1618 1626 … … 1622 1630 1623 1631 MTaskList tlist2; 1624 plist. Replace(&tlist2);1632 plist.AddToList(&tlist2); 1625 1633 1626 1634 MReadMarsFile read("Events"); … … 1760 1768 fillsp.SetWeight(); 1761 1769 1770 // Try to find the class used to determine the signal! 1762 1771 // FIXME: To be done: A task checking the lower 1% after the lower 1763 1772 // energy limit! … … 1776 1785 SetupWriter(&write); 1777 1786 1778 MParameterI par("DataType"); 1779 plist.AddToList(&par); 1780 par.SetVal(2); 1787 MParameterI *par = (MParameterI*)plist.FindCreateObj("MParameterI", "DataType"); 1788 if (!par) 1789 return kFALSE; 1790 par->SetVal(2); 1781 1791 1782 1792 tlist2.AddToList(&read); … … 1844 1854 } 1845 1855 1846 gLog.Separator("Energy Estimator");1856 fLog->Separator("Energy Estimator"); 1847 1857 if (plist.FindObject("EstimateEnergy")) 1848 1858 plist.FindObject("EstimateEnergy")->Print(); 1849 1859 1850 gLog.Separator("Spectrum");1860 fLog->Separator("Spectrum"); 1851 1861 1852 1862 // -------------------------- Spectrum ---------------------------- … … 1856 1866 1857 1867 // Spectrum fitted (convert res[1] from TeV to GeV) 1858 TF1 flx("flx", Form("%e*pow(x/500, %f)", res[1]/500, res[0]));1868 TF1 flx("flx", MString::Format("%e*pow(x/500, %f)", res[1]/500, res[0])); 1859 1869 1860 1870 // Number of events this spectrum would produce per s and m^2 … … 1880 1890 1881 1891 // check if output should be written 1882 if ( fPathOut.IsNull())1883 return kTRUE;1884 1885 TNamed ganame("ganymed.root", fPathIn.Data()); 1886 1887 // Write the output1888 TObjArray cont;1889 cont.Add((TObject*)GetEnv());// const_cast1890 cont.Add((TObject*)&set); // const_cast1891 cont.Add(plist.FindObject("MAlphaFitter"));1892 cont.Add(&area0);1893 cont.Add(&area1);1894 cont.Add(&hest);1895 cont.Add(&ganame); 1896 1897 if (fDisplay)1898 cont.Add(fDisplay); 1899 1900 if (!WriteContainer(cont, "", GetPathOut().IsNull()?"RECREATE":"UPDATE"))1901 {1902 *fLog << err << GetDescriptor() << ": Writing result failed." << endl;1903 return kFALSE;1892 if (!fPathOut.IsNull()) 1893 { 1894 TNamed ganame("ganymed.root", fPathIn.Data()); 1895 1896 // Write the output 1897 TObjArray cont; 1898 cont.Add((TObject*)GetEnv()); // const_cast 1899 cont.Add((TObject*)&set); // const_cast 1900 cont.Add(plist.FindObject("MAlphaFitter")); 1901 cont.Add(&area0); 1902 cont.Add(&area1); 1903 cont.Add(&hest); 1904 cont.Add(&ganame); 1905 1906 if (fDisplay) 1907 cont.Add(fDisplay); 1908 1909 if (!WriteContainer(cont, "", GetPathOut().IsNull()?"RECREATE":"UPDATE")) 1910 { 1911 *fLog << err << GetDescriptor() << ": Writing result failed." << endl; 1912 return kFALSE; 1913 } 1904 1914 } 1905 1915 -
trunk/MagicSoft/Mars/mjobs/MJSpectrum.h
r8985 r9335 51 51 Bool_t ReadOrigMCDistribution(const MDataSet &set, TH1 &h, MMcSpectrumWeight &w) const; 52 52 void GetThetaDistribution(TH1D &temp1, TH2D &temp2) const; 53 TString GetHAlpha() const; 53 54 Bool_t Refill(MParList &plist, TH1D &h) /*const*/; 54 55 Bool_t InitWeighting(const MDataSet &set, MMcSpectrumWeight &w) const;
Note:
See TracChangeset
for help on using the changeset viewer.