Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-05 22:48:38

0001 // system include files
0002 
0003 // user include files
0004 #include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorMakerBase.h"
0005 #include "SimG4Core/Notification/interface/SimActivityRegistryEnroller.h"
0006 #include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorPluginFactory.h"
0007 
0008 #include "Geometry/HcalTestBeamData/interface/HcalTB06BeamParameters.h"
0009 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0010 #include "SimG4CMS/HcalTestBeam/interface/HcalTB06BeamSD.h"
0011 
0012 #include "FWCore/Framework/interface/ConsumesCollector.h"
0013 #include "FWCore/Utilities/interface/ESGetToken.h"
0014 #include "FWCore/PluginManager/interface/ModuleDef.h"
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 
0017 class HcalTB06BeamDetectorBuilder : public SensitiveDetectorMakerBase {
0018 public:
0019   explicit HcalTB06BeamDetectorBuilder(edm::ParameterSet const& p, edm::ConsumesCollector cc)
0020       : hcParToken_{cc.esConsumes<edm::Transition::BeginRun>()}, hcPar_{nullptr} {}
0021 
0022   void beginRun(const edm::EventSetup& es) final { hcPar_ = &es.getData(hcParToken_); }
0023 
0024   std::unique_ptr<SensitiveDetector> make(const std::string& iname,
0025                                           const SensitiveDetectorCatalog& clg,
0026                                           const edm::ParameterSet& p,
0027                                           const SimTrackManager* man,
0028                                           SimActivityRegistry& reg) const final {
0029     auto sd = std::make_unique<HcalTB06BeamSD>(iname, hcPar_, clg, p, man);
0030     SimActivityRegistryEnroller::enroll(reg, sd.get());
0031     return sd;
0032   }
0033 
0034 private:
0035   const edm::ESGetToken<HcalTB06BeamParameters, IdealGeometryRecord> hcParToken_;
0036   const HcalTB06BeamParameters* hcPar_;
0037 };
0038 
0039 typedef HcalTB06BeamSD HcalTB06BeamDetector;
0040 DEFINE_SENSITIVEDETECTORBUILDER(HcalTB06BeamDetectorBuilder, HcalTB06BeamDetector);