EgammaObject

VarComparer

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
#ifndef DataFormats_HLTReco_EgammaObject_h
#define DataFormats_HLTReco_EgammaObject_h

#include "DataFormats/HLTReco/interface/TriggerObject.h"
#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
#include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h"
#include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h"

#include <vector>
#include <string>

namespace reco {
  class RecoEcalCandidate;
}

namespace trigger {
  class EgammaObject : public TriggerObject {
  public:
    EgammaObject() : hasPixelMatch_(false) {}

    EgammaObject(int id, float pt, float eta, float phi, float mass)
        : TriggerObject(id, pt, eta, phi, mass), hasPixelMatch_(false) {}
    EgammaObject(const reco::RecoEcalCandidate& ecalCand);

    const reco::SuperClusterRef& superCluster() const { return superCluster_; }
    const reco::GsfTrackRefVector& gsfTracks() const { return gsfTracks_; }
    const reco::ElectronSeedRefVector& seeds() const { return seeds_; }

    void setSuperCluster(const reco::SuperClusterRef& sc) { superCluster_ = sc; }
    void setGsfTracks(reco::GsfTrackRefVector trks) { gsfTracks_ = std::move(trks); }
    void setSeeds(reco::ElectronSeedRefVector seeds);

    bool hasVar(const std::string& varName) const;
    float var(const std::string& varName, bool raiseExcept = true) const;
    const std::vector<std::pair<std::string, float>>& vars() const { return vars_; }
    //varNames and varNamesStr are reasonably expensive functions and are more
    //intended for debugging than normal use
    std::vector<std::string> varNames() const;
    std::string varNamesStr() const;
    void setVars(std::vector<std::pair<std::string, float>> vars);
    void clearVars() { vars_.clear(); }

  private:
    struct VarComparer {
      bool operator()(const std::string& lhs, const std::pair<std::string, float>& rhs) const {
        return lhs < rhs.first;
      }
      bool operator()(const std::pair<std::string, float>& lhs, const std::string& rhs) const {
        return lhs.first < rhs;
      }
    };

    bool hasPixelMatch_;
    std::vector<std::pair<std::string, float>> vars_;

    reco::SuperClusterRef superCluster_;
    reco::GsfTrackRefVector gsfTracks_;
    //currently these are pixel seeds but could be tracker seeds...
    reco::ElectronSeedRefVector seeds_;
  };

}  // namespace trigger

#endif