Changeset 1652 for trunk/MagicSoft
- Timestamp:
- 11/20/02 12:18:01 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHFadcCam.cc
r1629 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 ! … … 34 34 #include "MHFadcCam.h" 35 35 36 #include "MLog.h" 37 #include "MLogManip.h" 38 36 39 #include "MRawEvtData.h" 37 40 #include "MRawEvtPixelIter.h" … … 44 47 // creates an a list of histograms for all pixels and both gain channels 45 48 // 46 MHFadcCam::MHFadcCam(const char *name, const char *title) 49 MHFadcCam::MHFadcCam(MHFadcPix::Type_t t, const char *name, const char *title) 50 : fNumHiGains(-1), fNumLoGains(-1), fType(t) 47 51 { 48 52 // … … 60 64 61 65 for (Int_t i=0; i<577; i++) 62 (*fArray)[i] = new MHFadcPix(i+1 );66 (*fArray)[i] = new MHFadcPix(i+1, fType); 63 67 } 64 68 … … 89 93 Bool_t MHFadcCam::Fill(const MParContainer *par) 90 94 { 91 MRawEvtData *evt = (MRawEvtData*)par; 92 93 MRawEvtPixelIter pixel(evt); 94 95 const Int_t nhisamples = evt->GetNumHiGainSamples(); 96 const Int_t nlosamples = evt->GetNumLoGainSamples(); 97 98 while (pixel.Next()) 99 { 100 const UInt_t id = pixel.GetPixelId(); 101 102 for (Int_t i=0; i<nhisamples; i++) 103 FillHi(id, pixel.GetHiGainSamples()[i]); 104 105 if (!pixel.HasLoGain()) 106 continue; 107 108 for (Int_t i=0; i<nlosamples; i++) 109 FillLo(id, pixel.GetLoGainSamples()[i]); 110 } 111 112 return kTRUE; 95 return Fill((MRawEvtData*)par); 113 96 } 114 97 115 98 Bool_t MHFadcCam::Fill(const MRawEvtData *par) 116 99 { 117 return Fill((MParContainer*)par); 100 if (fType==MHFadcPix::kSlices) 101 { 102 const Int_t nlo = par->GetNumLoGainSamples(); 103 const Int_t nhi = par->GetNumHiGainSamples(); 104 105 // 106 // First call 107 // 108 if (fNumHiGains<0) 109 for (int i=0; i<577; i++) 110 (*this)[i].Init(nhi, nlo); 111 else 112 if (fNumHiGains!=nhi || fNumLoGains!=nlo) 113 { 114 *fLog << err << dbginf << "ERROR - Number of lo- or hi-gain samples changed." << endl; 115 return kFALSE; 116 } 117 118 fNumHiGains = nhi; 119 fNumLoGains = nlo; 120 } 121 122 for (int i=0; i<577; i++) 123 if (!(*this)[i].Fill(*par)) 124 return kFALSE; 125 126 return kTRUE; 118 127 } 119 128 -
trunk/MagicSoft/Mars/mhist/MHFadcCam.h
r1629 r1652 24 24 TObjArray *fArray; //-> List of Lo/Hi gain Histograms 25 25 26 void FillHi(UInt_t ipix, Byte_t data) { (*this)[ipix]->FillHi(data); } 27 void FillLo(UInt_t ipix, Byte_t data) { (*this)[ipix]->FillLo(data); } 26 // void FillHi(UInt_t ipix, Byte_t data) { (*this)[ipix]->FillHi(data); } 27 // void FillLo(UInt_t ipix, Byte_t data) { (*this)[ipix]->FillLo(data); } 28 29 Int_t fNumHiGains; //! 30 Int_t fNumLoGains; //! 31 32 MHFadcPix::Type_t fType; //! 28 33 29 34 public: 30 MHFadcCam( const char *name=NULL, const char *title=NULL);35 MHFadcCam(MHFadcPix::Type_t t=MHFadcPix::kValue, const char *name=NULL, const char *title=NULL); 31 36 ~MHFadcCam(); 32 37 33 MHFadcPix *operator[](UInt_t i) { return(MHFadcPix*)(fArray->At(i)); }34 const MHFadcPix *operator[](UInt_t i) const { return(MHFadcPix*)(fArray->At(i)); }38 MHFadcPix &operator[](UInt_t i) { return *(MHFadcPix*)(fArray->At(i)); } 39 const MHFadcPix &operator[](UInt_t i) const { return *(MHFadcPix*)(fArray->At(i)); } 35 40 36 TH1F *GetHistHi(UInt_t i) { return (*this)[i] ->GetHistHi(); }37 TH1F *GetHistLo(UInt_t i) { return (*this)[i] ->GetHistLo(); }41 TH1F *GetHistHi(UInt_t i) { return (*this)[i].GetHistHi(); } 42 TH1F *GetHistLo(UInt_t i) { return (*this)[i].GetHistLo(); } 38 43 39 const TH1F *GetHistHi(UInt_t i) const { return (*this)[i] ->GetHistHi(); }40 const TH1F *GetHistLo(UInt_t i) const { return (*this)[i] ->GetHistLo(); }44 const TH1F *GetHistHi(UInt_t i) const { return (*this)[i].GetHistHi(); } 45 const TH1F *GetHistLo(UInt_t i) const { return (*this)[i].GetHistLo(); } 41 46 42 47 Bool_t Fill(const MParContainer *par); … … 51 56 void DrawLo(UInt_t i) { GetHistLo(i)->Draw(); } 52 57 53 void DrawPix(UInt_t i) { (*this)[i] ->Draw(); }58 void DrawPix(UInt_t i) { (*this)[i].Draw(); } 54 59 55 60 Int_t GetEntries() const { return fArray->GetEntries(); } -
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 } -
trunk/MagicSoft/Mars/mhist/MHFadcPix.h
r1629 r1652 6 6 #endif 7 7 8 class TH1F; 8 #ifndef ROOT_TH1 9 #include <TH1.h> 10 #endif 11 12 class MRawEvtData; 9 13 10 14 class MHFadcPix : public MParContainer 11 15 { 16 public: 17 enum Type_t { kSlices, kValue }; 18 12 19 private: 13 TH1F *fHistHi;14 TH1F *fHistLo;20 TH1F fHistHi; 21 TH1F fHistLo; 15 22 16 23 UInt_t fPixId; 17 24 25 Type_t fType; 26 18 27 public: 19 MHFadcPix(UInt_t pixid=0); 20 ~MHFadcPix(); 28 MHFadcPix(UInt_t pixid=0, Type_t t=kValue); 21 29 22 TH1F *GetHistHi() { return fHistHi; }23 TH1F *GetHistLo() { return fHistLo; }30 TH1F *GetHistHi() { return &fHistHi; } 31 TH1F *GetHistLo() { return &fHistLo; } 24 32 25 const TH1F *GetHistHi() const { return fHistHi; }26 const TH1F *GetHistLo() const { return fHistLo; }33 const TH1F *GetHistHi() const { return &fHistHi; } 34 const TH1F *GetHistLo() const { return &fHistLo; } 27 35 28 void FillHi(Byte_t i);29 void FillLo(Byte_t i);36 void Init(Byte_t nhi, Byte_t nlo); 37 Bool_t Fill(const MRawEvtData &evt); 30 38 31 39 void DrawHi(); -
trunk/MagicSoft/Mars/mmain/MDataCheck.cc
r1603 r1652 31 31 #include "MFillH.h" 32 32 #include "MParList.h" 33 #include "MEvtLoop.h" 34 #include "MHFadcCam.h" 33 35 #include "MTaskList.h" 34 #include "MEvtLoop.h"35 36 #include "MReadTree.h" 36 37 #include "MGDisplayAdc.h" … … 58 59 { 59 60 TGTextButton *pedadc = new TGTextButton(fTop1, "ADC Spectra of Pedestals", kButPedAdc); 60 TGTextButton *cradc = new TGTextButton(fTop1, "ADC Spect a of Cosmics", kButEvtAdc);61 TGTextButton *pedtdc = new TGTextButton(fTop3, " TDCSpectra of Pedestals", kButPedTdc);62 TGTextButton *crtdc = new TGTextButton(fTop3, " TDC Specta of Cosmics", kButEvtTdc);61 TGTextButton *cradc = new TGTextButton(fTop1, "ADC Spectra of Cosmics", kButEvtAdc); 62 TGTextButton *pedtdc = new TGTextButton(fTop3, "Run Spectra of Pedestals", kButPedTdc); 63 TGTextButton *crtdc = new TGTextButton(fTop3, "Run Spectra of Cosmics", kButEvtTdc); 63 64 64 65 pedadc->Associate(this); … … 97 98 // histograms. 98 99 // 99 void MDataCheck::View AdcSpectra(const char *inputfile, const char *treeName)100 void MDataCheck::View(const char *inputfile, const char *treeName, MHFadcPix::Type_t t) 100 101 { 101 102 // … … 119 120 read.DisableAutoScheme(); 120 121 121 MFillH fill("MHFadcCam", "MRawEvtData"); 122 MHFadcCam hist(t); 123 plist.AddToList(&hist); 124 125 MFillH fill(&hist, "MRawEvtData"); 122 126 123 127 tasks.AddToList(&read); … … 149 153 return; 150 154 151 new MGDisplayAdc( (MHFadcCam*)plist.FindObject("MHFadcCam"));155 new MGDisplayAdc(&hist); 152 156 } 153 157 … … 178 182 { 179 183 case kButPedAdc: 180 View AdcSpectra(fInputFile, "PedEvents");184 View(fInputFile, "PedEvents", MHFadcPix::kValue); 181 185 return kTRUE; 182 186 183 187 case kButEvtAdc: 184 View AdcSpectra(fInputFile, "Events");188 View(fInputFile, "Events", MHFadcPix::kValue); 185 189 return kTRUE; 186 190 187 191 case kButPedTdc: 188 // fOctober.PedTdcSpectra(fInputFile);192 View(fInputFile, "PedEvents", MHFadcPix::kSlices); 189 193 return kTRUE; 190 194 191 195 case kButEvtTdc: 196 View(fInputFile, "Events", MHFadcPix::kSlices); 192 197 return kTRUE; 193 198 } -
trunk/MagicSoft/Mars/mmain/MDataCheck.h
r1210 r1652 6 6 #endif 7 7 8 #ifndef MARS_MHFadcPix 9 #include "MHFadcPix.h" 10 #endif 11 8 12 class MDataCheck : public MBrowser 9 13 { 10 14 private: 11 void View AdcSpectra(const char *inputfile, const char *treeName);15 void View(const char *inputfile, const char *treeName, MHFadcPix::Type_t t); 12 16 13 17 public:
Note:
See TracChangeset
for help on using the changeset viewer.