Skip to content
Snippets Groups Projects
Commit c47136e9 authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau
Browse files

Add reco folder and base sub-folder + add template for Unpacker algos, refs#1518 @1h

git-svn-id: https://subversion.gsi.de/cbmsoft/cbmroot/trunk@15653 5a1b234a-d7ce-0410-9a93-fd649a8fa65c
parent c035083a
No related branches found
No related tags found
No related merge requests found
# CMakeList file for library CbmReco
# P.-A. Loizeau, 7 February 2020
add_subdirectory(base)
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
// --- base
//#pragma link C++ class CbmUnpack+; <= Template, not needed
#endif /* __CINT__ */
// -----------------------------------------------------------------------------
// ----- -----
// ----- CbmUnpack -----
// ----- Created 07.02.2020 by P.-A. Loizeau -----
// ----- -----
// -----------------------------------------------------------------------------
#ifndef CBMUNPACK_H
#define CBMUNPACK_H
#include "Timeslice.hpp"
#include "Rtypes.h"
#include <boost/any.hpp>
#include <vector>
#include <string>
#include <map>
#include <utility>
class TList;
class TNamed;
class TCanvas;
template<typename T>
bool is_this_type(const boost::any& varValue)
{
if (auto q = boost::any_cast<T>(&varValue))
return true;
else
return false;
}
template<typename T>
class CbmUnpack
{
public:
CbmUnpack() :
fParCList( nullptr ),
fvMsComponentsList(),
fuNbCoreMsPerTs( 0 ),
fuNbOverMsPerTs( 0 ),
fuNbMsLoop( 0 ),
fbIgnoreOverlapMs( kFALSE ),
fdMsSizeInNs(-1.0),
fdTsCoreSizeInNs(-1.0),
fdTsFullSizeInNs(-1.0),
fvpAllHistoPointers(),
fDigiVect(),
fParameterMap()
{};
virtual ~CbmUnpack() = default;
CbmUnpack(const CbmUnpack&) = delete;
CbmUnpack& operator=(const CbmUnpack&) = delete;
virtual Bool_t Init() = 0;
virtual void Reset() = 0;
virtual void Finish() = 0;
virtual Bool_t ProcessTs( const fles::Timeslice& ts ) = 0;
// virtual Bool_t ProcessTs( const fles::Timeslice& ts, size_t component ) = 0;
// virtual Bool_t ProcessMs( const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx ) = 0;
virtual Bool_t InitContainers() = 0;
virtual Bool_t ReInitContainers() = 0;
virtual TList* GetParList() = 0;
virtual void SetParameter(std::string /*param*/) {;}
virtual std::string GetParameter(std::string /*param*/) { return std::string{""}; }
/// For monitoring of internal processes.
void AddHistoToVector( TNamed * pointer, std::string sFolder = "" )
{ fvpAllHistoPointers.push_back( std::pair< TNamed *, std::string >( pointer, sFolder ) ); }
std::vector< std::pair< TNamed *, std::string > > GetHistoVector() { return fvpAllHistoPointers; }
void AddCanvasToVector( TCanvas * pointer, std::string sFolder = "" )
{ fvpAllCanvasPointers.push_back( std::pair< TCanvas *, std::string >( pointer, sFolder ) ); }
std::vector< std::pair< TCanvas *, std::string > > GetCanvasVector() { return fvpAllCanvasPointers; }
/// Output vector
void AssignOutputVector( std::vector<T> & rVect ){ fDigiVect = rVect; }
// void ClearVector() {fDigiVect->clear();}
// std::vector<T> * GetVector() {return fDigiVect;}
/// Control flags
void SetIgnoreOverlapMs( Bool_t bFlagIn = kTRUE ) { fbIgnoreOverlapMs = bFlagIn; }
protected:
/// Parameter management
TList* fParCList = nullptr;
/// Parameters related to FLES containers
std::vector< size_t > fvMsComponentsList; //! List of components used in the TS, updated internaly by the Algos
size_t fuNbCoreMsPerTs; //! Number of Core MS in the TS
size_t fuNbOverMsPerTs; //! Number of Overlap MS at the end of the TS
size_t fuNbMsLoop; //! Number of MS for the loop in each MS, updated internaly by the Algos to read OverMS or not
Bool_t fbIgnoreOverlapMs; //! Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice
Double_t fdMsSizeInNs; //! Size of a single MS, [nanoseconds]
Double_t fdTsCoreSizeInNs; //! Total size of the core MS in a TS, [nanoseconds]
Double_t fdTsFullSizeInNs; //! Total size of the core MS in a TS, [nanoseconds]
/// For monitoring of internal processes.
/// => Pointers should be filled with TH1*, TH2*, TProfile*, ...
/// ==> To check if object N is of type T, use "T ObjectPointer = dynamic_cast<T>( fvpAllHistoPointers[N].first );" and check for nullptr
/// ==> To get back the original class name use "fvpAllHistoPointers[N].first->ClassName()" which returns a const char * (e.g. "TH1I")
/// ===> Usage example with feeding a THttpServer:
/// ===> #include "TH2.h"
/// ===> std::string sClassName = vHistos[ uHisto ].first.ClassName();
/// ===> if( !strncmp( sClassName, "TH1", 3 ) )
/// ===> server->Register( vHistos[ uHisto ].second.data(), dynamic_cast< TH1 * >(vHistos[ uHisto ].first) );
/// ===> else if( !strncmp( sClassName, "TH2", 3 ) )
/// ===> server->Register( vHistos[ uHisto ].second.data(), dynamic_cast< TH2 * >(vHistos[ uHisto ].first) );
std::vector< std::pair< TNamed *, std::string > > fvpAllHistoPointers; //! Vector of pointers to histograms + optional folder name
std::vector< std::pair< TCanvas *, std::string > > fvpAllCanvasPointers; //! Vector of pointers to canvases + optional folder name
/// Output vector
std::vector<T> & fDigiVect; //! Vector of digis FIXME: check that the reference works as expected
/// For any algo
std::map<std::string, std::string> fParameterMap; //! Map of parameter name and type
Bool_t CheckParameterValidity(std::string /*parameterName*/, std::string /*parameterType*/) { return kTRUE;}
private:
};
#endif // CBMUNPACK_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment