14#include "ObjectMatrix.h"
17 ObjectMatrix_1::ObjectMatrix_1(
const ObjectMatrix_1& manager) :
18 TNamed(manager), fSize(manager.fSize), fComments(NULL), fArray(NULL) {
19 if (manager.fComments) {
20 fComments = new TString(fSize);
21 fArray = new TObject*[fSize];
22 for (int i = 0; i < fSize; i++) {
23 fComments[i] = manager.fComments[i];
24 fArray[i] = (TObject*) manager.fArray[i]->Clone();
29 ObjectMatrix_1& ObjectMatrix_1::operator=(
const ObjectMatrix_1& manager) {
30 if (
this == &manager) {
return *
this; }
32 for (
int i = 0; i < fSize; i++) {
40 fSize = manager.fSize;
41 if (manager.fSize > 0) {
42 fComments =
new TString(fSize);
43 fArray =
new TObject*[fSize];
44 for (
int i = 0; i < fSize; i++) {
45 fComments[i] = manager.fComments[i];
46 fArray[i] = (TObject*) manager.fArray[i]->Clone();
52 void ObjectMatrix_1::Init(Int_t size,
const TObject* temp) {
54 fArray =
new TObject*[fSize];
55 fComments =
new TString[fSize];
56 TString title = Form(
"%s[%%i]", temp->GetName());
57 for (
int i = 0; i < fSize; i++) {
58 fArray[i] = (TObject*) temp->Clone(Form(title, i));
65 for (
int i = 0; i < fSize; i++) {
71 TList* ObjectMatrix_1::GetFlatList()
const {
72 TList* list =
new TList();
73 list->SetOwner(kFALSE);
74 for (
int i = 0; i < fSize; i++) {
80 ObjectMatrix_2::ObjectMatrix_2(
const ObjectMatrix_2& manager) : TNamed(manager), fSize(manager.fSize), fArray(NULL) {
82 fArray = new ObjectMatrix_1*[fSize];
83 for (int i = 0; i < fSize; i++) {
84 fArray[i] = new ObjectMatrix_1(*manager.fArray[i]);
89 ObjectMatrix_2& ObjectMatrix_2::operator=(
const ObjectMatrix_2& manager) {
90 if (
this == &manager) {
return *
this; }
95 fSize = manager.fSize;
96 if (manager.fSize > 0) {
98 for (
int i = 0; i <
fSize; i++) {
99 fArray[i] =
new ObjectMatrix_1(*manager.fArray[i]);
108 TString title = Form(
"%s[%%i]", temp->GetName());
109 for (
int i = 0; i <
fSize; i++) {
110 TString Title = Form(title, i);
112 TObject* temp_obj = (TObject*) temp->Clone(Form(title, i));
120 for (
int i = 0; i <
fSize; i++) {
127 TList* list =
new TList();
128 list->SetOwner(kFALSE);
129 for (
int i = 0; i <
fSize; i++) {
137 ObjectMatrix_2::~ObjectMatrix_2() {
138 if (
fArray == NULL)
return;
139 for (
int i = 0; i <
fSize; i++)
144 ObjectMatrix_3::ObjectMatrix_3(
const ObjectMatrix_3& manager) : TNamed(manager), fSize(manager.fSize), fArray(NULL) {
145 if (manager.fArray) {
146 fArray = new ObjectMatrix_2*[fSize];
147 for (int i = 0; i < fSize; i++) {
148 fArray[i] = new ObjectMatrix_2(*manager.fArray[i]);
153 ObjectMatrix_3& ObjectMatrix_3::operator=(
const ObjectMatrix_3& manager) {
154 if (
this == &manager) {
return *
this; }
159 fSize = manager.fSize;
160 if (manager.fSize > 0) {
161 fArray =
new ObjectMatrix_2*[fSize];
162 for (
int i = 0; i < fSize; i++) {
163 fArray[i] =
new ObjectMatrix_2(*manager.fArray[i]);
173 if (temp->InheritsFrom(
"TNamed")) name = temp->GetName();
174 TString title = Form(
"%s[%%i]", temp->GetName());
175 for (
int i = 0; i < fSize; i++) {
176 TObject* temp_obj = (TObject*) temp->Clone(Form(title, i));
185 for (
int i = 0; i < fSize; i++) {
192 TList* list =
new TList();
193 list->SetOwner(kFALSE);
194 for (
int i = 0; i < fSize; i++) {
197 list->Add(
At(i, j, k));
204 ObjectMatrix_3::~ObjectMatrix_3() {
205 if (
fArray == NULL)
return;
206 for (
int i = 0; i < fSize; i++)
211 ObjectMatrix_4::ObjectMatrix_4(
const ObjectMatrix_4& manager) : TNamed(manager), fSize(manager.fSize), fArray(NULL) {
212 if (manager.fArray) {
213 fArray = new ObjectMatrix_3*[fSize];
214 for (int i = 0; i < fSize; i++) {
215 fArray[i] = new ObjectMatrix_3(*manager.fArray[i]);
220 ObjectMatrix_4& ObjectMatrix_4::operator=(
const ObjectMatrix_4& manager) {
221 if (
this == &manager) {
return *
this; }
226 fSize = manager.fSize;
227 if (manager.fSize > 0) {
228 fArray =
new ObjectMatrix_3*[fSize];
229 for (
int i = 0; i < fSize; i++) {
230 fArray[i] =
new ObjectMatrix_3(*manager.fArray[i]);
239 TString title = Form(
"%s[%%i]", temp->GetName());
240 for (
int i = 0; i < fSize; i++) {
241 TString Title = Form(title, i);
242 TObject* temp_obj = (TObject*) temp->Clone(Form(title, i));
244 fArray[i]->
Init(sizeY, sizeZ, sizeD, temp_obj);
251 for (
int i = 0; i < fSize; i++) {
258 TList* list =
new TList();
259 list->SetOwner(kFALSE);
260 for (
int i = 0; i < fSize; i++) {
264 list->Add(
At(i, j, k, l));
272 ObjectMatrix_4::~ObjectMatrix_4() {
273 if (
fArray == NULL)
return;
274 for (
int i = 0; i < fSize; i++)
virtual void Init(Int_t size, const TObject *temp)
TList * GetFlatList() const
ObjectMatrix_1 * Get(Int_t i) const
TObject * At(Int_t i, Int_t j) const
virtual void Init(Int_t sizeX, Int_t sizeY, const TObject *temp)
void Init(Int_t sizeX, Int_t sizeY, Int_t sizeZ, const TObject *temp)
TList * GetFlatList() const
ObjectMatrix_2 * Get(Int_t i) const
TObject * At(Int_t i, Int_t j, Int_t k) const
TObject * At(Int_t i, Int_t j, Int_t k, Int_t l) const
ObjectMatrix_3 * Get(const Int_t i) const
TList * GetFlatList() const
virtual void Init(Int_t sizeX, Int_t sizeY, Int_t sizeZ, Int_t sizeT, const TObject *temp)
void AddObject(TObject *object)