Skip to content

Commit f1c2e49

Browse files
author
Oz Amram
committed
Promote configuration issues to exceptions
1 parent e90cad9 commit f1c2e49

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

IOMC/ParticleGuns/src/CloseByParticleGunProducer.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ CloseByParticleGunProducer::CloseByParticleGunProducer(const ParameterSet& pset)
2828
fControlledByEta = pgun_params.getParameter<bool>("ControlledByEta");
2929
fControlledByREta = pgun_params.getParameter<bool>("ControlledByREta");
3030
if(fControlledByEta and fControlledByREta)
31-
LogError("CloseByParticleGunProducer") << " Conflicting configuration, cannot have both ControlledByEta and ControlledByREta ";
31+
throw cms::Exception("CloseByParticleGunProducer") << " Conflicting configuration, cannot have both ControlledByEta and ControlledByREta ";
3232

3333
fVarMax = pgun_params.getParameter<double>("VarMax");
3434
fVarMin = pgun_params.getParameter<double>("VarMin");
3535
fMaxVarSpread = pgun_params.getParameter<bool>("MaxVarSpread");
3636
fLogSpacedVar = pgun_params.getParameter<bool>("LogSpacedVar");
3737
fFlatPtGeneration = pgun_params.getParameter<bool>("FlatPtGeneration");
3838
if (fVarMin < 1 && !fFlatPtGeneration)
39-
LogError("CloseByParticleGunProducer") << " Please choose a minimum energy greater than 1 GeV, otherwise time "
39+
throw cms::Exception("CloseByParticleGunProducer") << " Please choose a minimum energy greater than 1 GeV, otherwise time "
4040
"information may be invalid or not reliable";
4141
if (fVarMin < 0 && fLogSpacedVar)
42-
LogError("CloseByParticleGunProducer") << " Minimum energy must be greater than zero for log spacing";
42+
throw cms::Exception("CloseByParticleGunProducer") << " Minimum energy must be greater than zero for log spacing";
4343
else{
4444
log_fVarMin = std::log(fVarMin);
4545
log_fVarMax = std::log(fVarMax);
@@ -49,27 +49,27 @@ CloseByParticleGunProducer::CloseByParticleGunProducer(const ParameterSet& pset)
4949
fEtaMax = pgun_params.getParameter<double>("MaxEta");
5050
fEtaMin = pgun_params.getParameter<double>("MinEta");
5151
if (fEtaMax <= fEtaMin)
52-
LogError("CloseByParticleGunProducer") << " Please fix MinEta and MaxEta values in the configuration";
52+
throw cms::Exception("CloseByParticleGunProducer") << " Please fix MinEta and MaxEta values in the configuration";
5353
} else {
5454
fRMax = pgun_params.getParameter<double>("RMax");
5555
fRMin = pgun_params.getParameter<double>("RMin");
5656
if (fRMax <= fRMin)
57-
LogError("CloseByParticleGunProducer") << " Please fix RMin and RMax values in the configuration";
57+
throw cms::Exception("CloseByParticleGunProducer") << " Please fix RMin and RMax values in the configuration";
5858
}
5959
if(!fControlledByREta){
6060
fZMax = pgun_params.getParameter<double>("ZMax");
6161
fZMin = pgun_params.getParameter<double>("ZMin");
6262

6363
if (fZMax <= fZMin)
64-
LogError("CloseByParticleGunProducer") << " Please fix ZMin and ZMax values in the configuration";
64+
throw cms::Exception("CloseByParticleGunProducer") << " Please fix ZMin and ZMax values in the configuration";
6565
}
6666
fDelta = pgun_params.getParameter<double>("Delta");
6767
fPhiMin = pgun_params.getParameter<double>("MinPhi");
6868
fPhiMax = pgun_params.getParameter<double>("MaxPhi");
6969
fPointing = pgun_params.getParameter<bool>("Pointing");
7070
fOverlapping = pgun_params.getParameter<bool>("Overlapping");
7171
if (fFlatPtGeneration && !fPointing)
72-
LogError("CloseByParticleGunProducer")
72+
throw cms::Exception("CloseByParticleGunProducer")
7373
<< " Can't generate non pointing FlatPt samples; please disable FlatPt generation or generate pointing sample";
7474
fRandomShoot = pgun_params.getParameter<bool>("RandomShoot");
7575
fNParticles = pgun_params.getParameter<int>("NParticles");
@@ -80,7 +80,7 @@ CloseByParticleGunProducer::CloseByParticleGunProducer(const ParameterSet& pset)
8080
fTMax = pgun_params.getParameter<double>("TMax");
8181
fTMin = pgun_params.getParameter<double>("TMin");
8282
if (fTMax <= fTMin)
83-
LogError("CloseByParticleGunProducer") << " Please fix TMin and TMax values in the configuration";
83+
throw cms::Exception("CloseByParticleGunProducer") << " Please fix TMin and TMax values in the configuration";
8484
// set a fixed time offset for the particles
8585
fOffsetFirst = pgun_params.getParameter<double>("OffsetFirst");
8686

0 commit comments

Comments
 (0)