| 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): Sebastian Raducci 12/2003 <mailto:raducci@fisica.uniud.it>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2002-2003
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | //
|
|---|
| 27 | // MArrivalTimeCalc
|
|---|
| 28 | //
|
|---|
| 29 | // This is a task that calculates the arrival times of photons.
|
|---|
| 30 | // For now, it returns the number of time slice containig the maximum value.
|
|---|
| 31 | //
|
|---|
| 32 | // P R E L I M I N A R Y
|
|---|
| 33 | // Other more sophisticated methods have to be implemented.
|
|---|
| 34 | //
|
|---|
| 35 | // Input Containers:
|
|---|
| 36 | // MRawEvtData
|
|---|
| 37 | //
|
|---|
| 38 | // Output Containers:
|
|---|
| 39 | // MArrivalTime
|
|---|
| 40 | //
|
|---|
| 41 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 42 |
|
|---|
| 43 | #include "MArrivalTime.h"
|
|---|
| 44 | #include "MArrivalTimeCalc.h"
|
|---|
| 45 |
|
|---|
| 46 | #include "MParList.h"
|
|---|
| 47 |
|
|---|
| 48 | #include "MLog.h"
|
|---|
| 49 | #include "MLogManip.h"
|
|---|
| 50 |
|
|---|
| 51 | #include "MGeomCam.h"
|
|---|
| 52 | #include "MMcRunHeader.hxx"
|
|---|
| 53 |
|
|---|
| 54 | #include "MRawRunHeader.h"
|
|---|
| 55 | #include "MRawEvtData.h" // MRawEvtData::GetNumPixels
|
|---|
| 56 | #include "MCameraData.h"
|
|---|
| 57 | #include "MRawEvtPixelIter.h"
|
|---|
| 58 |
|
|---|
| 59 | ClassImp(MArrivalTimeCalc);
|
|---|
| 60 |
|
|---|
| 61 | using namespace std;
|
|---|
| 62 |
|
|---|
| 63 | // --------------------------------------------------------------------------
|
|---|
| 64 | //
|
|---|
| 65 | // Default constructor.
|
|---|
| 66 | //
|
|---|
| 67 | MArrivalTimeCalc::MArrivalTimeCalc(const char *name, const char *title)
|
|---|
| 68 | {
|
|---|
| 69 | fName = name ? name : "MArrivalTimeCalc";
|
|---|
| 70 | fTitle = title ? title : "Calculate photons arrival time";
|
|---|
| 71 |
|
|---|
| 72 | AddToBranchList("MRawEvtData.fHiGainPixId");
|
|---|
| 73 | AddToBranchList("MRawEvtData.fLoGainPixId");
|
|---|
| 74 | AddToBranchList("MRawEvtData.fHiGainFadcSamples");
|
|---|
| 75 | AddToBranchList("MRawEvtData.fLoGainFadcSamples");
|
|---|
| 76 |
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | // --------------------------------------------------------------------------
|
|---|
| 80 | //
|
|---|
| 81 | // The PreProcess searches for the following input containers:
|
|---|
| 82 | // - MRawRunHeader
|
|---|
| 83 | // - MRawEvtData
|
|---|
| 84 | // - MArrivalTime
|
|---|
| 85 | // - MGeomCam
|
|---|
| 86 | //
|
|---|
| 87 | // The following output containers are also searched and created if
|
|---|
| 88 | // they were not found:
|
|---|
| 89 | // - MArrivalTime
|
|---|
| 90 | //
|
|---|
| 91 | Int_t MArrivalTimeCalc::PreProcess(MParList *pList)
|
|---|
| 92 | {
|
|---|
| 93 | fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
|
|---|
| 94 | if (!fRunHeader)
|
|---|
| 95 | {
|
|---|
| 96 | *fLog << err << "MRawRunHeader not found... aborting." << endl;
|
|---|
| 97 | return kFALSE;
|
|---|
| 98 | }
|
|---|
| 99 |
|
|---|
| 100 | fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData"));
|
|---|
| 101 | if (!fRawEvt)
|
|---|
| 102 | {
|
|---|
| 103 | *fLog << err << "MRawEvtData not found... aborting." << endl;
|
|---|
| 104 | return kFALSE;
|
|---|
| 105 | }
|
|---|
| 106 |
|
|---|
| 107 | fGeom = (MGeomCam*)pList->FindObject("MGeomCam");
|
|---|
| 108 | if (!fGeom)
|
|---|
| 109 | {
|
|---|
| 110 | *fLog << err << "MGeomCam not found... aborting." << endl;
|
|---|
| 111 | return kFALSE;
|
|---|
| 112 | }
|
|---|
| 113 |
|
|---|
| 114 | fArrTime = (MArrivalTime*)pList->FindCreateObj(AddSerialNumber("MArrivalTime"));
|
|---|
| 115 | if (!fArrTime)
|
|---|
| 116 | return kFALSE;
|
|---|
| 117 |
|
|---|
| 118 | return kTRUE;
|
|---|
| 119 | }
|
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 | // --------------------------------------------------------------------------
|
|---|
| 123 | // Evaluation of the mean arrival times (for now it stands for the maximum in slices units)
|
|---|
| 124 | // per pixel and store them in the MArrivalTime container.
|
|---|
| 125 | //
|
|---|
| 126 | Int_t MArrivalTimeCalc::Process()
|
|---|
| 127 | {
|
|---|
| 128 | MRawEvtPixelIter pixel(fRawEvt);
|
|---|
| 129 |
|
|---|
| 130 | fArrTime->Calc((const MRawEvtData&) *fRawEvt,(const MGeomCam&) *fGeom);
|
|---|
| 131 |
|
|---|
| 132 | fArrTime->SetReadyToSave();
|
|---|
| 133 |
|
|---|
| 134 | return kTRUE;
|
|---|
| 135 | }
|
|---|