From: <ro...@us...> - 2010-12-27 11:40:51
|
Revision: 1747 http://nsclspectcl.svn.sourceforge.net/nsclspectcl/?rev=1747&view=rev Author: ron-fox Date: 2010-12-27 11:40:44 +0000 (Mon, 27 Dec 2010) Log Message: ----------- Added ability to get total multiplicity array. Modified Paths: -------------- branches/LLNLMadcChainSpecTcl/CMultiplicity.cpp branches/LLNLMadcChainSpecTcl/CMultiplicity.h Modified: branches/LLNLMadcChainSpecTcl/CMultiplicity.cpp =================================================================== --- branches/LLNLMadcChainSpecTcl/CMultiplicity.cpp 2010-12-27 11:40:22 UTC (rev 1746) +++ branches/LLNLMadcChainSpecTcl/CMultiplicity.cpp 2010-12-27 11:40:44 UTC (rev 1747) @@ -50,6 +50,7 @@ m_timestamp("timestamp"), m_moduleID("moduleID"), m_bankNo("bankNo"), + m_currentCycle(0), m_initialized(false) { } @@ -137,11 +138,13 @@ // Clear/release the various data that we will use to accumulate multiplicities and multiplicity // sums: // + m_fragmentQueues.clear(); // All the fragment queues must be empty by definition. + m_Histogram.clear(); + delete []m_currentCycle; m_currentCycleNumber = 0; m_currentCycle = new uint32_t[(int)((double)m_bins)]; memset(m_currentCycle, 0, m_bins * sizeof(uint32_t)); - m_Histogram.clear(); // Set up the fragment queues: @@ -206,11 +209,9 @@ writeMultiplicityData(filename, comment); - // Cleanup data: + // Cleanup data-- done in begin so that we can fish out data between runs if needed. - m_fragmentQueues.clear(); // All the fragment queues must be empty by definition. - m_Histogram.clear(); - delete []m_currentCycle; + m_initialized = false; } @@ -1002,3 +1003,27 @@ } m_currentCycle[bin] += count; // Add to the neutron count for this bin. } +/*--------------------------------------------------------------------------- +** Query functions, used by plotting e.g. +----------------------------------------------------------------------------*/ +/* +** Return a multiplicity histogram. +** e.g. total number of zeroes, 1's two's etc. in the histogram. +** @return vector<unsigned> +*/ +vector<unsigned> +CMultiplicity::getMultiplicityTotals() +{ + vector<unsigned> result; + for(int i =0; i < m_Histogram.size(); i++) { + for(int j = 0; j < m_Histogram[i].size(); j++) { + unsigned neutrons = m_Histogram[i][j]; + while (result.size() <= j) { + result.push_back(0); + } + result[j] += neutrons; + } + } + + return result; +} Modified: branches/LLNLMadcChainSpecTcl/CMultiplicity.h =================================================================== --- branches/LLNLMadcChainSpecTcl/CMultiplicity.h 2010-12-27 11:40:22 UTC (rev 1746) +++ branches/LLNLMadcChainSpecTcl/CMultiplicity.h 2010-12-27 11:40:44 UTC (rev 1747) @@ -166,6 +166,12 @@ CEvent& rEvent, CAnalyzer& rAnalyzer, CBufferDecoder& rDecoder); + /** + ** Query functions. - These functions allow you to fish out + */ + + std::vector<unsigned> getMultiplicityTotals(); + // Utitities: private: void saveTreeVariables(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |