CMS 3D CMS Logo

CaloTopologyBuilder.cc

Go to the documentation of this file.
00001 #include "Geometry/CaloEventSetup/plugins/CaloTopologyBuilder.h"
00002 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
00003 #include "Geometry/CaloTopology/interface/EcalBarrelTopology.h"
00004 #include "Geometry/CaloTopology/interface/EcalEndcapTopology.h"
00005 #include "Geometry/CaloTopology/interface/EcalPreshowerTopology.h"
00006 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00007 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00008 
00009 
00010 CaloTopologyBuilder::CaloTopologyBuilder( const edm::ParameterSet& iConfig )
00011 {
00012    //the following line is needed to tell the framework what
00013    // data is being produced
00014 
00015 // disable
00016 //   setWhatProduced( this, &CaloTopologyBuilder::produceIdeal );
00017    setWhatProduced( this, &CaloTopologyBuilder::produceCalo  );
00018 }
00019 
00020 
00021 CaloTopologyBuilder::~CaloTopologyBuilder()
00022 { 
00023 }
00024 
00025 
00026 //
00027 // member functions
00028 //
00029 
00030 // ------------ method called to produce the data  ------------
00031 CaloTopologyBuilder::ReturnType
00032 CaloTopologyBuilder::produceCalo( const CaloTopologyRecord& iRecord )
00033 {
00034    if( 0 == m_caloTopology.get() ) // ignore updates because cell list will not change!
00035    {
00036       edm::ESHandle<CaloGeometry>                  theGeometry   ;
00037       iRecord.getRecord<CaloGeometryRecord>().get( theGeometry ) ;
00038 
00039       m_caloTopology = ReturnType( new CaloTopology ) ;
00040       //ECAL parts      
00041       m_caloTopology->setSubdetTopology( DetId::Ecal,
00042                                          EcalBarrel,
00043                                          new EcalBarrelTopology( theGeometry ) ) ;
00044       m_caloTopology->setSubdetTopology( DetId::Ecal,
00045                                          EcalEndcap,
00046                                          new EcalEndcapTopology( theGeometry ) ) ;
00047       m_caloTopology->setSubdetTopology( DetId::Ecal,
00048                                          EcalPreshower,
00049                                          new EcalPreshowerTopology(theGeometry));   
00050    }
00051    return m_caloTopology;
00052 }
00053 
00054 CaloTopologyBuilder::ReturnType
00055 CaloTopologyBuilder::produceIdeal( const IdealGeometryRecord& iRecord )
00056 {
00057    edm::ESHandle<CaloGeometry> theGeometry   ;
00058    iRecord.get(                theGeometry ) ;
00059 
00060    ReturnType ct ( new CaloTopology ) ;
00061 
00062    //ECAL parts      
00063    ct->setSubdetTopology( DetId::Ecal,
00064                           EcalBarrel,
00065                           new EcalBarrelTopology( theGeometry ) ) ;
00066 
00067    ct->setSubdetTopology( DetId::Ecal,
00068                           EcalEndcap,
00069                           new EcalEndcapTopology( theGeometry ) ) ;
00070 
00071    ct->setSubdetTopology( DetId::Ecal,
00072                           EcalPreshower,
00073                           new EcalPreshowerTopology(theGeometry));   
00074    return ct ;
00075 }

Generated on Tue Jun 9 17:37:10 2009 for CMSSW by  doxygen 1.5.4