Changeset 2128 for trunk/MagicSoft/Mars/mhist/MHBlindPixels.cc
- Timestamp:
- 05/21/03 12:21:58 (21 years ago)
- File:
-
- 1 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
Note:
See TracChangeset
for help on using the changeset viewer.