CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/Geometry/CaloTopology/interface/EcalBarrelTopology.h

Go to the documentation of this file.
00001 #ifndef GEOMETRY_CALOTOPOLOGY_ECALBARRELTOPOLOGY_H
00002 #define GEOMETRY_CALOTOPOLOGY_ECALBARRELTOPOLOGY_H 1
00003 
00004 #include <vector>
00005 #include <iostream>
00006 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00007 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
00008 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00009 #include "FWCore/Framework/interface/ESHandle.h"
00010 
00011 class EcalBarrelTopology : public CaloSubdetectorTopology
00012 {
00013 
00014  public:
00016   EcalBarrelTopology(): theGeom_(0) {};
00017 
00019   virtual ~EcalBarrelTopology() { }  
00020 
00022   EcalBarrelTopology(edm::ESHandle<CaloGeometry> theGeom) : theGeom_(theGeom)
00023     {
00024     }
00025   
00027   virtual std::vector<DetId> north(const DetId& id) const
00028     { 
00029       EBDetId nextId(incrementIphi(EBDetId(id)));
00030       std::vector<DetId> vNeighborsDetId;
00031       if (! (nextId==EBDetId(0)))
00032         vNeighborsDetId.push_back(DetId(nextId.rawId()));
00033       return vNeighborsDetId;
00034     }
00035 
00037   virtual std::vector<DetId> south(const DetId& id) const
00038     { 
00039       EBDetId nextId(decrementIphi(EBDetId(id)));
00040       std::vector<DetId> vNeighborsDetId;
00041       if (! (nextId==EBDetId(0)))
00042         vNeighborsDetId.push_back(DetId(nextId.rawId()));
00043       return vNeighborsDetId;
00044     }
00045 
00047   virtual std::vector<DetId> east(const DetId& id) const
00048     { 
00049       EBDetId nextId(decrementIeta(EBDetId(id)));
00050       std::vector<DetId> vNeighborsDetId;
00051       if (! (nextId==EBDetId(0)))
00052         vNeighborsDetId.push_back(DetId(nextId.rawId()));
00053       return vNeighborsDetId;
00054     }
00055 
00057   virtual std::vector<DetId> west(const DetId& id) const
00058     { 
00059       EBDetId nextId(incrementIeta(EBDetId(id)));
00060       std::vector<DetId> vNeighborsDetId;
00061       if (! (nextId==EBDetId(0)))
00062         vNeighborsDetId.push_back(DetId(nextId.rawId()));
00063       return vNeighborsDetId;
00064     }
00065   
00066   virtual std::vector<DetId> up(const DetId& /*id*/) const
00067     {
00068       std::cout << "EcalBarrelTopology::up() not yet implemented" << std::endl; 
00069       std::vector<DetId> vNeighborsDetId;
00070       return  vNeighborsDetId;
00071     }
00072   
00073   virtual std::vector<DetId> down(const DetId& /*id*/) const
00074     {
00075       std::cout << "EcalBarrelTopology::down() not yet implemented" << std::endl; 
00076       std::vector<DetId> vNeighborsDetId;
00077       return  vNeighborsDetId;
00078     }
00079 
00080  private:
00081 
00083   EBDetId incrementIeta(const EBDetId&) const ;
00084 
00086   EBDetId decrementIeta(const EBDetId&) const ;
00087 
00089   EBDetId incrementIphi(const EBDetId&) const ;
00090 
00092   EBDetId decrementIphi(const EBDetId&) const;
00093 
00094   edm::ESHandle<CaloGeometry> theGeom_;
00095 };
00096 
00097 #endif