File indexing completed on 2024-04-06 12:14:17
0001 #ifndef GEOMETRY_CALOTOPOLOGY_CALOTOWERCONSTITUENTSMAP_H
0002 #define GEOMETRY_CALOTOPOLOGY_CALOTOWERCONSTITUENTSMAP_H 1
0003
0004 #include "DataFormats/DetId/interface/DetId.h"
0005 #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h"
0006 #include "DataFormats/Common/interface/SortedCollection.h"
0007 #include <vector>
0008 #include <map>
0009 #include <atomic>
0010
0011 class HcalTopology;
0012 class CaloTowerTopology;
0013
0014
0015
0016
0017
0018 class CaloTowerConstituentsMap {
0019 public:
0020 CaloTowerConstituentsMap() = delete;
0021 ~CaloTowerConstituentsMap();
0022 CaloTowerConstituentsMap(const HcalTopology* hcaltopo, const CaloTowerTopology* cttopo);
0023
0024
0025 CaloTowerDetId towerOf(const DetId& id) const;
0026
0027
0028 std::vector<DetId> constituentsOf(const CaloTowerDetId& id) const;
0029
0030
0031 void assign(const DetId& cell, const CaloTowerDetId& tower);
0032
0033
0034 void sort();
0035
0036
0037 void useStandardHB(bool use = true);
0038
0039 void useStandardHE(bool use = true);
0040
0041 void useStandardHO(bool use = true);
0042
0043 void useStandardHF(bool use = true);
0044
0045 void useStandardEB(bool use = true);
0046
0047 private:
0048 const HcalTopology* m_hcaltopo;
0049 const CaloTowerTopology* m_cttopo;
0050
0051 bool standardHB_;
0052 bool standardHE_;
0053 bool standardHF_;
0054 bool standardHO_;
0055 bool standardEB_;
0056
0057 struct MapItem {
0058 typedef DetId key_type;
0059 MapItem(const DetId& acell, const CaloTowerDetId& atower) : cell(acell), tower(atower) {}
0060 DetId cell;
0061 CaloTowerDetId tower;
0062 inline DetId id() const { return cell; }
0063 };
0064
0065 edm::SortedCollection<MapItem> m_items;
0066 mutable std::atomic<std::multimap<CaloTowerDetId, DetId>*> m_reverseItems;
0067 };
0068
0069 #endif