You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/ModulesDevelopment.md
+46-20Lines changed: 46 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,9 +129,23 @@ The repository QualityControl contains the _Framework_ and the _Modules_ in the
129
129
130
130
The Data Sampling code is part of the AliceO2 repository.
131
131
132
+
### Developing with aliBuild/alienv
133
+
134
+
One can of course build using `aliBuild` (`aliBuild build --defaults o2 QualityControl`). However, that will take quite some time as it checks all dependencies and builds everything.
135
+
136
+
The correct way of building is to load the environment with `alienv` and then go to the build directory and run `make` or `ninja`.
137
+
138
+
```
139
+
alienv load QualityControl/latest
140
+
cd sw/BUILD/QualityControl-latest/QualityControl
141
+
make -j8 install # or ninja -j8 install , also adapt to the number of cores available
142
+
```
143
+
132
144
### User-defined modules
133
145
134
-
The Quality Control uses _plugins_ to load the actual code to be executed by the _Tasks_ and the _Checkers_. A module, or plugin, can contain one or several _Tasks_ and/or one or several _Checks_. They must subclass `TaskInterface.h` and `CheckInterface.h` respectively. We use the Template Method Design Pattern.
146
+
The Quality Control uses _plugins_ to load the actual code to be executed by the _Tasks_ and the _Checks_. A module, or plugin, can contain one or several of these classes, both Tasks and Checks. They must subclass `TaskInterface.h` and `CheckInterface.h` respectively. We use the Template Method Design Pattern.
147
+
148
+
The same code, the same class, can be run many times in parallel. It means that you can run several qc tasks (no uppercase, i.e. processes) in parallel, each executing the same code defined in the same Task (uppercase, the class).
135
149
136
150
## Module creation
137
151
@@ -159,54 +173,66 @@ Options:
159
173
-p PP_NAME create a postprocessing task named PP_NAME
160
174
```
161
175
162
-
For example, if your detector 3-letter code is ABC you might want to do
176
+
For example, if your detector 3-letter code is TST you might want to do
163
177
```
164
178
# we are in ~/alice
165
179
cd QualityControl/Modules
166
-
./o2-qc-module-configurator.sh -m Abc -t RawDataQcTask # create the module and a task
180
+
./o2-qc-module-configurator.sh -m TST -t RawDataQcTask # create the module and a task
167
181
```
168
182
183
+
IMPORTANT: Make sure that your detector code is listed in TaskRunner::validateDetectorName. If it is not, feel free to add it.
184
+
185
+
We will refer in the following section to the module as `Tst` and the task as `RawDataQcTask`. Make sure to use your own code and names.
186
+
169
187
## Test run
170
188
171
189
Now that there is a module, we can build it and test it. First let's build it :
172
190
```
173
-
# We are in ~/alice and alienv has been called.
191
+
# We are in ~/alice, call alienv if not already done
192
+
alienv enter QualityControl/latest
174
193
# Go to the build directory of QualityControl.
175
194
cd sw/BUILD/QualityControl-latest/QualityControl
176
-
make -j8 install # replace 8 by the number of cores on your machine
195
+
make -j8 install # or ninja, replace 8 by the number of cores on your machine
177
196
```
178
197
179
-
To test whether it works, we are going to run a basic DPL workflow defined in `runBasic.cxx`.
180
-
We need to modify slightly the config file to indicate our freshly created module and classes.
181
-
The config file is called `basic.json` and is located in `$QUALITYCONTROL_ROOT/etc/`. After installation, if you want to modify the original one, it is in the source directory `Framework`. In case you need it updated in the installation directory, you have to `make install` the project again.
198
+
To test whether it works, we are going to run a basic workflow made of a producer and the qc, which corresponds to the one we saw in the [QuickStart](QuickStart.md#basic-workflow).
199
+
200
+
We are going to duplicate the config file we used previously, i.e. `basic.json`:
You should see the QcTask at qcg-test.cern.ch with an object `Example` updating.
199
-
200
-
## Modification of a Task
201
-
202
-
Fill in the methods in RawDataQcTask.cxx. For example, make it publish a second histogram. Objects must be published only once and they will then be updated automatically every cycle (10 seconds for our example, 1 minute in general).
203
-
Once done, recompile it (see section above) and run it. You should see the second object published in the qcg.
230
+
You should see an object `example` in `/qc/TST/MyRawDataQcTask` at qcg-test.cern.ch.
204
231
205
-
TODO give actual steps
232
+
## Modification of the Task
206
233
207
-
You can rename the task by simply changing its name in the config file. Change the name from
208
-
`QcTask` to whatever you like and run it again (no need to recompile). You should see the new name
209
-
appear in the QCG.
234
+
We are going to modify our task to make it publish a second histogram. Objects must be published only once and they will then be updated automatically every cycle (10 seconds for our example, 1 minute in general). Modify `RawDataQcTask.cxx` and its header to add a new histogram, build it and publish it with `getObjectsManager()->startPublishing(mHistogram);`.
235
+
Once done, recompile it (see section above, `make -j8 install` in the build directory) and run it (same as above). You should see the second object published in the qcg.
0 commit comments