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 631 of file JetAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.JetAnalysisConfig.LargeRJetAnalysisConfig.__init__ ( self)

Definition at line 634 of file JetAnalysisConfig.py.

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

Member Function Documentation

◆ createFFSmearingTool()

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

Definition at line 790 of file JetAnalysisConfig.py.

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

◆ 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 761 of file JetAnalysisConfig.py.

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

◆ getUncertaintyToolSettings()

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

Definition at line 712 of file JetAnalysisConfig.py.

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

◆ instanceName()

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

Definition at line 708 of file JetAnalysisConfig.py.

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

◆ makeAlgs()

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

Definition at line 829 of file JetAnalysisConfig.py.

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

Member Data Documentation

◆ containerName

python.JetAnalysisConfig.LargeRJetAnalysisConfig.containerName

Definition at line 832 of file JetAnalysisConfig.py.

◆ recalibratePhyslite

python.JetAnalysisConfig.LargeRJetAnalysisConfig.recalibratePhyslite

Definition at line 861 of file JetAnalysisConfig.py.

◆ runJERsystematicsOnData

python.JetAnalysisConfig.LargeRJetAnalysisConfig.runJERsystematicsOnData

Definition at line 780 of file JetAnalysisConfig.py.

◆ runUncertainties

python.JetAnalysisConfig.LargeRJetAnalysisConfig.runUncertainties

Definition at line 883 of file JetAnalysisConfig.py.


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