Skip to content

Commit

Permalink
Add range checks for min/maxPhi
Browse files Browse the repository at this point in the history
  • Loading branch information
makortel committed Jun 27, 2017
1 parent d71d3ea commit ca093f4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
12 changes: 12 additions & 0 deletions CommonTools/RecoAlgos/interface/RecoTrackSelectorBase.h
Expand Up @@ -31,6 +31,18 @@ class RecoTrackSelectorBase {
min3DLayer_(cfg.getParameter<int>("min3DLayer")),
usePV_(cfg.getParameter<bool>("usePV")),
bsSrcToken_(iC.consumes<reco::BeamSpot>(cfg.getParameter<edm::InputTag>("beamSpot"))) {
const auto minPhi = cfg.getParameter<double>("minPhi");
const auto maxPhi = cfg.getParameter<double>("maxPhi");
if(minPhi >= maxPhi) {
throw cms::Exception("Configuration") << "RecoTrackSelectorPhase: minPhi (" << minPhi << ") must be smaller than maxPhi (" << maxPhi << "). The range is constructed from minPhi to maxPhi around their average.";
}
if(minPhi >= M_PI) {
throw cms::Exception("Configuration") << "RecoTrackSelectorPhase: minPhi (" << minPhi << ") must be smaller than PI. The range is constructed from minPhi to maxPhi around their average.";
}
if(maxPhi <= -M_PI) {
throw cms::Exception("Configuration") << "RecoTrackSelectorPhase: maxPhi (" << maxPhi << ") must be larger than -PI. The range is constructed from minPhi to maxPhi around their average.";
}

if (usePV_)
vertexToken_ = iC.consumes<reco::VertexCollection>(cfg.getParameter<edm::InputTag>("vertexTag"));
for(const std::string& quality: cfg.getParameter<std::vector<std::string> >("quality"))
Expand Down
12 changes: 11 additions & 1 deletion SimTracker/Common/interface/TrackingParticleSelector.h
Expand Up @@ -23,7 +23,17 @@ class TrackingParticleSelector {
double minPhi=-3.2, double maxPhi=3.2) :
ptMin2_( ptMin*ptMin ), minRapidity_( minRapidity ), maxRapidity_( maxRapidity ),
meanPhi_((minPhi+maxPhi)/2.), rangePhi_((maxPhi-minPhi)/2.),
tip2_( tip*tip ), lip_( lip ), minHit_( minHit ), signalOnly_(signalOnly), intimeOnly_(intimeOnly), chargedOnly_(chargedOnly), stableOnly_(stableOnly), pdgId_( pdgId ) { }
tip2_( tip*tip ), lip_( lip ), minHit_( minHit ), signalOnly_(signalOnly), intimeOnly_(intimeOnly), chargedOnly_(chargedOnly), stableOnly_(stableOnly), pdgId_( pdgId ) {
if(minPhi >= maxPhi) {
throw cms::Exception("Configuration") << "TrackingParticleSelector: minPhi (" << minPhi << ") must be smaller than maxPhi (" << maxPhi << "). The range is constructed from minPhi to maxPhi around their average.";
}
if(minPhi >= M_PI) {
throw cms::Exception("Configuration") << "TrackingParticleSelector: minPhi (" << minPhi << ") must be smaller than PI. The range is constructed from minPhi to maxPhi around their average.";
}
if(maxPhi <= -M_PI) {
throw cms::Exception("Configuration") << "TrackingParticleSelector: maxPhi (" << maxPhi << ") must be larger than -PI. The range is constructed from minPhi to maxPhi around their average.";
}
}

/// Operator() performs the selection: e.g. if (tPSelector(tp)) {...}
bool operator()( const TrackingParticle & tp ) const {
Expand Down

0 comments on commit ca093f4

Please sign in to comment.