| 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): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2001
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | // //
|
|---|
| 27 | // MCerPhotCalc //
|
|---|
| 28 | // //
|
|---|
| 29 | // This is a task which calculates the number of photons from the FADC //
|
|---|
| 30 | // time slices. At the moment it integrates simply the FADC values. //
|
|---|
| 31 | // //
|
|---|
| 32 | // Input Containers: //
|
|---|
| 33 | // MRawEvtData, MPedesdtalCam //
|
|---|
| 34 | // //
|
|---|
| 35 | // Output Containers: //
|
|---|
| 36 | // MCerPhotEvt //
|
|---|
| 37 | // //
|
|---|
| 38 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 39 |
|
|---|
| 40 | #include "MCerPhotCalc.h"
|
|---|
| 41 |
|
|---|
| 42 | #include "MParList.h"
|
|---|
| 43 |
|
|---|
| 44 | #include "MLog.h"
|
|---|
| 45 | #include "MLogManip.h"
|
|---|
| 46 |
|
|---|
| 47 | #include "MRawEvtPixelIter.h"
|
|---|
| 48 | #include "MCerPhotEvt.h"
|
|---|
| 49 | #include "MPedestalPix.h"
|
|---|
| 50 | #include "MPedestalCam.h"
|
|---|
| 51 |
|
|---|
| 52 | ClassImp(MCerPhotCalc);
|
|---|
| 53 |
|
|---|
| 54 | // --------------------------------------------------------------------------
|
|---|
| 55 | //
|
|---|
| 56 | // Default constructor.
|
|---|
| 57 | //
|
|---|
| 58 | MCerPhotCalc::MCerPhotCalc(const char *name, const char *title)
|
|---|
| 59 | {
|
|---|
| 60 | *fName = name ? name : "MCerPhotCalc";
|
|---|
| 61 | *fTitle = title ? title : "Task to calculate Cerenkov photons from raw data";
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | // --------------------------------------------------------------------------
|
|---|
| 65 | //
|
|---|
| 66 | // The PreProcess searches for the following input containers:
|
|---|
| 67 | // - MRawEvtData
|
|---|
| 68 | // - MPedestalCam
|
|---|
| 69 | //
|
|---|
| 70 | // The following output containers are also searched and created if
|
|---|
| 71 | // they were not found:
|
|---|
| 72 | // - MCerPhotEvt
|
|---|
| 73 | //
|
|---|
| 74 | Bool_t MCerPhotCalc::PreProcess( MParList *pList )
|
|---|
| 75 | {
|
|---|
| 76 | fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
|
|---|
| 77 | if (!fRawEvt)
|
|---|
| 78 | {
|
|---|
| 79 | *fLog << dbginf << "MRawEvtData not found... aborting." << endl;
|
|---|
| 80 | return kFALSE;
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam");
|
|---|
| 84 | if (!fPedestals)
|
|---|
| 85 | {
|
|---|
| 86 | *fLog << dbginf << "MPedestalCam not found... aborting." << endl;
|
|---|
| 87 | return kFALSE;
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt");
|
|---|
| 91 | if (!fCerPhotEvt)
|
|---|
| 92 | return kFALSE;
|
|---|
| 93 |
|
|---|
| 94 | return kTRUE;
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 | // --------------------------------------------------------------------------
|
|---|
| 98 | //
|
|---|
| 99 | // Calculate the integral of the FADC time slaices and store them as a new
|
|---|
| 100 | // pixel in the MCerPhotEvt container.
|
|---|
| 101 | //
|
|---|
| 102 | Bool_t MCerPhotCalc::Process()
|
|---|
| 103 | {
|
|---|
| 104 | fCerPhotEvt->Clear();
|
|---|
| 105 |
|
|---|
| 106 | MRawEvtPixelIter pixel(fRawEvt);
|
|---|
| 107 |
|
|---|
| 108 | while (pixel.Next())
|
|---|
| 109 | {
|
|---|
| 110 | const UInt_t pixid = pixel.GetPixelId();
|
|---|
| 111 |
|
|---|
| 112 | const MPedestalPix &ped = (*fPedestals)[pixid];
|
|---|
| 113 |
|
|---|
| 114 | const Float_t nphot = (Float_t)pixel.GetSumHiGainFadcSamples() - ped.GetMean();
|
|---|
| 115 |
|
|---|
| 116 | fCerPhotEvt->AddPixel(pixid, nphot, ped.GetMeanRms());
|
|---|
| 117 |
|
|---|
| 118 | // FIXME! Handling of Lo Gains is missing!
|
|---|
| 119 | }
|
|---|
| 120 |
|
|---|
| 121 | fCerPhotEvt->SetReadyToSave();
|
|---|
| 122 |
|
|---|
| 123 | return kTRUE;
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|