source: trunk/MagicSoft/Mars/mraw/MRawCrateArray.cc@ 837

Last change on this file since 837 was 765, checked in by tbretz, 24 years ago
*** empty log message ***
File size: 3.4 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 12/2000 (tbretz@uni-sw.gwdg.de)
19!
20! Copyright: MAGIC Software Development, 2000-2001
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MRawCrateArray
28//
29// This class exists to make it possible to read in the crate data
30// TClones Array. In principal we can directly write the TClonesArray
31// to the root file, but when we read in again the root file we cannot
32// put the TClonesArray into our parameter list, becaus it isn't derived
33// from MParContainer. This class is derived from MParContainer and can be
34// put in the list. The TClones Array containes conatiners which store
35// the information about one crate (MRawCrateData).
36//
37/////////////////////////////////////////////////////////////////////////////
38#include "MRawCrateArray.h"
39
40#include <TClonesArray.h>
41
42#include "MLog.h"
43
44ClassImp(MRawCrateArray)
45
46// --------------------------------------------------------------------------
47//
48// Default Constructor. It creates the TClonesArray which is used to store
49// the crate data.
50//
51MRawCrateArray::MRawCrateArray(const char *name, const char *title)
52{
53 *fName = name ? name : "MRawCrateArray";
54 *fTitle = title ? title : "Array of MRawCrateData Information";
55
56 //
57 // craete an (almost) empty array. The size is easily determined
58 // while filling the array
59 //
60 fArray = new TClonesArray("MRawCrateData", 0);
61}
62
63// --------------------------------------------------------------------------
64//
65// Destructor. Deletes the TClones Array which stores the crate information
66//
67MRawCrateArray::~MRawCrateArray()
68{
69 // FIXME: Is the contained data deleted, too?
70 delete fArray;
71}
72
73// --------------------------------------------------------------------------
74//
75// clear the entries in the TClonesArray
76//
77void MRawCrateArray::Clear(Option_t *opt)
78{
79 fArray->Clear();
80}
81
82// --------------------------------------------------------------------------
83//
84// Return a pointer the i-th entry in the array
85//
86MRawCrateData *MRawCrateArray::GetEntry(Int_t i)
87{
88 return (MRawCrateData*)fArray->AddrAt(i);
89}
90
91// --------------------------------------------------------------------------
92//
93// Return the i-th entry in the array
94//
95MRawCrateData* &MRawCrateArray::operator[](Int_t i)
96{
97 return (MRawCrateData*&)(*fArray)[i];
98}
99
100// --------------------------------------------------------------------------
101//
102// return a pointer to the pointer of the array
103// (actually not used. You may need it if you want to write
104// the TClonesArray directly)
105//
106TClonesArray **MRawCrateArray::GetArray()
107{
108 return &fArray;
109}
110
Note: See TracBrowser for help on using the repository browser.