CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQMOffline/Trigger/src/HLTTauDQMTrkPlotter.cc

Go to the documentation of this file.
00001 #include "DQMOffline/Trigger/interface/HLTTauDQMTrkPlotter.h"
00002 
00003 HLTTauDQMTrkPlotter::HLTTauDQMTrkPlotter(const edm::ParameterSet& iConfig, int etbins, int etabins, int phibins, double maxpt, bool ref, double dr, std::string dqmBaseFolder ) {
00004     //Initialize Plotter
00005     name_ = "HLTTauDQMTrkPlotter";
00006     
00007     //Process PSet
00008     try {
00009         jetTagSrc_       = iConfig.getUntrackedParameter<edm::InputTag>("ConeIsolation");
00010         isolJets_        = iConfig.getUntrackedParameter<edm::InputTag>("IsolatedJets");
00011         triggerTag_      = iConfig.getUntrackedParameter<std::string>("DQMFolder");
00012         triggerTagAlias_ = iConfig.getUntrackedParameter<std::string>("Alias","");
00013         type_            = iConfig.getUntrackedParameter<std::string>("Type");
00014         mcMatch_         = dr;
00015         EtMax_           = maxpt;
00016         NPtBins_         = etbins;
00017         NEtaBins_        = etabins;
00018         NPhiBins_        = phibins;
00019         dqmBaseFolder_   = dqmBaseFolder;
00020         doRef_           = ref;
00021         validity_        = true;
00022     } catch ( cms::Exception &e ) {
00023         edm::LogWarning("HLTTauDQMTrkPlotter::HLTTauDQMTrkPlotter") << e.what() << std::endl;
00024         validity_ = false;
00025         return;
00026     }
00027     
00028     if (store_) {
00029         //Create the histograms
00030         store_->setCurrentFolder(triggerTag());
00031         store_->removeContents();
00032         
00033         jetEt = store_->book1D((type_+"TauEt").c_str(), "#tau E_{T}",NPtBins_,0,EtMax_);
00034         jetEta = store_->book1D((type_+"TauEta").c_str(), "#tau #eta", NEtaBins_, -2.5, 2.5);
00035         jetPhi = store_->book1D((type_+"TauPhi").c_str(), "#tau #phi", NPhiBins_, -3.2, 3.2);
00036         isoJetEt = store_->book1D((type_+"IsolJetEt").c_str(), "Selected Jet E_{T}", NPtBins_, 0,EtMax_);
00037         isoJetEta = store_->book1D((type_+"IsolJetEta").c_str(), "Selected Jet #eta", NEtaBins_, -2.5, 2.5);
00038         isoJetPhi = store_->book1D((type_+"IsolJetPhi").c_str(), "Selected jet #phi", NPhiBins_, -3.2, 3.2);
00039         
00040         nPxlTrksInL25Jet = store_->book1D((type_+"nTracks").c_str(), "# RECO Tracks", 30, 0, 30);
00041         nQPxlTrksInL25Jet = store_->book1D((type_+"nQTracks").c_str(),"# Quality RECO Tracks", 15, 0, 15);
00042         signalLeadTrkPt = store_->book1D((type_+"LeadTrackPt").c_str(), "Lead Track p_{T}", 75, 0, 150);
00043         hasLeadTrack = store_->book1D((type_+"HasLeadTrack").c_str(), "Lead Track ?", 2, 0, 2);
00044         
00045         EtEffNum = store_->book1D((type_+"TauEtEffNum").c_str(),"Efficiency vs E_{T} (Numerator)",NPtBins_,0,EtMax_);
00046         EtEffNum->getTH1F()->Sumw2();
00047         
00048         EtEffDenom = store_->book1D((type_+"TauEtEffDenom").c_str(),"Efficiency vs E_{T} (Denominator)",NPtBins_,0,EtMax_);
00049         EtEffDenom->getTH1F()->Sumw2();
00050         
00051         EtaEffNum = store_->book1D((type_+"TauEtaEffNum").c_str(),"Efficiency vs #eta (Numerator)",NEtaBins_,-2.5,2.5);
00052         EtaEffNum->getTH1F()->Sumw2();
00053         
00054         EtaEffDenom = store_->book1D((type_+"TauEtaEffDenom").c_str(),"Efficiency vs #eta (Denominator)",NEtaBins_,-2.5,2.5);
00055         EtaEffDenom->getTH1F()->Sumw2();
00056         
00057         PhiEffNum = store_->book1D((type_+"TauPhiEffNum").c_str(),"Efficiency vs #phi (Numerator)",NPhiBins_,-3.2,3.2);
00058         PhiEffNum->getTH1F()->Sumw2();
00059         
00060         PhiEffDenom = store_->book1D((type_+"TauPhiEffDenom").c_str(),"Efficiency vs #phi (Denominator)",NPhiBins_,-3.2,3.2);
00061         PhiEffDenom->getTH1F()->Sumw2();
00062     }
00063 }
00064 
00065 
00066 HLTTauDQMTrkPlotter::~HLTTauDQMTrkPlotter() {
00067 }
00068 
00069 void HLTTauDQMTrkPlotter::analyze( const edm::Event& iEvent, const edm::EventSetup& iSetup, const std::map<int,LVColl>& mcInfo ) {
00070     using namespace edm;
00071     using namespace reco;
00072     
00073     //Tau reference
00074     std::map<int,LVColl>::const_iterator iref;
00075     iref = mcInfo.find(15);
00076     
00077     Handle<IsolatedTauTagInfoCollection> tauTagInfos;
00078     Handle<CaloJetCollection> isolJets;                    
00079     
00080     bool gotL3 = iEvent.getByLabel(jetTagSrc_, tauTagInfos) && tauTagInfos.isValid();
00081     
00082     if ( gotL3 ) {
00083         for ( unsigned int i = 0; i < tauTagInfos->size(); ++i ) {
00084             IsolatedTauTagInfo tauTagInfo = (*tauTagInfos)[i];
00085             if ( &(*tauTagInfo.jet()) ) {
00086                 LV theJet = tauTagInfo.jet()->p4();                      
00087 
00088                 std::pair<bool,LV> m(false,LV());
00089                 if ( iref != mcInfo.end() ) m = match(theJet,iref->second,mcMatch_);
00090                                 
00091                 if ( (doRef_ && m.first) || (!doRef_) ) {
00092                     jetEt->Fill(theJet.Et());                                                                            
00093                     jetEta->Fill(theJet.Eta());                                                                  
00094                     jetPhi->Fill(theJet.Phi());                                                                  
00095                     nPxlTrksInL25Jet->Fill(tauTagInfo.allTracks().size());                                                                  
00096                     nQPxlTrksInL25Jet->Fill(tauTagInfo.selectedTracks().size());                                                            
00097                     
00098                     const TrackRef leadTrk = tauTagInfo.leadingSignalTrack();
00099                     if ( !leadTrk ) { 
00100                         hasLeadTrack->Fill(0.5);
00101                     } else {
00102                         hasLeadTrack->Fill(1.5);
00103                         signalLeadTrkPt->Fill(leadTrk->pt());                            
00104                     }
00105                     
00106                     LV refV;
00107                     if ( doRef_ ) {
00108                         refV = m.second;   
00109                     } else {
00110                         refV = theJet;   
00111                     } 
00112                     
00113                     EtEffDenom->Fill(refV.pt());
00114                     EtaEffDenom->Fill(refV.eta());
00115                     PhiEffDenom->Fill(refV.phi());
00116                     
00117                     bool gotIsoL3 = iEvent.getByLabel(isolJets_, isolJets) && isolJets.isValid();
00118                     
00119                     if ( gotIsoL3 ) {
00120                         if ( matchJet(*(tauTagInfo.jet()),*isolJets) ) {
00121                             isoJetEta->Fill(theJet.Eta());
00122                             isoJetEt->Fill(theJet.Et());
00123                             isoJetPhi->Fill(theJet.Phi());
00124                             
00125                             EtEffNum->Fill(refV.pt());
00126                             EtaEffNum->Fill(refV.eta());
00127                             PhiEffNum->Fill(refV.phi());
00128                         }
00129                     }
00130                 }
00131             }
00132         }
00133     }
00134 }
00135 
00136 bool HLTTauDQMTrkPlotter::matchJet(const reco::Jet& jet,const reco::CaloJetCollection& McInfo) {
00137     //Loop On the Collection and see if your tau jet is matched to one there
00138     //Also find the nearest Matched MC Particle to your Jet (to be complete)
00139     
00140     bool matched = false;
00141     
00142     for ( reco::CaloJetCollection::const_iterator it = McInfo.begin(); it != McInfo.end(); ++it ) {
00143         double delta = ROOT::Math::VectorUtil::DeltaR(jet.p4().Vect(),it->p4().Vect());
00144         if ( delta < mcMatch_ ) {
00145             matched = true;
00146         }
00147     }
00148     return matched;
00149 }