00001 #ifndef __MuonTriggerMatching_h__
00002 #define __MuonTriggerMatching_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 MuonTriggerMatching : public LeptonTriggerMatching {
00023 public:
00029 MuonTriggerMatching(const MTT__D3PDEvent *d3pd,
00030 TTree *TrigConfTree=0)
00031 : LeptonTriggerMatching(d3pd, TrigConfTree),
00032 m_index(false),
00033 m_DimuonChainMap()
00034 {
00035 if (TrigConfTree) {
00036 std::vector<std::string> skip;
00037 skip.push_back("EF_mu");
00038 skip.push_back("EF_2mu");
00039 skip.push_back("L2_mu15");
00040 skip.push_back("L2_mu18");
00041 skip.push_back("L2_mu20");
00042 skip.push_back("L2_mu24");
00043 readTrigConfTree(TrigConfTree, skip);
00044
00045 } else {
00046 createChainIdMapFromFile();
00047 }
00048 }
00049 virtual ~MuonTriggerMatching(){}
00050
00051
00060 bool match(const double eta,
00061 const double phi,
00062 const std::string& chain,
00063 const std::string& l1item="");
00064
00065
00076 std::pair<int, int>
00077 matchedTrack(const double eta,
00078 const double phi,
00079 const std::string& chain,
00080 const std::string& l1item="");
00081
00082
00092 bool matchDimuon(const TLorentzVector& muon1,
00093 const TLorentzVector& muon2,
00094 const std::string& chain,
00095 std::pair<bool, bool>& result1,
00096 std::pair<bool, bool>& result2);
00097
00098
00099 int matchDimuon_python(const TLorentzVector& muon1,
00100 const TLorentzVector& muon2,
00101 const std::string& chain)
00102 {
00103 std::pair<bool, bool> result1, result2;
00104 matchDimuon(muon1, muon2, chain, result1, result2);
00105 return (result1.second << 3 | result2.first << 2 | result2.second << 1 | result1.first << 0);
00106 }
00107
00108
00109
00110
00111 void useIndex(bool x) {m_index = x;}
00112
00113
00117 struct DimuonChainInfo {
00118 public:
00119 std::string chain;
00120 std::string tightness;
00121 std::pair<std::string, std::string> thresholds;
00122 std::string l2seed;
00123 std::string efseed;
00124 bool is2011;
00125 bool isEFFS;
00126 bool isSymmetric;
00127 bool isValid;
00128
00129 DimuonChainInfo(const std::string& chain_="") :
00130 chain(chain_), tightness(""), thresholds(), l2seed(""), efseed(""),
00131 is2011(false), isEFFS(false), isSymmetric(false), isValid(false) {}
00132
00133 void dump() {
00134 std::cout << "DimuonChainInfo: chain = " << chain << " tightness = " << tightness
00135 << " thresholds.first = " << thresholds.first << " thresholds.second = " << thresholds.second
00136 << " l2seed = " << l2seed << " efseed = " << efseed << " is2011 = " << is2011
00137 << " isEFFS = " << isEFFS << " isSymmetric = " << isSymmetric << " isValid = " << isValid << "\n";
00138 }
00139 };
00140
00141 private:
00142 bool m_index;
00143 std::map<std::string, DimuonChainInfo> m_DimuonChainMap;
00144
00145 double matchedTrackDetail_index(EFmuon& efMuonId,
00146 const EFmuon& usedEfMuonId,
00147 const double eta,
00148 const double phi,
00149 const std::string& chainForThisMuon,
00150 const std::string& l1item = std::string(),
00151 const std::string& chainEventTrigger = std::string());
00152
00153 double matchedTrackDetail(EFmuon& efMuonId,
00154 const EFmuon& usedEfMuonId,
00155 const double eta,
00156 const double phi,
00157 const std::string& chainForThisMuon,
00158 const std::string& l1item = std::string(),
00159 const std::string& chainEventTrigger = std::string());
00160
00161 std::pair<bool, bool> matchDimuon(const TLorentzVector& muon1,
00162 const TLorentzVector& muon2,
00163 const DimuonChainInfo& chain);
00164
00165 void createChainIdMapFromFile();
00166
00167 bool decodeDimuonChain(DimuonChainInfo& chainInfo);
00168
00169 bool checkSeedL2(const double eta,
00170 const double phi,
00171 const std::string& chain,
00172 double l2dr=0.15,
00173 double l1dr=0.20);
00174
00175 bool checkSeedEF(const double eta,
00176 const double phi,
00177 const std::string& chain);
00178
00179 bool checkSeed_index(const double eta,
00180 const double phi,
00181 const std::string& chain);
00182 };
00183
00184
00185 #endif //__MuonTriggerMatching_h__
00186