ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitEdm/DataFormats/interface/BasePartAction.h
Revision: 1.2
Committed: Fri Aug 29 00:27:21 2008 UTC (16 years, 8 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.1: +2 -2 lines
Log Message:
A bit of cleanup.

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.2 // $Id: BasePartAction.h,v 1.1 2008/07/29 13:16:22 loizides Exp $
3 loizides 1.1 //
4     // BasePartAction
5     //
6     // This abstract base class has been created to help people with recursive descent of a Particle
7     // Decay Graph. Instead of writing a recursive subroutine or member function, define a subclass of
8     // this class. The subclass should provide a handler for both decay particles and stable particles.
9     //
10     // Recursion occurs when a client invokes:
11     //
12     // DecayPart *particle;
13     // particle = ....
14     // particle->doAction(Action);
15     //
16     // Then, the handle functions are called once per particle as the action is passed up or down the
17     // Particle Decay Graph. A non-recursive action has also been implemented.
18     //
19 loizides 1.2 // Authors: C.Paus
20 loizides 1.1 //--------------------------------------------------------------------------------------------------
21    
22     #ifndef MITEDM_BASEPARTACTION_H
23     #define MITEDM_BASEPARTACTION_H
24    
25     namespace mitedm
26     {
27     class BasePart;
28     class DecayPart;
29     class StablePart;
30    
31     class BasePartAction
32     {
33     public:
34     // Define the type of the action
35     enum ActionType { BottomUp, TopDown, NonRecursive };
36    
37     // Constructor
38     BasePartAction(ActionType aType);
39    
40     // Destructor
41     virtual ~BasePartAction();
42    
43     // Handle Generic Particles
44     virtual void doAction(const BasePart* part);
45    
46     // Handle Decaying Particles
47     virtual void doAction(const DecayPart* part) = 0;
48    
49     // Handle Stable Particles
50     virtual void doAction(const StablePart* part) = 0;
51    
52     // Recursion level
53     void incLevel () { level_++; }
54     void decLevel () { level_--; }
55     int getLevel () const { return level_; }
56     ActionType getActionType() const { return actionType_; }
57    
58     private:
59     // What type of action
60     ActionType actionType_;
61     // Remember how deep we are in there
62     int level_;
63     };
64     }
65     #endif