54 #include "StSvtHybridData.hh"
55 #include "StSequence.hh"
68 StSvtHybridData::StSvtHybridData(
int barrel,
int ladder,
int wafer,
int hybrid) :
77 StSvtHybridData::~StSvtHybridData()
90 mBarrel = hybrid.mBarrel;
91 mLadder = hybrid.mLadder;
92 mWafer = hybrid.mWafer;
93 mHybrid = hybrid.mHybrid;
94 mTimeZero = hybrid.mTimeZero;
95 mSCAZero = hybrid.mSCAZero;
98 anodeList = hybrid.anodeList;
99 lookUp = hybrid.lookUp;
105 mBarrel = hybrid.mBarrel;
106 mLadder = hybrid.mLadder;
107 mWafer = hybrid.mWafer;
108 mHybrid = hybrid.mHybrid;
109 mTimeZero = hybrid.mTimeZero;
110 mSCAZero = hybrid.mSCAZero;
112 anodeList = hybrid.anodeList;
113 lookUp = hybrid.lookUp;
118 int StSvtHybridData::getAnodeList(
int*& list)
123 if (!anodeList.size()) setAnodeList();
124 list = &anodeList[0];
125 return anodeList.size();
129 int StSvtHybridData::getSequences(
int anode,
int& nSequence,
StSequence*& sequence)
137 if (!lookUp.size()) setAnodeList();
138 if (anode>=(
int)lookUp.size())
return 0;
139 int i = lookUp[anode];
140 assert(i<(
int)seq.size());
142 nSequence = seq[i].size();
143 sequence = &(seq[i][0]);
148 int StSvtHybridData::getListSequences(
int listID,
int& nSequence,
StSequence*& sequence)
152 if(listID >= 0 && listID < (
int)seq.size())
154 nSequence = seq[listID].size();
155 sequence = &seq[listID][0];
160 int StSvtHybridData::getListTruth(
int listID,
int& nSequence,
StMCTruth*& sequence)
164 if(listID >= 0 && listID < (
int)seq.size())
166 nSequence = seq[listID].mTruth.size();
167 sequence = &seq[listID].mTruth[0];
169 if(!nSequence) sequence=0;
174 int StSvtHybridData::setListSequences(
int listID,
int Anode,
int& nSequence,
StSequence* tempSeq)
177 int nAnodes = seq.size();
186 if(listID >= 0 && listID < nAnodes){
187 seq[listID].resize(nSequence);
188 seq[listID].mAnode = Anode;
189 seq[listID].mTruth.resize(0);
190 memcpy(&(seq[listID][0]),tempSeq,nSequence*
sizeof(
StSequence));
195 int StSvtHybridData::setListTruth(
int listID,
int Anode,
int& nSequence,
StMCTruth* tempTru)
198 int nAnodes = seq.size();
200 if(listID >= 0 && listID < nAnodes){
201 assert(Anode==seq[listID].mAnode);
202 assert((
int)seq[listID].size()==nSequence);
203 seq[listID].mTruth.resize(nSequence);
204 memcpy(&(seq[listID].mTruth[0]),tempTru,nSequence*
sizeof(
StMCTruth));
210 int StSvtHybridData::setAnodeList()
215 int nAnodes = seq.size();
216 anodeList.resize(nAnodes);
218 for(
int i=0; i<nAnodes; i++){
219 if(!seq[i].size())
continue;
220 if (maxAnode<seq[i].mAnode) maxAnode=seq[i].mAnode;
222 seq[newTot].mAnode = seq[i].mAnode;
223 seq[newTot].swap(seq[i]);
224 seq[newTot].mTruth.swap(seq[i].mTruth);
226 anodeList[newTot] = seq[newTot].mAnode;
231 anodeList.resize(nAnodes);
233 lookUp.resize(maxAnode+1,-1);
234 for(
int i=0; i<nAnodes; i++){lookUp[seq[i].mAnode] = i;}