GSI Forum - RDF feed
https://forum.gsi.de/index.php
FinishTask() funktion for uninitialized Tasks -> Bug or feature?
https://forum.gsi.de/index.phpindex.php?t=rview&goto=20145&th=5221#msg_20145
Currently I'm programming a few new Classes/ Tasks for PandaRoot, and realized the following behavior.
In my "Init()" function I implemented some checks and if they fail a "kERROR" is returned. (mainly if the needed input Branches are not found)
As expected for this "uninitialized" Tasks the "Task::Exec()" is not processes subsequently.
BUT the Task::FinishTask() function is still called, which leads to a segmentation violation in my case, although this is exactly what I want to avoid by doing this checks during the initialization.
Is this working as expected?
regards Dominik]]>Dominik Steinschaden2017-01-18T14:29:01-00:00Re: FinishTask() funktion for uninitialized Tasks -> Bug or feature?
https://forum.gsi.de/index.phpindex.php?t=rview&goto=20148&th=5221#msg_20148
Although I'm no expert I think this behavior is ok. You want to have the possibility to remove the traces of your Task even if the initialization fails. In principal you can re-initialize correctly after the change of the run.
There is a FairSoft part on the GSI forums, so the question should be asked there, too.
Cheers!
Ralf]]>Ralf Kliemt2017-01-18T14:35:46-00:00Re: FinishTask() funktion for uninitialized Tasks -> Bug or feature?
https://forum.gsi.de/index.phpindex.php?t=rview&goto=20152&th=5221#msg_20152
so thanks for the answer.
I will just rearrange my Init() function. My plan was to first do the checks and if everything goes fine then all needed variables are initialized. therefore if the checks fail, the variables are not initialized for the finishTask()
Just wanted to save resources . . .]]>Dominik Steinschaden2017-01-18T14:42:16-00:00Re: FinishTask() funktion for uninitialized Tasks -> Bug or feature?
https://forum.gsi.de/index.phpindex.php?t=rview&goto=20154&th=5221#msg_20154
There is also a FairTask::Finish() method, that is only called if the task is initialized...
yours
radek]]>Radoslaw Karabowicz2017-01-18T14:46:25-00:00Re: FinishTask() funktion for uninitialized Tasks -> Bug or feature?
https://forum.gsi.de/index.phpindex.php?t=rview&goto=20155&th=5221#msg_20155
Radoslaw Karabowicz2017-01-18T15:05:01-00:00Re: FinishTask() funktion for uninitialized Tasks -> Bug or feature?
https://forum.gsi.de/index.phpindex.php?t=rview&goto=20159&th=5221#msg_20159
I do not know your code but it would be very easy either to save the output of Init() in a variable and put the FinishTask() part in an if-statement or have your pointers initialized to 0 (as you always should do) and check for that in your FinishTask().
Cheers,
Tobias
]]>Tobias Stockmanns2017-01-18T15:27:53-00:00Re: FinishTask() funktion for uninitialized Tasks -> Bug or feature?
https://forum.gsi.de/index.phpindex.php?t=rview&goto=20162&th=5221#msg_20162
a good praxis (or maybe THE praxis) is to initialize the variables in the constructor, and not in the Init function:
In this way also the compiler helps you to find what is missing. Variables should be never left uninitialized. Once you have them initialized, in the Init you can set the proper values, or leave them as they are, and you won't have problems in the FinishTask.
]]>StefanoSpataro2017-01-18T15:51:35-00:00Re: FinishTask() funktion for uninitialized Tasks -> Bug or feature?
https://forum.gsi.de/index.phpindex.php?t=rview&goto=20167&th=5221#msg_20167
Just for interested persons: the variable causing the problems was a pointer to a TClonesArray which is used to write the data into the outputfile.
And If no Output is generated I want to avoid to register an output branch. I will just use an additional If statement in the FinishTask() as suggested.
Dominik]]>Dominik Steinschaden2017-01-19T09:42:48-00:00Re: FinishTask() funktion for uninitialized Tasks -> Bug or feature?
https://forum.gsi.de/index.phpindex.php?t=rview&goto=20172&th=5221#msg_20172