Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:15:55

0001 /**
0002  *  @file   PandoraSDK/include/Objects/OrderedCaloHitList.h
0003  * 
0004  *  @brief  Header file for the ordered calo hit list class.
0005  * 
0006  *  $Log: $
0007  */
0008 #ifndef PANDORA_ORDERED_CALO_HIT_LIST_H
0009 #define PANDORA_ORDERED_CALO_HIT_LIST_H 1
0010 
0011 #include "Objects/CaloHit.h"
0012 
0013 #include "Pandora/PandoraInternal.h"
0014 #include "Pandora/StatusCodes.h"
0015 
0016 #include <map>
0017 
0018 namespace pandora
0019 {
0020 
0021 /**
0022  *  @brief  Calo hit lists arranged by pseudo layer
0023  */
0024 class OrderedCaloHitList
0025 {
0026 public:
0027     typedef std::map<unsigned int, CaloHitList *> TheList;
0028     typedef TheList::value_type value_type;
0029     typedef TheList::const_iterator const_iterator;
0030     typedef TheList::const_reverse_iterator const_reverse_iterator;
0031 
0032     /**
0033      *  @brief  Default constructor
0034      */
0035     OrderedCaloHitList();
0036 
0037     /**
0038      *  @brief  Copy constructor
0039      * 
0040      *  @param  rhs the ordered calo hit list to copy
0041      */
0042     OrderedCaloHitList(const OrderedCaloHitList &rhs);
0043 
0044     /**
0045      *  @brief  Destructor
0046      */
0047     ~OrderedCaloHitList();
0048 
0049     /**
0050      *  @brief  Add the hits from a second ordered calo hit list to this list
0051      * 
0052      *  @param  rhs the source ordered calo hit list
0053      */
0054     StatusCode Add(const OrderedCaloHitList &rhs);
0055 
0056     /**
0057      *  @brief  Remove the hits in a second ordered calo hit list from this list
0058      * 
0059      *  @param  rhs the source ordered calo hit list
0060      */
0061     StatusCode Remove(const OrderedCaloHitList &rhs);
0062 
0063     /**
0064      *  @brief  Add a list of calo hits to the ordered calo hit list
0065      * 
0066      *  @param  caloHitList the calo hit list
0067      */
0068     StatusCode Add(const CaloHitList &caloHitList);
0069 
0070     /**
0071      *  @brief  Remove a list of calo hits from the ordered calo hit list
0072      * 
0073      *  @param  caloHitList the calo hit list
0074      */
0075     StatusCode Remove(const CaloHitList &caloHitList);
0076 
0077     /**
0078      *  @brief  Add a calo hit to the ordered calo hit list
0079      * 
0080      *  @param  pCaloHit the address of the calo hit
0081      */
0082     StatusCode Add(const CaloHit *const pCaloHit);
0083 
0084     /**
0085      *  @brief  Remove a calo hit from the ordered calo hit list
0086      * 
0087      *  @param  pCaloHit the address of the calo hit
0088      */
0089     StatusCode Remove(const CaloHit *const pCaloHit);
0090 
0091     /**
0092      *  @brief  Get calo hits in specified pseudo layer
0093      * 
0094      *  @param  pseudoLayer the pseudo layer
0095      *  @param  pCaloHitList to receive the address of the relevant calo hit list
0096      */
0097     StatusCode GetCaloHitsInPseudoLayer(const unsigned int pseudoLayer, CaloHitList *&pCaloHitList) const;
0098 
0099     /**
0100      *  @brief  Get the number of calo hits in a specified pseudo layer
0101      * 
0102      *  @param  pseudoLayer the pseudo layer
0103      * 
0104      *  @return The number of calo hits in the specified pseudo layer
0105      */
0106     unsigned int GetNCaloHitsInPseudoLayer(const unsigned int pseudoLayer) const;
0107 
0108     /**
0109      *  @brief  Reset the ordered calo hit list, emptying its contents
0110      */
0111     void Reset();
0112 
0113     /**
0114      *  @brief  Fill a provided calo hit list with all the calo hits in the ordered calo hit list
0115      * 
0116      *  @param  caloHitList to receive the list of calo hits
0117      */
0118     void FillCaloHitList(CaloHitList &caloHitList) const;
0119 
0120     /**
0121      *  @brief  Returns a const iterator referring to the first element in the ordered calo hit list
0122      */
0123     const_iterator begin() const;
0124 
0125     /**
0126      *  @brief  Returns a const iterator referring to the past-the-end element in the ordered calo hit list
0127      */
0128     const_iterator end() const;
0129 
0130     /**
0131      *  @brief  Returns a const reverse iterator referring to the first element in the ordered calo hit list
0132      */
0133     const_reverse_iterator rbegin() const;
0134 
0135     /**
0136      *  @brief  Returns a const reverse iterator referring to the past-the-end element in the ordered calo hit list
0137      */
0138     const_reverse_iterator rend() const;
0139 
0140     /**
0141      *  @brief  Searches the container for an element with specified layer and returns an iterator to it if found,
0142      *          otherwise it returns an iterator to the past-the-end element.
0143      */
0144     const_iterator find(const unsigned int index) const;
0145 
0146     /**
0147      *  @brief  Returns the number of elements in the container.
0148      */
0149     unsigned int size() const;
0150 
0151     /**
0152      *  @brief  Returns whether the map container is empty (i.e. whether its size is 0)
0153      */
0154     bool empty() const;
0155 
0156     /**
0157      *  @brief  Assignment operator
0158      * 
0159      *  @param  rhs the ordered calo hit list to assign
0160      */
0161     bool operator= (const OrderedCaloHitList &rhs);
0162 
0163 private:
0164     /**
0165      *  @brief  Clear the ordered calo hit list
0166      */
0167     void clear();
0168 
0169     /**
0170      *  @brief  Add a calo hit to a specified pseudo layer
0171      * 
0172      *  @param  pCaloHit the address of the calo hit
0173      *  @param  pseudoLayer the pesudo layer
0174      */
0175     StatusCode Add(const CaloHit *const pCaloHit, const unsigned int pseudoLayer);
0176 
0177     /**
0178      *  @brief  Remove a calo hit from a specified pseudo layer
0179      * 
0180      *  @param  pCaloHit the address of the calo hit
0181      *  @param  pseudoLayer the pesudo layer
0182      */
0183     StatusCode Remove(const CaloHit *const pCaloHit, const unsigned int pseudoLayer);
0184 
0185     TheList     m_theList;      ///< The ordered calo hit list
0186 };
0187 
0188 //------------------------------------------------------------------------------------------------------------------------------------------
0189 
0190 inline OrderedCaloHitList::const_iterator OrderedCaloHitList::begin() const
0191 {
0192     return m_theList.begin();
0193 }
0194 
0195 //------------------------------------------------------------------------------------------------------------------------------------------
0196 
0197 inline OrderedCaloHitList::const_iterator OrderedCaloHitList::end() const
0198 {
0199     return m_theList.end();
0200 }
0201 
0202 //------------------------------------------------------------------------------------------------------------------------------------------
0203 
0204 inline OrderedCaloHitList::const_iterator OrderedCaloHitList::find(const unsigned int index) const
0205 {
0206     return m_theList.find(index);
0207 }
0208 
0209 //------------------------------------------------------------------------------------------------------------------------------------------
0210 
0211 inline OrderedCaloHitList::const_reverse_iterator OrderedCaloHitList::rbegin() const
0212 {
0213     return m_theList.rbegin();
0214 }
0215 
0216 //------------------------------------------------------------------------------------------------------------------------------------------
0217 
0218 inline OrderedCaloHitList::const_reverse_iterator OrderedCaloHitList::rend() const
0219 {
0220     return m_theList.rend();
0221 }
0222 //------------------------------------------------------------------------------------------------------------------------------------------
0223 
0224 inline unsigned int OrderedCaloHitList::size() const
0225 {
0226     return m_theList.size();
0227 }
0228 
0229 //------------------------------------------------------------------------------------------------------------------------------------------
0230 
0231 inline bool OrderedCaloHitList::empty() const
0232 {
0233     return m_theList.empty();
0234 }
0235 
0236 //------------------------------------------------------------------------------------------------------------------------------------------
0237 
0238 inline StatusCode OrderedCaloHitList::Add(const CaloHit *const pCaloHit)
0239 {
0240     return this->Add(pCaloHit, pCaloHit->GetPseudoLayer());
0241 }
0242 
0243 //------------------------------------------------------------------------------------------------------------------------------------------
0244 
0245 inline StatusCode OrderedCaloHitList::Remove(const CaloHit *const pCaloHit)
0246 {
0247     return this->Remove(pCaloHit, pCaloHit->GetPseudoLayer());
0248 }
0249 
0250 //------------------------------------------------------------------------------------------------------------------------------------------
0251 
0252 inline void OrderedCaloHitList::clear()
0253 {
0254     m_theList.clear();
0255 }
0256 
0257 } // namespace pandora
0258 
0259 #endif // #ifndef PANDORA_ORDERED_CALO_HIT_LIST_H