10#include "Femto1DCFAnaMapPairsDumped.h"
12#include "DividedHisto.h"
13#include "Femto1DCFAnaMapMC.h"
14#include "Femto1DMapGenerator.h"
15#include "FemtoFreezoutGenerator.h"
16#include "FemtoMiniPair.h"
18#include "FemtoSourceModel.h"
19#include "FemtoWeightGenerator.h"
22#include <TClonesArray.h>
23#include <TCollection.h>
24#include <TDirectoryFile.h>
36 Femto1DCFAnaMapPairsDumped::Femto1DCFAnaMapPairsDumped() :
37 Femto1DCFAnaMapMC(kFALSE),
38 fInFile(
"pairs.root"),
41 fPairsSignal(nullptr),
42 fPairsBackground(nullptr),
43 fUseBackground(kFALSE),
44 fWeightedBackround(kFALSE),
47 void Femto1DCFAnaMapPairsDumped::SetInFile(TString filename) { fInFile = filename; }
49 void Femto1DCFAnaMapPairsDumped::Run(Int_t start, Int_t end) {
52 end = fTree->GetEntries();
54 for (
int i = start; i < end; i++) {
56 if (!fUseBackground) {
57 MakePairsWeighted(fPairsSignal, kTRUE);
58 MakePairsUnWeighted(fPairsSignal, kFALSE);
60 MakePairsWeighted(fPairsSignal, kTRUE);
61 if (fWeightedBackround) {
62 MakePairsWeighted(fPairsBackground, kFALSE);
64 MakePairsUnWeighted(fPairsBackground, kFALSE);
70 Bool_t Femto1DCFAnaMapPairsDumped::Init() {
71 fFile =
new TFile(fInFile);
72 if (fFile->IsZombie())
return kFALSE;
73 TList* list = fFile->GetListOfKeys();
74 for (
int i = 0; i < list->GetEntries(); i++) {
75 TKey* key = (TKey*) list->At(i);
76 TObject* obj = fFile->Get(key->GetName());
77 if (obj->InheritsFrom(
"TTree")) {
82 if (fTree ==
nullptr)
return kFALSE;
83 TBranch* br = fTree->GetBranch(
"FemtoSignal.");
84 fPairsSignal =
new TClonesArray(
"Hal::FemtoMiniPair");
85 br->SetAddress(&fPairsSignal);
87 br = fTree->GetBranch(
"FemtoBackground.");
88 fPairsBackground =
new TClonesArray(
"Hal::FemtoMiniPair");
89 br->SetAddress(&fPairsBackground);
91 return Femto1DCFAnaMapMC::Init();
94 void Femto1DCFAnaMapPairsDumped::MakePairsWeighted(TClonesArray* arr, Bool_t num) {
97 hist = (TH2*) fMap->GetNum();
99 hist = (TH2*) fMap->GetDen();
102 for (
int i = 0; i < arr->GetEntriesFast(); i++) {
103 FemtoMiniPair* mini = (FemtoMiniPair*) arr->UncheckedAt(i);
106 Double_t k = fPair->GetT();
107 if (fIgnoreSign) { k = TMath::Abs(k); }
108 for (
int r_bin = 0; r_bin < fRBins; r_bin++) {
109 Double_t R = fRadiiBins[r_bin];
110 fGenerator->GetSourceModel()->SetRadius(R);
111 fGenerator->GenerateFreezoutCooordinates(fPair);
112 Double_t weight = fWeight->GenerateWeight(fPair);
113 hist->Fill(k, R, weight);
118 void Femto1DCFAnaMapPairsDumped::MakePairsUnWeighted(TClonesArray* arr, Bool_t num) {
121 hist = (TH2*) fMap->GetNum();
123 hist = (TH2*) fMap->GetDen();
125 for (
int i = 0; i < arr->GetEntriesFast(); i++) {
126 FemtoMiniPair* mini = (FemtoMiniPair*) arr->UncheckedAt(i);
129 Double_t k = fPair->GetT();
130 if (fIgnoreSign) { k = TMath::Abs(k); }
131 for (
double r_bin = 0; r_bin < fRBins; r_bin++) {
132 Double_t R = fRadiiBins[r_bin];
138 Femto1DCFAnaMapPairsDumped::~Femto1DCFAnaMapPairsDumped() {