Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:42

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 /** \class EcalTrigTowerConstituentsMap
0015   *  
0016   * \author P.Meridiani
0017   */
0018 
0019 class EcalTrigTowerConstituentsMap {
0020 public:
0021   EcalTrigTowerConstituentsMap();
0022 
0023   /// Get the tower id for this det id (or null if not known)
0024   EcalTrigTowerDetId towerOf(const DetId& id) const;
0025 
0026   /// Get the constituent detids for this tower id
0027   std::vector<DetId> constituentsOf(const EcalTrigTowerDetId& id) const;
0028 
0029   /// set the association between a DetId and a tower
0030   void assign(const DetId& cell, const EcalTrigTowerDetId& tower);
0031 
0032 private:
0033   /// Wrap a generic EEDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2)
0034   DetId wrapEEDetId(const DetId& id) const;
0035   /// Wrap a generic EcalTrigTowerDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2)
0036   DetId wrapEcalTrigTowerDetId(const DetId& id) const;
0037 
0038   DetId changeEEDetIdQuadrantAndZ(const DetId& fromid, const int& toQuadrant, const int& tozside) const;
0039 
0040   int changeTowerQuadrant(int phiTower, int fromQuadrant, int toQuadrant) const;
0041 
0042   struct MapItem {
0043     MapItem(const DetId& acell, const EcalTrigTowerDetId& atower) : cell(acell), tower(atower) {}
0044     DetId cell;
0045     EcalTrigTowerDetId tower;
0046   };
0047 
0048   typedef boost::multi_index_container<
0049       MapItem,
0050       boost::multi_index::indexed_by<
0051           boost::multi_index::ordered_unique<boost::multi_index::member<MapItem, DetId, &MapItem::cell> >,
0052           boost::multi_index::ordered_non_unique<
0053               boost::multi_index::member<MapItem, EcalTrigTowerDetId, &MapItem::tower> > > >
0054       EcalTowerMap;
0055 
0056   typedef EcalTowerMap::nth_index<0>::type EcalTowerMap_by_DetId;
0057   typedef EcalTowerMap::nth_index<1>::type EcalTowerMap_by_towerDetId;
0058 
0059   EcalTowerMap m_items;
0060 };
0061 
0062 #endif