CMS 3D CMS Logo

parseHBHEPhase1AlgoDescription.cc
Go to the documentation of this file.
1 #include <cassert>
2 
6 
9 
10 // Phase 1 HBHE reco algorithm headers
12 
13 static std::unique_ptr<MahiFit>
15 {
16 
17  const bool iDynamicPed = conf.getParameter<bool> ("dynamicPed");
18  const double iTS4Thresh = conf.getParameter<double> ("ts4Thresh");
19  const double chiSqSwitch = conf.getParameter<double> ("chiSqSwitch");
20 
21  const bool iApplyTimeSlew = conf.getParameter<bool> ("applyTimeSlew");
22 
23  const double iMeanTime = conf.getParameter<double> ("meanTime");
24  const double iTimeSigmaHPD = conf.getParameter<double> ("timeSigmaHPD");
25  const double iTimeSigmaSiPM = conf.getParameter<double> ("timeSigmaSiPM");
26 
27  const std::vector<int> iActiveBXs = conf.getParameter<std::vector<int>> ("activeBXs");
28  const int iNMaxItersMin = conf.getParameter<int> ("nMaxItersMin");
29  const int iNMaxItersNNLS = conf.getParameter<int> ("nMaxItersNNLS");
30  const double iDeltaChiSqThresh = conf.getParameter<double> ("deltaChiSqThresh");
31  const double iNnlsThresh = conf.getParameter<double> ("nnlsThresh");
32 
33  std::unique_ptr<MahiFit> corr = std::make_unique<MahiFit>();
34 
35  corr->setParameters(iDynamicPed, iTS4Thresh, chiSqSwitch, iApplyTimeSlew, HcalTimeSlew::Medium,
36  iMeanTime, iTimeSigmaHPD, iTimeSigmaSiPM,
37  iActiveBXs, iNMaxItersMin, iNMaxItersNNLS,
38  iDeltaChiSqThresh, iNnlsThresh);
39 
40  return corr;
41 }
42 
43 
44 static std::unique_ptr<PulseShapeFitOOTPileupCorrection>
46 {
47  const bool iPedestalConstraint = conf.getParameter<bool> ("applyPedConstraint");
48  const bool iTimeConstraint = conf.getParameter<bool> ("applyTimeConstraint");
49  const bool iAddPulseJitter = conf.getParameter<bool> ("applyPulseJitter");
50  const bool iApplyTimeSlew = conf.getParameter<bool> ("applyTimeSlew");
51  const double iTS4Min = conf.getParameter<double>("ts4Min");
52  const std::vector<double> iTS4Max = conf.getParameter<std::vector<double>>("ts4Max");
53  const double iPulseJitter = conf.getParameter<double>("pulseJitter");
54  const double iTimeMean = conf.getParameter<double>("meanTime");
55  const double iTimeSigHPD = conf.getParameter<double>("timeSigmaHPD");
56  const double iTimeSigSiPM = conf.getParameter<double>("timeSigmaSiPM");
57  const double iPedMean = conf.getParameter<double>("meanPed");
58  const double iTMin = conf.getParameter<double>("timeMin");
59  const double iTMax = conf.getParameter<double>("timeMax");
60  const std::vector<double> its4Chi2 = conf.getParameter<std::vector<double>>("ts4chi2");
61  const int iFitTimes = conf.getParameter<int> ("fitTimes");
62 
63  if (iTimeConstraint) assert(iTimeSigHPD);
64  if (iTimeConstraint) assert(iTimeSigSiPM);
65 
66  std::unique_ptr<PulseShapeFitOOTPileupCorrection> corr =
67  std::make_unique<PulseShapeFitOOTPileupCorrection>();
68 
69  corr->setPUParams(iPedestalConstraint, iTimeConstraint, iAddPulseJitter,
70  iApplyTimeSlew, iTS4Min, iTS4Max,
71  iPulseJitter,
72  iTimeMean,iTimeSigHPD, iTimeSigSiPM, iPedMean,
73  iTMin, iTMax, its4Chi2,
74  HcalTimeSlew::Medium, iFitTimes);
75 
76  return corr;
77 }
78 
79 
80 static std::unique_ptr<HcalDeterministicFit>
82 {
83  const bool iApplyTimeSlew = conf.getParameter<bool> ("applyTimeSlewM3");
84  const int iTimeSlewParsType = conf.getParameter<int> ("timeSlewParsType");
85  const double irespCorrM3 = conf.getParameter<double>("respCorrM3");
86 
87  std::unique_ptr<HcalDeterministicFit> fit = std::make_unique<HcalDeterministicFit>();
88 
89  fit->init( (HcalTimeSlew::ParaSource)iTimeSlewParsType,
90  HcalTimeSlew::Medium, iApplyTimeSlew,
91  irespCorrM3);
92 
93  return fit;
94 }
95 
96 
97 std::unique_ptr<AbsHBHEPhase1Algo>
99 {
100  std::unique_ptr<AbsHBHEPhase1Algo> algo;
101 
102  const std::string& className = ps.getParameter<std::string>("Class");
103 
104  if (className == "SimpleHBHEPhase1Algo")
105  {
106  std::unique_ptr<MahiFit> mahi;
107  std::unique_ptr<PulseShapeFitOOTPileupCorrection> m2;
108  std::unique_ptr<HcalDeterministicFit> detFit;
109 
110  // only run Mahi OR Method 2 but not both
111  if (ps.getParameter<bool>("useMahi") && ps.getParameter<bool>("useM2")) {
112  throw cms::Exception("ConfigurationError") <<
113  "SimpleHBHEPhase1Algo does not allow both Mahi and Method 2 to be turned on together.";
114  }
115  if (ps.getParameter<bool>("useMahi"))
116  mahi = parseHBHEMahiDescription(ps);
117  if (ps.getParameter<bool>("useM2"))
119  if (ps.getParameter<bool>("useM3"))
120  detFit = parseHBHEMethod3Description(ps);
121 
122  algo = std::unique_ptr<AbsHBHEPhase1Algo>(
123  new SimpleHBHEPhase1Algo(ps.getParameter<int> ("firstSampleShift"),
124  ps.getParameter<int> ("samplesToAdd"),
125  ps.getParameter<double>("correctionPhaseNS"),
126  ps.getParameter<double>("tdcTimeShift"),
127  ps.getParameter<bool> ("correctForPhaseContainment"),
128  std::move(m2), std::move(detFit), std::move(mahi))
129  );
130  }
131 
132  return algo;
133 }
T getParameter(std::string const &) const
std::unique_ptr< AbsHBHEPhase1Algo > parseHBHEPhase1AlgoDescription(const edm::ParameterSet &ps)
static std::unique_ptr< PulseShapeFitOOTPileupCorrection > parseHBHEMethod2Description(const edm::ParameterSet &conf)
JetCorrectorParameters corr
Definition: classes.h:5
static std::unique_ptr< MahiFit > parseHBHEMahiDescription(const edm::ParameterSet &conf)
static std::unique_ptr< HcalDeterministicFit > parseHBHEMethod3Description(const edm::ParameterSet &conf)
def move(src, dest)
Definition: eostools.py:511
std::string className(const T &t)
Definition: ClassName.h:30