00001 #ifndef __ElectronTriggerMatching_h__
00002 #define __ElectronTriggerMatching_h__
00003
00009 #include <string>
00010 #include <map>
00011 #include <set>
00012 #include "TTree.h"
00013 #include "TLorentzVector.h"
00014
00015 #include "TrigMuonEfficiency/LeptonTriggerMatching.h"
00016
00022 class ElectronTriggerMatching : public LeptonTriggerMatching {
00023 public:
00024 struct DielectronChainInfo {
00025 public:
00026 std::string chain;
00027 std::pair<std::string, std::string> thresholds;
00028 std::string tightness;
00029 bool isSymmetric;
00030 bool isValid;
00031
00032 DielectronChainInfo(const std::string& chain_="") :
00033 chain(chain_), thresholds(), tightness(), isSymmetric(false), isValid(false) { }
00034
00035
00036 void dump() const {
00037 std::cout << "DielectronChainInfo: chain = " << chain
00038 << " thresholds.first = " << thresholds.first << " thresholds.second = " << thresholds.second
00039 << " isSymmetric = " << isSymmetric << " isValid = " << isValid << "\n";
00040 }
00041 };
00042
00048 ElectronTriggerMatching(const MTT__D3PDEvent *d3pd,
00049 TTree *TrigConfTree=0)
00050 : LeptonTriggerMatching(d3pd, TrigConfTree),
00051 m_DielectronChainMap()
00052 {
00053 if (TrigConfTree) {
00054 std::vector<std::string> skip;
00055 skip.push_back("EF_e");
00056 skip.push_back("EF_2e");
00057 readTrigConfTree(TrigConfTree, skip);
00058
00059 } else {
00060 createChainIdMapFromFile();
00061 }
00062 }
00063 virtual ~ElectronTriggerMatching(){}
00064
00065
00066
00074 bool match(const double eta,
00075 const double phi,
00076 const std::string& chain);
00077
00087 bool matchDielectron(const TLorentzVector& electron1,
00088 const TLorentzVector& electron2,
00089 const std::string& chain,
00090 bool& result1,
00091 bool& result2);
00092
00093 bool matchDielectron(const TLorentzVector& electron1,
00094 const TLorentzVector& electron2,
00095 const std::string& chain,
00096 std::pair<bool, bool>& result1,
00097 std::pair<bool, bool>& result2);
00098
00099 int matchDielectron_python(const TLorentzVector& electron1,
00100 const TLorentzVector& electron2,
00101 const std::string& chain)
00102 {
00103 std::pair<bool, bool> result1, result2;
00104 matchDielectron(electron1, electron2, chain, result1, result2);
00105 return (result1.second << 3 | result2.first << 2 | result2.second << 1 | result1.first << 0);
00106 }
00107
00108
00109
00117 bool matchElectronMuon(const TLorentzVector& electron,
00118 const TLorentzVector& muon,
00119 const std::string& chain);
00120
00121
00122
00123 private:
00124 std::map<std::string, DielectronChainInfo> m_DielectronChainMap;
00125
00126 double matchedTrackDetail(EFelectron& efElectronId,
00127 const EFelectron& usedEfElectronId,
00128 const double eta,
00129 const double phi,
00130 const std::string& chainEventTrigger,
00131 const std::string& threshold = std::string());
00132
00133
00134 std::pair<bool, bool> matchDielectron(const TLorentzVector& electron1,
00135 const TLorentzVector& electron2,
00136 const DielectronChainInfo& chainInfo);
00137
00138 bool decodeDielectronChain(DielectronChainInfo& chainInfo);
00139
00140 bool decodeElectronMuonChain(const std::string& chain,
00141 std::string& threshold);
00142
00143 void createChainIdMapFromFile();
00144 };
00145
00146 #endif //__ElectronTriggerMatching_h__
00147