| 1 | /* ======================================================================== *\
|
|---|
| 2 | ! $Name: not supported by cvs2svn $:$Id: MArrivalTimeCam.cc,v 1.11 2006-10-23 10:00:27 tbretz Exp $
|
|---|
| 3 | ! --------------------------------------------------------------------------
|
|---|
| 4 | !
|
|---|
| 5 | ! *
|
|---|
| 6 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
|---|
| 7 | ! * Software. It is distributed to you in the hope that it can be a useful
|
|---|
| 8 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
|---|
| 9 | ! * It is distributed WITHOUT ANY WARRANTY.
|
|---|
| 10 | ! *
|
|---|
| 11 | ! * Permission to use, copy, modify and distribute this software and its
|
|---|
| 12 | ! * documentation for any purpose is hereby granted without fee,
|
|---|
| 13 | ! * provided that the above copyright notice appear in all copies and
|
|---|
| 14 | ! * that both that copyright notice and this permission notice appear
|
|---|
| 15 | ! * in supporting documentation. It is provided "as is" without express
|
|---|
| 16 | ! * or implied warranty.
|
|---|
| 17 | ! *
|
|---|
| 18 | !
|
|---|
| 19 | !
|
|---|
| 20 | ! Author(s): Markus Gaug 12/2003 <mailto:markus@ifae.es>
|
|---|
| 21 | ! Author(s): Thomas Bretz 12/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
|
|---|
| 22 | ! Author(s): Hendrik Bartko 02/2004 <mailto:hbartko@mppmu.mpg.de>
|
|---|
| 23 | !
|
|---|
| 24 | ! Copyright: MAGIC Software Development, 2000-2006
|
|---|
| 25 | !
|
|---|
| 26 | !
|
|---|
| 27 | \* ======================================================================== */
|
|---|
| 28 |
|
|---|
| 29 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 30 | //
|
|---|
| 31 | // MArrivalTimeCam
|
|---|
| 32 | //
|
|---|
| 33 | // Hold the ArrivalTime information for all pixels in the camera
|
|---|
| 34 | //
|
|---|
| 35 | //
|
|---|
| 36 | // Class Version 2:
|
|---|
| 37 | // ----------------
|
|---|
| 38 | // - Byte_t fFirstUsedSliceHiGain;
|
|---|
| 39 | // - Byte_t fFirstUsedSliceLoGain;
|
|---|
| 40 | // - Byte_t fLastUsedSliceHiGain;
|
|---|
| 41 | // - Byte_t fLastUsedSliceLoGain;
|
|---|
| 42 | //
|
|---|
| 43 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 44 | #include "MArrivalTimeCam.h"
|
|---|
| 45 |
|
|---|
| 46 | #include <TClonesArray.h>
|
|---|
| 47 |
|
|---|
| 48 | #include "MLog.h"
|
|---|
| 49 | #include "MLogManip.h"
|
|---|
| 50 |
|
|---|
| 51 | #include "MArrivalTimePix.h"
|
|---|
| 52 |
|
|---|
| 53 | ClassImp(MArrivalTimeCam);
|
|---|
| 54 |
|
|---|
| 55 | using namespace std;
|
|---|
| 56 |
|
|---|
| 57 | // --------------------------------------------------------------------------
|
|---|
| 58 | //
|
|---|
| 59 | // Default constructor. Creates a MArrivalTimePix object for each pixel
|
|---|
| 60 | //
|
|---|
| 61 | MArrivalTimeCam::MArrivalTimeCam(const char *name, const char *title)
|
|---|
| 62 | {
|
|---|
| 63 | fName = name ? name : "MArrivalTimeCam";
|
|---|
| 64 | fTitle = title ? title : "Storage container for all Extracted Signal Information in the camera";
|
|---|
| 65 |
|
|---|
| 66 | fArray = new TClonesArray("MArrivalTimePix", 1);
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 | // --------------------------------------------------------------------------
|
|---|
| 70 | //
|
|---|
| 71 | // Delete the array conatining the pixel pedest information
|
|---|
| 72 | //
|
|---|
| 73 | MArrivalTimeCam::~MArrivalTimeCam()
|
|---|
| 74 | {
|
|---|
| 75 | delete fArray;
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 | // --------------------------------------------------------------------------
|
|---|
| 79 | //
|
|---|
| 80 | // Distribute logging stream to all childs
|
|---|
| 81 | //
|
|---|
| 82 | void MArrivalTimeCam::SetLogStream(MLog *lg)
|
|---|
| 83 | {
|
|---|
| 84 | fArray->R__FOR_EACH(MParContainer, SetLogStream)(lg);
|
|---|
| 85 | MParContainer::SetLogStream(lg);
|
|---|
| 86 | }
|
|---|
| 87 |
|
|---|
| 88 | // --------------------------------------------------------------------------
|
|---|
| 89 | //
|
|---|
| 90 | // Set the size of the camera
|
|---|
| 91 | //
|
|---|
| 92 | void MArrivalTimeCam::InitSize(const UInt_t i)
|
|---|
| 93 | {
|
|---|
| 94 | fArray->ExpandCreate(i);
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 | // --------------------------------------------------------------------------
|
|---|
| 98 | //
|
|---|
| 99 | // Get the size of the MArrivalTimeCam
|
|---|
| 100 | //
|
|---|
| 101 | Int_t MArrivalTimeCam::GetSize() const
|
|---|
| 102 | {
|
|---|
| 103 | return fArray->GetEntriesFast();
|
|---|
| 104 | }
|
|---|
| 105 |
|
|---|
| 106 | // --------------------------------------------------------------------------
|
|---|
| 107 | //
|
|---|
| 108 | // Get i-th pixel (pixel index)
|
|---|
| 109 | //
|
|---|
| 110 | MArrivalTimePix &MArrivalTimeCam::operator[](Int_t i)
|
|---|
| 111 | {
|
|---|
| 112 | return *static_cast<MArrivalTimePix*>(fArray->UncheckedAt(i));
|
|---|
| 113 | }
|
|---|
| 114 |
|
|---|
| 115 | // --------------------------------------------------------------------------
|
|---|
| 116 | //
|
|---|
| 117 | // Get i-th pixel (pixel index)
|
|---|
| 118 | //
|
|---|
| 119 | const MArrivalTimePix &MArrivalTimeCam::operator[](Int_t i) const
|
|---|
| 120 | {
|
|---|
| 121 | return *static_cast<MArrivalTimePix*>(fArray->UncheckedAt(i));
|
|---|
| 122 | }
|
|---|
| 123 |
|
|---|
| 124 | void MArrivalTimeCam::Clear(Option_t *o)
|
|---|
| 125 | {
|
|---|
| 126 | fArray->R__FOR_EACH(TObject, Clear)();
|
|---|
| 127 | }
|
|---|
| 128 |
|
|---|
| 129 | void MArrivalTimeCam::Print(Option_t *o) const
|
|---|
| 130 | {
|
|---|
| 131 | *fLog << all << GetDescriptor() << ":" << endl;
|
|---|
| 132 | int idx = -1;
|
|---|
| 133 |
|
|---|
| 134 | TIter Next(fArray);
|
|---|
| 135 | MArrivalTimePix *pix;
|
|---|
| 136 | while ((pix=(MArrivalTimePix*)Next()))
|
|---|
| 137 | {
|
|---|
| 138 | idx++;
|
|---|
| 139 |
|
|---|
| 140 | if (!pix->IsArrivalTimeValid())
|
|---|
| 141 | continue;
|
|---|
| 142 |
|
|---|
| 143 | *fLog << idx << ": ";
|
|---|
| 144 | pix->Print();
|
|---|
| 145 | }
|
|---|
| 146 | }
|
|---|
| 147 |
|
|---|
| 148 | Bool_t MArrivalTimeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
|---|
| 149 | {
|
|---|
| 150 | if (idx>=GetSize())
|
|---|
| 151 | return kFALSE;
|
|---|
| 152 |
|
|---|
| 153 | const MArrivalTimePix &pix = (*this)[idx];
|
|---|
| 154 |
|
|---|
| 155 | switch (type)
|
|---|
| 156 | {
|
|---|
| 157 | case 0:
|
|---|
| 158 | val = pix.GetArrivalTimeHiGain();
|
|---|
| 159 | return pix.IsHiGainValid() && !pix.IsHiGainSaturated();
|
|---|
| 160 |
|
|---|
| 161 | case 1:
|
|---|
| 162 | val = pix.GetArrivalTimeHiGainError();
|
|---|
| 163 | return val>0;
|
|---|
| 164 |
|
|---|
| 165 | case 2:
|
|---|
| 166 | val = pix.GetArrivalTimeLoGain();
|
|---|
| 167 | return pix.IsLoGainValid() && !pix.IsLoGainSaturated();
|
|---|
| 168 |
|
|---|
| 169 | case 3:
|
|---|
| 170 | val = pix.GetArrivalTimeLoGainError();
|
|---|
| 171 | return val>0;
|
|---|
| 172 |
|
|---|
| 173 | case 4:
|
|---|
| 174 | case 6:
|
|---|
| 175 | val = pix.GetArrivalTime();
|
|---|
| 176 | return pix.IsArrivalTimeValid();
|
|---|
| 177 |
|
|---|
| 178 | // This is for the case the signal has been
|
|---|
| 179 | // extracted from lo- and hi-gain
|
|---|
| 180 | case 7:
|
|---|
| 181 | // Lo- and hi-gain must be successfully extracted
|
|---|
| 182 | if (!pix.IsLoGainValid() || !pix.IsHiGainValid())
|
|---|
| 183 | return kFALSE;
|
|---|
| 184 |
|
|---|
| 185 | // Lo- and hi-gain must not be saturated
|
|---|
| 186 | if (pix.IsLoGainSaturated() || pix.IsHiGainSaturated())
|
|---|
| 187 | return kFALSE;
|
|---|
| 188 |
|
|---|
| 189 | // if (pix.GetArrivalTimeHiGain()<3 || pix.GetArrivalTimeHiGain()>12 ||
|
|---|
| 190 | // pix.GetArrivalTimeLoGain()<3 || pix.GetArrivalTimeLoGain()>12)
|
|---|
| 191 | // return kFALSE;
|
|---|
| 192 |
|
|---|
| 193 | val = pix.GetArrivalTimeLoGain()-pix.GetArrivalTimeHiGain();
|
|---|
| 194 | return TMath::Abs(val)<2; // FIXME: Is this a good value?
|
|---|
| 195 |
|
|---|
| 196 | default:
|
|---|
| 197 | return kFALSE;
|
|---|
| 198 | }
|
|---|
| 199 |
|
|---|
| 200 | return kFALSE;
|
|---|
| 201 | }
|
|---|
| 202 |
|
|---|
| 203 | void MArrivalTimeCam::DrawPixelContent(Int_t num) const
|
|---|
| 204 | {
|
|---|
| 205 | *fLog << warn << "MArrivalTimeCam::DrawPixelContent - not available." << endl;
|
|---|
| 206 | }
|
|---|