Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion install.sh
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot support 3 different LCG releases. What was done for the master branch of latinos/mkShapesRDF was to stick with 103 for all the OS (see here).
Also el8 should be a unusual OS for the machines we work with.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then this should be integrated also here at some point.
I understand el9 is the standard but if the code is olnly made to work on el9 machines one should clearly specify it in the instruction at the early stages

Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
#!/bin/bash

# sourceCommand="source /root/.bashrc && mamba activate cern"
sourceCommand="source /cvmfs/sft.cern.ch/lcg/views/LCG_103/x86_64-centos7-gcc11-opt/setup.sh"
# sourceCommand="source /cvmfs/sft.cern.ch/lcg/views/LCG_103/x86_64-centos7-gcc11-opt/setup.sh"
# Not optimal because SCRAM is not setup with cmsenv... but better than nothing

fullos=$(uname -r)
split=(${fullos//./ })
os=${split[5]}

if [[ ${os:0:3} == el7 ]]; then
echo "Assuming el7 OS"
sourceCommand="source /cvmfs/sft.cern.ch/lcg/views/LCG_103/x86_64-centos7-gcc11-opt/setup.sh"
elif [[ ${os:0:3} == el8 ]]; then
echo "Assuming el8 OS"
sourceCommand="source /cvmfs/sft.cern.ch/lcg/views/LCG_104/x86_64-centos8-gcc11-opt/setup.sh"
elif [[ ${os:0:3} == el9 ]]; then
echo "Assuming el9 OS"
sourceCommand="source /cvmfs/sft.cern.ch/lcg/views/LCG_105/x86_64-el9-gcc11-opt/setup.sh"
else
echo "OS not recognized"
exit
fi

eval "$sourceCommand"
python -m venv --system-site-packages myenv
Expand Down
6 changes: 4 additions & 2 deletions mkShapesRDF/shapeAnalysis/latinos/LatinosUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ def flatten_samples(samples):

subsamplesmap.append((sname, []))
for sub in sample["subsamples"]:
samples["%s_%s" % (sname, sub)] = sample
subsamplesmap[-1][1].append("%s_%s" % (sname, sub))
samples["%s" % (sub)] = sample
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what the problem is, this is coming from original LatinoAnalisys code here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code will always prepend the "sample" name to the "subsample" name. Suppose you have a sample, and you split into subsamples with different event weight then the subsample name is not user defined and that could affect other part of the process, like tayloring the datacrds to combine models (e.g you have a sample "Zee" and you want it into the "sm" subsample, "quad_cW" subsample, .... you'll never be able to have the correct naming).
By lifting this the user has full flexibility on the subsamples names and can alsp prepend the sample name if he wants to

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't the final names be ['Zee_sm', 'Zee_quad_cW'] ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the old code yes. With the new one it would be "sm" and "quad_cW" There is no way to get rid of the initial Zee_ in the old setup (if not using something external to mkShapesRDF) which is clearly unnecessary.

subsamplesmap[-1][1].append("%s" % (sub))

sample.pop("subsamples")
samples.pop(sname)

print(subsamplesmap)

return subsamplesmap


Expand Down
12 changes: 6 additions & 6 deletions mkShapesRDF/shapeAnalysis/latinos/PlotFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ def makePlot(
try:
histoVar = nuisanceHistos[ivar][nuisanceName]
# test = rnp.hist2array(histoVar, copy=False)
_ = hist2array(histoVar, copy=False)
_ = hist2array(histoVar, copy=False, flow=True)
except KeyError:
# now, even if not considered this nuisance, I need to add it,
# so that in case is "empty" it will add the nominal value
Expand All @@ -764,15 +764,15 @@ def makePlot(
except KeyError:
# vy = nuisances_vy[nuisanceName] = np.zeros_like(rnp.hist2array(histo, copy=False))
vy = nuisances_vy[nuisanceName] = np.zeros_like(
hist2array(histo, copy=False)
hist2array(histo, copy=False, flow=True)
)

# get the background sum
if (
plotdef["isSignal"] == 0
): # ---> add the signal too????? See ~ 20 lines below
# vy += rnp.hist2array(histoVar, copy=False)
vy += hist2array(histoVar, copy=False)
vy += hist2array(histoVar, copy=False, flow=True)
# print(sampleName, nuisanceName, rnp.hist2array(histoVar, copy=False))

# create the group of histograms to plot
Expand Down Expand Up @@ -830,7 +830,7 @@ def makePlot(
if thsBackground.GetNhists() != 0:
last = thsBackground.GetStack().Last()
# tgrMC_vy = rnp.hist2array(last, copy=True)
tgrMC_vy = hist2array(last, copy=True)
tgrMC_vy = hist2array(last, copy=True, flow=True)
for iBin in range(
1, thsBackground.GetStack().Last().GetNbinsX() + 1
):
Expand All @@ -842,8 +842,8 @@ def makePlot(
)
# nuisances_err2_up = rnp.array(last.GetSumw2())[1:-1]
# nuisances_err2_do = rnp.array(last.GetSumw2())[1:-1]
_, nuisances_err2_up = hist2array(last, include_sumw2=True)
_, nuisances_err2_do = hist2array(last, include_sumw2=True)
_, nuisances_err2_up = hist2array(last, include_sumw2=True, flow=True)
_, nuisances_err2_do = hist2array(last, include_sumw2=True, flow=True)
# nuisances_err2_do = np_array(last.GetSumw2())[1:-1]
if self._removeMCStat:
nuisances_err2_up.fill(0)
Expand Down
Loading