/** * @file STBuilder.cpp * @author Dan Saunders, on behalf of the SoLid collaboration. * @date 19 Feb 2016 */ #include "STBuilder.h" //============================================================================== //! Constructor setting up default values. STBuilder::STBuilder(SDetector * dtr, SClipboard * cb) : ISAlgorithm(dtr, cb, "STBuilder"), m_chainPos(0) {} //============================================================================== //! Setup branches to intput tree and load files on the clipboard. void STBuilder::initialize() { m_chain = new TChain("waveforms"); m_chain->SetBranchAddress("waveform", &br_waveform); br_waveform = 0; // Stupid ROOT. m_chain->SetBranchAddress("chanID", &br_safChanID); m_chain->SetBranchAddress("cycle", &br_iCycle); if (cb()->inputDataFileNames()->size()==0) { std::cout<<"[Error]: Exiting since no input files specified"<inputDataFileNames())) { std::cout<<"[Note]: Adding input data file: "<Add(f.c_str()); if (status < 1) { std::cout<<"[Error]: Exiting due to problem adding file: "<GetEntry(0); std::cout<<"[Note]: ...done"<cycle()) { if (!dtr()->channel(br_safChanID)->masked()) { uint64_t time = 0; SWaveform * w = new SWaveform(time, 0, dtr()->channel(br_safChanID)); for (uint i=0; isize(); i++) w->samples()->emplace_back(br_waveform->at(i)); cb()->waveforms()->push_back(w); dtr()->channel(br_safChanID)->waveforms()->push_back(w); } m_chainPos++; if (m_chainPos == m_chain->GetEntries()) { setRunStopped(true); break; } // Get the next entry. In case of a cycle boundry, this is the first of the // next cycle. m_chain->GetEntry(m_chainPos); } } //============================================================================== //! Empty finalize. void STBuilder::finalize() {} //==============================================================================