Skip to content

Commit

Permalink
modernize JetHTAnalyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
mmusich committed Dec 1, 2022
1 parent 40a1c56 commit 54ad1fd
Showing 1 changed file with 21 additions and 26 deletions.
47 changes: 21 additions & 26 deletions Alignment/OfflineValidation/plugins/JetHTAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,12 @@
//
// class declaration
//

// If the analyzer does not use TFileService, please remove
// the template argument to the base class so the class inherits
// from edm::one::EDAnalyzer<>
// This will improve performance in multithreaded jobs.

using reco::TrackCollection;

class JetHTAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
public:
explicit JetHTAnalyzer(const edm::ParameterSet&);
~JetHTAnalyzer() override;
~JetHTAnalyzer() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
static bool mysorter(reco::Track i, reco::Track j) { return (i.pt() > j.pt()); }
Expand All @@ -78,23 +72,23 @@ class JetHTAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
void endJob() override;

// ----------member data ---------------------------
const edm::InputTag pvsTag_;
const edm::EDGetTokenT<reco::VertexCollection> pvsToken_;

edm::InputTag pvsTag_;
edm::EDGetTokenT<reco::VertexCollection> pvsToken_;
const edm::InputTag tracksTag_;
const edm::EDGetTokenT<reco::TrackCollection> tracksToken_;

edm::InputTag tracksTag_;
edm::EDGetTokenT<reco::TrackCollection> tracksToken_;
const edm::InputTag triggerTag_;
const edm::EDGetTokenT<edm::TriggerResults> triggerToken_;

edm::InputTag triggerTag_;
edm::EDGetTokenT<edm::TriggerResults> triggerToken_;
const int printTriggerTable_;
const double minVtxNdf_;
const double minVtxWgt_;

int printTriggerTable_;
double minVtxNdf_;
double minVtxWgt_;

std::vector<double> profilePtBorders_;
std::vector<int> iovList_;
const std::vector<double> profilePtBorders_;
const std::vector<int> iovList_;

// output histograms
edm::Service<TFileService> outfile_;
TH1F* h_ntrks;
TH1F* h_probePt;
Expand All @@ -106,6 +100,9 @@ class JetHTAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
TH1F* h_probeDzErr;

SmartSelectionMonitor mon;

// for the conversions
static constexpr double cmToum = 10000;
};

//
Expand All @@ -127,11 +124,6 @@ JetHTAnalyzer::JetHTAnalyzer(const edm::ParameterSet& iConfig)
usesResource(TFileService::kSharedResource);
}

//
// Default destructor
//
JetHTAnalyzer::~JetHTAnalyzer() = default;

//
// member functions
//
Expand All @@ -140,8 +132,6 @@ JetHTAnalyzer::~JetHTAnalyzer() = default;
void JetHTAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
using namespace edm;

const double cmToum = 10000;

const auto& vertices = iEvent.get(pvsToken_);
const reco::VertexCollection& pvtx = vertices;

Expand Down Expand Up @@ -341,6 +331,11 @@ void JetHTAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& description
desc.add<edm::InputTag>("vtxCollection", edm::InputTag("offlinePrimaryVerticesFromRefittedTrks"));
desc.add<edm::InputTag>("triggerResults", edm::InputTag("TriggerResults", "", "HLT"));
desc.add<edm::InputTag>("trackCollection", edm::InputTag("TrackRefitter"));
desc.add<int>("printTriggerTable", false);
desc.add<double>("minVertexNdf", 10.);
desc.add<double>("minVertexMeanWeight", 0.5);
desc.add<std::vector<double>>("profilePtBorders", {3, 5, 10, 20, 50, 100});
desc.add<std::vector<double>>("iovList", {0, 500000});
descriptions.add("JetHTAnalyzer", desc);
}

Expand Down

0 comments on commit 54ad1fd

Please sign in to comment.