Updates to LauBlattWeisskopfFactor and LauResonanceMaker to allow a model to be generated only containing a K-matrix (for visualisation purposes)
Details
Visualising the K-matrix in B -> DDh Dalitz analyses
Diff Detail
- Repository
- rLAURA laura
- Branch
- johndan-ImproveBlattWeisskopfHandling
- Lint
No Lint Coverage - Unit
No Test Coverage - Build Status
Buildable 156 Build 156: arc lint + arc unit
Event Timeline
inc/LauBlattWeisskopfFactor.hh | ||
---|---|---|
39 | Needed, annoyingly, for the default argument assignment of "" to the TString parameter of setRadiusName. | |
128 | This is the new function I had to introduce which doesn't expect a resInfo argument (since it's not needed in most cases for naming the Blatt-Weisskopf factor category) | |
src/LauBlattWeisskopfFactor.cc | ||
63 | Why was NEED_A_GOOD_NAME here? | |
86 | This seems to be the only case in which resInfo is actually needed, so for all the others I just use a default argument of "" for the category name and then it is assigned in the old way. Passing around "" seems imperfect, and perhaps you'll have a smarter way to do this. What I would rather do is modify the original | |
142 | I'm amazed that C++ doesn't have a mechanism to allow enum types to be converted to strings easily. I saw boost has a preprocessor library that can handle it, but managing it in C++ looks messy in the examples I've seen. |
Hi @johndan, thanks for this. Few comments inline.
src/LauBlattWeisskopfFactor.cc | ||
---|---|---|
63 | I think it's just there as an explicit reminder that the name needs to be, and indeed is, updated in the function body. | |
86 | An alternative way would be to have 3 functions: TString setRadiusName( const LauResonanceInfo& resInfo, const BlattWeisskopfCategory category ); TString setRadiusName( const BlattWeisskopfCategory category ); TString setRadiusName( const TString& categoryName ); The first is modified as you've done except that in the Indep case you just call the 3rd one with the result of resInfo.getSanitisedName(). TString LauBlattWeisskopfFactor::setRadiusName( const TString& categoryName ) { TString name = "BarrierRadius_"; name.Append(categoryName); radius_->name(name); return categoryName; } This avoids having any default arguments but does rather proliferate the number of functions. I agree that these functions should be private, and have no objection to them being moved into that access category. | |
142 | Indeed, it is a bit surprising that this isn't easier to do. There are some clever tricks that can be done with macros to autogenerate this stuff but they're hard to read, so I prefer to keep it like this, at least for now. | |
src/LauResonanceMaker.cc | ||
647 | Could here create it with some hard-coded default, e.g. 4.0, for the radius and print a warning that it's being created with such a default value, instead of an error that you can't create it at all. Similarly, should probably handle the case that you don't find the Parent category in the category information map, cf. lines 677-684. |
src/LauBlattWeisskopfFactor.cc | ||
---|---|---|
86 | Thanks for the detailed proposal! So for the second one, and case Indep:, what does the action look like? You don't have the resInfo to get a name from... Also, what should the name be for the "Default" case? "Unknown", like before, or something else? | |
142 | Yes, I entirely agree. The boost solution was the least messy of them all, but certainly not worth introducing dependencies to achieve this minor goal. | |
src/LauResonanceMaker.cc | ||
647 | Sure thing. Isn't Parent created by default in the constructor? |
src/LauBlattWeisskopfFactor.cc | ||
---|---|---|
86 | Also, why would the second one call the third one, since both have the same form. Why not just set the categoryName variable for the Indep and Default cases? |
src/LauBlattWeisskopfFactor.cc | ||
---|---|---|
86 | Apologies, I accidentally omitted a few details. To avoid further ambiguities, here's exactly what I had in mind. Hopefully this clarifies what I meant to the extent that all your questions are answered? TString LauBlattWeisskopfFactor::setRadiusName( const LauResonanceInfo& resInfo, const BlattWeisskopfCategory category ) { switch (category) { case Indep : return this->setRadiusName( resInfo.getSanitisedName() ); break; default : return this->setRadiusName( category ); break; } } TString LauBlattWeisskopfFactor::setRadiusName( const BlattWeisskopfCategory category ) { switch (category) { case Default : case Indep : // We shouldn't ever end up here return this->setRadiusName("Unknown"); case Parent : return this->setRadiusName("Parent"); case Light : return this->setRadiusName("Light"); case Kstar : return this->setRadiusName("Kstar"); case Charm : return this->setRadiusName("Charm"); case StrangeCharm : return this->setRadiusName("StrangeCharm"); case Charmonium : return this->setRadiusName("Charmonium"); case Beauty : return this->setRadiusName("Beauty"); case StrangeBeauty : return this->setRadiusName("StrangeBeauty"); case CharmBeauty : return this->setRadiusName("CharmBeauty"); case Custom1 : return this->setRadiusName("Custom1"); case Custom2 : return this->setRadiusName("Custom2"); case Custom3 : return this->setRadiusName("Custom3"); case Custom4 : return this->setRadiusName("Custom4"); } } TString LauBlattWeisskopfFactor::setRadiusName( const TString& categoryName ) { TString name = "BarrierRadius_"; name.Append(categoryName); radius_->name(name); return categoryName; } | |
src/LauResonanceMaker.cc | ||
647 | Indeed, at the moment it is created on line 75. However, it's not impossible that that might be removed in future, so it seems prudent to handle the case where it isn't found. |
src/LauBlattWeisskopfFactor.cc | ||
---|---|---|
86 | Looks good. The compiler doesn't like the switch with no return outside: /afs/cern.ch/user/j/johndan/ExternalSoftware/Laura++/laura/src/LauBlattWeisskopfFactor.cc: In member function 'TString LauBlattWeisskopfFactor::setRadiusName(LauBlattWeisskopfFactor::BlattWeisskopfCategory)': /afs/cern.ch/user/j/johndan/ExternalSoftware/Laura++/laura/src/LauBlattWeisskopfFactor.cc:124:1: warning: control reaches end of non-void function [-Wreturn-type] 124 | } |
src/LauBlattWeisskopfFactor.cc | ||
---|---|---|
86 | Oh yes, I'd forgotten about gcc's insistence that control can get beyond a switch on an enum that covers every case and returns from each (clang is happy that it can't). // We should never get here but gcc seems to think we can return this->setRadiusName("Unknown"); at the end. |
src/LauResonanceMaker.cc | ||
---|---|---|
657–659 | I think this can be dropped now? |
Many thanks for taking care of all these extensions to the K-matrix @johndan !
Will land this now.