1 #ifndef ALITRIGSCHEDULER_H
2 #define ALITRIGSCHEDULER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
7 // Author: Andrei Gheata, 27/07/2009
13 //==============================================================================
15 // AliTrigScheduledGroup - A group of scheduled entries that will simply be
16 // fired-up sequentially. The group delay in global time
17 // units is the latest start time of the contained
18 // entries. A group has a priority assigned by the
19 // owner scheduler object. Groups are fired-up according
20 // a programable sequence.
22 //==============================================================================
25 class AliTrigScheduledEntry;
26 class AliTrigScheduler;
28 //______________________________________________________________________________
29 class AliTrigScheduledGroup : public TNamed {
32 Int_t fPriority; // Group priority
33 Int_t fDelay; // Group max. delay.
34 TObjArray *fEntries; // List of scheduled entries
37 AliTrigScheduledGroup(const AliTrigScheduledGroup &other);
38 AliTrigScheduledGroup &operator=(const AliTrigScheduledGroup &other);
41 AliTrigScheduledGroup();
42 AliTrigScheduledGroup(const char *name, Int_t priority=0);
43 virtual ~AliTrigScheduledGroup();
45 void AddEntry(AliTrigScheduledEntry *entry);
46 void FireUp(Int_t time);
47 TObjArray *GetScheduledEntries() const {return fEntries;}
48 Int_t GetNentries() const;
49 Int_t GetPriority() const {return fPriority;}
50 Int_t GetDelay() const {return fDelay;}
51 virtual void Print(Option_t *option) const;
52 void RemoveEntry(AliTrigScheduledEntry *entry);
53 void SetPriority(Int_t priority) {fPriority = priority;}
55 ClassDef(AliTrigScheduledGroup, 1) // Groups of scheduled response functions
58 //==============================================================================
60 // AliTrigScheduledSequence - A programable group sequence. Scheduled groups
61 // are owned and controlled by a trigger scheduler. They
62 // are fired-up in such a sequence. A sequence supports some
63 // default modes but can also be programed manually.
65 //==============================================================================
67 //______________________________________________________________________________
68 class AliTrigScheduledSequence : public TNamed {
81 AliTrigScheduler *fScheduler; // Scheduler to which the sequence applies
82 Int_t fNgroups; // Number of groups
83 ESortingType fType; // Sorting type
84 Int_t *fArray; //[fNgroups] Array specifying the sequence
87 AliTrigScheduledSequence(const AliTrigScheduledSequence &other);
88 AliTrigScheduledSequence &operator=(const AliTrigScheduledSequence &other);
89 void SortArray(Int_t *array, Bool_t increasing);
92 AliTrigScheduledSequence();
93 AliTrigScheduledSequence(const char *name, AliTrigScheduler *scheduler);
94 virtual ~AliTrigScheduledSequence();
96 Int_t *GetArray() const {return fArray;}
97 Int_t GetNgroups() const {return fNgroups;}
98 AliTrigScheduler *GetScheduler() const {return fScheduler;}
99 ESortingType GetSortingType() const {return fType;}
100 virtual void Print(Option_t *option) const;
101 void Sort(ESortingType type, Int_t *sequence=0);
103 ClassDef(AliTrigScheduledSequence, 1) // Class for a scheduled group sequence
106 //==============================================================================
108 // AliTrigScheduler - Device response function scheduler. Every device has a
109 // scheduler, but the same scheduler can replay responses of
110 // several devices. A scheduler holds groups of scheduled
111 // entries. The groups can be replayed in programable
112 // sequences. A default group and sequence are always created.
114 //==============================================================================
116 class AliTrigScheduledGroup;
117 class AliTrigScheduledSequence;
119 //______________________________________________________________________________
120 class AliTrigScheduler : public TNamed {
123 Int_t fNgroups; // Number of scheduled groups (at least one)
124 TObjArray *fGroups; // List of groups of response functions
125 TObjArray *fSequences; // List of group replay sequences
126 AliTrigScheduledSequence *fCurrentSequence; // Current group replay sequence
129 AliTrigScheduler(const AliTrigScheduler &other);
130 AliTrigScheduler &operator=(const AliTrigScheduler &other);
134 AliTrigScheduler(const char *name);
135 virtual ~AliTrigScheduler();
137 void AddScheduledEntry(AliTrigScheduledEntry *entry, const char *togroup="default");
138 AliTrigScheduledGroup *AddGroup(const char *groupname);
139 AliTrigScheduledGroup *AddGroup(AliTrigScheduledGroup *group);
140 AliTrigScheduledSequence *AddSequence(const char *seqname, AliTrigScheduledSequence::ESortingType type=AliTrigScheduledSequence::kDefault,
141 Int_t *sequence = 0);
142 void FireUp(Int_t time);
143 AliTrigScheduledSequence *GetCurrentSequence() const {return fCurrentSequence;}
144 Int_t GetNgroups() const {return fNgroups;}
145 TObjArray *GetScheduledGroups() const {return fGroups;}
146 AliTrigScheduledGroup *GetScheduledGroup(Int_t i) const;
147 AliTrigScheduledGroup *GetScheduledGroup(const char *name) const;
148 void SetCurrentSequence(AliTrigScheduledSequence *seq) {fCurrentSequence = seq;}
149 void SetGroupPriority(const char *groupname, Int_t priority);
151 ClassDef(AliTrigScheduler,1) // Trigger scheduler class