#ifndef TControlSampleBase_h #define TControlSampleBase_h #include #include #include #include #include #include #include #include /// Base class for set of classes that will select particular events. /// The base class takes care of providing the file name to the executable. /// /// Derived classes must implement the method IsEventSelectedInternal(event) /// which should return true if this event is selected. class IControlSampleBase{ public: IControlSampleBase(std::string SamplName, int Prescale=1); virtual ~IControlSampleBase(){;}; bool IsEventSelected(COMET::ICOMETEvent& event) ; int GetEnable() { return fEnable; } void SetPrescale(int i) { fPrescale = i; } int GetPrescale() { return fPrescale;} // Add a trigger to the list used by the TControlSample void AddValidTrigger(COMET::Trigger::Bits t) { fValidTriggerMask |= t; } // Get the triggers used by the TControlSample unsigned int GetValidTrigger() { return fValidTriggerMask; } // Clear the triggers used by the TControlSample; void ClearValidTrigger() { fValidTriggerMask = 0; } void SetFileName(std::string s) { fFileName = s; } std::string GetFileName() const { return fFileName; } // Make histogram file? void SetMakeHistoFile(bool b) { fMakeHistoFile = b; } bool MakeHistoFile() { return fMakeHistoFile; } void SetHistoFileName(std::string s) { fHistoFileName = s; } void OpenHistoFile(std::string s); std::string GetSampleName(){return fSampleName;}; void EndJob(); protected: /// This is the function that derived classes must implement. /// It should return true if the event should be selected. virtual bool IsEventSelectedInternal(COMET::ICOMETEvent& event)=0; /// method to initailize histograms virtual void InitHistograms() { }; /// Flag to enable the control sample int fEnable; /// The prescaling factor for this particular control sample. int fPrescale; int fSelectedEvents; /// The name for this particular sample. std::string fSampleName; /// Verbosity Level int fVerbose; /// Generate diagonstic histogram file int fMakeHistoFile; /// Histogram file name std::string fHistoFileName; /// File name std::string fFileName; /// the Histogram file TFile* fHistoFile; private: // Make private so that derived classes must specify a sample name. IControlSampleBase(){}; unsigned int fValidTriggerMask; }; #endif