/** @class CalcDark.cpp @author Brian Magill @creation date 1/1/2007 $Date:$ $Revision:$ @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 Calculates the dark signal for a given channel */ #include "CalcDark.h" #include "CalcDarkValue.h" #include "CalcDarkDiff.h" #include "SOFIE_namespace.h" #include "GATS_Utilities.hpp" using namespace std; using GATS_Utilities::ConvertToString; void CalcDark::operator()(std::valarray const &time, ChannelSignals const &in, DarkSigParam &darkParam, std::string &comments) { const bool calcPerformed = true; CalcDarkValue calcValue; CalcDarkDiff calcDiffValue; //double correction; valarray workStrong; valarray workWeak; valarray workDiff; int gasID = in.getID(); vector offset(3); vector tRef(3); vector sigma(3, 0.0); vector quality(3, 0); comments = ""; in.getSignal(SOFIE::Strong, workStrong); offset[SOFIE::Strong] = calcValue(workStrong); tRef[SOFIE::Strong] = calcValue.timeAtMin(workStrong, time); if (!checkDetect->verify(offset[SOFIE::Strong])) { quality[SOFIE::Strong] = 1; comments = " Strong offset out of range, not applied."; } in.getSignal(SOFIE::Weak, workWeak); offset[SOFIE::Weak] = calcValue(workWeak); tRef[SOFIE::Weak] = calcValue.timeAtMin(workWeak, time); if (!checkDetect->verify(offset[SOFIE::Weak])) { quality[SOFIE::Weak] = 1; comments = comments + " Weak offset out of range, not applied."; } in.getSignal(SOFIE::Diff, workDiff); offset[SOFIE::Diff] = calcDiffValue(workStrong, workDiff); tRef[SOFIE::Diff] = calcValue.timeAtMin(workStrong, time); if (!checkDiff->verify(offset[SOFIE::Diff])) { quality[SOFIE::Diff] = 1; comments = comments + " Difference offset out of range, not applied."; } if (comments.size() > 0) comments = string("Channel ") + ConvertToString(gasID) + string(" : ") + comments; darkParam = DarkSigParam(gasID, offset, tRef, sigma, quality, calcPerformed); }