26 #include <TClonesArray.h>
27 #include <TDatabasePDG.h>
28 #include <TEveManager.h>
29 #include <TEveTrack.h>
30 #include <TLorentzVector.h>
31 #include <TParticle.h>
32 #include <TParticlePDG.h>
35 #include <fairlogger/Logger.h>
41 , fShowSecondary(kTRUE)
47 SetElementNameTitle(
"FairMCTracks",
"FairMCTracks");
76 Bool_t primary = kTRUE;
79 if (fShowPrimary && primary)
81 if (fShowSecondary && !primary)
111 track->SetElementTitle(Form(
"p={%4.3f,%4.3f,%4.3f}", p.Px(), p.Py(), p.Pz()));
112 track->SetMainColor(color);
113 TVector3 pos(p.Vx(), p.Vy(), p.Vz());
114 TVector3 mom(p.Px(), p.Py(), p.Pz());
117 TParticlePDG *part = fPDG->GetParticle(tr->
GetPdgCode());
121 charge = part->Charge() / 3.0;
123 Double_t P = 1.0 / mom.Mag();
124 Double_t vecRKIn[7] = {pos.X(), pos.Y(), pos.Z(), mom.Px() * P, mom.Py() * P, mom.Pz() * P, 1.0 / P};
125 Double_t vec1[3] = {0, 1, 0};
126 Double_t vec2[3] = {1, 0, 0};
127 Double_t vec3[3] = {0, 0, 0};
129 for (
int i = 0; i < 100; i++) {
132 pos.SetXYZ(vecOut[0], vecOut[1], vecOut[2]);
133 track->SetNextPoint(pos);
135 track->SetRnrLine(kTRUE);
136 trList->AddElement(track);
141 Int_t nTracks = fContainer->GetEntriesFast();
143 for (
int i = 0; i < nTracks; i++) {
146 gEve->Redraw3D(kFALSE);
152 fContainer = (TClonesArray *)mngr->
GetObject(
"MCTrack");
153 if (fContainer ==
nullptr)
157 if (field ==
nullptr) {
158 LOG(
ERROR) <<
"Lack of magnetic field map!";
162 fPDG = TDatabasePDG::Instance();
Double_t GetStartT() const
Int_t GetMotherId() const
FairEventManager * GetEventManager() const
Double_t GetStartY() const
Double_t GetEtaMax() const
virtual ~FairEveMCTracks()
virtual InitStatus Init()
Double_t GetStartX() const
Bool_t UseEnergyCut() const
static FairRootManager * Instance()
Double_t GetEnergyMin() const
TObject * GetObject(const char *BrName)
void Get4Momentum(TLorentzVector &momentum)
Double_t GetEnergyMax() const
static FairRunAna * Instance()
virtual Int_t Color(Int_t pdg)
Double_t GetStartZ() const
Double_t GetPtMax() const
virtual InitStatus Init()
Bool_t CheckCuts(FairMCTrack *tr)
Double_t GetEtaMin() const
TEveTrackList * FindTrackGroup(TString groupName, Color_t color)
Double_t GetPtMin() const
Double_t GetEnergy() const
void SetFirstPoint(const TVector3 &mom, const TVector3 &pos)
void PropagateToPlane(double Charge, double *vecRKIn, double *vec1, double *vec2, double *vec3, double *vecOut)