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
00026 #include "StFtpcHitCollection.h"
00027 #include "StFtpcSectorHitCollection.h"
00028 #include "StFtpcHit.h"
00029
00030 static const char rcsid[] = "$Id: StFtpcHitCollection.cxx,v 2.4 2001/04/05 04:00:50 ullrich Exp $";
00031
00032 ClassImp(StFtpcHitCollection)
00033
00034 StFtpcHitCollection::StFtpcHitCollection() { }
00035
00036 StFtpcHitCollection::~StFtpcHitCollection() { }
00037
00038 bool
00039 StFtpcHitCollection::addHit(StFtpcHit* hit)
00040 {
00041 unsigned int p, s;
00042 if (hit &&
00043 (p = hit->plane()-1) < mNumberOfPlanes &&
00044 (s = hit->sector()-1) < mPlanes[p].numberOfSectors()) {
00045 mPlanes[p].sector(s)->hits().push_back(hit);
00046 return kTRUE;
00047 }
00048 else
00049 return kFALSE;
00050 }
00051
00052 unsigned int
00053 StFtpcHitCollection::numberOfPlanes() const { return mNumberOfPlanes; }
00054
00055 unsigned int
00056 StFtpcHitCollection::numberOfHits() const
00057 {
00058 unsigned int sum = 0;
00059 for (unsigned int i=0; i<mNumberOfPlanes; i++) {
00060 for (unsigned int j=0; j<mPlanes[i].numberOfSectors(); j++) {
00061 sum += mPlanes[i].sector(j)->hits().size();
00062 }
00063 }
00064 return sum;
00065 }
00066
00067 StFtpcPlaneHitCollection*
00068 StFtpcHitCollection::plane(unsigned int i)
00069 {
00070 if (i < mNumberOfPlanes)
00071 return &(mPlanes[i]);
00072 else
00073 return 0;
00074 }
00075
00076 const StFtpcPlaneHitCollection*
00077 StFtpcHitCollection::plane(unsigned int i) const
00078 {
00079 if (i < mNumberOfPlanes)
00080 return &(mPlanes[i]);
00081 else
00082 return 0;
00083 }