/** @class DetectorSignals @author Brian Magill @datecreated 12/29/2005 $Date: 2006/04/06 18:25:15 $ $Revision: 1.2 $ @copyright (©) Copyright 2006 by GATS Inc. 11864 Canon Blvd., Suite 101, Newport News, VA 23606 All Rights Reserved. No part of this software or publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise without the prior written permission of GATS Inc. @brief Contains all of the detector signals for an event */ //---------------------------------------------------------------------- // #include #include #include "DetectorSignals.h" #include "SOFIE_namespace.h" //#include "SOFIE_Exception.h" #include using namespace SOFIE; using namespace std; DetectorSignals::DetectorSignals(deque const& InSignals) { AllSignals = InSignals; } DetectorSignals::DetectorSignals(const DetectorSignals& rhs ) { AllSignals = rhs.AllSignals; } DetectorSignals& DetectorSignals::operator = (const DetectorSignals& rhs ) { if (this == &rhs) return *this; AllSignals = rhs.AllSignals; return *this; } valarray DetectorSignals::get_times() { unsigned long count = AllSignals.size(); valarray time(count); unsigned long j; for (j = 0; j < count; ++j) time[j] = AllSignals[j].getTime(); return time; } valarray DetectorSignals::get_detector_voltage(long detector_num) { unsigned long count = AllSignals.size(); valarray detector_signal(count); unsigned long j; if(detector_num < 0 || detector_num > SOFIE::tot_det_signals - 1) throw runtime_error("DetectorSignals::getChan(): invalid detector number"); for (j = 0; j < count; ++j) detector_signal[j] = AllSignals[j].getChan(detector_num); return detector_signal; } double DetectorSignals::getStartTime() { deque ::iterator DequeIter; DequeIter = min_element(AllSignals.begin(), AllSignals.end() ); return (*DequeIter).getTime(); } double DetectorSignals::getEndTime() { deque ::iterator DequeIter; DequeIter = max_element(AllSignals.begin(), AllSignals.end() ); return (*DequeIter).getTime(); } void DetectorSignals::dump() { int count = 0; deque ::iterator DequeIter; for (DequeIter = AllSignals.begin(); DequeIter != AllSignals.end(); DequeIter++) { cout << "Entry: " << ++count << endl; (*DequeIter).dump(); cout << endl; } }