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

Last change on this file since 2173 was 2173, checked in by tbretz, 21 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
46using namespace std;
47
48// --------------------------------------------------------------------------
49//
50// Creates a MCerPhotPix object for each pixel in the event
51//
52MRflEvtData::MRflEvtData(const char *name, const char *title)
53 : fList("MRflSinglePhoton", 0), fPos(0)
54{
55 fName = name ? name : "MRflEvtData";
56 fTitle = title ? title : "All Photons from a reflector event";
57}
58
59// --------------------------------------------------------------------------
60//
61// Dump informations off all photons
62//
63void MRflEvtData::Print(Option_t *o) const
64{
65 *fLog << all << underline << GetDescriptor() << ":" << endl;
66 fList.Print();
67}
68
69// --------------------------------------------------------------------------
70//
71// Add a new photon to the list
72//
73MRflSinglePhoton &MRflEvtData::GetNewPhoton()
74{
75 // If necessary the []-operator creates a new element
76 // Warning: The virtual table may not be set correctly,
77 // this is why you have to call the new-operator.
78 return *new (fList[fPos++]) MRflSinglePhoton;
79}
80
81// --------------------------------------------------------------------------
82//
83// If you have added all photon fix the size of the container.
84//
85void MRflEvtData::FixSize()
86{
87 if (fList.GetEntriesFast() == fPos)
88 return;
89
90 fList.ExpandCreateFast(fPos);
91}
92
Note: See TracBrowser for help on using the repository browser.