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
00027
00028
00029
00030 #include "StSvtHitCollection.h"
00031 #include "StSvtHit.h"
00032
00033 static const char rcsid[] = "$Id: StSvtHitCollection.cxx,v 2.5 2001/04/05 04:00:55 ullrich Exp $";
00034
00035 ClassImp(StSvtHitCollection)
00036
00037 StSvtHitCollection::StSvtHitCollection()
00038 {
00039
00040
00041
00042
00043
00044 for (int i=0; i<mNumberOfBarrels; i++) {
00045 mBarrels[i].setBarrelNumber(i);
00046 for (unsigned int j=0; j<mBarrels[i].numberOfLadders(); j++)
00047 mBarrels[i].ladder(j)->setBarrelNumber(i);
00048 }
00049 }
00050
00051 StSvtHitCollection::~StSvtHitCollection() { }
00052
00053 unsigned int
00054 StSvtHitCollection::numberOfBarrels() const { return mNumberOfBarrels; }
00055
00056 bool
00057 StSvtHitCollection::addHit(StSvtHit* hit)
00058 {
00059 unsigned int l, d, w;
00060 if (hit &&
00061 (l = hit->barrel()-1) < mNumberOfBarrels &&
00062 (d = hit->ladder()-1) < mBarrels[l].numberOfLadders() &&
00063 (w = hit->wafer()-1) < mBarrels[l].ladder(d)->numberOfWafers()) {
00064 mBarrels[l].ladder(d)->wafer(w)->hits().push_back(hit);
00065 return kTRUE;
00066 }
00067 else
00068 return kFALSE;
00069 }
00070
00071 unsigned int
00072 StSvtHitCollection::numberOfHits() const
00073 {
00074 unsigned int sum = 0;
00075 for (int i=0; i<mNumberOfBarrels; i++)
00076 for (unsigned int j=0; j<mBarrels[i].numberOfLadders(); j++)
00077 for (unsigned int k=0; k<mBarrels[i].ladder(j)->numberOfWafers(); k++)
00078 sum += mBarrels[i].ladder(j)->wafer(k)->hits().size();
00079 return sum;
00080 }
00081
00082 StSvtBarrelHitCollection*
00083 StSvtHitCollection::barrel(unsigned int i)
00084 {
00085 if (i < mNumberOfBarrels)
00086 return &(mBarrels[i]);
00087 else
00088 return 0;
00089 }
00090
00091 const StSvtBarrelHitCollection*
00092 StSvtHitCollection::barrel(unsigned int i) const
00093 {
00094 if (i < mNumberOfBarrels)
00095 return &(mBarrels[i]);
00096 else
00097 return 0;
00098 }
00099