Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:14:36

0001 // -*- C++ -*-
0002 //
0003 // Package:    EcalTBGeometryBuilder
0004 // Class:      EcalTBGeometryBuilder
0005 //
0006 /**\class EcalTBGeometryBuilder EcalTBGeometryBuilder.h tmp/EcalTBGeometryBuilder/interface/EcalTBGeometryBuilder.h
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Jeremiah Mans
0015 //         Created:  Mon Oct  3 11:35:27 CDT 2005
0016 //
0017 //
0018 
0019 // user include files
0020 #include "Geometry/EcalTestBeam/plugins/EcalTBGeometryBuilder.h"
0021 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0023 
0024 //
0025 // constructors and destructor
0026 //
0027 EcalTBGeometryBuilder::EcalTBGeometryBuilder(const edm::ParameterSet& iConfig) {
0028   //the following line is needed to tell the framework what
0029   // data is being produced
0030   auto cc = setWhatProduced(this);
0031 
0032   barrelToken_ = cc.consumes<CaloSubdetectorGeometry>(edm::ESInputTag{"", "EcalBarrel"});
0033   hodoscopeToken_ = cc.consumes<CaloSubdetectorGeometry>(edm::ESInputTag{"", "EcalLaserPnDiode"});
0034 
0035   //now do what ever other initialization is needed
0036 }
0037 
0038 EcalTBGeometryBuilder::~EcalTBGeometryBuilder() {}
0039 
0040 //
0041 // member functions
0042 //
0043 
0044 // ------------ method called to produce the data  ------------
0045 EcalTBGeometryBuilder::ReturnType EcalTBGeometryBuilder::produce(const IdealGeometryRecord& iRecord) {
0046   auto pCaloGeom = std::make_unique<CaloGeometry>();
0047 
0048   // TODO: Look for ECAL parts
0049   if (auto pG = iRecord.getHandle(barrelToken_)) {
0050     pCaloGeom->setSubdetGeometry(DetId::Ecal, EcalBarrel, pG.product());
0051   } else {
0052     edm::LogWarning("MissingInput") << "No Ecal Barrel Geometry found";
0053   }
0054   if (auto pG = iRecord.getHandle(hodoscopeToken_)) {
0055     pCaloGeom->setSubdetGeometry(DetId::Ecal, EcalLaserPnDiode, pG.product());
0056   } else {
0057     edm::LogWarning("MissingInput") << "No Ecal TB Hodoscope Geometry found";
0058   }
0059 
0060   return pCaloGeom;
0061 }