| 1 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 2 | //
|
|---|
| 3 | // MRawCrateArray
|
|---|
| 4 | //
|
|---|
| 5 | // This class exists to make it possible to read in the crate data
|
|---|
| 6 | // TClones Array. In principal we can directly write the TClonesArray
|
|---|
| 7 | // to the root file, but when we read in again the root file we cannot
|
|---|
| 8 | // put the TClonesArray into our parameter list, becaus it isn't derived
|
|---|
| 9 | // from TNamed. This class is derived from TNamed and can be put in the list
|
|---|
| 10 | //
|
|---|
| 11 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 12 | #include "MRawCrateArray.h"
|
|---|
| 13 |
|
|---|
| 14 | #include <iostream.h>
|
|---|
| 15 |
|
|---|
| 16 | #include <TClonesArray.h>
|
|---|
| 17 |
|
|---|
| 18 | ClassImp(MRawCrateArray)
|
|---|
| 19 |
|
|---|
| 20 | MRawCrateArray::MRawCrateArray(const char *name, const char *title)
|
|---|
| 21 | {
|
|---|
| 22 | *fName = name ? name : "MRawCrateArray";
|
|---|
| 23 | *fTitle = title ? title : "Array of MRawCrateData Information";
|
|---|
| 24 |
|
|---|
| 25 | //
|
|---|
| 26 | // craete an (almost) empty array. The size is easily determined
|
|---|
| 27 | // while filling the array
|
|---|
| 28 | //
|
|---|
| 29 | fArray = new TClonesArray("MRawCrateData", 0);
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | MRawCrateArray::~MRawCrateArray()
|
|---|
| 33 | {
|
|---|
| 34 | delete fArray;
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | void MRawCrateArray::Clear(Option_t *opt)
|
|---|
| 38 | {
|
|---|
| 39 | //
|
|---|
| 40 | // clear the entries in the TClonesArray
|
|---|
| 41 | //
|
|---|
| 42 | fArray->Clear();
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | void MRawCrateArray::Print(Option_t *opt)
|
|---|
| 46 | {
|
|---|
| 47 | cout << "MRawCrateArray::Print()" << endl;
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | MRawCrateData *MRawCrateArray::GetEntry(Int_t i)
|
|---|
| 51 | {
|
|---|
| 52 | //
|
|---|
| 53 | // Return a pointer the i-th entry in the array
|
|---|
| 54 | //
|
|---|
| 55 | return (MRawCrateData*)fArray->AddrAt(i);
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | MRawCrateData* &MRawCrateArray::operator[](Int_t i)
|
|---|
| 59 | {
|
|---|
| 60 | //
|
|---|
| 61 | // Return the i-th entry in the array
|
|---|
| 62 | //
|
|---|
| 63 | return (MRawCrateData*&)(*fArray)[i];
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | TClonesArray **MRawCrateArray::GetArray()
|
|---|
| 67 | {
|
|---|
| 68 | //
|
|---|
| 69 | // return a pointer to the pointer of the array
|
|---|
| 70 | // (actually not used. You may need it if you want to write
|
|---|
| 71 | // the TClonesArray directly)
|
|---|
| 72 | //
|
|---|
| 73 | return &fArray;
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|