00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "StPmdCollection.h"
00026 #include "StPmdDetector.h"
00027
00028 ClassImp(StPmdCollection)
00029
00030 StPmdCollection::StPmdCollection(const Char_t * name):TDataSet(name) {
00031 for(int i=0; i<2; i++){
00032 mDetector[i]=0;
00033 StPmdDetector * det = new StPmdDetector(i,12);
00034 this->setDetector(det,i);
00035 }
00036 }
00037
00038 StPmdCollection::~StPmdCollection(){
00039 for(int i=0; i<2; i++){
00040 if(mDetector[i]) delete mDetector[i];
00041 }
00042 }
00043
00044 StPmdDetector*
00045 StPmdCollection::detector(Int_t id)
00046 {
00047 if(id >= 0 && id <= 1)
00048 return mDetector[id];
00049 else
00050 return 0;
00051 }
00052
00053 void
00054 StPmdCollection::setDetector(StPmdDetector* val, Int_t id)
00055 {
00056 if (val) {
00057 if (id >= 0 && id <= 1) {
00058
00059 if (mDetector[id]) mDetector[id]=0;
00060 if (mDetector[id]) delete mDetector[id];
00061 mDetector[id] = val;
00062 }
00063 }
00064 }
00065
00066
00067