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
reco::PFClusterCollection
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
Definition: PFClusterFwd.h:9
Basic2DGenericPFlowPositionCalc::_timeResolutionCalcBarrel
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalcBarrel
Definition: Basic2DGenericPFlowPositionCalc.h:97
CaloRecHitResolutionProvider
Definition: CaloRecHitResolutionProvider.h:8
Basic2DGenericPFlowPositionCalc::calculateAndSetPositionActual
void calculateAndSetPositionActual(reco::PFCluster &) const
Definition: Basic2DGenericPFlowPositionCalc.cc:30
PFRecHitFwd.h
mps_fire.i
i
Definition: mps_fire.py:428
Basic2DGenericPFlowPositionCalc::_posCalcNCrystals
const int _posCalcNCrystals
Definition: Basic2DGenericPFlowPositionCalc.h:93
MessageLogger.h
HLT_FULL_cff.detectorEnum
detectorEnum
Definition: HLT_FULL_cff.py:13208
Basic2DGenericPFlowPositionCalc
Definition: Basic2DGenericPFlowPositionCalc.h:13
cms::cuda::assert
assert(be >=bs)
Basic2DGenericPFlowPositionCalc::calculateAndSetPosition
void calculateAndSetPosition(reco::PFCluster &) override
Definition: Basic2DGenericPFlowPositionCalc.cc:20
Basic2DGenericPFlowPositionCalc::_logWeightDenom
std::tuple< std::vector< int >, std::vector< int >, std::vector< float > > _logWeightDenom
Definition: Basic2DGenericPFlowPositionCalc.h:94
Basic2DGenericPFlowPositionCalc::_timeResolutionCalcEndcap
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalcEndcap
Definition: Basic2DGenericPFlowPositionCalc.h:98
PFRecHit.h
customizeHLTforCMSSW.depths
depths
Definition: customizeHLTforCMSSW.py:31
Basic2DGenericPFlowPositionCalc::_minAllowedNorm
const float _minAllowedNorm
Definition: Basic2DGenericPFlowPositionCalc.h:95
PFCPositionCalculatorBase.h
PFCPositionCalculatorBase
Definition: PFCPositionCalculatorBase.h:14
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
Basic2DGenericPFlowPositionCalc::Basic2DGenericPFlowPositionCalc
Basic2DGenericPFlowPositionCalc(const edm::ParameterSet &conf)
Definition: Basic2DGenericPFlowPositionCalc.h:15
edm::ParameterSet
Definition: ParameterSet.h:47
Basic2DGenericPFlowPositionCalc::calculateAndSetPositions
void calculateAndSetPositions(reco::PFClusterCollection &) override
Definition: Basic2DGenericPFlowPositionCalc.cc:24
edmplugin::PluginFactory
Definition: PluginFactory.h:34
createfilelist.int
int
Definition: createfilelist.py:10
Basic2DGenericPFlowPositionCalc::operator=
Basic2DGenericPFlowPositionCalc & operator=(const Basic2DGenericPFlowPositionCalc &)=delete
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
CaloRecHitResolutionProvider.h
Exception
Definition: hltDiff.cc:246
reco::PFCluster
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ParameterSet::getParameterSetVector
VParameterSet const & getParameterSetVector(std::string const &name) const
Definition: ParameterSet.cc:2160
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2128
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27