Changeset 1652 for trunk/MagicSoft/Mars/mhist/MHFadcPix.cc
- Timestamp:
- 11/20/02 12:18:01 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHFadcPix.cc
r1303 r1652 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@ uni-sw.gwdg.de>18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! Author(s): Harald Kornmayer 1/2001 20 20 ! 21 ! Copyright: MAGIC Software Development, 2000-200 121 ! Copyright: MAGIC Software Development, 2000-2002 22 22 ! 23 23 ! … … 28 28 // MHFadcPix 29 29 // 30 // This container stores a h ostogram to display an Fadc Spekrtum.30 // This container stores a histogram to display an Fadc Spektrum. 31 31 // The spektrum of all the values measured by the Fadcs. 32 32 // 33 33 /////////////////////////////////////////////////////////////////////// 34 35 34 #include "MHFadcPix.h" 36 35 37 #include <TH1.h>38 36 #include <TPad.h> 39 37 40 38 #include "MH.h" 39 #include "MBinning.h" 40 41 #include "MRawEvtData.h" 42 #include "MRawEvtPixelIter.h" 41 43 42 44 ClassImp(MHFadcPix); … … 46 48 // Creates the histograms for lo and hi gain of one pixel 47 49 // 48 MHFadcPix::MHFadcPix(UInt_t pixid) : fPixId(pixid) 50 MHFadcPix::MHFadcPix(UInt_t pixid, Type_t t) 51 : fPixId(pixid), fType(t) 49 52 { 50 fHistHi = new TH1F(pixid ? Form("HiGain%03d", pixid) : "HiGain",51 pixid ? Form("Hi Gain Pixel #%d", pixid) : "Hi Gain Samples",52 256, -.5, 255.5);53 fHistHi.SetName(pixid ? Form("HiGain%03d", pixid) : "HiGain"); 54 fHistHi.SetTitle(pixid ? Form("Hi Gain Pixel #%d", pixid) : "Hi Gain Samples"); 55 fHistHi.SetDirectory(NULL); 53 56 54 fHist Hi->SetDirectory(NULL);55 fHist Hi->SetXTitle("Signal/FADC Units");56 fHist Hi->SetYTitle("Count");57 fHistLo.SetName(pixid ? Form("LoGain%03d", pixid) : "LoGain"); 58 fHistLo.SetTitle(pixid ? Form("Lo Gain Pixel #%d", pixid) : "Lo Gain Samples"); 59 fHistLo.SetDirectory(NULL); 57 60 58 fHistLo = new TH1F(pixid ? Form("LoGain%03d", pixid) : "LoGain", 59 pixid ? Form("Lo Gain Pixel #%d", pixid) : "Lo Gain Samples", 60 256, -.5, 255.5); 61 if (fType==kValue) 62 { 63 fHistHi.SetXTitle("Signal/FADC Units"); 64 fHistLo.SetXTitle("Signal/FADC Units"); 65 fHistHi.SetYTitle("Count"); 66 fHistLo.SetYTitle("Count"); 61 67 62 fHistLo->SetDirectory(NULL); 63 fHistLo->SetXTitle("Signal/FADC Units"); 64 fHistLo->SetYTitle("Count"); 68 MBinning bins; 69 bins.SetEdges(255, -.5, 255.5); 70 71 bins.Apply(fHistHi); 72 bins.Apply(fHistLo); 73 } 74 else 75 { 76 fHistHi.SetXTitle("Time/FADC Slices"); 77 fHistLo.SetXTitle("Time/FADC Slices"); 78 fHistLo.SetYTitle("Sum Signal/FADC Units"); 79 fHistHi.SetYTitle("Sum Signal/FADC Units"); 80 } 65 81 } 66 82 67 // -------------------------------------------------------------------------- 68 MHFadcPix::~MHFadcPix() 83 void MHFadcPix::Init(Byte_t nhi, Byte_t nlo) 69 84 { 70 delete fHistHi; 71 delete fHistLo; 85 MBinning bins; 86 87 bins.SetEdges(nhi, -.5, -.5+nhi); 88 bins.Apply(fHistHi); 89 90 bins.SetEdges(nlo, -.5, -.5+nlo); 91 bins.Apply(fHistLo); 72 92 } 73 93 74 // -------------------------------------------------------------------------- 75 void MHFadcPix::FillHi(Byte_t i) 94 Bool_t MHFadcPix::Fill(const MRawEvtData &evt) 76 95 { 77 fHistHi->Fill(i); 78 } 96 MRawEvtPixelIter pixel((MRawEvtData*)&evt); 79 97 80 // -------------------------------------------------------------------------- 81 void MHFadcPix::FillLo(Byte_t i) 82 { 83 fHistLo->Fill(i); 98 if (!pixel.Jump(fPixId)) 99 return kTRUE; 100 101 const Int_t nhisamples = evt.GetNumHiGainSamples(); 102 103 if (fType==kValue) 104 for (Int_t i=0; i<nhisamples; i++) 105 fHistHi.Fill(pixel.GetHiGainSamples()[i]); 106 else 107 for (Int_t i=0; i<nhisamples; i++) 108 fHistHi.Fill(i, pixel.GetHiGainSamples()[i]); 109 110 if (!pixel.HasLoGain()) 111 return kTRUE; 112 113 const Int_t nlosamples = evt.GetNumLoGainSamples(); 114 115 if (fType==kValue) 116 for (Int_t i=0; i<nlosamples; i++) 117 fHistLo.Fill(pixel.GetLoGainSamples()[i]); 118 else 119 for (Int_t i=0; i<nlosamples; i++) 120 fHistLo.Fill(i, pixel.GetLoGainSamples()[i]); 121 122 return kTRUE; 84 123 } 85 124 … … 87 126 void MHFadcPix::DrawHi() 88 127 { 89 fHistHi ->Draw();128 fHistHi.Draw(); 90 129 } 91 130 … … 93 132 void MHFadcPix::DrawLo() 94 133 { 95 fHistLo ->Draw();134 fHistLo.Draw(); 96 135 } 97 136 … … 105 144 MHFadcPix &pix = *(MHFadcPix*)TObject::Clone(); 106 145 107 pix.fHistHi ->SetDirectory(NULL);108 pix.fHistLo ->SetDirectory(NULL);146 pix.fHistHi.SetDirectory(NULL); 147 pix.fHistLo.SetDirectory(NULL); 109 148 110 149 return &pix; … … 116 155 if (!gPad) 117 156 { 118 const char *name 157 const char *name = StrDup(fPixId ? Form("Pixel #%d", fPixId) : "Pixel"); 119 158 MH::MakeDefCanvas(name, fPixId ? Form("%s FADC Samples", name) : "FADC Samples"); 120 159 delete [] name; … … 124 163 125 164 gPad->cd(1); 126 fHistHi ->Draw();165 fHistHi.Draw(); 127 166 128 167 gPad->cd(2); 129 fHistLo ->Draw();168 fHistLo.Draw(); 130 169 }
Note:
See TracChangeset
for help on using the changeset viewer.