32 #include <TClonesArray.h>
33 #include <TDatabasePDG.h>
34 #include <TEveCompound.h>
35 #include <TEveElement.h>
36 #include <TEveManager.h>
37 #include <TEveTrack.h>
38 #include <TEveTrackPropagator.h>
40 #include <TObjArray.h>
41 #include <TParticle.h>
48 , fContainerReco(nullptr)
49 , fContainerSim(nullptr)
53 , fShowSecondary(kTRUE)
60 SetElementNameTitle(
"FairEveRecoTracksExample",
"FairEveRecoTracksExample");
80 Double_t energy = TMath::Sqrt(mom.Mag2() + 0.139 * 0.139);
96 Color_t col = kYellow;
97 TString gropuName =
"neutral";
98 Int_t dummy_pid = 111;
112 dummy_pid, 0, 0, 0, 0, 0, par.
GetPx(), par.
GetPy(), par.
GetPz(), 0, par.
GetX(), par.
GetY(), par.
GetZ(), 0);
114 track->SetElementTitle(Form(
"p={%4.3f,%4.3f,%4.3f}", p.Px(), p.Py(), p.Pz()));
116 TVector3 pos(p.Vx(), p.Vy(), p.Vz());
117 TVector3 mom(p.Px(), p.Py(), p.Pz());
118 track->GetRecoTrack()->SetFirstPoint(mom, pos);
119 Double_t charge = par.
GetQ();
120 Double_t P = 1.0 / mom.Mag();
121 Double_t vecRKIn[7] = {pos.X(), pos.Y(), pos.Z(), mom.Px() * P, mom.Py() * P, mom.Pz() * P, 1.0 / P};
122 Double_t vec1[3] = {0, 1, 0};
123 Double_t vec2[3] = {1, 0, 0};
124 Double_t vec3[3] = {0, 0, 0};
127 for (
int i = 0; i < 100; i++) {
130 pos.SetXYZ(vecOut[0], vecOut[1], vecOut[2]);
131 track->GetRecoTrack()->SetNextPoint(pos);
135 switch (hitid.first) {
138 track->AddHit(TVector3(hit->
GetX(), hit->
GetY(), hit->
GetZ()));
142 track->AddHit(TVector3(hit->
GetX(), hit->
GetY(), hit->
GetZ()));
164 track->InitMCTrack(&p_mc);
169 vecRKIn[3] = mc->
GetPx() * P;
170 vecRKIn[4] = mc->
GetPy() * P;
171 vecRKIn[5] = mc->
GetPz() * P;
172 vecRKIn[6] = 1.0 / P;
173 for (
double z = mc->
GetStartZ(); z < 100; z++) {
176 pos.SetXYZ(vecOut[0], vecOut[1], vecOut[2]);
177 track->GetMCTrack()->SetNextPoint(pos);
180 track->CloseCompound();
181 track->GetRecoTrack()->SetRnrLine(kTRUE);
182 trList->AddElement(track);
187 Int_t nTracks = fContainerReco->GetEntriesFast();
189 for (
int i = 0; i < nTracks; i++) {
192 gEve->Redraw3D(kFALSE);
198 fContainerReco = (TClonesArray *)mngr->
GetObject(
"FairTutPropTracks");
199 if (fContainerReco ==
nullptr) {
200 LOG(
ERROR) <<
"Reco traks not found";
203 fHits1 = (TClonesArray *)mngr->
GetObject(
"FairTutPropHits");
204 fHits2 = (TClonesArray *)mngr->
GetObject(
"FairTutPropHits2");
205 if (fHits1 ==
nullptr || fHits2 ==
nullptr) {
206 LOG(
ERROR) <<
"Hits not found";
209 fContainerSim = (TClonesArray *)mngr->
GetObject(
"MCTrack");
210 if (fContainerSim ==
nullptr) {
211 LOG(
WARNING) <<
"No branch with MC tracks";
215 if (field ==
nullptr) {
216 LOG(
ERROR) <<
"Lack of magnetic field map!";
220 fPDG = TDatabasePDG::Instance();
virtual Double_t GetPz() const
Double_t GetStartT() const
Double_t GetStartY() const
Double_t GetEtaMax() const
FairTrackParP GetParamFirst()
Double_t GetStartX() const
Bool_t UseEnergyCut() const
static FairRootManager * Instance()
Double_t GetEnergyMin() const
TObject * GetObject(const char *BrName)
void SetMainColor(Color_t color)
virtual Double_t GetPx() const
Double_t GetEnergyMax() const
void SetDrawMC(Bool_t draw)
static FairRunAna * Instance()
FairMQExParamsParOne * par
Double_t GetStartZ() const
virtual InitStatus Init()
virtual Double_t GetPy() const
Bool_t CheckCuts(FairTutPropTrack *tr)
Double_t GetPtMax() const
virtual InitStatus Init()
virtual ~FairEveRecoTracksExample()
Double_t GetEtaMin() const
FairEveRecoTracksExample()
std::pair< int, int > GetHitIndex(int i)
TEveTrackList * FindTrackGroup(TString groupName, Color_t color)
Double_t GetPtMin() const
Double_t GetEnergy() const
void PropagateToPlane(double Charge, double *vecRKIn, double *vec1, double *vec2, double *vec3, double *vecOut)