CMS 3D CMS Logo

parseHBHEPhase1AlgoDescription.cc
Go to the documentation of this file.
1 #include <cassert>
2 
7 
10 
11 // Phase 1 HBHE reco algorithm headers
13 
14 static std::unique_ptr<MahiFit> parseHBHEMahiDescription(const edm::ParameterSet& conf) {
15  const bool iDynamicPed = conf.getParameter<bool>("dynamicPed");
16  const double iTS4Thresh = conf.getParameter<double>("ts4Thresh");
17  const double chiSqSwitch = conf.getParameter<double>("chiSqSwitch");
18 
19  const bool iApplyTimeSlew = conf.getParameter<bool>("applyTimeSlew");
20 
21  const bool iCalculateArrivalTime = conf.getParameter<bool>("calculateArrivalTime");
22  const double iMeanTime = conf.getParameter<double>("meanTime");
23  const double iTimeSigmaHPD = conf.getParameter<double>("timeSigmaHPD");
24  const double iTimeSigmaSiPM = conf.getParameter<double>("timeSigmaSiPM");
25 
26  const std::vector<int> iActiveBXs = conf.getParameter<std::vector<int>>("activeBXs");
27  const int iNMaxItersMin = conf.getParameter<int>("nMaxItersMin");
28  const int iNMaxItersNNLS = conf.getParameter<int>("nMaxItersNNLS");
29  const double iDeltaChiSqThresh = conf.getParameter<double>("deltaChiSqThresh");
30  const double iNnlsThresh = conf.getParameter<double>("nnlsThresh");
31 
32  std::unique_ptr<MahiFit> corr = std::make_unique<MahiFit>();
33 
34  corr->setParameters(iDynamicPed,
35  iTS4Thresh,
37  iApplyTimeSlew,
39  iCalculateArrivalTime,
40  iMeanTime,
41  iTimeSigmaHPD,
42  iTimeSigmaSiPM,
43  iActiveBXs,
44  iNMaxItersMin,
45  iNMaxItersNNLS,
46  iDeltaChiSqThresh,
47  iNnlsThresh);
48 
49  return corr;
50 }
51 
52 static std::unique_ptr<PulseShapeFitOOTPileupCorrection> parseHBHEMethod2Description(const edm::ParameterSet& conf) {
53  const bool iPedestalConstraint = conf.getParameter<bool>("applyPedConstraint");
54  const bool iTimeConstraint = conf.getParameter<bool>("applyTimeConstraint");
55  const bool iAddPulseJitter = conf.getParameter<bool>("applyPulseJitter");
56  const bool iApplyTimeSlew = conf.getParameter<bool>("applyTimeSlew");
57  const double iTS4Min = conf.getParameter<double>("ts4Min");
58  const std::vector<double> iTS4Max = conf.getParameter<std::vector<double>>("ts4Max");
59  const double iPulseJitter = conf.getParameter<double>("pulseJitter");
60  const double iTimeMean = conf.getParameter<double>("meanTime");
61  const double iTimeSigHPD = conf.getParameter<double>("timeSigmaHPD");
62  const double iTimeSigSiPM = conf.getParameter<double>("timeSigmaSiPM");
63  const double iPedMean = conf.getParameter<double>("meanPed");
64  const double iTMin = conf.getParameter<double>("timeMin");
65  const double iTMax = conf.getParameter<double>("timeMax");
66  const std::vector<double> its4Chi2 = conf.getParameter<std::vector<double>>("ts4chi2");
67  const int iFitTimes = conf.getParameter<int>("fitTimes");
68 
69  if (iTimeConstraint)
70  assert(iTimeSigHPD);
71  if (iTimeConstraint)
72  assert(iTimeSigSiPM);
73 
74  std::unique_ptr<PulseShapeFitOOTPileupCorrection> corr = std::make_unique<PulseShapeFitOOTPileupCorrection>();
75 
76  corr->setPUParams(iPedestalConstraint,
77  iTimeConstraint,
78  iAddPulseJitter,
79  iApplyTimeSlew,
80  iTS4Min,
81  iTS4Max,
82  iPulseJitter,
83  iTimeMean,
84  iTimeSigHPD,
85  iTimeSigSiPM,
86  iPedMean,
87  iTMin,
88  iTMax,
89  its4Chi2,
91  iFitTimes);
92 
93  return corr;
94 }
95 
96 static std::unique_ptr<HcalDeterministicFit> parseHBHEMethod3Description(const edm::ParameterSet& conf) {
97  const bool iApplyTimeSlew = conf.getParameter<bool>("applyTimeSlewM3");
98  const int iTimeSlewParsType = conf.getParameter<int>("timeSlewParsType");
99  const double irespCorrM3 = conf.getParameter<double>("respCorrM3");
100 
101  std::unique_ptr<HcalDeterministicFit> fit = std::make_unique<HcalDeterministicFit>();
102 
103  fit->init((HcalTimeSlew::ParaSource)iTimeSlewParsType, HcalTimeSlew::Medium, iApplyTimeSlew, irespCorrM3);
104 
105  return fit;
106 }
107 
108 std::unique_ptr<AbsHBHEPhase1Algo> parseHBHEPhase1AlgoDescription(const edm::ParameterSet& ps,
110  std::unique_ptr<AbsHBHEPhase1Algo> algo;
111 
112  const std::string& className = ps.getParameter<std::string>("Class");
113 
114  if (className == "SimpleHBHEPhase1Algo") {
115  std::unique_ptr<MahiFit> mahi;
116  std::unique_ptr<PulseShapeFitOOTPileupCorrection> m2;
117  std::unique_ptr<HcalDeterministicFit> detFit;
118 
119  // only run Mahi OR Method 2 but not both
120  if (ps.getParameter<bool>("useMahi") && ps.getParameter<bool>("useM2")) {
121  throw cms::Exception("ConfigurationError")
122  << "SimpleHBHEPhase1Algo does not allow both Mahi and Method 2 to be turned on together.";
123  }
124  if (ps.getParameter<bool>("useMahi"))
125  mahi = parseHBHEMahiDescription(ps);
126  if (ps.getParameter<bool>("useM2"))
128  if (ps.getParameter<bool>("useM3"))
129  detFit = parseHBHEMethod3Description(ps);
130 
131  algo = std::make_unique<SimpleHBHEPhase1Algo>(ps.getParameter<int>("firstSampleShift"),
132  ps.getParameter<int>("samplesToAdd"),
133  ps.getParameter<double>("correctionPhaseNS"),
134  ps.getParameter<double>("tdcTimeShift"),
135  ps.getParameter<bool>("correctForPhaseContainment"),
136  ps.getParameter<bool>("applyLegacyHBMCorrection"),
137  std::move(m2),
138  std::move(detFit),
139  std::move(mahi),
140  iC);
141  }
142 
143  return algo;
144 }
145 
148 
149  desc.setAllowAnything();
150  desc.add<std::string>("Class", "SimpleHBHEPhase1Algo");
151  desc.add<bool>("useM2", false);
152  desc.add<bool>("useM3", true);
153  desc.add<bool>("useMahi", true);
154  desc.add<int>("firstSampleShift", 0);
155  desc.add<int>("samplesToAdd", 2);
156  desc.add<double>("correctionPhaseNS", 6.0);
157  desc.add<double>("tdcTimeShift", 0.0);
158  desc.add<bool>("correctForPhaseContainment", true);
159  desc.add<bool>("applyLegacyHBMCorrection", true);
160  desc.add<bool>("calculateArrivalTime", false);
161 
162  return desc;
163 }
parseHBHEMethod3Description
static std::unique_ptr< HcalDeterministicFit > parseHBHEMethod3Description(const edm::ParameterSet &conf)
Definition: parseHBHEPhase1AlgoDescription.cc:96
HcalDeterministicFit.h
HcalTimeSlew::ParaSource
ParaSource
Definition: HcalTimeSlew.h:70
MessageLogger.h
parseHBHEPhase1AlgoDescription.h
HcalTimeSlew::Medium
Definition: HcalTimeSlew.h:71
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
cms::cuda::assert
assert(be >=bs)
L1TowerCalibrationProducer_cfi.fit
fit
Definition: L1TowerCalibrationProducer_cfi.py:36
parseHBHEPhase1AlgoDescription
std::unique_ptr< AbsHBHEPhase1Algo > parseHBHEPhase1AlgoDescription(const edm::ParameterSet &ps, edm::ConsumesCollector iC)
Definition: parseHBHEPhase1AlgoDescription.cc:108
PulseShapeFitOOTPileupCorrection.h
cmsdt::algo
algo
Definition: constants.h:171
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
HLT_FULL_cff.chiSqSwitch
chiSqSwitch
Definition: HLT_FULL_cff.py:8391
fillDescriptionForParseHBHEPhase1Algo
edm::ParameterSetDescription fillDescriptionForParseHBHEPhase1Algo()
Definition: parseHBHEPhase1AlgoDescription.cc:146
parseHBHEMethod2Description
static std::unique_ptr< PulseShapeFitOOTPileupCorrection > parseHBHEMethod2Description(const edm::ParameterSet &conf)
Definition: parseHBHEPhase1AlgoDescription.cc:52
edm::ParameterSet
Definition: ParameterSet.h:47
SimpleHBHEPhase1Algo.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
callgraph.m2
m2
Definition: callgraph.py:38
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
parseHBHEMahiDescription
static std::unique_ptr< MahiFit > parseHBHEMahiDescription(const edm::ParameterSet &conf)
Definition: parseHBHEPhase1AlgoDescription.cc:14
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
className
std::string className(const T &t)
Definition: ClassName.h:31
ConsumesCollector.h
ParameterSet.h
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
fit
Definition: CombinedChiSquaredLikelihood.h:6