Closed AndrewEdmonds11 closed 10 years ago
The reason I'm reluctant to change the generator's constructor is because by keeping them all the same as the modules' constructors I can reuse a lot of code.
The code from MakeAnalysedPulses::BeforeFirstEntry
responsible for instantiating the generators is:
203 // Get the requested generator
204 TVAnalysedPulseGenerator* generator=
205 TAPGeneratorFactory::Instance()->createModule(generatorType,opts);
206 if(!generator) return false;
207 generator->SetChannel(detector);
There are 2 ways I could improve this, and in the end it might be worth doing both:
Add the channel's name as an option that get's passed in:
203 // Get the requested generator
204 opts->SetOption("channel",detector);
205 TVAnalysedPulseGenerator* generator=
206 TAPGeneratorFactory::Instance()->createModule(generatorType,opts);
Initialise
method to the generators equivalent to BeforeFirstEntry for modules. I would call it immediately after the constructor. This is a bit more convenient if we want restructure things, though it may not be used very often at this point.Cool. It's nice that you have ideas to implement.
Do you think it is a massive slow-down having the retrieval of parameters and creation of the Algorithms in the ProcessPulses
function though? From a conceptual point of view it would be nice to move these things into the constructor but if it's not worth it then there's no point in making any extra work for ourselves?
Do you think it is a massive slow-down having the retrieval of parameters and creation of the Algorithms in the ProcessPulses function though?
As long as it's a one off operation that's only called on the first loop the effect of keeping this in the ProcessPulses
method would be small and potentially zero if the compiler optimises this (though I really don't know enough of that to be sure).
I can very easily add the channel name to the options passed in though. Then you can work in the constructor as you'd like. I'll call the option channel_name
which I assume is not being used as the option to any generator at the moment.
We can just keep in mind the option of an Init
method for the future, though I won't add it now.
Cool. Thanks, Ben. That makes things easier.
This is done on develop.
As mentioned in pull request #211, I have a question about the TAP generators. Here's what I wrote:
@benkrikler, I guess you're the best person to answer.