// ESAF : Euso Simulation and Analysis Framework // $Id: TriggerEngine.hh,v 1.14 2005/11/10 10:36:18 pesce Exp $ // M. Pallavicini created Oct, 24 2003 // Base class for any triggering algorythm // It acts as a visitor (friend class) of MacroCellData // #ifndef __TRIGGERENGINE_HH_ #define __TRIGGERENGINE_HH_ #include #include "euso.hh" #include "EsafConfigurable.hh" #include "EsafMsgSource.hh" #include "Etypes.hh" class MacroCellData; class TriggerEngine : public EsafConfigurable, public EsafMsgSource { public: // ctor TriggerEngine(const string& name, ETriggerTypeIdentifier); // dtor virtual ~TriggerEngine(); // factory method for engines static map &GetEngines( ETriggerTypeIdentifier ); // return engine name inline const string& GetName() const { return fName; } // simulate trigger virtual void Simulate( MacroCellData* ) = 0; // true if we got a trigger inline Bool_t HasTriggered() const { return fHasTriggered; } // get trigger word (bitfield for all trigger engines) static Int_t GetTriggerWord() {return fTriggerWord;} // reset trigger word static void ResetTriggerWord() {fTriggerWord=0; fTrgWords.clear();} //get trgwords static const map& GetTrgWords() {return fTrgWords;} // get gtu at which trigger occurred inline Int_t GetGtuTrigger() const { return fGtuTrigger;} EsafConfigClass(Electronics,TriggerEngine); protected: // set trigger flag reserved to child classes inline void SetTrigger() { fHasTriggered = kTRUE; fTriggerWord |= (Int_t)GetTriggerId(); } void SetTrigger(Int_t word); // get trigger id reserved to child classes inline Int_t GetTriggerId() const { return fTrgId;} // set gtu trigger inline void SetGtuTrigger(Int_t gtu) { fGtuTrigger = gtu; } private: // name of this engine string fName; // trigger id for this engine ETriggerTypeIdentifier fTrgId; // true if triggered occurred Bool_t fHasTriggered; // gtu at which trigger occurred Int_t fGtuTrigger; // factory method for trigger engines // right now designed to provide the same trigger structure for all // macrocells static map *fEngines; // trigger word is the same for all engines // bit field of ETriggerTypeIdentifier static Int_t fTriggerWord; //trigger word map for triggers with multiple config running in parallel static map fTrgWords; ClassDef(TriggerEngine,0) }; #endif /* __TRIGGERENGINE_HH_ */