| 1 | /* ======================================================================== *\
|
|---|
| 2 | ! $Name: not supported by cvs2svn $:$Id: MArrivalTimeCam.cc,v 1.10 2006-10-19 14:06:46 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-2004
|
|---|
| 25 | !
|
|---|
| 26 | !
|
|---|
| 27 | \* ======================================================================== */
|
|---|
| 28 |
|
|---|
| 29 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 30 | //
|
|---|
| 31 | // MArrivalTimeCam
|
|---|
| 32 | //
|
|---|
| 33 | // Hold the ArrivalTime information for all pixels in the camera
|
|---|
| 34 | //
|
|---|
| 35 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 36 | #include "MArrivalTimeCam.h"
|
|---|
| 37 |
|
|---|
| 38 | #include <TClonesArray.h>
|
|---|
| 39 |
|
|---|
| 40 | #include "MLog.h"
|
|---|
| 41 | #include "MLogManip.h"
|
|---|
| 42 |
|
|---|
| 43 | #include "MArrivalTimePix.h"
|
|---|
| 44 |
|
|---|
| 45 | ClassImp(MArrivalTimeCam);
|
|---|
| 46 |
|
|---|
| 47 | using namespace std;
|
|---|
| 48 |
|
|---|
| 49 | // --------------------------------------------------------------------------
|
|---|
| 50 | //
|
|---|
| 51 | // Default constructor. Creates a MArrivalTimePix object for each pixel
|
|---|
| 52 | //
|
|---|
| 53 | MArrivalTimeCam::MArrivalTimeCam(const char *name, const char *title)
|
|---|
| 54 | {
|
|---|
| 55 | fName = name ? name : "MArrivalTimeCam";
|
|---|
| 56 | fTitle = title ? title : "Storage container for all Extracted Signal Information in the camera";
|
|---|
| 57 |
|
|---|
| 58 | fArray = new TClonesArray("MArrivalTimePix", 1);
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | // --------------------------------------------------------------------------
|
|---|
| 62 | //
|
|---|
| 63 | // Delete the array conatining the pixel pedest information
|
|---|
| 64 | //
|
|---|
| 65 | MArrivalTimeCam::~MArrivalTimeCam()
|
|---|
| 66 | {
|
|---|
| 67 | delete fArray;
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | // --------------------------------------------------------------------------
|
|---|
| 71 | //
|
|---|
| 72 | // Distribute logging stream to all childs
|
|---|
| 73 | //
|
|---|
| 74 | void MArrivalTimeCam::SetLogStream(MLog *lg)
|
|---|
| 75 | {
|
|---|
| 76 | fArray->R__FOR_EACH(MParContainer, SetLogStream)(lg);
|
|---|
| 77 | MParContainer::SetLogStream(lg);
|
|---|
| 78 | }
|
|---|
| 79 |
|
|---|
| 80 | // --------------------------------------------------------------------------
|
|---|
| 81 | //
|
|---|
| 82 | // Set the size of the camera
|
|---|
| 83 | //
|
|---|
| 84 | void MArrivalTimeCam::InitSize(const UInt_t i)
|
|---|
| 85 | {
|
|---|
| 86 | fArray->ExpandCreate(i);
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 | // --------------------------------------------------------------------------
|
|---|
| 90 | //
|
|---|
| 91 | // Get the size of the MArrivalTimeCam
|
|---|
| 92 | //
|
|---|
| 93 | Int_t MArrivalTimeCam::GetSize() const
|
|---|
| 94 | {
|
|---|
| 95 | return fArray->GetEntriesFast();
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 | // --------------------------------------------------------------------------
|
|---|
| 99 | //
|
|---|
| 100 | // Get i-th pixel (pixel index)
|
|---|
| 101 | //
|
|---|
| 102 | MArrivalTimePix &MArrivalTimeCam::operator[](Int_t i)
|
|---|
| 103 | {
|
|---|
| 104 | return *static_cast<MArrivalTimePix*>(fArray->UncheckedAt(i));
|
|---|
| 105 | }
|
|---|
| 106 |
|
|---|
| 107 | // --------------------------------------------------------------------------
|
|---|
| 108 | //
|
|---|
| 109 | // Get i-th pixel (pixel index)
|
|---|
| 110 | //
|
|---|
| 111 | const MArrivalTimePix &MArrivalTimeCam::operator[](Int_t i) const
|
|---|
| 112 | {
|
|---|
| 113 | return *static_cast<MArrivalTimePix*>(fArray->UncheckedAt(i));
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| 116 | void MArrivalTimeCam::Clear(Option_t *o)
|
|---|
| 117 | {
|
|---|
| 118 | fArray->R__FOR_EACH(TObject, Clear)();
|
|---|
| 119 | }
|
|---|
| 120 |
|
|---|
| 121 | void MArrivalTimeCam::Print(Option_t *o) const
|
|---|
| 122 | {
|
|---|
| 123 | *fLog << all << GetDescriptor() << ":" << endl;
|
|---|
| 124 | int idx = -1;
|
|---|
| 125 |
|
|---|
| 126 | TIter Next(fArray);
|
|---|
| 127 | MArrivalTimePix *pix;
|
|---|
| 128 | while ((pix=(MArrivalTimePix*)Next()))
|
|---|
| 129 | {
|
|---|
| 130 | idx++;
|
|---|
| 131 |
|
|---|
| 132 | if (!pix->IsArrivalTimeValid())
|
|---|
| 133 | continue;
|
|---|
| 134 |
|
|---|
| 135 | *fLog << idx << ": ";
|
|---|
| 136 | pix->Print();
|
|---|
| 137 | }
|
|---|
| 138 | }
|
|---|
| 139 |
|
|---|
| 140 | Bool_t MArrivalTimeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
|---|
| 141 | {
|
|---|
| 142 | if (idx>=GetSize())
|
|---|
| 143 | return kFALSE;
|
|---|
| 144 |
|
|---|
| 145 | const MArrivalTimePix &pix = (*this)[idx];
|
|---|
| 146 |
|
|---|
| 147 | switch (type)
|
|---|
| 148 | {
|
|---|
| 149 | case 0:
|
|---|
| 150 | val = pix.GetArrivalTimeHiGain();
|
|---|
| 151 | return pix.IsHiGainValid() && !pix.IsHiGainSaturated();
|
|---|
| 152 |
|
|---|
| 153 | case 1:
|
|---|
| 154 | val = pix.GetArrivalTimeHiGainError();
|
|---|
| 155 | return val>0;
|
|---|
| 156 |
|
|---|
| 157 | case 2:
|
|---|
| 158 | val = pix.GetArrivalTimeLoGain();
|
|---|
| 159 | return pix.IsLoGainValid() && !pix.IsLoGainSaturated();
|
|---|
| 160 |
|
|---|
| 161 | case 3:
|
|---|
| 162 | val = pix.GetArrivalTimeLoGainError();
|
|---|
| 163 | return val>0;
|
|---|
| 164 |
|
|---|
| 165 | case 4:
|
|---|
| 166 | case 6:
|
|---|
| 167 | val = pix.GetArrivalTime();
|
|---|
| 168 | return pix.IsArrivalTimeValid();
|
|---|
| 169 |
|
|---|
| 170 | // This is for the case the signal has been
|
|---|
| 171 | // extracted from lo- and hi-gain
|
|---|
| 172 | case 7:
|
|---|
| 173 | // Lo- and hi-gain must be successfully extracted
|
|---|
| 174 | if (!pix.IsLoGainValid() || !pix.IsHiGainValid())
|
|---|
| 175 | return kFALSE;
|
|---|
| 176 |
|
|---|
| 177 | // Lo- and hi-gain must not be saturated
|
|---|
| 178 | if (pix.IsLoGainSaturated() || pix.IsHiGainSaturated())
|
|---|
| 179 | return kFALSE;
|
|---|
| 180 |
|
|---|
| 181 | // if (pix.GetArrivalTimeHiGain()<3 || pix.GetArrivalTimeHiGain()>12 ||
|
|---|
| 182 | // pix.GetArrivalTimeLoGain()<3 || pix.GetArrivalTimeLoGain()>12)
|
|---|
| 183 | // return kFALSE;
|
|---|
| 184 |
|
|---|
| 185 | val = pix.GetArrivalTimeLoGain()-pix.GetArrivalTimeHiGain();
|
|---|
| 186 | return TMath::Abs(val)<2; // FIXME: Is this a good value?
|
|---|
| 187 |
|
|---|
| 188 | default:
|
|---|
| 189 | return kFALSE;
|
|---|
| 190 | }
|
|---|
| 191 |
|
|---|
| 192 | return kFALSE;
|
|---|
| 193 | }
|
|---|
| 194 |
|
|---|
| 195 | void MArrivalTimeCam::DrawPixelContent(Int_t num) const
|
|---|
| 196 | {
|
|---|
| 197 | *fLog << warn << "MArrivalTimeCam::DrawPixelContent - not available." << endl;
|
|---|
| 198 | }
|
|---|