emcClusterContainer.C

Go to the documentation of this file.
00001 #include "emcClusterContainer.h"
00002 #include "emcClusterContent.h"
00003 #include "TClonesArray.h"
00004 
00005 ClassImp(emcClusterContainer)
00006 
00007 //_____________________________________________________________________________
00008 emcClusterContainer& 
00009 emcClusterContainer::operator=(const emcClusterContainer&)
00010 {
00011   return *this;
00012 }
00013 
00014 //_____________________________________________________________________________
00015 void
00016 emcClusterContainer::print(std::ostream& out) const
00017 {
00018   for ( unsigned int i = 0; i < size(); ++i ) 
00019     {
00020       getCluster(i)->print(out);
00021     }
00022 }
00023 
00024 emcClusterContent*
00025 emcClusterContainer::addCluster(const emcClusterContent &clus)
00026 {
00027   // First check if TC array exists (it does not for the base class
00028   if (!GetTCArray())
00029     {
00030       return NULL;
00031     }
00032   // this is a bit ugly but GetLast returns the  index-1, so the argument
00033   // for the ExpandCreate is  GetLast() + 2
00034   int nnew;
00035     nnew = GetTCArray()->GetLast() + 2;
00036   // this is a TCArray method, it creates a new Object of
00037   // the type which is stored in the TCArray. It uses the default ctor
00038   GetTCArray()->ExpandCreate(nnew);
00039   emcClusterContent *newclus = static_cast<emcClusterContent *> (GetTCArray()->UncheckedAt(GetTCArray()->GetLast()));
00040   // Since the ExpandCreate calls the default ctor we still need to copy
00041   // the actual values from the input particle
00042   newclus->Copy(clus);
00043   return newclus;
00044 }