Last active
August 29, 2015 13:57
-
-
Save pgjones/9665004 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// Get the uncalibrated PMTs | |
| /// | |
| /// @return the set of uncalibrated pmts | |
| PMTSet<PMTUnCal>& GetUncalibratedPMTs() { return uncalibratedPMTs;} | |
| const PMTSet<PMTUnCal>& GetUncalibratedPMTs() const { return uncalibratedPMTs;} | |
| /// Get the calibrated PMTs | |
| /// | |
| /// @return the set of calibrated pmts | |
| PMTSet<PMTCal>& GetCalibratedPMTs() { return calibratedPMTs;} | |
| const PMTSet<PMTCal>& GetCalibratedPMTs() const { return calibratedPMTs;} | |
| protected: | |
| PMTSet<PMTUnCal> uncalibratedPMTs; /// < The uncalibrated PMTs for this event | |
| PMTSet<PMTCal> calibratedPMTs; /// < The most recent (best) calibration PMTs for this event |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //////////////////////////////////////////////////////////////////////// | |
| /// \class RAT::DS::PMTSet | |
| /// | |
| /// \brief Collection of PMTs by SNO+ type | |
| /// | |
| /// \author Phil G Jones <p.g.jones@qmul.ac.uk> | |
| /// | |
| /// REVISION HISTORY:\n | |
| /// 2014-03-18 : P G Jones - New file, methods from EV.\n | |
| /// | |
| /// \detail The class contains PMTs (daq channels really) organised by | |
| /// SNO+ type. If simulating something generic only the normal collection | |
| /// will be filled. | |
| /// | |
| /// The collection of Uncalibrated PMTs is a typedef (below) as | |
| /// UncalibratedPMTs = PMTSet<PMTUnCal> | |
| /// and calibrated PMTs | |
| /// CalibratedPMTs = PMTSet<PMTCal> | |
| /// | |
| //////////////////////////////////////////////////////////////////////// | |
| #ifndef __RAT_DS_PMTSet___ | |
| #define __RAT_DS_PMTSet___ | |
| #include <TObject.h> | |
| #include <RAT/ListHelp.hh> | |
| #include <RAT/DS/PMT.hh> | |
| #include <vector> | |
| namespace RAT | |
| { | |
| namespace DS | |
| { | |
| template<class T> | |
| class PMTSet : public TObject | |
| { | |
| public: | |
| /// construct the PMT, nothing to do | |
| PMTSet() : TObject() { } | |
| virtual ~PMTSet() { } | |
| /// Get a PMT using the index in all of the vectors | |
| /// | |
| /// @param[in] index into the all vectors | |
| /// @return reference to the T (PMT type) | |
| /// @throws out_of_range if the index is out of range | |
| inline T& GetAllPMT( size_t index ); | |
| /// Get a PMT using the index in the normal vector | |
| /// | |
| /// @param[in] index into the array | |
| /// @return reference to the T (PMT type) | |
| /// @throws out_of_range if the index is out of range | |
| T& GetPMT( const size_t index ) { return normal.at( index ); } | |
| /// Get a PMT using the index in the owl vector | |
| /// | |
| /// @param[in] index into the array | |
| /// @return reference to the T (PMT type) | |
| /// @throws out_of_range if the index is out of range | |
| T& GetOWLPMT( const size_t index ) { return owl.at( index ); } | |
| /// Get a PMT using the index in the low gain vector | |
| /// | |
| /// @param[in] index into the array | |
| /// @return reference to the T (PMT type) | |
| /// @throws out_of_range if the index is out of range | |
| T& GetLowGainPMT( const size_t index ) { return lowGain.at( index ); } | |
| /// Get a PMT using the index in the butt vector | |
| /// | |
| /// @param[in] index into the array | |
| /// @return reference to the T (PMT type) | |
| /// @throws out_of_range if the index is out of range | |
| T& GetBUTTPMT( const size_t index ) { return butt.at( index ); } | |
| /// Get a PMT using the index in the fecd vector | |
| /// | |
| /// @param[in] index into the array | |
| /// @return reference to the T (PMT type) | |
| /// @throws out_of_range if the index is out of range | |
| T& GetFECDPMT( const size_t index ) { return fecd.at( index ); } | |
| /// Get a PMT using the index in the spare vector | |
| /// | |
| /// @param[in] index into the array | |
| /// @return reference to the T (PMT type) | |
| /// @throws out_of_range if the index is out of range | |
| T& GetSparePMT( const size_t index ) { return spare.at( index ); } | |
| /// Get a PMT using the index in the invalid vector | |
| /// | |
| /// @param[in] index into the array | |
| /// @return reference to the T (PMT type) | |
| /// @throws out_of_range if the index is out of range | |
| T& GetInvalidPMT( const size_t index ) { return invalid.at( index ); } | |
| /// Get the count of all PMTs | |
| /// | |
| /// @return count of all the PMTs | |
| inline size_t GetAllCount() const; | |
| /// Get the count of normal PMTs | |
| /// | |
| /// @return count of normal PMTs | |
| size_t GetCount() const { return normal.size(); } | |
| /// Get the count of OWL PMTs | |
| /// | |
| /// @return count of OWL PMTs | |
| size_t GetOWLCount() const { return owl.size(); } | |
| /// Get the count of low gain PMTs | |
| /// | |
| /// @return count of low gain PMTs | |
| size_t GetLowGainCount() const { return lowGain.size(); } | |
| /// Get the count of BUTT PMTs | |
| /// | |
| /// @return count of BUTT PMTs | |
| size_t GetBUTTCount() const { return butt.size(); } | |
| /// Get the count of FECD PMTs | |
| /// | |
| /// @return count of FECD PMTs | |
| size_t GetFECDCount() const { return fecd.size(); } | |
| /// Get the count of spare PMTs | |
| /// | |
| /// @return count of spare PMTs | |
| size_t GetSpareCount() const { return spare.size(); } | |
| /// Get the count of invalid PMTs | |
| /// | |
| /// @return count of invalid PMTs | |
| size_t GetInvalidCount() const { return invalid.size(); } | |
| /// Add a normal PMT | |
| /// | |
| /// @param[in] pmt to add | |
| void AddPMT( const T& pmt ) { normal.push_back( pmt ); } | |
| /// Add a owl PMT | |
| /// | |
| /// @param[in] pmt to add | |
| void AddOWLPMT( const T& pmt ) { owl.push_back( pmt ); } | |
| /// Add a low gain PMT | |
| /// | |
| /// @param[in] pmt to add | |
| void AddLowGainPMT( const T& pmt ) { lowGain.push_back( pmt ); } | |
| /// Add a butt PMT | |
| /// | |
| /// @param[in] pmt to add | |
| void AddBUTTPMT( const T& pmt ) { butt.push_back( pmt ); } | |
| /// Add a fecd PMT | |
| /// | |
| /// @param[in] pmt to add | |
| void AddFECDPMT( const T& pmt ) { fecd.push_back( pmt ); } | |
| /// Add a spare PMT | |
| /// | |
| /// @param[in] pmt to add | |
| void AddSparePMT( const T& pmt ) { spare.push_back( pmt ); } | |
| /// Add a invalid PMT | |
| /// | |
| /// @param[in] pmt to add | |
| void AddInvalidPMT( const T& pmt ) { invalid.push_back( pmt ); } | |
| /// Prune all the PMTs | |
| inline void PruneAllPMTs(); | |
| /// Prune the normal PMTs | |
| void PruneNormalPMTs() { clear_vector<T>( normal ); } | |
| /// Prune the owl PMTs | |
| void PruneOWLPMTs() { clear_vector<T>( owl ); } | |
| /// Prune the low gain PMTs | |
| void PruneLowGainPMTs() { clear_vector<T>( lowGain ); } | |
| /// Prune the butt PMTs | |
| void PruneBUTTPMTs() { clear_vector<T>( butt ); } | |
| /// Prune the fecd PMTs | |
| void PruneFECDPMTs() { clear_vector<T>( fecd ); } | |
| /// Prune the spare PMTs | |
| void PruneSparePMTs() { clear_vector<T>( spare ); } | |
| /// Prune the invalid PMTs | |
| void PruneInvalidPMTs() { clear_vector<T>( invalid ); } | |
| ClassDef( PMTSet, 1 ) | |
| protected: | |
| std::vector<T> normal; /// < Collection of normal PMTs | |
| std::vector<T> owl; /// < Collection of OWL PMTs | |
| std::vector<T> lowGain; /// < Collection of Low Gain PMTs | |
| std::vector<T> butt; /// < Collection of BUTT PMTs (don't exist in SNO+) | |
| std::vector<T> fecd; /// < Collection of FECD PMTs (really daq channels) | |
| std::vector<T> spare; /// < Collection of spare PMTs (really daq channels) | |
| std::vector<T> invalid; /// < Collection of invalid PMTs (really daq channels) | |
| }; | |
| template<class T> | |
| T& | |
| PMTSet<T>::GetAllPMT( size_t index ) | |
| { | |
| if( index < normal.size() ) return normal.at( index ); | |
| index -= normal.size(); | |
| if( index < owl.size() ) return owl.at( index ); | |
| index -= owl.size(); | |
| if( index < lowGain.size() ) return lowGain.at( index ); | |
| index -= lowGain.size(); | |
| if( index < butt.size() ) return butt.at( index ); | |
| index -= butt.size(); | |
| if( index < fecd.size() ) return fecd.at( index ); | |
| index -= fecd.size(); | |
| if( index < spare.size() ) return spare.at( index ); | |
| index -= spare.size(); | |
| return invalid.at( index ); | |
| } | |
| template<class T> | |
| size_t | |
| PMTSet<T>::GetAllCount() const | |
| { | |
| return normal.size() + owl.size() + lowGain.size() + butt.size() + fecd.size() + spare.size() + invalid.size(); | |
| } | |
| template<class T> | |
| void | |
| PMTSet<T>::PruneAllPMTs() | |
| { | |
| clear_vector<T>( normal ); | |
| clear_vector<T>( owl ); | |
| clear_vector<T>( lowGain ); | |
| clear_vector<T>( butt ); | |
| clear_vector<T>( fecd ); | |
| clear_vector<T>( spare ); | |
| clear_vector<T>( invalid ); | |
| } | |
| typedef PMTSet<PMTUnCal> UncalibratedPMTs; | |
| typedef PMTSet<PMTCal> CalibratedPMTs; | |
| } // namespace DS | |
| } // namespace RAT | |
| #endif |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Forgot about neck pmts, added in local version.