/** @file CbmDigitize.h ** @author Volker Friese ** @date 01.06.2018 **/ #ifndef CBMDIGITIZE_H #define CBMDIGITIZE_H 1 #include "FairTask.h" class CbmDaq; class CbmDigi; class CbmMatch; /** @class CbmDigitize ** @brief Abstract base class for CBM digitisation tasks ** @author Volker Friese ** @date 01 June 2018 ** ** Derived classes have to implement the abstract method WriteDigi. **/ class CbmDigitize : public FairTask { public: /** @brief Constructor **/ CbmDigitize(); /** @brief Constructor with name ** @param name Task name **/ CbmDigitize(const char* name); /** @brief Destructor **/ virtual ~CbmDigitize(); /** @brief Fill custom data into time slice ** @param fillTime Time until data can be filled ** @param limit If kTRUE, only data up to fillTime will be treated; otherwise, all. ** ** This method allows the digitizer to implement additional functionality ** than writing digis and match objects. It will be called from CbmDaq. **/ virtual void FillCustomData(Double_t /*fillTime*/, Bool_t /*limit*/ = kTRUE) { } /** @brief Get event information **/ void GetEventInfo(); /** @brief Current event time ** @value Start time of current event [ns] **/ Double_t GetEventTime() const { return fCurrentEventTime; } /** @brief Send a digi object to the DAQ ** @param digi Pointer to digi object ** ** Ownership is passed. The digi object will be deleted by CbmDaq. **/ void SendDigi(CbmDigi* digi); /** @brief Send a digi and the corresponding match object to the DAQ ** @param digi Pointer to digi object ** @param match Pointer to match object ** ** Ownership is passed with the objects. The will be deleted by CbmDaq. **/ void SendDigi(CbmDigi* digi, CbmMatch* match); /** @brief Set creation of links to MC ** @param Choice If kTRUE, the match objects will be created **/ void SetCreateMatches(Bool_t choice = kTRUE) { fCreateMatches = choice; } /** @brief Set the DAQ instance **/ void SetDaq(CbmDaq* daq) { fDaq = daq; } /** @brief Set event-by-event mode ** @param Choice If kTRUE, the digitizer will run in event-by-event mode **/ void SetEventMode(Bool_t choice = kTRUE) { fEventMode = choice; } /** @brief Set production of inter-event noise ** @param Choice If kTRUE, the digitizer will produce noise **/ void SetProduceNoise(Bool_t choice = kTRUE) { fProduceNoise = choice; } /** @brief Reset the output arrays ** ** This method is called from CbmDaq after a tree->Fill is triggered. ** To be implemented by the derived class. **/ virtual void ResetArrays() = 0; /** @brief Write a digi object to the output array ** @param digi Pointer to digi object ** ** A copy of the digi object has to be created and inserted into ** the output array registered to the FairRootManager in the Init method. ** The corresponding match object has to be treated accordingly. ** This method will be called from CbmDaq. **/ virtual void WriteDigi(CbmDigi* digi, CbmMatch* match = nullptr) = 0; protected: Bool_t fEventMode; /// Flag for event-by-event mode Bool_t fProduceNoise; /// Flag for production of inter-event noise Bool_t fCreateMatches; /// Flag for creation of links to MC Int_t fCurrentInput; Int_t fCurrentEvent; Int_t fCurrentMCEntry; Double_t fCurrentEventTime; CbmDaq* fDaq; //! Pointer to DAQ for data transport private: /** @brief Copy constructor forbidden **/ CbmDigitize(const CbmDigitize&) = delete; /** @brief Assignment operator forbidden **/ void operator=(const CbmDigitize&) = delete; ClassDef(CbmDigitize, 1); }; #endif /* CBMDIGITIZE_H */