Skip to content

Commit

Permalink
Merge pull request #34594 from guitargeek/PhysicsTools_merging_1
Browse files Browse the repository at this point in the history
Merge .h and .cc files of plugins in several PhysicsTools packages
  • Loading branch information
cmsbuild authored Jul 27, 2021
2 parents 532acfe + de74f55 commit 23f1aad
Show file tree
Hide file tree
Showing 22 changed files with 658 additions and 764 deletions.
51 changes: 48 additions & 3 deletions PhysicsTools/CandAlgos/plugins/EventShapeVarsProducer.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,56 @@
#include "PhysicsTools/CandAlgos/plugins/EventShapeVarsProducer.h"
/** \class EventShapeVarsProducer
*
* Produce set of event shape variables.
* The values of different event shape variables are stored as doubles in the event.
* They can be retrieved with InputTags like "moduleName::instanceName", where moduleName corresponds to
* "eventShapeVarsProducer" per default and instance name specifies an individual event shape variable
* which you wish to retrieve from the event:
*
* - thrust
* - oblateness
* - isotropy
* - circularity
* - sphericity
* - aplanarity
* - C
* - D
* - Fox-Wolfram moments
*
* See https://arxiv.org/pdf/hep-ph/0603175v2.pdf#page=524
* for an explanation of sphericity, aplanarity, the quantities C and D, thrust, oblateness, Fox-Wolfram moments.
*
* \author Christian Veelken, UC Davis
*
*
*
*/

#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "PhysicsTools/CandUtils/interface/EventShapeVariables.h"
#include "PhysicsTools/CandUtils/interface/Thrust.h"

#include <vector>
#include <memory>
#include <vector>

class EventShapeVarsProducer : public edm::EDProducer {
public:
explicit EventShapeVarsProducer(const edm::ParameterSet&);
~EventShapeVarsProducer() override {}

private:
edm::EDGetTokenT<edm::View<reco::Candidate>> srcToken_;
double r_;
unsigned fwmax_;

void beginJob() override {}
void produce(edm::Event&, const edm::EventSetup&) override;
void endJob() override {}
};

EventShapeVarsProducer::EventShapeVarsProducer(const edm::ParameterSet& cfg) {
srcToken_ = consumes<edm::View<reco::Candidate>>(cfg.getParameter<edm::InputTag>("src"));
Expand Down
54 changes: 0 additions & 54 deletions PhysicsTools/CandAlgos/plugins/EventShapeVarsProducer.h

This file was deleted.

61 changes: 50 additions & 11 deletions PhysicsTools/PatExamples/plugins/MuonAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,66 @@
* \author R. Bellan - CERN <[email protected]>
*/

#include "PhysicsTools/PatExamples/plugins/MuonAnalyzer.h"

// Collaborating Class Header
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CommonTools/UtilAlgos/interface/TFileService.h"

#include "DataFormats/Math/interface/LorentzVector.h"
#include "DataFormats/PatCandidates/interface/Muon.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ServiceRegistry/interface/Service.h"

#include "TH1I.h"
#include "TH1F.h"
#include "TH2F.h"

class ExampleMuonAnalyzer : public edm::EDAnalyzer {
public:
/// Constructor
ExampleMuonAnalyzer(const edm::ParameterSet &pset);

/// Destructor
~ExampleMuonAnalyzer() override;

// Operations

void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override;

void beginJob() override;
void endJob() override;

protected:
private:
edm::EDGetTokenT<pat::MuonCollection> theMuonToken;

// Histograms
TH1I *hNMuons;
TH1F *hPtRec;
TH2F *hPtReso;
TH1F *hEHcal;

TH1I *hMuonType;
TH1F *hPtSTATKDiff;

// ID
TH1F *hMuCaloCompatibility;
TH1F *hMuSegCompatibility;
TH1I *hChamberMatched;
TH1I *hMuIdAlgo;

// Isolation
TH1F *hMuIso03SumPt;
TH1F *hMuIso03CaloComb;

TH1F *h4MuInvMass;
};

using namespace std;
using namespace edm;

/// Constructor
ExampleMuonAnalyzer::ExampleMuonAnalyzer(const ParameterSet& pset) {
ExampleMuonAnalyzer::ExampleMuonAnalyzer(const ParameterSet &pset) {
theMuonToken = consumes<pat::MuonCollection>(pset.getParameter<InputTag>("MuonCollection"));
}

Expand Down Expand Up @@ -59,7 +98,7 @@ void ExampleMuonAnalyzer::beginJob() {

void ExampleMuonAnalyzer::endJob() {}

void ExampleMuonAnalyzer::analyze(const Event& event, const EventSetup& eventSetup) {
void ExampleMuonAnalyzer::analyze(const Event &event, const EventSetup &eventSetup) {
// Get the Muon collection
Handle<pat::MuonCollection> muons;
event.getByToken(theMuonToken, muons);
Expand Down
65 changes: 0 additions & 65 deletions PhysicsTools/PatExamples/plugins/MuonAnalyzer.h

This file was deleted.

69 changes: 66 additions & 3 deletions PhysicsTools/PatExamples/plugins/PatTauAnalyzer.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,75 @@
#include "PhysicsTools/PatExamples/plugins/PatTauAnalyzer.h"

#include "CommonTools/UtilAlgos/interface/TFileService.h"
#include "DataFormats/PatCandidates/interface/Tau.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CommonTools/UtilAlgos/interface/TFileService.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include <TH1.h>
#include <TMath.h>

#include <string>

class PatTauAnalyzer : public edm::EDAnalyzer {
public:
explicit PatTauAnalyzer(const edm::ParameterSet&);
~PatTauAnalyzer() override;

//--- methods inherited from EDAnalyzer base-class
void beginJob() override;
void analyze(const edm::Event&, const edm::EventSetup&) override;
void endJob() override;

private:
//--- configuration parameters
edm::InputTag src_;
edm::EDGetTokenT<pat::TauCollection> srcToken_;

bool requireGenTauMatch_;

std::string discrByLeadTrack_;
std::string discrByIso_;
std::string discrByTaNC_;

//--- generator level histograms
TH1* hGenTauEnergy_;
TH1* hGenTauPt_;
TH1* hGenTauEta_;
TH1* hGenTauPhi_;

//--- reconstruction level histograms
TH1* hTauJetEnergy_;
TH1* hTauJetPt_;
TH1* hTauJetEta_;
TH1* hTauJetPhi_;

TH1* hNumTauJets_;

TH1* hTauLeadTrackPt_;

TH1* hTauNumSigConeTracks_;
TH1* hTauNumIsoConeTracks_;

TH1* hTauDiscrByIso_;
TH1* hTauDiscrByTaNC_;
TH1* hTauDiscrAgainstElectrons_;
TH1* hTauDiscrAgainstMuons_;

TH1* hTauJetEnergyIsoPassed_;
TH1* hTauJetPtIsoPassed_;
TH1* hTauJetEtaIsoPassed_;
TH1* hTauJetPhiIsoPassed_;

TH1* hTauJetEnergyTaNCpassed_;
TH1* hTauJetPtTaNCpassed_;
TH1* hTauJetEtaTaNCpassed_;
TH1* hTauJetPhiTaNCpassed_;
};

const reco::GenParticle* getGenTau(const pat::Tau& patTau) {
std::vector<reco::GenParticleRef> associatedGenParticles = patTau.genParticleRefs();
for (std::vector<reco::GenParticleRef>::const_iterator it = associatedGenParticles.begin();
Expand Down
Loading

0 comments on commit 23f1aad

Please sign in to comment.