#include "my_class/EMS.h" ClassImp(EMS) TClonesArray *EMS::fgEMCells = 0; EMS::EMS() { if (!fgEMCells) fgEMCells = new TClonesArray("EMCells", 1000); _ecells = fgEMCells; } EMS::EMS(const EMS &orig) { *this = orig; } EMS::~EMS() { delete fgEMCells; fgEMCells = 0; } EMS& EMS::operator = (const EMS &orig) { _ecells->Clear(); for (int icell = 0; icell < orig._ecells->GetLast() + 1; icell++) { EMCells acell = *(EMCells*)orig._ecells->At(icell); addCell(icell, acell); } return *this; } TRef EMS::addCell(const int &addingPosition, const EMCells &acell) { int tmpIndex = addingPosition; TClonesArray &newCellList = *(TClonesArray*)_ecells; new(newCellList[tmpIndex++]) EMCells(acell); TRef tRef = newCellList[tmpIndex-1]; return tRef; } void EMS::setCells(const TClonesArray *ecells) { for (int icell = 0; icell < ecells->GetLast() + 1; icell++) { EMCells acell = *(EMCells*)ecells->At(icell); addCell(icell, acell); } }