CMS 3D CMS Logo

Namespaces | Functions
parseHFPhase1AlgoDescription.h File Reference
#include <memory>
#include "RecoLocalCalo/HcalRecAlgos/interface/AbsHFPhase1Algo.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

Go to the source code of this file.

Namespaces

 edm
 HLT enums.
 

Functions

edm::ParameterSetDescription fillDescriptionForParseHFPhase1AlgoDescription ()
 
std::unique_ptr< AbsHFPhase1AlgoparseHFPhase1AlgoDescription (const edm::ParameterSet &ps)
 

Function Documentation

edm::ParameterSetDescription fillDescriptionForParseHFPhase1AlgoDescription ( )

Definition at line 89 of file parseHFPhase1AlgoDescription.cc.

References edm::ParameterSetDescription::add(), edm::ParameterSetDescription::ifValue(), or, and mitigatedMETSequence_cff::U.

Referenced by HFPhase1Reconstructor::fillDescriptions().

90 {
92 
93  std::vector<double> allPass{-10000.0, 10000.0, -10000.0, 10000.0};
94  desc.add<std::vector<double> >("tlimits", allPass);
95  desc.add<std::vector<double> >("energyWeights");
96  desc.add<unsigned>("soiPhase", 1U);
97  desc.add<double>("timeShift", 0.0);
98  desc.add<double>("triseIfNoTDC", -100.0);
99  desc.add<double>("tfallIfNoTDC", -101.0);
100  desc.add<double>("minChargeForUndershoot", 1.0e10);
101  desc.add<double>("minChargeForOvershoot", 1.0e10);
102  desc.add<bool>("alwaysCalculateQAsymmetry", true);
103 
104  desc.ifValue(edm::ParameterDescription<std::string>("Class", "HFSimpleTimeCheck", true),
105  "HFSimpleTimeCheck" >> edm::ParameterDescription<bool>("rejectAllFailures", false, true) or
106  "HFFlexibleTimeCheck" >> edm::ParameterDescription<bool>("rejectAllFailures", true, true));
107 
108  return desc;
109 }
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
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::unique_ptr<AbsHFPhase1Algo> parseHFPhase1AlgoDescription ( const edm::ParameterSet ps)

Definition at line 11 of file parseHFPhase1AlgoDescription.cc.

References patPFMETCorrections_cff::algo, HFPhase1Reconstructor_cfi::alwaysCalculateQAsymmetry, className(), HFPhase1Reconstructor_cfi::energyWeights, edm::ParameterSet::getParameter(), mps_fire::i, HFPhase1Reconstructor_cfi::minChargeForOvershoot, HFPhase1Reconstructor_cfi::minChargeForUndershoot, HFAnodeStatus::N_POSSIBLE_STATES, hcalLocalRecoNZS_cff::rejectAllFailures, HFPhase1Reconstructor_cfi::soiPhase, AlCaHLTBitMon_QueryRunRegistry::string, HFPhase1Reconstructor_cfi::tfallIfNoTDC, HFPhase1Reconstructor_cfi::timeShift, HFPhase1Reconstructor_cfi::tlimits, and HFPhase1Reconstructor_cfi::triseIfNoTDC.

12 {
13  std::unique_ptr<AbsHFPhase1Algo> algo;
14 
15  const std::string& className = ps.getParameter<std::string>("Class");
16 
17  const bool isHFSimpleTimeCheck = className == "HFSimpleTimeCheck";
18  if (isHFSimpleTimeCheck || className == "HFFlexibleTimeCheck")
19  {
20  const std::vector<double>& energyWeightsVec =
21  ps.getParameter<std::vector<double> >("energyWeights");
22  const unsigned soiPhase =
23  ps.getParameter<unsigned>("soiPhase");
24  const float timeShift =
25  ps.getParameter<double>("timeShift");
26  const float triseIfNoTDC =
27  ps.getParameter<double>("triseIfNoTDC");
28  const float tfallIfNoTDC =
29  ps.getParameter<double>("tfallIfNoTDC");
30  const bool rejectAllFailures =
31  ps.getParameter<bool>("rejectAllFailures");
32  const float minChargeForUndershoot =
33  ps.getParameter<double>("minChargeForUndershoot");
34  const float minChargeForOvershoot =
35  ps.getParameter<double>("minChargeForOvershoot");
36  const bool alwaysCalculateQAsymmetry =
37  ps.getParameter<bool>("alwaysCalculateQAsymmetry");
38 
40  const unsigned sz = sizeof(energyWeights)/sizeof(energyWeights[0][0]);
41 
42  if (energyWeightsVec.size() == sz)
43  {
44  std::pair<float,float> tlimits[2];
45  if (isHFSimpleTimeCheck)
46  {
47  // Must specify the time limits explicitly for this algorithm
48  const std::vector<double>& tlimitsVec =
49  ps.getParameter<std::vector<double> >("tlimits");
50  if (tlimitsVec.size() == 4)
51  {
52  tlimits[0] = std::pair<float,float>(tlimitsVec[0], tlimitsVec[1]);
53  tlimits[1] = std::pair<float,float>(tlimitsVec[2], tlimitsVec[3]);
54  }
55  else
56  return algo;
57  }
58  else
59  {
60  // Use "all pass" time limits values, just in case
61  tlimits[0] = std::pair<float,float>(-FLT_MAX, FLT_MAX);
62  tlimits[1] = tlimits[0];
63  }
64 
65  // Same order of elements as in the natural C array mapping
66  float* to = &energyWeights[0][0];
67  for (unsigned i=0; i<sz; ++i)
68  to[i] = energyWeightsVec[i];
69 
70  // Create the algorithm object
71  if (isHFSimpleTimeCheck)
72  algo = std::unique_ptr<AbsHFPhase1Algo>(
73  new HFSimpleTimeCheck(tlimits, energyWeights, soiPhase,
74  timeShift, triseIfNoTDC, tfallIfNoTDC,
75  minChargeForUndershoot, minChargeForOvershoot,
76  rejectAllFailures, alwaysCalculateQAsymmetry));
77  else
78  algo = std::unique_ptr<AbsHFPhase1Algo>(
79  new HFFlexibleTimeCheck(tlimits, energyWeights, soiPhase,
80  timeShift, triseIfNoTDC, tfallIfNoTDC,
81  minChargeForUndershoot, minChargeForOvershoot,
82  rejectAllFailures, alwaysCalculateQAsymmetry));
83  }
84  }
85 
86  return algo;
87 }
T getParameter(std::string const &) const
std::string className(const T &t)
Definition: ClassName.h:30