File indexing completed on 2024-04-06 12:14:18
0001 #ifndef GEOMETRY_CALOTOPOLOGY_ECALTRIGTOWERCONSTITUENTSMAP_H
0002 #define GEOMETRY_CALOTOPOLOGY_ECALTRIGTOWERCONSTITUENTSMAP_H 1
0003
0004 #include "DataFormats/DetId/interface/DetId.h"
0005 #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
0006
0007 #include <boost/multi_index_container.hpp>
0008 #include <boost/multi_index/member.hpp>
0009 #include <boost/multi_index/ordered_index.hpp>
0010 #include <boost/tuple/tuple.hpp>
0011
0012 #include <vector>
0013
0014
0015
0016
0017
0018
0019 class EcalTrigTowerConstituentsMap {
0020 public:
0021 EcalTrigTowerConstituentsMap();
0022
0023
0024 EcalTrigTowerDetId towerOf(const DetId& id) const;
0025
0026 static EcalTrigTowerDetId barrelTowerOf(const DetId& id);
0027
0028
0029 std::vector<DetId> constituentsOf(const EcalTrigTowerDetId& id) const;
0030
0031
0032 void assign(const DetId& cell, const EcalTrigTowerDetId& tower);
0033
0034 private:
0035
0036 DetId wrapEEDetId(const DetId& id) const;
0037
0038 DetId wrapEcalTrigTowerDetId(const DetId& id) const;
0039
0040 DetId changeEEDetIdQuadrantAndZ(const DetId& fromid, const int& toQuadrant, const int& tozside) const;
0041
0042 int changeTowerQuadrant(int phiTower, int fromQuadrant, int toQuadrant) const;
0043
0044 struct MapItem {
0045 MapItem(const DetId& acell, const EcalTrigTowerDetId& atower) : cell(acell), tower(atower) {}
0046 DetId cell;
0047 EcalTrigTowerDetId tower;
0048 };
0049
0050 typedef boost::multi_index_container<
0051 MapItem,
0052 boost::multi_index::indexed_by<
0053 boost::multi_index::ordered_unique<boost::multi_index::member<MapItem, DetId, &MapItem::cell> >,
0054 boost::multi_index::ordered_non_unique<
0055 boost::multi_index::member<MapItem, EcalTrigTowerDetId, &MapItem::tower> > > >
0056 EcalTowerMap;
0057
0058 typedef EcalTowerMap::nth_index<0>::type EcalTowerMap_by_DetId;
0059 typedef EcalTowerMap::nth_index<1>::type EcalTowerMap_by_towerDetId;
0060
0061 EcalTowerMap m_items;
0062 };
0063
0064 #endif