ATLAS Offline Software
Loading...
Searching...
No Matches
python.JetAnalysisConfig.LargeRJetAnalysisConfig Class Reference
Inheritance diagram for python.JetAnalysisConfig.LargeRJetAnalysisConfig:
Collaboration diagram for python.JetAnalysisConfig.LargeRJetAnalysisConfig:

Public Member Functions

 __init__ (self)
 instanceName (self)
 getUncertaintyToolSettings (self, config)
 createUncertaintyTool (self, jetUncertaintiesAlg, config, jetCollectionName, doPseudoData=False)
 createFFSmearingTool (self, jetFFSmearingAlg, config)
 makeAlgs (self, config)

Public Attributes

 runJERsystematicsOnData
 containerName
 recalibratePhyslite
 runUncertainties

Detailed Description

the ConfigBlock for the large-r jet sequence

Definition at line 633 of file JetAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.JetAnalysisConfig.LargeRJetAnalysisConfig.__init__ ( self)

Definition at line 636 of file JetAnalysisConfig.py.

636 def __init__ (self) :
637 super().__init__()
638 self.addOption ('containerName', '', type=str,
639 noneAction='error',
640 info="the name of the output container after calibration.",
641 meta={'role':'container'})
642 self.addOption ('jetCollection', '', type=str,
643 noneAction='error',
644 info="the jet container to run on. It is interpreted to determine "
645 "the correct config blocks to call for small- or large-R jets.")
646 self.addOption ('recalibratePhyslite', True, type=bool,
647 info="whether to run the CP::JetCalibrationAlg on PHYSLITE "
648 "derivations. The default is True.")
649 self.addOption ('runUncertainties', True, type=bool,
650 info="whether to configure JetUncertaintiesTool.", expertMode=True )
651 self.addOption ('systematicsModelJER', "Full", type=str,
652 info="the NP reduction scheme to use for JER: Full, Simple. The default is Full.",
653 meta={'choices':(['Simple','Full'],1)})
654 self.addOption ('systematicsModelJMS', "Full", type=str,
655 info="the NP reduction scheme to use for JMS: Full, Simple. The default is Full.",
656 meta={'choices':(['Simple','Full'],1)})
657 self.addOption ('systematicsModelJMR', "Full", type=str,
658 info="the NP reduction scheme to use for JMR: Full, Simple. The default is Full.",
659 meta={'choices':(['Full','Simple'],1)})
660 self.addOption ('runJERsystematicsOnData', False, type=bool,
661 info="whether to run the All/Full JER model variations also on data samples. Expert option!",
662 expertMode=True)
663 # Adding these options to override the jet uncertainty config file when we have new recommendations
664 # Calibration tool options
665 self.addOption ('calibToolConfigFile', None, type=str,
666 info="name of the config file to use for the jet calibration "
667 "tool. Expert option to override JetETmiss recommendations.",
668 expertMode=True)
669 self.addOption ('calibToolCalibArea', None, type=str,
670 info="name of the CVMFS area to use for the jet calibration "
671 "tool. Expert option to override JetETmiss recommendations.",
672 expertMode=True)
673 self.addOption ('calibToolCalibSeq', None, type=str,
674 info="name of the sequence to use for the jet calibration "
675 "tool (e.g. `JetArea_Residual_EtaJES_GSC`). Expert option to override "
676 "JetETmiss recommendations.",
677 expertMode=True)
678 # Uncertainties tool options
679 self.addOption ('uncertToolConfigPath', None, type=str,
680 info="name of the config file to use for the JES, JER, and JMS uncertainty "
681 "tool. Expert option to override JetETmiss recommendations.",
682 expertMode=True)
683 self.addOption ('uncertToolConfigPathJMR', None, type=str,
684 info="name of the config file to use for the JMR uncertainty "
685 "tool. Expert option to override JetETmiss recommendations.",
686 expertMode=True)
687 self.addOption ('uncertToolCalibArea', None, type=str,
688 info="name (str) of the CVMFS area to use for the jet uncertainty "
689 "tool. Expert option to override JetETmiss recommendations. The "
690 "default is None.",
691 expertMode=True)
692 self.addOption ('uncertToolMCType', None, type=str,
693 info="data type (str) to use for the jet uncertainty tool (e.g. "
694 "'AF3' or 'MC16'). Expert option to override JetETmiss "
695 "recommendations. The default is None.",
696 expertMode=True)
697 self.addOption ('minPt', 200.*GeV, type=float,
698 info=r"the minimum $p_\mathrm{T}$ cut (in MeV) to apply to calibrated large-R jets.")
699 self.addOption ('maxPt', 3000.*GeV, type=float,
700 info=r"the maximum $p_\mathrm{T}$ cut (in MeV) to apply to calibrated large-R jets.")
701 self.addOption ('maxEta', 0., type=float,
702 info=r"the maximum $\vert\eta\vert$ cut to apply to calibrated large-R jets.")
703 self.addOption ('maxRapidity', 2., type=float,
704 info="the maximum rapidity cut to apply to calibrated large-R jets.")
705 self.addOption ('minMass', 40.*GeV, type=float,
706 info="the minimum mass cut (in MeV) to apply to calibrated large-R jets.")
707 self.addOption ('maxMass', 600.*GeV, type=float,
708 info="the maximum mass cut (in MeV) to apply to calibrated large-R jets.")
709

Member Function Documentation

◆ createFFSmearingTool()

python.JetAnalysisConfig.LargeRJetAnalysisConfig.createFFSmearingTool ( self,
jetFFSmearingAlg,
config )

Definition at line 792 of file JetAnalysisConfig.py.

792 def createFFSmearingTool(self, jetFFSmearingAlg, config):
793 # Retrieve appropriate large-R jet mass resolution recommendations for the FFJetSmearingTool.
794
795 # Config file:
796 if self.systematicsModelJMR in ["Simple", "Full"]:
797 config_file = f"R10_{self.systematicsModelJMR}JMR.config"
798 else:
799 raise ValueError(
800 f"Invalid request for systematicsModelJMR settings: {self.systematicsModelJMR}"
801 )
802
803 # Expert override for config path:
804 if self.uncertToolConfigPathJMR is not None:
805 config_file = self.uncertToolConfigPathJMR
806 else:
807 config_file = "rel22/Summer2025_PreRec/" + config_file
808 if config.geometry() is LHCPeriod.Run4:
809 warnings.warn_explicit(
810 "Uncertainties for UFO jets are not for Run 4!",
811 JetUncertaintyWarning, filename='', lineno=0)
812
813 # MC type:
814 if config.geometry() is LHCPeriod.Run2:
815 if config.dataType() is DataType.FastSim:
816 mc_type = "MC20AF3"
817 else:
818 mc_type = "MC20"
819 elif config.geometry() >= LHCPeriod.Run3:
820 if config.dataType() is DataType.FastSim:
821 mc_type = "MC23AF3"
822 else:
823 mc_type = "MC23"
824
825 # Set up the FF smearing tool
826 config.addPrivateTool( 'FFSmearingTool', 'CP::FFJetSmearingTool')
827 jetFFSmearingAlg.FFSmearingTool.MassDef = "UFO"
828 jetFFSmearingAlg.FFSmearingTool.MCType = mc_type
829 jetFFSmearingAlg.FFSmearingTool.ConfigFile = config_file
830

◆ createUncertaintyTool()

python.JetAnalysisConfig.LargeRJetAnalysisConfig.createUncertaintyTool ( self,
jetUncertaintiesAlg,
config,
jetCollectionName,
doPseudoData = False )
Create instance(s) of JetUncertaintiesTool following JetETmiss recommendations.

JER uncertainties under the "Full" scheme must be run on MC samples twice:
1. Normal (MC) mode,
2. Pseudodata (PD) mode, as if the events are Data.

Definition at line 763 of file JetAnalysisConfig.py.

763 def createUncertaintyTool(self, jetUncertaintiesAlg, config, jetCollectionName, doPseudoData=False):
764 '''
765 Create instance(s) of JetUncertaintiesTool following JetETmiss recommendations.
766
767 JER uncertainties under the "Full" scheme must be run on MC samples twice:
768 1. Normal (MC) mode,
769 2. Pseudodata (PD) mode, as if the events are Data.
770 '''
771
772 # Retrieve the common configuration settings
773 configFile, calibArea, mcType = self.getUncertaintyToolSettings(config)
774
775 # The main tool for all JER combinations
776 _addJetUncertaintiesTool(config, jetUncertaintiesAlg, 'uncertaintiesTool',
777 jetCollectionName, configFile, calibArea, mcType,
778 isData=(config.dataType() is DataType.Data),
779 pseudoData=False)
780
781 # JER smearing on data
782 if config.dataType() is DataType.Data and not (doPseudoData and self.runJERsystematicsOnData):
783 # we don't want any systematics on data if we're not using the right JER model!
784 jetUncertaintiesAlg.affectingSystematicsFilter = '.*'
785
786 if config.dataType() is not DataType.Data and doPseudoData and not self.runJERsystematicsOnData:
787 # The secondary tool for pseudo-data JER smearing
788 _addJetUncertaintiesTool(config, jetUncertaintiesAlg, 'uncertaintiesToolPD',
789 jetCollectionName, configFile, calibArea, mcType,
790 isData=True, pseudoData=True)
791

◆ getUncertaintyToolSettings()

python.JetAnalysisConfig.LargeRJetAnalysisConfig.getUncertaintyToolSettings ( self,
config )

Definition at line 714 of file JetAnalysisConfig.py.

714 def getUncertaintyToolSettings(self, config):
715 # Retrieve appropriate JES/JER recommendations for the JetUncertaintiesTool.
716 # We do this separately from the tool declaration, as we may need to set uo
717 # two such tools, but they have to be private.
718
719
720 # Config file:
721 config_file = None
722 if self.systematicsModelJER in ["Simple", "Full"] and self.systematicsModelJMS in ["Simple", "Full"]:
723 config_file = f"R10_CategoryJES_{self.systematicsModelJER}JER_{self.systematicsModelJMS}JMS.config"
724 else:
725 raise ValueError(
726 "Invalid request for systematicsModelJER/JMS settings: "
727 f"systematicsModelJER = '{self.systematicsModelJER}', "
728 f"systematicsModelJMS = '{self.systematicsModelJMS}'" )
729 if self.uncertToolConfigPath is not None:
730 # Expert override
731 config_file = self.uncertToolConfigPath
732 else:
733 if config.geometry() in [LHCPeriod.Run2, LHCPeriod.Run3]:
734 config_file = "rel22/Summer2025_PreRec/" + config_file
735 else:
736 warnings.warn_explicit(
737 "Uncertainties for UFO jets are not available for Run 4!",
738 JetUncertaintyWarning, filename='', lineno=0)
739
740
741 # Calibration area:
742 calib_area = None
743 if self.uncertToolCalibArea is not None:
744 calib_area = self.uncertToolCalibArea
745
746 # MC type:
747 if self.uncertToolMCType is not None:
748 mc_type = self.uncertToolMCType
749 else:
750 if config.dataType() is DataType.FastSim:
751 if config.geometry() is LHCPeriod.Run2:
752 mc_type = "MC20AF3"
753 else:
754 mc_type = "MC23AF3"
755 else:
756 if config.geometry() is LHCPeriod.Run2:
757 mc_type = "MC20"
758 else:
759 mc_type = "MC23"
760
761 return config_file, calib_area, mc_type
762

◆ instanceName()

python.JetAnalysisConfig.LargeRJetAnalysisConfig.instanceName ( self)
Return the instance name for this block

Definition at line 710 of file JetAnalysisConfig.py.

710 def instanceName (self) :
711 """Return the instance name for this block"""
712 return self.containerName
713

◆ makeAlgs()

python.JetAnalysisConfig.LargeRJetAnalysisConfig.makeAlgs ( self,
config )

Definition at line 831 of file JetAnalysisConfig.py.

831 def makeAlgs (self, config) :
832
833 # Self-select: only run for large-R (radius 10) jets
834 if config.getContainerMeta(self.containerName, 'jetRadius', failOnMiss=True) != 10:
835 return
836
837 jetCollectionName = config.getContainerMeta(self.containerName, 'jetCollectionName', failOnMiss=True)
838
839 jetInput = config.getContainerMeta(self.containerName, 'jetInput', failOnMiss=True)
840 trim = config.getContainerMeta(self.containerName, 'jetTrim', failOnMiss=True)
841
842 if jetInput not in ["UFO"]:
843 raise ValueError(f"Invalid input type '{jetInput}' for large-R jets!" )
844
845 if not trim:
846 raise ValueError("Untrimmed large-R jets are not supported!")
847
848 configFile = "JES_MC20PreRecommendation_R10_UFO_CSSK_SoftDrop_JMS_R21Insitu_26Nov2024.config"
849 calibArea = "00-04-83"
850 if self.calibToolConfigFile is not None:
851 configFile = self.calibToolConfigFile
852
853 if config.dataType() is not DataType.Data:
854 calibSeq = "EtaJES_JMS"
855 else:
856 calibSeq = "EtaJES_JMS_Insitu"
857 if self.calibToolCalibSeq is not None:
858 calibSeq = self.calibToolCalibSeq
859
860 if self.calibToolCalibArea is not None:
861 calibArea = self.calibToolCalibArea
862
863 if not config.isPhyslite() or self.recalibratePhyslite:
864 # Create calibration tool before algorithm (EventLoop ordering)
865 calibToolName = 'JetCalibTool_' + jetCollectionName[:-4]
866 calibTool = config.createPublicTool( 'JetCalibrationTool', calibToolName )
867
868 calibTool.JetCollection = jetCollectionName[:-4]
869
870 calibTool.ConfigFile = configFile
871
872 calibTool.CalibSequence = calibSeq
873
874 if calibArea is not None:
875 calibTool.CalibArea = calibArea
876
877 calibTool.IsData = (config.dataType() is DataType.Data)
878 # Prepare the jet calibration algorithm
879 alg = config.createAlgorithm( 'CP::JetCalibrationAlg', 'JetCalibrationAlg' )
880 alg.calibrationTool = f'{calibTool.getType()}/{calibTool.getName()}'
881 alg.jets = config.readName(self.containerName)
882 alg.jetsOut = config.copyName(self.containerName)
883
884 # Jet uncertainties
885 if config.dataType() in [DataType.FullSim, DataType.FastSim] and self.runUncertainties:
886 alg = config.createAlgorithm( 'CP::JetUncertaintiesAlg', 'JetUncertaintiesAlg' )
887 self.createUncertaintyTool(alg, config, jetCollectionName, doPseudoData=( self.systematicsModelJER in ["Full","All"] ))
888
889 # R=1.0 jets have a validity range
890 alg.outOfValidity = 2 # SILENT
891 alg.outOfValidityDeco = 'outOfValidity'
892
893 alg.jets = config.readName (self.containerName)
894 alg.jetsOut = config.copyName (self.containerName)
895 alg.preselection = config.getPreselection (self.containerName, '')
896
897 if config.dataType() is not DataType.Data:
898 # set up the FF smearing algorithm
899 alg = config.createAlgorithm( 'CP::JetFFSmearingAlg', 'JetFFSmearingAlg' )
900 self.createFFSmearingTool(alg, config)
901 alg.outOfValidity = 2 # SILENT
902 alg.outOfValidityDeco = 'outOfValidityJMR'
903 alg.jets = config.readName (self.containerName)
904 alg.jetsOut = config.copyName (self.containerName)
905 alg.preselection = config.getPreselection (self.containerName, '')
906
907 if self.minPt > 0 or self.maxPt > 0 or self.maxEta > 0 or self.maxRapidity > 0:
908 # Set up the the pt-eta selection
909 alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'JetPtEtaCutAlg' )
910 alg.selectionDecoration = 'selectPtEta,as_bits'
911 config.addPrivateTool( 'selectionTool', 'CP::AsgPtEtaSelectionTool' )
912 alg.selectionTool.minPt = self.minPt
913 alg.selectionTool.maxPt = self.maxPt
914 alg.selectionTool.maxEta = self.maxEta
915 alg.selectionTool.maxRapidity = self.maxRapidity
916 alg.particles = config.readName (self.containerName)
917 alg.preselection = config.getPreselection (self.containerName, '')
918 config.addSelection (self.containerName, '', alg.selectionDecoration,
919 preselection=True)
920
921 if self.minMass > 0 or self.maxMass > 0:
922 # Set up the the mass selection
923 alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'JetMassCutAlg' )
924 alg.selectionDecoration = 'selectMass,as_bits'
925 config.addPrivateTool( 'selectionTool', 'CP::AsgMassSelectionTool' )
926 alg.selectionTool.minM = self.minMass
927 alg.selectionTool.maxM = self.maxMass
928 alg.particles = config.readName (self.containerName)
929 alg.preselection = config.getPreselection (self.containerName, '')
930 config.addSelection (self.containerName, '', alg.selectionDecoration,
931 preselection=True)
932
933 config.addOutputVar (self.containerName, 'm', 'm', auxType="float")
934

Member Data Documentation

◆ containerName

python.JetAnalysisConfig.LargeRJetAnalysisConfig.containerName

Definition at line 834 of file JetAnalysisConfig.py.

◆ recalibratePhyslite

python.JetAnalysisConfig.LargeRJetAnalysisConfig.recalibratePhyslite

Definition at line 863 of file JetAnalysisConfig.py.

◆ runJERsystematicsOnData

python.JetAnalysisConfig.LargeRJetAnalysisConfig.runJERsystematicsOnData

Definition at line 782 of file JetAnalysisConfig.py.

◆ runUncertainties

python.JetAnalysisConfig.LargeRJetAnalysisConfig.runUncertainties

Definition at line 885 of file JetAnalysisConfig.py.


The documentation for this class was generated from the following file: