CMS 3D CMS Logo

Public Member Functions | Private Types | Private Attributes

RecoTauPlotDiscriminator Class Reference

Inheritance diagram for RecoTauPlotDiscriminator:
edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &es)
 RecoTauPlotDiscriminator (const edm::ParameterSet &pset)
virtual ~RecoTauPlotDiscriminator ()

Private Types

typedef std::map< std::string,
HistoMap
DiscMap
typedef std::map< std::string,
TH1 * > 
HistoMap
typedef std::vector
< edm::InputTag
VInputTag

Private Attributes

VInputTag discs_
DiscMap histos_
edm::InputTag src_

Detailed Description

Definition at line 30 of file RecoTauPlotDiscriminator.cc.


Member Typedef Documentation

typedef std::map<std::string, HistoMap> RecoTauPlotDiscriminator::DiscMap [private]

Definition at line 38 of file RecoTauPlotDiscriminator.cc.

typedef std::map<std::string, TH1*> RecoTauPlotDiscriminator::HistoMap [private]

Definition at line 37 of file RecoTauPlotDiscriminator.cc.

typedef std::vector<edm::InputTag> RecoTauPlotDiscriminator::VInputTag [private]

Definition at line 39 of file RecoTauPlotDiscriminator.cc.


Constructor & Destructor Documentation

RecoTauPlotDiscriminator::RecoTauPlotDiscriminator ( const edm::ParameterSet pset)

Definition at line 44 of file RecoTauPlotDiscriminator.cc.

References discs_, edm::ParameterSet::getParameter(), histos_, edm::InputTag::label(), max(), min, RecoTauCommonJetSelections_cfi::nbins, and GlobalPosition_Frontier_DevDB_cff::tag.

  :src_(pset.getParameter<edm::InputTag>("src")) {
  uint32_t nbins = pset.getParameter<uint32_t>("nbins");
  double min = pset.getParameter<double>("min");
  double max = pset.getParameter<double>("max");
  edm::Service<TFileService> fs;
  // Get the discriminators
  discs_ = pset.getParameter<std::vector<edm::InputTag> >("discriminators");

  BOOST_FOREACH(const edm::InputTag &tag, discs_) {
    HistoMap discMap;
    discMap["plain"] =
        fs->make<TH1F>(tag.label().c_str(), tag.label().c_str(),
                       nbins, min, max);

    // Make correlation plots w.r.t tau pt
    std::string vs_pt_name = tag.label()+"_pt";
    discMap["vs_pt"] =
        fs->make<TH2F>(vs_pt_name.c_str(), vs_pt_name.c_str(),
                       nbins, min, max, 100, 0, 100);

    // W.r.t. jet pt
    std::string vs_jetpt_name = tag.label()+"_jetPt";
    discMap["vs_jetPt"] =
        fs->make<TH2F>(vs_jetpt_name.c_str(), vs_jetpt_name.c_str(),
                       nbins, min, max, 100, 0, 100);

    // W.r.t. embedded pt in alternat lorentz vector (used to hold gen tau pt)
    std::string vs_embedpt_name = tag.label()+"_embedPt";
    discMap["vs_embedPt"] =
        fs->make<TH2F>(vs_embedpt_name.c_str(), vs_embedpt_name.c_str(),
                       nbins, min, max, 100, 0, 100);

    // 3D histogram with tau pt & jet pt
    std::string vs_pt_jetPt_name = tag.label()+"_pt_jetPt";
    discMap["vs_pt_jetPt"] =
        fs->make<TH3F>(vs_pt_jetPt_name.c_str(), vs_pt_jetPt_name.c_str(),
                       nbins, min, max, 100, 0, 100, 100, 0, 100);

    std::string vs_pt_embedPt_name = tag.label()+"_pt_embedPt";
    discMap["vs_pt_embedPt"] =
        fs->make<TH3F>(vs_pt_embedPt_name.c_str(), vs_pt_embedPt_name.c_str(),
                       nbins, min, max, 100, 0, 100, 100, 0, 100);


    std::string vs_eta_name = tag.label()+"_eta";
    discMap["vs_eta"] =
        fs->make<TH2F>(vs_eta_name.c_str(), vs_eta_name.c_str(),
                       nbins, min, max, 100, -2.5, 2.5);

    std::string vs_dm_name = tag.label()+"_dm";
    discMap["vs_dm"] =
        fs->make<TH2F>(vs_dm_name.c_str(), vs_dm_name.c_str(),
                       nbins, min, max, 15, -0.5, 14.5);
    histos_[tag.label()] = discMap;
  }
}
virtual RecoTauPlotDiscriminator::~RecoTauPlotDiscriminator ( ) [inline, virtual]

Definition at line 33 of file RecoTauPlotDiscriminator.cc.

{}

Member Function Documentation

void RecoTauPlotDiscriminator::analyze ( const edm::Event evt,
const edm::EventSetup es 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 103 of file RecoTauPlotDiscriminator.cc.

References discs_, HcalObjRepresent::Fill(), edm::Event::getByLabel(), histos_, collect_tpl::input, edm::InputTag::label(), query::result, src_, GlobalPosition_Frontier_DevDB_cff::tag, and metsig::tau.

                                                           {
  // Get the input collection to clean
  edm::Handle<reco::CandidateView> input;
  evt.getByLabel(src_, input);

  // Cast the input candidates to Refs to real taus
  reco::PFTauRefVector inputRefs =
      reco::tau::castView<reco::PFTauRefVector>(input);

  // Plot the discriminator output for each of our taus
  BOOST_FOREACH(const reco::PFTauRef& tau, inputRefs) {
    // Plot each discriminator
    BOOST_FOREACH(const edm::InputTag &tag, discs_) {
      edm::Handle<reco::PFTauDiscriminator> discHandle;
      evt.getByLabel(tag, discHandle);
      //const HistoMap &discHistos = disc.second;
      double result = (*discHandle)[tau];
      HistoMap& mymap = histos_[tag.label()];
      mymap["plain"]->Fill(result);
      mymap["vs_pt"]->Fill(result, tau->pt());
      mymap["vs_jetPt"]->Fill(result, tau->jetRef()->pt());
      mymap["vs_embedPt"]->Fill(result, tau->alternatLorentzVect().pt());
      dynamic_cast<TH3F*>(mymap["vs_pt_jetPt"])->Fill(
          result, tau->pt(), tau->jetRef()->pt());
      dynamic_cast<TH3F*>(mymap["vs_pt_embedPt"])->Fill(
          result, tau->pt(), tau->alternatLorentzVect().pt());
      mymap["vs_eta"]->Fill(result, tau->eta());
      mymap["vs_dm"]->Fill(result, tau->decayMode());
    }
  }
}

Member Data Documentation

Definition at line 40 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze(), and RecoTauPlotDiscriminator().

Definition at line 41 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze(), and RecoTauPlotDiscriminator().

Definition at line 36 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze().