| 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 | // MFillHFadc
|
|---|
| 29 | //
|
|---|
| 30 | // This task fill the n time slices from all pixels
|
|---|
| 31 | // (stored in a MRawEvtData container) into histograms.
|
|---|
| 32 | // This histograms (one per pixel) are stored in MHFadcCam, MHFadcPix
|
|---|
| 33 | //
|
|---|
| 34 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 35 |
|
|---|
| 36 | #include "MFillHFadc.h"
|
|---|
| 37 |
|
|---|
| 38 | #include "MLog.h"
|
|---|
| 39 | #include "MLogManip.h"
|
|---|
| 40 | #include "MParList.h"
|
|---|
| 41 | #include "MHFadcCam.h"
|
|---|
| 42 | #include "MRawEvtData.h"
|
|---|
| 43 | #include "MRawEvtPixelIter.h"
|
|---|
| 44 |
|
|---|
| 45 | ClassImp(MFillHFadc)
|
|---|
| 46 |
|
|---|
| 47 | // --------------------------------------------------------------------------
|
|---|
| 48 | MFillHFadc::MFillHFadc (const char *name, const char *title) : fRawEvtData(NULL)
|
|---|
| 49 | {
|
|---|
| 50 | *fName = name ? name : "MFillHFadc";
|
|---|
| 51 | *fTitle = title ? title : "Task to fill the adc spectra with raw data";
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | // --------------------------------------------------------------------------
|
|---|
| 55 | //
|
|---|
| 56 | // The PrProcess function checks for the existance of all necessary
|
|---|
| 57 | // parameter containers
|
|---|
| 58 | //
|
|---|
| 59 | Bool_t MFillHFadc::PreProcess (MParList *pList)
|
|---|
| 60 | {
|
|---|
| 61 | //
|
|---|
| 62 | // check if all necessary input containers are existing
|
|---|
| 63 | //
|
|---|
| 64 | fRawEvtData = (MRawEvtData*)pList->FindCreateObj("MRawEvtData");
|
|---|
| 65 | if (!fRawEvtData)
|
|---|
| 66 | {
|
|---|
| 67 | *fLog << dbginf << " Error: MRawEvtData not found... exit." << endl;
|
|---|
| 68 | return kFALSE;
|
|---|
| 69 | }
|
|---|
| 70 |
|
|---|
| 71 | //
|
|---|
| 72 | // check if the output containers are existing, if not craete them
|
|---|
| 73 | //
|
|---|
| 74 | fHistos = (MHFadcCam*)pList->FindCreateObj("MHFadcCam");
|
|---|
| 75 | if (!fHistos)
|
|---|
| 76 | return kFALSE;
|
|---|
| 77 |
|
|---|
| 78 | return kTRUE;
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | // --------------------------------------------------------------------------
|
|---|
| 82 | //
|
|---|
| 83 | // This process function loops over all pixels in an MRawEvtData
|
|---|
| 84 | // event and fills the values into histograms
|
|---|
| 85 | //
|
|---|
| 86 | Bool_t MFillHFadc::Process()
|
|---|
| 87 | {
|
|---|
| 88 | // loop over the pixels and fill the values in the histograms
|
|---|
| 89 |
|
|---|
| 90 | MRawEvtPixelIter pixel(fRawEvtData);
|
|---|
| 91 |
|
|---|
| 92 | const Int_t nhisamples = fRawEvtData->GetNumHiGainSamples() ;
|
|---|
| 93 | const Int_t nlosamples = fRawEvtData->GetNumLoGainSamples() ;
|
|---|
| 94 |
|
|---|
| 95 | while ( pixel.Next() )
|
|---|
| 96 | {
|
|---|
| 97 | const UInt_t id = pixel.GetPixelId();
|
|---|
| 98 |
|
|---|
| 99 | for (Int_t i=0; i<nhisamples; i++)
|
|---|
| 100 | fHistos->FillHi(id, pixel.GetHiGainFadcSamples()[i]);
|
|---|
| 101 |
|
|---|
| 102 | if (!pixel.HasLoGain())
|
|---|
| 103 | continue;
|
|---|
| 104 |
|
|---|
| 105 | for (Int_t i=0; i<nlosamples; i++)
|
|---|
| 106 | fHistos->FillLo(id, pixel.GetLoGainFadcSamples()[i]);
|
|---|
| 107 | }
|
|---|
| 108 |
|
|---|
| 109 | return kTRUE;
|
|---|
| 110 | }
|
|---|
| 111 |
|
|---|
| 112 | Bool_t MFillHFadc::PostProcess()
|
|---|
| 113 | {
|
|---|
| 114 | fHistos->SetHasChanged();
|
|---|
| 115 | return kTRUE;
|
|---|
| 116 | }
|
|---|