Skip to content
Snippets Groups Projects
Commit 1775616a authored by Viktor Klochkov's avatar Viktor Klochkov :eyes:
Browse files

add matching config

parent 6fe4ae2a
No related branches found
No related tags found
1 merge request!9Template way
Pipeline #3031 canceled
......@@ -22,7 +22,7 @@ if (CMAKE_BUILD_TYPE MATCHES DEBUG)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif ()
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb -DDEBUG -D__DEBUG -Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb -g -DDEBUG -D__DEBUG -Wall -Wextra")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -ftree-vectorize -ffast-math -DNODEBUG")
message(STATUS "Using CXX flags for ${CMAKE_BUILD_TYPE}: ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}")
......
......@@ -79,19 +79,19 @@ class BranchConfig{
if (sField == "eta") return TrackFields::kEta;
if (sField == "p") return TrackFields::kP;
}
if (type_ == kHit)
else if (type_ == kHit)
{
if (sField == "x") return HitFields::kX;
if (sField == "y") return HitFields::kY;
if (sField == "z") return HitFields::kZ;
if (sField == "phi") return HitFields::kPhi;
}
if (type_ == kModule)
else if (type_ == kModule)
{
if (sField == "id") return ModuleFields::kId;
if (sField == "signal") return ModuleFields::kSignal;
}
if (type_ == kEventHeader)
else if (type_ == kEventHeader)
{
if (sField == "vtx_x") return EventHeaderFields::kVertexX;
if (sField == "vtx_y") return EventHeaderFields::kVertexY;
......
......@@ -30,7 +30,7 @@ class Configuration : public TObject{
branches_.push_back(branch);
}
void AddBranchConfig(const std::string name, ShortInt_t type)
void AddBranchConfig(const std::string& name, ShortInt_t type)
{
BranchConfig branch(name);
branch.SetType(type);
......@@ -55,19 +55,36 @@ class Configuration : public TObject{
{
std::cout << "This is a " << name_ << std::endl;
std::cout << "The Tree has the following branches:" << std::endl;
for(const auto branch : branches_)
for(const auto& branch : branches_)
{
std::cout << std::endl;
branch.Print();
}
}
const std::string& GetMatchName(const std::string& br1, const std::string& br2) const {
auto search = matches_.find(std::pair(br1, br2));
if (search != matches_.end()) {
return search->second;
} else {
std::cout << "Configuration::GetMatchName - Not found\n";
exit(1);
}
}
void AddMatch(const std::string& br1, const std::string& br2, const std::string& name) {
matches_.insert( std::pair(std::make_pair(br1, br2), name) );
}
uint GetLastId() const { return branches_.back().GetId(); }
protected:
std::string name_{""};
std::vector <BranchConfig> branches_{};
std::map<std::pair<std::string, std::string>, std::string> matches_{};
std::map<std::pair<int, int>, std::string> matches_id_{};
ClassDef(AnalysisTree::Configuration, 1)
};
......
......@@ -63,6 +63,9 @@ class EventHeader : public Container {
EventHeader::vtx_pos_[Exyz::kZ] = z;
}
static constexpr int GetNumberOfChannels() { return 1; } // needed in order to have EventHeader similar to Detector
const EventHeader& GetChannel(int) const { return *this; } // needed in order to have EventHeader similar to Detector
protected:
std::array <Floating_t, 3> vtx_pos_{ {UndefValueFloat,UndefValueFloat, UndefValueFloat} };
......
......@@ -2,6 +2,7 @@
#define ANALYSISTREE_MATCHING_H
#include <map>
#include <iostream>
#include "Constants.h"
......@@ -17,18 +18,18 @@ public:
Matching(ShortInt_t id1, ShortInt_t id2) : branch1_id_(id1), branch2_id_(id2) {};
virtual ~Matching() = default;
void AddMathch(ShortInt_t id1, ShortInt_t id2)
void AddMatch(ShortInt_t id1, ShortInt_t id2)
{
match_.insert( std::pair<ShortInt_t, ShortInt_t>(id1, id2) );
match_inverted_.insert( std::pair<ShortInt_t, ShortInt_t>(id2, id1) );
}
ShortInt_t GetMatch(ShortInt_t id) const {
ShortInt_t GetMatchDirect(ShortInt_t id) const {
auto search = match_.find(id);
if (search != match_.end()){
return search->second;
} else {
// std::cout << "Matching::GetMatch - Not found\n";
std::cout << "Matching::GetMatchDirect - Not found\n";
return UndefValueShort;
}
}
......@@ -38,11 +39,15 @@ public:
if (search != match_inverted_.end()){
return search->second;
} else {
// std::cout << "Matching::GetMatchInverted - Not found\n";
std::cout << "Matching::GetMatchInverted - Not found\n";
return UndefValueShort;
}
}
ShortInt_t GetMatch(ShortInt_t id, bool is_inverted) const {
return is_inverted ? GetMatchInverted(id) : GetMatchDirect(id);
}
void Clear(){
match_.clear();
match_inverted_.clear();
......
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