/** BeamMonBaseModule
 *
 * Base class for job modules that produce beam monitoring histograms
 * for use in the CDFMonitoringFwk.
 *
 * Available configuration parameters:
 *
 *  folder: (string) set the base folder in which to put histograms
 *  and other publishable objects.  Default is "Monitoring"
 *
 * Sub classes may have further configuration parameters.
 */


#ifndef BEAMMONBASEMODULE_H
#define BEAMMONBASEMODULE_H

#include <JobControl/JobCModule.h>
#include <HistMan/HistMan.h>
#include <Registry/Registry.h>

class MomNavigator;
class RawBeamMonBlock;
class RawBeamMonHeaderBlock;
class Registry;

class BeamMonBaseModule : public JobCModule {
public:
    BeamMonBaseModule();
    virtual ~BeamMonBaseModule();

    JobCResult Ana(const MomNavigator *mom);

    /// Return default config.  Subclasses may inherit from this but should
    /// call the non-const version and add parameters to that registry.
    virtual const Registry& DefaultConfig() const;

    /// Get a HistMan rooted on the folder set by the "folder" config
    /// parameter.
    HistMan GetHistMan();

protected:

    /// Sub class can call this to get non-const config Registry to which
    /// the subclass can add any subclass specific configuration
    Registry& DefaultConfigWritable() const;

    /// Subclass implements to visit each RawBeamMonBlock to fill
    /// histograms.  Booking should be done in BeginJob().
    virtual void Fill(const RawBeamMonHeaderBlock& header, const RawBeamMonBlock& block) = 0;

private:
    mutable Registry fConfig;

    //ClassDef(BeamMonBaseModule,1)

};

#endif  // BEAMMONBASEMODULE_H
