Diana Software
MMyModule.cc
Go to the documentation of this file.
1 #include "MMyModule.hh"
2 #include "QEvent.hh"
3 #include "QEventList.hh"
4 
5 
7 
8 using namespace Diana;
9 
11 {
12  /* This method is called before event loop.
13  * Here you can:
14  * 1) Get parameters from cfg (see QBaseModule.hh):
15  *
16  * GetDouble("parname",defaultVal);
17  * GetInt("parname",defaultVal);
18  * GetBool("parname",defaultVal);
19  * GetString("parname",defaultVal);
20  *
21  * 2) Add new QObjects to the QEvent (see QEvent.hh):
22  *
23  * ev.Add<QObjectType>("name");
24  *
25  * 3) Set aliases for added objects (see QEvent.hh):
26  *
27  * ev.SetAlias("name","path_in_object","alias");
28  *
29  * 4) Require the presence in the QEvent of the QObjects
30  * that will be read in the Do():
31  *
32  * ev.Require<QObjectType>("owner","name"); or
33  * ev.RequireByLabel<QObjectType>("owner@name");
34  *
35  * 5) Read/Write global data (see QGlobalDataManager.hh / QGlobalHandle.hh):
36  *
37  * GlobalHandle<QObjectType> ghandle("name");
38  * handle.SetChannel(3); // if needed
39  * GlobalData().Get("owner",&ghandle,"DB"); // instead of "DB", you can specify "filename" for file or "" for cached objects.
40  * const QObjectType& gobject = ghandle.Get();
41  *
42  * GlobalHandle<QObjectType> myghandle("name");
43  * myghandle.SetChannel(3); // if needed
44  * myghandle.SetRun(809); // if needed, note that the run number is not available from the event in the Init()
45  * myghandle.Set(object); // object is of type QObjectType
46  * GlobalData().Set(&myghandle,"filename.root");
47  *
48  * 5) Operate on the sequence execution parameters(see QBaseModule.hh) :
49  *
50  * SetRunAgain(); // set to rerun the sequence at the end of the event loop
51  * GetIteration(); // number of sequence (re)iteration
52  * GetRunAgain(); // check if the sequence will be rerun
53  */
54 }
55 
56 //void MMyModule::Do(QEvent& ev, const QEventList& neighbours)
58 {
59  /* This method is called event by event.
60  * The list of neighbours is filled only if activated in
61  * the reader cfg (see QReader.hh, option "NeighboursOn").
62  * Use the interface with neighbours declaration in place of this one if neighbours are needed.
63  * Here you can:
64  * 1) Read QObjects owned by other modules (should match the required QObjects in Init()):
65  *
66  * const QObjectType& object = ev.Get<QObjectType>("owner","name"); or
67  * const QObjectType& object = ev.GetByLabel<QObjectType>("owner@name");
68  *
69  * 1b) Read QObjects owned by other modules from neighbour events (if this interface contains neighbours):
70  * for(size_t i = 0; i < neighbours.Size(); i++) {
71  * const QObjectType& n_object = neighbours[i].Get<QObjectType>("owner","name"); or
72  * const QObjectType& n_object = neighbours[i].GetByLabel<QObjectType>("owner@name");
73  * }
74  * 2) Write QObjects owned by this module:
75  *
76  * QObjectType& myObject = ev.Get<QObjectType>("name");
77  * myObject = ...
78  *
79  * 3) Read/Write global data.
80  *
81  * 4) Operate on the sequence execution parameters(see QBaseModule.hh).
82  */
83 }
84 
86 {
87  /* This method is called at the end of the event loop.
88  * Here you can:
89  *
90  * 1) Operate on the sequence execution parameters(see QBaseModule.hh).
91  *
92  * 2) Read/Write global data.
93  */
94 }
95 
#define REGISTER_MODULE(clazz)
Definition: QDriver.hh:133
one-line description of your module
Definition: MMyModule.hh:40
void Init(Diana::QEvent &ev)
Init method.
Definition: MMyModule.cc:10
void Done()
Done method.
Definition: MMyModule.cc:85
void Do(Diana::QEvent &ev)
Do method. Declare and implement only one of the two versions.
Definition: MMyModule.cc:57
diana event
Definition: QEvent.hh:46
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...