Skip to content

Commit

Permalink
Add data monitor and ValueError and update on filesource
Browse files Browse the repository at this point in the history
Adding new class R3BDataMonitor for easy histogram operations in
FairTask. New class ValueError can be used to represent values with
errors. R3BFileSource2 now can handle root files just with root tree
inside. Documentation of these new classes and changes have been added
to the README.md in the r3bbase folder.
  • Loading branch information
YanzhaoW authored and jose-luis-rs committed Oct 1, 2024
1 parent 2fd06e3 commit 018e08a
Show file tree
Hide file tree
Showing 15 changed files with 1,222 additions and 82 deletions.
4 changes: 4 additions & 0 deletions r3bbase/BaseLinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@
#pragma link C++ class R3BTcutPar+;
#pragma link C++ class R3BTsplinePar+;
#pragma link C++ class R3BCoarseTimeStitch+;
#pragma link C++ class R3B::ValueError<double>+;
#pragma link C++ class pair<R3B::ValueError<double>, R3B::ValueError<double>>+;
#pragma link C++ class R3B::LRPair<R3B::ValueError<double>>+;
#pragma link C++ class R3B::LRPair<int>+;
#endif
7 changes: 7 additions & 0 deletions r3bbase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
##############################################################################

set(SRCS
# cmake-format: sortable
data_monitor/R3BDataMonitor.cxx
data_monitor/R3BDataMonitorCanvas.cxx
R3BCoarseTimeStitch.cxx
R3BDataPropagator.cxx
R3BDetector.cxx
Expand All @@ -27,6 +30,9 @@ set(SRCS
R3BWhiterabbitPropagator.cxx)

set(HEADERS
# cmake-format: sortable
data_monitor/R3BDataMonitor.h
data_monitor/R3BDataMonitorCanvas.h
R3BCoarseTimeStitch.h
R3BDataPropagator.h
R3BDetector.h
Expand Down Expand Up @@ -55,6 +61,7 @@ add_library_with_dictionary(
SRCS
${SRCS}
INCLUDEDIRS
data_monitor
${CMAKE_CURRENT_SOURCE_DIR}
DEPENDENCIES
${DEPENDENCIES})
Expand Down
22 changes: 5 additions & 17 deletions r3bbase/R3BEventHeaderPropagator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* or submit itself to any jurisdiction. *
******************************************************************************/

#include "FairLogger.h"
#include <FairRootManager.h>

#include "R3BEventHeaderPropagator.h"
Expand All @@ -23,22 +22,12 @@ R3BEventHeaderPropagator::R3BEventHeaderPropagator()
{
}

R3BEventHeaderPropagator::R3BEventHeaderPropagator(const TString& name, Int_t iVerbose, const TString& nameheader)
R3BEventHeaderPropagator::R3BEventHeaderPropagator(const TString& name, Int_t iVerbose, std::string_view nameheader)
: FairTask(name, iVerbose)
, fNameHeader(nameheader)
, fHeader(nullptr)
, fSource(nullptr)
{
}

R3BEventHeaderPropagator::~R3BEventHeaderPropagator()
{
if (fHeader)
{
delete fHeader;
}
}

InitStatus R3BEventHeaderPropagator::Init()
{
R3BLOG(info, "");
Expand All @@ -47,21 +36,20 @@ InitStatus R3BEventHeaderPropagator::Init()
R3BLOG_IF(fatal, !fHeader, "EventHeader. not found.");
R3BLOG_IF(info, fHeader, "EventHeader. found.");

frm->Register(fNameHeader, "EventHeader", fHeader, kTRUE);
frm->Register(fNameHeader.data(), "EventHeader", fHeader, kTRUE);

fSource = R3BFileSource::Instance();
fSource = frm->GetSource();
R3BLOG_IF(fatal, !fSource, "R3BFileSource not found.");

return kSUCCESS;
}

void R3BEventHeaderPropagator::Exec(Option_t*)
void R3BEventHeaderPropagator::Exec(Option_t* /*option*/)
{
if (fSource)
if (fSource != nullptr)
{
fHeader->SetRunId(fSource->GetRunId());
}
return;
}

ClassImp(R3BEventHeaderPropagator);
22 changes: 9 additions & 13 deletions r3bbase/R3BEventHeaderPropagator.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <Rtypes.h>

#include "R3BEventHeader.h"
class R3BFileSource;
class FairSource;

class R3BEventHeaderPropagator : public FairTask
{
Expand All @@ -35,13 +35,9 @@ class R3BEventHeaderPropagator : public FairTask
* @param name a name of the task.
* @param iVerbose a verbosity level.
*/
R3BEventHeaderPropagator(const TString& name, Int_t iVerbose = 1, const TString& nameheader = "EventHeader.");

/**
* Destructor.
* Frees the memory used by the object.
*/
~R3BEventHeaderPropagator() override;
explicit R3BEventHeaderPropagator(const TString& name,
Int_t iVerbose = 1,
std::string_view nameheader = "EventHeader.");

/**
* Method for task initialization.
Expand All @@ -56,15 +52,15 @@ class R3BEventHeaderPropagator : public FairTask
* Is called by the framework every time a new event is read.
* @param option an execution option.
*/
void Exec(Option_t*) override;
void Exec(Option_t* /*option*/) override;

private:
TString fNameHeader;
R3BEventHeader* fHeader;
R3BFileSource* fSource;
std::string fNameHeader;
R3BEventHeader* fHeader = nullptr;
FairSource* fSource = nullptr;

public:
ClassDefOverride(R3BEventHeaderPropagator, 0)
ClassDefOverride(R3BEventHeaderPropagator, 1)
};

#endif // R3BEVENTHEADERPROPAGATOR_H
Loading

0 comments on commit 018e08a

Please sign in to comment.