CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EcalSensitiveDetectorBuilder.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:
26  num_ = m_EC.getUntrackedParameter<int>("Detectors");
27  for (int k = 0; k < num_; ++k)
29  }
30 
31  void beginRun(const edm::EventSetup& es) final {
32  for (const auto& token : ecToken_)
33  ecpar_.emplace_back(es.getHandle(token));
34  }
35 
36  std::unique_ptr<SensitiveDetector> make(const std::string& iname,
37  const SensitiveDetectorCatalog& clg,
38  const edm::ParameterSet& p,
39  const SimTrackManager* man,
40  SimActivityRegistry& reg) const final {
41  int k = static_cast<int>(std::find(name_, name_ + num_, iname) - name_);
42  auto const& par = ((k < num_) && ecpar_[k].isValid()) ? ecpar_[k].product() : nullptr;
43  auto sd = std::make_unique<ECalSD>(iname, par, clg, p, man);
45  return sd;
46  }
47 
48 private:
49  static constexpr unsigned int nameSize_ = 3;
50  const std::string name_[nameSize_] = {"EcalHitsEB", "EcalHitsEE", "EcalHitsES"};
51  int num_;
52  std::vector<edm::ESGetToken<EcalSimulationParameters, IdealGeometryRecord>> ecToken_;
53  std::vector<edm::ESHandle<EcalSimulationParameters>> ecpar_;
54 };
55 
std::vector< edm::ESGetToken< EcalSimulationParameters, IdealGeometryRecord > > ecToken_
T getUntrackedParameter(std::string const &, T const &) const
EcalSensitiveDetectorBuilder(edm::ParameterSet const &p, edm::ConsumesCollector cc)
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
const std::string name_[nameSize_]
std::unique_ptr< SensitiveDetector > make(const std::string &iname, const SensitiveDetectorCatalog &clg, const edm::ParameterSet &p, const SimTrackManager *man, SimActivityRegistry &reg) const final
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
static void enroll(SimActivityRegistry &iReg, T *iObj)
#define DEFINE_SENSITIVEDETECTORBUILDER(type, name)
void beginRun(const edm::EventSetup &es) final
Definition: ECalSD.h:31
double sd
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ECalSD EcalSensitiveDetector
std::vector< edm::ESHandle< EcalSimulationParameters > > ecpar_