CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HGCalSensitiveDetectorBuilder Class Reference
Inheritance diagram for HGCalSensitiveDetectorBuilder:
SensitiveDetectorMakerBase

Public Member Functions

void beginRun (const edm::EventSetup &es) final
 
 HGCalSensitiveDetectorBuilder (edm::ParameterSet const &p, edm::ConsumesCollector cc)
 
std::unique_ptr< SensitiveDetectormake (const std::string &iname, const SensitiveDetectorCatalog &clg, const edm::ParameterSet &p, const SimTrackManager *man, SimActivityRegistry &reg) const final
 
- Public Member Functions inherited from SensitiveDetectorMakerBase
virtual std::unique_ptr< SensitiveDetectormake (const std::string &iname, const edm::EventSetup &es, const SensitiveDetectorCatalog &clg, const edm::ParameterSet &p, const SimTrackManager *man, SimActivityRegistry &reg) const
 
const SensitiveDetectorMakerBaseoperator= (const SensitiveDetectorMakerBase &)=delete
 
 SensitiveDetectorMakerBase ()=default
 
 SensitiveDetectorMakerBase (const SensitiveDetectorMakerBase &)=delete
 
virtual ~SensitiveDetectorMakerBase ()
 

Private Attributes

bool doEE_
 
bool doHE_
 
edm::ESHandle< HGCalDDDConstantshgcalEE_
 
edm::ESHandle< HGCalDDDConstantshgcalHE_
 
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecordhgcEEToken_
 
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecordhgcHEToken_
 

Detailed Description

Definition at line 24 of file HGCalSensitiveDetectorBuilder.cc.

Constructor & Destructor Documentation

◆ HGCalSensitiveDetectorBuilder()

HGCalSensitiveDetectorBuilder::HGCalSensitiveDetectorBuilder ( edm::ParameterSet const &  p,
edm::ConsumesCollector  cc 
)
inlineexplicit

Definition at line 26 of file HGCalSensitiveDetectorBuilder.cc.

References edm::BeginRun, and edm::ConsumesCollector::esConsumes().

27  : hgcEEToken_{cc.esConsumes<edm::Transition::BeginRun>(edm::ESInputTag{"", "HGCalEESensitive"})},
28  hgcHEToken_{cc.esConsumes<edm::Transition::BeginRun>(edm::ESInputTag{"", "HGCalHESiliconSensitive"})} {
29  edm::ParameterSet m_HGC = p.getParameter<edm::ParameterSet>("HGCSD");
30  int num = m_HGC.getUntrackedParameter<int>("UseDetector");
31  doEE_ = ((num % 2) == 1);
32  doHE_ = (((num / 2) % 2) == 1);
33  }
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > hgcHEToken_
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > hgcEEToken_

Member Function Documentation

◆ beginRun()

void HGCalSensitiveDetectorBuilder::beginRun ( const edm::EventSetup es)
inlinefinalvirtual

Reimplemented from SensitiveDetectorMakerBase.

Definition at line 35 of file HGCalSensitiveDetectorBuilder.cc.

References doEE_, doHE_, hgcalEE_, hgcalHE_, hgcEEToken_, and hgcHEToken_.

35  {
36  if (doEE_)
38  if (doHE_)
40  }
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
edm::ESHandle< HGCalDDDConstants > hgcalEE_
edm::ESHandle< HGCalDDDConstants > hgcalHE_
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > hgcHEToken_
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > hgcEEToken_

◆ make()

std::unique_ptr<SensitiveDetector> HGCalSensitiveDetectorBuilder::make ( const std::string &  iname,
const SensitiveDetectorCatalog clg,
const edm::ParameterSet p,
const SimTrackManager man,
SimActivityRegistry reg 
) const
inlinefinalvirtual

Reimplemented from SensitiveDetectorMakerBase.

Definition at line 42 of file HGCalSensitiveDetectorBuilder.cc.

References doEE_, doHE_, SimActivityRegistryEnroller::enroll(), caloTruthProducer_cfi::hgc, hgcalEE_, hgcalHE_, edm::ESHandleBase::isValid(), dqmdumpme::k, AlCaHLTBitMon_ParallelJobs::p, and edm::ESHandle< T >::product().

46  {
47  auto hgc =
48  (((iname.find("HitsEE") != std::string::npos) && doEE_ && hgcalEE_.isValid())
49  ? hgcalEE_.product()
50  : (((iname.find("HitsHEfront") != std::string::npos) && doHE_ && hgcalHE_.isValid()) ? hgcalHE_.product()
51  : nullptr));
52  auto sd = std::make_unique<HGCalSD>(iname, hgc, clg, p, man);
54 #ifdef EDM_ML_DEBUG
55  const auto& dets = clg.logicalNames(iname);
56  edm::LogVerbatim("HGCSim") << "HGCalSensitiveDetectorBuilder for " << iname << " utilizes " << dets.size()
57  << " detectors";
58  for (unsigned int k = 0; k < dets.size(); ++k)
59  edm::LogVerbatim("HGCSim") << "Detector [" << k << "] " << dets[k];
60 #endif
61  return sd;
62  }
Log< level::Info, true > LogVerbatim
static void enroll(SimActivityRegistry &iReg, T *iObj)
T const * product() const
Definition: ESHandle.h:86
edm::ESHandle< HGCalDDDConstants > hgcalEE_
bool isValid() const
Definition: ESHandle.h:44
edm::ESHandle< HGCalDDDConstants > hgcalHE_

Member Data Documentation

◆ doEE_

bool HGCalSensitiveDetectorBuilder::doEE_
private

Definition at line 67 of file HGCalSensitiveDetectorBuilder.cc.

Referenced by beginRun(), and make().

◆ doHE_

bool HGCalSensitiveDetectorBuilder::doHE_
private

Definition at line 67 of file HGCalSensitiveDetectorBuilder.cc.

Referenced by beginRun(), and make().

◆ hgcalEE_

edm::ESHandle<HGCalDDDConstants> HGCalSensitiveDetectorBuilder::hgcalEE_
private

Definition at line 68 of file HGCalSensitiveDetectorBuilder.cc.

Referenced by beginRun(), and make().

◆ hgcalHE_

edm::ESHandle<HGCalDDDConstants> HGCalSensitiveDetectorBuilder::hgcalHE_
private

Definition at line 68 of file HGCalSensitiveDetectorBuilder.cc.

Referenced by beginRun(), and make().

◆ hgcEEToken_

const edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> HGCalSensitiveDetectorBuilder::hgcEEToken_
private

Definition at line 65 of file HGCalSensitiveDetectorBuilder.cc.

Referenced by beginRun().

◆ hgcHEToken_

const edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> HGCalSensitiveDetectorBuilder::hgcHEToken_
private

Definition at line 66 of file HGCalSensitiveDetectorBuilder.cc.

Referenced by beginRun().