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