27 #include "StFgtDaq2RootMaker.h"
31 #include "StRoot/StEvent/StEvent.h"
32 #include "StRoot/StEvent/StFgtCollection.h"
33 #include "StRoot/StEvent/StFgtStrip.h"
36 StFgtDaq2RootMaker::StFgtDaq2RootMaker(
const Char_t* name,
37 const Char_t* outputfile )
39 mFileName( outputfile ),
44 StFgtDaq2RootMaker::~StFgtDaq2RootMaker(){
51 Int_t StFgtDaq2RootMaker::Init(){
55 LOG_INFO <<
"Opening file '" << mFileName <<
"' for output" << endm;
56 mTFile =
new TFile( mFileName.data(),
"RECREATE",
"raw fgt data from the cosmic test stand" );
57 if( !mTFile->IsOpen() ){
58 LOG_FATAL <<
"error opening file '" << mFileName <<
"'" << endm;
63 mTTree =
new TTree (
"fgtTree",
"raw fgt data from the cosmic test stand" );
64 mTTree->Branch(
"branch", &mData,
"data[26880]/I" );
70 void StFgtDaq2RootMaker::Clear(
const Option_t* opts ){
71 for( Int_t quad = 0; quad < kNumQuad; ++quad )
72 for( Int_t apv = 0; apv < kNumApv; ++apv )
73 for( Int_t chan = 0; chan < kNumApv; ++chan )
74 for( Int_t tb = 0; tb < kNumApv; ++tb )
75 mData.quad[quad].apv[apv].chan[chan].tb[tb] = 0;
83 eventPtr = (
StEvent*)GetInputDS(
"StEvent");
86 LOG_ERROR <<
"Error getting pointer to StEvent from '" << ClassName() <<
"'" << endm;
93 fgtCollectionPtr=eventPtr->fgtCollection();
96 if( !fgtCollectionPtr) {
97 LOG_ERROR <<
"Error getting pointer to StFgtCollection from '" << ClassName() <<
"'" << endm;
102 for( UInt_t discIdx=0; discIdx<fgtCollectionPtr->getNumDiscs(); ++discIdx ){
104 if( stripCollectionPtr ){
105 StSPtrVecFgtStrip& stripVec = stripCollectionPtr->getStripVec();
106 StSPtrVecFgtStripIterator stripIter;
108 for( stripIter = stripVec.begin(); stripIter != stripVec.end(); ++stripIter ){
109 for( Int_t tb = 0; tb < kFgtNumTimeBins; ++tb ){
110 Short_t adc = (*stripIter)->getAdc(tb);
112 Int_t rdo, arm, apv, chan, quad;
113 (*stripIter)->getElecCoords( rdo, arm, apv, chan );
122 if( rdo == 1 && arm == 0 && apv < 10 )
124 else if( arm == 1 && apv < 10 )
126 else if( rdo == 1 && arm == 1 && apv > 10 )
131 mData.quad[quad].apv[apv].chan[chan].tb[tb] = adc;