  | 
  
    ATLAS Offline Software
    
   | 
 
 
 
 
Go to the documentation of this file.
    5 #ifndef ENHANCEDBIASWEIGHTER_ENHANCEDBIASWEIGHTER_H 
    6 #define ENHANCEDBIASWEIGHTER_ENHANCEDBIASWEIGHTER_H 1 
   10 #include "GaudiKernel/ToolHandle.h" 
   11 #include "Gaudi/Accumulators.h" 
   19 #include <unordered_map> 
   74    virtual double getEBWeight(
const EventContext& context) 
const override;
 
   88    virtual double getEBLiveTime(
const EventContext& context) 
const override;
 
   95    virtual double getLBLength(
const EventContext& context) 
const override;
 
  104    virtual double getLBLumi(
const EventContext& context) 
const override;
 
  156    virtual bool isGoodLB(
const EventContext& context) 
const override; 
 
  161    virtual bool isMC() 
const override;
 
  169    virtual std::unordered_map<std::string, ChainDetail> 
parsePrescaleXML(
const std::string& prescaleXML) 
const override;
 
  186     int32_t 
getEventEBID(
const EventContext& context) 
const; 
 
  192     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."};
 
  193     Gaudi::Property<bool> 
m_errorOnMissingEBWeights{
this, 
"ErrorOnMissingEBWeights", 
false, 
"If true, Throws error if EB weights are missing."};
 
  194     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"};
 
  195     Gaudi::Property<bool> 
m_useBunchCrossingData{
this, 
"UseBunchCrossingData", 
true, 
"BunchCrossing data requires CONDBR2 access. Can be disabled here if this is a problem."};
 
  196     Gaudi::Property<bool> 
m_isMC{
this, 
"IsMC", 
false,  
"MC mode? If so we need a cross section and filter efficiency"};
 
  197     Gaudi::Property<double> 
m_mcCrossSection{
this, 
"MCCrossSection", 0.0, 
"If running over MC. The process cross section in nb (AMI gives thins in nb)"};
 
  198     Gaudi::Property<double> 
m_mcFilterEfficiency{
this, 
"MCFilterEfficiency", 1.0, 
"If running over MC. The process filter efficiency (0.0-1.0)"}; 
 
  199     Gaudi::Property<double> 
m_mcKFactor{
this, 
"MCKFactor", 1.0, 
"If running over MC. The process filter efficiency (0.0-1.0)"}; 
 
  200     Gaudi::Property<bool> 
m_mcIgnoreGeneratorWeights{
this, 
"MCIgnoreGeneratorWeights", 
false, 
"If running over MC. Flag to ignore the generator weight."}; 
 
  201     Gaudi::Property<double> 
m_inelasticCrossSection{
this, 
"InelasticCrossSection", 8
e-26, 
"Inelastic cross section in units cm^2. Default 80 mb at 13 TeV."};
 
  202     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"};  
 
  203     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."};
 
  204     Gaudi::Property<double> 
m_targetLumi{
this, 
"TargetLuminosity", 2
e34, 
"Targer inst. luminosity, assuming full ring."};
 
  228 #endif //> !ENHANCEDBIASWEIGHTER_ENHANCEDBIASWEIGHTER_H 
  
virtual double getEBLiveTime(const xAOD::EventInfo *eventInfo) const override
 
virtual double getBunchCrossingRate() const override
 
Gaudi::Property< bool > m_doMultiSliceDiJet
 
virtual StatusCode getDistanceIntoTrain(const xAOD::EventInfo *eventInfo, uint32_t &distance, const EventContext &ctx) const override
 
Gaudi::Property< double > m_mcCrossSection
 
virtual StatusCode initialize() override
Initialize is required by AsgTool base class.
 
Gaudi::Property< uint32_t > m_runNumber
 
Gaudi::Accumulators::AveragingCounter< double > m_lumiAverage ATLAS_THREAD_SAFE
The average instantaneous lumionosity over all events.
 
uint32_t m_pairedBunches
Online number of paired bunches.
 
Tool to calculate data-driven rates using EnhancedBias datasets.
 
double m_prescaledEfficiencyErr
 
Gaudi::Property< bool > m_isMC
 
StatusCode trackAverages(const xAOD::EventInfo *eventInfo) const
Internal function to keep track of the mean instantaneous lumi & mean pileup of the EB/MC sample bein...
 
virtual double getLBLumi(const xAOD::EventInfo *eventInfo) const override
 
Gaudi::Property< bool > m_mcIgnoreGeneratorWeights
 
virtual double getLBLength(const xAOD::EventInfo *eventInfo) const override
 
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, double > m_deadtimePerLB
Map of average deadtime per LB.
 
std::unordered_map< uint32_t, uint32_t > m_eventsPerLB
Map of how many EnhancedBias events were recorded per LB.
 
int32_t getEventEBID(const xAOD::EventInfo *eventInfo) const
 
double m_prescaledEfficiency
 
virtual double getDeadtime(const int lumiblock=-1) 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...
 
Gaudi::Property< double > m_inelasticCrossSection
 
Gaudi::Property< bool > m_enforceEBGRL
 
Gaudi::Property< std::string > m_weightsDirectory
 
Define interface of EnhancedBias weighting class.
 
std::string findLocalFile(const std::string &fileName) const
 
std::vector< int32_t > m_bunches
Number of BCIDs in each bunch group.
 
virtual bool isGoodLB(const xAOD::EventInfo *eventInfo) const override
 
virtual double getAverageMu() const override
 
ReadLumiBlock m_readLumiBlock
Cache lumi block lengths.
 
::StatusCode StatusCode
StatusCode definition for legacy code.
 
virtual double getAverageLumi() const override
 
Gaudi::Property< bool > m_useBunchCrossingData
 
virtual bool isMC() const override
 
constexpr static uint32_t FULL_RING
Number of bunches in a full ring.
 
double m_eventsPassedWeighted
 
SG::ReadCondHandleKey< BunchCrossingCondData > m_bunchCrossingKey
Tool to get distance into bunch train.
 
std::unordered_map< uint64_t, int32_t > m_eventNumberToIdMap
Map event number to a weighting ID.
 
virtual double getEBWeight(const xAOD::EventInfo *eventInfo) const override
 
Gaudi::Property< double > m_mcFilterEfficiency
 
double m_passthroughPrescale
 
constexpr static double LHC_FREQUENCY
 
Gaudi::Property< bool > m_errorOnMissingEBWeights
 
virtual StatusCode addBranches(const EventContext &ctx) const override
Decorate the AOD with EnhancedBias weighting quantities such that no CVMFS or DB access is required o...
 
virtual uint32_t getPairedBunches() const override
 
EnhancedBiasWeighter(const std::string &name)
 
virtual uint32_t getRunNumber() const override
 
std::unordered_map< uint32_t, uint8_t > m_goodLB
Like a Good Run List flag for EnhancedBias runs.
 
std::mutex m_mutex
Protection for above map.
 
Class describing the basic event information.
 
virtual StatusCode finalize() override
 
virtual bool isUnbiasedEvent(const xAOD::EventInfo *eventInfo) const override
 
Gaudi::Property< double > m_targetLumi
 
Gaudi::Accumulators::AveragingCounter< double > m_muAverage ATLAS_THREAD_SAFE
The average mu over all events.
 
StatusCode loadWeights()
Read into memory from XML event weights for this EnhancedBias run.
 
std::unordered_map< int32_t, double > m_idToWeightMap
Map a weighting ID to a Enhanced Bias event weight.
 
double m_deadtime
Online deadtime to correct for in rate prediction.
 
double m_mcModifiedCrossSection
Product of xsec, filter & kfactor.
 
virtual const std::vector< int32_t > & getBunchGroups() const override
 
std::unordered_map< uint32_t, double > m_lumiPerLB
Map of instantaneous luminosity per LB.
 
Gaudi::Property< double > m_mcKFactor
 
Replaces the BunchCrossing AlgTool used in run1/2.
 
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].
 
Define macros for attributes used to control the static checker.
 
StatusCode loadLumi()
Read into memory this EnhancedBias run's XML.
 
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
 
Helper class to read in lumi block length info from COOL for a run.
 
Structure to encompass the data stored in a prescales XML generated by the RuleBook.