00001 #include "DQM/HLTEvF/interface/HLTTauDQMTrkPlotter.h"
00002 #include "Math/GenVector/VectorUtil.h"
00003
00004 HLTTauDQMTrkPlotter::HLTTauDQMTrkPlotter(const edm::ParameterSet& iConfig,int etbins,int etabins,int phibins,double maxpt,bool ref,double dr){
00005 jetTagSrc_ = iConfig.getParameter<edm::InputTag>("ConeIsolation");
00006 isolJets_ = iConfig.getParameter<edm::InputTag>("IsolatedJets");
00007 mcMatch_ = dr;
00008 doRef_ = ref;
00009 folder_ = iConfig.getParameter<std::string>("DQMFolder");
00010 type_ = iConfig.getParameter<std::string>("Type");
00011 EtMax_ = maxpt;
00012 NPtBins_ = etbins;
00013 NEtaBins_ = etabins;
00014 NPhiBins_ = phibins;
00015
00016
00017 store = &*edm::Service<DQMStore>();
00018
00019 if(store)
00020 {
00021 store->setCurrentFolder(folder_);
00022 jetEt = store->book1D((type_+"TauEt").c_str(), "Tau Et",NPtBins_,0,EtMax_);
00023 jetEta = store->book1D((type_+"TauEta").c_str(), "Tau Eta", NEtaBins_, -2.5, 2.5);
00024 jetPhi = store->book1D((type_+"TauPhi").c_str(), "Tau Phi", NPhiBins_, -3.2, 3.2);
00025 isoJetEt = store->book1D((type_+"IsolJetEt").c_str(), "Selected Jet E_{t}", NPtBins_, 0,EtMax_);
00026 isoJetEta = store->book1D((type_+"IsolJetEta").c_str(), "Selected Jet #eta", NEtaBins_, -2.5, 2.5);
00027 isoJetPhi = store->book1D((type_+"IsolJetPhi").c_str(), "Selected jet #phi", NPhiBins_, -3.2, 3.2);
00028
00029 nPxlTrksInL25Jet = store->book1D((type_+"nTracks").c_str(), "# RECO Tracks", 30, 0, 30);
00030 nQPxlTrksInL25Jet = store->book1D((type_+"nQTracks").c_str(),"# Quality RECO tracks", 15, 0, 15);
00031 signalLeadTrkPt = store->book1D((type_+"LeadTrackPt").c_str(), "Lead Track p_{t}", 75, 0, 150);
00032 hasLeadTrack = store->book1D((type_+"HasLeadTrack").c_str(), "Lead Track ?", 2, 0, 2);
00033
00034
00035 EtEffNum=store->book1D((type_+"TauEtEffNum").c_str(),"Efficiency vs E_{t}(Numerator)",NPtBins_,0,EtMax_);
00036 EtEffNum->getTH1F()->Sumw2();
00037
00038 EtEffDenom=store->book1D((type_+"TauEtEffDenom").c_str(),"Efficiency vs E_{t}(Denominator)",NPtBins_,0,EtMax_);
00039 EtEffDenom->getTH1F()->Sumw2();
00040
00041 EtaEffNum=store->book1D((type_+"TauEtaEffNum").c_str(),"Efficiency vs #eta (Numerator)",NEtaBins_,-2.5,2.5);
00042 EtaEffNum->getTH1F()->Sumw2();
00043
00044 EtaEffDenom=store->book1D((type_+"TauEtaEffDenom").c_str(),"Efficiency vs #eta(Denominator)",NEtaBins_,-2.5,2.5);
00045 EtaEffDenom->getTH1F()->Sumw2();
00046
00047 PhiEffNum=store->book1D((type_+"TauPhiEffNum").c_str(),"Efficiency vs #phi (Numerator)",NPhiBins_,-3.2,3.2);
00048 PhiEffNum->getTH1F()->Sumw2();
00049
00050 PhiEffDenom=store->book1D((type_+"TauPhiEffDenom").c_str(),"Efficiency vs #phi(Denominator)",NPhiBins_,-3.2,3.2);
00051 PhiEffDenom->getTH1F()->Sumw2();
00052
00053 }
00054 }
00055
00056
00057 HLTTauDQMTrkPlotter::~HLTTauDQMTrkPlotter(){
00058 }
00059
00060
00061
00062 void
00063 HLTTauDQMTrkPlotter::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup,const LVColl& mcInfo){
00064 using namespace edm;
00065 using namespace reco;
00066
00067 Handle<IsolatedTauTagInfoCollection> tauTagInfos;
00068 Handle<CaloJetCollection> isolJets;
00069
00070
00071 bool gotL3= iEvent.getByLabel(jetTagSrc_, tauTagInfos) &&tauTagInfos.isValid();
00072
00073 if(gotL3)
00074 {
00075 for(unsigned int i=0;i<tauTagInfos->size();++i)
00076 {
00077 IsolatedTauTagInfo tauTagInfo = (*tauTagInfos)[i];
00078 if(&(*tauTagInfo.jet()))
00079 {
00080 LV theJet=tauTagInfo.jet()->p4();
00081
00082 std::pair <bool,LV> m = match(theJet,mcInfo);
00083
00084 if((doRef_&&m.first)||(!doRef_))
00085 {
00086 jetEt->Fill(theJet.Et());
00087 jetEta->Fill(theJet.Eta());
00088 jetPhi->Fill(theJet.Phi());
00089 nPxlTrksInL25Jet->Fill(tauTagInfo.allTracks().size());
00090 nQPxlTrksInL25Jet->Fill(tauTagInfo.selectedTracks().size());
00091
00092 const TrackRef leadTrk = tauTagInfo.leadingSignalTrack();
00093 if(!leadTrk)
00094 {
00095 hasLeadTrack->Fill(0.5);
00096 }
00097 else
00098 {
00099 hasLeadTrack->Fill(1.5);
00100 signalLeadTrkPt->Fill(leadTrk->pt());
00101 }
00102
00103 LV refV;
00104 if(doRef_) refV = m.second; else refV=theJet;
00105
00106 EtEffDenom->Fill(refV.pt());
00107 EtaEffDenom->Fill(refV.eta());
00108 PhiEffDenom->Fill(refV.phi());
00109
00110
00111 bool gotIsoL3= iEvent.getByLabel(isolJets_, isolJets) && isolJets.isValid();
00112
00113
00114
00115 if(gotIsoL3)
00116 if(matchJet(*(tauTagInfo.jet()),*isolJets))
00117 {
00118 isoJetEta->Fill(theJet.Eta());
00119 isoJetEt->Fill(theJet.Et());
00120 isoJetPhi->Fill(theJet.Phi());
00121
00122 EtEffNum->Fill(refV.pt());
00123 EtaEffNum->Fill(refV.eta());
00124 PhiEffNum->Fill(refV.phi());
00125 }
00126 }
00127 }
00128 }
00129 }
00130 }
00131
00132
00133
00134
00135
00136
00137 std::pair<bool,LV>
00138 HLTTauDQMTrkPlotter::match(const LV& jet, const LVColl& matchingObject)
00139 {
00140 bool matched = false;
00141 LV mLV;
00142
00143 if(matchingObject.size() !=0 )
00144 {
00145 for(LVColl::const_iterator i = matchingObject.begin();i != matchingObject.end(); ++i)
00146 {
00147 double deltaR = ROOT::Math::VectorUtil::DeltaR(jet, *i);
00148 if(deltaR < mcMatch_)
00149 {
00150 matched = true;
00151 mLV = *i;
00152 }
00153 }
00154 }
00155
00156 std::pair<bool,LV> p = std::make_pair(matched,mLV);
00157
00158 return p;
00159 }
00160
00161 bool
00162 HLTTauDQMTrkPlotter::matchJet(const reco::Jet& jet,const reco::CaloJetCollection& McInfo)
00163 {
00164
00165
00166
00167
00168 bool matched=false;
00169
00170 if(McInfo.size()>0)
00171 for(reco::CaloJetCollection::const_iterator it = McInfo.begin();it!=McInfo.end();++it)
00172 {
00173 double delta = ROOT::Math::VectorUtil::DeltaR(jet.p4().Vect(),it->p4().Vect());
00174 if(delta<mcMatch_)
00175 {
00176 matched=true;
00177
00178 }
00179 }
00180
00181
00182
00183 return matched;
00184 }