Skip to content

Commit

Permalink
Modernize ResolutionCreator
Browse files Browse the repository at this point in the history
Add "SERIAL" to the TH1::Fit() calls to make the calls thread friendly.
  • Loading branch information
makortel committed Jan 11, 2022
1 parent 91a33de commit f8cb941
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions TopQuarkAnalysis/TopObjectResolutions/src/ResolutionCreator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
Expand Down Expand Up @@ -35,10 +35,9 @@
// class declaration
//

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

private:
void beginJob() override;
Expand Down Expand Up @@ -74,6 +73,8 @@ class ResolutionCreator : public edm::EDAnalyzer {
// constructors and destructor
//
ResolutionCreator::ResolutionCreator(const edm::ParameterSet &iConfig) {
usesResource("TFileService");

// input parameters
genEvtToken_ = consumes<TtGenEvent>(edm::InputTag("genEvt"));
objectType_ = iConfig.getParameter<std::string>("object");
Expand All @@ -97,8 +98,6 @@ ResolutionCreator::ResolutionCreator(const edm::ParameterSet &iConfig) {
nrFilled = 0;
}

ResolutionCreator::~ResolutionCreator() {}

//
// member functions
//
Expand Down Expand Up @@ -456,7 +455,7 @@ void ResolutionCreator::endJob() {
fResPtEtaBin[ro][etab][ptb]->SetParameters(hResPtEtaBin[ro][etab][ptb]->GetMaximum(),
hResPtEtaBin[ro][etab][ptb]->GetMean(),
hResPtEtaBin[ro][etab][ptb]->GetRMS());
hResPtEtaBin[ro][etab][ptb]->Fit(fResPtEtaBin[ro][etab][ptb]->GetName(), "RQ");
hResPtEtaBin[ro][etab][ptb]->Fit(fResPtEtaBin[ro][etab][ptb]->GetName(), "RQ SERIAL");
hResEtaBin[ro][etab]->SetBinContent(ptb + 1, fResPtEtaBin[ro][etab][ptb]->GetParameter(2));
hResEtaBin[ro][etab]->SetBinError(ptb + 1, fResPtEtaBin[ro][etab][ptb]->GetParError(2));
//CD: Fill the tree
Expand All @@ -474,7 +473,7 @@ void ResolutionCreator::endJob() {
error = fResPtEtaBin[ro][etab][0]->GetParError(2) + fResPtEtaBin[ro][etab][1]->GetParError(2);
tResVar->Fill();
// standard fit
hResEtaBin[ro][etab]->Fit(fResEtaBin[ro][etab]->GetName(), "RQ");
hResEtaBin[ro][etab]->Fit(fResEtaBin[ro][etab]->GetName(), "RQ SERIAL");
}
}
if (objectType_ == "lJets" && nrFilled == 0)
Expand Down

0 comments on commit f8cb941

Please sign in to comment.