CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/HLTriggerOffline/Common/interface/FourVectorHLTriggerOffline.h

Go to the documentation of this file.
00001 #ifndef FOURVECTORHLTRIGGEROFFLINE_H
00002 #define FOURVECTORHLTRIGGEROFFLINE_H
00003 // -*- C++ -*-
00004 //
00005 // Package:    FourVectorHLTriggerOffline
00006 // Class:      FourVectorHLTriggerOffline
00007 // 
00016 //
00017 // Original Author:  Jeffrey Berryhill
00018 //         Created:  June 2008
00019 // Rewritten by: Vladimir Rekovic
00020 //         Date:  May 2009
00021 // $Id: FourVectorHLTriggerOffline.h,v 1.27.2.1 2010/08/03 16:08:23 wmtan Exp $
00022 //
00023 //
00024 
00025 
00026 // system include files
00027 #include <memory>
00028 #include <unistd.h>
00029 
00030 
00031 // user include files
00032 #include "FWCore/Framework/interface/Frameworkfwd.h"
00033 #include "FWCore/Framework/interface/EDAnalyzer.h"
00034 
00035 #include "FWCore/Framework/interface/Event.h"
00036 #include "FWCore/Framework/interface/MakerMacros.h"
00037 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00038 #include "DataFormats/Common/interface/TriggerResults.h"
00039 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
00040 
00041 #include "DQMServices/Core/interface/DQMStore.h"
00042 #include "DQMServices/Core/interface/MonitorElement.h"
00043 #include "FWCore/ServiceRegistry/interface/Service.h"
00044 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00045 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00046 
00047 // added VR
00048 #include "FWCore/Framework/interface/EDAnalyzer.h"
00049 #include "DataFormats/Common/interface/Handle.h"
00050 #include "FWCore/Framework/interface/Run.h"
00051 #include "FWCore/Framework/interface/MakerMacros.h"
00052 #include "FWCore/Framework/interface/ESHandle.h"
00053 
00054 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00055 
00056 #include "DataFormats/HLTReco/interface/TriggerObject.h"
00057 #include "DataFormats/Common/interface/TriggerResults.h"
00058 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00059 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
00060 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
00061 
00062 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00063 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
00064 #include "DataFormats/EgammaCandidates/interface/Photon.h"
00065 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00066 #include "DataFormats/TrackReco/interface/Track.h"
00067 #include "DataFormats/TrackReco/interface/TrackExtra.h"
00068 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00069 #include "DataFormats/MuonReco/interface/Muon.h"
00070 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00071 #include "DataFormats/JetReco/interface/CaloJet.h"
00072 #include "DataFormats/TauReco/interface/CaloTauFwd.h"
00073 #include "DataFormats/TauReco/interface/CaloTau.h"
00074 #include "DataFormats/METReco/interface/CaloMETCollection.h"
00075 #include "DataFormats/METReco/interface/CaloMET.h"
00076 #include "DataFormats/BTauReco/interface/JetTag.h"
00077 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00078 #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
00079 #include "DataFormats/JetReco/interface/GenJetCollection.h"
00080 #include "DataFormats/METReco/interface/GenMETCollection.h"
00081 #include "DataFormats/METReco/interface/GenMET.h"
00082 #include "DataFormats/Math/interface/deltaR.h"
00083 #include  "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
00084 
00085 #include "DQMServices/Core/interface/MonitorElement.h"
00086 
00087 
00088 #include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h"
00089 #include "DataFormats/JetReco/interface/JetFloatAssociation.h"
00090 
00091 
00092 #include <iostream>
00093 #include <fstream>
00094 #include <vector>
00095 
00096 
00097 typedef std::multimap<float,int> fimmap ;
00098 typedef std::set<fimmap , std::less<fimmap> > mmset;
00099 
00100 class FourVectorHLTriggerOffline : public edm::EDAnalyzer {
00101    public:
00102       explicit FourVectorHLTriggerOffline(const edm::ParameterSet&);
00103       ~FourVectorHLTriggerOffline();
00104 
00105       void cleanDRMatchSet(mmset& tempSet);
00106 
00107    private:
00108       virtual void beginJob() ;
00109       virtual void analyze(const edm::Event&, const edm::EventSetup&);
00110       virtual void endJob() ;
00111 
00112       // BeginRun
00113       void beginRun(const edm::Run& run, const edm::EventSetup& c);
00114 
00115       // EndRun
00116       void endRun(const edm::Run& run, const edm::EventSetup& c);
00117 
00118 
00119       // ----------member data --------------------------- 
00120       int nev_;
00121       DQMStore * dbe_;
00122 
00123       MonitorElement* total_;
00124 
00125       bool plotAll_;
00126       bool resetMe_;
00127       int currentRun_;
00128  
00129       unsigned int nBins_; 
00130       double ptMin_ ;
00131       double ptMax_ ;
00132       
00133       double electronEtaMax_;
00134       double electronEtMin_;
00135       double electronDRMatch_;
00136       double muonEtaMax_;
00137       double muonEtMin_;
00138       double muonDRMatch_;
00139       double tauEtaMax_;
00140       double tauEtMin_;
00141       double tauDRMatch_;
00142       double jetEtaMax_;
00143       double jetEtMin_;
00144       double jetDRMatch_;
00145       double bjetEtaMax_;
00146       double bjetEtMin_;
00147       double bjetDRMatch_;
00148       double photonEtaMax_;
00149       double photonEtMin_;
00150       double photonDRMatch_;
00151       double trackEtaMax_;
00152       double trackEtMin_;
00153       double trackDRMatch_;
00154       double metMin_;
00155       double htMin_;
00156       double sumEtMin_;
00157 
00158       std::vector<std::pair<std::string, std::string> > custompathnamepairs_;
00159 
00160 
00161       std::string dirname_;
00162       std::string processname_;
00163       bool monitorDaemon_;
00164       int theHLTOutputType;
00165       edm::InputTag triggerSummaryLabel_;
00166       edm::InputTag triggerResultsLabel_;
00167       HLTConfigProvider hltConfig_;
00168       // data across paths
00169       MonitorElement* scalersSelect;
00170       // helper class to store the data path
00171 
00172       class PathInfo {
00173         PathInfo():
00174           pathIndex_(-1), denomPathName_("unset"), pathName_("unset"), l1pathName_("unset"), filterName_("unset"), processName_("unset"), objectType_(-1)
00175           {};
00176       public:
00177         void setHistos(
00178                        MonitorElement* const NMc, 
00179                        MonitorElement* const mcEtMc, 
00180                        MonitorElement* const mcEtavsmcPhiMc,  
00181                        MonitorElement* const NOn, 
00182                        MonitorElement* const onEtOn, 
00183                        MonitorElement* const onEtavsonPhiOn,  
00184                        MonitorElement* const NOff, 
00185                        MonitorElement* const offEtOff, 
00186                        MonitorElement* const offEtavsoffPhiOff,
00187                        MonitorElement* const NL1, 
00188                        MonitorElement* const l1EtL1, 
00189                        MonitorElement* const l1Etavsl1PhiL1,
00190                        MonitorElement* const NL1On, 
00191                        MonitorElement* const l1EtL1On, 
00192                        MonitorElement* const l1Etavsl1PhiL1On,
00193                        MonitorElement* const NL1Off,   
00194                        MonitorElement* const offEtL1Off, 
00195                        MonitorElement* const offEtavsoffPhiL1Off,
00196                        MonitorElement* const NOnOff, 
00197                        MonitorElement* const offEtOnOff, 
00198                        MonitorElement* const offEtavsoffPhiOnOff,
00199                        MonitorElement* const NL1Mc, 
00200                        MonitorElement* const mcEtL1Mc, 
00201                        MonitorElement* const mcEtavsmcPhiL1Mc,
00202                        MonitorElement* const NOffMc, 
00203                        MonitorElement* const mcEtOffMc, 
00204                        MonitorElement* const mcEtavsmcPhiOffMc,
00205                        MonitorElement* const NOnMc, 
00206                        MonitorElement* const mcEtOnMc, 
00207                        MonitorElement* const mcEtavsmcPhiOnMc,
00208                        MonitorElement* const NL1OnUM, 
00209                        MonitorElement* const l1EtL1OnUM, 
00210                        MonitorElement* const l1Etavsl1PhiL1OnUM,
00211                        MonitorElement* const NL1OffUM,   
00212                        MonitorElement* const offEtL1OffUM, 
00213                        MonitorElement* const offEtavsoffPhiL1OffUM,
00214                        MonitorElement* const NOnOffUM, 
00215                        MonitorElement* const offEtOnOffUM, 
00216                        MonitorElement* const offEtavsoffPhiOnOffUM,
00217                        MonitorElement* const NL1McUM, 
00218                        MonitorElement* const mcEtL1McUM, 
00219                        MonitorElement* const mcEtavsmcPhiL1McUM,
00220                        MonitorElement* const NOffMcUM, 
00221                        MonitorElement* const mcEtOffMcUM, 
00222                        MonitorElement* const mcEtavsmcPhiOffMcUM,
00223                        MonitorElement* const NOnMcUM, 
00224                        MonitorElement* const mcEtOnMcUM, 
00225                        MonitorElement* const mcEtavsmcPhiOnMcUM,
00226                        MonitorElement* const mcDRL1Mc, 
00227                        MonitorElement* const mcDROnMc, 
00228                        MonitorElement* const mcDROffMc, 
00229                        MonitorElement* const offDRL1Off, 
00230                        MonitorElement* const offDROnOff, 
00231                        MonitorElement* const l1DRL1On 
00232                                          ) {
00233           NMc_ = NMc;
00234           mcEtMc_ = mcEtMc;
00235           mcEtavsmcPhiMc_ = mcEtavsmcPhiMc;
00236           NOn_ = NOn;
00237           onEtOn_ = onEtOn;
00238           onEtavsonPhiOn_ = onEtavsonPhiOn;
00239           NOff_ = NOff;
00240           offEtOff_ = offEtOff;
00241           offEtavsoffPhiOff_ = offEtavsoffPhiOff;
00242           NL1_ = NL1;
00243           l1EtL1_ = l1EtL1;
00244           l1Etavsl1PhiL1_ = l1Etavsl1PhiL1;
00245           NL1On_ = NL1On;
00246           l1EtL1On_ = l1EtL1On;
00247           l1Etavsl1PhiL1On_ = l1Etavsl1PhiL1On;
00248           NL1Off_ = NL1Off;
00249           offEtL1Off_ = offEtL1Off;
00250           offEtavsoffPhiL1Off_ = offEtavsoffPhiL1Off;
00251           NOnOff_ = NOnOff;
00252           offEtOnOff_ = offEtOnOff;
00253           offEtavsoffPhiOnOff_ = offEtavsoffPhiOnOff;
00254           NL1Mc_ = NL1Mc;
00255           mcEtL1Mc_ = mcEtL1Mc;
00256           mcEtavsmcPhiL1Mc_ = mcEtavsmcPhiL1Mc;
00257           NOffMc_ = NOffMc;
00258           mcEtOffMc_ = mcEtOffMc;
00259           mcEtavsmcPhiOffMc_ = mcEtavsmcPhiOffMc;
00260           NOnMc_ = NOnMc;
00261           mcEtOnMc_ = mcEtOnMc;
00262           mcEtavsmcPhiOnMc_ = mcEtavsmcPhiOnMc;
00263           NL1OnUM_ = NL1OnUM;
00264           l1EtL1OnUM_ = l1EtL1OnUM;
00265           l1Etavsl1PhiL1OnUM_ = l1Etavsl1PhiL1OnUM;
00266           NL1OffUM_ = NL1OffUM;
00267           offEtL1OffUM_ = offEtL1OffUM;
00268           offEtavsoffPhiL1OffUM_ = offEtavsoffPhiL1OffUM;
00269           NOnOffUM_ = NOnOffUM;
00270           offEtOnOffUM_ = offEtOnOffUM;
00271           offEtavsoffPhiOnOffUM_ = offEtavsoffPhiOnOffUM;
00272           NL1McUM_ = NL1McUM;
00273           mcEtL1McUM_ = mcEtL1McUM;
00274           mcEtavsmcPhiL1McUM_ = mcEtavsmcPhiL1McUM;
00275           NOffMcUM_ = NOffMcUM;
00276           mcEtOffMcUM_ = mcEtOffMcUM;
00277           mcEtavsmcPhiOffMcUM_ = mcEtavsmcPhiOffMcUM;
00278           NOnMcUM_ = NOnMcUM;
00279           mcEtOnMcUM_ = mcEtOnMcUM;
00280           mcEtavsmcPhiOnMcUM_ = mcEtavsmcPhiOnMcUM;
00281     mcDRL1Mc_   =  mcDRL1Mc; 
00282     mcDROnMc_   =  mcDROnMc; 
00283     mcDROffMc_  =  mcDROffMc; 
00284     offDRL1Off_ =  offDRL1Off; 
00285     offDROnOff_ =  offDROnOff; 
00286     l1DRL1On_   =  l1DRL1On;
00287         }
00288         MonitorElement * getNMcHisto() {
00289           return NMc_;
00290         }
00291         MonitorElement * getMcEtMcHisto() {
00292           return mcEtMc_;
00293         }
00294         MonitorElement * getMcEtaVsMcPhiMcHisto() {
00295           return mcEtavsmcPhiMc_;
00296         }
00297         MonitorElement * getNOnHisto() {
00298           return NOn_;
00299         }
00300         MonitorElement * getOnEtOnHisto() {
00301           return onEtOn_;
00302         }
00303         MonitorElement * getOnEtaVsOnPhiOnHisto() {
00304           return onEtavsonPhiOn_;
00305         }
00306         MonitorElement * getNOffHisto() {
00307           return NOff_;
00308         }
00309         MonitorElement * getOffEtOffHisto() {
00310           return offEtOff_;
00311         }
00312         MonitorElement * getOffEtaVsOffPhiOffHisto() {
00313           return offEtavsoffPhiOff_;
00314         }
00315         MonitorElement * getNL1Histo() {
00316           return NL1_;
00317         }
00318         MonitorElement * getL1EtL1Histo() {
00319           return l1EtL1_;
00320         }
00321         MonitorElement * getL1EtaVsL1PhiL1Histo() {
00322           return l1Etavsl1PhiL1_;
00323         }
00324         MonitorElement * getNL1OnHisto() {
00325           return NL1On_;
00326         }
00327         MonitorElement * getL1EtL1OnHisto() {
00328           return l1EtL1On_;
00329         }
00330         MonitorElement * getL1EtaVsL1PhiL1OnHisto() {
00331           return l1Etavsl1PhiL1On_;
00332         }
00333         MonitorElement * getNL1OffHisto() {
00334           return NL1Off_;
00335         }
00336         MonitorElement * getOffEtL1OffHisto() {
00337           return offEtL1Off_;
00338         }
00339         MonitorElement * getOffEtaVsOffPhiL1OffHisto() {
00340           return offEtavsoffPhiL1Off_;
00341         }
00342         MonitorElement * getNOnOffHisto() {
00343           return NOnOff_;
00344         }
00345         MonitorElement * getOffEtOnOffHisto() {
00346           return offEtOnOff_;
00347         }
00348         MonitorElement * getOffEtaVsOffPhiOnOffHisto() {
00349           return offEtavsoffPhiOnOff_;
00350         }
00351         MonitorElement * getNL1McHisto() {
00352           return NL1Mc_;
00353         }
00354         MonitorElement * getMcEtL1McHisto() {
00355           return mcEtL1Mc_;
00356         }
00357         MonitorElement * getMcEtaVsMcPhiL1McHisto() {
00358           return mcEtavsmcPhiL1Mc_;
00359         }
00360 
00361         MonitorElement * getNOffMcHisto() {
00362           return NOffMc_;
00363         }
00364         MonitorElement * getMcEtOffMcHisto() {
00365           return mcEtOffMc_;
00366         }
00367         MonitorElement * getMcEtaVsMcPhiOffMcHisto() {
00368           return mcEtavsmcPhiOffMc_;
00369         }
00370 
00371         MonitorElement * getNOnMcHisto() {
00372           return NOnMc_;
00373         }
00374         MonitorElement * getMcEtOnMcHisto() {
00375           return mcEtOnMc_;
00376         }
00377         MonitorElement * getMcEtaVsMcPhiOnMcHisto() {
00378           return mcEtavsmcPhiOnMc_;
00379         }
00380         MonitorElement * getNL1OnUMHisto() {
00381           return NL1OnUM_;
00382         }
00383         MonitorElement * getL1EtL1OnUMHisto() {
00384           return l1EtL1OnUM_;
00385         }
00386         MonitorElement * getL1EtaVsL1PhiL1OnUMHisto() {
00387           return l1Etavsl1PhiL1OnUM_;
00388         }
00389         MonitorElement * getNL1OffUMHisto() {
00390           return NL1OffUM_;
00391         }
00392         MonitorElement * getOffEtL1OffUMHisto() {
00393           return offEtL1OffUM_;
00394         }
00395         MonitorElement * getOffEtaVsOffPhiL1OffUMHisto() {
00396           return offEtavsoffPhiL1OffUM_;
00397         }
00398         MonitorElement * getNOnOffUMHisto() {
00399           return NOnOffUM_;
00400         }
00401         MonitorElement * getOffEtOnOffUMHisto() {
00402           return offEtOnOffUM_;
00403         }
00404         MonitorElement * getOffEtaVsOffPhiOnOffUMHisto() {
00405           return offEtavsoffPhiOnOffUM_;
00406         }
00407         MonitorElement * getNL1McUMHisto() {
00408           return NL1McUM_;
00409         }
00410         MonitorElement * getMcEtL1McUMHisto() {
00411           return mcEtL1McUM_;
00412         }
00413         MonitorElement * getMcEtaVsMcPhiL1McUMHisto() {
00414           return mcEtavsmcPhiL1McUM_;
00415         }
00416 
00417         MonitorElement * getNOffMcUMHisto() {
00418           return NOffMcUM_;
00419         }
00420         MonitorElement * getMcEtOffMcUMHisto() {
00421           return mcEtOffMcUM_;
00422         }
00423         MonitorElement * getMcEtaVsMcPhiOffMcUMHisto() {
00424           return mcEtavsmcPhiOffMcUM_;
00425         }
00426 
00427         MonitorElement * getNOnMcUMHisto() {
00428           return NOnMcUM_;
00429         }
00430         MonitorElement * getMcEtOnMcUMHisto() {
00431           return mcEtOnMcUM_;
00432         }
00433         MonitorElement * getMcEtaVsMcPhiOnMcUMHisto() {
00434           return mcEtavsmcPhiOnMcUM_;
00435         }
00436         MonitorElement * getMcDRL1McHisto() {
00437           return mcDRL1Mc_;
00438         }
00439         MonitorElement * getOffDRL1OffHisto() {
00440           return offDRL1Off_;
00441         }
00442         MonitorElement * getOffDROnOffHisto() {
00443           return offDROnOff_;
00444         }
00445         MonitorElement * getMcDROnMcHisto() {
00446           return mcDROnMc_;
00447         }
00448         MonitorElement * getMcDROffMcHisto() {
00449           return mcDROffMc_;
00450         }
00451         MonitorElement * getL1DROnL1Histo() {
00452           return l1DRL1On_;
00453         }
00454         const std::string getLabel(void ) const {
00455           return filterName_;
00456         }
00457         void setLabel(std::string labelName){
00458           filterName_ = labelName;
00459           return;
00460         }
00461         const std::string getPath(void ) const {
00462           return pathName_;
00463         }
00464         const std::string getl1Path(void ) const {
00465           return l1pathName_;
00466         }
00467         const std::string getDenomPath(void ) const {
00468           return denomPathName_;
00469         }
00470         const std::string getProcess(void ) const {
00471           return processName_;
00472         }
00473         const int getObjectType(void ) const {
00474           return objectType_;
00475         }
00476 
00477         const edm::InputTag getTag(void) const{
00478           edm::InputTag tagName(filterName_,"",processName_);
00479           return tagName;
00480         }
00481         ~PathInfo() {};
00482         PathInfo(std::string denomPathName, std::string pathName, std::string l1pathName, std::string filterName, std::string processName, size_t type, float ptmin, 
00483                  float ptmax):
00484           denomPathName_(denomPathName), pathName_(pathName), l1pathName_(l1pathName), filterName_(filterName), processName_(processName), objectType_(type),
00485           NMc_(0), mcEtMc_(0), mcEtavsmcPhiMc_(0),
00486           NOn_(0), onEtOn_(0), onEtavsonPhiOn_(0),
00487           NOff_(0), offEtOff_(0), offEtavsoffPhiOff_(0),
00488           NL1_(0), l1EtL1_(0), l1Etavsl1PhiL1_(0),
00489           NL1On_(0), l1EtL1On_(0), l1Etavsl1PhiL1On_(0),
00490           NL1Off_(0), offEtL1Off_(0), offEtavsoffPhiL1Off_(0),
00491           NOnOff_(0), offEtOnOff_(0), offEtavsoffPhiOnOff_(0),
00492           NL1Mc_(0), mcEtL1Mc_(0), mcEtavsmcPhiL1Mc_(0),
00493           NOffMc_(0), mcEtOffMc_(0), mcEtavsmcPhiOffMc_(0),
00494           NOnMc_(0), mcEtOnMc_(0), mcEtavsmcPhiOnMc_(0),
00495           NL1OnUM_(0), l1EtL1OnUM_(0), l1Etavsl1PhiL1OnUM_(0),
00496           NL1OffUM_(0), offEtL1OffUM_(0), offEtavsoffPhiL1OffUM_(0),
00497           NOnOffUM_(0), offEtOnOffUM_(0), offEtavsoffPhiOnOffUM_(0),
00498           NL1McUM_(0), mcEtL1McUM_(0), mcEtavsmcPhiL1McUM_(0),
00499           NOffMcUM_(0), mcEtOffMcUM_(0), mcEtavsmcPhiOffMcUM_(0),
00500           NOnMcUM_(0), mcEtOnMcUM_(0), mcEtavsmcPhiOnMcUM_(0),
00501     mcDRL1Mc_(0), mcDROnMc_(0), mcDROffMc_(0), offDRL1Off_(0),
00502     offDROnOff_(0), l1DRL1On_(0),
00503           ptmin_(ptmin), ptmax_(ptmax)
00504           {
00505           };
00506           PathInfo(std::string denomPathName, std::string pathName, std::string l1pathName, std::string filterName, std::string processName, size_t type,
00507                    MonitorElement *NMc,
00508                    MonitorElement *mcEtMc,
00509                    MonitorElement *mcEtavsmcPhiMc,
00510                    MonitorElement *NOn,
00511                    MonitorElement *onEtOn,
00512                    MonitorElement *onEtavsonPhiOn,
00513                    MonitorElement *NOff,
00514                    MonitorElement *offEtOff,
00515                    MonitorElement *offEtavsoffPhiOff,
00516                    MonitorElement *NL1,
00517                    MonitorElement *l1EtL1,
00518                    MonitorElement *l1Etavsl1PhiL1,
00519                    MonitorElement *NL1On,
00520                    MonitorElement *l1EtL1On,
00521                    MonitorElement *l1Etavsl1PhiL1On,
00522                    MonitorElement *NL1Off,
00523                    MonitorElement *offEtL1Off,
00524                    MonitorElement *offEtavsoffPhiL1Off,
00525                    MonitorElement *NOnOff,
00526                    MonitorElement *offEtOnOff,
00527                    MonitorElement *offEtavsoffPhiOnOff,
00528                    MonitorElement *NL1Mc,
00529                    MonitorElement *mcEtL1Mc,
00530                    MonitorElement *mcEtavsmcPhiL1Mc,
00531                    MonitorElement *NOffMc,
00532                    MonitorElement *mcEtOffMc,
00533                    MonitorElement *mcEtavsmcPhiOffMc,
00534                    MonitorElement *NOnMc,
00535                    MonitorElement *mcEtOnMc,
00536                    MonitorElement *mcEtavsmcPhiOnMc,
00537                    MonitorElement *NL1OnUM,
00538                    MonitorElement *l1EtL1OnUM,
00539                    MonitorElement *l1Etavsl1PhiL1OnUM,
00540                    MonitorElement *NL1OffUM,
00541                    MonitorElement *offEtL1OffUM,
00542                    MonitorElement *offEtavsoffPhiL1OffUM,
00543                    MonitorElement *NOnOffUM,
00544                    MonitorElement *offEtOnOffUM,
00545                    MonitorElement *offEtavsoffPhiOnOffUM,
00546                    MonitorElement *NL1McUM,
00547                    MonitorElement *mcEtL1McUM,
00548                    MonitorElement *mcEtavsmcPhiL1McUM,
00549                    MonitorElement *NOffMcUM,
00550                    MonitorElement *mcEtOffMcUM,
00551                    MonitorElement *mcEtavsmcPhiOffMcUM,
00552                    MonitorElement *NOnMcUM,
00553                    MonitorElement *mcEtOnMcUM,
00554                    MonitorElement *mcEtavsmcPhiOnMcUM,
00555        MonitorElement *mcDRL1Mc, 
00556        MonitorElement *mcDROnMc, 
00557        MonitorElement *mcDROffMc, 
00558        MonitorElement *offDRL1Off, 
00559        MonitorElement *offDROnOff, 
00560        MonitorElement *l1DRL1On,
00561                    float ptmin, float ptmax
00562                    ):
00563             denomPathName_(denomPathName), pathName_(pathName), l1pathName_(l1pathName), filterName_(filterName), processName_(processName), objectType_(type),
00564             NMc_(NMc), mcEtMc_(mcEtMc), mcEtavsmcPhiMc_(mcEtavsmcPhiMc),
00565             NOn_(NOn), onEtOn_(onEtOn), onEtavsonPhiOn_(onEtavsonPhiOn),
00566             NOff_(NOff), offEtOff_(offEtOff), offEtavsoffPhiOff_(offEtavsoffPhiOff),
00567             NL1_(NL1), l1EtL1_(l1EtL1), l1Etavsl1PhiL1_(l1Etavsl1PhiL1),
00568             NL1On_(NL1On), l1EtL1On_(l1EtL1On), l1Etavsl1PhiL1On_(l1Etavsl1PhiL1On),
00569             NL1Off_(NL1Off), offEtL1Off_(offEtL1Off), offEtavsoffPhiL1Off_(offEtavsoffPhiL1Off),
00570             NOnOff_(NOnOff), offEtOnOff_(offEtOnOff), offEtavsoffPhiOnOff_(offEtavsoffPhiOnOff),
00571             NL1Mc_(NL1Mc), mcEtL1Mc_(mcEtL1Mc), mcEtavsmcPhiL1Mc_(mcEtavsmcPhiL1Mc),
00572             NOffMc_(NOffMc), mcEtOffMc_(mcEtOffMc), mcEtavsmcPhiOffMc_(mcEtavsmcPhiOffMc),
00573             NOnMc_(NOnMc), mcEtOnMc_(mcEtOnMc), mcEtavsmcPhiOnMc_(mcEtavsmcPhiOnMc),
00574             NL1OnUM_(NL1OnUM), l1EtL1OnUM_(l1EtL1OnUM), l1Etavsl1PhiL1OnUM_(l1Etavsl1PhiL1OnUM),
00575             NL1OffUM_(NL1OffUM), offEtL1OffUM_(offEtL1OffUM), offEtavsoffPhiL1OffUM_(offEtavsoffPhiL1OffUM),
00576             NOnOffUM_(NOnOffUM), offEtOnOffUM_(offEtOnOffUM), offEtavsoffPhiOnOffUM_(offEtavsoffPhiOnOffUM),
00577             NL1McUM_(NL1McUM), mcEtL1McUM_(mcEtL1McUM), mcEtavsmcPhiL1McUM_(mcEtavsmcPhiL1McUM),
00578             NOffMcUM_(NOffMcUM), mcEtOffMcUM_(mcEtOffMcUM), mcEtavsmcPhiOffMcUM_(mcEtavsmcPhiOffMcUM),
00579             NOnMcUM_(NOnMcUM), mcEtOnMcUM_(mcEtOnMcUM), mcEtavsmcPhiOnMcUM_(mcEtavsmcPhiOnMcUM),
00580     mcDRL1Mc_(mcDRL1Mc), 
00581     mcDROnMc_(mcDROnMc), 
00582     mcDROffMc_(mcDROffMc), 
00583     offDRL1Off_(offDRL1Off), 
00584     offDROnOff_(offDROnOff), 
00585     l1DRL1On_(l1DRL1On),
00586             ptmin_(ptmin), ptmax_(ptmax)
00587             {};
00588             bool operator==(const std::string v) 
00589             {
00590               return v==filterName_;
00591             }
00592       private:
00593           int pathIndex_;
00594           std::string denomPathName_;
00595           std::string pathName_;
00596           std::string l1pathName_;
00597           std::string filterName_;
00598           std::string processName_;
00599           int objectType_;
00600 
00601           // we don't own this data
00602           MonitorElement *NMc_, *mcEtMc_, *mcEtavsmcPhiMc_;
00603     MonitorElement *NOn_, *onEtOn_, *onEtavsonPhiOn_;
00604           MonitorElement *NOff_, *offEtOff_, *offEtavsoffPhiOff_;
00605           MonitorElement *NL1_, *l1EtL1_, *l1Etavsl1PhiL1_;
00606           MonitorElement *NL1On_, *l1EtL1On_, *l1Etavsl1PhiL1On_;
00607           MonitorElement *NL1Off_, *offEtL1Off_, *offEtavsoffPhiL1Off_;
00608           MonitorElement *NOnOff_, *offEtOnOff_, *offEtavsoffPhiOnOff_;
00609           MonitorElement *NL1Mc_, *mcEtL1Mc_, *mcEtavsmcPhiL1Mc_;
00610           MonitorElement *NOffMc_, *mcEtOffMc_, *mcEtavsmcPhiOffMc_;
00611           MonitorElement *NOnMc_, *mcEtOnMc_, *mcEtavsmcPhiOnMc_;
00612           MonitorElement *NL1OnUM_, *l1EtL1OnUM_, *l1Etavsl1PhiL1OnUM_;
00613           MonitorElement *NL1OffUM_, *offEtL1OffUM_, *offEtavsoffPhiL1OffUM_;
00614           MonitorElement *NOnOffUM_, *offEtOnOffUM_, *offEtavsoffPhiOnOffUM_;
00615           MonitorElement *NL1McUM_, *mcEtL1McUM_, *mcEtavsmcPhiL1McUM_;
00616           MonitorElement *NOffMcUM_, *mcEtOffMcUM_, *mcEtavsmcPhiOffMcUM_;
00617           MonitorElement *NOnMcUM_, *mcEtOnMcUM_, *mcEtavsmcPhiOnMcUM_;
00618     MonitorElement *mcDRL1Mc_, *mcDROnMc_, *mcDROffMc_,
00619                    *offDRL1Off_, *offDROnOff_, *l1DRL1On_;
00620 
00621           float ptmin_, ptmax_;
00622 
00623           const int index() { 
00624             return pathIndex_;
00625           }
00626           const int type() { 
00627             return objectType_;
00628           }
00629       public:
00630           float getPtMin() const { return ptmin_; }
00631           float getPtMax() const { return ptmax_; }
00632       };
00633 
00634       // simple collection - just 
00635       class PathInfoCollection: public std::vector<PathInfo> {
00636       public:
00637         PathInfoCollection(): std::vector<PathInfo>() 
00638           {};
00639           std::vector<PathInfo>::iterator find(std::string pathName) {
00640             return std::find(begin(), end(), pathName);
00641           }
00642       };
00643       PathInfoCollection hltPaths_;
00644 
00645 
00646 };
00647 
00648 template <class T> 
00649 class objMon {
00650 public:
00651     objMon() { EtaMax_= 2.5; EtMin_=3.0; GenJetsFlag_ = false; BJetsFlag_ = false; }
00652                 void setLimits(float etaMax, float etMin, float drMatch) 
00653                 {
00654                  EtaMax_= etaMax; 
00655                  EtMin_= etMin; 
00656                  DRMatch_= drMatch;
00657                 }
00658                 void setTriggerType(std::vector<int> trigType) { triggerType_ = trigType; }
00659                 void pushTriggerType(int trigType) { triggerType_.push_back(trigType); }
00660                 void setL1TriggerType(std::vector<int> trigType) { l1triggerType_ = trigType; }
00661                 void pushL1TriggerType(int trigType) { l1triggerType_.push_back(trigType); }
00662                 void setPath(FourVectorHLTriggerOffline::PathInfoCollection::iterator v) { v_ = v; }
00663                 void setReco(edm::Handle<T> offColl) { offColl_ = offColl; }
00664                 void setRecoB(edm::Handle<reco::JetTagCollection> offCollB) { offCollB_ = offCollB; }
00665                 void setMC(edm::Handle<reco::GenParticleCollection> genParticles, int pdgId, int status)
00666                 {
00667 
00668       genParticles_ = genParticles;
00669                         pdgId_ = pdgId;
00670                         pdgStatus_ = status;
00671                         
00672                 }
00673 
00674     void fillMC();
00675     void fillOff();
00676                 void monitorL1(const trigger::Vids & idtype, const trigger::Keys & l1k, const trigger::TriggerObjectCollection & toc);
00677     void monitorDenominator(FourVectorHLTriggerOffline::PathInfoCollection::iterator v, bool l1accept, const trigger::Vids & idtype, const trigger::Keys & l1k, const trigger::TriggerObjectCollection& toc);
00678 
00679                 void fillL1OffMatch(FourVectorHLTriggerOffline* fv);
00680                 void fillL1MCMatch(FourVectorHLTriggerOffline* fv);
00681                 void fillL1Match(FourVectorHLTriggerOffline* fv)
00682                 {
00683                   fillL1OffMatch(fv);
00684                   fillL1MCMatch(fv);
00685                 }
00686 
00687                 void monitorOnline(const trigger::Vids & idtype, const trigger::Keys & l1k, trigger::Keys::const_iterator ki, const trigger::TriggerObjectCollection & toc, unsigned int & NOn);
00688     void monitorOffline(FourVectorHLTriggerOffline* fv);
00689                 void fillOnOffMatch(FourVectorHLTriggerOffline* fv);
00690                 void fillOnMCMatch(FourVectorHLTriggerOffline* fv);
00691                 void fillOnL1Match(FourVectorHLTriggerOffline* fv, const trigger::Keys & l1k,  const trigger::TriggerObjectCollection & toc);
00692                 void fillOnlineMatch(FourVectorHLTriggerOffline* fv, const trigger::Keys & l1k,  const trigger::TriggerObjectCollection & toc)
00693                 {
00694 
00695       if(! isTriggerType(v_->getObjectType()) ) return;
00696             fillOnOffMatch(fv);
00697             fillOnMCMatch(fv);
00698             fillOnL1Match(fv, l1k, toc);
00699 
00700           }
00701 
00702     void fillOffMCMatch(FourVectorHLTriggerOffline* fv);
00703                 void fillOffMatch(FourVectorHLTriggerOffline* fv)
00704                 {
00705       if(! isTriggerType(v_->getObjectType()) ) return;
00706                   fillOffMCMatch(fv);
00707                 }
00708                 void clearSets();
00709 
00710                 bool isTriggerType(int t);
00711                 bool isL1TriggerType(int t);
00712     bool hasBPartonInCone(reco::GenJetCollection::const_iterator gjet, float coneSize);
00713 
00714     mmset L1OffDRMatchSet;
00715     mmset L1MCDRMatchSet;
00716     mmset OnOffDRMatchSet;
00717     mmset OnMCDRMatchSet;
00718     mmset OnL1DRMatchSet;
00719     mmset OffMCDRMatchSet;
00720 
00721 
00722                 void setGenJets(bool flag, edm::Handle<reco::GenJetCollection> genJets ) 
00723                 { 
00724                   GenJetsFlag_ = flag;  
00725                         genJets_ = genJets; 
00726                 }
00727                 void setBJetsFlag(bool flag) 
00728                 { 
00729                   BJetsFlag_ = flag; 
00730                 }
00731                 
00732 
00733 private:
00734 
00735                 int   pdgId_;
00736                 int   pdgStatus_;
00737 
00738     float EtaMax_;
00739     float EtMin_;
00740 
00741                 float DRMatch_;
00742 
00743                 bool GenJetsFlag_;
00744                 bool BJetsFlag_;
00745 
00746                 std::vector<int> triggerType_;
00747                 std::vector<int> l1triggerType_;
00748 
00749     edm::Handle<T> offColl_;
00750     edm::Handle<reco::JetTagCollection> offCollB_;
00751 
00752     edm::Handle<reco::GenParticleCollection> genParticles_;
00753     edm::Handle<reco::GenJetCollection> genJets_;
00754     FourVectorHLTriggerOffline::PathInfoCollection::iterator v_;
00755 
00756 };
00757 
00758 template <class T> 
00759 bool objMon<T>::isTriggerType(int t)
00760 {
00761   bool rc = false;
00762 
00763   for(std::vector<int>::const_iterator it = triggerType_.begin(); it != triggerType_.end(); ++it)
00764         {
00765 
00766          if(t == *it) { rc = true; break; }
00767 
00768   } // end for
00769 
00770         return rc;
00771 
00772 }
00773 
00774 
00775 template <class T> 
00776 bool objMon<T>::isL1TriggerType(int t)
00777 {
00778   bool rc = false;
00779 
00780   for(std::vector<int>::const_iterator it = l1triggerType_.begin(); it != l1triggerType_.end(); ++it)
00781         {
00782 
00783          if(t == *it) { rc = true; break; }
00784 
00785   } // end for
00786 
00787         return rc;
00788 
00789 }
00790 
00791 template <class T> 
00792 void objMon<T>::monitorDenominator(FourVectorHLTriggerOffline::PathInfoCollection::iterator v, bool l1accept, const trigger::Vids & idtype, const trigger::Keys & l1k, const trigger::TriggerObjectCollection& toc)
00793 {
00794 
00795         setPath(v);
00796                                 
00797                                 if(! isTriggerType(v_->getObjectType()) ) return;
00798 
00799               fillMC();
00800 
00801               fillOff();
00802 
00803         if (l1accept) monitorL1(idtype, l1k, toc);
00804 
00805 
00806 }
00807 
00808 template <class T> 
00809 void objMon<T>::fillOff()
00810 {
00811 
00812  unsigned int NOff = 0;
00813 
00814  if( offCollB_.isValid()) {
00815   typedef typename reco::JetTagCollection::const_iterator const_iterator;
00816   for( const_iterator iter = offCollB_->begin(), iend = offCollB_->end(); iter != iend; ++iter )
00817   {
00818 
00819           float recoEta = (*iter).first->eta();
00820           float recoPhi = (*iter).first->phi();
00821           float recoPt = (*iter).first->pt();
00822 
00823 
00824     if (fabs(recoEta) <= EtaMax_ && recoPt >=  EtMin_ )
00825     {
00826            
00827              NOff++;
00828        v_->getOffEtOffHisto()->Fill(recoPt);
00829        v_->getOffEtaVsOffPhiOffHisto()->Fill(recoEta, recoPhi);
00830 
00831     }
00832 
00833   }
00834 
00835  }
00836  else if(offColl_.isValid()) {
00837 
00838   typedef typename T::const_iterator const_iterator;
00839   for( const_iterator iter = offColl_->begin(), iend = offColl_->end(); iter != iend; ++iter )
00840   {
00841 
00842 
00843    if (fabs(iter->eta()) <= EtaMax_ && iter->pt() >=  EtMin_ )
00844    {
00845 
00846            NOff++;
00847      v_->getOffEtOffHisto()->Fill(iter->pt());
00848      v_->getOffEtaVsOffPhiOffHisto()->Fill(iter->eta(), iter->phi());
00849 
00850    }
00851 
00852   }
00853 
00854  } // end else if
00855 
00856  v_->getNOffHisto()->Fill(NOff);
00857 
00858 }
00859 
00860 template <class T> 
00861 void objMon<T>::fillMC()
00862 {
00863 
00864  float NMc=0; 
00865 
00866  if(GenJetsFlag_)
00867  {
00868 
00869         if (! genJets_.isValid()) return;
00870 
00871   for(reco::GenJetCollection::const_iterator gjet=genJets_->begin(); gjet!=genJets_->end(); gjet++) {
00872 
00873     if (fabs(gjet->eta()) <= EtaMax_ && gjet->pt() >= EtMin_ ){
00874 
00875        if(BJetsFlag_)
00876        {
00877                                  // this jet must have b in the cone
00878          if(! hasBPartonInCone(gjet,0.7))  continue;
00879 
00880 
00881        }
00882 
00883                          NMc++;
00884        v_->getMcEtMcHisto()->Fill(gjet->pt());
00885        v_->getMcEtaVsMcPhiMcHisto()->Fill(gjet->eta(),gjet->phi());
00886 
00887 
00888     } // end if Eta , Et
00889 
00890   } // end for
00891 
00892 
00893  } // end if GenJetsFlag_
00894  else if( genParticles_.isValid()) {
00895 
00896  for(size_t i = 0; i < genParticles_->size(); ++ i) {
00897 
00898    const reco::GenParticle & p = (*genParticles_)[i];
00899    if (abs(p.pdgId()) == pdgId_ && p.status() == pdgStatus_ && fabs(p.eta()) <= EtaMax_ && p.pt() >= EtMin_ ){
00900     
00901                 NMc++;
00902     v_->getMcEtMcHisto()->Fill(p.pt());
00903     v_->getMcEtaVsMcPhiMcHisto()->Fill(p.eta(),p.phi());
00904 
00905          }
00906 
00907  } // end for
00908 
00909  } // end if
00910 
00911  v_->getNMcHisto()->Fill(NMc);
00912 
00913 }
00914 
00915 template <class T> 
00916 void objMon<T>::monitorL1(const trigger::Vids & idtype, const trigger::Keys & l1k, const trigger::TriggerObjectCollection& toc)
00917 {
00918 
00919  unsigned int NL1=0;
00920  unsigned int NL1McUM=0;
00921  unsigned int NL1OffUM=0;
00922 
00923  trigger::Vids::const_iterator idtypeiter = idtype.begin(); 
00924  for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
00925 
00926          trigger::TriggerObject l1FV = toc[*l1ki];
00927          if(isL1TriggerType(*idtypeiter))
00928          {
00929 
00930                         NL1++;
00931 
00932 
00933       if (fabs(l1FV.eta()) <= EtaMax_ && l1FV.pt() >= EtMin_)
00934       { 
00935 
00936         v_->getL1EtL1Histo()->Fill(l1FV.pt());
00937               v_->getL1EtaVsL1PhiL1Histo()->Fill(l1FV.eta(), l1FV.phi());
00938 
00939             }
00940 
00941       fimmap L1OffDRMatchMap;
00942 
00943             if (offCollB_.isValid()) {
00944 
00945               int j=0;
00946         typedef typename reco::JetTagCollection::const_iterator const_iterator;
00947         for( const_iterator iter = offCollB_->begin(), iend = offCollB_->end(); iter != iend; ++iter )
00948         {
00949 
00950                                   float recoEta = (*iter).first->eta();
00951                                   float recoPhi = (*iter).first->phi();
00952                                   float recoPt = (*iter).first->pt();
00953 
00954           if (fabs(recoEta) <= EtaMax_ && recoPt >=  EtMin_ )
00955           {
00956 
00957                                     // fill UM histos (no matching required)
00958                                     if(NL1 == 1) {
00959 
00960                                                         NL1OffUM++;
00961                     v_->getOffEtL1OffUMHisto()->Fill(recoPt);
00962                     v_->getOffEtaVsOffPhiL1OffUMHisto()->Fill(recoEta,recoPhi);
00963 
00964                                                 }
00965 
00966                                                  // make maps of matched objects
00967                   float dR = reco::deltaR(recoEta,recoPhi,l1FV.eta(),l1FV.phi());
00968                   if ( dR < 1.0)
00969                                                 {
00970 
00971                           L1OffDRMatchMap.insert(std::pair<float,int>(dR,j));
00972 
00973                                                 }
00974 
00975           }
00976 
00977                 j++;
00978 
00979                                 }
00980 
00981                   }
00982             else if (offColl_.isValid()) {
00983 
00984               int j=0;
00985         typedef typename T::const_iterator const_iterator;
00986         for( const_iterator iter = offColl_->begin(), iend = offColl_->end(); iter != iend; ++iter )
00987         {
00988 
00989           if (fabs(iter->eta()) <= EtaMax_ && iter->pt() >=  EtMin_ )
00990           {
00991 
00992                                     // fill UM histos (no matching required)
00993                                     if(NL1 == 1) {
00994 
00995                                                         NL1OffUM++;
00996                     v_->getOffEtL1OffUMHisto()->Fill(iter->pt());
00997                     v_->getOffEtaVsOffPhiL1OffUMHisto()->Fill(iter->eta(),iter->phi());
00998 
00999                                                 }
01000 
01001                                                 // make maps of matched objects
01002                   float dR = reco::deltaR(iter->eta(),iter->phi(),l1FV.eta(),l1FV.phi());
01003                   if ( dR < 1.0) 
01004                                                 {
01005 
01006                          L1OffDRMatchMap.insert(std::pair<float,int>(dR,j));
01007 
01008                                                 }
01009 
01010           }
01011 
01012                 j++;
01013 
01014         }
01015 
01016              }
01017        if(! L1OffDRMatchMap.empty())  L1OffDRMatchSet.insert(L1OffDRMatchMap);
01018 
01019                          // fillL1MCUM
01021 
01022             if (GenJetsFlag_ && genJets_.isValid())
01023                         {
01024 
01025               fimmap L1MCDRMatchMap;
01026               int j=0;
01027 
01028         for(reco::GenJetCollection::const_iterator gjet=genJets_->begin(); gjet!=genJets_->end(); gjet++) {
01029        
01030           if (fabs(gjet->eta()) <= EtaMax_ && gjet->pt() >= EtMin_ ){
01031 
01032                                if (BJetsFlag_) { 
01033                                                   
01034                                                          // this jet must have b in the cone
01035                                                    if(! hasBPartonInCone(gjet,0.7)) {
01036 
01037                                                                  j++;
01038                                                            continue;
01039 
01040                                                          }
01041 
01042                                                  }
01043 
01044                                      // fill UM histos (no matching required)
01045                                      if(NL1 == 1) {
01046 
01047                                                          NL1McUM++;
01048                      v_->getMcEtL1McUMHisto()->Fill(gjet->pt());
01049                      v_->getMcEtaVsMcPhiL1McUMHisto()->Fill(gjet->eta(),gjet->phi());
01050                                                 
01051                                                  }
01052 
01053                                                  // make maps of matched objects
01054                    float dR = reco::deltaR(gjet->eta(),gjet->phi(),l1FV.eta(),l1FV.phi());
01055                    if ( dR < 1.0) 
01056                                                  {
01057 
01058                           L1MCDRMatchMap.insert(std::pair<float,int>(dR,j));
01059 
01060                                                  }
01061 
01062        
01063           } // end if eta, Et
01064 
01065                 j++;
01066        
01067         } // end for genJets
01068 
01069         if(! L1MCDRMatchMap.empty()) { 
01070                                 L1MCDRMatchSet.insert(L1MCDRMatchMap);
01071                                 }
01072 
01073             } // end if genJets
01074             else if ( ! GenJetsFlag_ && genParticles_.isValid())
01075                         {
01076 
01077               fimmap L1MCDRMatchMap;
01078         for(size_t i = 0; i < genParticles_->size(); ++ i) 
01079                                 {
01080 
01081            const reco::GenParticle & p = (*genParticles_)[i];
01082            if (abs(p.pdgId()) == pdgId_ && p.status() == pdgStatus_ && fabs(p.eta()) <= EtaMax_ && p.pt() >= EtMin_)
01083                                          { 
01084 
01085                                      // fill UM histos (no matching required)
01086                                      if(NL1 == 1) {
01087 
01088                                                          NL1McUM++;
01089                      v_->getMcEtL1McUMHisto()->Fill(p.pt());
01090                      v_->getMcEtaVsMcPhiL1McUMHisto()->Fill(p.eta(),p.phi());
01091 
01092                                                  }
01093 
01094                                                  // make maps of matched objects
01095                    float dR = reco::deltaR(p.eta(),p.phi(),l1FV.eta(),l1FV.phi());
01096                    if ( dR < 1.0) 
01097                                                  {
01098 
01099                           L1MCDRMatchMap.insert(std::pair<float,int>(dR,i));
01100 
01101                                                  }
01102 
01103                  } // end if pdg, status, eta, pt
01104         } // end for
01105 
01106         if(! L1MCDRMatchMap.empty()) { 
01107                                 L1MCDRMatchSet.insert(L1MCDRMatchMap);
01108                                 }
01109 
01110             } // end if genParticle_
01111 
01112            } // end if isL1TriggerType
01113      ++idtypeiter;
01114 
01115  } // end for l1ki
01116 
01117  v_->getNL1Histo()->Fill(NL1);
01118  v_->getNL1OffUMHisto()->Fill(NL1OffUM);
01119  v_->getNL1McUMHisto()->Fill(NL1McUM);
01120 
01121 }
01122 
01123 template <class T> 
01124 void objMon<T>::monitorOnline(const trigger::Vids & idtype, const trigger::Keys & l1k, trigger::Keys::const_iterator ki, const trigger::TriggerObjectCollection & toc, unsigned int & NOn)
01125 {
01126 
01127 
01128                  unsigned int NOnOffUM=0;
01129                  unsigned int NOnMcUM=0;
01130                  unsigned int NOnL1UM=0;
01131 
01132                  if(! isTriggerType(v_->getObjectType()) ) return;
01133 
01134                  trigger::TriggerObject onlineFV = toc[*ki];
01135 
01136            NOn++;    
01137 
01138      if (fabs(onlineFV.eta()) <= EtaMax_ && onlineFV.pt() >= EtMin_)
01139      { 
01140 
01141        v_->getOnEtOnHisto()->Fill(onlineFV.pt());
01142              v_->getOnEtaVsOnPhiOnHisto()->Fill(onlineFV.eta(), onlineFV.phi());
01143 
01144            }
01145 
01146 
01147      fimmap OnOffDRMatchMap;
01148 
01149            if (offCollB_.isValid()) {
01150 
01151               int j=0;
01152         typedef typename reco::JetTagCollection::const_iterator const_iterator;
01153         for( const_iterator iter = offCollB_->begin(), iend = offCollB_->end(); iter != iend; ++iter )
01154         {
01155 
01156                                   float recoEta = (*iter).first->eta();
01157                                   float recoPhi = (*iter).first->phi();
01158                                   float recoPt = (*iter).first->pt();
01159 
01160           if (fabs(recoEta) <= EtaMax_ && recoPt >=  EtMin_ )
01161           {
01162 
01163                                     // fill UM histos (no matching required)
01164                                     if(NOn == 1) {
01165 
01166                                                         NOnOffUM++;
01167                     v_->getOffEtOnOffUMHisto()->Fill(recoPt);
01168                     v_->getOffEtaVsOffPhiOnOffUMHisto()->Fill(recoEta,recoPhi);
01169 
01170                                                 }
01171 
01172                                                  // make maps of matched objects
01173                   float dR = reco::deltaR(recoEta,recoPhi,onlineFV.eta(),onlineFV.phi());
01174                   if ( dR < 1.0)
01175                                                 {
01176 
01177                           OnOffDRMatchMap.insert(std::pair<float,int>(dR,j));
01178 
01179                                                 }
01180 
01181           }
01182 
01183                 j++;
01184 
01185                                 }
01186 
01187                   }
01188             else if (offColl_.isValid()) {
01189 
01190               int j=0;
01191 
01192         typedef typename T::const_iterator const_iterator;
01193         for( const_iterator iter = offColl_->begin(), iend = offColl_->end(); iter != iend; ++iter )
01194         {
01195 
01196           if (fabs(iter->eta()) <= EtaMax_ && iter->pt() >=  EtMin_ )
01197           {
01198 
01199                                     // fill UM histos (no matching required)
01200                                     if(NOn == 1) {
01201 
01202                                                         NOnOffUM++;
01203                     v_->getOffEtOnOffUMHisto()->Fill(iter->pt());
01204                     v_->getOffEtaVsOffPhiOnOffUMHisto()->Fill(iter->eta(),iter->phi());
01205 
01206                                                 }
01207 
01208                                                  // make maps of matched objects
01209                   float dR = reco::deltaR(iter->eta(),iter->phi(),onlineFV.eta(),onlineFV.phi());
01210                   if ( dR < 1.0)
01211                                                 {
01212 
01213                           OnOffDRMatchMap.insert(std::pair<float,int>(dR,j));
01214 
01215                                                 }
01216 
01217           }
01218 
01219                 j++;
01220 
01221 
01222         }
01223 
01224              }
01225 
01226        if(! OnOffDRMatchMap.empty())  OnOffDRMatchSet.insert(OnOffDRMatchMap);
01227 
01228 
01229 
01230        fimmap OnL1DRMatchMap;
01231              int j=0;
01232        trigger::Vids::const_iterator idtypeiter = idtype.begin(); 
01233        for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) 
01234                          {
01235 
01236                            
01237 
01238                if(isL1TriggerType(*idtypeiter))
01239                {
01240 
01241                        trigger::TriggerObject l1FV = toc[*l1ki];
01242 
01243                  if ( fabs(l1FV.eta()) <= EtaMax_ && l1FV.pt() >= EtMin_ )
01244            {
01245 
01246                                       // fill UM histos (no matching required)
01247                                       if(NOn == 1) {
01248 
01249                                                          NOnL1UM++;
01250                      v_->getL1EtL1OnUMHisto()->Fill(l1FV.pt());
01251                      v_->getL1EtaVsL1PhiL1OnUMHisto()->Fill(l1FV.eta(),l1FV.phi());
01252 
01253                                                    }
01254 
01255 
01256                float dR = reco::deltaR(l1FV.eta(),l1FV.phi(),onlineFV.eta(),onlineFV.phi());
01257 
01258                      if ( dR < 1.0) 
01259                                                    {
01260 
01261                        OnL1DRMatchMap.insert(std::pair<float,int>(dR,j));
01262 
01263                                                    }
01264 
01265                                                  } // end if l1FV eta, pt
01266 
01267           } // end if isL1TriggerType
01268 
01269                 ++idtypeiter;
01270                 j++;
01271 
01272             } // end for
01273 
01274       if(! OnL1DRMatchMap.empty()) OnL1DRMatchSet.insert(OnL1DRMatchMap);
01275 
01276                         // fillOnMCUM
01278 
01279             if (GenJetsFlag_ && genJets_.isValid())
01280                         {
01281 
01282               fimmap OnMCDRMatchMap;
01283               int j=0;
01284 
01285         for(reco::GenJetCollection::const_iterator gjet=genJets_->begin(); gjet!=genJets_->end(); gjet++) {
01286        
01287           if (fabs(gjet->eta()) <= EtaMax_ && gjet->pt() >= EtMin_ ){
01288        
01289                                if (BJetsFlag_) { 
01290                                                   
01291                                                          // this jet must have b in the cone
01292                                                    if(! hasBPartonInCone(gjet,0.7)) {
01293                                                          
01294                                                                  j++;
01295                                                            continue;
01296 
01297                                                          }
01298 
01299                                                  }
01300                                      // fill UM histos (no matching required)
01301                                      if(NOn == 1) {
01302 
01303                                                          NOnMcUM++;
01304                      v_->getMcEtOnMcUMHisto()->Fill(gjet->pt());
01305                      v_->getMcEtaVsMcPhiOnMcUMHisto()->Fill(gjet->eta(),gjet->phi());
01306                                                 
01307                                                  }
01308 
01309                                                  // make maps of matched objects
01310                    float dR = reco::deltaR(gjet->eta(),gjet->phi(),onlineFV.eta(),onlineFV.phi());
01311                    if ( dR < 1.0) 
01312                                                  {
01313 
01314                           OnMCDRMatchMap.insert(std::pair<float,int>(dR,j));
01315 
01316                                                  }
01317        
01318           } // end if eta, Et
01319 
01320                 j++;
01321        
01322         } // end for genJets
01323 
01324         if(! OnMCDRMatchMap.empty()) OnMCDRMatchSet.insert(OnMCDRMatchMap);
01325 
01326             } // end if genJets
01327             else if (!GenJetsFlag_ && genParticles_.isValid())
01328                         {
01329 
01330               fimmap OnMCDRMatchMap;
01331         for(size_t i = 0; i < genParticles_->size(); ++ i) 
01332                                 {
01333 
01334            const reco::GenParticle & p = (*genParticles_)[i];
01335            if (abs(p.pdgId()) == pdgId_ && p.status() == pdgStatus_ && fabs(p.eta()) <= EtaMax_ && p.pt() >= EtMin_)
01336                                          { 
01337 
01338                                      // fill UM histos (no matching required)
01339                                      if(NOn == 1) {
01340 
01341                                                          NOnMcUM++;
01342                      v_->getMcEtOnMcUMHisto()->Fill(p.pt());
01343                      v_->getMcEtaVsMcPhiOnMcUMHisto()->Fill(p.eta(),p.phi());
01344 
01345                                                  }
01346 
01347                                                  // make maps of matched objects
01348                    float dR = reco::deltaR(p.eta(),p.phi(),onlineFV.eta(),onlineFV.phi());
01349                    if ( dR < 1.0)
01350                                                  {
01351 
01352                           OnMCDRMatchMap.insert(std::pair<float,int>(dR,i));
01353 
01354                                                  }
01355                  } // end if
01356         } // end for
01357 
01358         if(! OnMCDRMatchMap.empty()) OnMCDRMatchSet.insert(OnMCDRMatchMap);
01359 
01360             } 
01361 
01362                         v_->getNOnHisto()->Fill(NOn);
01363                         v_->getNOnOffUMHisto()->Fill(NOnOffUM);
01364                         v_->getNL1OnUMHisto()->Fill(NOnL1UM);
01365                         v_->getNOnMcUMHisto()->Fill(NOnMcUM);
01366 
01367 }
01368 
01369 template <class T> 
01370 void objMon<T>::monitorOffline(FourVectorHLTriggerOffline* fv)
01371 {
01372 
01373  unsigned int NOff=0;
01374  unsigned int NOffMcUM=0;
01375 
01376  if(! isTriggerType(v_->getObjectType()) ) return;
01377 
01378 
01379  if(offCollB_.isValid()) {
01380 
01381    typedef typename reco::JetTagCollection::const_iterator const_iterator;
01382    for( const_iterator iter = offCollB_->begin(), iend = offCollB_->end(); iter != iend; ++iter )
01383    {
01384 
01385           NOff++;
01386 
01387                 if (GenJetsFlag_ && genJets_.isValid())
01388                       {
01389 
01390              fimmap OffMCDRMatchMap;
01391                    int j=0;
01392 
01393              for(reco::GenJetCollection::const_iterator gjet=genJets_->begin(); gjet!=genJets_->end(); gjet++) {
01394 
01395             
01396                if (fabs(gjet->eta()) <= EtaMax_ && gjet->pt() >= EtMin_ ){
01397 
01398                                    if (BJetsFlag_ &&  hasBPartonInCone(gjet,0.7)) { 
01399                                                                          
01400             
01401                              // fill UM histos (no matching required)
01402                        if(NOff == 1) {
01403 
01404                                                                          NOffMcUM++;
01405                    v_->getMcEtOffMcUMHisto()->Fill(gjet->pt());
01406                    v_->getMcEtaVsMcPhiOffMcUMHisto()->Fill(gjet->eta(),gjet->phi());
01407                                         
01408                                          }
01409 
01410                                          // make maps of matched objects
01411                         float dR = reco::deltaR(gjet->eta(),gjet->phi(),(*iter).first->eta(),(*iter).first->phi());
01412                         if ( dR < 1.0) 
01413                                          {
01414 
01415                                OffMCDRMatchMap.insert(std::pair<float,int>(dR,j));
01416 
01417                                          }
01418 
01419                                                     } // end if BJetsFlag_ and hasBParton
01420             
01421                } // end if eta, Et
01422 
01423                      j++;
01424             
01425              } // end for genJets
01426 
01427              if(! OffMCDRMatchMap.empty()) OffMCDRMatchSet.insert(OffMCDRMatchMap);
01428 
01429                 } // end if genJets
01430 
01431    } // end for offline objects
01432  
01433  } // end if
01434  else if(offColl_.isValid()) {
01435 
01436    typedef typename T::const_iterator const_iterator;
01437    for( const_iterator iter = offColl_->begin(), iend = offColl_->end(); iter != iend; ++iter )
01438    {
01439 
01440                                         NOff++;
01441 
01442                 if (GenJetsFlag_ && genJets_.isValid())
01443                       {
01444 
01445              fimmap OffMCDRMatchMap;
01446                    int j=0;
01447 
01448              for(reco::GenJetCollection::const_iterator gjet=genJets_->begin(); gjet!=genJets_->end(); gjet++) {
01449             
01450                if (fabs(gjet->eta()) <= EtaMax_ && gjet->pt() >= EtMin_ ){
01451             
01452                                    if (BJetsFlag_) { 
01453                                                   
01454                                                              // this jet must have b in the cone
01455                                                        if(! hasBPartonInCone(gjet,0.7)) { 
01456                                                                          
01457                                                                           j++;
01458                                                                           continue;
01459 
01460                                                                          }
01461 
01462                                                      }
01463 
01464                              // fill UM histos (no matching required)
01465                        if(NOff == 1) {
01466 
01467                                                                          NOffMcUM++;
01468                    v_->getMcEtOffMcUMHisto()->Fill(gjet->pt());
01469                    v_->getMcEtaVsMcPhiOffMcUMHisto()->Fill(gjet->eta(),gjet->phi());
01470                                         
01471                                          }
01472 
01473                                          // make maps of matched objects
01474                         float dR = reco::deltaR(gjet->eta(),gjet->phi(),iter->eta(),iter->phi());
01475                         if ( dR < 1.0) 
01476                                          {
01477 
01478                                OffMCDRMatchMap.insert(std::pair<float,int>(dR,j));
01479 
01480                                          }
01481             
01482                } // end if eta, Et
01483 
01484                      j++;
01485             
01486              } // end for genJets
01487 
01488              if(! OffMCDRMatchMap.empty()) OffMCDRMatchSet.insert(OffMCDRMatchMap);
01489 
01490                 } // end if genJets
01491 
01492           else if (!GenJetsFlag_ && genParticles_.isValid())
01493                 {
01494 
01495             fimmap OffMCDRMatchMap;
01496             for(size_t i = 0; i < genParticles_->size(); ++ i) 
01497                  {
01498 
01499                const reco::GenParticle & p = (*genParticles_)[i];
01500                if (abs(p.pdgId()) == pdgId_ && p.status() == pdgStatus_ && fabs(p.eta()) <= EtaMax_ && p.pt() >= EtMin_)
01501                          { 
01502 
01503                       // fill UM histos (no matching required)
01504                       if(NOff == 1) {
01505 
01506                                                                          NOffMcUM++;
01507                    v_->getMcEtOffMcUMHisto()->Fill(p.pt());
01508                    v_->getMcEtaVsMcPhiOffMcUMHisto()->Fill(p.eta(),p.phi());
01509 
01510                                  }
01511 
01512                                  // make maps of matched objects
01513                  float dR = reco::deltaR(p.eta(),p.phi(),iter->eta(),iter->phi());
01514                  if ( dR < 1.0) 
01515                                  {
01516 
01517                   OffMCDRMatchMap.insert(std::pair<float,int>(dR,i));
01518 
01519                                  }
01520 
01521                } // end if pdg, status, eta, pt
01522             } // end for
01523 
01524             if(! OffMCDRMatchMap.empty()) OffMCDRMatchSet.insert(OffMCDRMatchMap);
01525 
01526           } // end if genParticle_
01527 
01528    } // end for offline objects
01529 
01530  } // end else if
01531 
01532  v_->getNOffHisto()->Fill(NOff);
01533  v_->getNOffMcUMHisto()->Fill(NOffMcUM);
01534 
01535 }
01536 
01537 template <class T> 
01538 void objMon<T>::fillL1OffMatch(FourVectorHLTriggerOffline* fv)
01539 {
01540 
01541   float NL1Off=0;
01542 
01543   if(L1OffDRMatchSet.size() > 1) fv->cleanDRMatchSet(L1OffDRMatchSet);
01544 
01545         // clean the set L1-Off
01546         // now fill histos
01547   for ( mmset::iterator setIter = L1OffDRMatchSet.begin( ); setIter != L1OffDRMatchSet.end( ); setIter++ ) 
01548   {
01549 
01550        fimmap tempMap = *setIter;
01551          
01552        fimmap::iterator it = tempMap.begin(); 
01553        int i  = (*it).second ;
01554                          float dR = (*it).first;
01555              v_->getOffDRL1OffHisto()->Fill(dR);
01556 
01557        if (dR > DRMatch_) continue;
01558        if( offCollB_.isValid()) {
01559 
01560          typedef typename reco::JetTagCollection::const_iterator const_iterator;
01561                            const_iterator iter = offCollB_->begin();
01562          for (int count = 0; count < i; count++) iter++;
01563 
01564 
01565                NL1Off++;
01566                v_->getOffEtL1OffHisto()->Fill((*iter).first->pt());
01567                v_->getOffEtaVsOffPhiL1OffHisto()->Fill((*iter).first->eta(),(*iter).first->phi());
01568 
01569 
01570                         }
01571       else if( offColl_.isValid()) {
01572 
01573          typedef typename T::const_iterator const_iterator;
01574                            const_iterator iter = offColl_->begin();
01575          for (int count = 0; count < i; count++) iter++;
01576 
01577 
01578                NL1Off++;
01579                v_->getOffEtL1OffHisto()->Fill(iter->pt());
01580                v_->getOffEtaVsOffPhiL1OffHisto()->Fill(iter->eta(),iter->phi());
01581 
01582                         }
01583 
01584         }
01585 
01586         v_->getNL1OffHisto()->Fill(NL1Off);
01587 
01588 }
01589 
01590 template <class T> 
01591 void objMon<T>::fillL1MCMatch(FourVectorHLTriggerOffline* fv)
01592 {
01593 
01594         unsigned int NL1Mc=0;
01595 
01596   if(GenJetsFlag_)
01597   {
01598   
01599    if (! genJets_.isValid()) return;
01600 
01601          // clean the set L1-MC
01602          if(L1MCDRMatchSet.size() > 1) fv->cleanDRMatchSet(L1MCDRMatchSet);
01603 
01604          float NL1Mc=0;
01605 
01606         // now fill histos
01607   for ( mmset::iterator setIter = L1MCDRMatchSet.begin( ); setIter != L1MCDRMatchSet.end( ); setIter++ ) 
01608   {
01609   
01610        fimmap tempMap = *setIter;
01611          
01612        fimmap::iterator it = tempMap.begin(); 
01613        int i  = (*it).second ;
01614                          float dR = (*it).first;
01615 
01616        v_->getMcDRL1McHisto()->Fill(dR);
01617 
01618        if (dR > DRMatch_) continue;
01619 
01620        reco::GenJetCollection::const_iterator gjet=genJets_->begin(); 
01621        for (int count = 0; count < i; count++) gjet++;
01622   
01623                          NL1Mc++;
01624        v_->getMcEtL1McHisto()->Fill(gjet->pt());
01625        v_->getMcEtaVsMcPhiL1McHisto()->Fill(gjet->eta(),gjet->phi());
01626 
01627   
01628          } // end for set
01629   
01630   } // end if GenJetsFlag_
01631         else if( genParticles_.isValid()) {
01632   
01633         // clean the set L1-MC
01634         if(L1MCDRMatchSet.size() > 1) fv->cleanDRMatchSet(L1MCDRMatchSet);
01635   
01636         // now fill histos
01637     for ( mmset::iterator setIter = L1MCDRMatchSet.begin( ); setIter != L1MCDRMatchSet.end( ); setIter++ ) 
01638     {
01639   
01640        fimmap tempMap = *setIter;
01641          
01642        fimmap::iterator it = tempMap.begin(); 
01643        int i  = (*it).second ;
01644                  float dR = (*it).first;
01645   
01646        v_->getMcDRL1McHisto()->Fill(dR);
01647   
01648        if (dR > DRMatch_) continue;
01649   
01650        const reco::GenParticle & p = (*genParticles_)[i];
01651 
01652            NL1Mc++;
01653            v_->getMcEtL1McHisto()->Fill(p.pt());
01654            v_->getMcEtaVsMcPhiL1McHisto()->Fill(p.eta(),p.phi());
01655   
01656         } // end for
01657 
01658  } // end else if
01659 
01660  v_->getNL1McHisto()->Fill(NL1Mc);
01661 
01662 }
01663 
01664 template <class T> 
01665 void objMon<T>::fillOnOffMatch(FourVectorHLTriggerOffline* fv)
01666 {
01667 
01668   unsigned int NOnOff=0;
01669 
01670         // clean the set L1-Off
01671   if(OnOffDRMatchSet.size() > 1) fv->cleanDRMatchSet(OnOffDRMatchSet);
01672         // now fill histos
01673   for ( mmset::iterator setIter = OnOffDRMatchSet.begin( ); setIter != OnOffDRMatchSet.end( ); setIter++ ) 
01674   {
01675 
01676 
01677        fimmap tempMap = *setIter;
01678          
01679        fimmap::iterator it = tempMap.begin(); 
01680        int i  = (*it).second ;
01681                          float dR = (*it).first;
01682              v_->getOffDROnOffHisto()->Fill(dR);
01683        
01684 
01685        if (dR > DRMatch_) continue;
01686 
01687        if( offCollB_.isValid()) {
01688 
01689 
01690          typedef typename reco::JetTagCollection::const_iterator const_iterator;
01691                            const_iterator iter = offCollB_->begin();
01692          for (int count = 0; count < i; count++) iter++;
01693 
01694 
01695                NOnOff++;
01696                v_->getOffEtOnOffHisto()->Fill((*iter).first->pt());
01697                v_->getOffEtaVsOffPhiOnOffHisto()->Fill((*iter).first->eta(),(*iter).first->phi());
01698 
01699                          }
01700        else if( offColl_.isValid()) {
01701 
01702          typedef typename T::const_iterator const_iterator;
01703                            const_iterator iter = offColl_->begin();
01704          for (int count = 0; count < i; count++) iter++;
01705 
01706                NOnOff++;
01707                v_->getOffEtOnOffHisto()->Fill(iter->pt());
01708                v_->getOffEtaVsOffPhiOnOffHisto()->Fill(iter->eta(),iter->phi());
01709 
01710                          }
01711 
01712         }
01713 
01714         v_->getNOnOffHisto()->Fill(NOnOff);
01715 
01716 }
01717 
01718 template <class T> 
01719 void objMon<T>::fillOnMCMatch(FourVectorHLTriggerOffline* fv)
01720 {
01721 
01722   unsigned int NOnMc=0;
01723 
01724   if(GenJetsFlag_)
01725   {
01726   
01727    if (! genJets_.isValid()) return;
01728 
01729          // clean the set L1-MC
01730          if(OnMCDRMatchSet.size() > 1) fv->cleanDRMatchSet(OnMCDRMatchSet);
01731 
01732         // now fill histos
01733   for ( mmset::iterator setIter = OnMCDRMatchSet.begin( ); setIter != OnMCDRMatchSet.end( ); setIter++ ) 
01734   {
01735   
01736        fimmap tempMap = *setIter;
01737          
01738        fimmap::iterator it = tempMap.begin(); 
01739        int i  = (*it).second ;
01740                          float dR = (*it).first;
01741              v_->getMcDROnMcHisto()->Fill(dR);
01742 
01743        if (dR > DRMatch_) continue;
01744 
01745        reco::GenJetCollection::const_iterator gjet=genJets_->begin(); 
01746        for (int count = 0; count < i; count++) gjet++;
01747   
01748   
01749        NOnMc++; 
01750        v_->getMcEtOnMcHisto()->Fill(gjet->pt());
01751        v_->getMcEtaVsMcPhiOnMcHisto()->Fill(gjet->eta(),gjet->phi());
01752   
01753          } // end for set
01754   
01755   } // end if GenJetsFlag_
01756         else if( genParticles_.isValid()) {
01757 
01758         // clean the set L1-MC
01759         if(OnMCDRMatchSet.size() > 1) fv->cleanDRMatchSet(OnMCDRMatchSet);
01760 
01761         // now fill histos
01762   for ( mmset::iterator setIter = OnMCDRMatchSet.begin( ); setIter != OnMCDRMatchSet.end( ); setIter++ ) 
01763   {
01764 
01765      fimmap tempMap = *setIter;
01766        
01767      fimmap::iterator it = tempMap.begin(); 
01768      int i  = (*it).second ;
01769                  float dR = (*it).first;
01770            v_->getMcDROnMcHisto()->Fill(dR);
01771 
01772      if (dR > DRMatch_) continue;
01773           
01774      const reco::GenParticle & p = (*genParticles_)[i];
01775 
01776            NOnMc++;
01777            v_->getMcEtOnMcHisto()->Fill(p.pt());
01778            v_->getMcEtaVsMcPhiOnMcHisto()->Fill(p.eta(),p.phi());
01779 
01780         }
01781 
01782  }
01783 
01784  v_->getNOnMcHisto()->Fill(NOnMc);
01785 
01786 }
01787 
01788 template <class T> 
01789 void objMon<T>::fillOffMCMatch(FourVectorHLTriggerOffline* fv)
01790 {
01791 
01792   unsigned int NOffMc=0;
01793 
01794   if(GenJetsFlag_)
01795   {
01796   
01797    if (! genJets_.isValid()) return;
01798 
01799          // clean the set L1-MC
01800          if(OffMCDRMatchSet.size() > 1) fv->cleanDRMatchSet(OffMCDRMatchSet);
01801 
01802         // now fill histos
01803   for ( mmset::iterator setIter = OffMCDRMatchSet.begin( ); setIter != OffMCDRMatchSet.end( ); setIter++ ) 
01804   {
01805   
01806        fimmap tempMap = *setIter;
01807          
01808        fimmap::iterator it = tempMap.begin(); 
01809        int i  = (*it).second ;
01810                          float dR = (*it).first;
01811              v_->getMcDROffMcHisto()->Fill(dR);
01812 
01813        if (dR > DRMatch_) continue;
01814 
01815        reco::GenJetCollection::const_iterator gjet=genJets_->begin(); 
01816        for (int count = 0; count < i; count++) gjet++;
01817   
01818        NOffMc++; 
01819        v_->getMcEtOffMcHisto()->Fill(gjet->pt());
01820        v_->getMcEtaVsMcPhiOffMcHisto()->Fill(gjet->eta(),gjet->phi());
01821   
01822          } // end for set
01823 
01824   } // end if GenJetsFlag_
01825         else if( genParticles_.isValid() && offColl_.isValid()) {
01826 
01827         // clean the set L1-MC
01828         if(OffMCDRMatchSet.size() > 1) fv->cleanDRMatchSet(OffMCDRMatchSet);
01829 
01830         // now fill histos
01831   for ( mmset::iterator setIter = OffMCDRMatchSet.begin( ); setIter != OffMCDRMatchSet.end( ); setIter++ ) 
01832   {
01833 
01834      fimmap tempMap = *setIter;
01835        
01836      fimmap::iterator it = tempMap.begin(); 
01837      int i  = (*it).second ;
01838                  float dR = (*it).first;
01839            v_->getMcDROffMcHisto()->Fill(dR);
01840 
01841      if (dR > DRMatch_) continue;
01842           
01843      const reco::GenParticle & p = (*genParticles_)[i];
01844 
01845            NOffMc++;
01846            v_->getMcEtOffMcHisto()->Fill(p.pt());
01847            v_->getMcEtaVsMcPhiOffMcHisto()->Fill(p.eta(),p.phi());
01848 
01849         }
01850 
01851  }
01852 
01853  v_->getNOffMcHisto()->Fill(NOffMc);
01854 
01855 }
01856 
01857 template <class T> 
01858 void objMon<T>::fillOnL1Match(FourVectorHLTriggerOffline* fv, const trigger::Keys & l1k,  const trigger::TriggerObjectCollection & toc)
01859 {
01860 
01861   unsigned int NOnL1=0;
01862 
01863         // clean the set On-L1
01864         if(OnL1DRMatchSet.size() > 1) fv->cleanDRMatchSet(OnL1DRMatchSet);
01865         // now fill histos
01866   for ( mmset::iterator setIter = OnL1DRMatchSet.begin( ); setIter != OnL1DRMatchSet.end( ); setIter++ ) 
01867   {
01868 
01869     fimmap tempMap = *setIter;
01870       
01871     fimmap::iterator it = tempMap.begin(); 
01872     int i  = (*it).second ;
01873                 float dR = (*it).first;
01874           v_->getL1DROnL1Histo()->Fill(dR);
01875 
01876     if (dR > DRMatch_) continue;
01877 
01878     trigger::Keys::const_iterator l1ki = l1k.begin();
01879     for (int count = 0; count < i; count++) l1ki++;
01880 
01881           NOnL1++;
01882           v_->getL1EtL1OnHisto()->Fill(toc[*l1ki].pt());
01883           v_->getL1EtaVsL1PhiL1OnHisto()->Fill(toc[*l1ki].eta(),toc[*l1ki].phi());
01884 
01885         }
01886 
01887   v_->getNL1OnHisto()->Fill(NOnL1);
01888 
01889 }
01890 
01891 template <class T> 
01892 bool objMon<T>::hasBPartonInCone(reco::GenJetCollection::const_iterator gjet, float coneSize)
01893 {
01894 
01895   bool rc = false;
01896   if (! genParticles_.isValid()) return rc;
01897 
01898   for(size_t i = 0; i < genParticles_->size(); ++ i) {
01899         
01900     const reco::GenParticle & p = (*genParticles_)[i];
01901     if (abs(p.pdgId()) == 5){ 
01902 
01903             if (reco::deltaR(p.eta(),p.phi(),gjet->eta(),gjet->phi()) < coneSize){
01904 
01905         rc = true;
01906 
01907             }
01908 
01909                  }
01910 
01911         }
01912   
01913 
01914         return rc;
01915 
01916 }
01917 
01918 template <class T> 
01919 void objMon<T>::clearSets()
01920 {
01921 
01922      L1OffDRMatchSet.clear();
01923      L1MCDRMatchSet.clear();
01924      OnOffDRMatchSet.clear();
01925      OnMCDRMatchSet.clear();
01926      OnL1DRMatchSet.clear();
01927      OffMCDRMatchSet.clear();
01928 
01929 }
01930 
01931 
01932 #endif