Changeset 2128 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 05/21/03 12:21:58 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHBlindPixels.cc
r2112 r2128 1 1 2 /* ======================================================================== *\ 2 3 ! … … 32 33 #include <TCanvas.h> 33 34 35 #include "MMcEvt.hxx" 34 36 #include "MBlindPixels.h" 37 #include "MPedestalCam.h" 38 #include "MParList.h" 39 #include "MBinning.h" 40 41 #include "MLog.h" 42 #include "MLogManip.h" 35 43 36 44 ClassImp(MHBlindPixels); … … 41 49 // 42 50 MHBlindPixels::MHBlindPixels(const char *name, const char *title) 43 : fHist(fName, fTitle, 577, -.5, 577-.5)44 51 { 45 52 fName = name ? name : "MHBlindPixels"; 46 fTitle = title ? title : "Histogram for Blind Pixels ";53 fTitle = title ? title : "Histogram for Blind Pixels vs. Theta"; 47 54 48 55 // - we initialize the histogram 49 // - we have to give dif erent names for the diferent histograms because56 // - we have to give different names for the different histograms because 50 57 // root don't allow us to have diferent histograms with the same name 51 58 52 fHist.SetName("1D-BlindPixels"); 53 fHist.SetTitle(fTitle); 59 fBlindId.SetName("2D-IdBlindPixels"); 60 fBlindId.SetTitle("2D-IdBlindPixels"); 61 fBlindId.SetDirectory(NULL); 62 fBlindId.SetXTitle("\\Theta [\\circ]"); 63 fBlindId.SetYTitle("pixel Id"); 54 64 55 fHist.SetDirectory(NULL); 65 fBlindN.SetName("2D-NBlindPixels"); 66 fBlindN.SetTitle("2D-NBlindPixels"); 67 fBlindN.SetDirectory(NULL); 68 fBlindN.SetXTitle("\\Theta [\\circ]"); 69 fBlindN.SetYTitle("number of blind pixels"); 70 } 56 71 57 fHist.SetXTitle("Id"); 58 fHist.SetYTitle("Counts"); 72 // -------------------------------------------------------------------------- 73 // 74 // Set the binnings and prepare the filling of the histogram 75 // 76 Bool_t MHBlindPixels::SetupFill(const MParList *plist) 77 { 78 fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt"); 79 if (!fMcEvt) 80 { 81 *fLog << err << "MMcEvt not found... aborting." << endl; 82 return kFALSE; 83 } 84 85 fPed = (MPedestalCam*)plist->FindObject("MPedestalCam"); 86 if (!fPed) 87 { 88 *fLog << err << "MPedestalCam not found... aborting." << endl; 89 return kFALSE; 90 } 91 92 93 // Get Theta Binning 94 MBinning* binstheta = (MBinning*)plist->FindObject("BinningTheta", "MBinning"); 95 if (!binstheta) 96 { 97 *fLog << err << "Object 'BinningTheta' [MBinning] not found... aborting" << endl; 98 return kFALSE; 99 } 100 101 // Get binning for pixel number 102 const UInt_t npix1 = fPed->GetSize()+1; 103 104 MBinning binspix("BinningPixel"); 105 binspix.SetEdges(npix1, -0.5, npix1-0.5); 106 107 // Set binnings in histograms 108 SetBinning(&fBlindId, binstheta, &binspix); 109 SetBinning(&fBlindN, binstheta, &binspix); 110 111 return kTRUE; 59 112 } 60 113 … … 68 121 pad->SetBorderMode(0); 69 122 70 fHist.Draw(option); 123 pad->Divide(2,2); 124 125 TH1D *h; 126 127 pad->cd(1); 128 fBlindId.Draw(option); 129 130 pad->cd(2); 131 fBlindN.Draw(option); 132 133 pad->cd(3); 134 gPad->SetBorderMode(0); 135 h = ((TH2*)&fBlindId)->ProjectionY("ProjY-pixId", -1, 9999, ""); 136 h->SetDirectory(NULL); 137 h->SetTitle("Distribution of blind pixel Id"); 138 h->SetXTitle("Id of blind pixel"); 139 h->SetYTitle("No. of events"); 140 h->Draw(option); 141 h->SetBit(kCanDelete); 142 143 pad->cd(4); 144 gPad->SetBorderMode(0); 145 h = ((TH2*)&fBlindN)->ProjectionY("ProjY-pixN", -1, 9999, ""); 146 h->SetDirectory(NULL); 147 h->SetTitle("Distribution of no.of blind pixels"); 148 h->SetXTitle("No. of blind pixels"); 149 h->SetYTitle("No. of events"); 150 h->Draw(option); 151 h->SetBit(kCanDelete); 71 152 72 153 pad->Modified(); … … 79 160 return kFALSE; 80 161 162 Double_t theta = fMcEvt->GetTelescopeTheta()*kRad2Deg; 81 163 const MBlindPixels &bp = *(MBlindPixels*)par; 82 164 83 165 // FIXME: Slow. 84 for (int i=0; i<577; i++) 166 const UInt_t npix = fPed->GetSize(); 167 168 UInt_t nb = 0; 169 for (UInt_t i=0; i<npix; i++) 170 { 85 171 if (bp.IsBlind(i)) 86 fHist.Fill(i, w); 172 { 173 fBlindId.Fill(theta, i, w); 174 nb++; 175 } 176 } 177 fBlindN.Fill(theta, nb, w); 87 178 88 179 return kTRUE; 89 180 } 181 182 183 184 185 186 187 188 189 190 191 192 -
trunk/MagicSoft/Mars/mhist/MHBlindPixels.h
r2043 r2128 5 5 #include "MH.h" 6 6 #endif 7 #ifndef ROOT_TH 18 #include <TH 1.h>7 #ifndef ROOT_TH2 8 #include <TH2.h> 9 9 #endif 10 11 class MPedestalCam; 12 class MMcEvt; 13 class MParList; 14 10 15 11 16 class MHBlindPixels : public MH 12 17 { 13 18 private: 14 TH1D fHist; // 19 MPedestalCam *fPed; //! 20 MMcEvt *fMcEvt; //! 21 22 TH2D fBlindId; // 2D-histogram : pixel Id vs. Theta 23 TH2D fBlindN; // 2D-histogram : no.of blind pixels vs. Theta 15 24 16 25 public: 17 26 MHBlindPixels(const char *name=NULL, const char *title=NULL); 18 27 19 const TH 1D *GetHist() { return &fHist; }20 const TH 1D *GetHist() const { return &fHist; }28 const TH2D *GetBlindId() { return &fBlindId; } 29 const TH2D *GetBlindId() const { return &fBlindId; } 21 30 22 TH1 *GetHistByName(const TString name) { return &fHist; } 31 const TH2D *GetBlindN() { return &fBlindN; } 32 const TH2D *GetBlindN() const { return &fBlindN; } 33 34 TH2 *GetBlinIdByName(const TString name) { return &fBlindId; } 35 TH2 *GetBlinNByName(const TString name) { return &fBlindN; } 23 36 24 37 void Draw(Option_t* option = ""); 38 Bool_t SetupFill(const MParList *plist); 25 39 Bool_t Fill(const MParContainer *par, const Stat_t w=1); 26 40 27 ClassDef(MHBlindPixels, 1) // Histogram of blind pixel s41 ClassDef(MHBlindPixels, 1) // Histogram of blind pixel Id vs. Theta 28 42 }; 29 43 30 44 #endif 45 46 -
trunk/MagicSoft/Mars/mhist/MHMatrix.cc
r2104 r2128 788 788 // Calculate normalization factors 789 789 // 790 const int nbins = thsh.GetNbinsX(); 791 const double frombin = thsh.GetBinLowEdge(1); 792 const double tobin = thsh.GetBinLowEdge(nbins+1); 793 const double dbin = thsh.GetBinWidth(1); 790 //const int nbins = thsh.GetNbinsX(); 791 //const double frombin = thsh.GetBinLowEdge(1); 792 //const double tobin = thsh.GetBinLowEdge(nbins+1); 793 //const double dbin = thsh.GetBinWidth(1); 794 794 795 const Int_t nrows = fM.GetNrows(); 795 796 const Int_t ncols = fM.GetNcols(); … … 798 799 // set up the real histogram (distribution before) 799 800 // 800 TH1F hth("th", "Distribution before reduction", nbins, frombin, tobin); 801 //TH1F hth("th", "Distribution before reduction", nbins, frombin, tobin); 802 TH1F hth; 803 hth.SetNameTitle("th", "Distribution before reduction"); 804 SetBinning(&hth, &thsh); 801 805 hth.SetDirectory(NULL); 802 806 for (Int_t j=0; j<nrows; j++) 803 807 hth.Fill(fM(j, refcolumn)); 804 808 805 TH1F hthd("thd", "Correction factors", nbins, frombin, tobin); 809 //TH1F hthd("thd", "Correction factors", nbins, frombin, tobin); 810 TH1F hthd; 811 hthd.SetNameTitle("thd", "Correction factors"); 812 SetBinning(&hthd, &thsh); 806 813 hthd.SetDirectory(NULL); 807 814 hthd.Divide((TH1F*)&thsh, &hth, 1, 1); … … 840 847 TVector v(fM.GetNrows()); 841 848 v = TMatrixColumn(fM, refcolumn); 842 v += -frombin;843 v *= 1/dbin;849 //v += -frombin; 850 //v *= 1/dbin; 844 851 845 852 // … … 850 857 for (ir=0; ir<nrows; ir++) 851 858 { 852 const Int_t indref = (Int_t)v(ind[ir]);853 859 // const Int_t indref = (Int_t)v(ind[ir]); 860 const Int_t indref = hthd.FindBin(v(ind[ir])) - 1; 854 861 cumulweight[indref] += hthd.GetBinContent(indref+1); 855 862 if (cumulweight[indref]<=0.5) -
trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc
r2109 r2128 100 100 101 101 MBinning binspix("BinningPixel"); 102 binspix.SetEdges(57 7, -0.5, 577.5);102 binspix.SetEdges(578, -0.5, 577.5); 103 103 104 104 SetBinning(&fSigmaTheta, &binst, &binsb); … … 169 169 170 170 // Get binning for pixel number 171 const UInt_t npix = fPed->GetSize();171 const UInt_t npix1 = fPed->GetSize()+1; 172 172 173 173 MBinning binspix("BinningPixel"); 174 binspix.SetEdges(npix , -0.5, 0.5+npix);174 binspix.SetEdges(npix1, -0.5, npix1-0.5); 175 175 176 176 // Set binnings in histograms
Note:
See TracChangeset
for help on using the changeset viewer.