CMS 3D CMS Logo

SiStripRawProcessingFactory.cc
Go to the documentation of this file.
1 #include <memory>
2 
5 
15 
16 std::unique_ptr<SiStripRawProcessingAlgorithms> SiStripRawProcessingFactory::create(const edm::ParameterSet& conf,
18  return std::unique_ptr<SiStripRawProcessingAlgorithms>(
20  create_SubtractorPed(conf, iC),
21  create_SubtractorCMN(conf, iC),
22  create_Suppressor(conf, iC),
23  create_Restorer(conf, iC),
24  conf.getParameter<bool>("doAPVRestore"),
25  conf.getParameter<bool>("useCMMeanMap")));
26 }
27 
28 std::unique_ptr<SiStripPedestalsSubtractor> SiStripRawProcessingFactory::create_SubtractorPed(
29  const edm::ParameterSet& conf, edm::ConsumesCollector iC) {
30  return std::unique_ptr<SiStripPedestalsSubtractor>(
31  new SiStripPedestalsSubtractor(conf.getParameter<bool>("PedestalSubtractionFedMode"), iC));
32 }
33 
34 std::unique_ptr<SiStripCommonModeNoiseSubtractor> SiStripRawProcessingFactory::create_SubtractorCMN(
35  const edm::ParameterSet& conf, edm::ConsumesCollector iC) {
36  const std::string mode = conf.getParameter<std::string>("CommonModeNoiseSubtractionMode");
37 
38  if (mode == "Median")
39  return std::unique_ptr<SiStripCommonModeNoiseSubtractor>(new MedianCMNSubtractor());
40 
41  if (mode == "Percentile") {
42  return std::unique_ptr<SiStripCommonModeNoiseSubtractor>(
43  new PercentileCMNSubtractor(conf.getParameter<double>("Percentile")));
44  }
45 
46  if (mode == "IteratedMedian") {
47  return std::unique_ptr<SiStripCommonModeNoiseSubtractor>(new IteratedMedianCMNSubtractor(
48  conf.getParameter<double>("CutToAvoidSignal"), conf.getParameter<int>("Iterations"), iC));
49  }
50 
51  if (mode == "FastLinear")
52  return std::unique_ptr<SiStripCommonModeNoiseSubtractor>(new FastLinearCMNSubtractor());
53 
54  if (mode == "TT6") {
55  return std::unique_ptr<SiStripCommonModeNoiseSubtractor>(
56  new TT6CMNSubtractor(conf.getParameter<double>("CutToAvoidSignal"), iC));
57  }
58 
59  edm::LogError("SiStripRawProcessingFactory::create_SubtractorCMN")
60  << "Unregistered Algorithm: " << mode << ". Use one of {Median, Percentile, IteratedMedian, FastLinear, TT6}";
61  return std::unique_ptr<SiStripCommonModeNoiseSubtractor>(new MedianCMNSubtractor());
62 }
63 
64 std::unique_ptr<SiStripFedZeroSuppression> SiStripRawProcessingFactory::create_Suppressor(const edm::ParameterSet& conf,
66  const uint32_t mode = conf.getParameter<uint32_t>("SiStripFedZeroSuppressionMode");
67  const bool trunc = conf.getParameter<bool>("TruncateInSuppressor");
68  const bool trunc10bits = conf.getParameter<bool>("Use10bitsTruncation");
69  switch (mode) {
70  case 1:
71  case 2:
72  case 3:
73  case 4:
74  return std::make_unique<SiStripFedZeroSuppression>(mode, &iC, trunc, trunc10bits);
75  default:
76  edm::LogError("SiStripRawProcessingFactory::createSuppressor")
77  << "Unregistered mode: " << mode << ". Use one of {1,2,3,4}.";
78  return std::make_unique<SiStripFedZeroSuppression>(4, &iC, true, trunc10bits);
79  }
80 }
81 
82 std::unique_ptr<SiStripAPVRestorer> SiStripRawProcessingFactory::create_Restorer(const edm::ParameterSet& conf,
84  if (!conf.exists("APVRestoreMode")) {
85  return std::unique_ptr<SiStripAPVRestorer>(nullptr);
86  } else {
87  return std::unique_ptr<SiStripAPVRestorer>(new SiStripAPVRestorer(conf, iC));
88  }
89 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool exists(std::string const &parameterName) const
checks if a parameter exists
static std::unique_ptr< SiStripFedZeroSuppression > create_Suppressor(const edm::ParameterSet &, edm::ConsumesCollector)
Log< level::Error, false > LogError
static std::unique_ptr< SiStripAPVRestorer > create_Restorer(const edm::ParameterSet &, edm::ConsumesCollector)
static std::unique_ptr< SiStripCommonModeNoiseSubtractor > create_SubtractorCMN(const edm::ParameterSet &, edm::ConsumesCollector)
static std::unique_ptr< SiStripPedestalsSubtractor > create_SubtractorPed(const edm::ParameterSet &, edm::ConsumesCollector)
static std::unique_ptr< SiStripRawProcessingAlgorithms > create(const edm::ParameterSet &, edm::ConsumesCollector)