Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:40

0001 #ifndef DataFormats_HLTReco_EgammaObject_h
0002 #define DataFormats_HLTReco_EgammaObject_h
0003 
0004 #include "DataFormats/HLTReco/interface/TriggerObject.h"
0005 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
0006 #include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h"
0007 #include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h"
0008 
0009 #include <vector>
0010 #include <string>
0011 
0012 namespace reco {
0013   class RecoEcalCandidate;
0014 }
0015 
0016 namespace trigger {
0017   class EgammaObject : public TriggerObject {
0018   public:
0019     EgammaObject() : hasPixelMatch_(false) {}
0020 
0021     EgammaObject(int id, float pt, float eta, float phi, float mass)
0022         : TriggerObject(id, pt, eta, phi, mass), hasPixelMatch_(false) {}
0023     EgammaObject(const reco::RecoEcalCandidate& ecalCand);
0024 
0025     const reco::SuperClusterRef& superCluster() const { return superCluster_; }
0026     const reco::GsfTrackRefVector& gsfTracks() const { return gsfTracks_; }
0027     const reco::ElectronSeedRefVector& seeds() const { return seeds_; }
0028 
0029     void setSuperCluster(const reco::SuperClusterRef& sc) { superCluster_ = sc; }
0030     void setGsfTracks(reco::GsfTrackRefVector trks) { gsfTracks_ = std::move(trks); }
0031     void setSeeds(reco::ElectronSeedRefVector seeds);
0032 
0033     bool hasVar(const std::string& varName) const;
0034     float var(const std::string& varName, bool raiseExcept = true) const;
0035     const std::vector<std::pair<std::string, float>>& vars() const { return vars_; }
0036     //varNames and varNamesStr are reasonably expensive functions and are more
0037     //intended for debugging than normal use
0038     std::vector<std::string> varNames() const;
0039     std::string varNamesStr() const;
0040     void setVars(std::vector<std::pair<std::string, float>> vars);
0041     void clearVars() { vars_.clear(); }
0042 
0043   private:
0044     struct VarComparer {
0045       bool operator()(const std::string& lhs, const std::pair<std::string, float>& rhs) const {
0046         return lhs < rhs.first;
0047       }
0048       bool operator()(const std::pair<std::string, float>& lhs, const std::string& rhs) const {
0049         return lhs.first < rhs;
0050       }
0051     };
0052 
0053     bool hasPixelMatch_;
0054     std::vector<std::pair<std::string, float>> vars_;
0055 
0056     reco::SuperClusterRef superCluster_;
0057     reco::GsfTrackRefVector gsfTracks_;
0058     //currently these are pixel seeds but could be tracker seeds...
0059     reco::ElectronSeedRefVector seeds_;
0060   };
0061 
0062 }  // namespace trigger
0063 
0064 #endif