HLTTauRefProducer

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
/*HLTTauRefProducer
  Producer that creates LorentzVector Collections
  from offline reconstructed quantities to be used
  in Offline Trigger DQM etc
*/

#ifndef HLTTauRefProducer_h
#define HLTTauRefProducer_h

#include "FWCore/Common/interface/Provenance.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "DataFormats/Math/interface/LorentzVector.h"
#include "DataFormats/Provenance/interface/ProcessHistoryID.h"
#include "DataFormats/Provenance/interface/ProductProvenance.h"

#include "TLorentzVector.h"
// TAU includes
#include "DataFormats/TauReco/interface/PFTau.h"
#include "DataFormats/TauReco/interface/PFTauDiscriminator.h"
#include "DataFormats/TauReco/interface/TauDiscriminatorContainer.h"

// ELECTRON includes
#include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
#include "DataFormats/EgammaCandidates/interface/Electron.h"
#include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
#include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
#include "DataFormats/TrackReco/interface/Track.h"
// MUON includes
#include "DataFormats/MuonReco/interface/Muon.h"
#include "DataFormats/JetReco/interface/CaloJet.h"
#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
#include "TLorentzVector.h"
#include "DataFormats/Math/interface/deltaR.h"

//Photon Includes
#include "DataFormats/EgammaCandidates/interface/Photon.h"
#include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"

//MET Includes
#include "DataFormats/METReco/interface/CaloMET.h"
#include "DataFormats/METReco/interface/CaloMETCollection.h"

#include <memory>

#include <string>
#include <vector>

typedef std::pair<edm::ProcessHistoryID, std::vector<int>> TauIDConfigCache;

class HLTTauRefProducer : public edm::global::EDProducer<edm::StreamCache<TauIDConfigCache>> {
public:
  explicit HLTTauRefProducer(const edm::ParameterSet&);

  void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override;

  std::unique_ptr<TauIDConfigCache> beginStream(edm::StreamID) const override {
    return std::make_unique<TauIDConfigCache>();
  }

private:
  using LorentzVector = math::XYZTLorentzVectorD;
  using LorentzVectorCollection = std::vector<LorentzVector>;

  edm::EDGetTokenT<reco::PFTauCollection> PFTaus_;
  std::vector<edm::EDGetTokenT<reco::PFTauDiscriminator>> PFTauDis_;
  std::vector<edm::EDGetTokenT<reco::TauDiscriminatorContainer>> PFTauDisCont_;
  std::vector<std::string> PFTauDisContWPs_;
  edm::ProcessHistoryID phID_;
  bool doPFTaus_;
  double ptMinPFTau_, etaMinPFTau_, etaMaxPFTau_, phiMinPFTau_, phiMaxPFTau_;

  edm::EDGetTokenT<reco::GsfElectronCollection> Electrons_;
  bool doElectrons_;
  edm::EDGetTokenT<reco::TrackCollection> e_ctfTrackCollection_;
  edm::InputTag e_ctfTrackCollectionSrc_;
  double ptMinElectron_;
  bool e_doID_;
  bool e_doTrackIso_;
  double e_trackMinPt_;
  double e_lipCut_;
  double e_minIsoDR_;
  double e_maxIsoDR_;
  double e_isoMaxSumPt_;
  bool doElecFromZ_;
  double e_zMmin_;
  double e_zMmax_;
  double e_FromZet_;

  edm::EDGetTokenT<reco::PhotonCollection> Photons_;
  bool doPhotons_;
  double photonEcalIso_;
  double ptMinPhoton_;

  edm::EDGetTokenT<reco::MuonCollection> Muons_;
  bool doMuons_;
  double ptMinMuon_;

  edm::EDGetTokenT<reco::CaloJetCollection> Jets_;
  bool doJets_;
  double ptMinJet_;

  edm::EDGetTokenT<CaloTowerCollection> Towers_;
  bool doTowers_;
  double ptMinTower_;
  double towerIsol_;

  edm::EDGetTokenT<reco::CaloMETCollection> MET_;
  bool doMET_;
  double ptMinMET_;

  double etaMin_, etaMax_, phiMin_, phiMax_;

  void doPFTaus(edm::StreamID, edm::Event&) const;
  void doMuons(edm::Event&) const;
  void doElectrons(edm::Event&) const;
  void doJets(edm::Event&) const;
  void doPhotons(edm::Event&) const;
  void doTowers(edm::Event&) const;
  void doMET(edm::Event&) const;
};

#endif