diff --git a/examples/advanced/propagator/macros/conf.xml b/examples/advanced/propagator/macros/conf.xml
index 218aad73b1..aa1ea7fdc9 100644
--- a/examples/advanced/propagator/macros/conf.xml
+++ b/examples/advanced/propagator/macros/conf.xml
@@ -16,4 +16,9 @@
-
\ No newline at end of file
+
+
+
+
+
+
diff --git a/examples/common/eventdisplay/FairEveMCTracks.cxx b/examples/common/eventdisplay/FairEveMCTracks.cxx
index 6cab365771..4a4ac6d7e7 100644
--- a/examples/common/eventdisplay/FairEveMCTracks.cxx
+++ b/examples/common/eventdisplay/FairEveMCTracks.cxx
@@ -22,6 +22,7 @@
#include "FairRKPropagator.h" // for FairRKPropagator
#include "FairRootManager.h" // for FairRootManager
#include "FairRunAna.h" // for FairRunAna
+#include "FairXMLNode.h" // for XML support
#include // for TClonesArray
#include // for TDatabasePDG
@@ -88,7 +89,7 @@ void FairEveMCTracks::DrawTrack(Int_t id)
auto tr = static_cast(fContainer->UncheckedAt(id));
if (!CheckCuts(tr))
return;
- Color_t color = GetEventManager()->Color(tr->GetPdgCode());
+ Color_t color = fXMLConf.GetColor(tr->GetPdgCode());
TEveTrackList* trList = FindTrackGroup(Form("%i", tr->GetPdgCode()), color);
TParticle p(tr->GetPdgCode(),
0,
@@ -145,7 +146,7 @@ void FairEveMCTracks::Repaint()
InitStatus FairEveMCTracks::Init()
{
- FairEventManager* eveManager = GetEventManager();
+ FairEventManager* eveManager = FairEventManager::Instance();
FairRootManager* mngr = &(eveManager->GetRootManager());
fContainer = dynamic_cast(mngr->GetObject("MCTrack"));
if (!fContainer) {
@@ -165,7 +166,19 @@ InitStatus FairEveMCTracks::Init()
}
fRK = std::make_unique(field);
fPDG = TDatabasePDG::Instance();
- return FairEveTracks::Init();
+ TString xmlConfig = eveManager->GetXMLConfig();
+ if (xmlConfig.Length() > 4) {
+ FairXMLFile file(xmlConfig);
+ FairXMLNode* root = file.GetRootNode();
+ FairXMLNode* mcColors = root->GetChild("FairMCTrackColors"); // lok for MCtrack colors
+ if (!mcColors) { // not found MCTracks? maybe there is a general branch for MC colors
+ root->GetChild("MCTracksColors");
+ LOG(warning) << "Cannot find FairMCTrackColors";
+ }
+ if (mcColors)
+ fXMLConf = FairXMLPdgColor(mcColors);
+ }
+ return kSUCCESS;
}
FairEveMCTracks::~FairEveMCTracks() = default;
diff --git a/examples/common/eventdisplay/FairEveMCTracks.h b/examples/common/eventdisplay/FairEveMCTracks.h
index c384258775..048d0df173 100644
--- a/examples/common/eventdisplay/FairEveMCTracks.h
+++ b/examples/common/eventdisplay/FairEveMCTracks.h
@@ -18,6 +18,7 @@
#include "FairEveTracks.h" // for FairEveTracks
#include "FairTask.h" // for InitStatus
+#include "FairXMLPdgColor.h"
#include
#include // for THashConsistencyHolder, ClassDef
@@ -40,6 +41,7 @@ class FairEveMCTracks : public FairEveTracks
Int_t fPdgCut;
std::unique_ptr fRK{};
TDatabasePDG* fPDG{nullptr};
+ FairXMLPdgColor fXMLConf;
protected:
Bool_t CheckCuts(FairMCTrack *tr);
diff --git a/fairroot/eventdisplay/CMakeLists.txt b/fairroot/eventdisplay/CMakeLists.txt
index d5ff3a14ef..c063d2d86a 100644
--- a/fairroot/eventdisplay/CMakeLists.txt
+++ b/fairroot/eventdisplay/CMakeLists.txt
@@ -39,6 +39,9 @@ set(sources
tracks/FairEveTracks.cxx
tracks/FairGeoTracksDraw.cxx
tracks/FairGeoTrackHandler.cxx
+ xml/FairXMLDetectorConf.cxx
+ xml/FairXMLEveConf.cxx
+ xml/FairXMLPdgColor.cxx
)
fair_change_extensions_if_exists(.cxx .h FILES "${sources}" OUTVAR headers)
@@ -51,6 +54,7 @@ target_include_directories(${target} PUBLIC
$
$
$
+ $
$
)
diff --git a/fairroot/eventdisplay/FairEventManager.cxx b/fairroot/eventdisplay/FairEventManager.cxx
index 7d029c2bd8..ceddc7af2a 100644
--- a/fairroot/eventdisplay/FairEventManager.cxx
+++ b/fairroot/eventdisplay/FairEventManager.cxx
@@ -14,6 +14,7 @@
#include "FairRootManager.h" // for FairRootManager
#include "FairRunAna.h" // for FairRunAna
+#include "FairXMLDetectorConf.h"
#include "FairXMLNode.h"
#include // for TDatabasePDG
@@ -70,55 +71,6 @@ FairEventManager::FairEventManager()
{
fgRinstance = this;
AddParticlesToPdgDataBase();
- fPDGToColor[22] = 623; // photon
- fPDGToColor[-2112] = 2; // anti-neutron
- fPDGToColor[-11] = 3; // e+
- fPDGToColor[-3122] = 4; // anti-lambda
- fPDGToColor[11] = 5; // e-
- fPDGToColor[-3222] = 6; // Sigma -
- fPDGToColor[12] = 7; // e-neutrino
- fPDGToColor[-3212] = 8; // Sigma0
- fPDGToColor[-13] = 9; // mu+
- fPDGToColor[-3112] = 10; // Sigma+ (PB
- fPDGToColor[13] = 11; // mu-
- fPDGToColor[-3322] = 12; // Xi0
- fPDGToColor[111] = 13; // pi0
- fPDGToColor[-3312] = 14; // Xi+
- fPDGToColor[211] = 15; // pi+
- fPDGToColor[-3334] = 16; // Omega+ (PB)
- fPDGToColor[-211] = 17; // pi-
- fPDGToColor[-15] = 18; // tau+
- fPDGToColor[130] = 19; // K long
- fPDGToColor[15] = 20; // tau -
- fPDGToColor[321] = 21; // K+
- fPDGToColor[411] = 22; // D+
- fPDGToColor[-321] = 23; // K-
- fPDGToColor[-411] = 24; // D-
- fPDGToColor[2112] = 25; // n
- fPDGToColor[421] = 26; // D0
- fPDGToColor[2212] = 27; // p
- fPDGToColor[-421] = 28; // D0
- fPDGToColor[-2212] = 29; // anti-proton
- fPDGToColor[431] = 30; // Ds+
- fPDGToColor[310] = 31; // K short
- fPDGToColor[-431] = 32; // anti Ds-
- fPDGToColor[221] = 33; // eta
- fPDGToColor[4122] = 34; // Lambda_C+
- fPDGToColor[3122] = 35; // Lambda
- fPDGToColor[24] = 36; // W+
- fPDGToColor[3222] = 37; // Sigma+
- fPDGToColor[-24] = 38; // W-
- fPDGToColor[3212] = 39; // Sigma0
- fPDGToColor[23] = 40; // Z
- fPDGToColor[3112] = 41; // Sigma -
- fPDGToColor[3322] = 42; // Xi0
- fPDGToColor[3312] = 43; // Xi-
- fPDGToColor[3334] = 44; // Omega- (PB)
- fPDGToColor[50000050] = 801; // Cerenkov
- fPDGToColor[1000010020] = 45;
- fPDGToColor[1000010030] = 48;
- fPDGToColor[1000020040] = 50;
- fPDGToColor[1000020030] = 55;
}
void FairEventManager::Init(Int_t visopt, Int_t vislvl, Int_t maxvisnds)
@@ -253,14 +205,6 @@ void FairEventManager::Close() {}
void FairEventManager::DisplaySettings() {}
-Int_t FairEventManager::Color(int pdg)
-{
- if (fPDGToColor.find(pdg) != fPDGToColor.end()) {
- return fPDGToColor[pdg];
- }
- return 0;
-}
-
void FairEventManager::AddParticlesToPdgDataBase(Int_t /*pdg*/)
{
// Add particles to the PDG data base
@@ -357,125 +301,16 @@ void FairEventManager::SetRhoZPlane(Double_t a, Double_t b, Double_t c, Double_t
void FairEventManager::LoadXMLSettings()
{
FairXMLFile xmlfile(fXMLConfig, "read");
- FairXMLNode *xml = xmlfile.GetRootNode();
- for (int i = 0; i < xml->GetNChildren(); i++) {
- TString nodename = xml->GetChild(i)->GetName();
- if (nodename.EqualTo("Detectors")) {
- TGeoNode *top = gGeoManager->GetTopNode();
- FairXMLNode *top_xml = xml->GetChild(i)->GetChild(0);
- if (top_xml != nullptr)
- LoadXMLDetector(top, top_xml);
- } else if (nodename.EqualTo("MCTracksColors")) {
- FairXMLNode *colors = xml->GetChild(i);
- for (int j = 0; j < colors->GetNChildren(); j++) {
- FairXMLNode *color = colors->GetChild(j);
- TString pgd_code = color->GetAttrib("pdg")->GetValue();
- TString color_code = color->GetAttrib("color")->GetValue();
- fPDGToColor[pgd_code.Atoi()] = StringToColor(color_code);
- }
- }
+ FairXMLNode* xml = xmlfile.GetRootNode();
+ FairXMLNode* detectors = xml->GetChild("Detectors");
+ if (detectors && detectors->GetNChildren()) {
+ TGeoNode* top = gGeoManager->GetTopNode();
+ FairXMLDetectorConf xmlGeoConf(detectors->GetChild(0));
+ xmlGeoConf.SetupNode(*top);
}
gEve->Redraw3D();
}
-void FairEventManager::LoadXMLDetector(TGeoNode *node, FairXMLNode *xml, Int_t depth)
-{
- TString name = xml->GetAttrib("name")->GetValue();
- TString node_name = node->GetName();
- Bool_t recursive = (xml->GetAttrib("recursive")->GetValue().Length() != 0 && !name.EqualTo(node_name));
- if (recursive && depth == 0)
- return;
- TString transparency = xml->GetAttrib("transparency")->GetValue();
- TString color = xml->GetAttrib("color")->GetValue();
- if (!color.EqualTo("")) {
- node->GetVolume()->SetFillColor(StringToColor(color));
- node->GetVolume()->SetLineColor(StringToColor(color));
- }
- if (!transparency.EqualTo("")) {
- node->GetVolume()->SetTransparency((Char_t)(transparency.Atoi()));
- }
- if (xml->GetAttrib("recursive")->GetValue().Length() > 0) {
- TString val = xml->GetAttrib("recursive")->GetValue();
- Int_t xml_depth = val.Atoi();
- if (recursive) {
- xml_depth = depth - 1;
- }
- for (int i = 0; i < node->GetNdaughters(); i++) {
- TGeoNode *daughter_node = node->GetDaughter(i);
- LoadXMLDetector(daughter_node, xml, xml_depth);
- }
- }
- if (xml->GetNChildren() > 0 && !recursive) {
- for (int i = 0; i < node->GetNdaughters(); i++) {
- TString subdetector_name = node->GetDaughter(i)->GetName();
- for (int j = 0; j < xml->GetNChildren(); j++) {
- FairXMLNode *subnode = xml->GetChild(j);
- TString subnode_name = subnode->GetAttrib("name")->GetValue();
- if (subnode_name == subdetector_name) {
- LoadXMLDetector(node->GetDaughter(i), subnode);
- }
- }
- }
- }
-}
-
-Int_t FairEventManager::StringToColor(TString color) const
-{
- if (color.Contains("k")) {
- Int_t plus_index = color.First('+');
- Int_t minus_index = color.First('-');
- Int_t cut = plus_index;
- if (cut == -1)
- cut = minus_index;
- if (cut == -1)
- cut = color.Length();
- TString col_name(color(0, cut));
- Int_t col_val = 0;
- if (col_name.EqualTo("kWhite")) {
- col_val = 0;
- } else if (col_name.EqualTo("kBlack")) {
- col_val = 1;
- } else if (col_name.EqualTo("kGray")) {
- col_val = 920;
- } else if (col_name.EqualTo("kRed")) {
- col_val = 632;
- } else if (col_name.EqualTo("kGreen")) {
- col_val = 416;
- } else if (col_name.EqualTo("kBlue")) {
- col_val = 600;
- } else if (col_name.EqualTo("kYellow")) {
- col_val = 400;
- } else if (col_name.EqualTo("kMagenta")) {
- col_val = 616;
- } else if (col_name.EqualTo("kCyan")) {
- col_val = 432;
- } else if (col_name.EqualTo("kOrange")) {
- col_val = 800;
- } else if (col_name.EqualTo("kSpring")) {
- col_val = 820;
- } else if (col_name.EqualTo("kTeal")) {
- col_val = 840;
- } else if (col_name.EqualTo("kAzure")) {
- col_val = 860;
- } else if (col_name.EqualTo("kViolet")) {
- col_val = 880;
- } else if (col_name.EqualTo("kPink")) {
- col_val = 900;
- }
- TString col_num(color(cut + 1, color.Length()));
- if (col_num.Length() > 0) {
- if (color.Contains("+")) {
- col_val += col_num.Atoi();
- } else {
- col_val -= col_num.Atoi();
- }
- }
- return col_val;
- } else {
- return color.Atoi();
- }
-}
-
void FairEventManager::SetTransparency(Bool_t use_xml, Int_t trans)
{
if (!use_xml) { // high transparency
diff --git a/fairroot/eventdisplay/FairEventManager.h b/fairroot/eventdisplay/FairEventManager.h
index a204344c65..e40478e43f 100644
--- a/fairroot/eventdisplay/FairEventManager.h
+++ b/fairroot/eventdisplay/FairEventManager.h
@@ -47,7 +47,6 @@ class FairEventManager : public TEveEventManager
virtual void PrevEvent(); // *MENU*
virtual void Close();
virtual void DisplaySettings(); // *Menu*
- virtual Int_t Color(Int_t pdg);
void AddTask(FairTask* t) { fRunAna->AddTask(t); }
virtual void Init(Int_t visopt = 1, Int_t vislvl = 3, Int_t maxvisnds = 10000);
virtual Int_t GetCurrentEvent() { return fEntry; }
@@ -85,6 +84,11 @@ class FairEventManager : public TEveEventManager
min = fTimeMin;
max = fTimeMax;
};
+ /**
+ *
+ * @return name of the xml file with configuration of event display
+ */
+ TString GetXMLConfig() const { return fXMLConfig; };
virtual void AddParticlesToPdgDataBase(Int_t pdg = 0);
/**
* set detector's transparency
@@ -147,8 +151,6 @@ class FairEventManager : public TEveEventManager
TEveProjectionAxes* GetRPhiAxes() const { return fAxesPhi; };
TEveProjectionAxes* GetRhoZAxes() const { return fAxesRho; };
virtual void LoadXMLSettings();
- void LoadXMLDetector(TGeoNode* node, FairXMLNode* xml, Int_t depth = 0);
- Int_t StringToColor(TString color) const;
private:
FairRunAna* fRunAna; //!
@@ -179,7 +181,6 @@ class FairEventManager : public TEveEventManager
TEveText* fEventTimeText{nullptr}; //!
TEveText* fEventNumberText{nullptr}; //!
TString fXMLConfig;
- std::map fPDGToColor;
void SetTransparencyForLayer(TGeoNode* node, Int_t depth, Char_t transparency);
static FairEventManager* fgRinstance; //!
FairEventManager(const FairEventManager&);
diff --git a/fairroot/eventdisplay/LinkDef.h b/fairroot/eventdisplay/LinkDef.h
index 0a627e32aa..6ecb3917aa 100644
--- a/fairroot/eventdisplay/LinkDef.h
+++ b/fairroot/eventdisplay/LinkDef.h
@@ -42,5 +42,7 @@
#pragma link C++ class FairTimebasedMCSource;
#pragma link C++ class FairTimebasedMCHitSource;
#pragma link C++ class FairGetEventTime + ;
-
+#pragma link C++ class FairXMLDetectorConf + ;
+#pragma link C++ class FairXMLPdgColor + ;
+#pragma link C++ class FairXMLEveConf + ;
#endif
diff --git a/fairroot/eventdisplay/tracks/FairEveGeoTracks.cxx b/fairroot/eventdisplay/tracks/FairEveGeoTracks.cxx
index 003df84c00..b91cc42bfc 100644
--- a/fairroot/eventdisplay/tracks/FairEveGeoTracks.cxx
+++ b/fairroot/eventdisplay/tracks/FairEveGeoTracks.cxx
@@ -20,6 +20,7 @@
#include "FairEventManager.h" // for FairEventManager
#include "FairGetEventTime.h"
#include "FairRootManager.h" // for FairRootManager
+#include "FairXMLNode.h"
#include
#include // for TClonesArray
@@ -47,7 +48,7 @@ FairEveGeoTracks::FairEveGeoTracks()
InitStatus FairEveGeoTracks::Init()
{
- FairEventManager* eveManager = GetEventManager();
+ FairEventManager* eveManager = FairEventManager::Instance();
auto& mngr = eveManager->GetRootManager();
fContainer = dynamic_cast(mngr.GetObject("GeoTracks"));
if (!fContainer) {
@@ -56,7 +57,16 @@ InitStatus FairEveGeoTracks::Init()
}
fBranch = mngr.GetInTree()->GetBranch("GeoTracks");
FairGetEventTime::Instance().Init();
- return FairEveTracks::Init();
+ TString xmlConfig = eveManager->GetXMLConfig();
+ if (xmlConfig.Length() > 4) {
+ FairXMLFile file(xmlConfig);
+ FairXMLNode* root = file.GetRootNode();
+ FairXMLNode* mcColors = root->GetChild("MCTracksColors");
+ if (mcColors) {
+ fXMLConf = FairXMLPdgColor(mcColors);
+ }
+ }
+ return kSUCCESS;
}
void FairEveGeoTracks::DrawTrack(Int_t id)
@@ -65,7 +75,7 @@ void FairEveGeoTracks::DrawTrack(Int_t id)
if (!CheckCuts(tr))
return;
auto p = static_cast(tr->GetParticle());
- Color_t color = GetEventManager()->Color(p->GetPdgCode());
+ Color_t color = fXMLConf.GetColor(p->GetPdgCode());
TEveTrackList* trList = FindTrackGroup(p->GetName(), color);
auto track = new FairEveTrack(p, p->GetPdgCode(), trList->GetPropagator());
@@ -97,7 +107,7 @@ void FairEveGeoTracks::DrawAnimatedTrack(TGeoTrack* tr, double t0)
if (tr->GetPoint(0)[3] * timeScale + t0 > fTMax)
return; // first point after tmax
auto p = static_cast(tr->GetParticle());
- Color_t color = GetEventManager()->Color(p->GetPdgCode());
+ Color_t color = fXMLConf.GetColor(p->GetPdgCode());
TEveTrackList* trList = FindTrackGroup(p->GetName(), color);
auto track = new FairEveTrack(p, p->GetPdgCode(), trList->GetPropagator());
track->SetElementTitle(Form("p={%4.3f,%4.3f,%4.3f}", p->Px(), p->Py(), p->Pz()));
diff --git a/fairroot/eventdisplay/tracks/FairEveGeoTracks.h b/fairroot/eventdisplay/tracks/FairEveGeoTracks.h
index 563a3171aa..73c4ff1484 100644
--- a/fairroot/eventdisplay/tracks/FairEveGeoTracks.h
+++ b/fairroot/eventdisplay/tracks/FairEveGeoTracks.h
@@ -18,6 +18,7 @@
#include "FairEveTracks.h" // for FairEveTracks
#include "FairTask.h" // for InitStatus
+#include "FairXMLPdgColor.h"
#include
#include // for THashConsistencyHolder, ClassDef
@@ -41,6 +42,7 @@ class FairEveGeoTracks : public FairEveTracks
Bool_t fUsePdg;
Int_t fPdgCut;
Double_t fTMin, fTMax;
+ FairXMLPdgColor fXMLConf;
TBranch* fBranch = nullptr;
FairTimebasedDataHandlerT fGeoTrackHandler;
diff --git a/fairroot/eventdisplay/tracks/FairEveTracks.cxx b/fairroot/eventdisplay/tracks/FairEveTracks.cxx
index 414bd1aeda..757f66cfc3 100644
--- a/fairroot/eventdisplay/tracks/FairEveTracks.cxx
+++ b/fairroot/eventdisplay/tracks/FairEveTracks.cxx
@@ -14,27 +14,21 @@
* Warsaw University of Technology, Faculty of Physics
*/
- #include "FairEveTracks.h"
- #include // for kFALSE, kTRUE, Bool_t, Color_t
- #include // for TEveManager, gEve
- #include // for TEveTrackList
- #include // for TEveTrackPropagator
- #include // for TString
- #include // for for_each
- #include // for __list_iterator, operator!=
- #include "FairEveRecoTrackList.h" // for FairEveRecoTrackList
- #include "FairEventManager.h" // for FairEventManager
+#include "FairEveTracks.h"
+#include "FairEveRecoTrackList.h" // for FairEveRecoTrackList
+#include "FairEventManager.h" // for FairEventManager
+
+#include // for kFALSE, kTRUE, Bool_t, Color_t
+#include // for TEveManager, gEve
+#include // for TEveTrackList
+#include // for TEveTrackPropagator
+#include // for TString
+#include // for for_each
+#include // for __list_iterator, operator!=
FairEveTracks::FairEveTracks(Bool_t acceptCompound)
- : fEventManager(nullptr)
- , fPt{0, 10}
- , fEta{-10, 10}
- , fEnergy{0, 10}
- , fUsePt(kFALSE)
- , fUseEta(kFALSE)
- , fUseEnergy(kFALSE)
- , fAcceptCompound(acceptCompound)
+ : fAcceptCompound(acceptCompound)
{}
void FairEveTracks::ToggleTracks()
@@ -51,12 +45,6 @@ void FairEveTracks::ToggleTracks()
gEve->Redraw3D(kFALSE);
}
-InitStatus FairEveTracks::Init()
-{
- fEventManager = FairEventManager::Instance();
- return kSUCCESS;
-}
-
FairEveTracks::~FairEveTracks() {}
TEveTrackList *FairEveTracks::FindTrackGroup(TString groupName, Color_t color)
diff --git a/fairroot/eventdisplay/tracks/FairEveTracks.h b/fairroot/eventdisplay/tracks/FairEveTracks.h
index ae443493cf..1a46a705b0 100644
--- a/fairroot/eventdisplay/tracks/FairEveTracks.h
+++ b/fairroot/eventdisplay/tracks/FairEveTracks.h
@@ -16,19 +16,19 @@
#ifndef FAIRTEVERACKS_H_
#define FAIRTEVERACKS_H_
-#include // for THashConsistencyHolder, ClassDef
-#include // for Double_t, Bool_t, kFALSE, Color_t
-#include // for TEveElement
-#include // for TNamed
-#include // for TString
-#include "FairTask.h" // for InitStatus
-class FairEventManager; // lines 23-23
+#include "FairTask.h" // for InitStatus
+
+#include // for THashConsistencyHolder, ClassDef
+#include // for Double_t, Bool_t, kFALSE, Color_t
+#include // for TEveElement
+#include // for TNamed
+#include // for TString
+class FairEventManager; // lines 23-23
class TBuffer;
class TClass;
class TEveTrackList; // lines 24-24
class TMemberInspector;
-
/**
* base evelement that represents tracks
*/
@@ -36,13 +36,12 @@ class FairEveTracks
: public TEveElement
, public TNamed
{
- FairEventManager *fEventManager; //!
- Double_t fPt[2];
- Double_t fEta[2];
- Double_t fEnergy[2];
- Bool_t fUsePt;
- Bool_t fUseEta;
- Bool_t fUseEnergy;
+ Double_t fPt[2]{0, 10};
+ Double_t fEta[2]{-10, 10};
+ Double_t fEnergy[2]{0, 10};
+ Bool_t fUsePt{kFALSE};
+ Bool_t fUseEta{kFALSE};
+ Bool_t fUseEnergy{kFALSE};
const Bool_t fAcceptCompound;
protected:
@@ -55,7 +54,6 @@ class FairEveTracks
Bool_t UsePtCut() const { return fUsePt; };
Bool_t UseEtaCut() const { return fUseEta; };
Bool_t UseEnergyCut() const { return fUseEnergy; };
- FairEventManager *GetEventManager() const { return fEventManager; };
/**
*
* @param groupName - name of the track group
@@ -118,7 +116,7 @@ class FairEveTracks
* reset group, repaint tracks assigned to this class
*/
virtual void Repaint() = 0;
- virtual InitStatus Init();
+ virtual InitStatus Init() { return kSUCCESS; }
virtual ~FairEveTracks();
ClassDef(FairEveTracks, 0)
};
diff --git a/fairroot/eventdisplay/xml/FairXMLDetectorConf.cxx b/fairroot/eventdisplay/xml/FairXMLDetectorConf.cxx
new file mode 100644
index 0000000000..31f6be438d
--- /dev/null
+++ b/fairroot/eventdisplay/xml/FairXMLDetectorConf.cxx
@@ -0,0 +1,97 @@
+/*
+ * FairXMLDetectorConf.cxx
+ *
+ * Created on: 21 paź 2021
+ * Author: Daniel Wielanek
+ * E-mail: daniel.wielanek@gmail.com
+ * Warsaw University of Technology, Faculty of Physics
+ */
+
+#include "FairXMLDetectorConf.h"
+
+#include "FairXMLNode.h"
+
+#include
+#include
+#include
+#include
+
+FairXMLDetectorConf::FairXMLDetectorConf(FairXMLNode* node)
+{
+ if (!node)
+ return;
+ if (TString(node->GetName()) == "detector") {
+ SetGood();
+ }
+ if (!IsGood())
+ return;
+ if (node->GetAttrib("transparency")) {
+ TString transparency = node->GetAttrib("transparency")->GetValue();
+ fTransparency = (Char_t)(transparency.Atoi());
+ fDefTransparency = kFALSE;
+ }
+ if (node->GetAttrib("name")) {
+ fName = node->GetAttrib("name")->GetValue();
+ }
+ if (node->GetAttrib("color")) {
+ TString col = node->GetAttrib("color")->GetValue();
+ fColor = StringToColor(col);
+ fDefColor = kFALSE;
+ }
+ if (node->GetAttrib("recursive")) {
+ TString recu = node->GetAttrib("recursive")->GetValue();
+ fRecursive = recu.Atoi();
+ }
+ for (int i = 0; i < node->GetNChildren(); i++) {
+ FairXMLDetectorConf conf(node->GetChild(i));
+ if (conf.IsGood()) {
+ AddChild(conf);
+ }
+ }
+}
+
+void FairXMLDetectorConf::SetupSubNode(TGeoNode& node, Int_t depth) const
+{
+ if (depth < 0)
+ return;
+ ChangeNode(node);
+ if (depth > 0) {
+ for (int i = 0; i < node.GetNdaughters(); i++) {
+ SetupSubNode(*node.GetDaughter(i), depth - 1);
+ }
+ }
+}
+
+void FairXMLDetectorConf::SetupNode(TGeoNode& node)
+{
+ TString nameNodeGeo = node.GetName();
+ if (nameNodeGeo != GetDetectorName())
+ return;
+ if (fRecursive > 0) {
+ SetupSubNode(node, fRecursive);
+ } else {
+ ChangeNode(node);
+ for (int i = 0; i < node.GetNdaughters(); i++) {
+ TGeoNode* dau = node.GetDaughter(i);
+ TString name = dau->GetName();
+ for (int j = 0; j < GetNChildren(); j++) {
+ if (name == fChild[j].GetDetectorName()) {
+ fChild[j].SetupNode(*dau);
+ // node configured don't need anymore the daughter
+ fChild.erase(std::next(fChild.begin(), j--));
+ break;
+ }
+ }
+ }
+ }
+}
+
+void FairXMLDetectorConf::ChangeNode(TGeoNode& node) const
+{
+ if (!fDefTransparency)
+ node.GetVolume()->SetTransparency(fTransparency);
+ if (!fDefColor) {
+ node.GetVolume()->SetFillColor(fColor);
+ node.GetVolume()->SetLineColor(fColor);
+ }
+}
diff --git a/fairroot/eventdisplay/xml/FairXMLDetectorConf.h b/fairroot/eventdisplay/xml/FairXMLDetectorConf.h
new file mode 100644
index 0000000000..65356dd0ab
--- /dev/null
+++ b/fairroot/eventdisplay/xml/FairXMLDetectorConf.h
@@ -0,0 +1,51 @@
+/********************************************************************************
+ * Copyright (C) 2020-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
+ * *
+ * This software is distributed under the terms of the *
+ * GNU Lesser General Public Licence (LGPL) version 3, *
+ * copied verbatim in the file "LICENSE" *
+ ********************************************************************************/
+
+/*
+ * FairXMLDetectorConf.h
+ *
+ * Created on: 21 paź 2021
+ * Author: Daniel Wielanek
+ * E-mail: daniel.wielanek@gmail.com
+ * Warsaw University of Technology, Faculty of Physics
+ */
+#ifndef FAIRROOT_EVENTDISPLAY_XML_FAIRXMLDETECTORCONF_H_
+#define FAIRROOT_EVENTDISPLAY_XML_FAIRXMLDETECTORCONF_H_
+
+#include "FairXMLEveConf.h"
+
+#include
+#include
+
+class TGeoNode;
+class FairXMLNode;
+
+class FairXMLDetectorConf : public FairXMLEveConf
+{
+ std::vector fChild;
+ TString fName{""};
+ Int_t fRecursive{0};
+ Color_t fColor{kWhite};
+ Char_t fTransparency{'0'};
+ Bool_t fDefColor{kTRUE};
+ Bool_t fDefTransparency{kTRUE};
+ void ChangeNode(TGeoNode& node) const;
+ void SetupSubNode(TGeoNode& node, Int_t depth) const;
+
+ public:
+ FairXMLDetectorConf(FairXMLNode* node = nullptr);
+ void SetupNode(TGeoNode& node);
+ void AddChild(FairXMLDetectorConf& set) { fChild.push_back(set); };
+ Int_t GetNChildren() const { return fChild.size(); }
+ TString GetDetectorName() const { return fName; }
+ const FairXMLDetectorConf& GetChild(Int_t n) const { return fChild[n]; };
+ virtual ~FairXMLDetectorConf(){};
+ ClassDefOverride(FairXMLDetectorConf, 1);
+};
+
+#endif /* FAIRROOT_EVENTDISPLAY_XML_FAIRXMLDETECTORCONF_H_ */
diff --git a/fairroot/eventdisplay/xml/FairXMLEveConf.cxx b/fairroot/eventdisplay/xml/FairXMLEveConf.cxx
new file mode 100644
index 0000000000..e788ba0acf
--- /dev/null
+++ b/fairroot/eventdisplay/xml/FairXMLEveConf.cxx
@@ -0,0 +1,66 @@
+/*
+ * FairXMLEveConf.cxx
+ *
+ * Created on: 21 paź 2021
+ * Author: Daniel Wielanek
+ * E-mail: daniel.wielanek@gmail.com
+ * Warsaw University of Technology, Faculty of Physics
+ */
+#include "FairXMLEveConf.h"
+
+Int_t FairXMLEveConf::StringToColor(const TString& color) const
+{
+ if (color.Contains("k")) {
+ Int_t plus_index = color.First('+');
+ Int_t minus_index = color.First('-');
+ Int_t cut = plus_index;
+ if (cut == -1)
+ cut = minus_index;
+ if (cut == -1)
+ cut = color.Length();
+ TString col_name(color(0, cut));
+ Int_t col_val = 0;
+ if (col_name.EqualTo("kWhite")) {
+ col_val = 0;
+ } else if (col_name.EqualTo("kBlack")) {
+ col_val = 1;
+ } else if (col_name.EqualTo("kGray")) {
+ col_val = 920;
+ } else if (col_name.EqualTo("kRed")) {
+ col_val = 632;
+ } else if (col_name.EqualTo("kGreen")) {
+ col_val = 416;
+ } else if (col_name.EqualTo("kBlue")) {
+ col_val = 600;
+ } else if (col_name.EqualTo("kYellow")) {
+ col_val = 400;
+ } else if (col_name.EqualTo("kMagenta")) {
+ col_val = 616;
+ } else if (col_name.EqualTo("kCyan")) {
+ col_val = 432;
+ } else if (col_name.EqualTo("kOrange")) {
+ col_val = 800;
+ } else if (col_name.EqualTo("kSpring")) {
+ col_val = 820;
+ } else if (col_name.EqualTo("kTeal")) {
+ col_val = 840;
+ } else if (col_name.EqualTo("kAzure")) {
+ col_val = 860;
+ } else if (col_name.EqualTo("kViolet")) {
+ col_val = 880;
+ } else if (col_name.EqualTo("kPink")) {
+ col_val = 900;
+ }
+ TString col_num(color(cut + 1, color.Length()));
+ if (col_num.Length() > 0) {
+ if (color.Contains("+")) {
+ col_val += col_num.Atoi();
+ } else {
+ col_val -= col_num.Atoi();
+ }
+ }
+ return col_val;
+ } else {
+ return color.Atoi();
+ }
+}
diff --git a/fairroot/eventdisplay/xml/FairXMLEveConf.h b/fairroot/eventdisplay/xml/FairXMLEveConf.h
new file mode 100644
index 0000000000..97334d42b8
--- /dev/null
+++ b/fairroot/eventdisplay/xml/FairXMLEveConf.h
@@ -0,0 +1,39 @@
+/********************************************************************************
+ * Copyright (C) 2020-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
+ * *
+ * This software is distributed under the terms of the *
+ * GNU Lesser General Public Licence (LGPL) version 3, *
+ * copied verbatim in the file "LICENSE" *
+ ********************************************************************************/
+
+/*
+ * FairXMLEveConf.h
+ *
+ * Created on: 21 paź 2021
+ * Author: Daniel Wielanek
+ * E-mail: daniel.wielanek@gmail.com
+ * Warsaw University of Technology, Faculty of Physics
+ */
+#ifndef FAIRROOT_EVENTDISPLAY_XML_FAIRXMLEVECONF_H_
+#define FAIRROOT_EVENTDISPLAY_XML_FAIRXMLEVECONF_H_
+
+#include
+
+class FairXMLEveConf
+
+{
+ bool fIsGood{false};
+
+ protected:
+ Int_t StringToColor(const TString& color) const;
+ void SetGood() { fIsGood = kTRUE; }
+ void SetBad() { fIsGood = kFALSE; }
+
+ public:
+ FairXMLEveConf() = default;
+ bool IsGood() const { return fIsGood; }
+ virtual ~FairXMLEveConf() = default;
+ ClassDef(FairXMLEveConf, 1)
+};
+
+#endif /* FAIRROOT_EVENTDISPLAY_XML_FAIRXMLEVECONF_H_ */
diff --git a/fairroot/eventdisplay/xml/FairXMLPdgColor.cxx b/fairroot/eventdisplay/xml/FairXMLPdgColor.cxx
new file mode 100644
index 0000000000..11fef5e99c
--- /dev/null
+++ b/fairroot/eventdisplay/xml/FairXMLPdgColor.cxx
@@ -0,0 +1,101 @@
+/*
+ * FairXMLPdgColor.cxx
+ *
+ * Created on: 21 paź 2021
+ * Author: Daniel Wielanek
+ * E-mail: daniel.wielanek@gmail.com
+ * Warsaw University of Technology, Faculty of Physics
+ */
+
+#include "FairXMLPdgColor.h"
+
+#include "FairXMLNode.h"
+
+#include
+
+FairXMLPdgColor::FairXMLPdgColor(FairXMLNode* node)
+{
+ if (!node) {
+ SetDefColor();
+ SetGood();
+ return;
+ }
+
+ if (node->GetNChildren()) {
+ FairXMLNode* pdgcol = node->GetChild(0);
+ if (pdgcol->GetAttrib("color") && pdgcol->GetAttrib("pdg"))
+ SetGood();
+ } else {
+ SetDefColor();
+ SetGood();
+ }
+ for (int i = 0; i < node->GetNChildren(); i++) {
+ FairXMLNode* colors = node->GetChild(i);
+ TString pgd_code = colors->GetAttrib("pdg")->GetValue();
+ TString color_code = colors->GetAttrib("color")->GetValue();
+ fPDGToColor[pgd_code.Atoi()] = StringToColor(color_code);
+ }
+}
+
+Int_t FairXMLPdgColor::GetColor(Int_t pdg) const
+{
+ if (fPDGToColor.find(pdg) != fPDGToColor.end()) {
+ return fPDGToColor.at(pdg);
+ }
+ return 0;
+}
+
+FairXMLPdgColor::~FairXMLPdgColor() {}
+
+void FairXMLPdgColor::SetDefColor()
+{
+ fPDGToColor[22] = 623; // photon
+ fPDGToColor[-2112] = 2; // anti-neutron
+ fPDGToColor[-11] = 3; // e+
+ fPDGToColor[-3122] = 4; // anti-lambda
+ fPDGToColor[11] = 5; // e-
+ fPDGToColor[-3222] = 6; // Sigma -
+ fPDGToColor[12] = 7; // e-neutrino
+ fPDGToColor[-3212] = 8; // Sigma0
+ fPDGToColor[-13] = 9; // mu+
+ fPDGToColor[-3112] = 10; // Sigma+ (PB
+ fPDGToColor[13] = 11; // mu-
+ fPDGToColor[-3322] = 12; // Xi0
+ fPDGToColor[111] = 13; // pi0
+ fPDGToColor[-3312] = 14; // Xi+
+ fPDGToColor[211] = 15; // pi+
+ fPDGToColor[-3334] = 16; // Omega+ (PB)
+ fPDGToColor[-211] = 17; // pi-
+ fPDGToColor[-15] = 18; // tau+
+ fPDGToColor[130] = 19; // K long
+ fPDGToColor[15] = 20; // tau -
+ fPDGToColor[321] = 21; // K+
+ fPDGToColor[411] = 22; // D+
+ fPDGToColor[-321] = 23; // K-
+ fPDGToColor[-411] = 24; // D-
+ fPDGToColor[2112] = 25; // n
+ fPDGToColor[421] = 26; // D0
+ fPDGToColor[2212] = 27; // p
+ fPDGToColor[-421] = 28; // D0
+ fPDGToColor[-2212] = 29; // anti-proton
+ fPDGToColor[431] = 30; // Ds+
+ fPDGToColor[310] = 31; // K short
+ fPDGToColor[-431] = 32; // anti Ds-
+ fPDGToColor[221] = 33; // eta
+ fPDGToColor[4122] = 34; // Lambda_C+
+ fPDGToColor[3122] = 35; // Lambda
+ fPDGToColor[24] = 36; // W+
+ fPDGToColor[3222] = 37; // Sigma+
+ fPDGToColor[-24] = 38; // W-
+ fPDGToColor[3212] = 39; // Sigma0
+ fPDGToColor[23] = 40; // Z
+ fPDGToColor[3112] = 41; // Sigma -
+ fPDGToColor[3322] = 42; // Xi0
+ fPDGToColor[3312] = 43; // Xi-
+ fPDGToColor[3334] = 44; // Omega- (PB)
+ fPDGToColor[50000050] = 801; // Cerenkov
+ fPDGToColor[1000010020] = 45;
+ fPDGToColor[1000010030] = 48;
+ fPDGToColor[1000020040] = 50;
+ fPDGToColor[1000020030] = 55;
+}
diff --git a/fairroot/eventdisplay/xml/FairXMLPdgColor.h b/fairroot/eventdisplay/xml/FairXMLPdgColor.h
new file mode 100644
index 0000000000..19a8bff907
--- /dev/null
+++ b/fairroot/eventdisplay/xml/FairXMLPdgColor.h
@@ -0,0 +1,37 @@
+/********************************************************************************
+ * Copyright (C) 2020-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
+ * *
+ * This software is distributed under the terms of the *
+ * GNU Lesser General Public Licence (LGPL) version 3, *
+ * copied verbatim in the file "LICENSE" *
+ ********************************************************************************/
+/*
+ * FairXMLPdgColor.h
+ *
+ * Created on: 21 paź 2021
+ * Author: Daniel Wielanek
+ * E-mail: daniel.wielanek@gmail.com
+ * Warsaw University of Technology, Faculty of Physics
+ */
+#ifndef FAIRROOT_EVENTDISPLAY_XML_FAIRXMLPDGCOLOR_H_
+#define FAIRROOT_EVENTDISPLAY_XML_FAIRXMLPDGCOLOR_H_
+
+#include "FairXMLEveConf.h"
+
+#include