11#include <tracking/trackFindingVXD/sectorMapTools/FilterValueDataSet.h>
13#include <framework/logging/Logger.h>
15#include <framework/pcore/RootMergeable.h>
16#include <framework/datastore/StoreObjPtr.h>
18#include <framework/pcore/ProcHandler.h>
67 std::string fileName = outputdir +
"/" + mapName +
"_" + tag +
".root";
68 m_file =
new TFile((fileName).c_str(),
"CREATE");
70 B2FATAL(
"File was not opened! File name: " << fileName <<
" (maybe it already exists!?)");
92 other.m_file =
nullptr;
102 B2DEBUG(20,
"RawSecMapRootInterface::initialize2Hit: start - got " << filterNames.size() <<
" filters");
103 B2DEBUG(20,
"and root file got size of: " <<
m_file->GetSize());
108 bool constructed =
m_tree2Hit.construct((
m_name + std::string(
"2Hit")).c_str(),
"Raw data of two-hit-combinations for a sectorMap");
109 B2DEBUG(20,
"RawSecMapRootInterface::initialize2Hit: isRegistered/isConstructed: " << registered <<
"/" << constructed);
122 B2DEBUG(20,
"RawSecMapRootInterface::initialize2Hit: adding " << filterNames.size() <<
" filters as branches to ttree ");
123 for (
auto& name : filterNames) {
124 double* valuePtr =
m_data2Hit.getValuePtr(name);
125 if (valuePtr !=
nullptr) {
126 B2DEBUG(20,
"RawSecMapRootInterface::initialize2Hit: adding now branch with name " << name);
127 m_tree2Hit->get().Branch(name.c_str(), valuePtr);
129 B2ERROR(
"RawSecMapRootInterface::initialize2Hit: filterName " << name <<
130 " not known! this is unintended behavior - skipping filter");
134 B2DEBUG(20,
"RawSecMapRootInterface::initialize2Hit: nBranches/nEntries: " <<
m_tree2Hit->get().GetNbranches() <<
"/" <<
143 B2DEBUG(20,
"RawSecMapRootInterface::initialize3Hit: start");
148 bool constructed =
m_tree3Hit.construct((
m_name + std::string(
"3Hit")).c_str(),
149 "Raw data of three-hit-combinations for a sectorMap");
150 B2DEBUG(20,
"RawSecMapRootInterface::initialize3Hit: isRegistered/isConstructed: " << registered <<
"/" << constructed);
164 B2DEBUG(20,
"RawSecMapRootInterface::initialize3Hit: adding " << filterNames.size() <<
" filters as branches to ttree ");
165 for (
auto& name : filterNames) {
166 double* valuePtr =
m_data3Hit.getValuePtr(name);
167 if (valuePtr !=
nullptr) {
168 B2DEBUG(20,
"RawSecMapRootInterface::initialize3Hit: adding now branch with name " << name);
169 m_tree3Hit->get().Branch(name.c_str(), valuePtr);
171 B2ERROR(
"RawSecMapRootInterface::initialize3Hit: filterName " << name <<
172 " not known! this is unintended behavior - skipping filter");
176 B2DEBUG(20,
"RawSecMapRootInterface::initialize3Hit: nBranches/nEntries: " <<
m_tree3Hit->get().GetNbranches() <<
"/" <<
194 B2ERROR(
"RawSecMapRootInterface::fill2Hit: attempt to fill invalid data in the tree! -> unintended behavior, data will not be filled.");
208 B2ERROR(
"RawSecMapRootInterface::fill3Hit: attempt to fill invalid data in the tree! -> unintended behavior, data will not be filled.");
220 B2DEBUG(20,
"RawSecMapRootInterface::write: start");
In the store you can park objects that have to be accessed by various modules.
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
@ c_Persistent
Object is available during entire execution time.
contains the relevant information needed for filling a TTree containing train-data for the secMap.
static bool isOutputProcess()
Return true if the process is an output process.
static bool parallelProcessingUsed()
Returns true if multiple processes have been spawned, false in single-core mode.
To be used as an interface to root-stuff.
FilterValueDataSet< SecIDPair > m_data2Hit
Mask for storing dataSets to be piped into 2hit-tree.
RawSecMapRootInterface(const std::string &mapName, const std::string &tag, const std::string &outputdir="./")
Constructor - prepares TTree.
RawSecMapRootInterface(RawSecMapRootInterface &&other)
but it may be moved
StoreObjPtr< RootMergeable< TTree > > m_tree3Hit
interface to the TTree storing three-hit-variables.
void fill3Hit()
fill three-hit-combinations in tree, triggers an Error if values not set yet.
void initialize3Hit(std::vector< std::string > filterNames)
initialize the RawSecMapRootInterface for three-hit-combinations (to be called in Module::initialize(...
FilterValueDataSet< SecIDTriplet > & get3HitDataSet()
returns a reference to the 3-hit-dataset so one can set the relevant values.
StoreObjPtr< RootMergeable< TTree > > m_tree2Hit
interface to the TTree storing two-hit-variables.
void fill2Hit()
fill two-hit-combinations in tree, triggers an Error if values not set yet.
TFile * m_file
a pointer to the file where the Tree shall be stored.
void write()
write all trees to file at end of processing.
void initialize2Hit(std::vector< std::string > filterNames)
initialize the RawSecMapRootInterface for two-hit-combinations (to be called in Module::initialize().
RawSecMapRootInterface(const RawSecMapRootInterface &rawSecMapInterFace)=delete
That class shall not be copied.
FilterValueDataSet< SecIDTriplet > m_data3Hit
Mask for storing dataSets to be piped into 3hit-tree.
FilterValueDataSet< SecIDPair > & get2HitDataSet()
returns a reference to the 2-hit-dataset so one can set the relevant values.
~RawSecMapRootInterface()
destructor deleting the rootFile.
RawSecMapRootInterface & operator=(const RawSecMapRootInterface &rawSecMapInterFace)=delete
That class shall not be copied.
std::string m_name
name of the StoreObjPtr.
Type-safe access to single objects in the data store.
Abstract base class for different kinds of events.