Development #260


Define Constants in a separate Class

Added by Florian Uhlig about 7 years ago. Updated over 6 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
12.00 h
Spent time:


When changing some code today I stumbled again over some constants which are defined directly in the code. In this case it was the proton mass in CbmUnigenGenerator, but I am sure we have such definitions in many classes.

To overcome the problem I propose to create a new class CbmConstants (or similar) and put all definitions there. This class should be then included at any place where such constants are needed.

Actions #1

Updated by Volker Friese about 7 years ago

  • Tracker changed from Feature to Development
  • Status changed from New to Assigned
  • Assignee set to Florian Uhlig

Good proposal; I agree. Better, I think, than a class would be a include file with namespace Cbm:: for the constants, which are then to be made static global. We will gradually move constants there when encountering them in code reviews.

Actions #2

Updated by Florian Uhlig almost 7 years ago

  • % Done changed from 0 to 20
Actions #3

Updated by Florian Uhlig almost 7 years ago

  • Status changed from Assigned to In Progress
Actions #4

Updated by Julian Book almost 7 years ago

I would like to point you to a solution provided by root. I would favour a solution alla TDatabasePDG::Instance()->GetParticle(2212)->Mass(); instead of hardcoded numbers as it is foreseen by now. what do you think?

Actions #5

Updated by Volker Friese over 6 years ago

Well, then the hardcoding of the numbers is done in ROOT instead of in CbmRoot. That's of course possible. But anybody can call this ROOT method himself from anywhere in the code, so I do not se the need to wrap this by CbmRoot.

Anyhow, the header file is there and can be used. Guess the issue can be closed then.

Actions #6

Updated by Volker Friese over 6 years ago

  • Due date set to 11/26/2015
  • Status changed from In Progress to Closed
  • % Done changed from 20 to 100

Also available in: Atom PDF