source: trunk/MagicSoft/Mars/manalysis/MArrivalTime.cc@ 2917

Last change on this file since 2917 was 2917, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 5.8 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): Sebastian Raducci, 12/2003 <mailto:raducci@fisica.uniud.it>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MArrivalTime
28//
29// Times are calculated using the TSpline5 Root Class
30//
31/////////////////////////////////////////////////////////////////////////////
32#include "MArrivalTime.h"
33
34#include "MGeomCam.h"
35#include "MGeomPix.h"
36
37#include "MLog.h"
38#include "MLogManip.h"
39
40#include "MRawEvtPixelIter.h"
41#include "MRawEvtData.h"
42
43ClassImp(MArrivalTime);
44
45using namespace std;
46
47#warning Commented out all usage of fPixelCehcked - THIS WILL CRASH YOUR PROGRAM!
48
49// --------------------------------------------------------------------------
50//
51// Creates an object containing the arrival time for each pixel in the event
52//
53MArrivalTime::MArrivalTime(const char *name, const char *title)
54{
55 fName = name ? name : "MArrivalTime";
56 fTitle = title ? title : "Photons arrival times Information";
57}
58
59// -------------------------------------------------------------------------
60//
61// Sets every pixel arrival time to -1
62//
63void MArrivalTime::Reset()
64{
65 fData.Reset(-1);
66}
67
68void MArrivalTime::InitSize(Int_t i)
69{
70 fData.Set(i);
71}
72
73// -------------------------------------------------------------------------
74//
75// Set the arrival time in one pixel
76//
77void MArrivalTime::SetTime(const Int_t i, const Float_t t)
78{
79 fData[i] = t;
80}
81
82// -------------------------------------------------------------------------
83//
84// Finds the clusters with similar Arrival Time
85//
86// PRELIMINARY!! For now the Arrival Time is not the one calculated with
87// the splines, but it's the Max Slice Idx
88//
89// TEST!! This method is used only for test. Do not use it until
90// it becomes stable
91//
92void MArrivalTime::EvalClusters(const MRawEvtData &evt, const MGeomCam &geom)
93{
94 const Int_t n = geom.GetNumPixels();
95
96 fData2.Set(n);
97 fData3.Set(n);
98 fData4.Set(n);
99 fData5.Set(n);
100
101 fData2.Reset(-1);
102 fData3.Reset(-1);
103 fData4.Reset(-1);
104 fData5.Reset(-1);
105
106 MRawEvtPixelIter pixel((MRawEvtData*)&evt);
107
108// Array that says if a pixel has been already checked or not
109
110// for (Int_t i = 0; i < n; i++)
111// fPixelChecked[i] = kFALSE;
112
113// This fakeData array will be subsituted with the fData Array.
114 fakeData.Set(n);
115 fakeData.Reset();
116
117 while ( pixel.Next() )
118 {
119 fakeData[pixel.GetPixelId()]=pixel.GetIdxMaxHiLoGainSample();
120 }
121// End of fakeData preparation
122 *fLog << warn << "fin qui bene" << endl;
123// Max dimension of cluster
124 Short_t dimCluster;
125
126 while ( pixel.Next() )
127 {
128 /*
129 if (!fPixelChecked[pixel.GetPixelId()])
130 {
131 dimCluster = 0;
132 fCluster.Set(n);
133 fCluster.Reset(-1);
134 fCluster[dimCluster]=pixel.GetPixelId();
135 dimCluster++;
136
137 CheckNeighbours(evt,geom,
138 pixel.GetPixelId(), &dimCluster);
139
140 if (dimCluster > 4)
141 {
142 for (Int_t i = 0; i < dimCluster; i++)
143 fData5[fCluster[i]]=fakeData[fCluster[i]];
144 }
145 if (dimCluster > 3)
146 {
147 for (Int_t i = 0; i < dimCluster; i++)
148 fData4[fCluster[i]]=fakeData[fCluster[i]];
149 }
150 if (dimCluster > 2)
151 {
152 for (Int_t i = 0; i < dimCluster; i++)
153 fData3[fCluster[i]]=fakeData[fCluster[i]];
154 }
155 if (dimCluster > 1)
156 {
157 for (Int_t i = 0; i < dimCluster; i++)
158 fData2[fCluster[i]]=fakeData[fCluster[i]];
159 }
160 } */
161 }
162
163}
164
165// --------------------------------------------------------------------------
166//
167// Function to check the nearest neighbour pixels arrivaltime
168//
169void MArrivalTime::CheckNeighbours(const MRawEvtData &evt, const MGeomCam &geom,
170 Short_t idx, Short_t *dimCluster)
171{
172 Byte_t numNeighbors=geom[idx].GetNumNeighbors();
173 //fPixelChecked[idx] = kTRUE;
174
175 for (Byte_t i=0x00; i < numNeighbors; i++)
176 {
177
178 /*
179 if (!fPixelChecked[geom[idx].GetNeighbor(i)] &&
180 fakeData[idx] == fakeData[geom[idx].GetNeighbor(i)])
181 {
182 fCluster[*dimCluster]=geom[idx].GetNeighbor(i);
183 *dimCluster++;
184 CheckNeighbours(evt, geom,
185 geom[idx].GetNeighbor(i), dimCluster);
186 }
187 */
188 }
189}
190// --------------------------------------------------------------------------
191//
192// Returns the arrival time value
193//
194Bool_t MArrivalTime::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
195{
196 if (idx<0 || idx>=fData.GetSize())
197 return kFALSE;
198
199 switch (type)
200 {
201 case 0:
202 case 1:
203 val = fData[idx];
204 break;
205 case 2:
206 val = fData2[idx];
207 break;
208 case 3:
209 val = fData3[idx];
210 break;
211 case 4:
212 val = fData4[idx];
213 break;
214 case 5:
215 val = fData5[idx];
216 break;
217 }
218
219 return kTRUE;
220}
221
222void MArrivalTime::DrawPixelContent(Int_t num) const
223{
224 *fLog << warn << "MArrivalTime::DrawPixelContent - not available." << endl;
225}
Note: See TracBrowser for help on using the repository browser.