emcGeometry.C

Go to the documentation of this file.
00001 #include "emcGeometry.h"
00002 #include <iostream>
00003 #include <cassert>
00004 
00005 size_t emcGeometry::fgNumberOfSectors = 8;
00006 
00007 using std::cerr;
00008 using std::endl;
00009 using std::ostream;
00010 
00011 //_____________________________________________________________________________
00012 emcGeometry::emcGeometry() : emcManageable("","","emcGeometry")
00013 {
00014   //  fSectors.reserve(fgNumberOfSectors);
00015 }
00016 
00017 //_____________________________________________________________________________
00018 emcGeometry::~emcGeometry()
00019 {
00020 
00021 }
00022 
00023 //_____________________________________________________________________________
00024 emcGeometry::emcGeometry(const emcGeometry& obj) : emcManageable()
00025 {
00026   obj.Copy(*this);
00027 }
00028 
00029 //_____________________________________________________________________________
00030 emcGeometry& emcGeometry::operator=(const emcGeometry& obj)
00031 {
00032   if ( this != &obj ) {
00033     obj.Copy(*this);
00034   }
00035   return *this;
00036 }
00037 
00038 //_____________________________________________________________________________
00039 void emcGeometry::Copy(emcGeometry& obj) const
00040 {
00041   emcManageable::Copy(static_cast<emcManageable&>(obj));
00042   obj.fSectors.clear();
00043   size_t i;
00044   for ( i = 0; i < fSectors.size(); i++ ) {
00045     obj.fSectors.push_back(fSectors[i]);
00046   }
00047   assert(obj.fSectors.size()==fSectors.size());
00048   obj.fStart = fStart;
00049   obj.fEnd = fEnd;
00050 }
00051 
00052 //_____________________________________________________________________________
00053 bool
00054 emcGeometry::IsValid(const PHTimeStamp& cwhen) const
00055 {
00056   PHTimeStamp& when = const_cast<PHTimeStamp&>(cwhen);
00057   if (when.isInRange(fStart,fEnd)) return true;
00058   return false;
00059 }
00060 
00061 //_____________________________________________________________________________
00062 const SecGeom& emcGeometry::Sector(size_t iS) const
00063 {
00064   static SecGeom dummy;
00065 
00066   if ( iS < fSectors.size() ) {
00067     return fSectors[iS];
00068   }
00069   else {
00070     cerr << "emcGeometry::GetSector(size_t iS) : iS out of bounds (iS=" << iS
00071          << ") max=" << fSectors.size() << endl;
00072     return dummy;
00073   }
00074 }
00075 
00076 //_____________________________________________________________________________
00077 ostream& operator<<(ostream& out, const emcGeometry& obj) 
00078 {
00079   size_t i;
00080   out << "emcGeometry:" << endl;
00081   for ( i = 0; i < obj.fSectors.size(); i++ ) {
00082     out << "Sector " << i << " : " << endl;
00083     out << obj.fSectors[i] << endl;
00084   }
00085   return out;
00086 }
00087 
00088 
00089 //_____________________________________________________________________________
00090 void emcGeometry::PrintCorners(void) const
00091 {
00092 }
00093 
00094 //_____________________________________________________________________________
00095 void emcGeometry::Reset(void)
00096 {
00097   fSectors.clear();
00098 }
00099 
00100