/** * @file SOxfordPMTsetup.cpp * @author Dan Saunders, on behalf of the SoLid collaboration. * @date Halloween 2016 */ #include "SOxfordPMTsetup.h" //============================================================================== //! Constructor setting up default values. SOxfordPMTsetup::SOxfordPMTsetup(SDetector * dtr, SClipboard * cb) : ISAlgorithm(dtr, cb, "SOxfordPMTsetup"), m_nBytesIn(0) {} //============================================================================== void SOxfordPMTsetup::initialize() { m_chain = new TChain("waveforms"); br_waveform0 = new std::vector; br_waveform1 = new std::vector; // ROOT needs this. br_waveform0 = 0; br_waveform1 = 0; m_chain->SetBranchAddress("wf_ch0", &br_waveform0); m_chain->SetBranchAddress("wf_ch1", &br_waveform1); 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"<GetEntry(cb()->cycle()); uint64_t time = 0; SWaveform * w0 = new SWaveform(time, 0, dtr()->channel(0)); SWaveform * w1 = new SWaveform(time, 0, dtr()->channel(1)); // Since saffron2 histos are currently setup to hand ADC values (not PAs, yet), // artificially introduce a gain of 50ADC/PA to scale this data (currently in PA). for (uint i=0; isize(); i++) w0->samples()->emplace_back(uint16_t(50*br_waveform0->at(i))); for (uint i=0; isize(); i++) w1->samples()->emplace_back(uint16_t(50*br_waveform1->at(i))); cb()->waveforms()->push_back(w0); dtr()->channel(0)->addWaveform(w0); cb()->waveforms()->push_back(w1); dtr()->channel(1)->addWaveform(w1); } //============================================================================== void SOxfordPMTsetup::finalize() { std::cout<<"[Note]: Fraction data read in: "<cycle()/float(m_chain->GetEntries())<