CP::TPileupReweighting Class Reference

Inheritance diagram for CP::TPileupReweighting:
CP::PileupReweightingTool

List of all members.

Classes

struct  CompositeTrigger
struct  Period
struct  Run

Public Member Functions

 TPileupReweighting (const char *name="TPileupReweighting")
 ~TPileupReweighting ()
Int_t UsePeriodConfig (const TString &configName)
Int_t SetBinning (Int_t nbinsx, Double_t *xbins, Int_t nbinsy=0, Double_t *ybins=0)
Int_t SetUniformBinning (Int_t nbinsx, Double_t xlow, Double_t xup, Int_t nbinsy=0, Double_t ylow=0, Double_t yup=0)
Int_t SetBinning (TH1 *hist)
void SetDefaultChannel (Int_t channel, Int_t mcRunNumber=-1)
Int_t GetDefaultChannel (Int_t mcRunNumber=-1)
Double_t GetIntegratedLumi (const TString &trigger="")
Double_t GetNumberOfEvents (Int_t channel)
Double_t GetSumOfEventWeights (Int_t channel)
void RemapPeriod (Int_t periodNumber1, Int_t periodNumber2)
Double_t GetIntegratedLumiFraction (Int_t periodNumber, UInt_t start, UInt_t end)
Double_t GetIntegratedLumiFraction (Int_t periodNumber, Double_t mu, UInt_t start, UInt_t end)
Double_t GetIntegratedLumi (UInt_t start, UInt_t end)
Double_t GetIntegratedLumi (Int_t periodNumber, UInt_t start, UInt_t end)
Double_t GetLumiBlockIntegratedLumi (Int_t runNumber, UInt_t lb)
Float_t GetLumiBlockMu (Int_t runNumber, UInt_t lb)
void DisableWarnings (Bool_t in)
void EnableDebugging (Bool_t in)
void SetUnrepresentedDataAction (Int_t action, Double_t tolerance=0.05)
Double_t GetUnrepresentedDataFraction (Int_t periodNumber, Int_t channel)
Float_t GetUnrepresentedDataWeight (Int_t periodNumber, Int_t channel)
Bool_t IsUnrepresentedData (Int_t runNumber, Float_t x, Float_t y=0.)
void IgnoreConfigFilePeriods (Bool_t in)
Int_t AddPeriod (Int_t periodNumber, UInt_t start, UInt_t end)
 returns a PeriodID. These count up from 1
Int_t GetFirstFoundPeriodNumber (UInt_t runNumber)
void SetDataScaleFactors (Float_t x, Float_t y=1.)
void SetMCScaleFactors (Float_t x, Float_t y=1.)
Int_t AddConfigFile (const TString &fileName)
Int_t AddLumiCalcFile (const TString &fileName, const TString &trigger="None")
Int_t AddMetaDataFile (const TString &fileName, const TString &channelBranchName="mc_channel_number")
Bool_t RemoveChannel (int chanNum)
Int_t Initialize ()
Float_t GetCombinedWeight (Int_t periodNumber, Int_t channelNumber, Float_t x, Float_t y=0.)
Float_t GetPeriodWeight (Int_t periodNumber, Int_t channelNumber)
Float_t GetPrimaryWeight (Int_t periodNumber, Int_t channelNumber, Float_t x)
Float_t GetSecondaryWeight (Int_t periodNumber, Int_t channelNumber, Float_t x, Float_t y)
Double_t GetMetaData (const TString &metadataName, Int_t channelNumber)
TTree * GetMetaDataTree ()
Int_t GenerateMetaDataFile (const TString &fileName, const TString &channelBranchName="mc_channel_number")
Int_t Fill (Int_t runNumber, Int_t channelNumber, Float_t w, Float_t x, Float_t y=0.)
Int_t WriteToFile (const TString &filename="")
Int_t WriteToFile (TFile *outFile)
ULong64_t GetPRWHash (Int_t periodNumber, Int_t channelNumber, Float_t x, Float_t y=0.)
Bool_t MakeWeightTree (TString channelNumbers, TString outFile, TString hashBranch="PRWHash", TString weightBranch="PileupWeight")
void SetRandomSeed (int seed)
int GetRandomSeed ()
UInt_t GetRandomRunNumber (Int_t mcRunNumber)
UInt_t GetRandomRunNumber (Int_t mcRunNumber, Double_t mu)
Int_t GetRandomPeriodNumber (Int_t mcRunNumber)
UInt_t GetRandomLumiBlockNumber (UInt_t runNumber)
Int_t Merge (TCollection *coll)
TH1 * GetInputHistogram (Int_t channelNumber, Int_t periodNumber)
TH1D * GetPrimaryDistribution (Int_t channelNumber, Int_t periodNumber)
TH1D * GetPrimaryTriggerDistribution (const TString &trigger, Int_t periodNumber, long triggerBits)
Double_t GetDataWeight (Int_t runNumber, TString trigger, Double_t x)
Double_t GetDataWeight (Int_t runNumber, TString trigger)
Bool_t IsInitialized ()
Int_t AddDistribution (TH1 *hist, Int_t runNumber, Int_t channelNumber)
void ResetCountingMode ()
void SetParentTool (TPileupReweighting *tool)
Float_t GetDataScaleFactor () const
void SetTriggerBit (const TString &trigger, bool in=true)
void ResetTriggerBits ()
double GetRunAverageMu (int run)
void PrintPeriods ()
void CopyProperties (const TPileupReweighting *in)

Protected Member Functions

virtual bool runLbnOK (Int_t, Int_t)
virtual bool passTriggerBeforePrescale (const TString &trigger) const
Int_t GetNearestGoodBin (Int_t thisMCRunNumber, Int_t bin)
Int_t IsBadBin (Int_t thisMCRunNumber, Int_t bin)
TH1 * CloneEmptyHistogram (Int_t runNumber, Int_t channelNumber)
void normalizeHistogram (TH1 *histo)
void AddDistributionTree (TTree *tree, TFile *file)
void CalculatePrescaledLuminosityHistograms (const TString &trigger)
CompositeTriggermakeTrigger (const TString &s)
void calculateHistograms (CompositeTrigger *trigger)

Protected Attributes

std::map< TString, bool > m_triggerPassBits
TPileupReweightingm_parentTool
Bool_t m_SetWarnings
Bool_t m_debugging
Bool_t m_countingMode
Int_t m_unrepresentedDataAction
Bool_t m_isInitialized
Bool_t m_lumiVectorIsLoaded
Float_t m_dataScaleFactorX
Float_t m_dataScaleFactorY
Float_t m_mcScaleFactorX
Float_t m_mcScaleFactorY
Int_t m_nextPeriodNumber
Bool_t m_ignoreFilePeriods
TTree * m_metadatatree
Double_t m_unrepDataTolerance
Bool_t m_doGlobalDataWeight
Int_t m_lumicalcRunNumberOffset
std::map< TString, std::vector
< TString > > 
m_lumicalcFiles
TH1 * m_emptyHistogram
std::map< TString, std::map
< Int_t, Double_t > > 
m_metadata
std::map< TString,
CompositeTrigger * > 
m_triggerObjs
std::map< Int_t, Period * > m_periods
std::map< UInt_t, Runm_runs
std::map< Int_t, Double_t > unrepDataByChannel
std::string m_prwFilesPathPrefix
TRandom3 * m_random3
Bool_t m_ignoreBadChannels
Bool_t m_useMultiPeriods = true

Constructor & Destructor Documentation

CP::TPileupReweighting::TPileupReweighting ( const char *  name = "TPileupReweighting"  ) 

Standard constructor

TPileupReweighting::~TPileupReweighting (  ) 

Standard destructor


Member Function Documentation

Int_t TPileupReweighting::AddPeriod ( Int_t  periodNumber,
UInt_t  start,
UInt_t  end 
)

returns a PeriodID. These count up from 1

Assign an mc RunNumber to a data period

Reimplemented in CP::PileupReweightingTool.

void CP::TPileupReweighting::DisableWarnings ( Bool_t  in  )  [inline]

Indicate if warnings should be suppressed

void CP::TPileupReweighting::EnableDebugging ( Bool_t  in  )  [inline]

Indicate if additional debugging information should be output

Double_t TPileupReweighting::GetDataWeight ( Int_t  runNumber,
TString  trigger,
Double_t  x 
)

Method for weighting data to account for prescales and mu bias. Use by giving the tool multiple lumicalc files, one for each trigger

Int_t TPileupReweighting::GetFirstFoundPeriodNumber ( UInt_t  runNumber  ) 

Get the first period number with the data run number contained - assume all periods are disconnected for this to be useful

Double_t TPileupReweighting::GetIntegratedLumi ( Int_t  periodNumber,
UInt_t  start,
UInt_t  end 
)

similar to above, but for only the given mcRunNumber/periodNumber

Reimplemented in CP::PileupReweightingTool.

Double_t CP::TPileupReweighting::GetIntegratedLumi ( UInt_t  start,
UInt_t  end 
) [inline]

get the amount of integrated lumi between the two given runs

Reimplemented in CP::PileupReweightingTool.

Double_t TPileupReweighting::GetIntegratedLumi ( const TString &  trigger = ""  ) 

total luminosity loaded and accepted by the tool (in inverse pb)

Reimplemented in CP::PileupReweightingTool.

Double_t TPileupReweighting::GetIntegratedLumiFraction ( Int_t  periodNumber,
Double_t  mu,
UInt_t  start,
UInt_t  end 
)

return fraction of lumi assigned to periodNumber (or mcRunNumber) with given mu, that is between start and end data run numbers

Reimplemented in CP::PileupReweightingTool.

Double_t TPileupReweighting::GetIntegratedLumiFraction ( Int_t  periodNumber,
UInt_t  start,
UInt_t  end 
)

return fraction of lumi assigned to periodNumber (or mcRunNumber) that is between start and end data run numbers

Reimplemented in CP::PileupReweightingTool.

Double_t TPileupReweighting::GetLumiBlockIntegratedLumi ( Int_t  runNumber,
UInt_t  lb 
)

get integrated lumi for specific run and lumiblock number .. comes from the 'unprescaled lumi', and is in pb

Float_t TPileupReweighting::GetLumiBlockMu ( Int_t  runNumber,
UInt_t  lb 
)

get the lumiblock mu, useful for 'updating' the mu coming from data to account for new lumitags

TTree * TPileupReweighting::GetMetaDataTree (  ) 

combines loaded metadata with channel sumsofweights and entry counts

Double_t CP::TPileupReweighting::GetNumberOfEvents ( Int_t  channel  )  [inline]

totalMC maps should also hold the total number of entries for each channel

UInt_t TPileupReweighting::GetRandomLumiBlockNumber ( UInt_t  runNumber  ) 

Get a random lumi block from the run number given. Use GetRandomRunNumber to choose the run number

Reimplemented in CP::PileupReweightingTool.

Int_t TPileupReweighting::GetRandomPeriodNumber ( Int_t  mcRunNumber  ) 

Get random period number from the sub-periods assigned to this run number

UInt_t TPileupReweighting::GetRandomRunNumber ( Int_t  mcRunNumber,
Double_t  mu 
)

Get random run number according to integrated lumi distribution for the given mu value (uses the binning of the mu histogram)

UInt_t TPileupReweighting::GetRandomRunNumber ( Int_t  mcRunNumber  ) 

Gets a random data run number according to the integrated lumi distribution associated to this mcRunNumber allows use of custom reweighting config files

Double_t TPileupReweighting::GetUnrepresentedDataFraction ( Int_t  periodNumber,
Int_t  channel 
)

return the unrepresented data fraction in a given channel .. when using action=2, you will want to scale up all MC events by 1/(1-unrepFraction) to account for missed data

void CP::TPileupReweighting::IgnoreConfigFilePeriods ( Bool_t  in  )  [inline]

Should the tool ignore period assignments encoded in config file

Int_t TPileupReweighting::Initialize (  ) 

Initialize this class once before the event loop starts If distribution information is provided, it is assumed to be for the standard pileup reweighting

void TPileupReweighting::normalizeHistogram ( TH1 *  histo  )  [protected]

Normalize histograms

void TPileupReweighting::RemapPeriod ( Int_t  periodNumber1,
Int_t  periodNumber2 
)

Combine two period numbers. Histos are merged and the first number will be redirected to the second (the second is created if it doesn't exist)

Bool_t TPileupReweighting::RemoveChannel ( int  chanNum  ) 

Removes a channel from the inputs ... this is for experts only

void CP::TPileupReweighting::ResetCountingMode (  )  [inline]

This method is DEFINITELY EXPERT USE ONLY. Used in the checkPRWConfigFile utitlity

Int_t TPileupReweighting::SetBinning ( Int_t  nbinsx,
Double_t *  xbins,
Int_t  nbinsy = 0,
Double_t *  ybins = 0 
)

Add a histogram binning config. To modify the pileup histo binning, use "pileup" as name

void CP::TPileupReweighting::SetDataScaleFactors ( Float_t  x,
Float_t  y = 1. 
) [inline]

Scale the LumiMetaData mu values by this factor

void TPileupReweighting::SetDefaultChannel ( Int_t  channel,
Int_t  mcRunNumber = -1 
)

Set which channel should be used as a default when specific mc channel distributions cannot be found default channels can now be assigned for each mc run number .. mcRunNumber=-1 is the global default

void CP::TPileupReweighting::SetUnrepresentedDataAction ( Int_t  action,
Double_t  tolerance = 0.05 
) [inline]

Set how to handle configurations where some of your data has no corresponding mc to describe it 0=Default (Throw exception), 1=Subtract lumi from normalizations (i.e. discard data), 2=keep lumi and continue

Int_t TPileupReweighting::UsePeriodConfig ( const TString &  configName  ) 

use a hardcoded period configuration


Member Data Documentation

the empty histogram used for this weight... effectively holds the configuration of the binning

std::map<TString,std::vector<TString> > CP::TPileupReweighting::m_lumicalcFiles [protected]

map storing the lumicalc file locations - used when building DataPileupWeights

std::map<TString, std::map<Int_t, Double_t> > CP::TPileupReweighting::m_metadata [protected]

channel metadata map


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 1 Dec 2017 for RootCore Packages by  doxygen 1.6.1