Add VME Module » History » Version 1
Ole Hansen, 03/30/2018 10:24 PM
1 | 1 | Ole Hansen | h1. How to add a VME Module to Podd |
---|---|---|---|
2 | |||
3 | R. Michaels, Mar 23, 2015 |
||
4 | |||
5 | A VME module is a device that sits in a VME crate and reads data. This document explains how to add a new VME module to the decoder for the Podd analyzer. |
||
6 | |||
7 | Note: I don't expect anyone to invent a new Fastbus module, so I'm only explaining VME. This is part of the "OO Decoder Upgrade" circa 2014. |
||
8 | |||
9 | Follow these steps. Details are shown below. |
||
10 | |||
11 | * Write a module class that inherits from VmeModule. An example would be SkeletonModule. You could copy that and make changes. |
||
12 | * Warning: your class must not be abstract ! If it is, the module will not be instantiated. (this means that methods=0 in base class must be defined). |
||
13 | * Add the "DoRegister" lines to your new module class. Note, each module has a unique identifying number, the "model number". E.g. 3801 for a Struck model 3801 scaler. |
||
14 | * Add the class to the namespace Decoder in Decoder.h |
||
15 | * Add it to the Makefile |
||
16 | * Add it to the haDecode_LinkDef.h file |
||
17 | * Add the appropriate lines to the crate map file db_cratemap.dat |
||
18 | |||
19 | Note that you can also "make your module a plugin":https://github.com/JeffersonLab/analyzer/blob/master/hana_decode/README_NEWMODULE.md. Using a plugin in Podd is an ideal way to develop and test your new module. (Thanks to Steve Wood for that.) |
||
20 | |||
21 | Here are a few technical details. |
||
22 | |||
23 | The "DoRegister" lines look like this, e.g. in @Fadc250Module.C@ |
||
24 | |||
25 | <pre> |
||
26 | Module::TypeIter_t Fadc250Module::fgThisType = |
||
27 | DoRegister( ModuleType( "Decoder::Fadc250Module" , 250 )); |
||
28 | </pre> |
||
29 | |||
30 | The last number (250) is the "model number" and must be unique for |
||
31 | that class. It essentially signals what class to use. |
||
32 | The model number must also appear in the @db_cratemap.dat@ file. |
||
33 | Actually, this was always the case. |
||
34 | |||
35 | The line in haDecode_LinkDef.h looks like this: |
||
36 | <pre> |
||
37 | #pragma link C++ class Decoder::Fadc250Module+; |
||
38 | </pre> |
||
39 | |||
40 | Important: If you fail to add the above line to @haDecode_LinkDef.h@ the code |
||
41 | will compile and run, but the class is not instantiated (and an error |
||
42 | message is shown) which means basically no module. It could take awhile |
||
43 | to figure that out if you miss the error messages. |
||
44 | |||
45 | The OO Decoder is very reliant on the @db_cratemap.dat@ file, so effort |
||
46 | must be put into making that correct. If a module is not in the cratemap |
||
47 | it will be ignored ! Put in all modules that were ever used during the |
||
48 | experiment. If a module is in the cratemap but not defined, a warning |
||
49 | is issued. For example, there is no such thing as a model 5678 VME module. |
||
50 | For Fastbus (unlike VME !), the modules are discoverable from the data, |
||
51 | and if they are not in the cratemap a warning is issued. Fix it. |
||
52 | |||
53 | One advantage of the new OO Decoder scheme is that you can "Get" |
||
54 | a module. This is useful for modules with complex behaviour. |
||
55 | See @tstfadc_main.C@, @tstf1tdc_main.C@, or @tstskel_main.C@ |
||
56 | for examples |
||
57 | <pre> |
||
58 | fadc = evdata->GetModule(9,5); // crate 9, slot 5 |
||
59 | |||
60 | if (fadc->GetMode()==1) {// do one thing, e.g. |
||
61 | h1->Fill(fadc->GetData(1,11,0)); |
||
62 | } |
||
63 | if (fadc->GetMode()==2) |
||
64 | cout<<"do something else"; |
||
65 | </pre> |