Changeset 4601
- Timestamp:
- 08/12/04 16:41:37 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 added
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4598 r4601 47 47 * Makefile: 48 48 - added showlog 49 50 * macros/sql/filldotrbk.C, macros/sql/filldotrun.C: 51 - update of comments 52 53 * mbase/MEvtLoop.cc: 54 - first interprete environment for fLog 55 56 * mbase/MEvtLoop.[h,cc], mbase/MParContainer.[h,cc], 57 mbase/MParList.[h,cc], mbase/MTaskList.[h,cc], 58 mfileio/MRead.[h,cc], mhbase/MHMatrix.[h,cc], 59 mpedestal/MPedCalcFromLoGain.[h,cc], 60 mpedestal/MPedCalcFromPedRun.[h,cc], 61 msignal/MExtractor.[h,cc]: 62 - changed type of ReadEnv from Bool_t to Int_t 63 64 * mbase/MLog.cc: 65 - fixed ReadEnv 66 67 * mbase/MParContainer.[h,cc]: 68 - added TestEnv 69 70 * mbase/MParList.cc, mbase/MTaskList.cc: 71 - moved some code to MParContainer::TestEnv 72 73 * mbase/Makefile, mbase/BaseLinkDef.h: 74 - added MTaskEnv 75 76 * mhist/MHCamera.cc: 77 - removed some output (Draw function don't write something 78 to the console) - it is displayed anyhow 79 - added some SetBorderMode(0) 80 81 * mjobs/JobsLinkDef.h, mjobs/Makefile: 82 - added MSequence 83 84 * mjobs/MJPedestal.[h,cc]: 85 - changed to allow a sequence as input 86 - changed to allow setting up the extractor from a TEnv 87 88 * mpedestal/MPedCalcFromLoGain.[h,cc]: 89 - moved a common block of code to a new Calc function 90 - fixed ReadEnv 91 92 * mpedestal/MPedCalcPedRun.cc, msignal/MExtractor.cc: 93 - fixed ReadEnv 94 95 * mraw/MRawCrateData.cc: 96 - updated Print() 97 98 * mraw/MRawFileRead.h: 99 - added default to first constructor argument 100 49 101 50 102 -
trunk/MagicSoft/Mars/NEWS
r4591 r4601 7 7 into a file back into colored text (for example to display it with 8 8 more): showlog 9 10 - Added support for Sequences (MSequence). Sequences are blocks of run 11 files containing the same calibration and belonging to the same 12 source 13 14 - Added a new task (MTaskEnv) which can be used in setup files to switch 15 between different tasks (for example to choose a signal extractor) 9 16 10 17 -
trunk/MagicSoft/Mars/macros/sql/filldotrbk.C
r4544 r4601 31 31 // the data center and store their contents in the runbook-database. 32 32 // 33 // Usage: root readrbk.C("/data/MAGIC/Period014", kTRUE) 33 // Usage: 34 // .x readrbk.C("/data/MAGIC/Period014", kTRUE) 34 35 // 35 36 // While the first argument is the directory in which all subdirectories where -
trunk/MagicSoft/Mars/macros/sql/filldotrun.C
r4563 r4601 39 39 // 40 40 // Usage: 41 // root -q -l -b filldotrun.C+("/data/MAGIC/Period019/ccdata", kTRUE) 2>&1 | tee filldotrun.log41 // .x filldotrun.C+("/data/MAGIC/Period019/ccdata", kTRUE) 42 42 // 43 43 // While the first argument is the directory in which all subdirectories where -
trunk/MagicSoft/Mars/mbase/BaseLinkDef.h
r4081 r4601 33 33 34 34 #pragma link C++ class MTask+; 35 #pragma link C++ class MTaskEnv+; 35 36 #pragma link C++ class MTaskInteractive+; 36 37 #pragma link C++ class MTaskList+; -
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r4452 r4601 936 936 // all Mars classes. 937 937 // 938 Bool_t MEvtLoop::ReadEnv(const TEnv &env, TString prefix, Bool_t print)938 Int_t MEvtLoop::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 939 939 { 940 940 if (!prefix.IsNull()) … … 946 946 *fLog << inf << "Reading resources for " << prefix /*TEnv::fRcName << " from " << env.GetRcName()*/ << endl; 947 947 948 fLog->ReadEnv(env, prefix, print); 949 948 950 if (fParList->ReadEnv(env, prefix, print)==kERROR) 949 951 { … … 951 953 return kFALSE; 952 954 } 953 954 fLog->ReadEnv(env, prefix, print);955 955 956 956 return kTRUE; -
trunk/MagicSoft/Mars/mbase/MEvtLoop.h
r4368 r4601 77 77 void Print(Option_t *opt="") const; 78 78 79 Bool_tReadEnv(const TEnv &env, TString prefix="", Bool_t print=kFALSE);79 Int_t ReadEnv(const TEnv &env, TString prefix="", Bool_t print=kFALSE); 80 80 Bool_t WriteEnv(TEnv &env, TString prefix="", Bool_t print=kFALSE) const; 81 81 -
trunk/MagicSoft/Mars/mbase/MGList.cc
r2173 r4601 37 37 #include <iostream> 38 38 39 #include <TROOT.h> 39 40 #include <TClass.h> 40 41 #include <TGClient.h> … … 45 46 46 47 using namespace std; 48 49 // -------------------------------------------------------------------------- 50 // 51 // Add the list to the global list of cleanups 52 // objects in the list. 53 // 54 MGList::MGList() : TList() 55 { 56 gROOT->GetListOfCleanups()->Add(this); 57 } 47 58 48 59 // -------------------------------------------------------------------------- … … 159 170 160 171 TList::Add(obj); 172 obj->SetBit(kMustCleanup); 161 173 } 162 174 … … 180 192 181 193 TList::Add(obj, opt); 194 obj->SetBit(kMustCleanup); 182 195 } 183 196 … … 187 200 // - The picture is freed as often as it was retrieved from gClient 188 201 // 189 void MGList::AddPicture( constTGPicture *pic, const char *name)202 void MGList::AddPicture(TGPicture *pic, const char *name) 190 203 { 191 204 // … … 204 217 // Add the picture to the list 205 218 // 206 TList::Add(const_cast<TGPicture*>(pic)); 219 TList::Add(pic); 220 pic->SetBit(kMustCleanup); 207 221 } 208 222 … … 221 235 const TGPicture *MGList::GetPicture(const char *name) 222 236 { 223 const TGPicture *pic = gClient->GetPicture(name);237 TGPicture *pic = const_cast<TGPicture*>(gClient->GetPicture(name)); 224 238 AddPicture(pic, name); 225 239 return pic; … … 240 254 const TGPicture *MGList::GetPicture(const char *name, Int_t width, Int_t height) 241 255 { 242 const TGPicture *pic = gClient->GetPicture(name, width, height);256 TGPicture *pic = const_cast<TGPicture*>(gClient->GetPicture(name, width, height)); 243 257 AddPicture(pic, name); 244 258 return pic; -
trunk/MagicSoft/Mars/mbase/MGList.h
r1108 r4601 15 15 Bool_t IsExisting(TObject *obj) const; 16 16 17 void AddPicture( constTGPicture *pic, const char *name);17 void AddPicture(TGPicture *pic, const char *name); 18 18 19 19 public: 20 MGList() : TList() {}21 virtual~MGList();20 MGList(); 21 ~MGList(); 22 22 23 23 void Add(TObject *obj); -
trunk/MagicSoft/Mars/mbase/MLog.cc
r4461 r4601 544 544 void MLog::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 545 545 { 546 if (!prefix.IsNull())547 prefix += ".";548 prefix += "MLog";549 550 546 MParContainer mlog("MLog"); 551 547 552 if (mlog.IsEnvDefined(env, prefix, "VerbosityLevel", print)) 553 SetDebugLevel(mlog.GetEnvValue(env, prefix, "VerbosityLevel", 2)); 554 555 if (mlog.IsEnvDefined(env, prefix, "DebugLevel", print)) 556 gDebug = mlog.GetEnvValue(env, prefix, "DebugLevel", 0); 557 558 if (mlog.IsEnvDefined(env, prefix, "NoColors", print)) 559 if (mlog.GetEnvValue(env, prefix, "NoColors", 1)>0) 560 SetNoColors(); 548 if (mlog.IsEnvDefined(env, prefix+"MLog", "VerbosityLevel", print)) 549 SetDebugLevel(mlog.GetEnvValue(env, prefix+"MLog", "VerbosityLevel", 2)); 550 else 551 if (mlog.IsEnvDefined(env, "MLog", "VerbosityLevel", print)) 552 SetDebugLevel(mlog.GetEnvValue(env, "MLog", "VerbosityLevel", 2)); 553 554 if (mlog.IsEnvDefined(env, prefix+"MLog", "DebugLevel", print)) 555 gDebug = mlog.GetEnvValue(env, prefix+"MLog", "DebugLevel", 0); 556 else 557 if (mlog.IsEnvDefined(env, "MLog", "DebugLevel", print)) 558 gDebug = mlog.GetEnvValue(env, "MLog", "DebugLevel", 0); 559 560 if (mlog.IsEnvDefined(env, prefix+"MLog", "NoColors", print)) 561 SetNoColors(mlog.GetEnvValue(env, prefix+"MLog", "NoColors", kFALSE)); 562 else 563 if (mlog.IsEnvDefined(env, "MLog", "NoColors", print)) 564 SetNoColors(mlog.GetEnvValue(env, "MLog", "NoColors", kFALSE)); 561 565 } 562 566 -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r4081 r4601 569 569 // all Mars classes. 570 570 // 571 Bool_t MParContainer::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 571 // Return values: 572 // kTRUE: Environment string found 573 // kFALSE: Environment string not found 574 // kERROR: Error occured, eg. environment invalid 575 // 576 // Overload this if you don't want to control the level of setup-string. In 577 // this case ReadEnv gets called with the different possibilities, see TestEnv. 578 // 579 Int_t MParContainer::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 572 580 { 573 581 if (!IsEnvDefined(env, prefix, "", print)) … … 609 617 } 610 618 619 // -------------------------------------------------------------------------- 620 // 621 // Take the prefix and call ReadEnv for: 622 // prefix.containername 623 // prefix.classname 624 // containername 625 // classname 626 // 627 // The existance of an environment variable is done in this order. If 628 // ReadEnv return kTRUE the existance of the container setup is assumed and 629 // the other tests are skipped. If kFALSE is assumed the sequence is 630 // continued. In case of kERROR failing of the setup from a file is assumed. 631 // 632 // Overload this if you want to control the handling of level of setup-string 633 // mentioned above. In this case ReadEnv gets never called if you don't call 634 // it explicitly. 635 // 636 Int_t MParContainer::TestEnv(const TEnv &env, TString prefix, Bool_t print) 637 { 638 if (print) 639 *fLog << all << "Testing Prefix+ContName: " << prefix+GetName() << endl; 640 Int_t rc = ReadEnv(env, prefix+GetName(), print); 641 if (rc==kERROR || rc==kTRUE) 642 return rc; 643 644 // Check For: Job4.MClassName.Varname 645 if (print) 646 *fLog << all << "Testing Prefix+ClasName: " << prefix+ClassName() << endl; 647 rc = ReadEnv(env, prefix+ClassName(), print); 648 if (rc==kERROR || rc==kTRUE) 649 return rc; 650 651 // Check For: ContainerName.Varname 652 if (print) 653 *fLog << all << "Testing ContName: " << GetName() << endl; 654 rc = ReadEnv(env, GetName(), print); 655 if (rc==kERROR || rc==kTRUE) 656 return rc; 657 658 // Check For: MClassName.Varname 659 if (print) 660 *fLog << all << "Testing ClassName: " << ClassName() << endl; 661 rc = ReadEnv(env, ClassName(), print); 662 if (rc==kERROR || rc==kTRUE) 663 return rc; 664 665 // Not found 666 return kFALSE; 667 } 668 611 669 Bool_t MParContainer::IsEnvDefined(const TEnv &env, TString prefix, TString postfix, Bool_t print) const 612 670 { -
trunk/MagicSoft/Mars/mbase/MParContainer.h
r3574 r4601 118 118 virtual void SetNames(TObjArray &arr); 119 119 120 virtual Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE); 120 virtual Int_t TestEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE); 121 virtual Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE); 121 122 virtual Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const; 122 123 -
trunk/MagicSoft/Mars/mbase/MParList.cc
r4577 r4601 853 853 // all Mars classes. 854 854 // 855 Bool_t MParList::ReadEnv(const TEnv &env, TString prefix, Bool_t print)855 Int_t MParList::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 856 856 { 857 857 if (print) … … 870 870 } 871 871 872 // Check For: Job4.ContainerName.Varname 873 if (print) 874 *fLog << all << "Testing: " << prefix+cont->GetName() << endl; 875 Bool_t rc = cont->ReadEnv(env, prefix+cont->GetName(), print); 876 if (rc==kERROR) 872 if (cont->TestEnv(env, prefix, print)==kERROR) 877 873 return kERROR; 878 if (rc==kTRUE)879 continue;880 881 // Check For: Job4.MClassName.Varname882 if (print)883 *fLog << all << "Testing: " << prefix+cont->ClassName() << endl;884 rc = cont->ReadEnv(env, prefix+cont->ClassName(), print);885 if (rc==kERROR)886 return kERROR;887 if (rc==kTRUE)888 continue;889 890 // Check For: ContainerName.Varname891 if (print)892 *fLog << all << "Testing: " << cont->GetName() << endl;893 rc = cont->ReadEnv(env, cont->GetName(), print);894 if (rc==kERROR)895 return kERROR;896 if (rc==kTRUE)897 continue;898 899 // Check For: MClassName.Varname900 if (print)901 *fLog << all << "Testing: " << cont->ClassName() << endl;902 rc = cont->ReadEnv(env, cont->ClassName(), print);903 if (rc==kERROR)904 return kERROR;905 if (rc==kTRUE)906 continue;907 874 } 908 875 -
trunk/MagicSoft/Mars/mbase/MParList.h
r4577 r4601 91 91 void SavePrimitive(ofstream &out, Option_t *o=""); 92 92 93 Bool_tReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);93 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE); 94 94 Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const; 95 95 -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r3788 r4601 734 734 // all Mars classes. 735 735 // 736 Bool_t MTaskList::ReadEnv(const TEnv &env, TString prefix, Bool_t print)736 Int_t MTaskList::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 737 737 { 738 738 if (print) … … 751 751 } 752 752 753 // Check For: Job4.ContainerName.Varname 754 if (print) 755 *fLog << all << "Testing: " << prefix+cont->GetName() << endl; 756 Bool_t rc = cont->ReadEnv(env, prefix+cont->GetName(), print); 757 if (rc==kERROR) 753 if (cont->TestEnv(env, prefix, print)==kERROR) 758 754 return kERROR; 759 if (rc==kTRUE)760 continue;761 762 // Check For: Job4.MClassName.Varname763 if (print)764 *fLog << all << "Testing: " << prefix+cont->ClassName() << endl;765 rc = cont->ReadEnv(env, prefix+cont->ClassName(), print);766 if (rc==kERROR)767 return kERROR;768 if (rc==kTRUE)769 continue;770 771 // Check For: ContainerName.Varname772 if (print)773 *fLog << all << "Testing: " << cont->GetName() << endl;774 rc = cont->ReadEnv(env, cont->GetName(), print);775 if (rc==kERROR)776 return kERROR;777 if (rc==kTRUE)778 continue;779 780 // Check For: MClassName.Varname781 if (print)782 *fLog << all << "Testing: " << cont->ClassName() << endl;783 rc = cont->ReadEnv(env, cont->ClassName(), print);784 if (rc==kERROR)785 return kERROR;786 if (rc==kTRUE)787 continue;788 755 } 789 756 -
trunk/MagicSoft/Mars/mbase/MTaskList.h
r3666 r4601 78 78 void SetNames(TObjArray &arr); 79 79 80 Bool_tReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);80 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE); 81 81 Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const; 82 82 -
trunk/MagicSoft/Mars/mbase/Makefile
r4081 r4601 30 30 MInputStreamID.cc \ 31 31 MTask.cc \ 32 MTaskEnv.cc \ 32 33 MTaskInteractive.cc \ 33 34 MTaskList.cc \ -
trunk/MagicSoft/Mars/mfileio/MRead.cc
r2298 r4601 82 82 // Number of entries at the moment not supported 83 83 // 84 Bool_t MRead::ReadEnv(const TEnv &env, TString prefix, Bool_t print)84 Int_t MRead::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 85 85 { 86 86 // -
trunk/MagicSoft/Mars/mfileio/MRead.h
r2298 r4601 26 26 Int_t AddFiles(MDirIter &dir); 27 27 28 Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);28 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 29 29 30 30 ClassDef(MRead, 0) // Base class for a reading task -
trunk/MagicSoft/Mars/mhbase/MHMatrix.cc
r2738 r4601 1055 1055 // MHMatrix.Column1: MHillasSrc.fAlpha 1056 1056 // 1057 Bool_t MHMatrix::ReadEnv(const TEnv &env, TString prefix, Bool_t print)1057 Int_t MHMatrix::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 1058 1058 { 1059 1059 if (fM.IsValid()) -
trunk/MagicSoft/Mars/mhbase/MHMatrix.h
r2738 r4601 112 112 Bool_t DefRefMatrix(Int_t nmaxevts=0, TMatrix *mrest=NULL); 113 113 114 Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);114 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE); 115 115 116 116 void ShuffleRows(UInt_t seed); -
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r4430 r4601 1676 1676 } 1677 1677 1678 1679 1678 // -------------------------------------------------------------------------- 1680 1679 // … … 1695 1694 // 7: Single Gauss with TLegend to show the meaning of the colours 1696 1695 // 1697 //1698 1696 void MHCamera::DrawProjection(Int_t fit) const 1699 1697 { 1700 1701 TArrayI inner(1); 1702 inner[0] = 0; 1703 1704 TArrayI outer(1); 1705 outer[0] = 1; 1706 1707 if (fit==5 || fit==6) 1708 { 1709 1710 if (GetGeomCam().InheritsFrom("MGeomCamMagic")) 1698 TArrayI inner(1); 1699 inner[0] = 0; 1700 1701 TArrayI outer(1); 1702 outer[0] = 1; 1703 1704 if (fit==5 || fit==6) 1705 { 1706 if (GetGeomCam().InheritsFrom("MGeomCamMagic")) 1711 1707 { 1712 TArrayI s0(6);1713 s0[0] = 6;1714 s0[1] = 1;1715 s0[2] = 2;1716 s0[3] = 3;1717 s0[4] = 4;1718 s0[5] = 5;1719 1720 TArrayI s1(3);1721 s1[0] = 6;1722 s1[1] = 1;1723 s1[2] = 2;1724 1725 TArrayI s2(3);1726 s2[0] = 3;1727 s2[1] = 4;1728 s2[2] = 5;1729 1730 gPad->Clear();1731 TVirtualPad *pad = gPad;1732 pad->Divide(2,1);1733 1734 TH1D *inout[2];1735 inout[0] = ProjectionS(s0, inner, "Inner");1736 inout[1] = ProjectionS(s0, outer, "Outer");1737 1738 inout[0]->SetDirectory(NULL);1739 inout[1]->SetDirectory(NULL);1740 1741 for (int i=0; i<2; i++)1708 TArrayI s0(6); 1709 s0[0] = 6; 1710 s0[1] = 1; 1711 s0[2] = 2; 1712 s0[3] = 3; 1713 s0[4] = 4; 1714 s0[5] = 5; 1715 1716 TArrayI s1(3); 1717 s1[0] = 6; 1718 s1[1] = 1; 1719 s1[2] = 2; 1720 1721 TArrayI s2(3); 1722 s2[0] = 3; 1723 s2[1] = 4; 1724 s2[2] = 5; 1725 1726 gPad->Clear(); 1727 TVirtualPad *pad = gPad; 1728 pad->Divide(2,1); 1729 1730 TH1D *inout[2]; 1731 inout[0] = ProjectionS(s0, inner, "Inner"); 1732 inout[1] = ProjectionS(s0, outer, "Outer"); 1733 1734 inout[0]->SetDirectory(NULL); 1735 inout[1]->SetDirectory(NULL); 1736 1737 for (int i=0; i<2; i++) 1742 1738 { 1743 pad->cd(i+1); 1744 inout[i]->SetLineColor(kRed+i); 1745 inout[i]->SetBit(kCanDelete); 1746 inout[i]->Draw(); 1747 inout[i]->Fit("gaus","Q"); 1748 1749 1750 if (fit == 6) 1739 pad->cd(i+1); 1740 gPad->SetBorderMode(0); 1741 1742 inout[i]->SetLineColor(kRed+i); 1743 inout[i]->SetBit(kCanDelete); 1744 inout[i]->Draw(); 1745 inout[i]->Fit("gaus","Q"); 1746 1747 if (fit == 6) 1751 1748 { 1752 TH1D *half[2];1753 half[0] = ProjectionS(s1, i==0 ? inner : outer , "Sector 6-1-2");1754 half[1] = ProjectionS(s2, i==0 ? inner : outer , "Sector 3-4-5");1755 1756 for (int j=0; j<2; j++)1749 TH1D *half[2]; 1750 half[0] = ProjectionS(s1, i==0 ? inner : outer , "Sector 6-1-2"); 1751 half[1] = ProjectionS(s2, i==0 ? inner : outer , "Sector 3-4-5"); 1752 1753 for (int j=0; j<2; j++) 1757 1754 { 1758 half[j]->SetLineColor(kRed+i+2*j+1);1759 half[j]->SetDirectory(NULL);1760 half[j]->SetBit(kCanDelete);1761 half[j]->Draw("same");1755 half[j]->SetLineColor(kRed+i+2*j+1); 1756 half[j]->SetDirectory(NULL); 1757 half[j]->SetBit(kCanDelete); 1758 half[j]->Draw("same"); 1762 1759 } 1763 1760 } 1764 1761 1765 1762 } 1766 1767 gLog << all << GetName()1768 << Form("%s%5.3f%s%3.2f"," Inner Pixels: ",1769 inout[0]->GetFunction("gaus")->GetParameter(1),"+-",1770 inout[0]->GetFunction("gaus")->GetParameter(2));1771 gLog << Form("%s%5.3f%s%3.2f"," Outer Pixels: ",1772 inout[1]->GetFunction("gaus")->GetParameter(1),"+-",1773 inout[1]->GetFunction("gaus")->GetParameter(2)) << endl;1774 1775 1763 } 1776 return; 1777 } 1778 1779 TH1D *obj2 = (TH1D*)Projection(GetName()); 1780 obj2->SetDirectory(0); 1781 obj2->Draw(); 1782 obj2->SetBit(kCanDelete); 1783 1784 if (fit == 0) 1785 return; 1786 1787 if (GetGeomCam().InheritsFrom("MGeomCamMagic")) 1788 { 1789 TArrayI s0(3); 1790 s0[0] = 6; 1791 s0[1] = 1; 1792 s0[2] = 2; 1764 return; 1765 } 1766 1767 TH1D *obj2 = (TH1D*)Projection(GetName()); 1768 obj2->SetDirectory(0); 1769 obj2->Draw(); 1770 obj2->SetBit(kCanDelete); 1771 1772 if (fit == 0) 1773 return; 1774 1775 if (GetGeomCam().InheritsFrom("MGeomCamMagic")) 1776 { 1777 TArrayI s0(3); 1778 s0[0] = 6; 1779 s0[1] = 1; 1780 s0[2] = 2; 1781 1782 TArrayI s1(3); 1783 s1[0] = 3; 1784 s1[1] = 4; 1785 s1[2] = 5; 1786 1787 TH1D *halfInOut[4]; 1788 1789 // Just to get the right (maximum) binning 1790 halfInOut[0] = ProjectionS(s0, inner, "Sector 6-1-2 Inner"); 1791 halfInOut[1] = ProjectionS(s1, inner, "Sector 3-4-5 Inner"); 1792 halfInOut[2] = ProjectionS(s0, outer, "Sector 6-1-2 Outer"); 1793 halfInOut[3] = ProjectionS(s1, outer, "Sector 3-4-5 Outer"); 1794 1795 TLegend *leg = new TLegend(0.05,0.65,0.35,0.9); 1796 1797 for (int i=0; i<4; i++) 1798 { 1799 halfInOut[i]->SetLineColor(kRed+i); 1800 halfInOut[i]->SetDirectory(0); 1801 halfInOut[i]->SetBit(kCanDelete); 1802 halfInOut[i]->Draw("same"); 1803 leg->AddEntry(halfInOut[i],halfInOut[i]->GetTitle(),"l"); 1804 } 1805 1806 if (fit==7) 1807 leg->Draw(); 1793 1808 1794 TArrayI s1(3); 1795 s1[0] = 3; 1796 s1[1] = 4; 1797 s1[2] = 5; 1798 1799 1800 TH1D *halfInOut[4]; 1801 1802 // Just to get the right (maximum) binning 1803 halfInOut[0] = ProjectionS(s0, inner, "Sector 6-1-2 Inner"); 1804 halfInOut[1] = ProjectionS(s1, inner, "Sector 3-4-5 Inner"); 1805 halfInOut[2] = ProjectionS(s0, outer, "Sector 6-1-2 Outer"); 1806 halfInOut[3] = ProjectionS(s1, outer, "Sector 3-4-5 Outer"); 1807 1808 TLegend *leg = new TLegend(0.05,0.65,0.35,0.9); 1809 1810 for (int i=0; i<4; i++) 1811 { 1812 halfInOut[i]->SetLineColor(kRed+i); 1813 halfInOut[i]->SetDirectory(0); 1814 halfInOut[i]->SetBit(kCanDelete); 1815 halfInOut[i]->Draw("same"); 1816 leg->AddEntry(halfInOut[i],halfInOut[i]->GetTitle(),"l"); 1817 } 1818 1819 if (fit==7) 1820 leg->Draw(); 1821 1822 gPad->Modified(); 1823 gPad->Update(); 1824 } 1825 1826 const Double_t min = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst()); 1827 const Double_t max = obj2->GetBinCenter(obj2->GetXaxis()->GetLast()); 1828 const Double_t integ = obj2->Integral("width")/2.5; 1829 const Double_t mean = obj2->GetMean(); 1830 const Double_t rms = obj2->GetRMS(); 1831 const Double_t width = max-min; 1832 1833 const TString dgausformula = "([0]-[3])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])" 1834 "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])"; 1835 1836 const TString tgausformula = "([0]-[3]-[6])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])" 1837 "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])" 1838 "+[6]/[8]*exp(-0.5*(x-[7])*(x-[7])/[8]/[8])"; 1839 TF1 *f=0; 1840 switch (fit) 1809 gPad->Modified(); 1810 gPad->Update(); 1811 } 1812 1813 const Double_t min = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst()); 1814 const Double_t max = obj2->GetBinCenter(obj2->GetXaxis()->GetLast()); 1815 const Double_t integ = obj2->Integral("width")/2.5; 1816 const Double_t mean = obj2->GetMean(); 1817 const Double_t rms = obj2->GetRMS(); 1818 const Double_t width = max-min; 1819 1820 const TString dgausformula = "([0]-[3])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])" 1821 "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])"; 1822 1823 const TString tgausformula = "([0]-[3]-[6])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])" 1824 "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])" 1825 "+[6]/[8]*exp(-0.5*(x-[7])*(x-[7])/[8]/[8])"; 1826 1827 TF1 *f=0; 1828 switch (fit) 1841 1829 { 1842 1830 case 1: 1843 f = new TF1("sgaus", "gaus(0)", min, max);1844 f->SetLineColor(kYellow);1845 f->SetBit(kCanDelete);1846 f->SetParNames("Area", "#mu", "#sigma");1847 f->SetParameters(integ/rms, mean, rms);1848 f->SetParLimits(0, 0, integ);1849 f->SetParLimits(1, min, max);1850 f->SetParLimits(2, 0, width/1.5);1851 1852 obj2->Fit(f, "QLR");1853 break;1854 1831 f = new TF1("sgaus", "gaus(0)", min, max); 1832 f->SetLineColor(kYellow); 1833 f->SetBit(kCanDelete); 1834 f->SetParNames("Area", "#mu", "#sigma"); 1835 f->SetParameters(integ/rms, mean, rms); 1836 f->SetParLimits(0, 0, integ); 1837 f->SetParLimits(1, min, max); 1838 f->SetParLimits(2, 0, width/1.5); 1839 1840 obj2->Fit(f, "QLR"); 1841 break; 1842 1855 1843 case 2: 1856 f = new TF1("dgaus",dgausformula.Data(),min,max);1857 f->SetLineColor(kYellow);1858 f->SetBit(kCanDelete);1859 f->SetParNames("A_{tot}", "#mu1", "#sigma1", "A2", "#mu2", "#sigma2");1860 f->SetParameters(integ,(min+mean)/2.,width/4.,1861 integ/width/2.,(max+mean)/2.,width/4.);1862 // The left-sided Gauss1863 f->SetParLimits(0,integ-1.5 , integ+1.5);1864 f->SetParLimits(1,min+(width/10.), mean);1865 f->SetParLimits(2,0 , width/2.);1866 // The right-sided Gauss1867 f->SetParLimits(3,0 , integ);1868 f->SetParLimits(4,mean, max-(width/10.));1869 f->SetParLimits(5,0 , width/2.);1870 obj2->Fit(f,"QLRM");1871 break;1872 1844 f = new TF1("dgaus",dgausformula.Data(),min,max); 1845 f->SetLineColor(kYellow); 1846 f->SetBit(kCanDelete); 1847 f->SetParNames("A_{tot}", "#mu1", "#sigma1", "A2", "#mu2", "#sigma2"); 1848 f->SetParameters(integ,(min+mean)/2.,width/4., 1849 integ/width/2.,(max+mean)/2.,width/4.); 1850 // The left-sided Gauss 1851 f->SetParLimits(0,integ-1.5 , integ+1.5); 1852 f->SetParLimits(1,min+(width/10.), mean); 1853 f->SetParLimits(2,0 , width/2.); 1854 // The right-sided Gauss 1855 f->SetParLimits(3,0 , integ); 1856 f->SetParLimits(4,mean, max-(width/10.)); 1857 f->SetParLimits(5,0 , width/2.); 1858 obj2->Fit(f,"QLRM"); 1859 break; 1860 1873 1861 case 3: 1874 f = new TF1("tgaus",tgausformula.Data(),min,max);1875 f->SetLineColor(kYellow);1876 f->SetBit(kCanDelete);1877 f->SetParNames("A_{tot}","#mu_{1}","#sigma_{1}",1878 "A_{2}","#mu_{2}","#sigma_{2}",1879 "A_{3}","#mu_{3}","#sigma_{3}");1880 f->SetParameters(integ,(min+mean)/2,width/4.,1881 integ/width/3.,(max+mean)/2.,width/4.,1882 integ/width/3.,mean,width/2.);1883 // The left-sided Gauss1884 f->SetParLimits(0,integ-1.5,integ+1.5);1885 f->SetParLimits(1,min+(width/10.),mean);1886 f->SetParLimits(2,width/15.,width/2.);1887 // The right-sided Gauss1888 f->SetParLimits(3,0.,integ);1889 f->SetParLimits(4,mean,max-(width/10.));1890 f->SetParLimits(5,width/15.,width/2.);1891 // The Gauss describing the outliers1892 f->SetParLimits(6,0.,integ);1893 f->SetParLimits(7,min,max);1894 f->SetParLimits(8,width/4.,width/1.5);1895 obj2->Fit(f,"QLRM");1896 break;1897 1862 f = new TF1("tgaus",tgausformula.Data(),min,max); 1863 f->SetLineColor(kYellow); 1864 f->SetBit(kCanDelete); 1865 f->SetParNames("A_{tot}","#mu_{1}","#sigma_{1}", 1866 "A_{2}","#mu_{2}","#sigma_{2}", 1867 "A_{3}","#mu_{3}","#sigma_{3}"); 1868 f->SetParameters(integ,(min+mean)/2,width/4., 1869 integ/width/3.,(max+mean)/2.,width/4., 1870 integ/width/3.,mean,width/2.); 1871 // The left-sided Gauss 1872 f->SetParLimits(0,integ-1.5,integ+1.5); 1873 f->SetParLimits(1,min+(width/10.),mean); 1874 f->SetParLimits(2,width/15.,width/2.); 1875 // The right-sided Gauss 1876 f->SetParLimits(3,0.,integ); 1877 f->SetParLimits(4,mean,max-(width/10.)); 1878 f->SetParLimits(5,width/15.,width/2.); 1879 // The Gauss describing the outliers 1880 f->SetParLimits(6,0.,integ); 1881 f->SetParLimits(7,min,max); 1882 f->SetParLimits(8,width/4.,width/1.5); 1883 obj2->Fit(f,"QLRM"); 1884 break; 1885 1898 1886 case 4: 1899 obj2->Fit("pol0", "Q");1900 obj2->GetFunction("pol0")->SetLineColor(kYellow);1901 break;1902 1887 obj2->Fit("pol0", "Q"); 1888 obj2->GetFunction("pol0")->SetLineColor(kYellow); 1889 break; 1890 1903 1891 case 9: 1904 break;1905 1892 break; 1893 1906 1894 default: 1907 obj2->Fit("gaus", "Q"); 1908 obj2->GetFunction("gaus")->SetLineColor(kYellow); 1909 break; 1910 } 1911 } 1912 1895 obj2->Fit("gaus", "Q"); 1896 obj2->GetFunction("gaus")->SetLineColor(kYellow); 1897 break; 1898 } 1899 } 1913 1900 1914 1901 // -------------------------------------------------------------------------- … … 1921 1908 void MHCamera::DrawRadialProfile() const 1922 1909 { 1923 1924 TProfile *obj2 = (TProfile*)RadialProfile(GetName()); 1925 obj2->SetDirectory(0); 1926 obj2->Draw(); 1927 obj2->SetBit(kCanDelete); 1928 1929 if (GetGeomCam().InheritsFrom("MGeomCamMagic")) 1930 { 1931 1932 TArrayI s0(6); 1933 s0[0] = 1; 1934 s0[1] = 2; 1935 s0[2] = 3; 1936 s0[3] = 4; 1937 s0[4] = 5; 1938 s0[5] = 6; 1939 1940 TArrayI inner(1); 1941 inner[0] = 0; 1942 1943 TArrayI outer(1); 1944 outer[0] = 1; 1945 1946 // Just to get the right (maximum) binning 1947 TProfile *half[2]; 1948 half[0] = RadialProfileS(s0, inner,Form("%s%s",GetName(),"Inner")); 1949 half[1] = RadialProfileS(s0, outer,Form("%s%s",GetName(),"Outer")); 1950 1951 for (Int_t i=0; i<2; i++) 1910 TProfile *obj2 = (TProfile*)RadialProfile(GetName()); 1911 obj2->SetDirectory(0); 1912 obj2->Draw(); 1913 obj2->SetBit(kCanDelete); 1914 1915 if (GetGeomCam().InheritsFrom("MGeomCamMagic")) 1916 { 1917 TArrayI s0(6); 1918 s0[0] = 1; 1919 s0[1] = 2; 1920 s0[2] = 3; 1921 s0[3] = 4; 1922 s0[4] = 5; 1923 s0[5] = 6; 1924 1925 TArrayI inner(1); 1926 inner[0] = 0; 1927 1928 TArrayI outer(1); 1929 outer[0] = 1; 1930 1931 // Just to get the right (maximum) binning 1932 TProfile *half[2]; 1933 half[0] = RadialProfileS(s0, inner,Form("%sInner",GetName())); 1934 half[1] = RadialProfileS(s0, outer,Form("%sOuter",GetName())); 1935 1936 for (Int_t i=0; i<2; i++) 1952 1937 { 1953 Double_t min = GetGeomCam().GetMinRadius(i);1954 Double_t max = GetGeomCam().GetMaxRadius(i);1955 1956 half[i]->SetLineColor(kRed+i);1957 half[i]->SetDirectory(0);1958 half[i]->SetBit(kCanDelete);1959 half[i]->Draw("same");1960 half[i]->Fit("pol1","Q","",min,max);1961 half[i]->GetFunction("pol1")->SetLineColor(kRed+i);1962 half[i]->GetFunction("pol1")->SetLineWidth(1);1938 Double_t min = GetGeomCam().GetMinRadius(i); 1939 Double_t max = GetGeomCam().GetMaxRadius(i); 1940 1941 half[i]->SetLineColor(kRed+i); 1942 half[i]->SetDirectory(0); 1943 half[i]->SetBit(kCanDelete); 1944 half[i]->Draw("same"); 1945 half[i]->Fit("pol1","Q","",min,max); 1946 half[i]->GetFunction("pol1")->SetLineColor(kRed+i); 1947 half[i]->GetFunction("pol1")->SetLineWidth(1); 1963 1948 } 1964 1949 } … … 1974 1959 void MHCamera::DrawAzimuthProfile() const 1975 1960 { 1976 1977 TProfile *obj2 = (TProfile*)AzimuthProfile(GetName()); 1978 obj2->SetDirectory(0); 1979 obj2->Draw(); 1980 obj2->SetBit(kCanDelete); 1981 obj2->Fit("pol0","Q",""); 1982 obj2->GetFunction("pol0")->SetLineWidth(1); 1983 1984 if (GetGeomCam().InheritsFrom("MGeomCamMagic")) 1985 { 1986 1987 TArrayI inner(1); 1988 inner[0] = 0; 1989 1990 TArrayI outer(1); 1991 outer[0] = 1; 1992 1993 // Just to get the right (maximum) binning 1994 TProfile *half[2]; 1995 half[0] = AzimuthProfileA(inner,Form("%s%s",GetName(),"Inner")); 1996 half[1] = AzimuthProfileA(outer,Form("%s%s",GetName(),"Outer")); 1997 1998 for (Int_t i=0; i<2; i++) 1961 TProfile *obj2 = (TProfile*)AzimuthProfile(GetName()); 1962 obj2->SetDirectory(0); 1963 obj2->Draw(); 1964 obj2->SetBit(kCanDelete); 1965 obj2->Fit("pol0","Q",""); 1966 obj2->GetFunction("pol0")->SetLineWidth(1); 1967 1968 if (GetGeomCam().InheritsFrom("MGeomCamMagic")) 1969 { 1970 TArrayI inner(1); 1971 inner[0] = 0; 1972 1973 TArrayI outer(1); 1974 outer[0] = 1; 1975 1976 // Just to get the right (maximum) binning 1977 TProfile *half[2]; 1978 half[0] = AzimuthProfileA(inner,Form("%sInner",GetName())); 1979 half[1] = AzimuthProfileA(outer,Form("%sOuter",GetName())); 1980 1981 for (Int_t i=0; i<2; i++) 1999 1982 { 2000 half[i]->SetLineColor(kRed+i);2001 half[i]->SetDirectory(0);2002 half[i]->SetBit(kCanDelete);2003 half[i]->SetMarkerSize(0.5);2004 half[i]->Draw("same");1983 half[i]->SetLineColor(kRed+i); 1984 half[i]->SetDirectory(0); 1985 half[i]->SetBit(kCanDelete); 1986 half[i]->SetMarkerSize(0.5); 1987 half[i]->Draw("same"); 2005 1988 } 2006 1989 } … … 2028 2011 TObject *notify) 2029 2012 { 2030 2031 c.cd(x); 2032 gPad->SetBorderMode(0); 2033 gPad->SetTicks(); 2034 MHCamera *obj1=(MHCamera*)DrawCopy("hist"); 2035 obj1->SetDirectory(NULL); 2036 2037 if (notify) 2038 obj1->AddNotify(notify); 2039 2040 c.cd(x+y); 2041 gPad->SetBorderMode(0); 2042 obj1->SetPrettyPalette(); 2043 obj1->Draw(); 2044 2045 Int_t cnt = 2; 2046 2047 if (rad) 2048 { 2049 c.cd(x+2*y); 2050 gPad->SetBorderMode(0); 2051 gPad->SetTicks(); 2052 DrawRadialProfile(); 2053 cnt++; 2054 } 2055 2056 if (azi) 2057 { 2058 c.cd(x+cnt*y); 2059 gPad->SetBorderMode(0); 2060 gPad->SetTicks(); 2061 DrawAzimuthProfile(); 2062 cnt++; 2063 } 2064 2065 if (!fit) 2066 return; 2067 2068 c.cd(x + cnt*y); 2069 gPad->SetBorderMode(0); 2070 gPad->SetTicks(); 2071 DrawProjection(fit); 2072 } 2073 2074 2013 c.cd(x); 2014 gPad->SetBorderMode(0); 2015 gPad->SetTicks(); 2016 MHCamera *obj1=(MHCamera*)DrawCopy("hist"); 2017 obj1->SetDirectory(NULL); 2018 2019 if (notify) 2020 obj1->AddNotify(notify); 2021 2022 c.cd(x+y); 2023 gPad->SetBorderMode(0); 2024 obj1->SetPrettyPalette(); 2025 obj1->Draw(); 2026 2027 Int_t cnt = 2; 2028 2029 if (rad) 2030 { 2031 c.cd(x+2*y); 2032 gPad->SetBorderMode(0); 2033 gPad->SetTicks(); 2034 DrawRadialProfile(); 2035 cnt++; 2036 } 2037 2038 if (azi) 2039 { 2040 c.cd(x+cnt*y); 2041 gPad->SetBorderMode(0); 2042 gPad->SetTicks(); 2043 DrawAzimuthProfile(); 2044 cnt++; 2045 } 2046 2047 if (!fit) 2048 return; 2049 2050 c.cd(x + cnt*y); 2051 gPad->SetBorderMode(0); 2052 gPad->SetTicks(); 2053 DrawProjection(fit); 2054 } -
trunk/MagicSoft/Mars/mjobs/JobsLinkDef.h
r4190 r4601 4 4 #pragma link off all classes; 5 5 #pragma link off all functions; 6 7 #pragma link C++ class MSequence+; 6 8 7 9 #pragma link C++ class MJPedestal+; -
trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
r4562 r4601 44 44 #include "MLogManip.h" 45 45 46 #include "MTaskEnv.h" 47 #include "MSequence.h" 46 48 #include "MRunIter.h" 47 49 #include "MParList.h" … … 86 88 // 87 89 MJPedestal::MJPedestal(const char *name, const char *title) 88 : fEnv(0), fRuns(0), f Extractor(NULL), fDisplayType(kNormalDisplay),90 : fEnv(0), fRuns(0), fSequence(0), fExtractor(NULL), fDisplayType(kNormalDisplay), 89 91 fDataCheck(kFALSE) 90 92 { … … 101 103 const char* MJPedestal::GetOutputFile() const 102 104 { 105 if (fSequence) 106 return Form("%s/calped%05d", (const char*)fOutputPath, fSequence->GetSequence()); 107 103 108 if (!fRuns) 104 109 return ""; … … 143 148 } 144 149 145 146 150 void MJPedestal::DisplayResult(MParList &plist) 147 151 { … … 154 158 TString title = fDisplay->GetTitle(); 155 159 title += "-- Pedestal "; 156 if (fRuns) // FIXME: What to do if an environmentfile was used? 157 title += fRuns->GetRunsAsString(); 160 if (fSequence) 161 title += fSequence->GetName(); 162 else 163 if (fRuns) // FIXME: What to do if an environmentfile was used? 164 title += fRuns->GetRunsAsString(); 158 165 title += " --"; 159 166 fDisplay->SetTitle(title); … … 242 249 c3.cd(6); 243 250 gPad->SetBorderMode(0); 244 gPad->SetTicks();245 246 TArrayI inner(1);247 inner[0] = 0;248 249 TArrayI outer(1);250 outer[0] = 1;251 251 252 252 if (geomcam.InheritsFrom("MGeomCamMagic")) 253 253 { 254 TArrayI inner(1); 255 inner[0] = 0; 256 257 TArrayI outer(1); 258 outer[0] = 1; 259 254 260 TArrayI s0(6); 255 261 s0[0] = 6; … … 270 276 s2[2] = 5; 271 277 272 gPad->Clear();273 278 TVirtualPad *pad = gPad; 274 279 pad->Divide(2,1); … … 278 283 inout[1] = disp1.ProjectionS(s0, outer, "Outer"); 279 284 280 inout[0]->SetDirectory(NULL);281 inout[1]->SetDirectory(NULL);282 283 285 for (int i=0; i<2; i++) 284 286 { 285 TLegend *leg2 = new TLegend(0.6,0.2,0.9,0.55);286 leg2->SetHeader(inout[i]->GetName());287 287 pad->cd(i+1); 288 gPad->SetBorderMode(0); 289 gPad->SetTicks(); 290 291 inout[i]->SetDirectory(NULL); 288 292 inout[i]->SetLineColor(kRed+i); 289 293 inout[i]->SetBit(kCanDelete); 290 294 inout[i]->Draw(); 291 inout[i]->Fit("gaus","Q"); 292 leg2->AddEntry(inout[i],inout[i]->GetName(),"l"); 295 inout[i]->Fit("gaus", "Q"); 296 297 TLegend *leg2 = new TLegend(0.6,0.2,0.9,0.55); 298 leg2->SetHeader(inout[i]->GetName()); 299 leg2->AddEntry(inout[i], inout[i]->GetName(), "l"); 293 300 294 301 // … … 310 317 half[j]->SetBit(kCanDelete); 311 318 half[j]->Draw("same"); 312 leg2->AddEntry(half[j], half[j]->GetName(),"l");319 leg2->AddEntry(half[j], half[j]->GetName(), "l"); 313 320 } 314 321 leg2->Draw(); … … 419 426 Bool_t MJPedestal::ProcessFile() 420 427 { 421 if (!fRuns && !fEnv )422 { 423 *fLog << err << "Neither AddRuns was called nor SetEnv was used... abort." << endl;424 return kFALSE; 425 } 426 if ( fRuns && fRuns->GetNumRuns() != fRuns->GetNumEntries())428 if (!fRuns && !fEnv && !fSequence) 429 { 430 *fLog << err << "Neither AddRuns nor SetSequence nor SetEnv was called... abort." << endl; 431 return kFALSE; 432 } 433 if (!fSequence && fRuns && fRuns->GetNumRuns() != fRuns->GetNumEntries()) 427 434 { 428 435 *fLog << err << "Number of files found doesn't match number of runs... abort." << endl; … … 433 440 fLog->Separator(GetDescriptor()); 434 441 *fLog << "Calculate MPedestalCam from Runs "; 435 if (f Runs)436 *fLog << f Runs->GetRunsAsString() << endl;442 if (fSequence) 443 *fLog << fSequence->GetName() << endl; 437 444 else 438 *fLog << "in " << fEnv->GetName() << endl; 445 if (fRuns) 446 *fLog << fRuns->GetRunsAsString() << endl; 447 else 448 *fLog << "in " << fEnv->GetName() << endl; 439 449 *fLog << endl; 440 450 … … 446 456 MRawFileRead rawread(NULL); 447 457 458 MDirIter iter; 459 if (fSequence) 460 fSequence->SetupPedRuns(iter); 461 448 462 if (fDataCheck) 449 463 { 450 if (fRuns )451 rawread.AddFiles( *fRuns);452 464 if (fRuns || fSequence) 465 rawread.AddFiles(fSequence ? iter : *fRuns); 466 tlist.AddToList(&rawread); 453 467 } 454 468 else 455 469 { 456 470 read.DisableAutoScheme(); 457 if (fRuns )458 static_cast<MRead&>(read).AddFiles( *fRuns);471 if (fRuns || fSequence) 472 static_cast<MRead&>(read).AddFiles(fSequence ? iter : *fRuns); 459 473 tlist.AddToList(&read); 460 474 } … … 468 482 MGeomApply geomapl; 469 483 MBadPixelsMerge merge(&fBadPixels); 484 470 485 MPedCalcPedRun pedcalc; 486 487 MTaskEnv taskenv("ExtractPedestal"); 488 taskenv.SetDefault(&pedcalc); 471 489 472 490 if (fExtractor) … … 483 501 tlist.AddToList(&geomapl); 484 502 tlist.AddToList(&merge); 485 tlist.AddToList(& pedcalc);503 tlist.AddToList(&taskenv); 486 504 487 505 // -
trunk/MagicSoft/Mars/mjobs/MJPedestal.h
r4562 r4601 12 12 class TCanvas; 13 13 class MParList; 14 class MSequence; 14 15 class MRunIter; 15 16 class MHCamera; … … 36 37 37 38 TEnv *fEnv; // Input setup-file 39 MRunIter *fRuns; 40 MSequence *fSequence; // 38 41 39 MRunIter *fRuns;40 42 MExtractor *fExtractor; // Signal extractor, used to find the nr. of used FADC slices 41 43 … … 70 72 71 73 void SetBadPixels(const MBadPixelsCam &bad) { bad.Copy(fBadPixels); } 72 void SetExtractor(MExtractor* ext ) { fExtractor = ext;}74 void SetExtractor(MExtractor* ext) { fExtractor = ext; } 73 75 void SetInput(MRunIter *iter) { fRuns = iter; } 76 void SetSequence(MSequence *seq) { fSequence = seq; } 74 77 void SetOutputPath(const char *path="."); 75 78 void SetEnv(const char *env); -
trunk/MagicSoft/Mars/mjobs/Makefile
r4190 r4601 25 25 #manalysis: MChisqEval (MParameters) 26 26 27 SRCFILES = MJPedestal.cc \ 27 SRCFILES = MSequence.cc \ 28 MJPedestal.cc \ 28 29 MJCalibration.cc \ 29 30 MJExtractSignal.cc \ -
trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc
r4565 r4601 114 114 // fLoGainWindowSize = fgLoGainWindowSize = 0 115 115 // 116 // Variables: 117 // fgHiGainFirst; First FADC slice Hi-Gain (currently set to: 3) 118 // fgHiGainLast: Last FADC slice Hi-Gain (currently set to: 14) 119 // fgLoGainFirst: First FADC slice Lo-Gain (currently set to: 3) 120 // fgLoGainLast: Last FADC slice Lo-Gain (currently set to: 14) 121 // fgHiGainWindowSize: The extraction window Hi-Gain 122 // fgLoGainWindowSize: The extraction window Lo-Gain 123 // fgMaxHiGainVar: The maximum difference between the highest and lowest slice 124 // in the high gain window allowed in order to use low gain 125 // 116 126 // Input Containers: 117 127 // MRawEvtData … … 201 211 fRunHeader = NULL; 202 212 fPedestals = NULL; 213 214 // If the size is yet set, set the size 215 if (fSumx.GetSize()>0) 216 { 217 // Reset contents of arrays. 218 fSumx.Reset(); 219 fSumx2.Reset(); 220 fSumAB0.Reset(); 221 fSumAB1.Reset(); 222 fNumEventsUsed.Reset(); 223 fTotalCounter.Reset(); 224 } 203 225 } 204 226 … … 297 319 // - MPedestalCam 298 320 // 299 Int_t MPedCalcFromLoGain::PreProcess( MParList *pList ) 300 { 301 Clear(); 302 303 fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData"); 304 if (!fRawEvt) 305 { 306 *fLog << err << "MRawEvtData not found... aborting." << endl; 307 return kFALSE; 308 } 309 310 fRunHeader = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader")); 311 if (!fRunHeader) 312 { 313 *fLog << err << AddSerialNumber("MRawRunHeader") << " not found... aborting." << endl; 314 return kFALSE; 315 } 316 317 fGeom = (MGeomCam*)pList->FindObject("MGeomCam"); 318 if (!fGeom) 319 { 320 *fLog << err << "MGeomCam not found... aborting." << endl; 321 return kFALSE; 322 } 323 324 *fLog << " searching for the container " << fPedContainerName << endl; 325 326 fPedestals = (MPedestalCam*)pList->FindCreateObj( AddSerialNumber("MPedestalCam"),fPedContainerName); 327 if (!fPedestals) 328 { 329 *fLog << err << fPedContainerName << " can not be created" << endl; 330 return kFALSE; 331 } 332 333 334 return kTRUE; 321 Int_t MPedCalcFromLoGain::PreProcess(MParList *pList) 322 { 323 Clear(); 324 325 fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData"); 326 if (!fRawEvt) 327 { 328 *fLog << err << "MRawEvtData not found... aborting." << endl; 329 return kFALSE; 330 } 331 332 fRunHeader = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader")); 333 if (!fRunHeader) 334 { 335 *fLog << err << AddSerialNumber("MRawRunHeader") << " not found... aborting." << endl; 336 return kFALSE; 337 } 338 339 fGeom = (MGeomCam*)pList->FindObject("MGeomCam"); 340 if (!fGeom) 341 { 342 *fLog << err << "MGeomCam not found... aborting." << endl; 343 return kFALSE; 344 } 345 346 fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam", AddSerialNumber(fPedContainerName)); 347 if (!fPedestals) 348 return kFALSE; 349 350 return kTRUE; 335 351 } 336 352 … … 353 369 Bool_t MPedCalcFromLoGain::ReInit(MParList *pList) 354 370 { 355 356 371 Int_t lastdesired = (Int_t)fLoGainLast; 357 372 Int_t lastavailable = (Int_t)fRunHeader->GetNumSamplesLoGain()-1; … … 413 428 414 429 415 Int_t npixels = fPedestals->GetSize(); 416 430 // If the size is not yet set, set the size 417 431 if (fSumx.GetSize()==0) 418 { 432 { 433 const Int_t npixels = fPedestals->GetSize(); 434 419 435 fSumx. Set(npixels); 420 436 fSumx2.Set(npixels); … … 423 439 fNumEventsUsed.Set(npixels); 424 440 fTotalCounter.Set(npixels); 425 441 442 // Reset contents of arrays. 426 443 fSumx.Reset(); 427 444 fSumx2.Reset(); … … 430 447 fNumEventsUsed.Reset(); 431 448 fTotalCounter.Reset(); 432 433 434 if (fWindowSizeHiGain == 0 && fWindowSizeLoGain ==0)435 436 *fLog << err << GetDescriptor() 449 } 450 451 if (fWindowSizeHiGain==0 && fWindowSizeLoGain==0) 452 { 453 *fLog << err << GetDescriptor() 437 454 << ": Number of extracted Slices is 0, abort ... " << endl; 438 455 return kFALSE; 439 } 440 441 456 } 457 442 458 *fLog << endl; 443 459 *fLog << inf << GetDescriptor() << ": Taking " << (int)fWindowSizeHiGain … … 449 465 } 450 466 467 void MPedCalcFromLoGain::Calc(ULong_t n, UInt_t idx) 468 { 469 const ULong_t nsamplestot = n*fWindowSizeLoGain; 470 471 const Float_t sum = fSumx.At(idx); 472 const Float_t sum2 = fSumx2.At(idx); 473 const Float_t ped = sum/nsamplestot; 474 475 // 1. Calculate the Variance of the sums: 476 Float_t var = (sum2-sum*sum/n)/(n-1.); 477 478 // 2. Scale the variance to the number of slices: 479 var /= (Float_t)(fWindowSizeLoGain); 480 481 // 3. Calculate the RMS from the Variance: 482 const Float_t rms = var<0 ? 0 : TMath::Sqrt(var); 483 484 // 4. Calculate the amplitude of the 150MHz "AB" noise 485 const Float_t abOffs = (fSumAB0[idx] - fSumAB1[idx]) / nsamplestot; 486 487 (*fPedestals)[idx].Set(ped, rms, abOffs, n); 488 489 fTotalCounter[idx]++; 490 } 491 451 492 // -------------------------------------------------------------------------- 452 493 // … … 457 498 Int_t MPedCalcFromLoGain::Process() 458 499 { 459 MRawEvtPixelIter pixel(fRawEvt); 460 461 while (pixel.Next()) { 500 MRawEvtPixelIter pixel(fRawEvt); 501 502 while (pixel.Next()) 503 { 504 const UInt_t idx = pixel.GetPixelId(); 505 506 Byte_t *ptr = pixel.GetHiGainSamples() + fHiGainFirst; 507 Byte_t *end = ptr + fWindowSizeHiGain; 508 509 UInt_t sum = 0; 510 UInt_t sqr = 0; 511 512 UInt_t max = 0; 513 UInt_t min = 255; 462 514 463 const UInt_t idx = pixel.GetPixelId(); 464 465 Byte_t *ptr = pixel.GetHiGainSamples() + fHiGainFirst; 466 Byte_t *end = ptr + fWindowSizeHiGain; 467 468 UInt_t sum = 0; 469 UInt_t sqr = 0; 470 471 UInt_t max = 0; 472 UInt_t min = 255; 473 474 // Find the maximum and minimum signal per slice in the high gain window 475 do { 476 if (*ptr > max) { 477 max = *ptr; 478 } 479 if (*ptr < min) { 480 min = *ptr; 481 } 482 } while (++ptr != end); 483 484 // If the maximum in the high gain window is smaller than 485 if ((max-min < fMaxHiGainVar) && (max < 255)) { 486 487 Byte_t *firstSlice = pixel.GetLoGainSamples() + fLoGainFirst; 488 Byte_t *lastSlice = firstSlice + fWindowSizeLoGain; 489 490 Byte_t *slice = firstSlice; 491 do { 492 sum += *slice; 493 sqr += *slice * *slice; 494 } while (++slice != lastSlice); 495 496 const Float_t msum = (Float_t)sum; 497 const Float_t sqrsum = msum*msum; 498 499 fSumx[idx] += msum; 500 fSumx2[idx] += sqrsum; 501 fNumEventsUsed[idx]++; 502 503 // Calculate the amplitude of the 150MHz "AB" noise 504 505 Int_t abFlag = (fRunHeader->GetNumSamplesHiGain() 506 + fLoGainFirst 507 + pixel.HasABFlag()) & 0x1; 508 for (Int_t islice=0; islice<fWindowSizeLoGain; islice+=2) { 509 Int_t sliceAB0 = islice + abFlag; 510 Int_t sliceAB1 = islice + 1 - abFlag; 511 fSumAB0[idx] += firstSlice[sliceAB0]; 512 fSumAB1[idx] += firstSlice[sliceAB1]; 513 } 514 515 if (fPedestalUpdate && (fNumEventsUsed[idx] >= fNumEventsDump)) { 516 517 const ULong_t n = fNumEventsDump; 518 519 const ULong_t nsamplestot = n*fWindowSizeLoGain; 520 521 const Float_t sum = fSumx.At(idx); 522 const Float_t sum2 = fSumx2.At(idx); 523 const Float_t ped = sum/(nsamplestot); 524 525 // 1. Calculate the Variance of the sums: 526 Float_t var = (sum2-sum*sum/n)/(n-1.); 527 528 // 2. Scale the variance to the number of slices: 529 var /= (Float_t)(fWindowSizeLoGain); 530 531 // 3. Calculate the RMS from the Variance: 532 Float_t rms = var < 0 ? 0. : TMath::Sqrt(var); 533 534 // 4. Calculate the amplitude of the 150MHz "AB" noise 535 Float_t abOffs = (fSumAB0[idx] - fSumAB1[idx]) / nsamplestot; 536 537 (*fPedestals)[idx].Set(ped, rms, abOffs, n); 538 539 fTotalCounter[idx]++; 540 fNumEventsUsed[idx]=0; 541 fSumx[idx]=0; 542 fSumx2[idx]=0; 543 fSumAB0[idx]=0; 544 fSumAB1[idx]=0; 545 } 546 } 547 } 548 549 fPedestals->SetReadyToSave(); 550 551 return kTRUE; 515 // Find the maximum and minimum signal per slice in the high gain window 516 do { 517 if (*ptr > max) { 518 max = *ptr; 519 } 520 if (*ptr < min) { 521 min = *ptr; 522 } 523 } while (++ptr != end); 524 525 // If the maximum in the high gain window is smaller than 526 if (max-min>=fMaxHiGainVar || max>=255) 527 continue; 528 529 Byte_t *firstSlice = pixel.GetLoGainSamples() + fLoGainFirst; 530 Byte_t *lastSlice = firstSlice + fWindowSizeLoGain; 531 532 Byte_t *slice = firstSlice; 533 do { 534 sum += *slice; 535 sqr += *slice * *slice; 536 } while (++slice != lastSlice); 537 538 const Float_t msum = (Float_t)sum; 539 const Float_t sqrsum = msum*msum; 540 541 fSumx[idx] += msum; 542 fSumx2[idx] += sqrsum; 543 fNumEventsUsed[idx]++; 544 545 // Calculate the amplitude of the 150MHz "AB" noise 546 547 Int_t abFlag = (fRunHeader->GetNumSamplesHiGain() 548 + fLoGainFirst 549 + pixel.HasABFlag()) & 0x1; 550 for (Int_t islice=0; islice<fWindowSizeLoGain; islice+=2) 551 { 552 Int_t sliceAB0 = islice + abFlag; 553 Int_t sliceAB1 = islice - abFlag + 1; 554 fSumAB0[idx] += firstSlice[sliceAB0]; 555 fSumAB1[idx] += firstSlice[sliceAB1]; 556 } 557 558 if (!fPedestalUpdate || fNumEventsUsed[idx]<fNumEventsDump) 559 continue; 560 561 Calc(fNumEventsDump, idx); 562 563 fNumEventsUsed[idx]=0; 564 fSumx[idx]=0; 565 fSumx2[idx]=0; 566 fSumAB0[idx]=0; 567 fSumAB1[idx]=0; 568 } 569 570 if (fPedestalUpdate) 571 fPedestals->SetReadyToSave(); 572 573 return kTRUE; 552 574 } 553 575 … … 558 580 Int_t MPedCalcFromLoGain::PostProcess() 559 581 { 560 561 // Compute pedestals and rms from the whole run 562 563 if (!fPedestalUpdate) { 564 565 MRawEvtPixelIter pixel(fRawEvt); 566 567 while (pixel.Next()) { 568 569 const Int_t idx = pixel.GetPixelId(); 570 571 const ULong_t n = fNumEventsUsed[idx]; 572 573 if (n < 2) 574 continue; 575 576 const ULong_t nsamplestot = n*fWindowSizeLoGain; 577 578 const Float_t sum = fSumx.At(idx); 579 const Float_t sum2 = fSumx2.At(idx); 580 const Float_t ped = sum/(nsamplestot); 581 582 // 1. Calculate the Variance of the sums: 583 Float_t var = (sum2-sum*sum/n)/(n-1.); 584 585 // 2. Scale the variance to the number of slices: 586 var /= (Float_t)(fWindowSizeLoGain); 587 588 // 3. Calculate the RMS from the Variance: 589 Float_t rms = var < 0 ? 0. : TMath::Sqrt(var); 590 591 // 4. Calculate the amplitude of the 150MHz "AB" noise 592 Float_t abOffs = (fSumAB0[idx] - fSumAB1[idx]) / nsamplestot; 593 594 (*fPedestals)[idx].Set(ped, rms, abOffs, n); 595 596 fTotalCounter[idx]++; 582 // Compute pedestals and rms from the whole run 583 if (fPedestalUpdate) 584 return kTRUE; 585 586 *fLog << flush << inf << "Calculating Pedestals..." << flush; 587 588 const Int_t npix = fGeom->GetNumPixels(); 589 for (Int_t idx=0; idx<npix; idx++) 590 { 591 const ULong_t n = fNumEventsUsed[idx]; 592 if (n>1) 593 Calc(n, idx); 597 594 } 598 595 599 596 fPedestals->SetReadyToSave(); 600 } 601 602 fSumx.Reset(); 603 fSumx2.Reset(); 604 fSumAB0.Reset(); 605 fSumAB1.Reset(); 606 fNumEventsUsed.Reset(); 607 fTotalCounter.Reset(); 608 609 return kTRUE; 610 } 597 return kTRUE; 598 } 599 600 Int_t MPedCalcFromLoGain::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 601 { 602 if (MExtractor::ReadEnv(env, prefix, print)==kERROR) 603 return kERROR; 604 605 Bool_t rc=kFALSE; 606 607 Byte_t hw = fWindowSizeHiGain; 608 Byte_t lw = fWindowSizeLoGain; 609 if (IsEnvDefined(env, prefix, "WindowSizeHiGain", print)) 610 { 611 hw = GetEnvValue(env, prefix, "WindowSizeHiGain", hw); 612 rc = kTRUE; 613 } 614 if (IsEnvDefined(env, prefix, "WindowSizeLoGain", print)) 615 { 616 lw = GetEnvValue(env, prefix, "WindowSizeLoGain", lw); 617 rc = kTRUE; 618 } 619 620 if (rc) 621 SetWindowSize(hw, lw); 622 623 Int_t num = fNumEventsDump; 624 if (IsEnvDefined(env, prefix, "NumEventsDump", print)) 625 { 626 num = GetEnvValue(env, prefix, "NumEventsDump", num); 627 rc = kTRUE; 628 } 629 SetDumpEvents(num); 630 631 Byte_t max = fMaxHiGainVar; 632 if (IsEnvDefined(env, prefix, "MaxHiGainVar", print)) 633 { 634 max = GetEnvValue(env, prefix, "MaxHiGainVar", max); 635 rc = kTRUE; 636 } 637 SetMaxHiGainVar(max); 638 639 Bool_t upd = fPedestalUpdate; 640 if (IsEnvDefined(env, prefix, "PedestalUpdate", print)) 641 { 642 upd = GetEnvValue(env, prefix, "PedestalUpdate", upd); 643 rc = kTRUE; 644 } 645 SetPedestalUpdate(upd); 646 647 return rc; 648 } -
trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.h
r4565 r4601 19 19 class MPedCalcFromLoGain : public MExtractor 20 20 { 21 static const Byte_t fgHiGainFirst; // First FADC slice Hi-Gain (currently set to: 3) 22 static const Byte_t fgHiGainLast; // Last FADC slice Hi-Gain (currently set to: 14) 23 static const Byte_t fgLoGainFirst; // First FADC slice Lo-Gain (currently set to: 3) 24 static const Byte_t fgLoGainLast; // Last FADC slice Lo-Gain (currently set to: 14) 25 static const Byte_t fgHiGainWindowSize; // The extraction window Hi-Gain 26 static const Byte_t fgLoGainWindowSize; // The extraction window Lo-Gain 27 static const Byte_t fgMaxHiGainVar; // The maximum difference between the highest and lowest slice 28 // in the high gain window allowed in order to use low gain 21 static const Byte_t fgHiGainFirst; // First FADC slice Hi-Gain (currently set to: 3) 22 static const Byte_t fgHiGainLast; // Last FADC slice Hi-Gain (currently set to: 14) 23 static const Byte_t fgLoGainFirst; // First FADC slice Lo-Gain (currently set to: 3) 24 static const Byte_t fgLoGainLast; // Last FADC slice Lo-Gain (currently set to: 14) 25 static const Byte_t fgHiGainWindowSize; // The extraction window Hi-Gain 26 static const Byte_t fgLoGainWindowSize; // The extraction window Lo-Gain 27 static const Byte_t fgMaxHiGainVar; // The maximum difference between the highest and lowest slice 29 28 30 Int_t fNumEventsDump;// Number of event after which MPedestalCam gets updated29 Int_t fNumEventsDump; // Number of event after which MPedestalCam gets updated 31 30 32 Byte_t fMaxHiGainVar;33 Byte_t fWindowSizeHiGain;// Number of Hi Gain slices in window34 Byte_t fWindowSizeLoGain;// Number of Lo Gain slices in window31 Byte_t fMaxHiGainVar; 32 Byte_t fWindowSizeHiGain; // Number of Hi Gain slices in window 33 Byte_t fWindowSizeLoGain; // Number of Lo Gain slices in window 35 34 36 Bool_t fPedestalUpdate;35 Bool_t fPedestalUpdate; 37 36 38 MGeomCam *fGeom; // Camera geometry 39 TString fPedContainerName; // name of the 'MPedestalCam' container 40 41 TArrayI fNumEventsUsed; // Number of events used for pedestal calc for each pixel 42 TArrayI fTotalCounter; // Counter for dumping values to Pedestal Container 43 TArrayD fSumx; // sum of values 44 TArrayD fSumx2; // sum of squared values 45 TArrayD fSumAB0; // sum of ABFlag=0 slices 46 TArrayD fSumAB1; // sum of ABFlag=1 slices 37 MGeomCam *fGeom; // Camera geometry 38 TString fPedContainerName; // name of the 'MPedestalCam' container 47 39 48 49 Int_t PreProcess (MParList *pList); 50 Bool_t ReInit (MParList *pList); 51 Int_t Process (); 52 Int_t PostProcess(); 53 40 TArrayI fNumEventsUsed; // Number of events used for pedestal calc for each pixel 41 TArrayI fTotalCounter; // Counter for dumping values to Pedestal Container 42 TArrayD fSumx; // sum of values 43 TArrayD fSumx2; // sum of squared values 44 TArrayD fSumAB0; // sum of ABFlag=0 slices 45 TArrayD fSumAB1; // sum of ABFlag=1 slices 46 47 // MParContainer 48 Int_t PreProcess (MParList *pList); 49 Bool_t ReInit (MParList *pList); 50 Int_t Process (); 51 Int_t PostProcess(); 52 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 53 54 // Calculation 55 void Calc(ULong_t n, UInt_t idx); 56 54 57 public: 55 MPedCalcFromLoGain(const char *name=NULL, const char *title=NULL); 56 57 void Clear(const Option_t *o=""); 58 void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0); 59 void SetWindowSize(Byte_t windowh=0, Byte_t windowl=0); 60 void SetMaxHiGainVar(Byte_t maxvar=0); 61 void SetDumpEvents(UInt_t dumpevents = 0) {fNumEventsDump = dumpevents;} 62 void SetPedestalUpdate(Bool_t pedupdate) {fPedestalUpdate = pedupdate;} 63 64 void SetPedContainerName(const char *name) { fPedContainerName = name; } 58 MPedCalcFromLoGain(const char *name=NULL, const char *title=NULL); 65 59 66 TArrayI *GetNumEventsUsed() {return &fNumEventsUsed;}; 67 68 ClassDef(MPedCalcFromLoGain, 0) // Task to calculate pedestals from pedestal runs raw data 60 // TObject 61 void Clear(const Option_t *o=""); 62 63 // Setter 64 void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0); 65 void SetWindowSize(Byte_t windowh=0, Byte_t windowl=0); 66 void SetMaxHiGainVar(Byte_t maxvar=0); 67 void SetDumpEvents(UInt_t dumpevents = 0) {fNumEventsDump = dumpevents;} 68 void SetPedestalUpdate(Bool_t pedupdate) {fPedestalUpdate = pedupdate;} 69 70 void SetPedContainerName(const char *name) { fPedContainerName = name; } 71 72 // Getter 73 TArrayI *GetNumEventsUsed() { return &fNumEventsUsed; } 74 75 ClassDef(MPedCalcFromLoGain, 0) // Task to calculate pedestals from pedestal runs raw data 69 76 }; 70 77 -
trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc
r4556 r4601 443 443 while (pixel.Next()) 444 444 { 445 446 445 const UInt_t idx = pixel.GetPixelId(); 447 446 const UInt_t aidx = (*fGeom)[idx].GetAidx(); … … 620 619 return kTRUE; 621 620 } 621 622 Int_t MPedCalcPedRun::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 623 { 624 if (MExtractor::ReadEnv(env, prefix, print)==kERROR) 625 return kERROR; 626 627 Byte_t hw = fWindowSizeHiGain; 628 Byte_t lw = fWindowSizeLoGain; 629 630 Bool_t rc = kFALSE; 631 632 if (IsEnvDefined(env, prefix, "WindowSizeHiGain", print)) 633 { 634 hw = GetEnvValue(env, prefix, "WindowSizeHiGain", hw); 635 rc=kTRUE; 636 } 637 638 if (IsEnvDefined(env, prefix, "WindowSizeLoGain", print)) 639 { 640 lw = GetEnvValue(env, prefix, "WindowSizeLoGain", lw); 641 rc=kTRUE; 642 } 643 644 if (rc) 645 SetWindowSize(hw, lw); 646 647 return rc; 648 } -
trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.h
r4556 r4601 44 44 Int_t Process (); 45 45 Int_t PostProcess(); 46 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 46 47 47 48 public: -
trunk/MagicSoft/Mars/mraw/MRawCrateData.cc
r3800 r4601 75 75 { 76 76 *fLog << all; 77 *fLog << "Crate Number" << dec << fDAQCrateNumber << ": ";78 *fLog << "FADCEventNr 79 *fLog << "FADCClockTick = " << fFADCClockTick << " (20MHz) " << endl;80 *fLog << "ABFlags = " << hex << fABFlags<< endl;77 *fLog << "Crate #" << dec << fDAQCrateNumber << ": "; 78 *fLog << "FADCEventNr = " << fFADCEvtNumber << " "; 79 *fLog << "FADCClockTick = " << fFADCClockTick << " (20MHz) "; 80 *fLog << "ABFlags = 0x" << Form("%02x", fABFlags) << endl; 81 81 } -
trunk/MagicSoft/Mars/mraw/MRawFileRead.h
r4115 r4601 29 29 30 30 public: 31 MRawFileRead(const char *filename , const char *name=NULL, const char *title=NULL);31 MRawFileRead(const char *filename=NULL, const char *name=NULL, const char *title=NULL); 32 32 ~MRawFileRead(); 33 33 -
trunk/MagicSoft/Mars/msignal/MExtractor.cc
r4586 r4601 302 302 // MJPedestal.MExtractor.SaturationLimit: 88 303 303 // 304 Bool_t MExtractor::ReadEnv(const TEnv &env, TString prefix, Bool_t print)304 Int_t MExtractor::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 305 305 { 306 306 Byte_t hf = fHiGainFirst; … … 309 309 Byte_t ll = fLoGainLast; 310 310 311 Bool_t rc = kFALSE; 312 311 313 if (IsEnvDefined(env, prefix, "HiGainFirst", print)) 314 { 312 315 hf = GetEnvValue(env, prefix, "HiGainFirst", hf); 316 rc = kTRUE; 317 } 313 318 if (IsEnvDefined(env, prefix, "LoGainFirst", print)) 319 { 314 320 lf = GetEnvValue(env, prefix, "LoGainFirst", lf); 321 rc = kTRUE; 322 } 315 323 316 324 if (IsEnvDefined(env, prefix, "HiGainLast", print)) 325 { 317 326 hl = GetEnvValue(env, prefix, "HiGainLast", hl); 327 rc = kTRUE; 328 } 318 329 if (IsEnvDefined(env, prefix, "LoGainLast", print)) 330 { 319 331 ll = GetEnvValue(env, prefix, "LoGainLast", ll); 332 rc = kTRUE; 333 } 320 334 321 335 SetRange(hf, hl, lf, ll); 322 336 323 337 if (IsEnvDefined(env, prefix, "SaturationLimit", print)) 338 { 324 339 SetSaturationLimit(GetEnvValue(env, prefix, "SaturationLimit", fSaturationLimit)); 325 326 return kTRUE; 327 } 340 rc = kTRUE; 341 } 342 343 return rc; 344 } -
trunk/MagicSoft/Mars/msignal/MExtractor.h
r4586 r4601 55 55 Int_t Process(); 56 56 void StreamPrimitive(ofstream &out) const; 57 Bool_tReadEnv(const TEnv &env, TString prefix, Bool_t print);57 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 58 58 59 59 public:
Note:
See TracChangeset
for help on using the changeset viewer.