source: trunk/MagicSoft/Mars/msignal/MArrivalTimeCam.cc@ 5633

Last change on this file since 5633 was 4077, checked in by gaug, 21 years ago
*** empty log message ***
File size: 4.5 KB
Line 
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-2004
23!
24!
25\* ======================================================================== */
26
27/////////////////////////////////////////////////////////////////////////////
28//
29// MArrivalTimeCam
30//
31// Hold the ArrivalTime information for all pixels in the camera
32//
33/////////////////////////////////////////////////////////////////////////////
34#include "MArrivalTimeCam.h"
35
36#include <TClonesArray.h>
37
38#include "MLog.h"
39#include "MLogManip.h"
40
41#include "MArrivalTimePix.h"
42
43ClassImp(MArrivalTimeCam);
44
45using namespace std;
46
47// --------------------------------------------------------------------------
48//
49// Default constructor. Creates a MArrivalTimePix object for each pixel
50//
51MArrivalTimeCam::MArrivalTimeCam(const char *name, const char *title)
52{
53 fName = name ? name : "MArrivalTimeCam";
54 fTitle = title ? title : "Storage container for all Extracted Signal Information in the camera";
55
56 fArray = new TClonesArray("MArrivalTimePix", 1);
57}
58
59// --------------------------------------------------------------------------
60//
61// Delete the array conatining the pixel pedest information
62//
63MArrivalTimeCam::~MArrivalTimeCam()
64{
65 delete fArray;
66}
67
68// --------------------------------------------------------------------------
69//
70// Distribute logging stream to all childs
71//
72void MArrivalTimeCam::SetLogStream(MLog *lg)
73{
74 fArray->ForEach(MParContainer, SetLogStream)(lg);
75 MParContainer::SetLogStream(lg);
76}
77
78// --------------------------------------------------------------------------
79//
80// Set the size of the camera
81//
82void MArrivalTimeCam::InitSize(const UInt_t i)
83{
84 fArray->ExpandCreate(i);
85}
86
87// --------------------------------------------------------------------------
88//
89// Get the size of the MArrivalTimeCam
90//
91Int_t MArrivalTimeCam::GetSize() const
92{
93 return fArray->GetEntriesFast();
94}
95
96// --------------------------------------------------------------------------
97//
98// Get i-th pixel (pixel index)
99//
100MArrivalTimePix &MArrivalTimeCam::operator[](Int_t i)
101{
102 return *static_cast<MArrivalTimePix*>(fArray->UncheckedAt(i));
103}
104
105// --------------------------------------------------------------------------
106//
107// Get i-th pixel (pixel index)
108//
109const MArrivalTimePix &MArrivalTimeCam::operator[](Int_t i) const
110{
111 return *static_cast<MArrivalTimePix*>(fArray->UncheckedAt(i));
112}
113
114void MArrivalTimeCam::Clear(Option_t *o)
115{
116 fArray->ForEach(TObject, Clear)();
117}
118
119void MArrivalTimeCam::Print(Option_t *o) const
120{
121 *fLog << all << GetDescriptor() << ":" << endl;
122 int idx = -1;
123
124 TIter Next(fArray);
125 MArrivalTimePix *pix;
126 while ((pix=(MArrivalTimePix*)Next()))
127 {
128 idx++;
129
130 if (!pix->IsValid())
131 continue;
132
133 *fLog << idx << ": ";
134 pix->Print();
135 }
136}
137
138Bool_t MArrivalTimeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
139{
140 switch (type)
141 {
142 case 0:
143 val = (*this)[idx].GetArrivalTimeHiGain();
144 break;
145 case 1:
146 val = (*this)[idx].GetArrivalTimeHiGainError();
147 break;
148 case 2:
149 val = (*this)[idx].GetArrivalTimeLoGain();
150 break;
151 case 3:
152 val = (*this)[idx].GetArrivalTimeLoGainError();
153 break;
154 case 4:
155 if ((*this)[idx].GetNumHiGainSaturated() > 0)
156 val = (*this)[idx].GetArrivalTimeLoGain();
157 else
158 val = (*this)[idx].GetArrivalTimeHiGain();
159 break;
160 default:
161 return kFALSE;
162 }
163 return val>=0;
164}
165
166void MArrivalTimeCam::DrawPixelContent(Int_t num) const
167{
168 *fLog << warn << "MArrivalTimeCam::DrawPixelContent - not available." << endl;
169}
Note: See TracBrowser for help on using the repository browser.