9#include "FemtoWeightGeneratorResidual.h"
11#include "ComplexEvent.h"
12#include "ComplexTrack.h"
14#include "DataFormatManager.h"
17#include "FemtoWeightGeneratorLednicky.h"
22 FemtoWeightGeneratorResidual::FemtoWeightGeneratorResidual() :
23 fMainWeight(nullptr), fResPair(nullptr), fWeightType(eWeightType::kOther), fComplexFormat(kFALSE) {}
25 FemtoWeightGeneratorResidual::FemtoWeightGeneratorResidual(
const FemtoWeightGenerator& w) :
26 fResPair(nullptr), fWeightType(eWeightType::kOther), fComplexFormat(kFALSE) {
27 fMainWeight = w.MakeCopy();
30 FemtoWeightGeneratorResidual::FemtoWeightGeneratorResidual(
const FemtoWeightGeneratorResidual& other) :
31 FemtoWeightGenerator(other),
34 fWeightType(eWeightType::kOther),
35 fComplexFormat(kFALSE) {}
37 Double_t FemtoWeightGeneratorResidual::GenerateWeight(
FemtoPair* pair) {
42 tr1 = (
McTrack*) z1->GetImgTrack();
43 tr2 = (
McTrack*) z2->GetImgTrack();
44 if (tr1 ==
nullptr || tr2 ==
nullptr)
return 1;
54 SetPairData(tr1, tr2);
60 SetPairData(tr1, tr2);
66 SetPairData(tr1, tr2);
75 SetPairData(tr1, tr2);
78 switch (fWeightType) {
79 case eWeightType::kLednicky: {
86 return fMainWeight->GenerateWeight(fResPair);
89 Bool_t FemtoWeightGeneratorResidual::Init(Int_t task_id,
FemtoPair* pair) {
90 if (fMainWeight ==
nullptr)
return kFALSE;
91 fMainWeight->Init(task_id, pair);
92 fResPair = pair->MakeCopy();
94 const Event*
event = mngr->
GetFormat(task_id, EFormatDepth::kBuffered);
95 if (
dynamic_cast<const ComplexEvent*
>(event)) fComplexFormat = kTRUE;
96 if (
dynamic_cast<const ExpEvent*
>(event)) {
97 Cout::PrintInfo(
"Experimental format cannot be used for residual weights", EInfo::kLowWarning);
104 Package* FemtoWeightGeneratorResidual::Report()
const {
106 report->
AddObject(fMainWeight->Report());
110 void FemtoWeightGeneratorResidual::SetPairData(McTrack* track1, McTrack* track2) {
111 const TLorentzVector& pt1 = track1->GetMomentum();
112 const TLorentzVector& pt2 = track2->GetMomentum();
113 fResPair->SetPdg1(track1->GetPdg());
114 fResPair->SetPdg2(track2->GetPdg());
116 const TLorentzVector& x1 = track1->GetFreezoutPosition();
117 const TLorentzVector& x2 = track2->GetFreezoutPosition();
118 fResPair->SetFreezoutCoord1(x1.X(), x1.Y(), x1.Z(), x1.T());
119 fResPair->SetFreezoutCoord2(x2.X(), x2.Y(), x2.Z(), x2.T());
120 fResPair->SetTrueMomenta1(pt1.Px(), pt1.Py(), pt1.Pz(), pt1.E());
121 fResPair->SetTrueMomenta2(pt2.Px(), pt2.Py(), pt2.Pz(), pt2.E());
126 FemtoWeightGeneratorResidual::~FemtoWeightGeneratorResidual() {
127 if (fMainWeight)
delete fMainWeight;
128 if (fResPair)
delete fResPair;
131 FemtoWeightGeneratorResidual& FemtoWeightGeneratorResidual::operator=(
const FemtoWeightGeneratorResidual& other) {
132 if (
this == &other)
return *
this;
135 fMainWeight =
nullptr;
141 if (other.fMainWeight) { fMainWeight = other.fMainWeight->MakeCopy(); }
142 if (other.fResPair) { fResPair = other.fResPair->MakeCopy(); }
143 fWeightType = other.fWeightType;
144 fComplexFormat = other.fComplexFormat;
Track * GetTrack(Int_t i) const
Track * GetTrack2() const
Track * GetTrack1() const
void AddObject(TObject *object)
Bool_t IsGoodSecondary() const
Int_t GetMotherIndex() const