CMS 3D CMS Logo

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