Skip to content

Commit

Permalink
Do not read config during Event processing
Browse files Browse the repository at this point in the history
The conf_ variable is a nullptr during Event processing so can not
be used. Instead, we cache the value we need in the constructor.
  • Loading branch information
Dr15Jones committed May 30, 2017
1 parent 8c3808f commit 640a89f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
2 changes: 2 additions & 0 deletions DQM/TrackingMonitor/interface/TrackAnalyzer.h
Expand Up @@ -82,6 +82,8 @@ class TrackAnalyzer

edm::ParameterSet const* conf_;

std::string stateName_;

bool doTrackerSpecific_;
bool doAllPlots_;
bool doBSPlots_;
Expand Down
27 changes: 13 additions & 14 deletions DQM/TrackingMonitor/src/TrackAnalyzer.cc
Expand Up @@ -25,6 +25,7 @@ using namespace dqm;

TrackAnalyzer::TrackAnalyzer(const edm::ParameterSet& iConfig)
: conf_( nullptr )
, stateName_ (iConfig.getParameter<std::string>("MeasurementState") )
, doTrackerSpecific_ ( iConfig.getParameter<bool>("doTrackerSpecific") )
, doAllPlots_ ( iConfig.getParameter<bool>("doAllPlots") )
, doBSPlots_ ( iConfig.getParameter<bool>("doBeamSpotPlots") )
Expand Down Expand Up @@ -181,22 +182,21 @@ void TrackAnalyzer::initHisto(DQMStore::IBooker & ibooker, const edm::EventSetup
// ---------------------------------------------------------------------------------//
if (doMeasurementStatePlots_ || doAllPlots_) {

std::string StateName = iConfig.getParameter<std::string>("MeasurementState");

if (StateName == "All") {
if (stateName_ == "All") {
bookHistosForState("OuterSurface", ibooker);
bookHistosForState("InnerSurface", ibooker);
bookHistosForState("ImpactPoint" , ibooker);
} else if (
StateName != "OuterSurface" &&
StateName != "InnerSurface" &&
StateName != "ImpactPoint" &&
StateName != "default"
stateName_ != "OuterSurface" &&
stateName_ != "InnerSurface" &&
stateName_ != "ImpactPoint" &&
stateName_ != "default"
) {
bookHistosForState("default", ibooker);

} else {
bookHistosForState(StateName, ibooker);
bookHistosForState(stateName_, ibooker);
}
conf_ = nullptr;
}
Expand Down Expand Up @@ -1235,21 +1235,20 @@ void TrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSe
}

if (doMeasurementStatePlots_ || doAllPlots_){
std::string StateName = conf_->getParameter<std::string>("MeasurementState");

if (StateName == "All") {
if (stateName_ == "All") {
fillHistosForState(iSetup, track, std::string("OuterSurface"));
fillHistosForState(iSetup, track, std::string("InnerSurface"));
fillHistosForState(iSetup, track, std::string("ImpactPoint"));
} else if (
StateName != "OuterSurface" &&
StateName != "InnerSurface" &&
StateName != "ImpactPoint" &&
StateName != "default"
stateName_ != "OuterSurface" &&
stateName_ != "InnerSurface" &&
stateName_ != "ImpactPoint" &&
stateName_ != "default"
) {
fillHistosForState(iSetup, track, std::string("default"));
} else {
fillHistosForState(iSetup, track, StateName);
fillHistosForState(iSetup, track, stateName_);
}
}

Expand Down

0 comments on commit 640a89f

Please sign in to comment.