source: trunk/MagicSoft/Mars/mreflector/MRflEvtData.cc@ 2160

Last change on this file since 2160 was 2135, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 2.7 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): Thomas Bretz, 5/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MRflEvtData
28//
29// All Photons of a event from the reflector program
30//
31// Should be filled like this:
32// MRflEvtData evt;
33// evt.Reset();
34// for (int i=0; i<10; i++)
35// MRflSinglePhoton &ph = evt.GetNewPhoton();
36// evt.FixSize();
37//
38/////////////////////////////////////////////////////////////////////////////
39#include "MRflEvtData.h"
40
41#include "MLog.h"
42#include "MLogManip.h"
43
44ClassImp(MRflEvtData);
45
46// --------------------------------------------------------------------------
47//
48// Creates a MCerPhotPix object for each pixel in the event
49//
50MRflEvtData::MRflEvtData(const char *name, const char *title)
51 : fList("MRflSinglePhoton", 0), fPos(0)
52{
53 fName = name ? name : "MRflEvtData";
54 fTitle = title ? title : "All Photons from a reflector event";
55}
56
57// --------------------------------------------------------------------------
58//
59// Dump informations off all photons
60//
61void MRflEvtData::Print(Option_t *o="") const
62{
63 *fLog << all << underline << GetDescriptor() << ":" << endl;
64 fList.Print();
65}
66
67// --------------------------------------------------------------------------
68//
69// Add a new photon to the list
70//
71MRflSinglePhoton &MRflEvtData::GetNewPhoton()
72{
73 // If necessary the []-operator creates a new element
74 // Warning: The virtual table may not be set correctly,
75 // this is why you have to call the new-operator.
76 return *new (fList[fPos++]) MRflSinglePhoton;
77}
78
79// --------------------------------------------------------------------------
80//
81// If you have added all photon fix the size of the container.
82//
83void MRflEvtData::FixSize()
84{
85 if (fList.GetEntriesFast() == fPos)
86 return;
87
88 fList.ExpandCreateFast(fPos);
89}
90
Note: See TracBrowser for help on using the repository browser.