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

Last change on this file since 761 was 760, checked in by tbretz, 24 years ago
*** empty log message ***
File size: 3.2 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 TNamed. This class is derived from TNamed and can be put in the list
34//
35/////////////////////////////////////////////////////////////////////////////
36#include "MRawCrateArray.h"
37
38#include <TClonesArray.h>
39
40#include "MLog.h"
41
42ClassImp(MRawCrateArray)
43
44// --------------------------------------------------------------------------
45//
46// Default Constructor. It creates the TClonesArray which is used to store
47// the crate data.
48//
49MRawCrateArray::MRawCrateArray(const char *name, const char *title)
50{
51 *fName = name ? name : "MRawCrateArray";
52 *fTitle = title ? title : "Array of MRawCrateData Information";
53
54 //
55 // craete an (almost) empty array. The size is easily determined
56 // while filling the array
57 //
58 fArray = new TClonesArray("MRawCrateData", 0);
59}
60
61// --------------------------------------------------------------------------
62//
63// Destructor. Deletes the TClones Array which stores the crate information
64//
65MRawCrateArray::~MRawCrateArray()
66{
67 // FIXME: Is the contained data deleted, too?
68 delete fArray;
69}
70
71// --------------------------------------------------------------------------
72//
73// clear the entries in the TClonesArray
74//
75void MRawCrateArray::Clear(Option_t *opt)
76{
77 fArray->Clear();
78}
79
80// --------------------------------------------------------------------------
81//
82// Return a pointer the i-th entry in the array
83//
84MRawCrateData *MRawCrateArray::GetEntry(Int_t i)
85{
86 return (MRawCrateData*)fArray->AddrAt(i);
87}
88
89// --------------------------------------------------------------------------
90//
91// Return the i-th entry in the array
92//
93MRawCrateData* &MRawCrateArray::operator[](Int_t i)
94{
95 return (MRawCrateData*&)(*fArray)[i];
96}
97
98// --------------------------------------------------------------------------
99//
100// return a pointer to the pointer of the array
101// (actually not used. You may need it if you want to write
102// the TClonesArray directly)
103//
104TClonesArray **MRawCrateArray::GetArray()
105{
106 return &fArray;
107}
108
Note: See TracBrowser for help on using the repository browser.