Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:30:25

0001 #ifndef L1Trigger_Phase2L1ParticleFlow_HGC3DClusterEgID_h
0002 #define L1Trigger_Phase2L1ParticleFlow_HGC3DClusterEgID_h
0003 #include "FWCore/Framework/interface/Frameworkfwd.h"
0004 #include "FWCore/Framework/interface/stream/EDProducer.h"
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 
0009 #include "DataFormats/L1THGCal/interface/HGCalMulticluster.h"
0010 #include "DataFormats/L1TParticleFlow/interface/PFCluster.h"
0011 #include "CommonTools/Utils/interface/StringCutObjectSelector.h"
0012 #include "CommonTools/Utils/interface/StringObjectFunction.h"
0013 
0014 #include "TMVA/Factory.h"
0015 #include "TMVA/Reader.h"
0016 
0017 #include <vector>
0018 #include <cmath>
0019 
0020 namespace l1tpf {
0021   class HGC3DClusterEgID {
0022   public:
0023     HGC3DClusterEgID(const edm::ParameterSet &pset);
0024 
0025     void prepareTMVA();
0026 
0027     float passID(l1t::HGCalMulticluster c, l1t::PFCluster &cpf);
0028 
0029     std::string method() { return method_; }
0030 
0031   private:
0032     class Var {
0033     public:
0034       Var(const std::string &name, const std::string &expr) : name_(name), expr_(expr) {}
0035       void declare(TMVA::Reader &r) { r.AddVariable(name_, &val_); }
0036       void fill(const l1t::HGCalMulticluster &c) { val_ = expr_(c); }
0037 
0038     private:
0039       std::string name_;
0040       StringObjectFunction<l1t::HGCalMulticluster> expr_;
0041       float val_;
0042     };
0043 
0044     bool isPUFilter_;
0045     StringCutObjectSelector<l1t::HGCalMulticluster> preselection_;
0046     std::vector<Var> variables_;
0047     std::string method_, weightsFile_;
0048     std::unique_ptr<TMVA::Reader> reader_;
0049     StringObjectFunction<l1t::HGCalMulticluster> wp_;
0050   };  //class
0051 };    // namespace l1tpf
0052 
0053 #endif