Commit d670462b2a914f059da85a8df8c842d930d488d5

Authored by Jürgen Knödlseder
1 parent 6049bf07

Remove ERECO histogram from effective area IRF extension

Showing 1 changed file with 15 additions and 33 deletions
cscripts/csroot2caldb.py
... ... @@ -146,7 +146,7 @@ class csroot2caldb(ctools.cscript):
146 146 def _make_dirs(self, version, irf):
147 147 """
148 148 Generate CALDB directory structure for one observation identifier
149   -
  149 +
150 150 The structure is given by
151 151  
152 152 data/<tel>/<inst>/bcf/<obsid>
... ... @@ -227,7 +227,7 @@ class csroot2caldb(ctools.cscript):
227 227 def _open(self, irf, ds):
228 228 """
229 229 Open existing or create new calibration
230   -
  230 +
231 231 The actual version will put all calibrations in the same file, although
232 232 each part of the response function will have its own logical name. We
233 233 can thus easily modify the script to put each calibration information
... ... @@ -322,7 +322,7 @@ class csroot2caldb(ctools.cscript):
322 322 def _open_hdu(self, fits, extname, name, doc, irf):
323 323 """
324 324 Open HDU
325   -
  325 +
326 326 Opens a FITS binary table with given "extname". If HDU does not exist
327 327 in the FITS file it will be created and appended to the FITS file.
328 328  
... ... @@ -534,10 +534,9 @@ class csroot2caldb(ctools.cscript):
534 534 def _root2ea(self, tfile, irf, ds):
535 535 """
536 536 Translate ROOT to CALDB effective area extension
537   -
  537 +
538 538 The following ROOT histograms are used:
539 539 - EffectiveAreaEtrue_offaxis -> EFFAREA
540   - - EffectiveArea_offaxis -> EFFAREA_RECO
541 540  
542 541 Parameters
543 542 ----------
... ... @@ -555,16 +554,13 @@ class csroot2caldb(ctools.cscript):
555 554  
556 555 # Get relevant ROOT histograms
557 556 etrue = tfile.Get('EffectiveAreaEtrue_offaxis')
558   - ereco = tfile.Get('EffectiveArea_offaxis')
559 557  
560 558 # If requested then normalize the 2D histogram on the on-axis 1D
561 559 # histogram. This assures that the 2D histogram has the same on-axis
562 560 # effective area dependence as the 1D histogram.
563 561 if self['norm1d'].boolean():
564 562 etrue_1D = tfile.Get('EffectiveAreaEtrue')
565   - ereco_1D = tfile.Get('EffectiveArea')
566 563 self._renorm_onaxis(etrue, etrue_1D)
567   - self._renorm_onaxis(ereco, ereco_1D)
568 564  
569 565 # If requested then rebin the effective area Etrue histogram. This
570 566 # increases the number of bins by a factor 10.
... ... @@ -589,17 +585,6 @@ class csroot2caldb(ctools.cscript):
589 585 for ieng in range(neng):
590 586 value = etrue.GetBinContent(ieng+1,ioff+1) * eascale
591 587 etrue.SetBinContent(ieng+1,ioff+1,value)
592   - neng = ereco.GetXaxis().GetNbins()
593   - noffset = ereco.GetYaxis().GetNbins()
594   - for ioff in range(noffset):
595   - for ieng in range(neng):
596   - value = ereco.GetBinContent(ieng+1,ioff+1) * eascale
597   - ereco.SetBinContent(ieng+1,ioff+1,value)
598   -
599   - # Set boundaries (use Ereco boundaries)
600   - #bounds = self._make_2D(ereco, ds['HDU_EA'], None, 'm2')
601   - #for b in bounds:
602   - # irf['EA_BOUNDS'].append(b)
603 588  
604 589 # Write boundary keywords
605 590 self._set_cif_keywords(ds['HDU_EA'], irf['EA_NAME'],
... ... @@ -608,16 +593,13 @@ class csroot2caldb(ctools.cscript):
608 593 # Create "EFFAREA" data column
609 594 self._make_2D(etrue, ds['HDU_EA'], 'EFFAREA', 'm2')
610 595  
611   - # Create "EFFAREA_RECO" data column
612   - self._make_2D(ereco, ds['HDU_EA'], 'EFFAREA_RECO', 'm2')
613   -
614 596 # Return
615 597 return
616 598  
617 599 def _root2psf(self, tfile, irf, ds):
618 600 """
619 601 Translate ROOT to CALDB point spread function extension
620   -
  602 +
621 603 Parameters
622 604 ----------
623 605 tfile : `~ROOT.TFile`
... ... @@ -646,7 +628,7 @@ class csroot2caldb(ctools.cscript):
646 628 def _root2psf_gauss(self, tfile, irf, ds):
647 629 """
648 630 Translate ROOT to CALDB point spread function extension
649   -
  631 +
650 632 The following ROOT histograms are used:
651 633 - 1/(2*pi*SIGMA_1) -> SCALE
652 634 - AngRes_offaxis -> SIGMA_1 (scaling: 1/0.8)
... ... @@ -729,7 +711,7 @@ class csroot2caldb(ctools.cscript):
729 711 def _root2psf_king(self, tfile, irf, ds):
730 712 """
731 713 Translate ROOT to CALDB point spread function extension
732   -
  714 +
733 715 The following ROOT histograms are used:
734 716 - AngRes_offaxis
735 717 - AngRes80_offaxis
... ... @@ -853,7 +835,7 @@ class csroot2caldb(ctools.cscript):
853 835 def _root2edisp(self, tfile, irf, ds):
854 836 """
855 837 Translate ROOT to CALDB energy dispersion extension
856   -
  838 +
857 839 The following ROOT histograms are used:
858 840 - EestOverEtrue_offaxis -> MATRIX
859 841  
... ... @@ -892,7 +874,7 @@ class csroot2caldb(ctools.cscript):
892 874 def _root2bgd(self, tfile, irf, ds):
893 875 """
894 876 Translate ROOT to CALDB background extension.
895   -
  877 +
896 878 The following ROOT histograms are used:
897 879 - BGRatePerSqDeg_offaxis -> BGD
898 880  
... ... @@ -945,7 +927,7 @@ class csroot2caldb(ctools.cscript):
945 927 def _append_column_axis(self, hdu, name, unit, axis, log=False):
946 928 """
947 929 Append column of ROOT axis values to HDU
948   -
  930 +
949 931 Parameters
950 932 ----------
951 933 hdu : `~gammalib.GFitsHDU`
... ... @@ -991,7 +973,7 @@ class csroot2caldb(ctools.cscript):
991 973 def _append_column_values(self, hdu, name, unit, values):
992 974 """
993 975 Append column of values to HDU
994   -
  976 +
995 977 Parameters
996 978 ----------
997 979 hdu : `~gammalib.GFitsHDU`
... ... @@ -1089,7 +1071,7 @@ class csroot2caldb(ctools.cscript):
1089 1071 for ioff in range(noffset):
1090 1072 value = hist2D_copy.GetBinContent(ieng+1,ioff+1) / onaxis
1091 1073 hist2D_copy.SetBinContent(ieng+1,ioff+1,value)
1092   -
  1074 +
1093 1075 # Put back the energy dependence
1094 1076 for ieng in range(neng):
1095 1077 onaxis = hist1D.GetBinContent(ieng+1)
... ... @@ -1324,7 +1306,7 @@ class csroot2caldb(ctools.cscript):
1324 1306 def _make_2D(self, array, hdu, name, unit, scale=1.0):
1325 1307 """
1326 1308 Make 2D data column as function of energy and offset angle
1327   -
  1309 +
1328 1310 If the HDU has already the energy and offset angle columns, this method
1329 1311 will simply add another data column. If name==None, the method will not
1330 1312 append any data column.
... ... @@ -1381,7 +1363,7 @@ class csroot2caldb(ctools.cscript):
1381 1363 def _make_3D(self, array, hdu, name, unit):
1382 1364 """
1383 1365 Make 3D data column as function of DETX, DETY and energy
1384   -
  1366 +
1385 1367 If the HDU has already the energy and offset angle columns, this method
1386 1368 will simply add another data column. If name==None, the method will not
1387 1369 append any data column.
... ... @@ -1471,7 +1453,7 @@ class csroot2caldb(ctools.cscript):
1471 1453 def _make_3D_migra(self, array, hdu, name, unit, scale=1.0):
1472 1454 """
1473 1455 Make 3D data column as function of ETRUE, MIGRA and THETA
1474   -
  1456 +
1475 1457 If the HDU has already the energy and offset angle columns, this method
1476 1458 will simply add another data column. If name==None, the method will not
1477 1459 append any data column.
... ...