/***************************************************************************
*
* $Id$
*
* Author: Marcelo Munhoz
***************************************************************************
*
* Description: SVT Hybrid Data BASE class
*
***************************************************************************
*
* $Log$
**************************************************************************/
////////////////////////////////////////////////////////////////////////////
// //
// This is the class to access the data from each hybrid. //
// //
////////////////////////////////////////////////////////////////////////////
#include "StSvtHybridData.hh"
#include "StSequence.hh"
#include "StDAQMaker/StDAQReader.h"
ClassImp(StSvtHybridData)
StSvtHybridData::StSvtHybridData() : StSvtHybrid()
{
nAnodes = 0;
anodeList = NULL;
nSeq = NULL;
seq = NULL;
}
StSvtHybridData::StSvtHybridData(int barrel, int ladder, int wafer, int hybrid) :
StSvtHybrid(barrel, ladder, wafer, hybrid)
{
//This constructor has four input parameters: Barrel, Ladder, Wafer and Hybrid number (as expected).
nAnodes = 0;
anodeList = NULL;
nSeq = NULL;
seq = NULL;
}
StSvtHybridData::StSvtHybridData(const StSvtHybridData& hybrid)
{
mBarrel = hybrid.mBarrel;
mLadder = hybrid.mLadder;
mWafer = hybrid.mWafer;
mHybrid = hybrid.mHybrid;
}
StSvtHybridData::~StSvtHybridData()
{
delete [] anodeList;
delete [] nSeq;
for (int ianode=0;ianode<nAnodes;ianode++)
if (seq[ianode]) delete seq[ianode];
delete [] seq;
}
StSvtHybridData& StSvtHybridData::operator = (const StSvtHybridData& hybrid)
{
mBarrel = hybrid.mBarrel;
mLadder = hybrid.mLadder;
mWafer = hybrid.mWafer;
mHybrid = hybrid.mHybrid;
nAnodes = hybrid.nAnodes;
anodeList = hybrid.anodeList;
nSeq = hybrid.nSeq;
seq = hybrid.seq;
return *this;
}
Bool_t StSvtHybridData::setHybrid(StSVTReader* reader)
{
// fills the data members of this object,
// so one can access the data through the two methods mentioned below.
// Therefore, it must be invoked before the access methods.
// This method can be overloaded to allow other types of input data (simulators, ASCII files, etc.).
// If everything goes OK, it returns kTRUE.
int anode, n, status=0;
unsigned char* array;
nAnodes = 240;
anodeList = new int[nAnodes];
nSeq = new int[nAnodes];
seq = new StSequence*[nAnodes];
for (int ianode=0;ianode<nAnodes;ianode++)
seq[ianode] = 0;
for (ianode=0;ianode<nAnodes;ianode++) {
anode = ianode + 1;
anodeList[ianode] = anode;
status = reader->getRawADC(mBarrel, mLadder, mWafer, mHybrid, anode, n, array);
if (status != 1) return status;
nSeq[ianode] = n;
// cout << "anode = " << anode << ", nSeq[ianode] = " << nSeq[ianode] << endl;
seq[ianode] = new StSequence[nSeq[ianode]];
for (int iseq=0;iseq<nSeq[ianode];iseq++) {
seq[ianode][iseq].startTimeBin = iseq;
seq[ianode][iseq].length = 1;
seq[ianode][iseq].firstAdc = array;
}
}
return status;
}
int StSvtHybridData::getAnodeList(int*& list)
{
// returns the number of anodes of a given hybrid that has one or more sequences of data.
// The anodeList contains the number (ID) of such anodes.
// In the case of raw data, it returns always 240 anodes.
cout << "StSvtHybridData::list = " << &list << ", anodelist = " << anodeList << endl;
list = anodeList;
return nAnodes;
}
int StSvtHybridData::getSequences(int anode, int& nSequence, StSequence*& sequence)
{
// provides the number of sequences each anode has (nSequences) and a list of the sequences (sequence).
// The structure StSequence (from StarClassLibrary) gives the first time bin of the sequence,
// the length of the sequence and a pointer for the first ADC of the sequence.
for (int i=0;i<nAnodes;i++) {
if (anodeList[i]==anode) {
nSequence = nSeq[i];
sequence = seq[i];
}
}
return 0;
}
ROOT page - Class index - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.