Warning, /EICrecon/CONTRIBUTING.md is written in an unsupported language. File is not indexed.
0001
0002 # Code style and naming
0003 There are many coding guidelines which could be selected by the whole community, now we need a minimum to start with consistent code
0004
0005 ## C++
0006
0007 ### Code
0008
0009 - class names: PascalCase
0010 - member functions: camelCase
0011 - members: m_snake_case
0012 - local variables: snake_case
0013 - constands, definitions: SCREAMING_SNAKE_CASE
0014 - base namespace: eicrecon
0015 - indent: 4 spaces
0016
0017 ### File naming
0018
0019 - file extensions: cc, h
0020 - factory names: WhatIsProduced_factory[_tag]
0021 - services, processors, etc.: Name_service, Name_processor, Name_etc
0022 - plugin with `name` should have `name`.cc file with `InitPlugin` function (It makes it so much easier to find the entry point of a plugin in the src tree)
0023 - templated classes: end with "T" (classes that inherit from them don't, unless they are also a template)
0024 - interface classes: start with "I"
0025
0026 ### Sample
0027
0028 (This code sample is temporary and needs further development)
0029
0030 ```c++
0031 #include <vector>
0032
0033 /** Doxygen style for Foo */
0034 class Foo {
0035 friend class AnotherClass;
0036
0037 public:
0038 Foo(some_arg) {
0039 m_field = some_arg;
0040 }
0041
0042 private:
0043 int m_field;
0044 };
0045
0046 class AnotherClass {
0047 public:
0048
0049 static const int MAX_VALUE = 42;
0050 static const int MIN_VALUE = 0;
0051
0052 virtual void method1() = 0;
0053 virtual void method2() = 0;
0054
0055 int x() { return m_x; }
0056 void setX(x) { m_x = x; }
0057
0058 private:
0059 int m_x;
0060
0061 };
0062
0063 ```
0064
0065 ## Python
0066
0067 - Strongly follow [PEP-8](https://peps.python.org/pep-0008/) unless naming is dictated by C++ wrapping
0068
0069 # Development policies
0070
0071 ## Use of data model classes
0072
0073 **podio** generates mutable and unmutable classes to work with underlying POD objects. e.g. `TrackerHit` (unmutable) an `MutableTrakerHit`. Unmutable variants are to be used for factory outputs and as a base classes of types that will be factory outputs:
0074
0075 ```C++
0076 class MyClass: public TrackerHit // Yes
0077 class MyClass: public MutableTrackerHit // NO!
0078
0079 std::vector<const TrackerHit*> results // Yes
0080 std::vector<const MutableTrackerHit*> results // NO!
0081 ```
0082
0083 ## spdlog as a main logging engine
0084
0085 [spdlog](https://github.com/gabime/spdlog) is suggested as the main logging engine for EICRecon. Based on
0086
0087 One can use a general and plugin level loggers as
0088
0089 ```C++
0090 // Create plugin level sub-log
0091 m_log = spdlog::stdout_color_mt("TrackerHitReconstruction_factory");
0092 ```
0093
0094 More documentation is available at [spdlog](https://github.com/gabime/spdlog)