| 1 | /* ======================================================================== *\
|
|---|
| 2 | !
|
|---|
| 3 | ! *
|
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
|---|
| 8 | ! *
|
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its
|
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee,
|
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and
|
|---|
| 12 | ! * that both that copyright notice and this permission notice appear
|
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express
|
|---|
| 14 | ! * or implied warranty.
|
|---|
| 15 | ! *
|
|---|
| 16 | !
|
|---|
| 17 | !
|
|---|
| 18 | ! Author(s): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de)
|
|---|
| 19 | ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)
|
|---|
| 20 | !
|
|---|
| 21 | ! Copyright: MAGIC Software Development, 2000-2001
|
|---|
| 22 | !
|
|---|
| 23 | !
|
|---|
| 24 | \* ======================================================================== */
|
|---|
| 25 |
|
|---|
| 26 | ///////////////////////////////////////////////////////////////////////
|
|---|
| 27 | //
|
|---|
| 28 | // MHFadcCam
|
|---|
| 29 | //
|
|---|
| 30 | // This class contains a list of MHFadcPix.
|
|---|
| 31 | //
|
|---|
| 32 | ///////////////////////////////////////////////////////////////////////
|
|---|
| 33 |
|
|---|
| 34 | #include "MHFadcCam.h"
|
|---|
| 35 |
|
|---|
| 36 | #include <TH1.h>
|
|---|
| 37 |
|
|---|
| 38 | #include "MRawEvtData.h"
|
|---|
| 39 | #include "MRawEvtPixelIter.h"
|
|---|
| 40 |
|
|---|
| 41 | ClassImp(MHFadcCam);
|
|---|
| 42 |
|
|---|
| 43 | // --------------------------------------------------------------------------
|
|---|
| 44 | //
|
|---|
| 45 | // default constructor
|
|---|
| 46 | // creates an a list of histograms for all pixels and both gain channels
|
|---|
| 47 | //
|
|---|
| 48 | MHFadcCam::MHFadcCam (const char *name, const char *title)
|
|---|
| 49 | {
|
|---|
| 50 | //
|
|---|
| 51 | // set the name and title of this object
|
|---|
| 52 | //
|
|---|
| 53 |
|
|---|
| 54 | *fName = name ? name : "MHFadcCam" ;
|
|---|
| 55 | *fTitle = title ? title : "Container for ADC spectra histograms" ;
|
|---|
| 56 |
|
|---|
| 57 | //
|
|---|
| 58 | // loop over all Pixels and create two histograms
|
|---|
| 59 | // one for the Low and one for the High gain
|
|---|
| 60 | // connect all the histogram with the container fHist
|
|---|
| 61 | //
|
|---|
| 62 | fArray = new TObjArray(577);
|
|---|
| 63 |
|
|---|
| 64 | for (Int_t i=0; i<577; i++)
|
|---|
| 65 | (*fArray)[i] = new MHFadcPix(i);
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | // --------------------------------------------------------------------------
|
|---|
| 69 | MHFadcCam::~MHFadcCam ()
|
|---|
| 70 | {
|
|---|
| 71 | delete fArray;
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | void MHFadcCam::Fill(const MParContainer *par)
|
|---|
| 75 | {
|
|---|
| 76 | MRawEvtData *evt = (MRawEvtData*)par;
|
|---|
| 77 |
|
|---|
| 78 | MRawEvtPixelIter pixel(evt);
|
|---|
| 79 |
|
|---|
| 80 | const Int_t nhisamples = evt->GetNumHiGainSamples();
|
|---|
| 81 | const Int_t nlosamples = evt->GetNumLoGainSamples();
|
|---|
| 82 |
|
|---|
| 83 | while (pixel.Next())
|
|---|
| 84 | {
|
|---|
| 85 | const UInt_t id = pixel.GetPixelId();
|
|---|
| 86 |
|
|---|
| 87 | for (Int_t i=0; i<nhisamples; i++)
|
|---|
| 88 | FillHi(id, pixel.GetHiGainFadcSamples()[i]);
|
|---|
| 89 |
|
|---|
| 90 | if (!pixel.HasLoGain())
|
|---|
| 91 | continue;
|
|---|
| 92 |
|
|---|
| 93 | for (Int_t i=0; i<nlosamples; i++)
|
|---|
| 94 | FillLo(id, pixel.GetLoGainFadcSamples()[i]);
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 | }
|
|---|
| 98 | /*void MHFadcCam::SaveHist(char *name)
|
|---|
| 99 | {
|
|---|
| 100 | //
|
|---|
| 101 | // save all histogram in this class to a root file
|
|---|
| 102 | //
|
|---|
| 103 |
|
|---|
| 104 | //
|
|---|
| 105 | // FIXME: Don't open a file and write to this file!
|
|---|
| 106 | // just Fill the current container (or the two histograms
|
|---|
| 107 | // to an open file. The user must choose a file before.
|
|---|
| 108 | //
|
|---|
| 109 | TFile out( name, "recreate") ;
|
|---|
| 110 |
|
|---|
| 111 | //
|
|---|
| 112 | // loop over all pixels and write the files out
|
|---|
| 113 | //
|
|---|
| 114 |
|
|---|
| 115 | fHistLo->Write() ;
|
|---|
| 116 | fHistHi->Write() ;
|
|---|
| 117 | }
|
|---|
| 118 |
|
|---|
| 119 | */ |
|---|