00001 #ifndef __LeptonTriggerMatching_h__
00002 #define __LeptonTriggerMatching_h__
00003
00008 #include <string>
00009 #include <map>
00010 #include <set>
00011 #include "TTree.h"
00012 #include "TLorentzVector.h"
00013
00014 #define MUONEF_CB(x) m_d3pd->trig_EF_trigmuonef_track_CB_##x
00015 #define MUONEF_SA(x) m_d3pd->trig_EF_trigmuonef_track_SA_##x
00016 #define MUGIRL_CB(x) m_d3pd->trig_EF_trigmugirl_track_CB_##x
00017
00018 #include "TrigMuonEfficiency/TriggerNavigationVariables.h"
00019 typedef TriggerNavigationVariables MTT__D3PDEvent;
00020
00026 class LeptonTriggerMatching {
00027 public:
00028 enum MuonChainType {
00029 CHAIN_CB = 0,
00030 CHAIN_SA = 1,
00031 CHAIN_MG = 2
00032 };
00033
00034 struct EFmuon {
00035 bool valid;
00036 bool isIso;
00037 int iso_index;
00038 int roi_index;
00039 unsigned int chain_type;
00040 std::pair<int, int> indicies;
00041 float charge;
00042 float pt;
00043 float eta;
00044 float phi;
00045
00046 EFmuon() : valid(false), isIso(false), iso_index(-1), roi_index(-1), chain_type(CHAIN_CB), indicies(),
00047 charge(0.), pt(-1.e30), eta(-1.e30), phi(-1.e30) {}
00048 };
00049
00050 struct EFelectron {
00051 bool valid;
00052 bool useThreshold;
00053 float charge;
00054 int roi_index;
00055 float eta;
00056 float phi;
00057 std::string threshold;
00058
00059 EFelectron() : valid(false), useThreshold(false), charge(0.), roi_index(-1), eta(-1.e30), phi(-1.e30), threshold() {}
00060 };
00061
00062
00063
00069 LeptonTriggerMatching(const MTT__D3PDEvent *d3pd,
00070 TTree* = 0)
00071 : m_d3pd(d3pd),
00072 m_matchingDr(0.1),
00073 m_debug(false),
00074 m_MapOfChainIdMap(),
00075 m_NotFoundChain(),
00076 m_isIndexMatchUsed(false),
00077 m_isNavigationMatchUsed(false)
00078 {}
00079 virtual ~LeptonTriggerMatching(){}
00080
00081
00086 double getDeltaR() const {return m_matchingDr;}
00087
00088
00093 void setDeltaR(const double dr) {m_matchingDr = dr;}
00094
00095
00096 void setTriggerNavigationVariables(const MTT__D3PDEvent *d3pd) {m_d3pd = d3pd;}
00097
00098
00099 void setDebug(bool x) {m_debug = x;}
00100 void showSMKeys();
00101 void dumpChainIdMap(const int SMK);
00102 void createChainIdMapFile(const int SMK,
00103 const std::string& fileName);
00104
00105
00106
00107 protected:
00108 const MTT__D3PDEvent* m_d3pd;
00109 double m_matchingDr;
00110 bool m_debug;
00111 std::map<int, std::map<std::string, int> > m_MapOfChainIdMap;
00112 std::set<std::string> m_NotFoundChain;
00113 bool m_isIndexMatchUsed;
00114 bool m_isNavigationMatchUsed;
00115
00116
00117 double matchedTrackDetail(EFelectron& efElectronId,
00118 const EFelectron& usedEfElectronId,
00119 const double eta,
00120 const double phi,
00121 const std::vector<int>& container,
00122 const std::vector<int>& status);
00123
00124 double matchedTrackDetail(EFmuon& efMuonId,
00125 const EFmuon& usedEfMuonId,
00126 const std::string& threshold,
00127 const double eta,
00128 const double phi,
00129 const std::vector<int>& container,
00130 const std::vector<int>& status);
00131
00132 double index_match(const double eta,
00133 const double phi,
00134 const std::string& chain,
00135 const std::string& threshold,
00136 EFmuon& efMuonId,
00137 const EFmuon& usedEfMuonId);
00138
00139 bool L1_isPassed(const int iRoI,
00140 const std::string& l1item);
00141
00142 int getL1pt(const std::string& l1item);
00143
00144 int getChainIndex(const std::string& chain);
00145
00146 void readTrigConfTree(TTree* TrigConfTree,
00147 const std::vector<std::string>& skip);
00148
00149 double dR(const double eta1,
00150 const double phi1,
00151 const double eta2,
00152 const double phi2);
00153
00154 void tokenize(const std::string& str,
00155 std::vector<std::string>& tokens,
00156 const std::string& delimiters);
00157
00158 bool isEqual(const double x,
00159 const double y);
00160 };
00161 #endif //__LeptonTriggerMatching_h__
00162