![]() |
ATLAS Offline Software
|
Tool to calculate data-driven rates using EnhancedBias datasets. More...
#include <EnhancedBiasWeighter.h>
Public Member Functions | |
| EnhancedBiasWeighter (const std::string &name) | |
| virtual StatusCode | initialize () override |
| Initialize is required by AsgTool base class. | |
| virtual StatusCode | finalize () override |
| virtual StatusCode | addBranches (const EventContext &ctx) const override |
| Decorate the AOD with EnhancedBias weighting quantities such that no CVMFS or DB access is required on subsequent passes through the dAOD to perform rates. | |
| virtual double | getEBWeight (const xAOD::EventInfo *eventInfo) const override |
| virtual double | getEBWeight (const EventContext &context) const override |
| virtual double | getBunchCrossingRate () const override |
| virtual double | getEBLiveTime (const xAOD::EventInfo *eventInfo) const override |
| virtual double | getEBLiveTime (const EventContext &context) const override |
| virtual double | getLBLength (const xAOD::EventInfo *eventInfo) const override |
| virtual double | getLBLength (const EventContext &context) const override |
| virtual double | getLBLumi (const xAOD::EventInfo *eventInfo) const override |
| virtual double | getLBLumi (const EventContext &context) const override |
| virtual double | getAverageLumi () const override |
| virtual double | getAverageMu () const override |
| virtual double | getDeadtime (const int lumiblock=-1) const override |
| virtual uint32_t | getPairedBunches () const override |
| virtual StatusCode | getDistanceIntoTrain (const xAOD::EventInfo *eventInfo, uint32_t &distance, const EventContext &ctx) const override |
| virtual uint32_t | getRunNumber () const override |
| virtual bool | isUnbiasedEvent (const xAOD::EventInfo *eventInfo) const override |
| virtual bool | isGoodLB (const xAOD::EventInfo *eventInfo) const override |
| virtual bool | isGoodLB (const EventContext &context) const override |
| virtual bool | isMC () const override |
| virtual std::unordered_map< std::string, ChainDetail > | parsePrescaleXML (const std::string &prescaleXML) const override |
| Parse a presscale XML and return a ordered summary of its content To make most use of the XML parsing available already in this class. | |
| virtual const std::vector< int32_t > & | getBunchGroups () const override |
| virtual void | print () const |
| Print the state of the tool. | |
| ServiceHandle< StoreGateSvc > & | evtStore () |
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. | |
| const ServiceHandle< StoreGateSvc > & | detStore () const |
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. | |
| virtual StatusCode | sysInitialize () override |
| Perform system initialization for an algorithm. | |
| virtual StatusCode | sysStart () override |
| Handle START transition. | |
| virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. | |
| virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. | |
| Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T, V, H > &t) |
| void | updateVHKA (Gaudi::Details::PropertyBase &) |
| MsgStream & | msg () const |
| bool | msgLvl (const MSG::Level lvl) const |
| DeclareInterfaceID (IAugmentationTool, 1, 0) | |
Additional helper functions, not directly mimicking Athena | |
| template<class T> | |
| const T * | getProperty (const std::string &name) const |
| Get one of the tool's properties. | |
| const std::string & | msg_level_name () const __attribute__((deprecated)) |
| A deprecated function for getting the message level's name. | |
| const std::string & | getName (const void *ptr) const |
| Get the name of an object that is / should be in the event store. | |
| SG::sgkey_t | getKey (const void *ptr) const |
| Get the (hashed) key of an object that is in the event store. | |
Static Public Attributes | |
| static constexpr double | LHC_FREQUENCY = 11245.5 |
| static constexpr uint32_t | FULL_RING = 2738 |
| Number of bunches in a full ring. | |
Protected Member Functions | |
| void | renounceArray (SG::VarHandleKeyArray &handlesArray) |
| remove all handles from I/O resolution | |
| std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > | renounce (T &h) |
| void | extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps) |
| Add StoreName to extra input/output deps as needed. | |
Private Types | |
| typedef ServiceHandle< StoreGateSvc > | StoreGateSvc_t |
Private Member Functions | |
| StatusCode | loadWeights () |
| Read into memory from XML event weights for this EnhancedBias run. | |
| StatusCode | loadLumi () |
| Read into memory this EnhancedBias run's XML. | |
| StatusCode | trackAverages (const xAOD::EventInfo *eventInfo) const |
| Internal function to keep track of the mean instantaneous lumi & mean pileup of the EB/MC sample being processed. | |
| StatusCode | trackAverages (const EventContext &context) const |
| int32_t | getEventEBID (const xAOD::EventInfo *eventInfo) const |
| int32_t | getEventEBID (const EventContext &context) const |
| std::string | findLocalFile (const std::string &fileName) const |
| Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> | |
Private Attributes | |
| SG::ReadCondHandleKey< BunchCrossingCondData > | m_bunchCrossingKey {this, "BunchCrossingKey", "BunchCrossingData", "Key BunchCrossing CDO" } |
| Tool to get distance into bunch train. | |
| Gaudi::Property< uint32_t > | m_runNumber {this, "RunNumber", 0, "Run we're processing (if data), needed at initialize to locate and read in extra configuration."} |
| Gaudi::Property< bool > | m_errorOnMissingEBWeights {this, "ErrorOnMissingEBWeights", false, "If true, Throws error if EB weights are missing."} |
| Gaudi::Property< bool > | m_enforceEBGRL {this, "EnforceEBGRL", true, "Each Enhanced Bias run has a 'good run list' style veto on some LB. If this flag is true, events in these LB get weight 0"} |
| Gaudi::Property< bool > | m_useBunchCrossingData {this, "UseBunchCrossingData", true, "BunchCrossing data requires CONDBR2 access. Can be disabled here if this is a problem."} |
| Gaudi::Property< bool > | m_isMC {this, "IsMC", false, "MC mode? If so we need a cross section and filter efficiency"} |
| Gaudi::Property< double > | m_mcCrossSection {this, "MCCrossSection", 0.0, "If running over MC. The process cross section in nb (AMI gives thins in nb)"} |
| Gaudi::Property< double > | m_mcFilterEfficiency {this, "MCFilterEfficiency", 1.0, "If running over MC. The process filter efficiency (0.0-1.0)"} |
| Gaudi::Property< double > | m_mcKFactor {this, "MCKFactor", 1.0, "If running over MC. The process filter efficiency (0.0-1.0)"} |
| Gaudi::Property< bool > | m_mcIgnoreGeneratorWeights {this, "MCIgnoreGeneratorWeights", false, "If running over MC. Flag to ignore the generator weight."} |
| Gaudi::Property< double > | m_inelasticCrossSection {this, "InelasticCrossSection", 8e-26, "Inelastic cross section in units cm^2. Default 80 mb at 13 TeV."} |
| Gaudi::Property< std::string > | m_weightsDirectory {this, "EBWeightsDirectory", "", "Path to directory with EB XML weights files, if empty they will be read from calibration area"} |
| Gaudi::Property< bool > | m_doMultiSliceDiJet {this, "DoMultiSliceDiJet", false, "Enable the HS-softer-than-PU (HSTP) filter; reweight the Slices according to Jet/ETMiss procedure; recommended by PMG for di-jet slices."} |
| Gaudi::Property< double > | m_targetLumi {this, "TargetLuminosity", 2e34, "Targer inst. luminosity, assuming full ring."} |
| double | m_deadtime |
| Online deadtime to correct for in rate prediction. | |
| uint32_t | m_pairedBunches |
| Online number of paired bunches. | |
| double | m_mcModifiedCrossSection |
| Product of xsec, filter & kfactor. | |
| std::unordered_map< uint64_t, int32_t > | m_eventNumberToIdMap |
| Map event number to a weighting ID. | |
| std::unordered_map< uint32_t, float > m_eventLivetime | ATLAS_THREAD_SAFE |
| Cache of per-event livetime as a function of LB [LB -> effective walltime per event]. | |
| std::mutex | m_mutex |
| Protection for above map. | |
| Gaudi::Accumulators::AveragingCounter< double > m_lumiAverage | ATLAS_THREAD_SAFE |
| The average instantaneous lumionosity over all events. | |
| Gaudi::Accumulators::AveragingCounter< double > m_muAverage | ATLAS_THREAD_SAFE |
| The average mu over all events. | |
| std::unordered_map< int32_t, double > | m_idToWeightMap |
| Map a weighting ID to a Enhanced Bias event weight. | |
| std::unordered_map< int32_t, uint8_t > | m_idToUnbiasedMap |
| Map a weighting ID to a flag if this weight is from an unbiased (RD) trigger online. | |
| std::unordered_map< uint32_t, uint32_t > | m_eventsPerLB |
| Map of how many EnhancedBias events were recorded per LB. | |
| std::unordered_map< uint32_t, double > | m_lumiPerLB |
| Map of instantaneous luminosity per LB. | |
| std::unordered_map< uint32_t, uint8_t > | m_goodLB |
| Like a Good Run List flag for EnhancedBias runs. | |
| std::unordered_map< uint32_t, double > | m_deadtimePerLB |
| Map of average deadtime per LB. | |
| std::vector< int32_t > | m_bunches |
| Number of BCIDs in each bunch group. | |
| ReadLumiBlock | m_readLumiBlock |
| Cache lumi block lengths. | |
| StoreGateSvc_t | m_evtStore |
| Pointer to StoreGate (event store by default) | |
| StoreGateSvc_t | m_detStore |
| Pointer to StoreGate (detector store by default) | |
| std::vector< SG::VarHandleKeyArray * > | m_vhka |
| bool | m_varHandleArraysDeclared |
Tool to calculate data-driven rates using EnhancedBias datasets.
Definition at line 47 of file EnhancedBiasWeighter.h.
|
privateinherited |
Definition at line 388 of file AthCommonDataStore.h.
| EnhancedBiasWeighter::EnhancedBiasWeighter | ( | const std::string & | name | ) |
Definition at line 29 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Decorate the AOD with EnhancedBias weighting quantities such that no CVMFS or DB access is required on subsequent passes through the dAOD to perform rates.
addBranches is required by DerivationFramework::AugmentationTool
Implements DerivationFramework::IAugmentationTool.
Definition at line 722 of file EnhancedBiasWeighter.cxx.
|
inlineprivateinherited |
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
|
inherited |
|
inlineinherited |
Definition at line 145 of file AthCommonDataStore.h.
|
inlineinherited |
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition at line 95 of file AthCommonDataStore.h.
|
inlineinherited |
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition at line 85 of file AthCommonDataStore.h.
|
protectedinherited |
Add StoreName to extra input/output deps as needed.
use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given
|
overridevirtual |
Definition at line 69 of file EnhancedBiasWeighter.cxx.
|
private |
Definition at line 750 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 711 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 716 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 470 of file EnhancedBiasWeighter.cxx.
|
inlineoverridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 174 of file EnhancedBiasWeighter.h.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 684 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 700 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 515 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 473 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 428 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 391 of file EnhancedBiasWeighter.cxx.
|
private |
Definition at line 372 of file EnhancedBiasWeighter.cxx.
|
private |
Definition at line 353 of file EnhancedBiasWeighter.cxx.
|
inherited |
Get the (hashed) key of an object that is in the event store.
This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.
In order to allow tools to efficiently perform this operation, they can use this helper function.
| ptr | The bare pointer to the object that the event store should know about |
Definition at line 119 of file AsgTool.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 565 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 552 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 664 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 644 of file EnhancedBiasWeighter.cxx.
|
inherited |
Get the name of an object that is / should be in the event store.
This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.
In order to allow tools to efficiently perform this operation, they can use this helper function.
| ptr | The bare pointer to the object that the event store should know about |
Definition at line 106 of file AsgTool.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 695 of file EnhancedBiasWeighter.cxx.
|
inherited |
Get one of the tool's properties.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 640 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Initialize is required by AsgTool base class.
Check if we're MC or data, and if data check if we're to load the weighting info or read it from the input file
Reimplemented from asg::AsgTool.
Definition at line 36 of file EnhancedBiasWeighter.cxx.
|
overridevirtualinherited |
Return this algorithm's input handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 616 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 596 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 636 of file EnhancedBiasWeighter.cxx.
|
overridevirtual |
Implements IEnhancedBiasWeighter.
Definition at line 577 of file EnhancedBiasWeighter.cxx.
|
private |
Read into memory this EnhancedBias run's XML.
Definition at line 146 of file EnhancedBiasWeighter.cxx.
|
private |
Read into memory from XML event weights for this EnhancedBias run.
Definition at line 75 of file EnhancedBiasWeighter.cxx.
|
inlineinherited |
Definition at line 24 of file AthCommonMsg.h.
|
inherited |
A deprecated function for getting the message level's name.
Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:
This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.
Definition at line 101 of file AsgTool.cxx.
|
inlineinherited |
Definition at line 30 of file AthCommonMsg.h.
|
overridevirtualinherited |
Return this algorithm's output handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
|
overridevirtual |
Parse a presscale XML and return a ordered summary of its content To make most use of the XML parsing available already in this class.
| prescaleXML | File name of a prescales file as generated by the RuleBook |
Implements IEnhancedBiasWeighter.
Definition at line 249 of file EnhancedBiasWeighter.cxx.
|
virtualinherited |
Print the state of the tool.
Implements asg::IAsgTool.
Reimplemented in AsgHelloTool, HI::HIPileupTool, JetBottomUpSoftDrop, JetConstituentsRetriever, JetDumper, JetFinder, JetFromPseudojet, JetModifiedMassDrop, JetPileupLabelingTool, JetPruner, JetPseudojetRetriever, JetReclusterer, JetReclusteringTool, JetRecTool, JetRecursiveSoftDrop, JetSoftDrop, JetSplitter, JetSubStructureMomentToolsBase, JetToolRunner, JetTrimmer, JetTruthLabelingTool, KtDeltaRTool, and LundVariablesTool.
Definition at line 131 of file AsgTool.cxx.
|
inlineprotectedinherited |
Definition at line 380 of file AthCommonDataStore.h.
|
inlineprotectedinherited |
remove all handles from I/O resolution
Definition at line 364 of file AthCommonDataStore.h.
|
overridevirtualinherited |
Perform system initialization for an algorithm.
We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.
Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.
|
overridevirtualinherited |
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
|
private |
Definition at line 456 of file EnhancedBiasWeighter.cxx.
|
private |
Internal function to keep track of the mean instantaneous lumi & mean pileup of the EB/MC sample being processed.
Definition at line 463 of file EnhancedBiasWeighter.cxx.
|
inlineinherited |
Definition at line 308 of file AthCommonDataStore.h.
|
mutableprivate |
Cache of per-event livetime as a function of LB [LB -> effective walltime per event].
Definition at line 211 of file EnhancedBiasWeighter.h.
|
mutableprivate |
The average instantaneous lumionosity over all events.
Definition at line 213 of file EnhancedBiasWeighter.h.
|
mutableprivate |
The average mu over all events.
Definition at line 214 of file EnhancedBiasWeighter.h.
|
staticconstexpr |
Number of bunches in a full ring.
Definition at line 56 of file EnhancedBiasWeighter.h.
|
staticconstexpr |
Definition at line 55 of file EnhancedBiasWeighter.h.
|
private |
Tool to get distance into bunch train.
Definition at line 190 of file EnhancedBiasWeighter.h.
|
private |
Number of BCIDs in each bunch group.
Definition at line 223 of file EnhancedBiasWeighter.h.
|
private |
Online deadtime to correct for in rate prediction.
Currently a constant for the EB period
Definition at line 206 of file EnhancedBiasWeighter.h.
|
private |
Map of average deadtime per LB.
Definition at line 221 of file EnhancedBiasWeighter.h.
|
privateinherited |
Pointer to StoreGate (detector store by default)
Definition at line 393 of file AthCommonDataStore.h.
|
private |
Definition at line 203 of file EnhancedBiasWeighter.h.
|
private |
Definition at line 194 of file EnhancedBiasWeighter.h.
|
private |
Definition at line 193 of file EnhancedBiasWeighter.h.
|
private |
Map event number to a weighting ID.
Definition at line 209 of file EnhancedBiasWeighter.h.
|
private |
Map of how many EnhancedBias events were recorded per LB.
Definition at line 218 of file EnhancedBiasWeighter.h.
|
privateinherited |
Pointer to StoreGate (event store by default)
Definition at line 390 of file AthCommonDataStore.h.
|
private |
Like a Good Run List flag for EnhancedBias runs.
Definition at line 220 of file EnhancedBiasWeighter.h.
|
private |
Map a weighting ID to a flag if this weight is from an unbiased (RD) trigger online.
Definition at line 217 of file EnhancedBiasWeighter.h.
|
private |
Map a weighting ID to a Enhanced Bias event weight.
Definition at line 216 of file EnhancedBiasWeighter.h.
|
private |
Definition at line 201 of file EnhancedBiasWeighter.h.
|
private |
Definition at line 196 of file EnhancedBiasWeighter.h.
|
private |
Map of instantaneous luminosity per LB.
Definition at line 219 of file EnhancedBiasWeighter.h.
|
private |
Definition at line 197 of file EnhancedBiasWeighter.h.
|
private |
Definition at line 198 of file EnhancedBiasWeighter.h.
|
private |
Definition at line 200 of file EnhancedBiasWeighter.h.
|
private |
Definition at line 199 of file EnhancedBiasWeighter.h.
|
private |
Product of xsec, filter & kfactor.
In units of cm
Definition at line 208 of file EnhancedBiasWeighter.h.
|
mutableprivate |
Protection for above map.
Definition at line 212 of file EnhancedBiasWeighter.h.
|
private |
Online number of paired bunches.
Definition at line 207 of file EnhancedBiasWeighter.h.
|
private |
Cache lumi block lengths.
Get this from COOL.
Definition at line 225 of file EnhancedBiasWeighter.h.
|
private |
Definition at line 192 of file EnhancedBiasWeighter.h.
|
private |
Definition at line 204 of file EnhancedBiasWeighter.h.
|
private |
Definition at line 195 of file EnhancedBiasWeighter.h.
|
privateinherited |
Definition at line 399 of file AthCommonDataStore.h.
|
privateinherited |
Definition at line 398 of file AthCommonDataStore.h.
|
private |
Definition at line 202 of file EnhancedBiasWeighter.h.