Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 10:01:06

0001 #ifndef RECOMTD_TIMINGIDTOOLS_MTDTRACKQUALITYMVA
0002 #define RECOMTD_TIMINGIDTOOLS_MTDTRACKQUALITYMVA
0003 
0004 #include "DataFormats/VertexReco/interface/Vertex.h"
0005 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0006 #include "DataFormats/TrackReco/interface/Track.h"
0007 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0008 #include "DataFormats/Common/interface/ValueMap.h"
0009 
0010 #include "CommonTools/MVAUtils/interface/TMVAEvaluator.h"
0011 
0012 #define MTDTRACKQUALITYMVA_VARS(MTDBDTVAR) \
0013   MTDBDTVAR(pt)                            \
0014   MTDBDTVAR(eta)                           \
0015   MTDBDTVAR(phi)                           \
0016   MTDBDTVAR(chi2)                          \
0017   MTDBDTVAR(ndof)                          \
0018   MTDBDTVAR(numberOfValidHits)             \
0019   MTDBDTVAR(numberOfValidPixelBarrelHits)  \
0020   MTDBDTVAR(numberOfValidPixelEndcapHits)  \
0021   MTDBDTVAR(btlMatchChi2)                  \
0022   MTDBDTVAR(btlMatchTimeChi2)              \
0023   MTDBDTVAR(etlMatchChi2)                  \
0024   MTDBDTVAR(etlMatchTimeChi2)              \
0025   MTDBDTVAR(mtdt)                          \
0026   MTDBDTVAR(path_len)
0027 
0028 #define MTDBDTVAR_ENUM(ENUM) ENUM,
0029 #define MTDBDTVAR_STRING(STRING) #STRING,
0030 
0031 class MTDTrackQualityMVA {
0032 public:
0033   //---ctors---
0034   MTDTrackQualityMVA(std::string weights_file);
0035 
0036   enum class VarID { MTDTRACKQUALITYMVA_VARS(MTDBDTVAR_ENUM) };
0037 
0038   //---getters---
0039   // 4D
0040   float operator()(const reco::TrackRef& trk,
0041                    const edm::ValueMap<int>& npixBarrels,
0042                    const edm::ValueMap<int>& npixEndcaps,
0043                    const edm::ValueMap<float>& btl_chi2s,
0044                    const edm::ValueMap<float>& btl_time_chi2s,
0045                    const edm::ValueMap<float>& etl_chi2s,
0046                    const edm::ValueMap<float>& etl_time_chi2s,
0047                    const edm::ValueMap<float>& tmtds,
0048                    const edm::ValueMap<float>& trk_lengths) const;
0049 
0050 private:
0051   std::vector<std::string> vars_, spec_vars_;
0052   std::unique_ptr<TMVAEvaluator> mva_;
0053 };
0054 
0055 #endif