Presentation on theme: "Code Review Offline Week Piotr Krzysztof Skowroński 10 March 2004."— Presentation transcript:
Code Review Offline Week Piotr Krzysztof Skowroński 10 March 2004
2P. K. Skowroński Offline Week March March 2004 Loaders misusage Offten loaders are accessed and used completely differently than intendend Instead of taking data from the folder with proper NAME people grab the first global pointer they can find: //Ha!, they moved TreeX() from gAlice to Loader, bud gAlice has the pointer! gAlice->GetRunLoader()->....//bad //Gotya!, we have another global pointer AliRunLoader::GetRunLoader()->...//bad AliRunLoader::GetRunLoader(name)//good We should remove the possibilities of the bad usage With the cost of some software redesign, f.e. hits that get access to geometry
3P. K. Skowroński Offline Week March March 2004 Deleted objects taken from whiteboard We should consider hiding whiteboard from public access Reimplement it inside loaders Return const& instead of pointer Anyway everybody uses loader‘s shortcut methods to access data It is easier to debug in case an object is deleted Maybe people will think a little bit before deleting they must cast reference to pointer before doing that
4P. K. Skowroński Offline Week March March 2004 Loader gives too many possibilities Yes, list of public methods in loader is very long It can be minimized to only few But than user would have to do things like this: fLoader->GetDataLoader(”Hits”)->Load(”read”); fLoader->GetDataLoader(”Digits”)-> GetTaskLoader->Load(”read”); Look at the header files and consider carefully what should be thrown away
5P. K. Skowroński Offline Week March March 2004 Remnestants of the OldIO Methods like AliRun::TreeE(), AliRun::TreeS(), etc. are made being shortcuts to AliRunLoader or MayNotUse(), just not to be forced to go through all the code by one or two people Detector responsibles were supposed to remove it from the code AliRoot is full of the lines like gAlice->TreeD() We should remove these methods from AliRun immediately
6P. K. Skowroński Offline Week March March 2004 Global Pointers We could consider removal of all global pointers in AliRoot, including gAlice gAlice is really indispensable only in „hitisation” phase Detectors can be accessed via RunLoader and stored just as an array The same with the geometry Especially that modeler is going to be introduced shortly MCApp could be accessed via loader or like a singleton In simulation there can not be present more than one MC application at one time? Data of MCApp can be written to AliHeader (TreeE) I know that global pointers are comfortable in usage, but you can not even imagine how much time Peter spends on debugging stuff connected with „data taken from the space” when making AliRoot really working Comments?
7P. K. Skowroński Offline Week March March 2004 Data containers It is true that we do not have uniform way of handling data containers that are written to the trees Some still have them in the detector object (ITS) Some have them in loaders (PHOS) Some others have this scattered all around the code When poor developer wants to decouple sth. from detector do not really know how to do it I propose to put them in loader, since filling containers is always connected with data loading Overloading Post() method seems to be the best solution Look at the PHOS Loader But not at PHOS Getter!!!!!!!! Comments?
8P. K. Skowroński Offline Week March March 2004 What is AliStream AliStack is an utility class used by Run Digitizer to manipulate I/O Opening sessions (Run Loader) Pushing next event Error checking in I/O manipulation Nacely encapsulates this functionality and decouple from Run Loader
9P. K. Skowroński Offline Week March March 2004 AliStram – why NOT get rid of it At the moment you throw it away you will start to think about reimplementing it with a different name 95% of its code is going to be moved to Run Digitizer Run Digitizer are going to cope with arrays of Run Loaders and file names managing opening sessions (of a given signal/background) getting the next event (of a given signal/background) deleting session (of a given signal/background) error checking, etc And you loose functionality that is aready implemented and debugged Maybe chaining many signal and/or background directories is not used in practice, but... What you gain ? If you do not like sth. in the AliStream, maybe consider redesign?