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  {
20 
21  std::vector<int> detectorEnum;
22  std::vector<int> depths;
23  std::vector<double> logWeightDenom;
24  std::vector<float> logWeightDenomInv;
25 
26  if(conf.exists("logWeightDenominatorByDetector")) {
27 
28  const std::vector<edm::ParameterSet>& logWeightDenominatorByDetectorPSet = conf.getParameterSetVector("logWeightDenominatorByDetector");
29 
30  for( const auto& pset : logWeightDenominatorByDetectorPSet ) {
31  if(!pset.exists("detector")) {
32  throw cms::Exception("logWeightDenominatorByDetectorPSet")
33  << "logWeightDenominator : detector not specified";
34  }
35 
36  const std::string& det = pset.getParameter<std::string>("detector");
37 
38  if (det==std::string("HCAL_BARREL1") || det==std::string("HCAL_ENDCAP")) {
39  std::vector<int> depthsT=pset.getParameter<std::vector<int> >("depths");
40  std::vector<double> logWeightDenomT=pset.getParameter<std::vector<double> >("logWeightDenominator");
41  if(logWeightDenomT.size()!=depthsT.size()) {
42  throw cms::Exception("logWeightDenominator")
43  << "logWeightDenominator mismatch with the numbers of depths";
44  }
45  for(unsigned int i=0;i < depthsT.size();++i){
46  if(det==std::string("HCAL_BARREL1")) detectorEnum.push_back(1);
47  if(det==std::string("HCAL_ENDCAP")) detectorEnum.push_back(2);
48  depths.push_back(depthsT[i]);
49  logWeightDenom.push_back(logWeightDenomT[i]);
50  }
51  }
52  }
53  } else {
54  detectorEnum.push_back(0);
55  depths.push_back(0);
56  logWeightDenom.push_back(conf.getParameter<double>("logWeightDenominator"));
57  }
58 
59  for(unsigned int i=0;i < depths.size();++i){
60  logWeightDenomInv.push_back(1./logWeightDenom[i]);
61  }
62 
63  // _logWeightDenom = std::make_pair(depths,logWeightDenomInv);
64  _logWeightDenom = std::make_tuple(detectorEnum,depths,logWeightDenomInv);
65 
66  _timeResolutionCalcBarrel.reset(nullptr);
67  if( conf.exists("timeResolutionCalcBarrel") ) {
68  const edm::ParameterSet& timeResConf =
69  conf.getParameterSet("timeResolutionCalcBarrel");
71  }
72  _timeResolutionCalcEndcap.reset(nullptr);
73  if( conf.exists("timeResolutionCalcEndcap") ) {
74  const edm::ParameterSet& timeResConf =
75  conf.getParameterSet("timeResolutionCalcEndcap");
77  }
78 
79  switch( _posCalcNCrystals ) {
80  case 5:
81  case 9:
82  case -1:
83  break;
84  default:
85  edm::LogError("Basic2DGenericPFlowPositionCalc") << "posCalcNCrystals not valid";
86  assert(0); // bug
87  }
88 
89 
90  }
91 
94 
97 
98  private:
99  const int _posCalcNCrystals;
100  std::tuple<std::vector<int> ,std::vector<int> , std::vector<float> > _logWeightDenom;
101  const float _minAllowedNorm;
102 
103  std::unique_ptr<CaloRecHitResolutionProvider> _timeResolutionCalcBarrel;
104  std::unique_ptr<CaloRecHitResolutionProvider> _timeResolutionCalcEndcap;
105 
107 };
108 
111  "Basic2DGenericPFlowPositionCalc");
112 
113 #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:47
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::tuple< std::vector< int >,std::vector< int >, std::vector< float > > _logWeightDenom
void calculateAndSetPositions(reco::PFClusterCollection &) override
ParameterSet const & getParameterSet(std::string const &) const
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalcBarrel
void calculateAndSetPosition(reco::PFCluster &) override
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)