cms-sw / cmssw

CMS Offline Software
http://cms-sw.github.io/
Apache License 2.0
1.07k stars 4.28k forks source link

pileupCalc.py error #45742

Open BasChiara opened 3 weeks ago

BasChiara commented 3 weeks ago

I am encountering issue with pileupCalc.py. In CMSSW_13_0_13 the pileupCalc application lunched with this command :

pileupCalc.py -i /eos/user/c/cmsdqm/www/CAF/certification/Collisions22/Cert_Collisions2022_eraE_359022_360331_Golden.json --inputLumiJSON /eos/user/c/cmsdqm/www/CAF/certification/Collisions22/PileUp/EFG/pileup_JSON.txt --calcMode true --minBiasXsec 69200 --maxPileupBin 100 --numPileupBins 100  out.root

gives the following error :

Traceback (most recent call last):
  File "/cvmfs/cms.cern.ch/el8_amd64_gcc10/cms/cmssw/CMSSW_12_4_11/bin/el8_amd64_gcc10/pileupCalc.py", line 189, in <module>
    fillPileupHistogram(lumiInfo, options.calcMode,
  File "/cvmfs/cms.cern.ch/el8_amd64_gcc10/cms/cmssw/CMSSW_12_4_11/bin/el8_amd64_gcc10/pileupCalc.py", line 87, in fillPileupHistogram
    obs = binning.find(AveNumInt)
  File "/cvmfs/cms.cern.ch/el8_amd64_gcc10/cms/cmssw/CMSSW_12_4_11/bin/el8_amd64_gcc10/pileupCalc.py", line 65, in find
    return np.floor((x-self.xMin)*self.num/(self.xMax-self.xMin)).astype(np.int)
  File "/afs/cern.ch/user/c/cbasile/.local/lib/python3.9/site-packages/numpy/__init__.py", line 313, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Can you please help me with this, am I doing something wrong? Thanks !

Chiara

cmsbuild commented 3 weeks ago

cms-bot internal usage

cmsbuild commented 3 weeks ago

A new Issue was created by @BasChiara.

@Dr15Jones, @antoniovilela, @makortel, @mandrenguyen, @rappoccio, @sextonkennedy, @smuzaffar can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

Dr15Jones commented 3 weeks ago

assign RecoLuminosity/LumiDB

cmsbuild commented 3 weeks ago

New categories assigned: db

@francescobrivio,@saumyaphor4252,@perrotta,@consuegs you have been requested to review this Pull request/Issue and eventually sign? Thanks

mmusich commented 3 weeks ago

type lumi

mmusich commented 3 weeks ago

@cms-sw/lumi-pog-l2 @romeof FYI

mmusich commented 3 weeks ago

something along:

diff --git a/RecoLuminosity/LumiDB/scripts/pileupCalc.py b/RecoLuminosity/LumiDB/scripts/pileupCalc.py
index 4c38b77d5e8..60740decba2 100755
--- a/RecoLuminosity/LumiDB/scripts/pileupCalc.py
+++ b/RecoLuminosity/LumiDB/scripts/pileupCalc.py
@@ -62,7 +62,7 @@ class EquidistantBinning(object):
     def width(self):
         return (self.xMax-self.xMin)/self.num
     def find(self, x):
-        return np.floor((x-self.xMin)*self.num/(self.xMax-self.xMin)).astype(np.int)
+        return np.floor((x-self.xMin)*self.num/(self.xMax-self.xMin)).astype(int)

 Sqrt2 = np.sqrt(2)

seems enough to fix the issue.

mmusich commented 20 hours ago

this should be fixed by https://github.com/cms-sw/cmssw/pull/45989

perrotta commented 20 hours ago

+db

cmsbuild commented 20 hours ago

This issue is fully signed and ready to be closed.