Skip to content

Commit

Permalink
Do mT differential analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbattistini committed Aug 2, 2024
1 parent 779dcdb commit 46c7bf5
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions ComputeRawCF.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from fempy.utils.io import Load, GetKeyNames


def ApplyMultReweight(hMultVsKStarSE, hMultVsKStarME, normRange, name='hMERew'):
def ApplyMultReweight(hMultVsKStarSE, hMultVsKStarME, normRange=None, name='hMERew'):
'''
Apply the multiplicity reweighting to the mixed-event distribution.
Expand Down Expand Up @@ -59,8 +59,13 @@ def ApplyMultReweight(hMultVsKStarSE, hMultVsKStarME, normRange, name='hMERew'):
hMErew.Add(hMEbinmult, weight)

# Compute the CFs for each multiplicity bin
firstBin = hSEbinmult.FindBin(normRange[0] * 1.0001)
lastBin = hSEbinmult.FindBin(normRange[1] * 0.9999)
if normRange:
firstBin = hSEbinmult.FindBin(normRange[0] * 1.0001)
lastBin = hSEbinmult.FindBin(normRange[1] * 0.9999)
else:
firstBin = 0
lastBin = hSEbinmult.GetNbinsX()

norm = hMEbinmult.Integral(firstBin, lastBin) / hSEbinmult.Integral(firstBin, lastBin)
hCFbinmult = norm * hSEbinmult / hMEbinmult
else:
Expand Down Expand Up @@ -88,7 +93,7 @@ def SumPairWithAntipair(hDistr):
hDistr['p02_13'] = {}
hDistr['p03_12'] = {}

for reg in regions:
for reg in hDistr['p02'].keys():
hDistr['p02_13'][reg] = hDistr['p02'][reg] + hDistr['p13'][reg]
hDistr['p03_12'][reg] = hDistr['p03'][reg] + hDistr['p12'][reg]

Expand Down Expand Up @@ -201,15 +206,6 @@ def SumPairWithAntipair(hDistr):
hSEmultk[comb][f'{region}/{ancestor}'] = TH1D()
hSEAnc.Copy(hSE[comb][f'{region}/{ancestor}'])
hSEAncMultk.Copy(hSEmultk[comb][f'{region}/{ancestor}'])

# Do mT differential analysis if available
if cfg['mt']['enable'] and False:
for iMT, (mTMin, mTMax) in enumerate(zip(cfg['mt']['mins'], cfg['mt']['maxs'])):
hMultVsKStarSE = Load(inFile, f'{folder}/SEmTMult_{iMT}_{fdcomb}')
hSE[comb][f'{region}/mT{iMT}'] = hMultVsKStarSE.ProjectionY(f'hSE_{comb}_{region}_mT{iMT}')

hMultVsKStarME = Load(inFile, f'{folder}/MEmTMult_{iMT}_{fdcomb}')
hME[comb][f'{region}/mT{iMT}'] = hMultVsKStarME.ProjectionY(f'hME_{comb}_{region}_mT{iMT}')

elif comb in GetKeyNames(inFile): # Make correlation functions from ALICE3 simulations
# The histograms are casted to TH1D with TH1::Copy to avoid NotImplementedError when computing hSE/hME
Expand All @@ -230,6 +226,17 @@ def SumPairWithAntipair(hDistr):
hMErew[comb][region], hWeightsRew[comb][region], hDistrs = \
ApplyMultReweight(hSEmultk[comb], hMEmultk[comb], normRange=cfg['norm'])

# Do mT differential analysis if available
if cfg['mt']['enable']:
for iMT, (mTMin, mTMax) in enumerate(zip(cfg['mt']['mins'], cfg['mt']['maxs'])):
hMultVsKStarSE = Load(inFile, f'{folder}/SEmTMult_{iMT}_{fdcomb}')
hMultVsKStarME = Load(inFile, f'{folder}/MEmTMult_{iMT}_{fdcomb}')

hSE[comb][f'{region}/mT{iMT}'] = hMultVsKStarSE.ProjectionX(f'hSE_{comb}_{region}_mT{iMT}')
hME[comb][f'{region}/mT{iMT}'] = hMultVsKStarME.ProjectionX(f'hME_{comb}_{region}_mT{iMT}')
hMErew[comb][f'{region}/mT{iMT}'], _, _ = \
ApplyMultReweight(hMultVsKStarSE, hMultVsKStarME, name=f'hMErew_{comb}_{region}_mT{iMT}')

for iBin, (se, me, cf) in enumerate(zip(*hDistrs)):
oFile.mkdir(f'{comb}/multbins/{iBin}')
oFile.cd(f'{comb}/multbins/{iBin}')
Expand Down Expand Up @@ -293,9 +300,10 @@ def SumPairWithAntipair(hDistr):
hMErew[comb][region].SetTitle(';#it{k}* (GeV/#it{c});Counts')
hMErew[comb][region].Write()

hWeightsRew[comb][region].SetName('hWeightsRew')
hWeightsRew[comb][region].SetTitle(';Mult bin;Weight')
hWeightsRew[comb][region].Write()
if hist := hWeightsRew[comb].get(region, None):
hist.SetName('hWeightsRew')
hist.SetTitle(';Mult bin;Weight')
hist.Write()

hCF.SetName('hCF')
hCF.SetTitle(';#it{k}* (GeV/#it{c});#it{C}(#it{k}*)')
Expand Down

0 comments on commit 46c7bf5

Please sign in to comment.