CMS 3D CMS Logo

GsfMaterialEffectsESProducer.cc
Go to the documentation of this file.
5 
8 
11 
18 
19 #include <string>
20 #include <memory>
21 #include <optional>
22 
30 public:
32 
33  std::unique_ptr<GsfMaterialEffectsUpdator> produce(const TrackingComponentsRecord&);
34 
35  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
36 
37 private:
39  BetheHeitlerInit(std::string iName, int iCorrection) : fileName(std::move(iName)), correction(iCorrection) {}
42  };
43 
44  std::optional<BetheHeitlerInit> doInit(const edm::ParameterSet& p) {
45  if (p.getParameter<std::string>("EnergyLossUpdator") != "GsfBetheHeitlerUpdator") {
46  return std::optional<BetheHeitlerInit>();
47  }
48  return std::make_optional<BetheHeitlerInit>(p.getParameter<std::string>("BetheHeitlerParametrization"),
49  p.getParameter<int>("BetheHeitlerCorrection"));
50  }
51 
52  std::optional<BetheHeitlerInit> betheHeitlerInit_;
53  const double mass_;
55 };
56 
57 using namespace edm;
58 
60  : betheHeitlerInit_(doInit(p)),
61  mass_(p.getParameter<double>("Mass")),
62  useMultipleScattering_(p.getParameter<std::string>("MultipleScatteringUpdator") == "GsfMultipleScatteringUpdator")
63 
64 {
65  std::string myname = p.getParameter<std::string>("ComponentName");
66  setWhatProduced(this, myname);
67 }
68 
69 std::unique_ptr<GsfMaterialEffectsUpdator> GsfMaterialEffectsESProducer::produce(
70  const TrackingComponentsRecord& iRecord) {
71  std::unique_ptr<GsfMaterialEffectsUpdator> msUpdator;
73  msUpdator = std::make_unique<GsfMultipleScatteringUpdator>(mass_);
74  } else {
75  msUpdator = std::make_unique<GsfMaterialEffectsAdapter>(MultipleScatteringUpdator(mass_));
76  }
77 
78  std::unique_ptr<GsfMaterialEffectsUpdator> elUpdator;
79  if (betheHeitlerInit_) {
80  elUpdator = std::make_unique<GsfBetheHeitlerUpdator>(betheHeitlerInit_->fileName, betheHeitlerInit_->correction);
81  } else {
82  elUpdator = std::make_unique<GsfMaterialEffectsAdapter>(EnergyLossUpdator(mass_));
83  }
84 
85  auto updator = std::make_unique<GsfCombinedMaterialEffectsUpdator>(*msUpdator, *elUpdator);
86 
87  return updator;
88 }
89 
92 
93  desc.add<std::string>("ComponentName");
94  desc.add<double>("Mass");
95  desc.add<std::string>("MultipleScatteringUpdator");
96  //Depending on the value of "EnergyLossUpdator", different parameters are allowed
97  desc.ifValue(
98  edm::ParameterDescription<std::string>("EnergyLossUpdator", "GsfBetheHeitlerUpdator", true),
99  "GsfBetheHeitlerUpdator" >> (edm::ParameterDescription<std::string>("BetheHeitlerParametrization", true) and
100  edm::ParameterDescription<int>("BetheHeitlerCorrection", true)) or
101  "EnergyLossUpdator" >> edm::EmptyGroupDescription() //No additional parameters needed
102  );
103  descriptions.addDefault(desc);
104 }
105 
GsfMaterialEffectsESProducer::produce
std::unique_ptr< GsfMaterialEffectsUpdator > produce(const TrackingComponentsRecord &)
Definition: GsfMaterialEffectsESProducer.cc:69
ESHandle.h
HLT_FULL_cff.EnergyLossUpdator
EnergyLossUpdator
Definition: HLT_FULL_cff.py:7148
MultipleScatteringUpdator.h
edm
HLT enums.
Definition: AlignableModifier.h:19
GsfMaterialEffectsESProducer::BetheHeitlerInit
Definition: GsfMaterialEffectsESProducer.cc:38
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
GsfMaterialEffectsESProducer::GsfMaterialEffectsESProducer
GsfMaterialEffectsESProducer(const edm::ParameterSet &p)
Definition: GsfMaterialEffectsESProducer.cc:59
ESProducer.h
EmptyGroupDescription.h
GsfMultipleScatteringUpdator.h
GsfMaterialEffectsAdapter.h
GsfMaterialEffectsESProducer::BetheHeitlerInit::BetheHeitlerInit
BetheHeitlerInit(std::string iName, int iCorrection)
Definition: GsfMaterialEffectsESProducer.cc:39
GsfMaterialEffectsESProducer
Definition: GsfMaterialEffectsESProducer.cc:29
GsfMaterialEffectsESProducer::BetheHeitlerInit::correction
int correction
Definition: GsfMaterialEffectsESProducer.cc:41
HLT_FULL_cff.MultipleScatteringUpdator
MultipleScatteringUpdator
Definition: HLT_FULL_cff.py:7150
GsfMaterialEffectsESProducer::doInit
std::optional< BetheHeitlerInit > doInit(const edm::ParameterSet &p)
Definition: GsfMaterialEffectsESProducer.cc:44
GsfBetheHeitlerUpdator.h
GsfMaterialEffectsESProducer::useMultipleScattering_
const bool useMultipleScattering_
Definition: GsfMaterialEffectsESProducer.cc:54
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
HLT_FULL_cff.updator
updator
Definition: HLT_FULL_cff.py:123
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
GsfCombinedMaterialEffectsUpdator.h
GsfMaterialEffectsESProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: GsfMaterialEffectsESProducer.cc:90
GsfMaterialEffectsESProducer::betheHeitlerInit_
std::optional< BetheHeitlerInit > betheHeitlerInit_
Definition: GsfMaterialEffectsESProducer.cc:52
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ModuleFactory.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
GsfMaterialEffectsESProducer::mass_
const double mass_
Definition: GsfMaterialEffectsESProducer.cc:53
EnergyLossUpdator.h
TrackingComponentsRecord.h
EventSetup.h
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::ESProducer
Definition: ESProducer.h:104
GsfMaterialEffectsUpdator.h
ParameterSet.h
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::EmptyGroupDescription
Definition: EmptyGroupDescription.h:15
edm::ParameterDescription
Definition: ParameterDescription.h:110
GsfMaterialEffectsESProducer::BetheHeitlerInit::fileName
std::string fileName
Definition: GsfMaterialEffectsESProducer.cc:40
TrackingComponentsRecord
Definition: TrackingComponentsRecord.h:12