--- PamCut/doc/PamCutDevGuide.tex 2009/06/15 14:44:01 1.3 +++ PamCut/doc/PamCutDevGuide.tex 2009/10/27 10:24:36 1.5 @@ -16,18 +16,19 @@ inherits form {\bf PamCut} and provides an implementation for the pure virtual method {\bf Check}. A special derived class is {\bf PamCutCollection}. This is a sort of a -container for basic cuts, and is considered as a single cut. Its {\bf Check} +container for basic cuts, and is considered as a single cut. It has an {\bf +AddCut} method which will add a cut to the collection. Its {\bf Check} implementation simply invokes all the {\bf Check}s of the single cuts, and it -is successful if all the single cuts are succesful. -{\bf PamCut} also provides the interface for two methods for post-processing: -{\bf OnGood} and {\bf OnBad}. In derived classes these can contain specific -tasks to be performed whenever an event satisfy the {\bf Check} condition or -not. The method {\bf ApplyCut} takes care of invoking {\bf Check} and -subsequently calls {\bf OnGood} or {\bf OnBad} according to the result of {\bf Check}. -Summarizing, {\bf Check}ing an event simply means to ask the object if the -event satisfy the selection criteria; applying a cut means to check and then -perform post-selection tasks. The cut can be applied to a bunch of events by -means of the {\bf Process} method. +is successful if all the single cuts are succesful. {\bf PamCut} also provides +the interface for two methods for post-processing: {\bf OnGood} and {\bf +OnBad}. In derived classes these can contain specific tasks to be performed +whenever an event satisfy the {\bf Check} condition or not. The method {\bf +ApplyCut} takes care of invoking {\bf Check} and subsequently calls {\bf +OnGood} or {\bf OnBad} according to the result of {\bf Check}. Summarizing, +{\bf Check}ing an event simply means to ask the object if the event satisfy +the selection criteria; applying a cut means to check and then perform +post-selection tasks. The cut can be applied to a bunch of events by means of +the {\bf Process} method. \subsection{More on collections} A collection is an object which inherits from {\bf PamCutCollection}, which in @@ -67,6 +68,18 @@ {\bf PamCutCollection}. See the Doxygen html documentation for more info about {\bf BlindCutCollection} and other specific cut implementations. +\subsection{Collections and memory management} + +Regarding to cuts ownership, a collection will by default own its cuts. This +means that when you add a cut to a collection calling {\bf AddCut} with a +pointer to the cut as argument, the collection will store this pointer and +will take charge of deleting it. This is done by the collection's destructor. +This way, a user can simply add a cut to a collection and forget about +deleting it. However, sometimes this feature is not desirable, so it can be +turned off by passing a proper value to the collection's constructor. In this +case, the user is in charge of managing the memory allocated for the cuts. + + \section{Actions and the SmartCollection} When performing an analysis, each time an event is selected as good some actions are likely to be performed, like filling histograms or writing a @@ -81,7 +94,7 @@ implementations will be called actions.\\ Actions are automatically handled by the {\bf SmartCollection} class. It inherits from {PamCutCollection}, and contains a vector of {\bf -CollectionAction} objects. These actions can be added using {\bf +CollectionAction} objects. These actions can be added calling {\bf SmartCollection::AddAction}; for each of them, the collection will take care of calling {\bf Setup} at the beginning of the analysis, {\bf OnGood} and {\bf OnBad} for every event (depending on the selection result), and {\bf Finalize} @@ -123,6 +136,12 @@ Loosely speaking, after defining an action one simply has to instantiate it, add it to a {\bf SmartCollection} and launch the analysis. +\subsection{SmartCollections and memory management} +Like the standard collection, SmartCollection can handle the memory management +for actions. This works exactly as for cuts. Cuts and actions have to be +managed uniformly, ie., one cannot turn off ownership only for cuts or only for +actions. + \section{The software organization} The software is organized in a tree of directories. The idea is that each node of this tree must provide the necessary informations about the sub-branches. In @@ -563,7 +582,7 @@ . . - PamCutCollection collection; + PamCutCollection collection("Collection"); DummyCut1 dummy1; collection.AddCut(dummy1);