Skip to content

Commit a1e030f

Browse files
authored
[PWGHF] Update of post processing macros for hf correlation studies (#12815)
1 parent e28606c commit a1e030f

File tree

7 files changed

+2404
-233
lines changed

7 files changed

+2404
-233
lines changed

PWGHF/HFC/Macros/DhCorrelationExtraction.cxx

Lines changed: 1025 additions & 41 deletions
Large diffs are not rendered by default.

PWGHF/HFC/Macros/DhCorrelationExtraction.h

Lines changed: 132 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#ifndef PWGHF_HFC_MACROS_DHCORRELATIONEXTRACTION_H_
1818
#define PWGHF_HFC_MACROS_DHCORRELATIONEXTRACTION_H_
1919

20-
#include <Rtypes.h>
21-
#include <RtypesCore.h>
2220
#include <TAttMarker.h>
2321
#include <TDirectoryFile.h>
2422
#include <TFile.h>
@@ -28,6 +26,9 @@
2826
#include <TObject.h>
2927
#include <TString.h>
3028

29+
#include <Rtypes.h>
30+
#include <RtypesCore.h>
31+
3132
class DhCorrelationExtraction : public TObject
3233
{
3334

@@ -40,6 +41,10 @@ class DhCorrelationExtraction : public TObject
4041
kME };
4142
enum selectInvMassRegion { kSign,
4243
kSideb };
44+
enum selectDmesonOrigin { kPrompt,
45+
kFD };
46+
enum selectParticleType { kPrimaryPart,
47+
kAllPart };
4348

4449
DhCorrelationExtraction(); // default constructor
4550
DhCorrelationExtraction(const DhCorrelationExtraction& source);
@@ -51,15 +56,36 @@ class DhCorrelationExtraction : public TObject
5156
void SetInputFilenameMass(TString filenameMass) { fFileNameMass = filenameMass; }
5257
void SetInputFilenameSE(TString filenameSE) { fFileNameSE = filenameSE; }
5358
void SetInputFilenameME(TString filenameME) { fFileNameME = filenameME; }
59+
void SetInputFilenameSecPart(TString filenameSecPart) { fFileSecPartName = filenameSecPart; }
60+
void SetInputFilenameBiasBtoD(TString filenamePromptMcRec, TString filenameNonPromptMcRec)
61+
{
62+
fFilePromptMcRecName = filenamePromptMcRec;
63+
fFileNonPromptMcRecName = filenameNonPromptMcRec;
64+
}
5465
void SetDirNameSE(TString dirNameSE) { fDirNameSE = dirNameSE; }
5566
void SetDirNameME(TString dirNameME) { fDirNameME = dirNameME; }
67+
void SetDirNameSecPart(TString dirNameSecPart) { fDirSecPartName = dirNameSecPart; }
5668
void SetMassHistoNameSgn(TString massHistoNameSgn) { fMassHistoNameSgn = massHistoNameSgn; }
5769
void SetMassHistoNameBkg(TString massHistoNameBkg) { fMassHistoNameBkg = massHistoNameBkg; }
5870
void SetMassHistoNameSBs(TString massHistoNameSBs) { fMassHistoNameSBs = massHistoNameSBs; }
5971
void SetSECorrelHistoSignalName(TString correlNameSigSE) { fSECorrelSignalRegionName = correlNameSigSE; }
6072
void SetSECorrelHistoSidebandName(TString correlNameSbSE) { fSECorrelSidebandsName = correlNameSbSE; }
73+
void SetSECorrelHistoSidebandLeftName(TString correlNameSbSE) { fSECorrelSidebandLeftName = correlNameSbSE; }
74+
void SetSECorrelHistoSidebandRightName(TString correlNameSbSE) { fSECorrelSidebandRightName = correlNameSbSE; }
6175
void SetMECorrelHistoSignalName(TString correlNameSigME) { fMECorrelSignalRegionName = correlNameSigME; }
6276
void SetMECorrelHistoSidebandName(TString correlNameSbME) { fMECorrelSidebandsName = correlNameSbME; }
77+
void SetMECorrelHistoSidebandLeftName(TString correlNameSbME) { fMECorrelSidebandLeftName = correlNameSbME; }
78+
void SetMECorrelHistoSidebandRightName(TString correlNameSbME) { fMECorrelSidebandRightName = correlNameSbME; }
79+
void SetHistoSecPartName(TString histoPrimaryPartName, TString histoAllPartName)
80+
{
81+
fHistoPrimaryPartName = histoPrimaryPartName;
82+
fHistoAllPartName = histoAllPartName;
83+
}
84+
void SetInputFilenameFDTemplate(TString filenameFDTemplate) { fFileFDTemplateName = filenameFDTemplate; }
85+
void SetInputFilenameFDPromptFrac(TString filenameFDPromptFrac) { fFileFDPromptFracName = filenameFDPromptFrac; }
86+
void SetInputHistoNameFDTemplatePrompt(TString hNameFDTemplatePrompt) { fHistoFDTemplatePromptName = hNameFDTemplatePrompt; }
87+
void SetInputHistoNameFDTemplateNonPrompt(TString hNameFDTemplateNonPrompt) { fHistoFDTemplateNonPromptName = hNameFDTemplateNonPrompt; }
88+
void SetInputHistoNameFDPromptFrac(TString hNameFDPromptFrac) { fHistoFDPromptFracName = hNameFDPromptFrac; }
6389

6490
// Input conditions: PtCand, PtHad, PoolBins
6591
void SetNpools(Int_t npools) { fNpools = npools; }
@@ -72,66 +98,136 @@ class DhCorrelationExtraction : public TObject
7298
void SetSubtractSoftPiInMEdistr(Bool_t subtractSoftPiME) { fSubtractSoftPiME = subtractSoftPiME; }
7399
void SetBkgScaleFactor(Double_t scaleFactor) { fBkgScaleFactor = scaleFactor; }
74100
void SetSignalYieldforNorm(Double_t sgnYield) { fSgnYieldNorm = sgnYield; }
101+
void SetBkgYield(Double_t bkgYield) { fBkgYield = bkgYield; }
102+
void SetSBYield(Double_t SBYield) { fSBYield = SBYield; }
75103
void SetRebin2DcorrelHisto(Int_t rebinDeltaEta, Int_t rebinDeltaPhi)
76104
{
77-
fRebin2Dhisto = kTRUE;
78105
fRebinAxisDeltaEta = rebinDeltaEta;
79106
fRebinAxisDeltaPhi = rebinDeltaPhi;
80107
}
108+
void SetRebinOptions(Bool_t rebinAngCorr, Bool_t rebinFDCorr, Bool_t rebinSecPart)
109+
{
110+
fRebinAngCorr = rebinAngCorr;
111+
fRebinFDCorr = rebinFDCorr;
112+
fRebinSecPart = rebinSecPart;
113+
}
81114
void GetSignalAndBackgroundForNorm(Double_t PtCandMin, Double_t PtCandMax);
82115
void NormalizeMEplot(TH2D*& histoME, TH2D*& histoMEsoftPi);
83116
void SetDebugLevel(Int_t debug) { fDebug = debug; }
117+
void SetDividedSidebands(Bool_t dividedSideb, Bool_t useSidebLeft, Bool_t useSidebRight)
118+
{
119+
fSidebandDivided = dividedSideb;
120+
fUseSidebLeft = useSidebLeft;
121+
fUseSidebRight = useSidebRight;
122+
}
123+
void SetFDSubtraction(Bool_t subtractFD) { fFDsubtraction = subtractFD; }
124+
void SetSecPartContamination(Bool_t secPartContamination) { fSecPartContamination = secPartContamination; }
125+
void SetCorrBiasBtoD(Bool_t corrbiasBtoD) { fCorrBiasBtoD = corrbiasBtoD; }
126+
void SetBinCandAndHad(Int_t binCand, Int_t binHad)
127+
{
128+
fBinPtCand = binCand;
129+
fBinPtHad = binHad;
130+
}
84131

85132
/// Analysis methods
86133
TH2D* GetCorrelHisto(Int_t SEorME, Int_t SorSB, Int_t pool, Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax);
134+
TH2D* GetFDTemplateHisto(Int_t PromptOrFD, Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax);
135+
TH1D* GetCorrelHistoSecondaryPart(Int_t PrimaryPart, Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax);
136+
TH1D* ReflectCorrHistogram(TH1D*& histo);
137+
TH1D* ReflectHistoRun2(TH1D* h, Double_t scale);
138+
TH1D* EvaluateMCClosModulations(Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax);
139+
Double_t GetFDPromptFrac(Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax);
140+
Double_t CalculateBaseline(TH1D*& histo, Bool_t totalRange = kTRUE, Bool_t reflected = kFALSE);
141+
Double_t CalculateBaselineError(TH1D*& histo, Bool_t totalRange = kTRUE, Bool_t reflected = kFALSE);
87142
Bool_t ReadInputSEandME();
88143
Bool_t ReadInputInvMass();
144+
Bool_t ReadInputFDSubtr();
145+
Bool_t ReadInputSecondaryPartContamination();
89146
Bool_t ExtractCorrelations(Double_t PtCandMin, Double_t PtCandMax, Double_t PtHadMin, Double_t PtHadMax, TString codeName);
90147
TH1D* GetCorrectedCorrHisto() { return fCorrectedCorrHisto; }
148+
TH1D* GetCorrectedCorrHisto_BaselineSubtr() { return fCorrectedCorrHisto_BaselineSubtr; }
149+
TH1D* GetCorrectedCorrHisto_Reflected() { return fCorrectedCorrHisto_Reflected; }
150+
TH1D* GetCorrectedCorrHisto_Reflected_BaselineSubtr() { return fCorrectedCorrHisto_Reflected_BaselineSubtr; }
91151

92152
/// Histogram style
93153
void SetTH1HistoStyle(TH1D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, Style_t markerStyle = kFullCircle, Color_t markerColor = kRed + 1, Double_t markerSize = 1.4, Color_t lineColor = kRed + 1, Int_t lineWidth = 3, Float_t hTitleXaxisOffset = 1.0, Float_t hTitleYaxisOffset = 1.0, Float_t hTitleXaxisSize = 0.060, Float_t hTitleYaxisSize = 0.060, Float_t hLabelXaxisSize = 0.060, Float_t hLabelYaxisSize = 0.060, Bool_t centerXaxisTitle = false, Bool_t centerYaxisTitle = false);
94154
void SetTH2HistoStyle(TH2D*& histo, TString hTitle, TString hXaxisTitle, TString hYaxisTitle, TString hZaxisTitle, Float_t hTitleXaxisOffset = 1.8, Float_t hTitleYaxisOffset = 1.8, Float_t hTitleZaxisOffset = 1.2, Float_t hTitleXaxisSize = 0.060, Float_t hTitleYaxisSize = 0.060, Float_t hTitleZaxisSize = 0.060, Float_t hLabelXaxisSize = 0.060, Float_t hLabelYaxisSize = 0.060, Float_t hLabelZaxisSize = 0.060, Bool_t centerXaxisTitle = true, Bool_t centerYaxisTitle = true);
95155

96156
private:
97-
TFile* fFileMass; // file containing the mass histograms
98-
TFile* fFileSE; // file containing the Same Event (SE) output
99-
TFile* fFileME; // file containing the Mixed Event (ME) output
100-
101-
TDirectoryFile* fDirMass; // TDirectory for mass histos
102-
TDirectoryFile* fDirSE; // TDirectory for SE info
103-
TDirectoryFile* fDirME; // TDirectory for ME info
104-
105-
TH1D* fCorrectedCorrHisto; // Corrected correlation histogram
106-
107-
DmesonSpecie fDmesonSpecies; // D meson specie
108-
TString fDmesonLabel; // D meson label
109-
TString fFileNameMass; // File cntaining inv. mass histograms
110-
TString fFileNameSE; // File contaning Same Event (SE) output
111-
TString fFileNameME; // File contaning Mixed Event (ME) output
112-
TString fDirNameSE; // Directory in the file containing SE output
113-
TString fDirNameME; // Directory in the file containing ME output
114-
TString fMassHistoNameSgn; // Inv. mass histo name signal yield
115-
TString fMassHistoNameBkg; // Inv. mass histo name background yield
116-
TString fMassHistoNameSBs; // Inv. mass histo name sideband yield
117-
TString fSECorrelSignalRegionName; // THnSparse name containing SE output for signal region
118-
TString fSECorrelSidebandsName; // THnSparse name containing SE output for sideband region
119-
TString fMECorrelSignalRegionName; // THnSparse name containing ME output for signal region
120-
TString fMECorrelSidebandsName; // THnSparse name containing ME output for sideband region
121-
122-
Int_t fNpools; // number of pools used for the ME correction
123-
Int_t fRebinAxisDeltaEta; // rebin deltaEta axis
124-
Int_t fRebinAxisDeltaPhi; // rebin deltaPhi axis
125-
Int_t fDebug; // debug level
126-
127-
Double_t fDeltaEtaMin; // deltaEta min value
128-
Double_t fDeltaEtaMax; // deltaEta max value
157+
TFile* fFileMass; // File containing the mass histograms
158+
TFile* fFileSE; // File containing the Same Event (SE) output
159+
TFile* fFileME; // File containing the Mixed Event (ME) output
160+
TFile* fFileFDTemplate; // File containing FD angular correlation templates
161+
TFile* fFileFDPromptFrac; // File containing prompt fraction (used fo FD subtraction)
162+
TFile* fFileSecPart; // File containing secondary particle contaminaion teplates
163+
TFile* fFilePromptMc; // File containing prompt ratio taken from MC Closure test study (to use for B to D bias correction)
164+
TFile* fFileNonPromptMc; // File containing non-prompt ratio taken from MC Closure test study (to use for B to D bias correction)
165+
166+
TDirectoryFile* fDirMass; // TDirectory for mass histos
167+
TDirectoryFile* fDirSE; // TDirectory for SE info
168+
TDirectoryFile* fDirME; // TDirectory for ME info
169+
TDirectoryFile* fDirSecPart; // TDirectory for seondary particle correction
170+
171+
TH1D* fCorrectedCorrHisto; // Corrected correlation histogram
172+
TH1D* fCorrectedCorrHisto_BaselineSubtr; // Corrected correlation histogram with baseline subtracion
173+
TH1D* fCorrectedCorrHisto_Reflected; // Corrected correlation histogram relected in azimuth
174+
TH1D* fCorrectedCorrHisto_Reflected_BaselineSubtr; // Corrected correlation histogram reflected in azimuth with baseline subtraction
175+
176+
DmesonSpecie fDmesonSpecies; // D meson specie
177+
TString fDmesonLabel; // D meson label
178+
TString fFileNameMass; // File name containing inv. mass histograms
179+
TString fFileNameSE; // File name contaning Same Event (SE) output
180+
TString fFileNameME; // File name contaning Mixed Event (ME) output
181+
TString fFileSecPartName; // File name contaning secondary particle correction output
182+
TString fFileFDTemplateName; // File name contaning FD angular correlation templates
183+
TString fFileFDPromptFracName; // File name contaning prompt fraction (used for FD subtraction)
184+
TString fFilePromptMcRecName; // File name contaning prompt angular correlation (used for B to d bias correction)
185+
TString fFileNonPromptMcRecName; // File name contaning non-prompt angular correlation (used for B to d bias correction)
186+
TString fDirNameSE; // Directory in the file containing SE output
187+
TString fDirNameME; // Directory in the file containing ME output
188+
TString fDirSecPartName; // Directory in the file containing secondary particle correction output
189+
TString fMassHistoNameSgn; // Inv. mass histo name signal yield
190+
TString fMassHistoNameBkg; // Inv. mass histo name background yield
191+
TString fMassHistoNameSBs; // Inv. mass histo name sideband yield
192+
TString fSECorrelSignalRegionName; // THnSparse name containing SE output for signal region
193+
TString fSECorrelSidebandsName; // THnSparse name containing SE output for sideband region
194+
TString fSECorrelSidebandLeftName; // THnSparse name containing SE output for sideband left region
195+
TString fSECorrelSidebandRightName; // THnSparse name containing SE output for sideband right region
196+
TString fMECorrelSignalRegionName; // THnSparse name containing ME output for signal region
197+
TString fMECorrelSidebandsName; // THnSparse name containing ME output for sideband regions
198+
TString fMECorrelSidebandLeftName; // THnSparse name containing ME output for sideband left region
199+
TString fMECorrelSidebandRightName; // THnSparse name containing ME output for sideband right region
200+
TString fHistoFDTemplatePromptName; // Prompt angular correlation histogram name
201+
TString fHistoFDTemplateNonPromptName; // FD angular correlation histogram name
202+
TString fHistoFDPromptFracName; // Prompt fraction histogram name
203+
TString fHistoPrimaryPartName; // Primary particle histogram (to be used for secondary particle contamination correction)
204+
TString fHistoAllPartName; // All particle histogram (to be used for secondary particle contamination correction)
205+
206+
Int_t fNpools; // Number of pools used for the ME correction
207+
Int_t fRebinAxisDeltaEta; // Rebin deltaEta axis value
208+
Int_t fRebinAxisDeltaPhi; // Rebin deltaPhi axis value
209+
Int_t fDebug; // Debug level
210+
Int_t fBinPtCand; // Pt bin of the candidate
211+
Int_t fBinPtHad; // Pt bin of the hadron
212+
213+
Double_t fDeltaEtaMin; // DeltaEta min value
214+
Double_t fDeltaEtaMax; // DeltaEta max value
129215
Double_t fBkgScaleFactor; // Bkg/SB factor to scale correlation plots obtained in the sideband region
130216
Double_t fSgnYieldNorm; // Signal yield (used for normalize correlation plots after bkg subtraction)
217+
Double_t fBkgYield; // Bkg yield under signal peak region
218+
Double_t fSBYield; // Sideband yield
131219

132220
Bool_t fCorrectPoolsSeparately; // Possibility to do the ME correction pool-by-pool (kTRUE) or merging all pools (kFALSE)
133221
Bool_t fSubtractSoftPiME; // Soft pion subtraction (for D0 case)
134-
Bool_t fRebin2Dhisto; // Flag to rebin the 2D correlation plots
222+
Bool_t fRebinAngCorr; // Rebin angular correlaion distributons (SE and ME)
223+
Bool_t fRebinFDCorr; // Rebin angular correlaion distributon templates used for FD correction (theory driven)
224+
Bool_t fRebinSecPart; // Rebin angular correlaion distributon templates used for secodary particle contamination correction
225+
Bool_t fSidebandDivided; // To be set to TRUE if two sideband corrlaion histograms are passed inteh config file
226+
Bool_t fUseSidebLeft; // To be set to TRUE if only sideband left is used for the bkg correction
227+
Bool_t fUseSidebRight; // To be set to TRUE if only sideband right is used for the bkg correction
228+
Bool_t fFDsubtraction; // Enable feed-down (FD) correction
229+
Bool_t fSecPartContamination; // Enable seconday particle contamination correction
230+
Bool_t fCorrBiasBtoD; // Enable bias B to D correction (perfrmed with angular correlaion templates taken from MC simulaions)
135231
};
136232

137233
#endif // PWGHF_HFC_MACROS_DHCORRELATIONEXTRACTION_H_

0 commit comments

Comments
 (0)