@@ -202,26 +202,28 @@ ParamHistFunc &createPHF(const std::string &phfname, std::string const &sysname,
202202 RooArgList gammas;
203203 for (std::size_t i = 0 ; i < n; ++i) {
204204 const std::string name = parnames.empty () ? defaultGammaName (sysname, i) : parnames[i];
205- auto * e = dynamic_cast <RooAbsReal*>(ws.obj (name.c_str ()));
206- if (e) gammas.add (*e);
207- else gammas.add (getOrCreate<RooRealVar>(ws, name, 1 ., gammaMin, gammaMax));
205+ auto *e = dynamic_cast <RooAbsReal *>(ws.obj (name.c_str ()));
206+ if (e)
207+ gammas.add (*e);
208+ else
209+ gammas.add (getOrCreate<RooRealVar>(ws, name, 1 ., gammaMin, gammaMax));
208210 }
209211
210212 auto &phf = tool.wsEmplace <ParamHistFunc>(phfname, observables, gammas);
211213
212- if (vals.size () > 0 ){
213- if (constraintType != " Const" ) {
214- auto constraintsInfo = createGammaConstraints (
215- gammas, vals, minSigma, constraintType == " Poisson" ? Constraint::Poisson : Constraint::Gaussian);
216- for (auto const &term : constraintsInfo.constraints ) {
217- ws.import (*term, RooFit::RecycleConflictNodes ());
218- constraints.add (*ws.pdf (term->GetName ()));
219- }
220- } else {
221- for (auto *gamma : static_range_cast<RooRealVar *>(gammas)) {
222- gamma->setConstant (true );
223- }
224- }
214+ if (vals.size () > 0 ) {
215+ if (constraintType != " Const" ) {
216+ auto constraintsInfo = createGammaConstraints (
217+ gammas, vals, minSigma, constraintType == " Poisson" ? Constraint::Poisson : Constraint::Gaussian);
218+ for (auto const &term : constraintsInfo.constraints ) {
219+ ws.import (*term, RooFit::RecycleConflictNodes ());
220+ constraints.add (*ws.pdf (term->GetName ()));
221+ }
222+ } else {
223+ for (auto *gamma : static_range_cast<RooRealVar *>(gammas)) {
224+ gamma->setConstant (true );
225+ }
226+ }
225227 }
226228
227229 return phf;
@@ -383,17 +385,18 @@ bool importHistSample(RooJSONFactoryWSTool &tool, RooDataHist &dh, RooArgSet con
383385 std::string funcName = channelName + " _" + sysname + " _ShapeSys" ;
384386 // funcName should be "<channel_name>_<sysname>_ShapeSys"
385387 std::vector<double > vals;
386- if (mod[" data" ].has_child (" vals" )){
387- for (const auto &v : mod[" data" ][" vals" ].children ()) {
388- vals.push_back (v.val_double ());
389- }
390- }
388+ if (mod[" data" ].has_child (" vals" )) {
389+ for (const auto &v : mod[" data" ][" vals" ].children ()) {
390+ vals.push_back (v.val_double ());
391+ }
392+ }
391393 std::vector<std::string> parnames;
392394 for (const auto &v : mod[" parameters" ].children ()) {
393395 parnames.push_back (v.val ());
394396 }
395397 if (vals.empty () && parnames.empty ()) {
396- RooJSONFactoryWSTool::error (" unable to instantiate shapesys '" + sysname + " ' with neither values nor parameters!" );
398+ RooJSONFactoryWSTool::error (" unable to instantiate shapesys '" + sysname +
399+ " ' with neither values nor parameters!" );
397400 }
398401 std::string constraint (mod.has_child (" constraint_type" ) ? mod[" constraint_type" ].val ()
399402 : mod.has_child (" constraint" ) ? mod[" constraint" ].val ()
0 commit comments