CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/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.31 2013/01/07 11:02:43 eulisse 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 public:
00635       typedef std::vector<PathInfo> PathInfoCollection;
00636 private:
00637       PathInfoCollection hltPaths_;
00638 
00639 
00640 };
00641 
00642 template <class T> 
00643 class objMon {
00644 public:
00645     objMon() { EtaMax_= 2.5; EtMin_=3.0; GenJetsFlag_ = false; BJetsFlag_ = false; }
00646                 void setLimits(float etaMax, float etMin, float drMatch) 
00647                 {
00648                  EtaMax_= etaMax; 
00649                  EtMin_= etMin; 
00650                  DRMatch_= drMatch;
00651                 }
00652                 void setTriggerType(std::vector<int> trigType) { triggerType_ = trigType; }
00653                 void pushTriggerType(int trigType) { triggerType_.push_back(trigType); }
00654                 void setL1TriggerType(std::vector<int> trigType) { l1triggerType_ = trigType; }
00655                 void pushL1TriggerType(int trigType) { l1triggerType_.push_back(trigType); }
00656                 void setPath(FourVectorHLTriggerOffline::PathInfoCollection::iterator v) { v_ = v; }
00657                 void setReco(edm::Handle<T> offColl) { offColl_ = offColl; }
00658                 void setRecoB(edm::Handle<reco::JetTagCollection> offCollB) { offCollB_ = offCollB; }
00659                 void setMC(edm::Handle<reco::GenParticleCollection> genParticles, int pdgId, int status)
00660                 {
00661 
00662       genParticles_ = genParticles;
00663                         pdgId_ = pdgId;
00664                         pdgStatus_ = status;
00665                         
00666                 }
00667 
00668     void fillMC();
00669     void fillOff();
00670                 void monitorL1(const trigger::Vids & idtype, const trigger::Keys & l1k, const trigger::TriggerObjectCollection & toc);
00671     void monitorDenominator(FourVectorHLTriggerOffline::PathInfoCollection::iterator v, bool l1accept, const trigger::Vids & idtype, const trigger::Keys & l1k, const trigger::TriggerObjectCollection& toc);
00672 
00673                 void fillL1OffMatch(FourVectorHLTriggerOffline* fv);
00674                 void fillL1MCMatch(FourVectorHLTriggerOffline* fv);
00675                 void fillL1Match(FourVectorHLTriggerOffline* fv)
00676                 {
00677                   fillL1OffMatch(fv);
00678                   fillL1MCMatch(fv);
00679                 }
00680 
00681                 void monitorOnline(const trigger::Vids & idtype, const trigger::Keys & l1k, trigger::Keys::const_iterator ki, const trigger::TriggerObjectCollection & toc, unsigned int & NOn);
00682     void monitorOffline(FourVectorHLTriggerOffline* fv);
00683                 void fillOnOffMatch(FourVectorHLTriggerOffline* fv);
00684                 void fillOnMCMatch(FourVectorHLTriggerOffline* fv);
00685                 void fillOnL1Match(FourVectorHLTriggerOffline* fv, const trigger::Keys & l1k,  const trigger::TriggerObjectCollection & toc);
00686                 void fillOnlineMatch(FourVectorHLTriggerOffline* fv, const trigger::Keys & l1k,  const trigger::TriggerObjectCollection & toc)
00687                 {
00688 
00689       if(! isTriggerType(v_->getObjectType()) ) return;
00690             fillOnOffMatch(fv);
00691             fillOnMCMatch(fv);
00692             fillOnL1Match(fv, l1k, toc);
00693 
00694           }
00695 
00696     void fillOffMCMatch(FourVectorHLTriggerOffline* fv);
00697                 void fillOffMatch(FourVectorHLTriggerOffline* fv)
00698                 {
00699       if(! isTriggerType(v_->getObjectType()) ) return;
00700                   fillOffMCMatch(fv);
00701                 }
00702                 void clearSets();
00703 
00704                 bool isTriggerType(int t);
00705                 bool isL1TriggerType(int t);
00706     bool hasBPartonInCone(reco::GenJetCollection::const_iterator gjet, float coneSize);
00707 
00708     mmset L1OffDRMatchSet;
00709     mmset L1MCDRMatchSet;
00710     mmset OnOffDRMatchSet;
00711     mmset OnMCDRMatchSet;
00712     mmset OnL1DRMatchSet;
00713     mmset OffMCDRMatchSet;
00714 
00715 
00716                 void setGenJets(bool flag, edm::Handle<reco::GenJetCollection> genJets ) 
00717                 { 
00718                   GenJetsFlag_ = flag;  
00719                         genJets_ = genJets; 
00720                 }
00721                 void setBJetsFlag(bool flag) 
00722                 { 
00723                   BJetsFlag_ = flag; 
00724                 }
00725                 
00726 
00727 private:
00728 
00729                 int   pdgId_;
00730                 int   pdgStatus_;
00731 
00732     float EtaMax_;
00733     float EtMin_;
00734 
00735                 float DRMatch_;
00736 
00737                 bool GenJetsFlag_;
00738                 bool BJetsFlag_;
00739 
00740                 std::vector<int> triggerType_;
00741                 std::vector<int> l1triggerType_;
00742 
00743     edm::Handle<T> offColl_;
00744     edm::Handle<reco::JetTagCollection> offCollB_;
00745 
00746     edm::Handle<reco::GenParticleCollection> genParticles_;
00747     edm::Handle<reco::GenJetCollection> genJets_;
00748     FourVectorHLTriggerOffline::PathInfoCollection::iterator v_;
00749 
00750 };
00751 
00752 template <class T> 
00753 bool objMon<T>::isTriggerType(int t)
00754 {
00755   bool rc = false;
00756 
00757   for(std::vector<int>::const_iterator it = triggerType_.begin(); it != triggerType_.end(); ++it)
00758         {
00759 
00760          if(t == *it) { rc = true; break; }
00761 
00762   } // end for
00763 
00764         return rc;
00765 
00766 }
00767 
00768 
00769 template <class T> 
00770 bool objMon<T>::isL1TriggerType(int t)
00771 {
00772   bool rc = false;
00773 
00774   for(std::vector<int>::const_iterator it = l1triggerType_.begin(); it != l1triggerType_.end(); ++it)
00775         {
00776 
00777          if(t == *it) { rc = true; break; }
00778 
00779   } // end for
00780 
00781         return rc;
00782 
00783 }
00784 
00785 template <class T> 
00786 void objMon<T>::monitorDenominator(FourVectorHLTriggerOffline::PathInfoCollection::iterator v, bool l1accept, const trigger::Vids & idtype, const trigger::Keys & l1k, const trigger::TriggerObjectCollection& toc)
00787 {
00788 
00789         setPath(v);
00790                                 
00791                                 if(! isTriggerType(v_->getObjectType()) ) return;
00792 
00793               fillMC();
00794 
00795               fillOff();
00796 
00797         if (l1accept) monitorL1(idtype, l1k, toc);
00798 
00799 
00800 }
00801 
00802 template <class T> 
00803 void objMon<T>::fillOff()
00804 {
00805 
00806  unsigned int NOff = 0;
00807 
00808  if( offCollB_.isValid()) {
00809   typedef typename reco::JetTagCollection::const_iterator const_iterator;
00810   for( const_iterator iter = offCollB_->begin(), iend = offCollB_->end(); iter != iend; ++iter )
00811   {
00812 
00813           float recoEta = (*iter).first->eta();
00814           float recoPhi = (*iter).first->phi();
00815           float recoPt = (*iter).first->pt();
00816 
00817 
00818     if (fabs(recoEta) <= EtaMax_ && recoPt >=  EtMin_ )
00819     {
00820            
00821              NOff++;
00822        v_->getOffEtOffHisto()->Fill(recoPt);
00823        v_->getOffEtaVsOffPhiOffHisto()->Fill(recoEta, recoPhi);
00824 
00825     }
00826 
00827   }
00828 
00829  }
00830  else if(offColl_.isValid()) {
00831 
00832   typedef typename T::const_iterator const_iterator;
00833   for( const_iterator iter = offColl_->begin(), iend = offColl_->end(); iter != iend; ++iter )
00834   {
00835 
00836 
00837    if (fabs(iter->eta()) <= EtaMax_ && iter->pt() >=  EtMin_ )
00838    {
00839 
00840            NOff++;
00841      v_->getOffEtOffHisto()->Fill(iter->pt());
00842      v_->getOffEtaVsOffPhiOffHisto()->Fill(iter->eta(), iter->phi());
00843 
00844    }
00845 
00846   }
00847 
00848  } // end else if
00849 
00850  v_->getNOffHisto()->Fill(NOff);
00851 
00852 }
00853 
00854 template <class T> 
00855 void objMon<T>::fillMC()
00856 {
00857 
00858  float NMc=0; 
00859 
00860  if(GenJetsFlag_)
00861  {
00862 
00863         if (! genJets_.isValid()) return;
00864 
00865   for(reco::GenJetCollection::const_iterator gjet=genJets_->begin(); gjet!=genJets_->end(); gjet++) {
00866 
00867     if (fabs(gjet->eta()) <= EtaMax_ && gjet->pt() >= EtMin_ ){
00868 
00869        if(BJetsFlag_)
00870        {
00871                                  // this jet must have b in the cone
00872          if(! hasBPartonInCone(gjet,0.7))  continue;
00873 
00874 
00875        }
00876 
00877                          NMc++;
00878        v_->getMcEtMcHisto()->Fill(gjet->pt());
00879        v_->getMcEtaVsMcPhiMcHisto()->Fill(gjet->eta(),gjet->phi());
00880 
00881 
00882     } // end if Eta , Et
00883 
00884   } // end for
00885 
00886 
00887  } // end if GenJetsFlag_
00888  else if( genParticles_.isValid()) {
00889 
00890  for(size_t i = 0; i < genParticles_->size(); ++ i) {
00891 
00892    const reco::GenParticle & p = (*genParticles_)[i];
00893    if (abs(p.pdgId()) == pdgId_ && p.status() == pdgStatus_ && fabs(p.eta()) <= EtaMax_ && p.pt() >= EtMin_ ){
00894     
00895                 NMc++;
00896     v_->getMcEtMcHisto()->Fill(p.pt());
00897     v_->getMcEtaVsMcPhiMcHisto()->Fill(p.eta(),p.phi());
00898 
00899          }
00900 
00901  } // end for
00902 
00903  } // end if
00904 
00905  v_->getNMcHisto()->Fill(NMc);
00906 
00907 }
00908 
00909 template <class T> 
00910 void objMon<T>::monitorL1(const trigger::Vids & idtype, const trigger::Keys & l1k, const trigger::TriggerObjectCollection& toc)
00911 {
00912 
00913  unsigned int NL1=0;
00914  unsigned int NL1McUM=0;
00915  unsigned int NL1OffUM=0;
00916 
00917  trigger::Vids::const_iterator idtypeiter = idtype.begin(); 
00918  for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) {
00919 
00920          trigger::TriggerObject l1FV = toc[*l1ki];
00921          if(isL1TriggerType(*idtypeiter))
00922          {
00923 
00924                         NL1++;
00925 
00926 
00927       if (fabs(l1FV.eta()) <= EtaMax_ && l1FV.pt() >= EtMin_)
00928       { 
00929 
00930         v_->getL1EtL1Histo()->Fill(l1FV.pt());
00931               v_->getL1EtaVsL1PhiL1Histo()->Fill(l1FV.eta(), l1FV.phi());
00932 
00933             }
00934 
00935       fimmap L1OffDRMatchMap;
00936 
00937             if (offCollB_.isValid()) {
00938 
00939               int j=0;
00940         typedef typename reco::JetTagCollection::const_iterator const_iterator;
00941         for( const_iterator iter = offCollB_->begin(), iend = offCollB_->end(); iter != iend; ++iter )
00942         {
00943 
00944                                   float recoEta = (*iter).first->eta();
00945                                   float recoPhi = (*iter).first->phi();
00946                                   float recoPt = (*iter).first->pt();
00947 
00948           if (fabs(recoEta) <= EtaMax_ && recoPt >=  EtMin_ )
00949           {
00950 
00951                                     // fill UM histos (no matching required)
00952                                     if(NL1 == 1) {
00953 
00954                                                         NL1OffUM++;
00955                     v_->getOffEtL1OffUMHisto()->Fill(recoPt);
00956                     v_->getOffEtaVsOffPhiL1OffUMHisto()->Fill(recoEta,recoPhi);
00957 
00958                                                 }
00959 
00960                                                  // make maps of matched objects
00961                   float dR = reco::deltaR(recoEta,recoPhi,l1FV.eta(),l1FV.phi());
00962                   if ( dR < 1.0)
00963                                                 {
00964 
00965                           L1OffDRMatchMap.insert(std::pair<float,int>(dR,j));
00966 
00967                                                 }
00968 
00969           }
00970 
00971                 j++;
00972 
00973                                 }
00974 
00975                   }
00976             else if (offColl_.isValid()) {
00977 
00978               int j=0;
00979         typedef typename T::const_iterator const_iterator;
00980         for( const_iterator iter = offColl_->begin(), iend = offColl_->end(); iter != iend; ++iter )
00981         {
00982 
00983           if (fabs(iter->eta()) <= EtaMax_ && iter->pt() >=  EtMin_ )
00984           {
00985 
00986                                     // fill UM histos (no matching required)
00987                                     if(NL1 == 1) {
00988 
00989                                                         NL1OffUM++;
00990                     v_->getOffEtL1OffUMHisto()->Fill(iter->pt());
00991                     v_->getOffEtaVsOffPhiL1OffUMHisto()->Fill(iter->eta(),iter->phi());
00992 
00993                                                 }
00994 
00995                                                 // make maps of matched objects
00996                   float dR = reco::deltaR(iter->eta(),iter->phi(),l1FV.eta(),l1FV.phi());
00997                   if ( dR < 1.0) 
00998                                                 {
00999 
01000                          L1OffDRMatchMap.insert(std::pair<float,int>(dR,j));
01001 
01002                                                 }
01003 
01004           }
01005 
01006                 j++;
01007 
01008         }
01009 
01010              }
01011        if(! L1OffDRMatchMap.empty())  L1OffDRMatchSet.insert(L1OffDRMatchMap);
01012 
01013                          // fillL1MCUM
01015 
01016             if (GenJetsFlag_ && genJets_.isValid())
01017                         {
01018 
01019               fimmap L1MCDRMatchMap;
01020               int j=0;
01021 
01022         for(reco::GenJetCollection::const_iterator gjet=genJets_->begin(); gjet!=genJets_->end(); gjet++) {
01023        
01024           if (fabs(gjet->eta()) <= EtaMax_ && gjet->pt() >= EtMin_ ){
01025 
01026                                if (BJetsFlag_) { 
01027                                                   
01028                                                          // this jet must have b in the cone
01029                                                    if(! hasBPartonInCone(gjet,0.7)) {
01030 
01031                                                                  j++;
01032                                                            continue;
01033 
01034                                                          }
01035 
01036                                                  }
01037 
01038                                      // fill UM histos (no matching required)
01039                                      if(NL1 == 1) {
01040 
01041                                                          NL1McUM++;
01042                      v_->getMcEtL1McUMHisto()->Fill(gjet->pt());
01043                      v_->getMcEtaVsMcPhiL1McUMHisto()->Fill(gjet->eta(),gjet->phi());
01044                                                 
01045                                                  }
01046 
01047                                                  // make maps of matched objects
01048                    float dR = reco::deltaR(gjet->eta(),gjet->phi(),l1FV.eta(),l1FV.phi());
01049                    if ( dR < 1.0) 
01050                                                  {
01051 
01052                           L1MCDRMatchMap.insert(std::pair<float,int>(dR,j));
01053 
01054                                                  }
01055 
01056        
01057           } // end if eta, Et
01058 
01059                 j++;
01060        
01061         } // end for genJets
01062 
01063         if(! L1MCDRMatchMap.empty()) { 
01064                                 L1MCDRMatchSet.insert(L1MCDRMatchMap);
01065                                 }
01066 
01067             } // end if genJets
01068             else if ( ! GenJetsFlag_ && genParticles_.isValid())
01069                         {
01070 
01071               fimmap L1MCDRMatchMap;
01072         for(size_t i = 0; i < genParticles_->size(); ++ i) 
01073                                 {
01074 
01075            const reco::GenParticle & p = (*genParticles_)[i];
01076            if (abs(p.pdgId()) == pdgId_ && p.status() == pdgStatus_ && fabs(p.eta()) <= EtaMax_ && p.pt() >= EtMin_)
01077                                          { 
01078 
01079                                      // fill UM histos (no matching required)
01080                                      if(NL1 == 1) {
01081 
01082                                                          NL1McUM++;
01083                      v_->getMcEtL1McUMHisto()->Fill(p.pt());
01084                      v_->getMcEtaVsMcPhiL1McUMHisto()->Fill(p.eta(),p.phi());
01085 
01086                                                  }
01087 
01088                                                  // make maps of matched objects
01089                    float dR = reco::deltaR(p.eta(),p.phi(),l1FV.eta(),l1FV.phi());
01090                    if ( dR < 1.0) 
01091                                                  {
01092 
01093                           L1MCDRMatchMap.insert(std::pair<float,int>(dR,i));
01094 
01095                                                  }
01096 
01097                  } // end if pdg, status, eta, pt
01098         } // end for
01099 
01100         if(! L1MCDRMatchMap.empty()) { 
01101                                 L1MCDRMatchSet.insert(L1MCDRMatchMap);
01102                                 }
01103 
01104             } // end if genParticle_
01105 
01106            } // end if isL1TriggerType
01107      ++idtypeiter;
01108 
01109  } // end for l1ki
01110 
01111  v_->getNL1Histo()->Fill(NL1);
01112  v_->getNL1OffUMHisto()->Fill(NL1OffUM);
01113  v_->getNL1McUMHisto()->Fill(NL1McUM);
01114 
01115 }
01116 
01117 template <class T> 
01118 void objMon<T>::monitorOnline(const trigger::Vids & idtype, const trigger::Keys & l1k, trigger::Keys::const_iterator ki, const trigger::TriggerObjectCollection & toc, unsigned int & NOn)
01119 {
01120 
01121 
01122                  unsigned int NOnOffUM=0;
01123                  unsigned int NOnMcUM=0;
01124                  unsigned int NOnL1UM=0;
01125 
01126                  if(! isTriggerType(v_->getObjectType()) ) return;
01127 
01128                  trigger::TriggerObject onlineFV = toc[*ki];
01129 
01130            NOn++;    
01131 
01132      if (fabs(onlineFV.eta()) <= EtaMax_ && onlineFV.pt() >= EtMin_)
01133      { 
01134 
01135        v_->getOnEtOnHisto()->Fill(onlineFV.pt());
01136              v_->getOnEtaVsOnPhiOnHisto()->Fill(onlineFV.eta(), onlineFV.phi());
01137 
01138            }
01139 
01140 
01141      fimmap OnOffDRMatchMap;
01142 
01143            if (offCollB_.isValid()) {
01144 
01145               int j=0;
01146         typedef typename reco::JetTagCollection::const_iterator const_iterator;
01147         for( const_iterator iter = offCollB_->begin(), iend = offCollB_->end(); iter != iend; ++iter )
01148         {
01149 
01150                                   float recoEta = (*iter).first->eta();
01151                                   float recoPhi = (*iter).first->phi();
01152                                   float recoPt = (*iter).first->pt();
01153 
01154           if (fabs(recoEta) <= EtaMax_ && recoPt >=  EtMin_ )
01155           {
01156 
01157                                     // fill UM histos (no matching required)
01158                                     if(NOn == 1) {
01159 
01160                                                         NOnOffUM++;
01161                     v_->getOffEtOnOffUMHisto()->Fill(recoPt);
01162                     v_->getOffEtaVsOffPhiOnOffUMHisto()->Fill(recoEta,recoPhi);
01163 
01164                                                 }
01165 
01166                                                  // make maps of matched objects
01167                   float dR = reco::deltaR(recoEta,recoPhi,onlineFV.eta(),onlineFV.phi());
01168                   if ( dR < 1.0)
01169                                                 {
01170 
01171                           OnOffDRMatchMap.insert(std::pair<float,int>(dR,j));
01172 
01173                                                 }
01174 
01175           }
01176 
01177                 j++;
01178 
01179                                 }
01180 
01181                   }
01182             else if (offColl_.isValid()) {
01183 
01184               int j=0;
01185 
01186         typedef typename T::const_iterator const_iterator;
01187         for( const_iterator iter = offColl_->begin(), iend = offColl_->end(); iter != iend; ++iter )
01188         {
01189 
01190           if (fabs(iter->eta()) <= EtaMax_ && iter->pt() >=  EtMin_ )
01191           {
01192 
01193                                     // fill UM histos (no matching required)
01194                                     if(NOn == 1) {
01195 
01196                                                         NOnOffUM++;
01197                     v_->getOffEtOnOffUMHisto()->Fill(iter->pt());
01198                     v_->getOffEtaVsOffPhiOnOffUMHisto()->Fill(iter->eta(),iter->phi());
01199 
01200                                                 }
01201 
01202                                                  // make maps of matched objects
01203                   float dR = reco::deltaR(iter->eta(),iter->phi(),onlineFV.eta(),onlineFV.phi());
01204                   if ( dR < 1.0)
01205                                                 {
01206 
01207                           OnOffDRMatchMap.insert(std::pair<float,int>(dR,j));
01208 
01209                                                 }
01210 
01211           }
01212 
01213                 j++;
01214 
01215 
01216         }
01217 
01218              }
01219 
01220        if(! OnOffDRMatchMap.empty())  OnOffDRMatchSet.insert(OnOffDRMatchMap);
01221 
01222 
01223 
01224        fimmap OnL1DRMatchMap;
01225              int j=0;
01226        trigger::Vids::const_iterator idtypeiter = idtype.begin(); 
01227        for (trigger::Keys::const_iterator l1ki = l1k.begin(); l1ki !=l1k.end(); ++l1ki ) 
01228                          {
01229 
01230                            
01231 
01232                if(isL1TriggerType(*idtypeiter))
01233                {
01234 
01235                        trigger::TriggerObject l1FV = toc[*l1ki];
01236 
01237                  if ( fabs(l1FV.eta()) <= EtaMax_ && l1FV.pt() >= EtMin_ )
01238            {
01239 
01240                                       // fill UM histos (no matching required)
01241                                       if(NOn == 1) {
01242 
01243                                                          NOnL1UM++;
01244                      v_->getL1EtL1OnUMHisto()->Fill(l1FV.pt());
01245                      v_->getL1EtaVsL1PhiL1OnUMHisto()->Fill(l1FV.eta(),l1FV.phi());
01246 
01247                                                    }
01248 
01249 
01250                float dR = reco::deltaR(l1FV.eta(),l1FV.phi(),onlineFV.eta(),onlineFV.phi());
01251 
01252                      if ( dR < 1.0) 
01253                                                    {
01254 
01255                        OnL1DRMatchMap.insert(std::pair<float,int>(dR,j));
01256 
01257                                                    }
01258 
01259                                                  } // end if l1FV eta, pt
01260 
01261           } // end if isL1TriggerType
01262 
01263                 ++idtypeiter;
01264                 j++;
01265 
01266             } // end for
01267 
01268       if(! OnL1DRMatchMap.empty()) OnL1DRMatchSet.insert(OnL1DRMatchMap);
01269 
01270                         // fillOnMCUM
01272 
01273             if (GenJetsFlag_ && genJets_.isValid())
01274                         {
01275 
01276               fimmap OnMCDRMatchMap;
01277               int j=0;
01278 
01279         for(reco::GenJetCollection::const_iterator gjet=genJets_->begin(); gjet!=genJets_->end(); gjet++) {
01280        
01281           if (fabs(gjet->eta()) <= EtaMax_ && gjet->pt() >= EtMin_ ){
01282        
01283                                if (BJetsFlag_) { 
01284                                                   
01285                                                          // this jet must have b in the cone
01286                                                    if(! hasBPartonInCone(gjet,0.7)) {
01287                                                          
01288                                                                  j++;
01289                                                            continue;
01290 
01291                                                          }
01292 
01293                                                  }
01294                                      // fill UM histos (no matching required)
01295                                      if(NOn == 1) {
01296 
01297                                                          NOnMcUM++;
01298                      v_->getMcEtOnMcUMHisto()->Fill(gjet->pt());
01299                      v_->getMcEtaVsMcPhiOnMcUMHisto()->Fill(gjet->eta(),gjet->phi());
01300                                                 
01301                                                  }
01302 
01303                                                  // make maps of matched objects
01304                    float dR = reco::deltaR(gjet->eta(),gjet->phi(),onlineFV.eta(),onlineFV.phi());
01305                    if ( dR < 1.0) 
01306                                                  {
01307 
01308                           OnMCDRMatchMap.insert(std::pair<float,int>(dR,j));
01309 
01310                                                  }
01311        
01312           } // end if eta, Et
01313 
01314                 j++;
01315        
01316         } // end for genJets
01317 
01318         if(! OnMCDRMatchMap.empty()) OnMCDRMatchSet.insert(OnMCDRMatchMap);
01319 
01320             } // end if genJets
01321             else if (!GenJetsFlag_ && genParticles_.isValid())
01322                         {
01323 
01324               fimmap OnMCDRMatchMap;
01325         for(size_t i = 0; i < genParticles_->size(); ++ i) 
01326                                 {
01327 
01328            const reco::GenParticle & p = (*genParticles_)[i];
01329            if (abs(p.pdgId()) == pdgId_ && p.status() == pdgStatus_ && fabs(p.eta()) <= EtaMax_ && p.pt() >= EtMin_)
01330                                          { 
01331 
01332                                      // fill UM histos (no matching required)
01333                                      if(NOn == 1) {
01334 
01335                                                          NOnMcUM++;
01336                      v_->getMcEtOnMcUMHisto()->Fill(p.pt());
01337                      v_->getMcEtaVsMcPhiOnMcUMHisto()->Fill(p.eta(),p.phi());
01338 
01339                                                  }
01340 
01341                                                  // make maps of matched objects
01342                    float dR = reco::deltaR(p.eta(),p.phi(),onlineFV.eta(),onlineFV.phi());
01343                    if ( dR < 1.0)
01344                                                  {
01345 
01346                           OnMCDRMatchMap.insert(std::pair<float,int>(dR,i));
01347 
01348                                                  }
01349                  } // end if
01350         } // end for
01351 
01352         if(! OnMCDRMatchMap.empty()) OnMCDRMatchSet.insert(OnMCDRMatchMap);
01353 
01354             } 
01355 
01356                         v_->getNOnHisto()->Fill(NOn);
01357                         v_->getNOnOffUMHisto()->Fill(NOnOffUM);
01358                         v_->getNL1OnUMHisto()->Fill(NOnL1UM);
01359                         v_->getNOnMcUMHisto()->Fill(NOnMcUM);
01360 
01361 }
01362 
01363 template <class T> 
01364 void objMon<T>::monitorOffline(FourVectorHLTriggerOffline* fv)
01365 {
01366 
01367  unsigned int NOff=0;
01368  unsigned int NOffMcUM=0;
01369 
01370  if(! isTriggerType(v_->getObjectType()) ) return;
01371 
01372 
01373  if(offCollB_.isValid()) {
01374 
01375    typedef typename reco::JetTagCollection::const_iterator const_iterator;
01376    for( const_iterator iter = offCollB_->begin(), iend = offCollB_->end(); iter != iend; ++iter )
01377    {
01378 
01379           NOff++;
01380 
01381                 if (GenJetsFlag_ && genJets_.isValid())
01382                       {
01383 
01384              fimmap OffMCDRMatchMap;
01385                    int j=0;
01386 
01387              for(reco::GenJetCollection::const_iterator gjet=genJets_->begin(); gjet!=genJets_->end(); gjet++) {
01388 
01389             
01390                if (fabs(gjet->eta()) <= EtaMax_ && gjet->pt() >= EtMin_ ){
01391 
01392                                    if (BJetsFlag_ &&  hasBPartonInCone(gjet,0.7)) { 
01393                                                                          
01394             
01395                              // fill UM histos (no matching required)
01396                        if(NOff == 1) {
01397 
01398                                                                          NOffMcUM++;
01399                    v_->getMcEtOffMcUMHisto()->Fill(gjet->pt());
01400                    v_->getMcEtaVsMcPhiOffMcUMHisto()->Fill(gjet->eta(),gjet->phi());
01401                                         
01402                                          }
01403 
01404                                          // make maps of matched objects
01405                         float dR = reco::deltaR(gjet->eta(),gjet->phi(),(*iter).first->eta(),(*iter).first->phi());
01406                         if ( dR < 1.0) 
01407                                          {
01408 
01409                                OffMCDRMatchMap.insert(std::pair<float,int>(dR,j));
01410 
01411                                          }
01412 
01413                                                     } // end if BJetsFlag_ and hasBParton
01414             
01415                } // end if eta, Et
01416 
01417                      j++;
01418             
01419              } // end for genJets
01420 
01421              if(! OffMCDRMatchMap.empty()) OffMCDRMatchSet.insert(OffMCDRMatchMap);
01422 
01423                 } // end if genJets
01424 
01425    } // end for offline objects
01426  
01427  } // end if
01428  else if(offColl_.isValid()) {
01429 
01430    typedef typename T::const_iterator const_iterator;
01431    for( const_iterator iter = offColl_->begin(), iend = offColl_->end(); iter != iend; ++iter )
01432    {
01433 
01434                                         NOff++;
01435 
01436                 if (GenJetsFlag_ && genJets_.isValid())
01437                       {
01438 
01439              fimmap OffMCDRMatchMap;
01440                    int j=0;
01441 
01442              for(reco::GenJetCollection::const_iterator gjet=genJets_->begin(); gjet!=genJets_->end(); gjet++) {
01443             
01444                if (fabs(gjet->eta()) <= EtaMax_ && gjet->pt() >= EtMin_ ){
01445             
01446                                    if (BJetsFlag_) { 
01447                                                   
01448                                                              // this jet must have b in the cone
01449                                                        if(! hasBPartonInCone(gjet,0.7)) { 
01450                                                                          
01451                                                                           j++;
01452                                                                           continue;
01453 
01454                                                                          }
01455 
01456                                                      }
01457 
01458                              // fill UM histos (no matching required)
01459                        if(NOff == 1) {
01460 
01461                                                                          NOffMcUM++;
01462                    v_->getMcEtOffMcUMHisto()->Fill(gjet->pt());
01463                    v_->getMcEtaVsMcPhiOffMcUMHisto()->Fill(gjet->eta(),gjet->phi());
01464                                         
01465                                          }
01466 
01467                                          // make maps of matched objects
01468                         float dR = reco::deltaR(gjet->eta(),gjet->phi(),iter->eta(),iter->phi());
01469                         if ( dR < 1.0) 
01470                                          {
01471 
01472                                OffMCDRMatchMap.insert(std::pair<float,int>(dR,j));
01473 
01474                                          }
01475             
01476                } // end if eta, Et
01477 
01478                      j++;
01479             
01480              } // end for genJets
01481 
01482              if(! OffMCDRMatchMap.empty()) OffMCDRMatchSet.insert(OffMCDRMatchMap);
01483 
01484                 } // end if genJets
01485 
01486           else if (!GenJetsFlag_ && genParticles_.isValid())
01487                 {
01488 
01489             fimmap OffMCDRMatchMap;
01490             for(size_t i = 0; i < genParticles_->size(); ++ i) 
01491                  {
01492 
01493                const reco::GenParticle & p = (*genParticles_)[i];
01494                if (abs(p.pdgId()) == pdgId_ && p.status() == pdgStatus_ && fabs(p.eta()) <= EtaMax_ && p.pt() >= EtMin_)
01495                          { 
01496 
01497                       // fill UM histos (no matching required)
01498                       if(NOff == 1) {
01499 
01500                                                                          NOffMcUM++;
01501                    v_->getMcEtOffMcUMHisto()->Fill(p.pt());
01502                    v_->getMcEtaVsMcPhiOffMcUMHisto()->Fill(p.eta(),p.phi());
01503 
01504                                  }
01505 
01506                                  // make maps of matched objects
01507                  float dR = reco::deltaR(p.eta(),p.phi(),iter->eta(),iter->phi());
01508                  if ( dR < 1.0) 
01509                                  {
01510 
01511                   OffMCDRMatchMap.insert(std::pair<float,int>(dR,i));
01512 
01513                                  }
01514 
01515                } // end if pdg, status, eta, pt
01516             } // end for
01517 
01518             if(! OffMCDRMatchMap.empty()) OffMCDRMatchSet.insert(OffMCDRMatchMap);
01519 
01520           } // end if genParticle_
01521 
01522    } // end for offline objects
01523 
01524  } // end else if
01525 
01526  v_->getNOffHisto()->Fill(NOff);
01527  v_->getNOffMcUMHisto()->Fill(NOffMcUM);
01528 
01529 }
01530 
01531 template <class T> 
01532 void objMon<T>::fillL1OffMatch(FourVectorHLTriggerOffline* fv)
01533 {
01534 
01535   float NL1Off=0;
01536 
01537   if(L1OffDRMatchSet.size() > 1) fv->cleanDRMatchSet(L1OffDRMatchSet);
01538 
01539         // clean the set L1-Off
01540         // now fill histos
01541   for ( mmset::iterator setIter = L1OffDRMatchSet.begin( ); setIter != L1OffDRMatchSet.end( ); setIter++ ) 
01542   {
01543 
01544        fimmap tempMap = *setIter;
01545          
01546        fimmap::iterator it = tempMap.begin(); 
01547        int i  = (*it).second ;
01548                          float dR = (*it).first;
01549              v_->getOffDRL1OffHisto()->Fill(dR);
01550 
01551        if (dR > DRMatch_) continue;
01552        if( offCollB_.isValid()) {
01553 
01554          typedef typename reco::JetTagCollection::const_iterator const_iterator;
01555                            const_iterator iter = offCollB_->begin();
01556          for (int count = 0; count < i; count++) iter++;
01557 
01558 
01559                NL1Off++;
01560                v_->getOffEtL1OffHisto()->Fill((*iter).first->pt());
01561                v_->getOffEtaVsOffPhiL1OffHisto()->Fill((*iter).first->eta(),(*iter).first->phi());
01562 
01563 
01564                         }
01565       else if( offColl_.isValid()) {
01566 
01567          typedef typename T::const_iterator const_iterator;
01568                            const_iterator iter = offColl_->begin();
01569          for (int count = 0; count < i; count++) iter++;
01570 
01571 
01572                NL1Off++;
01573                v_->getOffEtL1OffHisto()->Fill(iter->pt());
01574                v_->getOffEtaVsOffPhiL1OffHisto()->Fill(iter->eta(),iter->phi());
01575 
01576                         }
01577 
01578         }
01579 
01580         v_->getNL1OffHisto()->Fill(NL1Off);
01581 
01582 }
01583 
01584 template <class T> 
01585 void objMon<T>::fillL1MCMatch(FourVectorHLTriggerOffline* fv)
01586 {
01587 
01588         unsigned int NL1Mc=0;
01589 
01590   if(GenJetsFlag_)
01591   {
01592   
01593    if (! genJets_.isValid()) return;
01594 
01595          // clean the set L1-MC
01596          if(L1MCDRMatchSet.size() > 1) fv->cleanDRMatchSet(L1MCDRMatchSet);
01597 
01598          float NL1Mc=0;
01599 
01600         // now fill histos
01601   for ( mmset::iterator setIter = L1MCDRMatchSet.begin( ); setIter != L1MCDRMatchSet.end( ); setIter++ ) 
01602   {
01603   
01604        fimmap tempMap = *setIter;
01605          
01606        fimmap::iterator it = tempMap.begin(); 
01607        int i  = (*it).second ;
01608                          float dR = (*it).first;
01609 
01610        v_->getMcDRL1McHisto()->Fill(dR);
01611 
01612        if (dR > DRMatch_) continue;
01613 
01614        reco::GenJetCollection::const_iterator gjet=genJets_->begin(); 
01615        for (int count = 0; count < i; count++) gjet++;
01616   
01617                          NL1Mc++;
01618        v_->getMcEtL1McHisto()->Fill(gjet->pt());
01619        v_->getMcEtaVsMcPhiL1McHisto()->Fill(gjet->eta(),gjet->phi());
01620 
01621   
01622          } // end for set
01623   
01624   } // end if GenJetsFlag_
01625         else if( genParticles_.isValid()) {
01626   
01627         // clean the set L1-MC
01628         if(L1MCDRMatchSet.size() > 1) fv->cleanDRMatchSet(L1MCDRMatchSet);
01629   
01630         // now fill histos
01631     for ( mmset::iterator setIter = L1MCDRMatchSet.begin( ); setIter != L1MCDRMatchSet.end( ); setIter++ ) 
01632     {
01633   
01634        fimmap tempMap = *setIter;
01635          
01636        fimmap::iterator it = tempMap.begin(); 
01637        int i  = (*it).second ;
01638                  float dR = (*it).first;
01639   
01640        v_->getMcDRL1McHisto()->Fill(dR);
01641   
01642        if (dR > DRMatch_) continue;
01643   
01644        const reco::GenParticle & p = (*genParticles_)[i];
01645 
01646            NL1Mc++;
01647            v_->getMcEtL1McHisto()->Fill(p.pt());
01648            v_->getMcEtaVsMcPhiL1McHisto()->Fill(p.eta(),p.phi());
01649   
01650         } // end for
01651 
01652  } // end else if
01653 
01654  v_->getNL1McHisto()->Fill(NL1Mc);
01655 
01656 }
01657 
01658 template <class T> 
01659 void objMon<T>::fillOnOffMatch(FourVectorHLTriggerOffline* fv)
01660 {
01661 
01662   unsigned int NOnOff=0;
01663 
01664         // clean the set L1-Off
01665   if(OnOffDRMatchSet.size() > 1) fv->cleanDRMatchSet(OnOffDRMatchSet);
01666         // now fill histos
01667   for ( mmset::iterator setIter = OnOffDRMatchSet.begin( ); setIter != OnOffDRMatchSet.end( ); setIter++ ) 
01668   {
01669 
01670 
01671        fimmap tempMap = *setIter;
01672          
01673        fimmap::iterator it = tempMap.begin(); 
01674        int i  = (*it).second ;
01675                          float dR = (*it).first;
01676              v_->getOffDROnOffHisto()->Fill(dR);
01677        
01678 
01679        if (dR > DRMatch_) continue;
01680 
01681        if( offCollB_.isValid()) {
01682 
01683 
01684          typedef typename reco::JetTagCollection::const_iterator const_iterator;
01685                            const_iterator iter = offCollB_->begin();
01686          for (int count = 0; count < i; count++) iter++;
01687 
01688 
01689                NOnOff++;
01690                v_->getOffEtOnOffHisto()->Fill((*iter).first->pt());
01691                v_->getOffEtaVsOffPhiOnOffHisto()->Fill((*iter).first->eta(),(*iter).first->phi());
01692 
01693                          }
01694        else if( offColl_.isValid()) {
01695 
01696          typedef typename T::const_iterator const_iterator;
01697                            const_iterator iter = offColl_->begin();
01698          for (int count = 0; count < i; count++) iter++;
01699 
01700                NOnOff++;
01701                v_->getOffEtOnOffHisto()->Fill(iter->pt());
01702                v_->getOffEtaVsOffPhiOnOffHisto()->Fill(iter->eta(),iter->phi());
01703 
01704                          }
01705 
01706         }
01707 
01708         v_->getNOnOffHisto()->Fill(NOnOff);
01709 
01710 }
01711 
01712 template <class T> 
01713 void objMon<T>::fillOnMCMatch(FourVectorHLTriggerOffline* fv)
01714 {
01715 
01716   unsigned int NOnMc=0;
01717 
01718   if(GenJetsFlag_)
01719   {
01720   
01721    if (! genJets_.isValid()) return;
01722 
01723          // clean the set L1-MC
01724          if(OnMCDRMatchSet.size() > 1) fv->cleanDRMatchSet(OnMCDRMatchSet);
01725 
01726         // now fill histos
01727   for ( mmset::iterator setIter = OnMCDRMatchSet.begin( ); setIter != OnMCDRMatchSet.end( ); setIter++ ) 
01728   {
01729   
01730        fimmap tempMap = *setIter;
01731          
01732        fimmap::iterator it = tempMap.begin(); 
01733        int i  = (*it).second ;
01734                          float dR = (*it).first;
01735              v_->getMcDROnMcHisto()->Fill(dR);
01736 
01737        if (dR > DRMatch_) continue;
01738 
01739        reco::GenJetCollection::const_iterator gjet=genJets_->begin(); 
01740        for (int count = 0; count < i; count++) gjet++;
01741   
01742   
01743        NOnMc++; 
01744        v_->getMcEtOnMcHisto()->Fill(gjet->pt());
01745        v_->getMcEtaVsMcPhiOnMcHisto()->Fill(gjet->eta(),gjet->phi());
01746   
01747          } // end for set
01748   
01749   } // end if GenJetsFlag_
01750         else if( genParticles_.isValid()) {
01751 
01752         // clean the set L1-MC
01753         if(OnMCDRMatchSet.size() > 1) fv->cleanDRMatchSet(OnMCDRMatchSet);
01754 
01755         // now fill histos
01756   for ( mmset::iterator setIter = OnMCDRMatchSet.begin( ); setIter != OnMCDRMatchSet.end( ); setIter++ ) 
01757   {
01758 
01759      fimmap tempMap = *setIter;
01760        
01761      fimmap::iterator it = tempMap.begin(); 
01762      int i  = (*it).second ;
01763                  float dR = (*it).first;
01764            v_->getMcDROnMcHisto()->Fill(dR);
01765 
01766      if (dR > DRMatch_) continue;
01767           
01768      const reco::GenParticle & p = (*genParticles_)[i];
01769 
01770            NOnMc++;
01771            v_->getMcEtOnMcHisto()->Fill(p.pt());
01772            v_->getMcEtaVsMcPhiOnMcHisto()->Fill(p.eta(),p.phi());
01773 
01774         }
01775 
01776  }
01777 
01778  v_->getNOnMcHisto()->Fill(NOnMc);
01779 
01780 }
01781 
01782 template <class T> 
01783 void objMon<T>::fillOffMCMatch(FourVectorHLTriggerOffline* fv)
01784 {
01785 
01786   unsigned int NOffMc=0;
01787 
01788   if(GenJetsFlag_)
01789   {
01790   
01791    if (! genJets_.isValid()) return;
01792 
01793          // clean the set L1-MC
01794          if(OffMCDRMatchSet.size() > 1) fv->cleanDRMatchSet(OffMCDRMatchSet);
01795 
01796         // now fill histos
01797   for ( mmset::iterator setIter = OffMCDRMatchSet.begin( ); setIter != OffMCDRMatchSet.end( ); setIter++ ) 
01798   {
01799   
01800        fimmap tempMap = *setIter;
01801          
01802        fimmap::iterator it = tempMap.begin(); 
01803        int i  = (*it).second ;
01804                          float dR = (*it).first;
01805              v_->getMcDROffMcHisto()->Fill(dR);
01806 
01807        if (dR > DRMatch_) continue;
01808 
01809        reco::GenJetCollection::const_iterator gjet=genJets_->begin(); 
01810        for (int count = 0; count < i; count++) gjet++;
01811   
01812        NOffMc++; 
01813        v_->getMcEtOffMcHisto()->Fill(gjet->pt());
01814        v_->getMcEtaVsMcPhiOffMcHisto()->Fill(gjet->eta(),gjet->phi());
01815   
01816          } // end for set
01817 
01818   } // end if GenJetsFlag_
01819         else if( genParticles_.isValid() && offColl_.isValid()) {
01820 
01821         // clean the set L1-MC
01822         if(OffMCDRMatchSet.size() > 1) fv->cleanDRMatchSet(OffMCDRMatchSet);
01823 
01824         // now fill histos
01825   for ( mmset::iterator setIter = OffMCDRMatchSet.begin( ); setIter != OffMCDRMatchSet.end( ); setIter++ ) 
01826   {
01827 
01828      fimmap tempMap = *setIter;
01829        
01830      fimmap::iterator it = tempMap.begin(); 
01831      int i  = (*it).second ;
01832                  float dR = (*it).first;
01833            v_->getMcDROffMcHisto()->Fill(dR);
01834 
01835      if (dR > DRMatch_) continue;
01836           
01837      const reco::GenParticle & p = (*genParticles_)[i];
01838 
01839            NOffMc++;
01840            v_->getMcEtOffMcHisto()->Fill(p.pt());
01841            v_->getMcEtaVsMcPhiOffMcHisto()->Fill(p.eta(),p.phi());
01842 
01843         }
01844 
01845  }
01846 
01847  v_->getNOffMcHisto()->Fill(NOffMc);
01848 
01849 }
01850 
01851 template <class T> 
01852 void objMon<T>::fillOnL1Match(FourVectorHLTriggerOffline* fv, const trigger::Keys & l1k,  const trigger::TriggerObjectCollection & toc)
01853 {
01854 
01855   unsigned int NOnL1=0;
01856 
01857         // clean the set On-L1
01858         if(OnL1DRMatchSet.size() > 1) fv->cleanDRMatchSet(OnL1DRMatchSet);
01859         // now fill histos
01860   for ( mmset::iterator setIter = OnL1DRMatchSet.begin( ); setIter != OnL1DRMatchSet.end( ); setIter++ ) 
01861   {
01862 
01863     fimmap tempMap = *setIter;
01864       
01865     fimmap::iterator it = tempMap.begin(); 
01866     int i  = (*it).second ;
01867                 float dR = (*it).first;
01868           v_->getL1DROnL1Histo()->Fill(dR);
01869 
01870     if (dR > DRMatch_) continue;
01871 
01872     trigger::Keys::const_iterator l1ki = l1k.begin();
01873     for (int count = 0; count < i; count++) l1ki++;
01874 
01875           NOnL1++;
01876           v_->getL1EtL1OnHisto()->Fill(toc[*l1ki].pt());
01877           v_->getL1EtaVsL1PhiL1OnHisto()->Fill(toc[*l1ki].eta(),toc[*l1ki].phi());
01878 
01879         }
01880 
01881   v_->getNL1OnHisto()->Fill(NOnL1);
01882 
01883 }
01884 
01885 template <class T> 
01886 bool objMon<T>::hasBPartonInCone(reco::GenJetCollection::const_iterator gjet, float coneSize)
01887 {
01888 
01889   bool rc = false;
01890   if (! genParticles_.isValid()) return rc;
01891 
01892   for(size_t i = 0; i < genParticles_->size(); ++ i) {
01893         
01894     const reco::GenParticle & p = (*genParticles_)[i];
01895     if (abs(p.pdgId()) == 5){ 
01896 
01897             if (reco::deltaR(p.eta(),p.phi(),gjet->eta(),gjet->phi()) < coneSize){
01898 
01899         rc = true;
01900 
01901             }
01902 
01903                  }
01904 
01905         }
01906   
01907 
01908         return rc;
01909 
01910 }
01911 
01912 template <class T> 
01913 void objMon<T>::clearSets()
01914 {
01915 
01916      L1OffDRMatchSet.clear();
01917      L1MCDRMatchSet.clear();
01918      OnOffDRMatchSet.clear();
01919      OnMCDRMatchSet.clear();
01920      OnL1DRMatchSet.clear();
01921      OffMCDRMatchSet.clear();
01922 
01923 }
01924 
01925 
01926 #endif