Skip to content

Commit 468ba80

Browse files
Update Creating-a-new-Event-Bus-Object.md
1 parent 5858cfd commit 468ba80

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/developing/Creating-a-new-Event-Bus-Object.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ If the objects already in an Event module do not suit your purposes, you can def
77
* In the header file, include `ClassDef( ClassName , 1 );` at the bottom of your class declaration (right before the closing bracket `};`).
88
* At the top of the implementation file, include `ClassImp( ClassName );` right after the include statement.
99
* Your class shouldn't use `TRef` (or any derived class)
10-
* Your object needs to be "registered" with the software so that ROOT can put it in our event model dictionary. This is done by adding a line to the `CMakeLists.txt` file in the module you are putting the new object. For example, the `Recon` module has an object shared by Hcal and Ecal in it. This object is not put inside a collection, so no other parameters are needed.
10+
* Your object needs to be "registered" with the software so that ROOT can put it in our event model dictionary. This is done by adding lines to `LinkDef.h` in the module you are putting the new object. For example, the `Recon` module has an object shared by Hcal and Ecal in it. This object is not put inside a collection, so no other lines are needed.
1111

12-
```cmake
13-
register_event_object( module_path "Recon/Event" namespace "ldmx"
14-
class "HgcrocDigiCollection" )
12+
```cpp
13+
// inside Recon/include/Recon/Event/LinkDef.h
14+
#pragma link C++ class ldmx::HgcrocDigiCollection+;
1515
```
1616

1717
* If you class is going to be inside an STL container, then you need
@@ -21,6 +21,14 @@ Method | Description
2121
`Print()` | Summarize object in a one line description of the form: `MyObject { param1 = val, param2 = val,...}` output to input ostream.
2222
`operator<` | This is used to sort the collection before inputting into event bus.
2323

24+
and you should add the STL container class to the `LinkDef.h` file as well, for example
25+
```cpp
26+
// for a std::vector
27+
#pragma link C++ class std::vector<ClassName>+;
28+
// and/or for a std::map with int keys
29+
#pragma link C++ class std::map<int, ClassName>+;
30+
```
31+
2432
* If your class is going to be outside an STL container (i.e. put into the event bus by itself), then you need
2533

2634
Method | Description
@@ -44,3 +52,7 @@ cd Framework
4452
git clean -xxfd
4553
```
4654
This last step is only necessary for developments built off of ldmx-sw prior to v3.3.4.
55+
56+
### CMake Registration
57+
If you are developing off of ldmx-sw prior to v4.5.3, then instead of editing the `LinkDef.h` file directly, you would register within the `CMakeLists.txt` file and then some CMake code writes a LinkDef file for you.
58+
This extra indirection did not save much effort and got in the way of developing manual schema evolution, so it was dropped.

0 commit comments

Comments
 (0)