//////////////////////////////////////////////////////////////////////// /// \class RAT::DS::PMTSet /// /// \brief Collection of PMTs by SNO+ type /// /// \author Phil G Jones /// /// REVISION HISTORY:\n /// 2014-03-18 : P G Jones - New file, methods from EV.\n /// 2017-03-28 : T Kaptanoglu - Add HQE PMTs /// /// \details 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 /// /// UncalPMTs = PMTSet /// /// and calibrated PMTs /// /// CalPMTs = PMTSet /// /// and mc hits /// /// MCHits = PMTSet /// //////////////////////////////////////////////////////////////////////// #ifndef __RAT_DS_PMTSet___ #define __RAT_DS_PMTSet___ #include #include #include #include #include #include #include namespace RAT { namespace DS { template class PMTSet : public TObject { public: /// construct the PMT, nothing to do PMTSet() : TObject() { } /// Combine a PMTSet with this one /// /// @param[in] set to combine to this inline void Combine( const PMTSet& set ); /// 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 ); /// @copydoc GetAllPMT(size_t) inline const T& GetAllPMT( size_t index ) const; /// 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 inward.at( index ); } /// @copydoc GetPMT(size_t) const T& GetPMT( const size_t index ) const { return inward.at( 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& GetNormalPMT( const size_t index ) { return normal.at( index ); } /// @copydoc GetNormalPMT(size_t) const T& GetNormalPMT( const size_t index ) const { 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 ); } /// @copydoc GetOWLPMT(size_t) const T& GetOWLPMT( const size_t index ) const { 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 ); } /// @copydoc GetLowGainPMT(size_t) const T& GetLowGainPMT( const size_t index ) const { 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 ); } /// @copydoc GetBUTTPMT(size_t) const T& GetBUTTPMT( const size_t index ) const { return butt.at( index ); } /// Get a PMT using the index in the neck 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& GetNeckPMT( const size_t index ) { return neck.at( index ); } /// @copydoc GetNeckPMT(size_t) const T& GetNeckPMT( const size_t index ) const { return neck.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 ); } /// @copydoc GetFECDPMT(size_t) const T& GetFECDPMT( const size_t index ) const { 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 ); } /// @copydoc GetSparePMT(size_t) const T& GetSparePMT( const size_t index ) const { return spare.at( index ); } /// Get a PMT using the index in the HQE 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& GetHQEPMT( const size_t index ) { return hqe.at( index ); } /// @copydoc GetHQEPMT(size_t) const T& GetHQEPMT( const size_t index ) const { return hqe.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 ); } /// @copydoc GetInvalidPMT(size_t) const T& GetInvalidPMT( const size_t index ) const { 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 inward PMTs (normal + HQE) /// /// @return count of inward PMTs (normal + HQE) size_t GetCount() const { return inward.size(); } /// Get the count of normal PMTs /// /// @return count of normal PMTs size_t GetNormalCount() 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 neck PMTs /// /// @return count of neck PMTs size_t GetNeckCount() const { return neck.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 HQE PMTs /// /// @return count of HQE PMTs size_t GetHQECount() const { return hqe.size(); } /// Get the count of invalid PMTs /// /// @return count of invalid PMTs size_t GetInvalidCount() const { return invalid.size(); } /// Add a PMT with the type specified by an UInt_t /// /// @param[in] pmt to add /// @param[in] type of the pmt inline void AddPMT( const T& pmt, const DU::PMTInfo::EPMTType type ); /// Add a normal PMT /// /// @param[in] pmt to add void AddNormalPMT( const T& pmt ) { normal.push_back( pmt ); } /// Add an inward PMT /// /// @param[in] pmt to add void AddInwardPMT( const T& pmt ) { inward.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 neck PMT /// /// @param[in] pmt to add void AddNeckPMT( const T& pmt ) { neck.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 an HQE PMT /// /// @param[in] pmt to add void AddHQEPMT( const T& pmt ) { hqe.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( normal ); } /// Prune the normal PMTs void PruneInwardPMTs() { clear_vector( inward ); } /// Prune the owl PMTs void PruneOWLPMTs() { clear_vector( owl ); } /// Prune the low gain PMTs void PruneLowGainPMTs() { clear_vector( lowGain ); } /// Prune the butt PMTs void PruneBUTTPMTs() { clear_vector( butt ); } /// Prune the neck PMTs void PruneNeckPMTs() { clear_vector( neck ); } /// Prune the fecd PMTs void PruneFECDPMTs() { clear_vector( fecd ); } /// Prune the spare PMTs void PruneSparePMTs() { clear_vector( spare ); } /// Prune the hqe PMTs void PruneHQEPMTs() { clear_vector( hqe ); } /// Prune the invalid PMTs void PruneInvalidPMTs() { clear_vector( invalid ); } // This ROOT macro adds dictionary methods to this class. // The number should be incremented whenever this class's members are changed. // It assumes this class has no virtual methods, use ClassDef if change this. ClassDefNV( PMTSet, 2 ); protected: std::vector normal; ///< Collection of normal PMTs std::vector inward; ///< Collection of inward PMTs (normal + HQE) std::vector owl; ///< Collection of OWL PMTs std::vector lowGain; ///< Collection of Low Gain PMTs std::vector butt; ///< Collection of BUTT PMTs (don't exist in SNO+) std::vector neck; ///< Collection of neck PMTs std::vector fecd; ///< Collection of FECD PMTs (really daq channels) std::vector spare; ///< Collection of spare PMTs (really daq channels) std::vector hqe; ///< Collection of HQE PMTs std::vector invalid; ///< Collection of invalid PMTs (really daq channels) }; template void PMTSet::Combine( const PMTSet& set ) { normal.insert( normal.end(), set.normal.begin(), set.normal.end() ); inward.insert( inward.end(), set.inward.begin(), set.inward.end() ); owl.insert( owl.end(), set.owl.begin(), set.owl.end() ); lowGain.insert( lowGain.end(), set.lowGain.begin(), set.lowGain.end() ); butt.insert( butt.end(), set.butt.begin(), set.butt.end() ); neck.insert( neck.end(), set.neck.begin(), set.neck.end() ); fecd.insert( fecd.end(), set.fecd.begin(), set.fecd.end() ); spare.insert( spare.end(), set.spare.begin(), set.spare.end() ); hqe.insert( hqe.end(), set.hqe.begin(), set.hqe.end() ); invalid.insert( invalid.end(), set.invalid.begin(), set.invalid.end() ); } template void PMTSet::AddPMT( const T& pmt, const DU::PMTInfo::EPMTType type ) { switch(type) { case DU::PMTInfo::NORMAL: AddNormalPMT( pmt ); AddInwardPMT( pmt ); break; case DU::PMTInfo::OWL: AddOWLPMT( pmt ); break; case DU::PMTInfo::LOWGAIN: AddLowGainPMT( pmt ); break; case DU::PMTInfo::BUTT: AddBUTTPMT( pmt ); break; case DU::PMTInfo::NECK: AddNeckPMT( pmt ); break; case DU::PMTInfo::CALIB: AddFECDPMT( pmt ); break; case DU::PMTInfo::SPARE: AddSparePMT( pmt ); break; case DU::PMTInfo::HQE: AddHQEPMT( pmt ); AddInwardPMT( pmt ); break; case DU::PMTInfo::INVALID: AddInvalidPMT( pmt ); break; default: warn << "PMTSet::AddPMT: Unknown PMT type: " << type << "\n"; break; } } template T& PMTSet::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 < neck.size() ) return neck.at( index ); index -= neck.size(); if( index < fecd.size() ) return fecd.at( index ); index -= fecd.size(); if( index < spare.size() ) return spare.at( index ); index -= spare.size(); if( index < hqe.size() ) return hqe.at( index ); index -= hqe.size(); return invalid.at( index ); } template const T& PMTSet::GetAllPMT( size_t index ) const { 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 < neck.size() ) return neck.at( index ); index -= neck.size(); if( index < fecd.size() ) return fecd.at( index ); index -= fecd.size(); if( index < spare.size() ) return spare.at( index ); index -= spare.size(); if( index < hqe.size() ) return hqe.at( index ); index -= hqe.size(); return invalid.at( index ); } template size_t PMTSet::GetAllCount() const { return normal.size() + owl.size() + lowGain.size() + butt.size() + neck.size() + fecd.size() + spare.size() + hqe.size() + invalid.size(); } template void PMTSet::PruneAllPMTs() { clear_vector( normal ); clear_vector( inward ); clear_vector( owl ); clear_vector( lowGain ); clear_vector( butt ); clear_vector( neck ); clear_vector( fecd ); clear_vector( spare ); clear_vector( hqe ); clear_vector( invalid ); } /// \class RAT::DS::UncalPMTs /// This is a typedef of the PMTSet class using RAT::DS::PMTUncal /// \sa RAT::DS::PMTSet for full documentation typedef PMTSet UncalPMTs; /// \class RAT::DS::CalPMTs /// This is a typedef of the PMTSet class using RAT::DS::PMTCal /// \sa RAT::DS::PMTSet for full documentation typedef PMTSet CalPMTs; /// \class RAT::DS::MCHits /// This is a typedef of the PMTSet class using MCHit /// \sa RAT::DS::PMTSet for full documentation typedef PMTSet MCHits; } // namespace DS } // namespace RAT #endif