CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h

Go to the documentation of this file.
00001 #ifndef GEOMETRY_CALOTOPOLOGY_ECALTRIGTOWERCONSTITUENTSMAP_H
00002 #define GEOMETRY_CALOTOPOLOGY_ECALTRIGTOWERCONSTITUENTSMAP_H 1
00003 
00004 #include "DataFormats/DetId/interface/DetId.h"
00005 #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
00006 
00007 #include <boost/multi_index_container.hpp>
00008 #include <boost/multi_index/member.hpp>
00009 #include <boost/multi_index/ordered_index.hpp>
00010 #include <boost/tuple/tuple.hpp>
00011 
00012 #include <vector>
00013 
00020 class EcalTrigTowerConstituentsMap {
00021   
00022  public:
00023   
00024   EcalTrigTowerConstituentsMap();
00025 
00027   EcalTrigTowerDetId towerOf(const DetId& id) const;
00028 
00030   std::vector<DetId> constituentsOf(const EcalTrigTowerDetId& id) const;
00031 
00033   void assign(const DetId& cell, const EcalTrigTowerDetId& tower);
00034 
00035  private:
00037   DetId wrapEEDetId(const DetId& id) const;
00039   DetId wrapEcalTrigTowerDetId(const DetId& id) const;
00040 
00041   DetId changeEEDetIdQuadrantAndZ(const DetId& fromid, const int& toQuadrant,const int& tozside) const;
00042 
00043   int changeTowerQuadrant(int phiTower, int fromQuadrant, int toQuadrant) const;
00044 
00045   struct MapItem {
00046     MapItem(const DetId& acell, const EcalTrigTowerDetId& atower) : cell(acell),tower(atower) { }
00047     DetId cell;
00048     EcalTrigTowerDetId tower;
00049 
00050   };
00051 
00052   typedef boost::multi_index_container<
00053     MapItem,
00054     boost::multi_index::indexed_by<
00055     boost::multi_index::ordered_unique< boost::multi_index::member < MapItem,DetId,&MapItem::cell > >,
00056     boost::multi_index::ordered_non_unique< boost::multi_index::member < MapItem,EcalTrigTowerDetId,&MapItem::tower> >
00057     >
00058     > EcalTowerMap;
00059   
00060   typedef EcalTowerMap::nth_index<0>::type EcalTowerMap_by_DetId;
00061   typedef EcalTowerMap::nth_index<1>::type EcalTowerMap_by_towerDetId;
00062   
00063   EcalTowerMap m_items;
00064 };
00065 
00066 #endif