Skip to content

Commit

Permalink
Use static_assert for TrajectoryStopReason as well
Browse files Browse the repository at this point in the history
  • Loading branch information
makortel committed Sep 8, 2017
1 parent dab8732 commit 48d452e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
7 changes: 0 additions & 7 deletions DQM/TrackingMonitor/src/TrackAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -636,13 +636,6 @@ void TrackAnalyzer::bookHistosForHitProperties(DQMStore::IBooker & ibooker) {
}

size_t StopReasonNameSize = sizeof(StopReasonName::StopReasonName)/sizeof(std::string);
if(StopReasonNameSize != static_cast<unsigned int>(StopReason::SIZE)) {
throw cms::Exception("Assert") << "StopReason::SIZE is " << static_cast<unsigned int>(StopReason::SIZE)
<< " but StopReasonName's only for "
<< StopReasonNameSize
<< ". Please update DataFormats/TrackReco/interface/TrajectoryStopReasons.h.";
}

histname = "stoppingSource_";
stoppingSource = ibooker.book1D(histname+CategoryName, histname+CategoryName, StopReasonNameSize, 0., double(StopReasonNameSize));
stoppingSource->setAxisTitle("stopping reason",1);
Expand Down
7 changes: 0 additions & 7 deletions DQM/TrackingMonitor/src/TrackBuildingAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,6 @@ void TrackBuildingAnalyzer::initHisto(DQMStore::IBooker & ibooker, const edm::Pa
if (doAllTCPlots || doStopSource) {
// DataFormats/TrackReco/interface/TrajectoryStopReasons.h
size_t StopReasonNameSize = sizeof(StopReasonName::StopReasonName)/sizeof(std::string);
if(StopReasonNameSize != static_cast<unsigned int>(StopReason::SIZE)) {
throw cms::Exception("Assert") << "StopReason::SIZE is " << static_cast<unsigned int>(StopReason::SIZE)
<< " but StopReasonName's only for "
<< StopReasonNameSize
<< ". Please update DataFormats/TrackReco/interface/TrajectoryStopReasons.h.";
}


histname = "StoppingSource_"+seedProducer.label() + "_";
stoppingSource = ibooker.book1D(histname+CatagoryName,
Expand Down
3 changes: 3 additions & 0 deletions DataFormats/TrackReco/src/TrajectoryStopReasons.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "DataFormats/TrackReco/interface/TrajectoryStopReasons.h"

static_assert(sizeof(StopReasonName::StopReasonName)/sizeof(std::string) == static_cast<unsigned int>(StopReason::SIZE), "StopReason enum and StopReasonName are out of synch");

0 comments on commit 48d452e

Please sign in to comment.