Commit 4fb78a28 authored by Alex Pearce's avatar Alex Pearce
Browse files

added DAQ/DAQKernel from LHCb (LHCb/v41r0)

parent 72997283
......@@ -25,3 +25,6 @@
[lb-checkout "LHCb.Event/DAQEvent"]
base = 62d0daf5f20c4e9f1beb97ec47d906fc223f27d1
imported = 26b40caca408e53f5959c238cd35d37f88411761
[lb-checkout "LHCb.DAQ/DAQKernel"]
base = 72997283dd8ce1c05c699ab0b0a349546b407c5a
imported = 26b40caca408e53f5959c238cd35d37f88411761
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>DAQKernel</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
################################################################################
# Package: DAQKernel
################################################################################
gaudi_subdir(DAQKernel v1r1)
gaudi_depends_on_subdirs(Event/DAQEvent
GaudiAlg
GaudiUtils
Kernel/LHCbKernel)
message(STATUS "CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}")
gaudi_add_library(DAQKernelLib
src/lib/*.cpp
PUBLIC_HEADERS DAQKernel
LINK_LIBRARIES DAQEventLib GaudiAlgLib GaudiUtilsLib LHCbKernel)
//-----------------------------------------------------------------------------
/** @file DecoderAlgBase.h
*
* Header file for algorithm base class : Decoder::AlgBase
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 05/04/2002
*/
//-----------------------------------------------------------------------------
#ifndef DAQKERNEL_DECODERALGBASE_H
#define DAQKERNEL_DECODERALGBASE_H 1
// GaudiAlg
#include "GaudiAlg/GaudiAlgorithm.h"
// local
#include "DAQKernel/DecoderCommonBase.h"
namespace Decoder
{
//-----------------------------------------------------------------------------
/** @class AlgBase DAQAlgBase.h DAQKernel/DecoderAlgBase.h
*
* Abstract base class for DAQ algorithms providing
* some basic functionality.
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 02/10/2014
*/
//-----------------------------------------------------------------------------
class AlgBase : public Decoder::CommonBase<GaudiAlgorithm>
{
public:
/// Standard constructor
AlgBase( const std::string& name,
ISvcLocator* pSvcLocator )
: Decoder::CommonBase<GaudiAlgorithm> ( name, pSvcLocator ) { }
protected:
protected:
///avoid getIfExists name resolution for now
virtual inline LHCb::RawEvent* getIfExistsRaw(const std::string loc, bool rootOnTes) const
{
return GaudiAlgorithm::getIfExists<LHCb::RawEvent>(loc,rootOnTes);
}
/// override getIfExists to aid the name resolution?
//template < class TYPE > inline typename Gaudi::Utils::GetData<TYPE>::return_type getIfExists (
// IDataProviderSvc* svc ,
// const std::string& location ,
// const bool useRootInTES = true
// ) const
//{ return GaudiAlgorithm::getIfExists<TYPE> ( svc , location , useRootInTES ) ; }
/// override getIfExists to aid the name resolution?
//template < class TYPE > inline typename Gaudi::Utils::GetData<TYPE>::return_type getIfExists (
// const std::string& location ,
// const bool useRootInTES = true
// ) const
//{ return GaudiAlgorithm::getIfExists<TYPE> ( this->GaudiAlgorithm::evtSvc() , location , useRootInTES ) ; }
};
}
#endif // DAQKERNEL_DECODERALGBASE_H
//-----------------------------------------------------------------------------
/** @file DecoderCommonBase.h
*
* Header file for DAQ base class : Decoder::CommonBase
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 2005-08-27
*/
//-----------------------------------------------------------------------------
#ifndef DAQKERNEL_DECODERCOMMONBASE_H
#define DAQKERNEL_DECODERCOMMONBASE_H 1
//disable unused variable warnings which occur for every enum and string in RawEvent.h
//#pragma GCC diagnostic push
//#pragma GCC diagnostic "-Wunused-variable"
#include "Event/RawEvent.h"
//#pragma GCC diagnostic pop
namespace Decoder
{
//using GaudiUtils::operator<<;
//-----------------------------------------------------------------------------
/** @class CommonBase DecoderCommonBase.h DAQKernel/DecoderCommonBase.h
*
* Base class providing common functionality for all Decoder tools and algorithms
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 2014-02-10
*/
//-----------------------------------------------------------------------------
template <class PBASE>
class CommonBase : public PBASE
{
public:
/// Standard algorithm-like constructor
CommonBase( const std::string& name,
ISvcLocator* pSvcLocator );
/// Standard tool-like constructor
CommonBase( const std::string& type,
const std::string& name,
const IInterface* parent );
/// Standard Converter-like Constructor
CommonBase( long storage_type,
const CLID &class_type,
ISvcLocator *svc = NULL );
/// Destructor
virtual ~CommonBase( );
public:
/** Initialization of the algorithm after creation
*
* @return The status of the initialization
* @retval StatusCode::SUCCESS Initialization was successful
* @retval StatusCode::FAILURE Initialization failed
*/
virtual StatusCode initialize();
/** Finalization of the algorithm before deletion
*
* @return The status of the finalization
* @retval StatusCode::SUCCESS Finalization was successful
* @retval StatusCode::FAILURE Finalization failed
*/
virtual StatusCode finalize();
protected:
/** @brief Returns a pointer to the first RawEvent in the search path
*/
LHCb::RawEvent* findFirstRawEvent( ) const;
/** @brief Returns a std::vector of raw banks out of a first raw event containing those banks
*/
const std::vector< LHCb::RawBank * > & findFirstRawBank( const LHCb::RawBank::BankType ) const;
//get for one location
LHCb::RawEvent* tryEventAt( const std::string ) const;
/// Where to look for the raw event
std::vector<std::string> m_rawEventLocations;
///avoid getIfExists name resolution for now
virtual inline LHCb::RawEvent* getIfExistsRaw(const std::string, bool) const
{
throw GaudiException( "Don't call this from the baseclass!",
"Decoder::CommonBase", StatusCode::FAILURE );
return NULL;
}
/// Initialize search paths
void initRawEventSearch();
private: // data
/// Where to look first, saves the last place I was able to retrieve successfully
mutable std::string m_tryFirstRawEventLocation;
/// whether to use the RootOnTes next time
mutable bool m_tryRootOnTes;
};
}
#endif // DAQKERNEL_DECODERCOMMONBASE_H
//-----------------------------------------------------------------------------
/** @file DecoderHistoAlgBase.h
*
* Header file for algorithm base class : DecoderHistoAlgBase
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 02/10/2014
*/
//-----------------------------------------------------------------------------
#ifndef DAQKERNEL_DECODERHISTOALGBASE_H
#define DAQKERNEL_DECODERHISTOALGBASE_H 1
// GaudiAlg
#include "GaudiAlg/GaudiHistoAlg.h"
// local
#include "DAQKernel/DecoderCommonBase.h"
namespace Decoder
{
//-----------------------------------------------------------------------------
/** @class HistoAlgBase DAQHistoAlgBase.h DAQKernel/DecoderHistoAlgBase.h
*
* Abstract base class for DAQ algorithms providing some basic functionality.
*
* In addition, uses the histogramming
* functionality from the base class GaudiHistoAlg.
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 10/02/2014
*/
//-----------------------------------------------------------------------------
class HistoAlgBase : public Decoder::CommonBase<GaudiHistoAlg>
{
public:
/// Standard constructor
HistoAlgBase( const std::string& name,
ISvcLocator* pSvcLocator )
: Decoder::CommonBase<GaudiHistoAlg> ( name, pSvcLocator )
{ }
protected:
///avoid getIfExists name resolution for now
virtual inline LHCb::RawEvent* getIfExistsRaw(const std::string loc, bool rootOnTes) const
{
return GaudiHistoAlg::getIfExists<LHCb::RawEvent>(loc,rootOnTes);
}
};
}
#endif // DAQKERNEL_DECODERHISTOALGBASE_H
//-----------------------------------------------------------------------------
/** @file DecoderHistoToolBase.h
*
* Header file for tool base class : DecoderHistoToolBase
*
* CVS Log :-
* $Id: DecoderHistoToolBase.h,v 1.6 2009-07-27 20:29:01 jonrob Exp $
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 02/10/2014
*/
//-----------------------------------------------------------------------------
#ifndef DAQKERNEL_DECODERHISTOTOOLBASE_H
#define DAQKERNEL_DECODERHISTOTOOLBASE_H 1
// GaudiAlg
#include "GaudiAlg/GaudiHistoTool.h"
// local
#include "DAQKernel/DecoderCommonBase.h"
namespace Decoder
{
//-----------------------------------------------------------------------------
/** @class HistoToolBase DecoderHistoToolBase.h DAQKernel/DecoderHistoToolBase.h
*
* Abstract base class for DAQ tools providing some basic functionality.
*
* In addition, uses the histogramming
* functionality from the base class GaudiTupleAlg.
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 10/02/2014
*/
//-----------------------------------------------------------------------------
class HistoToolBase : public Decoder::CommonBase<GaudiHistoTool>
{
public:
/// Standard constructor
HistoToolBase( const std::string& type,
const std::string& name,
const IInterface* parent )
: Decoder::CommonBase<GaudiHistoTool> ( type, name, parent )
{ }
protected:
///avoid getIfExists name resolution for now
virtual inline LHCb::RawEvent* getIfExistsRaw(const std::string loc, bool rootOnTes) const
{
return GaudiHistoTool::getIfExists<LHCb::RawEvent>(loc,rootOnTes);
}
};
}
#endif // DAQKERNEL_DECODERHISTOTOOLBASE_H
//-----------------------------------------------------------------------------
/** @file DecoderToolBase.h
*
* Header file for tool base class : Decoder::ToolBase
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 10/02/2014
*/
//-----------------------------------------------------------------------------
#ifndef DAQKERNEL_DECODERTOOLBASE_H
#define DAQKERNEL_DECODERTOOLBASE_H 1
// GaudiAlg
#include "GaudiAlg/GaudiTool.h"
// local
#include "DAQKernel/DecoderCommonBase.h"
namespace Decoder
{
//-----------------------------------------------------------------------------
/** @class ToolBase DAQToolBase.h DAQKernel/DecoderToolBase.h
*
* Abstract base class for DAQ tools providing
* some basic functionality.
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 05/04/2002
*/
//-----------------------------------------------------------------------------
class ToolBase : public Decoder::CommonBase<GaudiTool>
{
public:
/// Standard constructor
ToolBase( const std::string& type,
const std::string& name,
const IInterface* parent )
: Decoder::CommonBase<GaudiTool> ( type, name, parent ) { }
protected:
///avoid getIfExists name resolution for now
virtual inline LHCb::RawEvent* getIfExistsRaw(const std::string loc, bool rootOnTes) const
{
return GaudiTool::getIfExists<LHCb::RawEvent>(loc,rootOnTes);
}
};
}
#endif // DAQKERNEL_DECODERTOOLBASE_H
//-----------------------------------------------------------------------------
/** @file DecoderTupleAlgBase.h
*
* Header file for algorithm base class : DecoderTupleAlgBase
*
* CVS Log :-
* $Id: DecoderTupleAlgBase.h,v 1.7 2009-07-27 20:29:01 jonrob Exp $
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 02/10/2014
*/
//-----------------------------------------------------------------------------
#ifndef DAQKERNEL_DECODERTUPLEALGBASE_H
#define DAQKERNEL_DECODERTUPLEALGBASE_H 1
// GaudiAlg
#include "GaudiAlg/GaudiTupleAlg.h"
// local
#include "DAQKernel/DecoderCommonBase.h"
namespace Decoder
{
//-----------------------------------------------------------------------------
/** @class TupleAlgBase DecoderTupleAlgBase.h DAQKernel/DecoderTupleAlgBase.h
*
* Abstract base class for DAQ algorithms providing some basic functionality.
*
* In addition, uses the histogramming and ntupling
* functionality from the base class GaudiTupleAlg.
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 10/02/2014
*/
//-----------------------------------------------------------------------------
class TupleAlgBase : public Decoder::CommonBase<GaudiTupleAlg>
{
public:
/// Standard constructor
TupleAlgBase( const std::string& name,
ISvcLocator* pSvcLocator )
: Decoder::CommonBase<GaudiTupleAlg> ( name, pSvcLocator )
{ }
protected:
///avoid getIfExists name resolution for now
virtual inline LHCb::RawEvent* getIfExistsRaw(const std::string loc, bool rootOnTes) const
{
return GaudiTupleAlg::getIfExists<LHCb::RawEvent>(loc,rootOnTes);
}
};
}
#endif // DAQKERNEL_DECODERTUPLEALGBASE_H
//-----------------------------------------------------------------------------
/** @file DecoderTupleToolBase.h
*
* Header file for tool base class : DecoderTupleToolBase
*
* CVS Log :-
* $Id: DecoderTupleToolBase.h,v 1.7 2009-07-27 20:29:01 jonrob Exp $
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 10/02/2014
*/
//-----------------------------------------------------------------------------
#ifndef DAQKERNEL_DECODERTUPLETOOLBASE_H
#define DAQKERNEL_DECODERTUPLETOOLBASE_H 1
// GaudiAlg
#include "GaudiAlg/GaudiTupleTool.h"
// local
#include "DAQKernel/DecoderCommonBase.h"
namespace Decoder
{
//-----------------------------------------------------------------------------
/** @class TupleToolBase DecoderTupleToolBase.h DAQKernel/DecoderTupleToolBase.h
*
* Abstract base class for DAQ tools providing some basic functionality.
*
* In addition, uses the histogramming and ntupling
* functionality from the base class GaudiTupleTool.
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 02/10/2014
*/
//-----------------------------------------------------------------------------
class TupleToolBase : public Decoder::CommonBase<GaudiTupleTool>
{
public:
/// Standard constructor
TupleToolBase( const std::string& type,
const std::string& name,
const IInterface* parent )
: Decoder::CommonBase<GaudiTupleTool> ( type, name, parent )
{ }
protected:
///avoid getIfExists name resolution for now
virtual inline LHCb::RawEvent* getIfExistsRaw(const std::string loc, bool rootOnTes) const
{
return GaudiTupleTool::getIfExists<LHCb::RawEvent>(loc,rootOnTes);
}
};
}
#endif // DAQKERNEL_DECODERTUPLETOOLBASE_H
#=====================================================================
# Created : 2014-02-10
# Maintainer : Rob Lambert
#=====================================================================
package DAQKernel
version v1r1
# ================ structure ==============================================
branches DAQKernel cmt doc src
# ================ dependencies ===========================================
use DAQEvent v* Event
use LHCbKernel v* Kernel
use GaudiAlg v*
use GaudiUtils v*
# ================ environment ============================================
apply_pattern install_more_includes more=DAQKernel
# ================ linker library ============================================
library DAQKernelLib ../src/lib/*.cpp
apply_pattern linker_library library=DAQKernelLib
!------------------------------------------------------------------------------
! Package : DAQ/DAQKernel
! Responsible : Rob Lambert
! Purpose : common DAQ/Encoder/decoder base classes
!------------------------------------------------------------------------------
!========================= DAQKernel v1r1 2014-09-08 =========================
! 2014-07-26 - Chris Jones
- Some minor coding improvements to the base class.
!========================= DAQKernel v1r0 2014-02-17 =========================
! 2014-02-11 - Rob Lambert
- Finally fixed problems with getIfExists using polymorphism
! 2014-02-10 Rob Lambert
- First version of this package
- Copy of RichKernel to implement templates on top of GaudiCommon for Decoder algs/tools
//-----------------------------------------------------------------------------
/** @file DAQAlgBase.cpp
*
* Implementation file for class : DAQ::AlgBase
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 2014-02-10
*/
//-----------------------------------------------------------------------------
// local
#include "DAQKernel/DecoderAlgBase.h"
// ============================================================================
// Force creation of templated classes
#include "DecoderCommonBase.icpp"
template class Decoder::CommonBase<GaudiAlgorithm> ;
// ============================================================================
//-----------------------------------------------------------------------------
/** @file DAQCommonBase.icpp
*
* Implementation file for DAQ base class : Decoder::CommonBase
*
* @author Rob Lambert Rob.Lambert@cern.ch
* @date 2014-02-10
*/
//-----------------------------------------------------------------------------
#ifndef DAQKERNEL_DECODERCOMMONBASE_ICPP
#define DAQKERNEL_DECODERCOMMONBASE_ICPP 1
// STL
#include <sstream>
#include <string>
#include <algorithm>
// local
#include "DAQKernel/DecoderCommonBase.h"