CMS 3D CMS Logo

HGCSensitiveDetectorBuilder.cc
Go to the documentation of this file.
1 
2 // system include files
3 #include <string>
4 #include <vector>
5 
6 // user include files
10 
14 
21 
23 public:
25  edm::ParameterSet m_HGC = p.getParameter<edm::ParameterSet>("HGCSD");
26  num_ = m_HGC.getUntrackedParameter<int>("Detectors");
27  for (int k = 0; k < num_; ++k) {
28  hgcToken_.emplace_back(cc.esConsumes<edm::Transition::BeginRun>(edm::ESInputTag{"", name0_[k]}));
29  edm::LogVerbatim("HGCSim") << "HGCSensitiveDetectorBuilder::Initailize Token[" << k << "] for " << name0_[k];
30  }
31  }
32 
33  void beginRun(const edm::EventSetup& es) final {
34  for (const auto& token : hgcToken_)
35  hgcons_.emplace_back(es.getHandle(token));
36  }
37 
38  std::unique_ptr<SensitiveDetector> make(const std::string& iname,
39  const SensitiveDetectorCatalog& clg,
40  const edm::ParameterSet& p,
41  const SimTrackManager* man,
42  SimActivityRegistry& reg) const final {
43  const HGCalDDDConstants* hgc = nullptr;
44  for (int k = 0; k < num_; ++k) {
45  if (iname.find(name1_[k]) != std::string::npos) {
46  if (hgcons_[k].isValid())
47  hgc = hgcons_[k].product();
48  break;
49  }
50  }
51  auto sd = std::make_unique<HGCSD>(iname, hgc, clg, p, man);
53  return sd;
54  }
55 
56 private:
57  static constexpr unsigned int nameSize_ = 3;
58  const std::string name0_[nameSize_] = {"HGCalEESensitive", "HGCalHESiliconSensitive", "HGCalHEScintillatorSensitive"};
59  const std::string name1_[nameSize_] = {"HitsEE", "HitsHEfront", "HitsHEback"};
60  int num_;
61  std::vector<edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord>> hgcToken_;
62  std::vector<edm::ESHandle<HGCalDDDConstants>> hgcons_;
63 };
64 
HGCSensitiveDetectorBuilder::nameSize_
static constexpr unsigned int nameSize_
Definition: HGCSensitiveDetectorBuilder.cc:57
HGCSensitiveDetectorBuilder
Definition: HGCSensitiveDetectorBuilder.cc:22
SimTrackManager
Definition: SimTrackManager.h:35
HGCSensitiveDetectorBuilder::name0_
const std::string name0_[nameSize_]
Definition: HGCSensitiveDetectorBuilder.cc:58
HGCSensitiveDetectorBuilder::make
std::unique_ptr< SensitiveDetector > make(const std::string &iname, const SensitiveDetectorCatalog &clg, const edm::ParameterSet &p, const SimTrackManager *man, SimActivityRegistry &reg) const final
Definition: HGCSensitiveDetectorBuilder.cc:38
edm::ESInputTag
Definition: ESInputTag.h:87
MessageLogger.h
ESHandle.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
HGCSensitiveDetector
HGCSD HGCSensitiveDetector
Definition: HGCSensitiveDetectorBuilder.cc:65
ESGetToken.h
HGCalDDDConstants
Definition: HGCalDDDConstants.h:27
hgc_digi
Definition: HGCDigitizerTypes.h:10
HGCSensitiveDetectorBuilder::hgcons_
std::vector< edm::ESHandle< HGCalDDDConstants > > hgcons_
Definition: HGCSensitiveDetectorBuilder.cc:62
SensitiveDetectorCatalog
Definition: SensitiveDetectorCatalog.h:10
dqmdumpme.k
k
Definition: dqmdumpme.py:60
sistrip::SpyUtilities::isValid
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
Definition: SiStripSpyUtilities.cc:124
HGCSD
Definition: HGCSD.h:22
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HGCSensitiveDetectorBuilder::HGCSensitiveDetectorBuilder
HGCSensitiveDetectorBuilder(edm::ParameterSet const &p, edm::ConsumesCollector cc)
Definition: HGCSensitiveDetectorBuilder.cc:24
SensitiveDetectorMakerBase
Definition: SensitiveDetectorMakerBase.h:28
ModuleDef.h
SimActivityRegistryEnroller::enroll
static void enroll(SimActivityRegistry &iReg, T *iObj)
Definition: SimActivityRegistryEnroller.h:50
IdealGeometryRecord.h
edm::EventSetup
Definition: EventSetup.h:58
cc
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCSensitiveDetectorBuilder::beginRun
void beginRun(const edm::EventSetup &es) final
Definition: HGCSensitiveDetectorBuilder.cc:33
SimActivityRegistryEnroller.h
SimActivityRegistry
Definition: SimActivityRegistry.h:39
DEFINE_SENSITIVEDETECTORBUILDER
#define DEFINE_SENSITIVEDETECTORBUILDER(type, name)
Definition: SensitiveDetectorPluginFactory.h:21
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
HGCSensitiveDetectorBuilder::hgcToken_
std::vector< edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > > hgcToken_
Definition: HGCSensitiveDetectorBuilder.cc:61
edm::Transition::BeginRun
sd
double sd
Definition: CascadeWrapper.h:113
HGCSD.h
ConsumesCollector.h
SensitiveDetectorPluginFactory.h
HGCalDDDConstants.h
ParameterSet.h
SensitiveDetectorMakerBase.h
HGCSensitiveDetectorBuilder::num_
int num_
Definition: HGCSensitiveDetectorBuilder.cc:60
HGCSensitiveDetectorBuilder::name1_
const std::string name1_[nameSize_]
Definition: HGCSensitiveDetectorBuilder.cc:59
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316