9#include "CorrFitDumpedPairAnaHorizontal.h"
11#include <TApplication.h>
13#include <TClonesArray.h>
14#include <TCollection.h>
15#include <TDirectoryFile.h>
28#include "CorrFitDumpedPairAna.h"
29#include "CorrFitInfo.h"
30#include "CorrFitParamsSetup.h"
34#include "FemtoConst.h"
35#include "FemtoCorrFunc.h"
36#include "FemtoCorrFuncSimple.h"
37#include "FemtoDumpPairAna.h"
38#include "FemtoFreezoutGenerator.h"
39#include "FemtoMiniPair.h"
42#include "FemtoSourceModel.h"
43#include "FemtoWeightGenerator.h"
44#include "FemtoWeightGeneratorLednicky.h"
49 CorrFitDumpedPairAnaHorizontal::CorrFitDumpedPairAnaHorizontal(Int_t jobid, Int_t maps_perAna) :
50 CorrFitDumpedPairAna(jobid, maps_perAna) {}
52 Bool_t CorrFitDumpedPairAnaHorizontal::Init() {
53 Bool_t preinit = CorrFitDumpedPairAna::Init();
57 void CorrFitDumpedPairAnaHorizontal::Finish() {
58 TObject* obj =
nullptr;
59 for (
int iJob = 0; iJob < fMultiplyJobs; iJob++) {
60 obj = fCF[iJob]->GetCF(0);
61 Bool_t exported = SaveAsRawArray(obj, iJob);
62 if (!exported) Cout::Text(
"Not supported CF",
"L", kRed);
65 obj = fCF[0]->GetCF(0);
66 TFile* file =
new TFile(
"files/config.root",
"recreate");
67 CorrFitInfo* info =
new CorrFitInfo();
73 while (std::getline(macro, line)) {
79 info->SetMacroText(val);
80 info->SetPairFile(fPairFile);
82 auto source = fGenerator[0]->GetSourceModel();
84 CorrFitParamsSetup* setup =
new CorrFitParamsSetup(
"corrfit_conf.xml");
85 info->SetSetup(*setup);
91 void CorrFitDumpedPairAnaHorizontal::RunSignalPair() {
92 for (
auto clones : fSignalClones) {
93 for (
int jPair = 0; jPair < clones->GetEntriesFast(); jPair++) {
94 auto MiniPair = (FemtoMicroPair*) clones->UncheckedAt(jPair);
96 for (
int preMulti = 0; preMulti < fMultiplyPreprocess; preMulti++) {
100 for (
int nJobs = 0; nJobs < fMultiplyJobs; nJobs++) {
101 for (
int weightMulti = 0; weightMulti < fMultiplyWeight; weightMulti++) {
102 fGenerator[nJobs]->GenerateFreezoutCooordinates(fPair);
103 fPair->SetWeight(fWeight->GenerateWeight(fPair));
104 fCF[nJobs]->FillNum(fPair);
105 fPair->SetWeight(1.0);
106 fCF[nJobs]->FillDenMixed(fPair);
114 void CorrFitDumpedPairAnaHorizontal::RunSignalBackgroundPair() {
115 for (
auto clones : fSignalClones) {
116 for (
int jSig = 0; jSig < clones->GetEntriesFast(); jSig++) {
117 auto MiniPair = (FemtoMicroPair*) clones->UncheckedAt(jSig);
119 for (
int preMulti = 0; preMulti < fMultiplyPreprocess; preMulti++) {
123 for (
int nJobs = 0; nJobs < fMultiplyJobs; nJobs++) {
124 for (
int weightPair = 0; weightPair < fMultiplyWeight; weightPair++) {
125 fGenerator[nJobs]->GenerateFreezoutCooordinates(fPair);
126 fPair->SetWeight(fWeight->GenerateWeight(fPair));
127 fCF[nJobs]->FillNum(fPair);
133 for (
auto clones : fBackgroundClones) {
134 for (
int jSig = 0; jSig < clones->GetEntriesFast(); jSig++) {
135 auto MiniPair = (FemtoMicroPair*) clones->UncheckedAt(jSig);
137 for (
int preMulti = 0; preMulti < fMultiplyPreprocess; preMulti++) {
141 for (
int nJobs = 0; nJobs < fMultiplyJobs; nJobs++) {
142 fPair->SetWeight(1 * fMultiplyWeight);
143 fCF[nJobs]->FillNum(fPair);
150 void CorrFitDumpedPairAnaHorizontal::RunBackgroundPair() {
151 for (
auto clones : fSignalClones) {
152 for (
int jMix = 0; jMix < clones->GetEntriesFast(); jMix++) {
153 auto MiniPair = (FemtoMicroPair*) clones->UncheckedAt(jMix);
155 for (
int preMulti = 0; preMulti < fMultiplyPreprocess; preMulti++) {
159 for (
int nJobs = 0; nJobs < fMultiplyJobs; nJobs++) {
160 for (
int weightPair = 0; weightPair < fMultiplyWeight; weightPair++) {
161 fGenerator[nJobs]->GenerateFreezoutCooordinates(fPair);
162 fPair->SetWeight(fWeight->GenerateWeight(fPair));
163 fCF[nJobs]->FillNum(fPair);
166 fPair->SetWeight(1.0 * fMultiplyJobs);
167 PreprocessMixedPair();
169 for (
int nJobs = 0; nJobs < fMultiplyJobs; nJobs++) {
170 fCF[nJobs]->FillDenMixed(fPair);
177 Bool_t CorrFitDumpedPairAnaHorizontal::InitGenerators(
const std::vector<int>& dims,
181 for (
int j = 0; j < fMultiplyJobs; j++) {
182 fGenerator.push_back(fTempGenerator->MakeCopy());
184 std::vector<int> arPos = Hal::Std::OneToMultiDimIndex(dims, fJobId * fMultiplyJobs + j);
187 Double_t val = setup.GetMin(i) + setup.GetStepSize(i) * ((Double_t) arPos[i]);
190 fGenerator[j]->Init();
195 Bool_t CorrFitDumpedPairAnaHorizontal::ConnectToData() {
198 Hal::Std::GetAxisPar(*fCF[0]->GetCF(0)->GetNum(), bins, min, max,
"x");
200 case eDumpCalcMode::kSignalPairs: {
201 auto vec = fGrouping->GetBranchesByValue(min, max,
true);
202 ConnectToSignal(vec);
204 case eDumpCalcMode::kBackgroundPairsOnly: {
205 auto vec = fGrouping->GetBranchesByValue(min, max,
false);
206 ConnectToBackground(vec);
208 case eDumpCalcMode::kSignalBackgroundPairs: {
209 auto vec = fGrouping->GetBranchesByValue(min, max,
false);
210 ConnectToBackground(vec);
211 vec = fGrouping->GetBranchesByValue(min, max,
true);
212 ConnectToSignal(vec);
218 Bool_t CorrFitDumpedPairAnaHorizontal::InitCFs() {
219 for (
int i = 0; i < fMultiplyJobs; i++) {
222 if (fCF.size() != 0)
return kTRUE;
226 CorrFitDumpedPairAnaHorizontal::~CorrFitDumpedPairAnaHorizontal() {
227 for (
auto cf : fCF) {
void SetParameterByName(TString name, Double_t par)
Int_t GetNChildren() const