PFIsoReaderDemo

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
#ifndef PFISOREADERDEMO_H
#define PFISOREADERDEMO_H
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
#include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
#include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
#include "CommonTools/UtilAlgos/interface/TFileService.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include <iostream>
#include <string>
#include <map>

#include "TH2F.h"

class PFIsoReaderDemo : public edm::one::EDAnalyzer<edm::one::SharedResources, edm::one::WatchRuns> {
public:
  explicit PFIsoReaderDemo(const edm::ParameterSet&);
  ~PFIsoReaderDemo() override;
  void beginRun(edm::Run const&, edm::EventSetup const&) override;
  void analyze(const edm::Event& iEvent, const edm::EventSetup& c) override;
  void endRun(edm::Run const&, edm::EventSetup const&) override {}

  typedef std::vector<edm::Handle<edm::ValueMap<reco::IsoDeposit> > > IsoDepositMaps;
  typedef std::vector<edm::Handle<edm::ValueMap<double> > > IsoDepositVals;

private:
  bool printPhotons_;
  bool printElectrons_;

  void plotIsoDeposits(const IsoDepositMaps& depmap, const reco::GsfElectronRef& ref, double&, double&, double&);

  //This analyzer produces a file with a tree so we need,
  edm::Service<TFileService> fileservice_;

  edm::InputTag inputTagGsfElectrons_;
  edm::EDGetTokenT<reco::GsfElectronCollection> tokenGsfElectrons_;
  edm::InputTag inputTagPhotons_;
  edm::EDGetTokenT<reco::PhotonCollection> tokenPhotons_;
  //   edm::InputTag inputTagPFCandidateMap_;
  //   std::vector<edm::InputTag> inputTagIsoDepElectrons_;
  std::vector<edm::EDGetTokenT<edm::ValueMap<reco::IsoDeposit> > > tokensIsoDepElectrons_;
  //   std::vector<edm::InputTag> inputTagIsoDepPhotons_;
  std::vector<edm::EDGetTokenT<edm::ValueMap<reco::IsoDeposit> > > tokensIsoDepPhotons_;
  //  std::vector<edm::InputTag> inputTagIsoValElectronsNoPFId_;
  //   std::vector<edm::InputTag> inputTagIsoValElectronsPFId_;
  std::vector<edm::EDGetTokenT<edm::ValueMap<double> > > tokensIsoValElectronsPFId_;
  //   std::vector<edm::InputTag> inputTagIsoValPhotonsPFId_;
  std::vector<edm::EDGetTokenT<edm::ValueMap<double> > > tokensIsoValPhotonsPFId_;

  // Control histos
  TH1F* chargedBarrelElectrons_;
  TH1F* photonBarrelElectrons_;
  TH1F* neutralBarrelElectrons_;

  TH1F* chargedEndcapsElectrons_;
  TH1F* photonEndcapsElectrons_;
  TH1F* neutralEndcapsElectrons_;

  TH1F* sumBarrelElectrons_;
  TH1F* sumEndcapsElectrons_;

  TH1F* chargedBarrelPhotons_;
  TH1F* photonBarrelPhotons_;
  TH1F* neutralBarrelPhotons_;

  TH1F* chargedEndcapsPhotons_;
  TH1F* photonEndcapsPhotons_;
  TH1F* neutralEndcapsPhotons_;

  TH1F* sumBarrelPhotons_;
  TH1F* sumEndcapsPhotons_;
};
#endif