FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairEveTracks.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2020 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 /*
9  * FairTracks.cxx
10  *
11  * Created on: 4 maj 2020
12  * Author: Daniel Wielanek
13  * E-mail: daniel.wielanek@gmail.com
14  * Warsaw University of Technology, Faculty of Physics
15  */
16 
17  #include "FairEveTracks.h"
18  #include <RtypesCore.h> // for kFALSE, kTRUE, Bool_t, Color_t
19  #include <TEveManager.h> // for TEveManager, gEve
20  #include <TEveTrack.h> // for TEveTrackList
21  #include <TEveTrackPropagator.h> // for TEveTrackPropagator
22  #include <TString.h> // for TString
23  #include <algorithm> // for for_each
24  #include <list> // for __list_iterator, operator!=
25  #include "FairEveRecoTrackList.h" // for FairEveRecoTrackList
26  #include "FairEventManager.h" // for FairEventManager
27 
28 
29 FairEveTracks::FairEveTracks(Bool_t acceptCompound)
30  : fEventManager(nullptr)
31  , fPt{0, 10}
32  , fEta{-10, 10}
33  , fEnergy{0, 10}
34  , fUsePt(kFALSE)
35  , fUseEta(kFALSE)
36  , fUseEnergy(kFALSE)
37  , fAcceptCompound(acceptCompound)
38 {}
39 
41 {
42  std::for_each(BeginChildren(), EndChildren(), [](TEveElement *trackGroup) {
43  std::for_each(trackGroup->BeginChildren(), trackGroup->EndChildren(), [](TEveElement *track) {
44  if (track->GetRnrSelf()) {
45  track->SetRnrSelfChildren(kFALSE, kFALSE);
46  } else {
47  track->SetRnrSelfChildren(kTRUE, kTRUE);
48  }
49  });
50  });
51  gEve->Redraw3D(kFALSE);
52 }
53 
55 {
56  fEventManager = FairEventManager::Instance();
57  return kSUCCESS;
58 }
59 
61 
62 TEveTrackList *FairEveTracks::FindTrackGroup(TString groupName, Color_t color)
63 {
64  auto trackGroup(static_cast<TEveTrackList *>(FindChild(groupName)));
65 
66  if (trackGroup == nullptr) {
67  TEveTrackPropagator *TrPropagator = new TEveTrackPropagator();
68  if (fAcceptCompound) {
69  trackGroup = new FairEveRecoTrackList(groupName, TrPropagator);
70  } else {
71  trackGroup = new TEveTrackList(groupName, TrPropagator);
72  }
73  AddElement(trackGroup);
74  trackGroup->SetRnrLine(kTRUE);
75  trackGroup->SetMainColor(color);
76  }
77  return trackGroup;
78 }
79 
81 {
82  std::for_each(BeginChildren(), EndChildren(), [](TEveElement *trackGroup) {
83  if (trackGroup->GetRnrSelf()) {
84  trackGroup->SetRnrSelfChildren(kFALSE, kFALSE);
85  } else {
86  trackGroup->SetRnrSelfChildren(kTRUE, kTRUE);
87  }
88  });
89  gEve->Redraw3D(kFALSE);
90 }
InitStatus
Definition: FairTask.h:33
virtual ~FairEveTracks()
FairEveTracks(Bool_t acceptCompound=kFALSE)
static FairEventManager * Instance()
virtual InitStatus Init()
TEveTrackList * FindTrackGroup(TString groupName, Color_t color)