CMS 3D CMS Logo

Basic2DGenericPFlowPositionCalc.h
Go to the documentation of this file.
1 #ifndef __Basic2DGenericPFlowPositionCalc_H__
2 #define __Basic2DGenericPFlowPositionCalc_H__
3 
7 
9 
11 #include <tuple>
12 
14 public:
17  _posCalcNCrystals(conf.getParameter<int>("posCalcNCrystals")),
18  _minAllowedNorm(conf.getParameter<double>("minAllowedNormalization")) {
19  std::vector<int> detectorEnum;
20  std::vector<int> depths;
21  std::vector<double> logWeightDenom;
22  std::vector<float> logWeightDenomInv;
23 
24  if (conf.exists("logWeightDenominatorByDetector")) {
25  const std::vector<edm::ParameterSet>& logWeightDenominatorByDetectorPSet =
26  conf.getParameterSetVector("logWeightDenominatorByDetector");
27 
28  for (const auto& pset : logWeightDenominatorByDetectorPSet) {
29  if (!pset.exists("detector")) {
30  throw cms::Exception("logWeightDenominatorByDetectorPSet") << "logWeightDenominator : detector not specified";
31  }
32 
33  const std::string& det = pset.getParameter<std::string>("detector");
34 
35  if (det == std::string("HCAL_BARREL1") || det == std::string("HCAL_ENDCAP")) {
36  std::vector<int> depthsT = pset.getParameter<std::vector<int> >("depths");
37  std::vector<double> logWeightDenomT = pset.getParameter<std::vector<double> >("logWeightDenominator");
38  if (logWeightDenomT.size() != depthsT.size()) {
39  throw cms::Exception("logWeightDenominator") << "logWeightDenominator mismatch with the numbers of depths";
40  }
41  for (unsigned int i = 0; i < depthsT.size(); ++i) {
42  if (det == std::string("HCAL_BARREL1"))
43  detectorEnum.push_back(1);
44  if (det == std::string("HCAL_ENDCAP"))
45  detectorEnum.push_back(2);
46  depths.push_back(depthsT[i]);
47  logWeightDenom.push_back(logWeightDenomT[i]);
48  }
49  }
50  }
51  } else {
52  detectorEnum.push_back(0);
53  depths.push_back(0);
54  logWeightDenom.push_back(conf.getParameter<double>("logWeightDenominator"));
55  }
56 
57  for (unsigned int i = 0; i < depths.size(); ++i) {
58  logWeightDenomInv.push_back(1. / logWeightDenom[i]);
59  }
60 
61  // _logWeightDenom = std::make_pair(depths,logWeightDenomInv);
62  _logWeightDenom = std::make_tuple(detectorEnum, depths, logWeightDenomInv);
63 
64  _timeResolutionCalcBarrel.reset(nullptr);
65  if (conf.exists("timeResolutionCalcBarrel")) {
66  const edm::ParameterSet& timeResConf = conf.getParameterSet("timeResolutionCalcBarrel");
68  }
69  _timeResolutionCalcEndcap.reset(nullptr);
70  if (conf.exists("timeResolutionCalcEndcap")) {
71  const edm::ParameterSet& timeResConf = conf.getParameterSet("timeResolutionCalcEndcap");
73  }
74 
75  switch (_posCalcNCrystals) {
76  case 5:
77  case 9:
78  case -1:
79  break;
80  default:
81  edm::LogError("Basic2DGenericPFlowPositionCalc") << "posCalcNCrystals not valid";
82  assert(0); // bug
83  }
84  }
85 
88 
91 
92 private:
93  const int _posCalcNCrystals;
94  std::tuple<std::vector<int>, std::vector<int>, std::vector<float> > _logWeightDenom;
95  const float _minAllowedNorm;
96 
97  std::unique_ptr<CaloRecHitResolutionProvider> _timeResolutionCalcBarrel;
98  std::unique_ptr<CaloRecHitResolutionProvider> _timeResolutionCalcEndcap;
99 
101 };
102 
104 
105 #endif
T getParameter(std::string const &) const
Basic2DGenericPFlowPositionCalc(const edm::ParameterSet &conf)
VParameterSet const & getParameterSetVector(std::string const &name) const
void calculateAndSetPositionActual(reco::PFCluster &) const
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:46
bool exists(std::string const &parameterName) const
checks if a parameter exists
void calculateAndSetPositions(reco::PFClusterCollection &) override
ParameterSet const & getParameterSet(std::string const &) const
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalcBarrel
void calculateAndSetPosition(reco::PFCluster &) override
std::tuple< std::vector< int >, std::vector< int >, std::vector< float > > _logWeightDenom
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalcEndcap
Basic2DGenericPFlowPositionCalc & operator=(const Basic2DGenericPFlowPositionCalc &)=delete
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
Definition: PFClusterFwd.h:9
#define DEFINE_EDM_PLUGIN(factory, type, name)