| 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): Markus Gaug 12/2003 <mailto:markus@ifae.es>
|
|---|
| 19 | ! Author(s): Thomas Bretz 12/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
|
|---|
| 20 | ! Author(s): Hendrik Bartko 02/2004 <mailto:hbartko@mppmu.mpg.de>
|
|---|
| 21 | !
|
|---|
| 22 | ! Copyright: MAGIC Software Development, 2000-2003
|
|---|
| 23 | !
|
|---|
| 24 | !
|
|---|
| 25 | \* ======================================================================== */
|
|---|
| 26 |
|
|---|
| 27 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 28 | //
|
|---|
| 29 | // MArrivalTimePix
|
|---|
| 30 | //
|
|---|
| 31 | // This is the storage container to hold informations about the ArrivalTime
|
|---|
| 32 | //
|
|---|
| 33 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 34 | #include "MArrivalTimePix.h"
|
|---|
| 35 |
|
|---|
| 36 | #include "MLog.h"
|
|---|
| 37 | #include "MLogManip.h"
|
|---|
| 38 |
|
|---|
| 39 | ClassImp(MArrivalTimePix);
|
|---|
| 40 |
|
|---|
| 41 | using namespace std;
|
|---|
| 42 |
|
|---|
| 43 | static const Float_t gkSignalInitializer = 99999.9;
|
|---|
| 44 |
|
|---|
| 45 | // ------------------------------------------------------------------------
|
|---|
| 46 | //
|
|---|
| 47 | // MArrivalTimePix holds the ArrivalTime (HiGain and LoGain)
|
|---|
| 48 | // of the FADC slices and its error.
|
|---|
| 49 | //
|
|---|
| 50 | // Additionally, the number of saturated HiGain and LoGain Slices are stored.
|
|---|
| 51 | //
|
|---|
| 52 | // Default values for the ArrivalTime are: 99999.9
|
|---|
| 53 | //
|
|---|
| 54 | MArrivalTimePix::MArrivalTimePix(const char* name, const char* title)
|
|---|
| 55 | {
|
|---|
| 56 | fName = name ? name : "MArrivalTimePix";
|
|---|
| 57 | fTitle = title ? title : "Container of the Extracted Signals";
|
|---|
| 58 |
|
|---|
| 59 | Clear();
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | // ------------------------------------------------------------------------
|
|---|
| 63 | //
|
|---|
| 64 | // Invalidate values
|
|---|
| 65 | //
|
|---|
| 66 | void MArrivalTimePix::Clear(Option_t *o)
|
|---|
| 67 | {
|
|---|
| 68 | fArrivalTimeHiGain = gkSignalInitializer;
|
|---|
| 69 | fArrivalTimeHiGainError = -1;
|
|---|
| 70 | fArrivalTimeLoGain = gkSignalInitializer;
|
|---|
| 71 | fArrivalTimeLoGainError = -1;
|
|---|
| 72 |
|
|---|
| 73 | fNumHiGainSaturated = 0;
|
|---|
| 74 | fNumLoGainSaturated = 0;
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | void MArrivalTimePix::SetArrivalTime(Float_t sig, Float_t sigerr)
|
|---|
| 78 | {
|
|---|
| 79 | fArrivalTimeHiGain = sig;
|
|---|
| 80 | fArrivalTimeHiGainError = sigerr;
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | void MArrivalTimePix::SetArrivalTime(Float_t sighi, Float_t sighierr,
|
|---|
| 84 | Float_t siglo, Float_t sigloerr)
|
|---|
| 85 | {
|
|---|
| 86 | fArrivalTimeHiGain = sighi;
|
|---|
| 87 | fArrivalTimeHiGainError = sighierr;
|
|---|
| 88 | fArrivalTimeLoGain = siglo;
|
|---|
| 89 | fArrivalTimeLoGainError = sigloerr;
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|
| 92 | Float_t MArrivalTimePix::GetArrivalTime() const
|
|---|
| 93 | {
|
|---|
| 94 | // If hi-gain is not saturated and has successfully been
|
|---|
| 95 | // extracted use the hi-gain arrival time
|
|---|
| 96 | if (!IsHiGainSaturated() && IsHiGainValid())
|
|---|
| 97 | return GetArrivalTimeHiGain();
|
|---|
| 98 |
|
|---|
| 99 | // If hi-gain could not be used ans the lo-gain could
|
|---|
| 100 | // not be extracted return
|
|---|
| 101 | if (!IsLoGainValid())
|
|---|
| 102 | return 0;
|
|---|
| 103 |
|
|---|
| 104 | // in all other cases use the lo-gain arrival time
|
|---|
| 105 | return GetArrivalTimeLoGain();
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | Bool_t MArrivalTimePix::IsArrivalTimeValid() const
|
|---|
| 109 | {
|
|---|
| 110 | // If hi-gain is not saturated and has successfully been
|
|---|
| 111 | // extracted use the hi-gain arrival time
|
|---|
| 112 | if (!IsHiGainSaturated() && IsHiGainValid())
|
|---|
| 113 | return kTRUE;
|
|---|
| 114 |
|
|---|
| 115 | // If hi-gain could not be used ans the lo-gain could
|
|---|
| 116 | // not be extracted return kFALSE (no valid arrival time)
|
|---|
| 117 | if (!IsLoGainValid())
|
|---|
| 118 | return kFALSE;
|
|---|
| 119 |
|
|---|
| 120 | // in all other cases use the lo-gain arrival time
|
|---|
| 121 | return kTRUE;
|
|---|
| 122 | }
|
|---|
| 123 |
|
|---|
| 124 | void MArrivalTimePix::SetGainSaturation(Byte_t higain, Byte_t logain)
|
|---|
| 125 | {
|
|---|
| 126 | fNumHiGainSaturated = higain;
|
|---|
| 127 | fNumLoGainSaturated = logain;
|
|---|
| 128 | }
|
|---|
| 129 |
|
|---|
| 130 | void MArrivalTimePix::Print(Option_t *o) const
|
|---|
| 131 | {
|
|---|
| 132 | *fLog << " Signal: " << fArrivalTimeHiGain
|
|---|
| 133 | << " +- " << fArrivalTimeHiGainError
|
|---|
| 134 | << " Nr. Sat. Hi Gain: " << fNumHiGainSaturated
|
|---|
| 135 | << " Nr. Sat. Lo Gain: " << fNumLoGainSaturated
|
|---|
| 136 | << endl;
|
|---|
| 137 | }
|
|---|