Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:02

0001 #ifndef RecoEgamma_EgammaTools_MVAVariableHelper_H
0002 #define RecoEgamma_EgammaTools_MVAVariableHelper_H
0003 
0004 #include "FWCore/Framework/interface/ConsumesCollector.h"
0005 #include "FWCore/Utilities/interface/EDGetToken.h"
0006 #include "FWCore/Framework/interface/Event.h"
0007 
0008 #include <unordered_map>
0009 #include <vector>
0010 #include <string>
0011 
0012 class MVAVariableHelper {
0013 public:
0014   MVAVariableHelper(edm::ConsumesCollector&& cc)
0015       : tokens_({cc.consumes<double>(edm::InputTag("fixedGridRhoFastjetAll")),
0016                  cc.consumes<double>(edm::InputTag("fixedGridRhoAll"))}) {}
0017 
0018   const std::vector<float> getAuxVariables(const edm::Event& iEvent) const {
0019     return std::vector<float>{static_cast<float>(iEvent.get(tokens_[0])), static_cast<float>(iEvent.get(tokens_[1]))};
0020   }
0021 
0022   static std::unordered_map<std::string, int> indexMap() {
0023     return {{"fixedGridRhoFastjetAll", 0}, {"fixedGridRhoAll", 1}};
0024   }
0025 
0026 private:
0027   const std::vector<edm::EDGetTokenT<double>> tokens_;
0028 };
0029 
0030 #endif