ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CP::LhoodMM_tools Class Referenceabstract

#include <LhoodMM_tools.h>

Inheritance diagram for CP::LhoodMM_tools:
Collaboration diagram for CP::LhoodMM_tools:

Public Member Functions

 LhoodMM_tools (const std::string &name)
 
 ~LhoodMM_tools ()
 
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function. More...
 
virtual StatusCode getTotalYield (float &yield, float &statErrUp, float &statErrDown) override final
 returns the accumulated fake lepton background yield (or compute it, in the case of the likelihood matrix method), and fills the registered histograms (if any) The 'selection' and 'process' settings used for these operations can be chosen with the 'Selection' and 'Process' properties. More...
 
virtual StatusCode register1DHistogram (TH1 *h1, const float *val) override
 associates a 1D histogram to the tool, to obtain a binned estimate of the fake lepton background the 'val' argument points to a variable corresponding to the X axis of the histogram and that needs to be updated before each call to addEvent() undefined behaviour if the pointers are invalidated during the tool's lifetime More...
 
virtual StatusCode register2DHistogram (TH2 *h2, const float *xval, const float *yval) override
 associates a 2D histogram to the tool, to obtain a binned estimate of the fake lepton background the 'xval' / 'yval' arguments point to variables corresponding to the X/Y axis of the histogram and that need to be updated before each call to addEvent() undefined behaviour if the pointers are invalidated during the tool's lifetime More...
 
virtual StatusCode register3DHistogram (TH3 *h3, const float *xval, const float *yval, const float *zval) override
 associates a 3D histogram to the tool, to obtain a binned estimate of the fake lepton background More...
 
double nfakes (Double_t *poserr, Double_t *negerr)
 
double nfakes_std (double *error)
 
double nfakes_std_perEventWeight (double *error)
 
StatusCode setFitType (const std::string &ft)
 
Int_t getFitStatus ()
 
void setPrintLevel (Int_t printLevel)
 
void set_do_std_perEventWeight (bool val)
 
virtual StatusCode saveProgress (TDirectory *dir) override
 
StatusCode mergeSubJobs ()
 
bool perfectFit ()
 
virtual StatusCode addEvent (const xAOD::IParticleContainer &particles, float extraWeight=1.f) override final
 supply list of leptons / global variables, internal counters incremented Does not return anything; event weight(s) must be retrieved by subsequent call(s) to getEventWeight() (for tools inheriting from ILinearFakeBkgTool) More...
 
virtual bool isAffectedBySystematic (const CP::SystematicVariation &systematic) const override
 Declare the interface that this class provides. More...
 
virtual CP::SystematicSet affectingSystematics () const override
 the list of all systematics this tool can be affected by More...
 
virtual CP::SystematicSet recommendedSystematics () const override
 the list of all systematics this tool recommends to use More...
 
virtual StatusCode applySystematicVariation (const CP::SystematicSet &systConfig) override
 effects: configure this tool for the given list of systematic variations. More...
 
virtual CP::SystematicSet affectingSystematicsFor (const std::string &nuisanceParameter) const override
 These functions are slow, don't use them in the tools implementations. More...
 
virtual std::string getUncertaintyDescription (const CP::SystematicVariation &systematic) const override final
 returns a human-readable description of the source of systematic uncertainty specified as argument More...
 
virtual void printUncertaintyDescription (const CP::SystematicVariation &systematic) const override final
 prints a human-readable description of the source of systematic uncertainty specified as argument More...
 
virtual bool isSystematicUncertainty (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty originates from a systematic uncertainty in the efficiencies (as opposed to statistical) More...
 
virtual bool isStatisticalUncertainty (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty originates from a statistical uncertainty in the efficiencies (as opposed to systematic) More...
 
virtual bool affectsElectrons (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects electrons More...
 
virtual bool affectsMuons (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects muons More...
 
virtual bool affectsTaus (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects taus More...
 
virtual bool affectsRealEfficiencies (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects real efficiencies More...
 
virtual bool affectsFakeEfficiencies (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects fake efficiencies More...
 
virtual bool affectsFakeFactors (const CP::SystematicVariation &systematic) const override final
 checks whether the specified source of uncertainty affects fake factors More...
 
virtual const IFakeBkgSystDescriptorgetSystDescriptor () const override
 retrieves an interface to various helper methods to identify what the different SystematicVariations correspond to More...
 
virtual void print () const =0
 Print the state of the tool. More...
 
virtual void print () const
 Print the state of the tool. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static constexpr const char * defaultSelection ()
 default value taken by the 'selection' argument of several methods or properties It indicates how the analysis selects leptons in the signal region The syntax supported for this arguments is described in the package documentation. More...
 
static constexpr const char * defaultProcess ()
 default value taken by the 'process' argument of several methods or properties It indicates what should be treated as fake lepton background. More...
 

Protected Member Functions

virtual void reset ()
 
virtual StatusCode addEventCustom () override
 
virtual FakeBkgTools::Client clientForDB () override final
 This indicates which type of efficiencies/fake factor need to be filled. More...
 
FakeBkgTools::FinalState getCachedFinalState (uint8_t nparticles, const std::string &strPID, const std::string &strProc, bool &success)
 
std::string getListOfEfficienciesAffectedBy (uint16_t uid) const
 
StatusCode CheckHistogramCompatibility (const TH1 *lhs, const TH1 *rhs)
 
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Protected Attributes

bool m_initialized = false
 
bool m_needEventInfo = true
 
bool m_convertWhenMissing = false
 
std::vector< FakeBkgTools::ParticleDatam_particles
 
std::unique_ptr< FakeBkgTools::Databasem_database
 
float m_externalWeight
 
std::hash< std::string > m_hasher
 comes from Event passed to addEvent() More...
 
std::set< FakeBkgTools::FinalStatem_cachedFinalStates
 
std::map< TH1 *, const float * > m_values_1dhisto_map
 
std::map< TH2 *, std::pair< const float *, const float * > > m_values_2dhisto_map
 
std::map< TH3 *, std::tuple< const float *, const float *, const float * > > m_values_3dhisto_map
 
std::string m_selection = defaultSelection()
 'selection' settings used to compute the total yield / fill histograms More...
 
std::string m_process = defaultProcess()
 'process' settings used to compute the total yield / fill histograms More...
 
std::string m_energyUnit
 property EnergyUnit user can choose between MeV or GeV to indicate the unit of the pT parametrization of efficiencies in the input files More...
 
bool m_useDB = true
 
std::vector< std::string > m_inputFiles
 property InputFiles More...
 
std::string m_tightDecoNameAndType
 property TightDecoration More...
 
CP::ISelectionReadAccessorm_tightAccessor = nullptr
 this can't be a unique_ptr as this can cause issues with the dictionary in some particular circumstances More...
 
std::string m_progressFileName
 property ProgressFileName More...
 
std::string m_progressFileDirectory
 property ProgressFileDirectory More...
 
UncertaintyListm_selectedUncertainties = nullptr
 Pointer to a value of the 'm_systSetDict' map it must be invalidated each time the map is updated in principle only applySystematicVariation() needs to do that. More...
 
std::unordered_map< CP::SystematicSet, UncertaintyListm_systSetDict
 List of uncertainties in internal format, associated with a particular SystematicSet the m_selectedUncertainties pointer must be invalidated each time this map is updated in principle only applySystematicVariation() needs to do that. More...
 
bool m_unlimitedSystematicVariations = true
 used to prevent multiple calls to applySystematicVariation() when unsupported set to true in a particular tool's constructor to disable the possibility of calling applySystematicVariation() more than once / after the first call to addEvent() More...
 
bool m_lockedSystematicVariations = false
 when m_unlimitedSystematicVariations=false, keeps track of prior calls to applySystematicVariation() / addEvent() More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

StatusCode setup ()
 
StatusCode addEventCustom (const std::vector< bool > &isTight_vals, const std::vector< FakeBkgTools::Efficiency > &realEff_vals, const std::vector< FakeBkgTools::Efficiency > &fakeEff_vals, const std::vector< int > &charges, float weight)
 
StatusCode incrementMatrices (const LhoodMMEvent &mmevt)
 
StatusCode incrementOneMatrixSet (LhoodMMFitInfo &fitInfo, const LhoodMMEvent &mmevt)
 
void get_init_pars (std::vector< double > &init_pars, int nlep)
 
void get_analytic (std::vector< double > &nrf, const int nlep)
 
double fixPosErr (double n_fake_fit, TMinuit_LHMM *lhoodFit)
 
double fixNegErr (double n_fake_fit, TMinuit_LHMM *lhoodFit)
 
void mapLhood (TMinuit_LHMM *lhoodFit, int nlep, double min, double max)
 
StatusCode fillHistograms ()
 
StatusCode fillHisto_internal (const std::vector< LhoodMMFitInfo > &fitInfo_vec, TH1 *h)
 
bool importEfficiencies (bool resetDB=false)
 load the config file(s) storing efficiencies More...
 
std::pair< uint16_t, float > identifyCpSystematicVariation (const CP::SystematicVariation &systematic) const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Static Private Member Functions

static double logPoisson (double obs, double pred)
 
static void fcn_nlep (Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
 
static void fcn_minnlep_maxnlep (Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
 

Private Attributes

LhoodMMFitInfo m_global_fitInfo
 
bool m_prevSave
 
bool m_perfectFit
 
const LhoodMMFitInfom_current_fitInfo
 
std::vector< std::unique_ptr< FakeBkgTools::FinalState > > m_fsvec
 
int m_curr_nlep
 
int m_minnlep
 
int m_maxnlep
 
int m_maxnlep_loose
 
int m_theta_tot_start_index
 
std::vector< std::vector< int > > m_real_indices
 
std::vector< std::vector< int > > m_fake_indices
 
bool m_requireSS
 
bool m_requireOS
 
bool m_needToResize
 
bool m_doFakeFactor
 
bool m_fixNormalization
 
float m_maxWeight
 
bool m_alreadyMerged
 
std::vector< std::vector< std::vector< double > > > m_coeffs
 
std::map< TH1 *, std::vector< LhoodMMFitInfo > > m_fitInfo_1dhisto_map
 
std::map< TH2 *, std::vector< LhoodMMFitInfo > > m_fitInfo_2dhisto_map
 
std::map< TH3 *, std::vector< LhoodMMFitInfo > > m_fitInfo_3dhisto_map
 
double m_dilep_SSfrac_num
 
double m_dilep_SSfrac_denom
 
std::vector< std::vector< double > > m_OSfrac
 
double m_nfakes_std
 
double m_nfakes_std_err
 
double m_nfakes_std_perEventWeight
 
double m_nfakes_std_err_perEventWeight
 
bool m_do_std_perEventWeight
 
Int_t m_fitStatus
 
Int_t m_printLevel
 
std::vector< std::shared_ptr< TMatrixT< double > > > m_nrf_mat_vec
 
std::vector< std::shared_ptr< TMatrixT< double > > > m_MMmatrix_vec
 
std::vector< std::shared_ptr< TMatrixT< double > > > m_ntlpred_vec
 
unsigned m_lastSaveIndex
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Static Private Attributes

static LhoodMM_toolsm_current_lhoodMM_tool
 
static const int s_nLepMax = 6
 
static const int s_maxRank = 64
 
static const double s_piover2 = 1.57079632679489661923
 
static const double s_piover4 = 0.785398163397448309616
 

Detailed Description

Definition at line 25 of file LhoodMM_tools.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ LhoodMM_tools()

LhoodMM_tools::LhoodMM_tools ( const std::string &  name)

Definition at line 41 of file LhoodMM_tools.cxx.

41  :
43 {
44 
46 
47  //setup fixHistogramNormalization property
48  declareProperty("FixHistogramNormalization", m_fixNormalization, "Boolean to determine whether or not histograms are scaled such that their normalization is equal to the fake yield computed for the entire sample (true = yes, do the scaleing)");
49 
50  declareProperty("DoFakeFactorFit", m_doFakeFactor, "Give results corresponding to the fake factor method rather than the matrix method");
51 
52  // set everything to default values
53  reset();
54 }

◆ ~LhoodMM_tools()

LhoodMM_tools::~LhoodMM_tools ( )

Definition at line 56 of file LhoodMM_tools.cxx.

56  {
57 
58 }

Member Function Documentation

◆ addEvent()

StatusCode BaseFakeBkgTool::addEvent ( const xAOD::IParticleContainer particles,
float  extraWeight = 1.f 
)
finaloverridevirtualinherited

supply list of leptons / global variables, internal counters incremented Does not return anything; event weight(s) must be retrieved by subsequent call(s) to getEventWeight() (for tools inheriting from ILinearFakeBkgTool)

prevent further calls to applySystematicVariation() if not allowed

only retrieved if some of the efficiency parameters are event-level!

for standalone compilation, pp is already a reference and the * operator is redefined to a no-op so that this works

Implements CP::IFakeBkgTool.

Definition at line 155 of file BaseFakeBkgTool.cxx.

156 {
157  if(!m_initialized)
158  {
159  ATH_MSG_WARNING("the tool hasn't been initialized");
160  return StatusCode::FAILURE;
161  }
162  m_particles.clear();
164 
165  const xAOD::EventInfo* eventInfo = nullptr;
166  if(m_needEventInfo)
167  {
168  #ifdef FAKEBKGTOOLS_ATLAS_ENVIRONMENT
169  ATH_CHECK( evtStore()->retrieve(eventInfo, "EventInfo") );
170  #else
171  eventInfo = &iparticles.eventInfo;
172  #endif
173  }
174 
175  for(const auto& pp : iparticles)
176  {
177  const auto& p = *pp;
178  m_particles.emplace_back();
179  auto& d = m_particles.back();
180  d.tight = m_tightAccessor->getBool(p);
181  d.type = p.type();
182  switch(p.type())
183  {
184  case xAOD::Type::Electron: d.charge = static_cast<const xAOD::Electron&>(p).charge(); break;
185  case xAOD::Type::Muon: d.charge = static_cast<const xAOD::Muon&>(p).charge(); break;
186  case xAOD::Type::Tau: d.charge = static_cast<const xAOD::TauJet&>(p).charge(); break;
187  case xAOD::Type::Photon: d.charge = 0; break;
188  default:
189  ATH_MSG_WARNING("unknown particle type, setting charge to 0");
190  d.charge = 0;
191  }
192  if(m_useDB)
193  {
194  std::string error;
195  if(!m_database->fillEfficiencies(d, p, *eventInfo, error))
196  {
197  ATH_MSG_ERROR("unable to retrieve efficiencies: " << error);
198  return StatusCode::FAILURE;
199  }
200  ATH_MSG_DEBUG("particle has fake fact. = " << d.fake_factor.value(this) <<", fake eff. = " << d.fake_efficiency.value(this) <<", real eff. = " << d.real_efficiency.value(this));
201  }
202  else
203  {
204  d.real_efficiency.nominal = p.auxdataConst<float>("real_eff");
205  d.fake_efficiency.nominal = p.auxdataConst<float>("fake_eff");
206  }
207  }
208  if(m_particles.size() > maxParticles())
209  {
210  ATH_MSG_WARNING( "the input contains " << m_particles.size() << " particles but the maximum allowed is " << maxParticles()
211  << "; the last " << (m_particles.size()-maxParticles()) << " will be ignored");
212  m_particles.erase(m_particles.begin() + maxParticles(), m_particles.end());
213  }
214  m_externalWeight = mcWeight;
215  ATH_MSG_DEBUG("calling addEventCustom() with #particles = " << m_particles.size());
216  return addEventCustom();
217 }

◆ addEventCustom() [1/2]

StatusCode LhoodMM_tools::addEventCustom ( )
overrideprotectedvirtual

Implements CP::BaseFakeBkgTool.

Definition at line 262 of file LhoodMM_tools.cxx.

262  {
263 
264  int nlep = m_particles.size();
265  if (nlep == 0) {
266  ATH_MSG_WARNING("Attempt to add an event with 0 leptons. This event will be ignored.");
267  return StatusCode::SUCCESS;
268  }
269  std::vector<bool> isTight_vals;
270  std::vector<Efficiency> realEff_vals;
271  std::vector<Efficiency> fakeEff_vals;
272  std::vector<int> charges;
273  std::vector<FakeBkgTools::ParticleData>::const_iterator particles_it;
274  for (particles_it = m_particles.begin(); particles_it != m_particles.end(); ++particles_it) {
275  const FakeBkgTools::ParticleData& p = *particles_it;
276  isTight_vals.push_back(p.tight);
277  realEff_vals.push_back(p.real_efficiency);
278  fakeEff_vals.push_back(p.fake_efficiency);
279  double r_eff = p.real_efficiency.value(this);
280  double f_eff = p.fake_efficiency.value(this);
281 
282  if (particles_it == m_particles.begin() ){
283 
284  for(const std::pair<short unsigned int, FakeBkgTools::Uncertainty> kv : p.real_efficiency.uncertainties)
285  {
286  ATH_MSG_DEBUG("real eff uncertainties for first lepton are " << kv.second.up << " " << kv.second.down);
287  }
288  for(const std::pair<short unsigned int, FakeBkgTools::Uncertainty> kv : p.fake_efficiency.uncertainties)
289  {
290  ATH_MSG_DEBUG("fake eff uncertainties for first lepton are " << kv.second.up << " " << kv.second.down);
291  }
292  }
293  charges.push_back(p.charge);
294  if ( r_eff < 0.01 && f_eff< 0.01) {
295  ATH_MSG_DEBUG("Found bad efficiency values");
296  }
297  }
298 
299  return addEventCustom( isTight_vals, realEff_vals, fakeEff_vals, charges, m_externalWeight);
300 }

◆ addEventCustom() [2/2]

StatusCode LhoodMM_tools::addEventCustom ( const std::vector< bool > &  isTight_vals,
const std::vector< FakeBkgTools::Efficiency > &  realEff_vals,
const std::vector< FakeBkgTools::Efficiency > &  fakeEff_vals,
const std::vector< int > &  charges,
float  weight 
)
private

Definition at line 237 of file LhoodMM_tools.cxx.

241  {
242 
243  if (extraweight > m_maxWeight) m_maxWeight = extraweight;
244 
245  int nlep = isTight_vals.size();
246 
247  m_needToResize = false;
248  if (nlep > m_maxnlep_loose) {
249  m_maxnlep_loose = nlep;
250  m_needToResize = true;
251  }
252 
253  LhoodMMEvent mmevt(nlep, realEff_vals, fakeEff_vals, isTight_vals, charges, extraweight);
254 
256 
257 
258  return StatusCode::SUCCESS;
259 
260 }

◆ affectingSystematics()

CP::SystematicSet BaseFakeBkgTool::affectingSystematics ( ) const
overridevirtualinherited

the list of all systematics this tool can be affected by

Implements CP::IReentrantSystematicsTool.

Definition at line 409 of file BaseFakeBkgTool.cxx.

410 {
411  if(!m_initialized || !m_database)
412  {
413  ATH_MSG_ERROR("This function can be called only once the tool has been initialized, since the number of systematic variations depends on the configuration...");
414  throw std::logic_error("BaseFakeBkgTool::affectingSystematics() called before initialization");
415  }
416  CP::SystematicSet affecting;
417  for(int step=0;step<2;++step)
418  {
419  std::string type = step? "STAT" : "SYST";
420  const int imax = step? m_database->numberOfStats() : m_database->numberOfSysts();
421  for(int i=0;i<imax;++i)
422  {
423  std::string name = "FAKEBKG_" + type + "_VAR" + std::to_string(i);
424  affecting.insert(CP::SystematicVariation(name, 1.f));
425  affecting.insert(CP::SystematicVariation(name, -1.f));
426  }
427  }
428  return affecting;
429 }

◆ affectingSystematicsFor()

CP::SystematicSet BaseFakeBkgTool::affectingSystematicsFor ( const std::string &  nuisanceParameter) const
overridevirtualinherited

These functions are slow, don't use them in the tools implementations.

Implements CP::IFakeBkgSystDescriptor.

Definition at line 589 of file BaseFakeBkgTool.cxx.

590 {
591  CP::SystematicSet affecting;
592  if(!m_initialized || !m_database)
593  {
594  ATH_MSG_ERROR("This function can be called only once the tool has been initialized, since the number of systematic variations depends on the configuration...");
595  return {};
596  }
597  bool up=true, down=true;
598  auto pos1=nuisanceParameter.find("__up"), pos2=nuisanceParameter.find("__down");
599  if(pos1!=std::string::npos && pos1+4==nuisanceParameter.length()) down = false;
600  else if(pos2!=std::string::npos && pos2+6==nuisanceParameter.length()) up = false;
601  std::string np = nuisanceParameter.substr(0, std::min(pos1, pos2));
602  for(unsigned i=0;i<m_database->numberOfSysts();++i)
603  {
604  auto syst = m_database->findSyst(m_database->systIndexToUID(i));
605  if(syst && syst->name==np)
606  {
607  std::string name = "FAKEBKG_SYST_VAR" + std::to_string(i);
608  if(up) affecting.insert(CP::SystematicVariation(name, 1.f));
609  if(down) affecting.insert(CP::SystematicVariation(name, -1.f));
610  }
611  }
612  return affecting;
613 }

◆ affectsElectrons()

bool BaseFakeBkgTool::affectsElectrons ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty affects electrons

Implements CP::IFakeBkgSystDescriptor.

Definition at line 547 of file BaseFakeBkgTool.cxx.

548 {
549  uint16_t UID = identifyCpSystematicVariation(systematic).first;
550  if(UID) return getListOfEfficienciesAffectedBy(UID).find("electron") != std::string::npos;
551  return false;
552 }

◆ affectsFakeEfficiencies()

bool BaseFakeBkgTool::affectsFakeEfficiencies ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty affects fake efficiencies

Implements CP::IFakeBkgSystDescriptor.

Definition at line 575 of file BaseFakeBkgTool.cxx.

576 {
577  uint16_t UID = identifyCpSystematicVariation(systematic).first;
578  if(UID) return getListOfEfficienciesAffectedBy(UID).find("fake eff") != std::string::npos;
579  return false;
580 }

◆ affectsFakeFactors()

bool BaseFakeBkgTool::affectsFakeFactors ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty affects fake factors

Implements CP::IFakeBkgSystDescriptor.

Definition at line 582 of file BaseFakeBkgTool.cxx.

583 {
584  uint16_t UID = identifyCpSystematicVariation(systematic).first;
585  if(UID) return getListOfEfficienciesAffectedBy(UID).find("fake factor") != std::string::npos;
586  return false;
587 }

◆ affectsMuons()

bool BaseFakeBkgTool::affectsMuons ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty affects muons

Implements CP::IFakeBkgSystDescriptor.

Definition at line 554 of file BaseFakeBkgTool.cxx.

555 {
556  uint16_t UID = identifyCpSystematicVariation(systematic).first;
557  if(UID) return getListOfEfficienciesAffectedBy(UID).find("muon") != std::string::npos;
558  return false;
559 }

◆ affectsRealEfficiencies()

bool BaseFakeBkgTool::affectsRealEfficiencies ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty affects real efficiencies

Implements CP::IFakeBkgSystDescriptor.

Definition at line 568 of file BaseFakeBkgTool.cxx.

569 {
570  uint16_t UID = identifyCpSystematicVariation(systematic).first;
571  if(UID) return getListOfEfficienciesAffectedBy(UID).find("real eff") != std::string::npos;
572  return false;
573 }

◆ affectsTaus()

bool BaseFakeBkgTool::affectsTaus ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty affects taus

Implements CP::IFakeBkgSystDescriptor.

Definition at line 561 of file BaseFakeBkgTool.cxx.

562 {
563  uint16_t UID = identifyCpSystematicVariation(systematic).first;
564  if(UID) return getListOfEfficienciesAffectedBy(UID).find("tau") != std::string::npos;
565  return false;
566 }

◆ applySystematicVariation()

StatusCode BaseFakeBkgTool::applySystematicVariation ( const CP::SystematicSet systConfig)
overridevirtualinherited

effects: configure this tool for the given list of systematic variations.

any requested systematics that are not affecting this tool will be silently ignored (unless they cause other errors). failures: systematic unknown failures: requesting multiple variations on the same systematic (e.g. up & down) failures: requesting an unsupported variation on an otherwise supported systematic (e.g. a 2 sigma variation and the tool only supports 1 sigma variations) failures: unsupported combination of supported systematic failures: other tool specific errors

prevent further calls to applySystematicVariation() if not allowed

Implements CP::ISystematicsTool.

Definition at line 436 of file BaseFakeBkgTool.cxx.

437 {
438  if(!m_initialized || !m_database)
439  {
440  ATH_MSG_ERROR("This function can be called only once the tool has been initialized");
441  throw std::logic_error("BaseFakeBkgTool::applySystematicVariation() called before initialization");
442  }
444  {
445  ATH_MSG_ERROR("this particular method doesn't support multiple calls to applySystematicVariation(), or after the first call to addEvent(). Please use a separate instance of the tool for each variation.");
446  throw std::logic_error("BaseFakeBkgTool::applySystematicVariation() called at a wrong time");
447  }
449  if(!systConfig.size())
450  {
451  m_selectedUncertainties = nullptr;
452  return StatusCode::SUCCESS;
453  }
454  auto itr = m_systSetDict.find(systConfig);
455  if(itr != m_systSetDict.end())
456  {
457  m_selectedUncertainties = &itr->second;
458  return StatusCode::SUCCESS;
459  }
460  CP::SystematicSet mysys;
462  if(sc != StatusCode::SUCCESS) return sc;
463  std::unique_ptr<UncertaintyList> uncertainties;
464  for(auto& sysvar : mysys)
465  {
466  auto var = identifyCpSystematicVariation(sysvar);
467  if(!var.first)
468  {
469  ATH_MSG_ERROR("The systematic variation " << sysvar.name() << " is not recognized, despite being present in affectingSystematics()...");
470  return StatusCode::FAILURE;
471  }
472  if(!uncertainties) uncertainties.reset(new UncertaintyList(var.first, var.second));
473  else uncertainties->extraVariation(var.first, var.second);
474  }
475  if(uncertainties)
476  {
477  auto emplaced = m_systSetDict.emplace(systConfig, std::move(*uncertainties));
478  m_selectedUncertainties = &emplaced.first->second;
479  }
480  else m_selectedUncertainties = nullptr;
481  return StatusCode::SUCCESS;
482 }

◆ CheckHistogramCompatibility()

StatusCode BaseFakeBkgTool::CheckHistogramCompatibility ( const TH1 lhs,
const TH1 rhs 
)
protectedinherited

Definition at line 330 of file BaseFakeBkgTool.cxx.

331 {
332  std::string error;
333  if(std::string(lhs->GetName()) != rhs->GetName()) error = "names";
334  else if(lhs->GetDimension() != rhs->GetDimension()) error = "dimensions";
335  else if(lhs->GetNbinsX()!=rhs->GetNbinsX() || lhs->GetNbinsY()!=rhs->GetNbinsY() || lhs->GetNbinsZ()!=rhs->GetNbinsZ()) error = "number of bins";
336  else
337  {
338  for(auto getAxis : std::initializer_list<const TAxis*(TH1::*)()const>{&TH1::GetXaxis, &TH1::GetYaxis, &TH1::GetZaxis})
339  {
340  auto lhsAxis=(lhs->*getAxis)(), rhsAxis=(rhs->*getAxis)();
341  for(int i=0;i<=lhsAxis->GetNbins();++i)
342  {
343  auto x=lhsAxis->GetBinUpEdge(i), y=rhsAxis->GetBinUpEdge(i), width=lhsAxis->GetBinWidth(i?i:1);
344  if(std::fabs(x-y) > 0.01*width) error = "bin edges";
345  }
346  }
347  }
348  if(error.length())
349  {
350  ATH_MSG_ERROR("the registered histogram \"" << lhs->GetName() << "\" is not compatible with the one saved in the in-progress ROOT file (mismatching " << error << "). Or, you tried registering two different histograms with the same name.");
351  return StatusCode::FAILURE;
352  }
353  return StatusCode::SUCCESS;
354 }

◆ clientForDB()

FakeBkgTools::Client LhoodMM_tools::clientForDB ( )
finaloverrideprotectedvirtual

This indicates which type of efficiencies/fake factor need to be filled.

Implements CP::BaseFakeBkgTool.

Definition at line 62 of file LhoodMM_tools.cxx.

63 {
65 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ defaultProcess()

static constexpr const char* CP::IFakeBkgTool::defaultProcess ( )
inlinestaticconstexprinherited

default value taken by the 'process' argument of several methods or properties It indicates what should be treated as fake lepton background.

The syntax supported for this arguments is described in the package documentation.

Definition at line 37 of file IFakeBkgTool.h.

37 { return ">=1F[T]"; }

◆ defaultSelection()

static constexpr const char* CP::IFakeBkgTool::defaultSelection ( )
inlinestaticconstexprinherited

default value taken by the 'selection' argument of several methods or properties It indicates how the analysis selects leptons in the signal region The syntax supported for this arguments is described in the package documentation.

Definition at line 32 of file IFakeBkgTool.h.

32 { return "0!T"; }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
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

◆ fcn_minnlep_maxnlep()

void LhoodMM_tools::fcn_minnlep_maxnlep ( Int_t &  npar,
Double_t *  gin,
Double_t &  f,
Double_t *  par,
Int_t  iflag 
)
staticprivate

Definition at line 557 of file LhoodMM_tools.cxx.

558 {
559 
561 
562  const bool verbose = (l->m_printLevel > 0);
563 
564  if (verbose) {
565  ASG_MSG_VERBOSE("Parameters input to fcn_minnlep_maxnlep:" );
566  for (int ipar = 0; ipar < npar; ipar++) {
567  ASG_MSG_VERBOSE(ipar << ": " << par[ipar]);
568  }
569  }
570  int minnlep = l->m_minnlep;
571  int maxnlep_loose = l->m_maxnlep_loose;
572 
573  Double_t f_tot = 0.;
574 
575  Double_t rsq = par[0];
576 
577  Double_t sinterm_tot = 1.;
578 
579  int theta_nlep_index = 1 + maxnlep_loose -minnlep;
580  ASG_MSG_VERBOSE("theta_nlep_index initial = " << theta_nlep_index);
581  for (int ilep = minnlep; ilep <= maxnlep_loose; ilep++) {
582  theta_nlep_index += l->m_real_indices[ilep-1].size();
583  ASG_MSG_VERBOSE("theta_nlep_index for ilep = " << ilep << " = " << theta_nlep_index);
584  }
585 
586  Double_t pars_thisnlep[s_maxRank]; // a bit of a waste of memory, but avoids compiler warnings for variable-
587 
588  if(verbose) ASG_MSG_VERBOSE("theta_nlep_index = " << theta_nlep_index);
589 
590  int real_index = 1;
591  for (int ilep = minnlep; ilep <= maxnlep_loose; ilep++) {
592  if (l->m_current_fitInfo->eventCount[ilep-1] == 0) {
593  ASG_MSG_VERBOSE("m_real_indices[" << ilep-1 << "].size() = " << l->m_real_indices[ilep-1].size());
594  real_index += l->m_real_indices[ilep-1].size();
595  for (int ipar = 0; ipar < (int)l->m_fake_indices[ilep-1].size()-1; ipar++) {
596  theta_nlep_index++;
597  }
598  continue;
599  }
600  l->m_curr_nlep = ilep;
601  Int_t npar_thisnlep = 0x1 << ilep;
602 
603  int theta_tot_index = l->m_theta_tot_start_index+ilep-minnlep;
604  if(verbose) ASG_MSG_VERBOSE("theta_tot_index, npar = " << theta_tot_index << " " << npar);
605  if(verbose) ASG_MSG_VERBOSE("sinterm_tot, par[theta_tot_index] = " << sinterm_tot << " " << par[theta_tot_index]);
606  if (l->m_maxnlep_loose - minnlep > 0) {
607  double costerm;
608  if (ilep < l->m_maxnlep_loose ) {
609  costerm = TMath::Cos(par[theta_tot_index]);
610  } else {
611  costerm = 1.;
612  }
613  if(verbose) ASG_MSG_VERBOSE("r sinterm_tot costerm = " << rsq <<" " << sinterm_tot << " " << costerm);
614  pars_thisnlep[0] = rsq*sinterm_tot*costerm*sinterm_tot*costerm;
615  sinterm_tot *= TMath::Sin(par[theta_tot_index]);
616  } else {
617  pars_thisnlep[0] = rsq;
618  }
619  if(verbose) ASG_MSG_VERBOSE("pars_thisnlep[0] = " << pars_thisnlep[0]);
620  int par_index = 1;
621  ASG_MSG_VERBOSE("m_real_indices[ilep-1].size() = " << l->m_real_indices[ilep-1].size());
622  for (unsigned ipar = 0; ipar < l->m_real_indices[ilep-1].size(); ipar++) {
623  pars_thisnlep[par_index] = par[real_index+ipar];
624  if(verbose) ASG_MSG_VERBOSE("r pars_thisnlep[" << par_index << "] = " << pars_thisnlep[par_index]);
625  par_index++;
626  }
627 
628  for (int ipar = 0; ipar < (int)l->m_fake_indices[ilep-1].size()-1; ipar++) {
629  ASG_MSG_VERBOSE("theta_nlep_index = " << theta_nlep_index );
630  pars_thisnlep[par_index+ipar] = par[theta_nlep_index];
631  if(verbose) ASG_MSG_VERBOSE("f pars_thisnlep[" << par_index+ipar <<"] = " << pars_thisnlep[par_index+ipar]);
632  theta_nlep_index++;
633  }
634  fcn_nlep(npar_thisnlep, gin, f, pars_thisnlep, iflag);
635  f_tot += f;
636 
637  real_index += l->m_real_indices[ilep-1].size();
638  }
639 
640  f = f_tot;
641 }

◆ fcn_nlep()

void LhoodMM_tools::fcn_nlep ( Int_t &  npar,
Double_t *  gin,
Double_t &  f,
Double_t *  par,
Int_t  iflag 
)
staticprivate

Definition at line 643 of file LhoodMM_tools.cxx.

644 {
645 
647 
648  const bool verbose = (l->m_printLevel > 0);
649 
650  int nlep = l->m_curr_nlep;
651  int lepidx = nlep-1;
652  int rank = 0x1 << nlep;
653 
654  if(verbose) {
655  ASG_MSG_VERBOSE("npar = " << npar);
656  for (int ipar = 0; ipar < npar; ipar++) {
657  ASG_MSG_VERBOSE("Parameter " << ipar << " = " << par[ipar]);
658  }
659  }
660 
661  if(verbose) {
662  std::string txt = "testing variable transform: angle pars in fcn: ";
663  for (int i = 0; i < npar; i++) {
664  txt += std::to_string(par[i]) + " ";
665  }
667  }
668 
669  // remaining parameters are the angles used to divide up the fakes contribution
670 
671  std::shared_ptr<TMatrixT<double>> nrf, MMmatrix, ntlpred;
672  nrf = l->m_nrf_mat_vec[lepidx];
673  if(verbose) {
674  ASG_MSG_VERBOSE("What does nrf look like?");
675  nrf->Print();
676  }
677  MMmatrix = l->m_MMmatrix_vec[lepidx];
678  ntlpred = l->m_ntlpred_vec[lepidx];
679 
680  (*nrf)(0,0) = par[0];
681  double rsq = TMath::Abs(par[0]);
682  if(verbose) ASG_MSG_VERBOSE("rsq = " << rsq);
683  int rsize = l->m_real_indices[lepidx].size();
684  int fsize = l->m_fake_indices[lepidx].size();
685 
686  for (int ipar = 0; ipar < rsize; ipar++) {
687  ASG_MSG_VERBOSE("In fcn, setting real par " << l->m_real_indices[lepidx][ipar] << " to " << par[ipar+1]);
688  (*nrf)(l->m_real_indices[lepidx][ipar], 0) = par[ipar+1];
689  }
690  double sinterm = 1.;
691 
692  if(verbose) ASG_MSG_VERBOSE("nrf[0] = " << (*nrf)(0,0));
693 
694  for (int ipar = 0; ipar < fsize; ipar++) {
695  if(verbose) ASG_MSG_VERBOSE("r, sinterm, par[ipar+1] " << rsq << " " << sinterm << " " << par[ipar+1]);
696  if (ipar < fsize-1 ) {
697  double costerm = TMath::Cos(par[rsize+ipar+1]);
698  if(verbose) ASG_MSG_VERBOSE("for setting fake parameter, sinterm = " << sinterm << " par index = " << l->m_real_indices[lepidx].size()+ipar+1);
699  (*nrf)(l->m_fake_indices[lepidx][ipar],0) = rsq*sinterm*costerm*sinterm*costerm;
700  } else {
701  (*nrf)(l->m_fake_indices[lepidx][ipar],0) = rsq*sinterm*sinterm;
702  }
703 
704  ASG_MSG_VERBOSE("nrf[" << ipar << "] = " << (*nrf)(ipar,0));
705  ASG_MSG_VERBOSE("In fcn, setting fake par " << l->m_fake_indices[lepidx][ipar] << " to " << (*nrf)(l->m_fake_indices[lepidx][ipar],0));
706 
707  sinterm *= TMath::Sin(par[rsize+ipar+1]);
708  }
709 
710  ASG_MSG_VERBOSE("Testing variable transform: nrf in fcn: ");
711  if(verbose) {
712  nrf->Print();
713  }
714 
715  *ntlpred = (*MMmatrix)*(*nrf);
716 
717  ASG_MSG_VERBOSE("Printing the matrix in fcn");
718  if(verbose) {
719  MMmatrix->Print();
720  nrf->Print();
721  }
722  f = 0;
723  int ipar_start;
724  if (l->m_doFakeFactor) {
725  ipar_start = 1;
726  } else {
727  ipar_start = 0;
728  }
729 
730  for (int ipar = ipar_start; ipar < rank; ipar++) {
731  if(verbose) ASG_MSG_VERBOSE("Comparing parameter " << ipar << ": " << l->m_current_fitInfo->event_cat.at(lepidx).at(ipar) << " to " << (*ntlpred)(ipar,0));
732  // following scaling for weighted events motivated by arXiv:1309.1287
733  int nobs = l->m_current_fitInfo->event_cat.at(lepidx).at(ipar);
734  double s = 1.;
735  if (nobs > 0) {
736  s= l->m_current_fitInfo->event_sumw2.at(lepidx).at(ipar)/nobs;
737  }
738  if (verbose) ASG_MSG_VERBOSE("s = " << s);
739  f += logPoisson(1.*nobs/s, (*ntlpred)(ipar,0)/s);
740  if (verbose) ASG_MSG_VERBOSE("f = " << f);
741  }
742 
743 }

◆ fillHisto_internal()

StatusCode LhoodMM_tools::fillHisto_internal ( const std::vector< LhoodMMFitInfo > &  fitInfo_vec,
TH1 h 
)
private

Definition at line 1159 of file LhoodMM_tools.cxx.

1159  {
1160 
1161  // If fixNormalization is set to true, the fake yield for the entire sample
1162  // will be calculated first, and then the histogram will be scaled at the end
1163  // so that its normalization matches this yield. Otherwise, the sum of the
1164  // bin entries is not guaranteed to match yield calculated on the sample
1165  // as a whole.
1166 
1167  // As a general rule of thumb, if the histogram being created is the key one
1168  // for the analysis (e.g. used to set limits) then it's best to keep
1169  // fixNormalization false. On the other hand, if the analysis is based on
1170  // total yield, and the histogram is a control/validation plot, it's best
1171  // to set fixNormalization to true.
1172 
1173  int nbins = h->GetNcells();
1174 
1175  ATH_MSG_VERBOSE("nbins = " << nbins);
1176  Double_t nf, poserr, negerr, shift = 0.;
1177 
1178  for (int ibin = 0; ibin < nbins; ibin++) {
1179 
1180  m_current_fitInfo = &fitInfo_vec[ibin];
1181  int totEvents = m_current_fitInfo->totEvents;
1182  if (totEvents > 0) {
1183  ATH_MSG_VERBOSE("Filling bin " << ibin << " with " << totEvents << " events");
1184  nf = nfakes(&poserr, &negerr);
1185  h->SetBinContent(ibin, nf+shift);
1186  if (TMath::IsNaN(h->GetBinContent(ibin))) {
1187  h->SetBinContent(ibin,0.);
1188  h->SetBinError(ibin, 0.);
1189  } else {
1190  h->SetBinError(ibin,TMath::Max(poserr,-negerr));
1191  }
1192  } else {
1193  h->SetBinContent(ibin,0.);
1194  h->SetBinError(ibin, 0.);
1195  }
1196  ATH_MSG_VERBOSE("Result is " << h->GetBinContent(ibin) << " +/- " << h->GetBinError(ibin));
1197  }
1198 
1199 
1200  if (m_fixNormalization) {
1201  double poserr, negerr;
1202  double totFakes;
1203 
1205  totFakes = nfakes(&poserr, &negerr);
1206 
1207  // find total content of histogram, including under- and overflows
1208  double totHistContent = 0.;
1209  for (int ibin = 0; ibin < nbins; ibin++) {
1210  totHistContent += h->GetBinContent(ibin);
1211  }
1212 
1213  ATH_MSG_VERBOSE("totHistContent = " << totHistContent);
1214  ATH_MSG_VERBOSE("sum of weights = " << h->GetSumOfWeights());
1215 
1216  double scaleFactor;
1217  if (totHistContent > 0.) {
1218  scaleFactor = totFakes/totHistContent;
1219  } else {
1220  scaleFactor = 1.;
1221  }
1222  for (int ibin = 1; ibin <= nbins; ibin++) {
1223  h->SetBinContent(ibin, scaleFactor*h->GetBinContent(ibin));
1224  h->SetBinError(ibin, scaleFactor*h->GetBinError(ibin));
1225  }
1226  }
1227  return StatusCode::SUCCESS;
1228 }

◆ fillHistograms()

StatusCode LhoodMM_tools::fillHistograms ( )
private

Definition at line 1132 of file LhoodMM_tools.cxx.

1132  {
1133 
1134  StatusCode status = StatusCode::SUCCESS;
1135 
1136  for (auto map1_iter=m_fitInfo_1dhisto_map.begin(); map1_iter != m_fitInfo_1dhisto_map.end(); map1_iter++) {
1137  auto & fitInfo_vec = map1_iter->second;
1138  TH1* histogram = map1_iter->first;
1139  status = fillHisto_internal(fitInfo_vec, histogram);
1140  }
1141 
1142  for (auto map2_iter=m_fitInfo_2dhisto_map.begin(); map2_iter != m_fitInfo_2dhisto_map.end(); map2_iter++) {
1143  auto& fitInfo_vec = map2_iter->second;
1144  TH2* histogram = (TH2*)map2_iter->first;
1145  status = fillHisto_internal(fitInfo_vec, histogram);
1146  ATH_MSG_VERBOSE("Inside fill code, mean = " << histogram->ProjectionX()->GetMean());
1147  }
1148 
1149  for (auto map3_iter=m_fitInfo_3dhisto_map.begin(); map3_iter != m_fitInfo_3dhisto_map.end(); map3_iter++) {
1150  auto& fitInfo_vec = map3_iter->second;
1151  TH3* histogram = (TH3*)map3_iter->first;
1152  status = fillHisto_internal(fitInfo_vec, histogram);
1153  ATH_MSG_VERBOSE("Inside fill code, mean = " << histogram->ProjectionX()->GetMean());
1154  }
1155 
1156  return status;
1157 }

◆ fixNegErr()

double LhoodMM_tools::fixNegErr ( double  n_fake_fit,
TMinuit_LHMM lhoodFit 
)
private

Definition at line 1581 of file LhoodMM_tools.cxx.

1581  {
1582 
1583  ATH_MSG_VERBOSE("Trying to fix bad negative error");
1584 
1585  // get current value of -lnL
1586  Double_t f_from_fit, junk;
1587  Int_t ijunk;
1588 
1589  lhoodFit->mnstat(f_from_fit, junk, junk, ijunk, ijunk, ijunk);
1590 
1591  // do a binary search to find real value of positive error
1592  double n_fake_guess_hi = n_fake_fit;
1593  double n_fake_guess_lo = 0.;
1594  double n_fake_guess = n_fake_guess_lo;
1595  double f_with_guess;
1596 
1597  bool errFound = 0;
1598  bool stopSearch = 0;
1599  double convergeCriteria = 0.01;
1600  double min_n_fake_guess = 0.05;
1601 
1602  int nfake_tot_index = 1;
1603 
1604  Double_t arglist[10];
1605 
1606  int ierflg;
1607 
1608  arglist[0] = nfake_tot_index;
1609  arglist[1] = n_fake_fit;
1610  lhoodFit->mnexcm("SET PAR", arglist, 2, ierflg);
1611  lhoodFit->mnexcm("FIX PAR", arglist, 1, ierflg);
1612 
1613  arglist[0] = 10000;
1614  arglist[1] = 1.0;
1615  lhoodFit->mnexcm("MIGRAD", arglist ,2,ierflg);
1616  lhoodFit->mnimpr();
1617 
1618  lhoodFit->mnstat(f_from_fit, junk, junk, ijunk, ijunk, ijunk);
1619 
1620  while (!stopSearch) {
1621  // fit with n_fake_tot fixed to guess value
1622 
1623 
1624  arglist[0] = nfake_tot_index;
1625  arglist[1] = n_fake_guess;
1626  lhoodFit->mnexcm("SET PAR", arglist, 2, ierflg);
1627  lhoodFit->mnexcm("FIX PAR", arglist, 1, ierflg);
1628 
1629  arglist[0] = 10000;
1630  arglist[1] = 1.0;
1631  lhoodFit->mnexcm("MIGRAD", arglist ,2,ierflg);
1632  lhoodFit->mnimpr();
1633  lhoodFit->mnstat(f_with_guess, junk, junk, ijunk, ijunk, ijunk);
1634 
1635  ATH_MSG_VERBOSE("nlep, n_fake_guess, n_fake_guess_lo, n_fake_guesss_hi, f_from_fit, f_with_guess: " << "?" << " " << n_fake_guess << " " << n_fake_guess_lo << " " << n_fake_guess_hi << " " << f_from_fit << " " << f_with_guess);
1636 
1637  if ((f_with_guess - f_from_fit) > 0.5) {
1638  n_fake_guess_lo = n_fake_guess;
1639  } else {
1640  n_fake_guess_hi = n_fake_guess;
1641  }
1642  n_fake_guess = 0.5*(n_fake_guess_lo+n_fake_guess_hi);
1643 
1644  if (((n_fake_guess_hi - n_fake_guess_lo)/n_fake_guess_hi < convergeCriteria) || (n_fake_guess_hi < min_n_fake_guess) ) {
1645  stopSearch = 1;
1646  if (n_fake_guess_hi < n_fake_fit) {
1647  errFound = 1;
1648  }
1649  }
1650  }
1651 
1652  // reset nfakes to value found from original fit, so it's read out properly
1653  // later
1654  arglist[0] = nfake_tot_index;
1655  arglist[1] = n_fake_fit;
1656  lhoodFit->mnexcm("SET PAR", arglist, 2, ierflg);
1657 
1658  if (errFound) {
1659  return n_fake_guess - n_fake_fit;
1660  } else {
1661  ATH_MSG_VERBOSE("Setting fitStatus to 1 in fixNegErr");
1662  m_fitStatus = 1;
1663  return 1.;
1664  }
1665 }

◆ fixPosErr()

double LhoodMM_tools::fixPosErr ( double  n_fake_fit,
TMinuit_LHMM lhoodFit 
)
private

Definition at line 1490 of file LhoodMM_tools.cxx.

1490  {
1491 
1492  ATH_MSG_VERBOSE("Trying to fix bad positive error");
1493 
1494  // get current value of -lnL
1495  Double_t f_from_fit, junk;
1496  Int_t ijunk;
1497 
1498  // do a binary search to find real value of positive error
1499  double n_fake_guess_hi = TMath::Max(n_fake_fit*5,1.);
1500  double n_fake_guess_lo = n_fake_fit;
1501  double n_fake_guess = n_fake_guess_hi;
1502  double f_with_guess;
1503 
1504  bool errFound = 0;
1505  bool stopSearch = 0;
1506 
1507  double convergeCriteria = 0.01;
1508 
1509  int nfake_tot_index = 1;
1510 
1511  Double_t arglist[10];
1512 
1513  int ierflg;
1514 
1515  arglist[0] = nfake_tot_index;
1516  arglist[1] = n_fake_fit;
1517  lhoodFit->mnexcm("SET PAR", arglist, 2, ierflg);
1518  lhoodFit->mnexcm("FIX PAR", arglist, 1, ierflg);
1519 
1520  arglist[0] = 10000;
1521  arglist[1] = 1.0;
1522  lhoodFit->mnexcm("MIGRAD", arglist ,2,ierflg);
1523  lhoodFit->mnimpr();
1524 
1525  lhoodFit->mnstat(f_from_fit, junk, junk, ijunk, ijunk, ijunk);
1526  ATH_MSG_VERBOSE("f_from_fit = " << f_from_fit);
1527 
1528  while (!stopSearch) {
1529  // fit with n_fake_tot fixed to guess value
1530  arglist[0] = nfake_tot_index;
1531  arglist[1] = n_fake_guess;
1532  lhoodFit->mnexcm("SET PAR", arglist, 2, ierflg);
1533  lhoodFit->mnexcm("FIX PAR", arglist, 1, ierflg);
1534 
1535  arglist[0] = 10000;
1536  arglist[1] = 1.0;
1537  lhoodFit->mnexcm("MIGRAD", arglist ,2,ierflg);
1538  lhoodFit->mnimpr();
1539 
1540  lhoodFit->mnstat(f_with_guess, junk, junk, ijunk, ijunk, ijunk);
1541 
1542  ATH_MSG_VERBOSE("nlep, n_fake_guess, n_fake_guess_lo, n_fake_guesss_hi, f_from_fit, f_with_guess: " << "?" << " " << n_fake_guess << " " << n_fake_guess_lo << " " << n_fake_guess_hi << " " << f_from_fit << " " << f_with_guess);
1543 
1544  if (TMath::IsNaN(f_with_guess)) {
1545  f_with_guess = f_from_fit + 1.;
1546  }
1547  if ((f_with_guess - f_from_fit) > 0.5) {
1548  n_fake_guess_hi = n_fake_guess;
1549  } else {
1550  n_fake_guess_lo = n_fake_guess;
1551  }
1552 
1553  n_fake_guess = 0.5*(n_fake_guess_lo+n_fake_guess_hi);
1554 
1555  ATH_MSG_VERBOSE( "n_fake_guess_lo, hi = " << n_fake_guess_hi << " " << n_fake_guess_lo);
1556  if ((n_fake_guess_hi - n_fake_guess_lo)/n_fake_guess_hi < convergeCriteria) {
1557  stopSearch = 1;
1558  ATH_MSG_VERBOSE("(n_fake_guess_lo, n_fake_fit = " << n_fake_guess_lo << " " << n_fake_fit);
1559  if (n_fake_guess_lo > n_fake_fit) {
1560  errFound = 1;
1561  }
1562 
1563  }
1564  }
1565 
1566  // reset nfakes to value found from original fit, so it's read out properly
1567  // later
1568  arglist[0] = nfake_tot_index;
1569  arglist[1] = n_fake_fit;
1570  lhoodFit->mnexcm("SET PAR", arglist, 2, ierflg);
1571 
1572  if (errFound) {
1573  return n_fake_guess - n_fake_fit;
1574  } else {
1575  ATH_MSG_VERBOSE("Setting fitStatus to 1 in fixPosErr");
1576  m_fitStatus = 1;
1577  return -1.;
1578  }
1579 }

◆ get_analytic()

void LhoodMM_tools::get_analytic ( std::vector< double > &  nrf,
const int  nlep 
)
private

Definition at line 1333 of file LhoodMM_tools.cxx.

1333  {
1334 
1335  m_perfectFit = true;
1336  ATH_MSG_VERBOSE("just getting started with nlep = " << nlep);
1337 
1338  ATH_MSG_VERBOSE("m_minnlepreg = " << m_minnlep << " m_maxnlep = " << m_maxnlep);
1339 
1340 
1341  int lepidx = nlep-1;
1342 
1343  if (m_current_fitInfo->eventCount[lepidx] == 0) return;
1344 
1345  const int rank = 0x1 << nlep;
1346 
1347  std::vector<FakeBkgTools::Efficiency> coeff_denom(rank);
1348 
1349  ATH_MSG_VERBOSE("All set! ");
1350 
1351  FakeBkgTools::FSBitset charges = m_fsvec[lepidx]->retrieveCharges(m_particles);
1352  for (int irf = 0; irf < rank; irf++) {
1353  // add up all the relevant terms in the denominator to translate the
1354  // loose sample counts to tight sample counts within the required range of
1355  // tight lepton multiplicity
1356  coeff_denom[irf].setToConst(0.);
1357  coeff_denom[0] = m_current_fitInfo->coeffs_num[lepidx][0][0]; // don't care about this one, but it can't be 0
1358  float chargefactor ;
1359  FakeBkgTools::FSBitset fakes = irf;
1360  FakeBkgTools::FSBitset reals;
1361  for (int ibit = 0; ibit < nlep; ibit++) {
1362  reals.set(ibit, ~fakes[ibit]);
1363  }
1364  for (int itl = 0; itl < rank; itl++) {
1365  chargefactor = 1.0;
1366  FakeBkgTools::FSBitset antitights = itl;
1367  FakeBkgTools::FSBitset tights = 0;
1368  for (int ibit = 0; ibit < nlep; ibit++) {
1369  tights.set(ibit, ~antitights[ibit]);
1370  }
1371  ATH_MSG_VERBOSE("tights " << tights);
1372  ATH_MSG_VERBOSE("reals " << reals);
1373  ATH_MSG_VERBOSE("charges " << charges);
1374  if (m_fsvec[lepidx]->accept_selection(tights, charges)
1375  && m_fsvec[lepidx]->accept_process(nlep, reals, tights) ) {
1376  ATH_MSG_VERBOSE("Accepted in LhoodMM_tools " << irf);
1377  ATH_MSG_VERBOSE("index is " << (itl<<nlep) + irf);
1378  ATH_MSG_VERBOSE("Adding " << m_current_fitInfo->normterms[lepidx][(itl<<nlep) + irf].value(this) << " to " << irf);
1379  // assume that dilepton fakes are evenly split between OS and SS
1380  if (nlep > 2 && tights.count() == 2) {
1381  if (m_requireOS || m_requireSS) {
1382  chargefactor = 0.5;
1383  ATH_MSG_VERBOSE("Setting SSfactor ");
1384  }
1385  }
1386  if (nlep == 2 && tights.count() == 2) {
1387  if (m_requireOS || m_requireSS) {
1388  chargefactor = m_OSfrac[2][2];
1389  }
1390  }
1391  if (m_requireOS) {
1392  chargefactor = m_OSfrac[lepidx][tights.count()];
1393  }
1394  ATH_MSG_VERBOSE("chargefactor = " << chargefactor << " for nlep = " << nlep);
1395  ATH_MSG_VERBOSE("normterm = " << m_current_fitInfo->normterms[lepidx][(itl<<nlep) + irf].value(this));
1396  FakeBkgTools::Efficiency tmpEff = m_current_fitInfo->normterms[lepidx][(itl<<nlep) + irf];
1397  tmpEff.multiply(chargefactor);
1398  ATH_MSG_VERBOSE("how much space? " << coeff_denom.size());
1399  ATH_MSG_VERBOSE("irf = " << irf);
1400  coeff_denom[irf].add(tmpEff);
1401  ATH_MSG_VERBOSE("m_normterms[" << nlep << "][" << (itl<<nlep) + irf << "]= " << m_current_fitInfo->normterms[lepidx][(itl<<nlep) + irf].value(this));
1402  ATH_MSG_VERBOSE("chargefactor = " << chargefactor);
1403  ATH_MSG_VERBOSE("coeff_denom[" << irf << "] = " << coeff_denom[irf].value(this));
1404  }
1405  }
1406 
1407  // The following are "don't care" terms, but need to have non-zero
1408  // denominators
1409  if (coeff_denom[irf].nominal == 0.) {
1410  coeff_denom[irf] = m_current_fitInfo->coeffs_num[lepidx][0][irf];
1411  }
1412 
1413  for (int itl = 0; itl < rank; itl++) {
1414  ATH_MSG_VERBOSE("coeff_denom[" << irf << "] = " << coeff_denom[irf].value(this));
1415  m_coeffs[lepidx][itl][irf] = m_current_fitInfo->coeffs_num[lepidx][itl][irf].value(this)/coeff_denom[irf].value(this);
1416  }
1417  }
1418 
1419  ATH_MSG_VERBOSE("About to do matrix stuff");
1420  std::shared_ptr<TMatrixT<double>> MMmatrix;
1421  MMmatrix = m_MMmatrix_vec[lepidx];
1422 
1423  for (int i = 0; i < rank; i++) {
1424  for (int j = 0; j < rank; j++) {
1425  ATH_MSG_VERBOSE(i << " " << j << " " << m_current_fitInfo->coeffs_num[lepidx][i][j].value(this) << " " << coeff_denom[j].value(this) << " " << m_coeffs[lepidx][i][j]);
1426  (*MMmatrix)(i,j) = m_coeffs[lepidx][i][j];
1427  }
1428  }
1429 
1430  const bool verbose = this->msgLvl(MSG::VERBOSE);
1431  ATH_MSG_VERBOSE("Printing the matrix in get_analytic ");
1432  if(verbose) MMmatrix->Print();
1433 
1434  TMatrixT<double> MMmatrix_inv(rank,rank);
1435  MMmatrix_inv = *MMmatrix;
1436  MMmatrix_inv.Invert();
1437 
1438  TMatrixT<double> MMmatrix_sqr = MMmatrix_inv;
1439  for (int i = 0; i < rank; i++) {
1440  for (int j = 0; j < rank; j++) {
1441  MMmatrix_sqr(i,j) *= MMmatrix_sqr[i][j];
1442  }
1443  }
1444 
1445  TMatrixT<double> nevents_mat(rank,1), nfake_mat(rank,1), nfake_err_mat(rank,1);
1446  for (int i = 0; i < rank; i++) {
1447  nevents_mat(i,0) = m_current_fitInfo->event_cat.at(lepidx).at(i);
1448  }
1449 
1450  ATH_MSG_VERBOSE("Printing nevents matrix");
1451  if(verbose) nevents_mat.Print();
1452 
1453  nfake_mat = MMmatrix_inv*nevents_mat;
1454 
1455  ATH_MSG_VERBOSE("MMmatrix:");
1456  if(verbose) MMmatrix->Print();
1457  ATH_MSG_VERBOSE("nevents_lll_mat:");
1458  if(verbose) nevents_mat.Print();
1459  ATH_MSG_VERBOSE("nfake_mat:");
1460  if(verbose) nfake_mat.Print();
1461 
1462 
1463  nfake_err_mat = MMmatrix_sqr*nevents_mat;
1464 
1465  int n_proc_acc = 0;
1466  for (int ipar = 0; ipar < (0x1 <<nlep) ; ipar++) {
1467  nrf[ipar] = nfake_mat(ipar, 0);
1468  if (nrf[ipar] < 0) m_perfectFit = false;
1469  ATH_MSG_VERBOSE("nrf[" << ipar << "] = " << nrf[ipar]);
1470  FakeBkgTools::FSBitset fakes = ipar;
1471  FakeBkgTools::FSBitset reals;
1472  FakeBkgTools::FSBitset tights = 0;
1473  for (int ibit = 0; ibit < nlep; ibit++) {
1474  tights.set(ibit, 1);
1475  reals.set(ibit, ~fakes[ibit]);
1476  }
1477  if (m_fsvec[lepidx]->accept_process(nlep, reals, tights) && m_fsvec[lepidx]->accept_selection(tights, charges)) {
1478  ATH_MSG_VERBOSE("Adding " << nfake_mat(ipar,0) << " to m_nfakes_std");
1479  n_proc_acc++;
1480  m_nfakes_std += nfake_mat(ipar,0);
1481  m_nfakes_std_err += nfake_err_mat(ipar, 0);
1482  }
1483  }
1484 
1485  ATH_MSG_VERBOSE("Accepted " << n_proc_acc << " processes for nlep = " << nlep);
1486  ATH_MSG_VERBOSE("m_nfakes_std = " << m_nfakes_std);
1487 
1488 }

◆ get_init_pars()

void LhoodMM_tools::get_init_pars ( std::vector< double > &  init_pars,
int  nlep 
)
private

Definition at line 1243 of file LhoodMM_tools.cxx.

1243  {
1244 
1245  ATH_MSG_VERBOSE("Setting initial parameters for nlep = " << nlep);
1246 
1247  int lepidx = nlep-1;
1248 
1249  vector<double> nrf;
1250  nrf.resize(0x1 <<nlep);
1251  get_analytic(nrf, nlep);
1252  m_real_indices[lepidx].clear();
1253  m_fake_indices[lepidx].clear();
1254 
1255  std::string txt = "Testing variable transform: Initial nrf: ";
1256  for (auto i = nrf.begin(); i != nrf.end(); ++i)
1257  txt += std::to_string(*i) + ' ';
1259 
1260  vector<double> init_angles;
1261 
1262  double nfakes_std_thisnlep = 0;
1263 
1264  ATH_MSG_VERBOSE("m_fsvec.size() = " << m_fsvec.size() );
1265  for (int ipar = 0; ipar < 0x1 <<nlep; ipar++) {
1266  ATH_MSG_VERBOSE("ipar = " << ipar );
1267  FakeBkgTools::FSBitset fakes = ipar;
1268  FakeBkgTools::FSBitset reals;
1269  for (int ibit = 0; ibit < nlep; ibit++) {
1270  reals.set(ibit, ~fakes[ibit]);
1271  }
1272  ATH_MSG_VERBOSE("reals set" );
1273  bool countsAsFake = false;
1274  for (int jpar = 0; jpar < 0x1 <<nlep; jpar++) {
1275  FakeBkgTools::FSBitset tights = jpar;
1276  for (int kpar = 0; kpar < 0x1 <<nlep; kpar++) {
1277  FakeBkgTools::FSBitset charges = kpar;
1278  if (!countsAsFake &&
1279  m_fsvec[lepidx]->accept_process(nlep, reals, tights) &&
1280  m_fsvec[lepidx]->accept_selection(tights, charges) ) {
1281  ATH_MSG_VERBOSE("accepted " << ipar);
1282  nfakes_std_thisnlep += nrf[ipar];
1283  m_fake_indices[lepidx].push_back(ipar);
1284  countsAsFake = true;
1285  break;
1286  }
1287  }
1288  }
1289  if (!countsAsFake) {
1290  ATH_MSG_VERBOSE("trying to push onto m_real_indices");
1291  ATH_MSG_VERBOSE("m_real_indices.size() = " << m_real_indices.size());
1292  m_real_indices[lepidx].push_back(ipar);
1293  }
1294  }
1295 
1296  init_pars[0] = nfakes_std_thisnlep;
1297  for (unsigned ipar = 1; ipar <= m_real_indices[lepidx].size(); ipar++) {
1298  init_pars[ipar] = nrf[m_real_indices[lepidx][ipar-1]];
1299  }
1300 
1301  if (nfakes_std_thisnlep > 0.5) {
1302  double sinterm = 1.;
1303  int ifake = 0;
1304  for (int ipar = m_real_indices[lepidx].size()+1; ipar < (0x1 << nlep); ipar++) {
1305  init_pars[ipar] = TMath::ACos(TMath::Sqrt(TMath::Max(nrf[m_fake_indices[lepidx][ifake] ], 0.)/(nfakes_std_thisnlep))/sinterm);
1306  sinterm *= TMath::Sin(init_pars[ipar]);
1307  ifake++;
1308  }
1309  } else {
1310  for (int ipar = m_real_indices[lepidx].size()+1; ipar < (0x1 << nlep); ipar++) {
1311  init_pars[ipar] = s_piover4;
1312  }
1313  }
1314 
1315  if (m_printLevel > 0) {
1316  txt = "testing variable transform: Initial pars: ";
1317  for (int i = 0; i < (0x1 << nlep); i++) {
1318  txt += std::to_string(init_pars[i]) + " ";
1319  }
1321  }
1322 
1323  // fix any nan's...
1324  for (int ipar = 2; ipar < (0x1 << nlep); ipar++) {
1325  if (TMath::IsNaN(init_pars[ipar])) {
1326  init_pars[ipar] = 0.;
1327  }
1328  ATH_MSG_VERBOSE("Setting angle parameter " << ipar << " to " << init_pars[ipar]);
1329  }
1330 }

◆ getCachedFinalState()

FinalState BaseFakeBkgTool::getCachedFinalState ( uint8_t  nparticles,
const std::string &  strPID,
const std::string &  strProc,
bool &  success 
)
protectedinherited

no longer fill cache if it becomes too large

Definition at line 219 of file BaseFakeBkgTool.cxx.

220 {
221  success = true;
222  size_t hFS = m_hasher(strProc) ^ m_hasher(strPID) ^ nparticles;
223  auto itrFS = m_cachedFinalStates.find(FinalState(hFS));
224  if(itrFS != m_cachedFinalStates.end()) return *itrFS;
225  std::string error;
226  FinalState fs(hFS, nparticles, strPID, strProc, error);
227  if(error.length())
228  {
230  success = false;
231  return FinalState(0);
232  }
233  if(m_cachedFinalStates.size() < 1024)
234  {
235  m_cachedFinalStates.emplace(fs);
236  }
237  return fs;
238 }

◆ getFitStatus()

Int_t CP::LhoodMM_tools::getFitStatus ( )
inline

Definition at line 61 of file LhoodMM_tools.h.

61 {return m_fitStatus;}

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void *  ptr) const
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.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119  {
120 
121 #ifdef XAOD_STANDALONE
122  // In case we use @c xAOD::TEvent, we have a direct function call
123  // for this.
124  return evtStore()->event()->getKey( ptr );
125 #else
126  const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127  return ( proxy == nullptr ? 0 : proxy->sgkey() );
128 #endif // XAOD_STANDALONE
129  }

◆ getListOfEfficienciesAffectedBy()

std::string BaseFakeBkgTool::getListOfEfficienciesAffectedBy ( uint16_t  uid) const
protectedinherited

Definition at line 356 of file BaseFakeBkgTool.cxx.

357 {
358  if(!m_initialized || !m_database)
359  {
360  ATH_MSG_ERROR("This function can be called only once the tool has been initialized");
361  return "";
362  }
363  std::bitset<Database::N_EFFICIENCY_TYPES> affects;
364  auto stat = m_database->findStat(uid);
365  if(stat) affects = stat->affects;
366  else
367  {
368  auto syst = m_database->findSyst(uid);
369  if(syst) affects = syst->affects;
370  else
371  {
372  ATH_MSG_ERROR("uncertainty with UID " << std::hex << uid << std::dec << " not found in database");
373  return "";
374  }
375  }
376  std::string info;
377  if(affects[Database::ELECTRON_REAL_EFFICIENCY]) info += "electron real efficiencies, ";
378  if(affects[Database::ELECTRON_FAKE_EFFICIENCY]) info += "electron fake efficiencies, ";
379  if(affects[Database::ELECTRON_FAKE_FACTOR]) info += "electron fake factors, ";
380  if(affects[Database::MUON_REAL_EFFICIENCY]) info += "muon real efficiencies, ";
381  if(affects[Database::MUON_FAKE_EFFICIENCY]) info += "muon fake efficiencies, ";
382  if(affects[Database::MUON_FAKE_FACTOR]) info += "muon fake factors, ";
383  if(affects[Database::PHOTON_ELE_FAKE_FACTOR]) info += "electron->photon fake rate, ";
384  if(affects[Database::PHOTON_ELE_FAKE_FACTOR_SF]) info += "electron->photon fake rate scale factor, ";
385  return info.substr(0, info.size()-2);
386 }

◆ getName()

const std::string & asg::AsgTool::getName ( const void *  ptr) const
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.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106  {
107 
108 #ifdef XAOD_STANDALONE
109  // In case we use @c xAOD::TEvent, we have a direct function call
110  // for this.
111  return evtStore()->event()->getName( ptr );
112 #else
113  const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114  static const std::string dummy = "";
115  return ( proxy == nullptr ? dummy : proxy->name() );
116 #endif // XAOD_STANDALONE
117  }

◆ getProperty()

template<class T >
const T* asg::AsgTool::getProperty ( const std::string &  name) const
inherited

Get one of the tool's properties.

◆ getSystDescriptor()

virtual const IFakeBkgSystDescriptor& CP::BaseFakeBkgTool::getSystDescriptor ( ) const
inlineoverridevirtualinherited

retrieves an interface to various helper methods to identify what the different SystematicVariations correspond to

Implements CP::IFakeBkgTool.

Definition at line 74 of file BaseFakeBkgTool.h.

74 {return *this; }

◆ getTotalYield()

StatusCode LhoodMM_tools::getTotalYield ( float &  yield,
float &  statErrorUp,
float &  statErrorDown 
)
finaloverridevirtual

returns the accumulated fake lepton background yield (or compute it, in the case of the likelihood matrix method), and fills the registered histograms (if any) The 'selection' and 'process' settings used for these operations can be chosen with the 'Selection' and 'Process' properties.

Only statistical uncertainties can be retrieved; use applySystematicVariation() to obtain uncertainties

Implements CP::IFakeBkgTool.

Definition at line 302 of file LhoodMM_tools.cxx.

302  {
303 
304  if (m_progressFileName != "none" && m_alreadyMerged == false) {
305  ATH_CHECK( mergeSubJobs() );
306  }
307 
308  //set output level according to debug flag, also check whether setPrintLevel was called directly
310 
311  Double_t poserr, negerr;
312 
314  yield = nfakes(&poserr,&negerr);
315 
316  ATH_MSG_DEBUG("Leaving getTotalYield with yield = " << yield);
317 
318  statErrUp = poserr;
319  statErrDown = -negerr;
320 
321  return fillHistograms();
322 }

◆ getUncertaintyDescription()

std::string BaseFakeBkgTool::getUncertaintyDescription ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

returns a human-readable description of the source of systematic uncertainty specified as argument

need to add more info (bin index, etc)

Implements CP::IFakeBkgSystDescriptor.

Definition at line 490 of file BaseFakeBkgTool.cxx.

491 {
492  if(!m_initialized || !m_database)
493  {
494  ATH_MSG_ERROR("This function can be called only once the tool has been initialized");
495  return "";
496  }
497 
498  auto UID = identifyCpSystematicVariation(systematic).first;
499  if(!UID)
500  {
501  ATH_MSG_WARNING("Systematic variation " + systematic.name() + " is not recognized by BaseFakeBkgTool");
502  return "";
503  }
504 
505  if(UID == 0)
506  {
507  return "Total statistical uncertainty in the event yield";
508  }
509  std::string info;
510  auto stat = m_database->findStat(UID);
511  if(stat)
512  {
513  info = "Statistical uncertainty affecting ";
515  }
516  else
517  {
518  auto syst = m_database->findSyst(UID);
519  if(syst)
520  {
521  info = "Systematic uncertainty \"" + syst->name + "\" affecting ";
522  }
523  else
524  {
525  ATH_MSG_ERROR("uncertainty with UID " << std::hex << UID << std::dec << " not found in database");
526  return "";
527  }
528  }
530  return info;
531 }

◆ identifyCpSystematicVariation()

std::pair< uint16_t, float > BaseFakeBkgTool::identifyCpSystematicVariation ( const CP::SystematicVariation systematic) const
privateinherited

Definition at line 388 of file BaseFakeBkgTool.cxx.

389 {
390  if(!m_initialized || !m_database)
391  {
392  ATH_MSG_ERROR("This function can be called only once the tool has been initialized, since the number of systematic variations depends on the configuration...");
393  throw std::logic_error("BaseFakeBkgTool::identifyCpSystematicVariation() called before initialization");
394  }
395  std::smatch smr;
396  auto bn = systematic.basename();
397  if(!std::regex_match(bn, smr, std::regex("FAKEBKG_(STAT|SYST)_VAR(\\d+)"))) return {{0}, 0.f};
398  unsigned index = std::stol(smr[2].str());
399  float sigma = systematic.parameter();
400  if(smr[1].str() == "SYST") return {m_database->systIndexToUID(index), sigma};
401  else return {m_database->statIndexToUID(index), sigma};
402 }

◆ importEfficiencies()

bool BaseFakeBkgTool::importEfficiencies ( bool  resetDB = false)
privateinherited

load the config file(s) storing efficiencies

XML parsing error

ROOT histograms importing error, or unknown error

Definition at line 109 of file BaseFakeBkgTool.cxx.

110 {
111  if(resetDB) m_database->reset();
112  std::string filename;
113  try
114  {
115  for(const auto& fn : m_inputFiles)
116  {
117  filename = fn;
118  auto pos = filename.rfind(".xml");
119  if(pos == filename.length()-4)
120  {
121  m_database->importXML(filename);
122  continue;
123  }
124  pos = filename.rfind(".root");
125  if(pos == filename.length()-5)
126  {
127  m_database->importDefaultROOT(fn);
128  continue;
129  }
130  ATH_MSG_ERROR("File extension not supported for " << filename);
131  return false;
132  }
133  }
134  catch(const Database::XmlError& err)
135  {
136  unsigned line1 = m_database->getXmlLineNumber(err.location.ptr);
137  unsigned line2 = m_database->getXmlLineNumber(err.location.endptr);
138  ATH_MSG_INFO("Exception caught while reading file " << filename << ", details follow");
139  std::string fullmsg = "(while parsing XML, line";
140  if(line2 != line1) fullmsg += "s " + std::to_string(line1) + " - " + std::to_string(line2);
141  else fullmsg += " " + std::to_string(line1);
142  fullmsg += "): " + err.reason;
143  ATH_MSG_ERROR(fullmsg);
144  return false;
145  }
146  catch(const Database::GenericError& err)
147  {
148  ATH_MSG_INFO("Exception caught while reading file " << filename << ", details follow");
149  ATH_MSG_ERROR(err.reason);
150  return false;
151  }
152  return m_database->ready();
153 }

◆ incrementMatrices()

StatusCode LhoodMM_tools::incrementMatrices ( const LhoodMMEvent mmevt)
private

Definition at line 324 of file LhoodMM_tools.cxx.

324  {
325 
326  int nlep = mmevt.nlep();
327  //increment global matrix
328  if (m_needToResize) {
330  }
331 
333 
334  // increment matrix terms for all registered histograms
335  // if size needs to increase, this must be done for all bins...
336 
337  for (auto map1_iter = m_values_1dhisto_map.begin(); map1_iter != m_values_1dhisto_map.end(); map1_iter++) {
338  const float* val = map1_iter->second;
339  TH1* h = map1_iter->first;
340  auto histoMap = m_fitInfo_1dhisto_map.find(map1_iter->first);
341  if (histoMap != m_fitInfo_1dhisto_map.end() ) {
342  int icell;
343  LhoodMMFitInfo *fitInfo;
344  if (m_needToResize) {
345  for (icell = 0; icell<h->GetNcells(); icell++) {
346  fitInfo = &histoMap->second[icell];
347  fitInfo->resizeVectors(nlep);
348  }
349  }
350  icell = h->FindBin(*val);
351  ATH_MSG_VERBOSE("fitInfo vector size is " << histoMap->second.size());
352  fitInfo = &histoMap->second[icell];
353  ATH_MSG_VERBOSE("icell is " << icell);
354  ATH_MSG_VERBOSE("fitInfo totEvents is " << fitInfo->totEvents);
355  ATH_MSG_VERBOSE("need to resize? " << m_needToResize);
356  ANA_CHECK(incrementOneMatrixSet(*fitInfo, mmevt));
357  ATH_MSG_VERBOSE("need to resize now? " << m_needToResize);
358  } else {
359  ATH_MSG_ERROR("Can not find entry for 1d histogram");
360  return StatusCode::FAILURE;
361  }
362  }
363 
364  std::map<TH2*, std::pair<const float*, const float*> >::iterator map2_iter;
365  for (map2_iter = m_values_2dhisto_map.begin(); map2_iter != m_values_2dhisto_map.end(); ++map2_iter) {
366  std::pair<const float*, const float*> val = map2_iter->second;
367  TH2* h = map2_iter->first;
368 
369  auto histoMap = m_fitInfo_2dhisto_map.find(map2_iter->first);
370  if (histoMap != m_fitInfo_2dhisto_map.end() ) {
371  int icell;
372  LhoodMMFitInfo *fitInfo;
373  if (m_needToResize) {
374  for (icell = 0; icell<h->GetNcells(); icell++) {
375  fitInfo = &histoMap->second[icell];
376  fitInfo->resizeVectors(nlep);
377  }
378  }
379  icell = h->FindBin(*(val.first), *(val.second));
380  fitInfo = &histoMap->second[icell];
381  ANA_CHECK(incrementOneMatrixSet(*fitInfo, mmevt));
382  } else {
383  ATH_MSG_ERROR("Can not find entry for 2d histogram");
384  return StatusCode::FAILURE;
385  }
386 
387  }
388 
389  std::map<TH3*, std::tuple<const float*, const float*, const float*> >::iterator map3_iter;
390  for (map3_iter = m_values_3dhisto_map.begin(); map3_iter != m_values_3dhisto_map.end(); ++map3_iter) {
391  std::tuple<const float*, const float*, const float*> val = map3_iter->second;
392  TH3* h = map3_iter->first;
393  auto histoMap = m_fitInfo_3dhisto_map.find(map3_iter->first);
394  if (histoMap != m_fitInfo_3dhisto_map.end() ) {
395  int icell;
396  LhoodMMFitInfo *fitInfo;
397  if (m_needToResize) {
398  for (icell = 0; icell<h->GetNcells(); icell++) {
399  fitInfo = &histoMap->second[icell];
400  fitInfo->resizeVectors(nlep);
401  }
402  }
403  icell = h->FindBin(*(std::get<0>(val)), *(std::get<1>(val)), *(std::get<2>(val)) );
404  fitInfo = &histoMap->second[icell];
405  ANA_CHECK(incrementOneMatrixSet(*fitInfo, mmevt));
406  } else {
407  ATH_MSG_ERROR("Can not find entry for 3d histogram");
408  return StatusCode::FAILURE;
409  }
410  }
411 
412  return StatusCode::SUCCESS;
413 }

◆ incrementOneMatrixSet()

StatusCode LhoodMM_tools::incrementOneMatrixSet ( LhoodMMFitInfo fitInfo,
const LhoodMMEvent mmevt 
)
private

Definition at line 415 of file LhoodMM_tools.cxx.

416  {
417 
418  int nlep = mmevt.nlep();
419  int lepidx = nlep-1;
420  int rank = 0x1 << nlep;
421 
422  fitInfo.totEvents++;
423  fitInfo.eventCount[lepidx]++;
424 
425 
426  if (nlep <= s_nLepMax) {
427  ATH_MSG_VERBOSE("In incrementMatrices, how many uncertainties? " << mmevt.realEffObj(0).uncertainties.size());
428  ATH_MSG_VERBOSE("In incrementMatrices, m_totEvents = " << fitInfo.totEvents);
429 
430  unsigned int catIndex = 0;
431  for (int jlep = 0; jlep < nlep; jlep++) {
432  catIndex += (!mmevt.isTight(jlep)) << jlep;
433  }
434  double weight = mmevt.weight();
435 
436  ATH_MSG_VERBOSE("event_cat.size() = " << fitInfo.event_cat.size());
437  ATH_MSG_VERBOSE("event_sumw2.size() = " << fitInfo.event_sumw2.size());
438 
439  ATH_MSG_VERBOSE("nlep= " << nlep);
440  ATH_MSG_VERBOSE("catIndex= " << catIndex);
441  ATH_MSG_VERBOSE("fitInfo.event_cat.at(nlep-1).size() = " << fitInfo.event_cat.at(lepidx).size());
442 
443  fitInfo.event_cat[lepidx][catIndex] +=weight;
444  fitInfo.event_sumw2[lepidx][catIndex]+=weight*weight;
445 
446  ATH_MSG_VERBOSE("Done updating event_cat and event_sumw2");
447 
448  //check to see if there is at least one OS pair...
449  for (int icomb = 0; icomb < (0x1 << nlep); icomb++) {
450  int totcharge = 0;
451  std::bitset<s_nLepMax+1> tights(icomb);
452  int ntight = tights.count();
453 
454  for (int jlep = 0; jlep < nlep; jlep++) {
455  if (tights[jlep]) {
456  totcharge += mmevt.charge(jlep);
457  }
458  }
459 
460  ATH_MSG_VERBOSE("Setting OSfrac_denom[" << lepidx << "][" << ntight << "]");
461  ATH_MSG_VERBOSE("size is " << fitInfo.OSfrac_denom.size() );
462  ATH_MSG_VERBOSE("size is " << fitInfo.OSfrac_denom[lepidx].size() );
463  ATH_MSG_VERBOSE("weight is " << weight );
464  fitInfo.OSfrac_denom[lepidx][ntight]+=weight;
465  ATH_MSG_VERBOSE("Setting OSfrac_num[" << lepidx << "][" << ntight << "]");
466  if ((TMath::Abs(totcharge) < ntight) || ntight == 1) fitInfo.OSfrac_num[lepidx][ntight]+=weight;
467  }
468 
469 
470  std::vector<std::vector<FakeBkgTools::Efficiency>> vals(2, std::vector<FakeBkgTools::Efficiency>(nlep));
471  for (int ilep = 0; ilep < nlep; ilep++) {
472  ATH_MSG_VERBOSE("1 vals[0].size() = " << vals[0].size());
473  ATH_MSG_VERBOSE("getting efficiency values for lepton " << ilep);
474  ATH_MSG_VERBOSE("how many leptons are there? " << mmevt.nlep());
475  ATH_MSG_VERBOSE("nlep-ilep-1 = " << nlep-ilep-1);
476  ATH_MSG_VERBOSE("2 vals[0].size() = " << vals[0].size());
477  ATH_MSG_VERBOSE("vals[1].size() = " << vals[1].size());
478  vals[0][ilep] = mmevt.realEffObj(ilep);
479  if (m_doFakeFactor) {
480  vals[0][ilep].setToConst(1.0);
481  }
482  vals[1][ilep] = mmevt.fakeEffObj(ilep);
483  ATH_MSG_VERBOSE("Real and fake efficiencies for lepton " << ilep << ": " << vals[0][nlep-ilep-1].value(this) << " " << vals[1][nlep-ilep-1].value(this));
484  ATH_MSG_VERBOSE("this is surely harmless");
485  ATH_MSG_VERBOSE("3 vals[0].size() = " << vals[0].size());
486  }
487 
488  FakeBkgTools::Efficiency curr_coeff_num;
489  ATH_MSG_VERBOSE("how many uncertainties in curr_coeff_num? " << curr_coeff_num.uncertainties.size());
490  for (int irf = 0; irf < rank; irf++) {
491  for (int itl = 0; itl < rank; itl++) {
492  curr_coeff_num.setToConst(1.);
493  for (int ilep = 0; ilep < nlep; ilep++) {
494  if (itl & (0x1 << ilep) ) {
495  if (irf & (0x1 << ilep)) {
496  FakeBkgTools::Efficiency tmpEff = vals[1][ilep];
497  curr_coeff_num.multiply(tmpEff.subFromOne());
498  } else {
499  FakeBkgTools::Efficiency tmpEff = vals[0][ilep];
500  curr_coeff_num.multiply(tmpEff.subFromOne());
501  }
502  } else {
503  if (irf & (0x1 << ilep) ) {
504  curr_coeff_num.multiply(vals[1][ilep]);
505  } else {
506  curr_coeff_num.multiply(vals[0][ilep]);
507  }
508  }
509  }
510  ATH_MSG_VERBOSE("about to set m_coeffs_num[" << lepidx << "][" << itl << "][" << irf << "]");
511  ATH_MSG_VERBOSE("setting normterm " << (itl<<nlep) + irf);
512  fitInfo.normterms[lepidx][(itl<<nlep) + irf].add(curr_coeff_num);
513  fitInfo.coeffs_num[lepidx][itl][irf].add(curr_coeff_num);
514  ATH_MSG_VERBOSE("how many uncertainties in coeffs_num? " << fitInfo.coeffs_num[lepidx][itl][irf].uncertainties.size());
515  ATH_MSG_VERBOSE("done setting normterm ");
516  }
517  }
518  return StatusCode::SUCCESS;
519  } else {
520  ATH_MSG_ERROR( "Error: can only handle " << s_nLepMax << " leptons; you tried " << nlep);
521  return StatusCode::FAILURE;
522  }
523 
524 }

◆ initialize()

StatusCode LhoodMM_tools::initialize ( )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from CP::BaseFakeBkgTool.

Definition at line 68 of file LhoodMM_tools.cxx.

69 {
71 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
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.

◆ isAffectedBySystematic()

bool BaseFakeBkgTool::isAffectedBySystematic ( const CP::SystematicVariation systematic) const
overridevirtualinherited

Declare the interface that this class provides.

returns: whether this tool is affected by the given systematics

Implements CP::ISystematicsTool.

Definition at line 404 of file BaseFakeBkgTool.cxx.

405 {
406  return identifyCpSystematicVariation(systematic).first;
407 }

◆ isStatisticalUncertainty()

bool BaseFakeBkgTool::isStatisticalUncertainty ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty originates from a statistical uncertainty in the efficiencies (as opposed to systematic)

Implements CP::IFakeBkgSystDescriptor.

Definition at line 540 of file BaseFakeBkgTool.cxx.

541 {
542  uint16_t UID = identifyCpSystematicVariation(systematic).first;
543  if(UID) return Database::isStatUID(UID);
544  return false;
545 }

◆ isSystematicUncertainty()

bool BaseFakeBkgTool::isSystematicUncertainty ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

checks whether the specified source of uncertainty originates from a systematic uncertainty in the efficiencies (as opposed to statistical)

Implements CP::IFakeBkgSystDescriptor.

Definition at line 533 of file BaseFakeBkgTool.cxx.

534 {
535  uint16_t UID = identifyCpSystematicVariation(systematic).first;
536  if(UID) return Database::isSystUID(UID);
537  return false;
538 }

◆ logPoisson()

double LhoodMM_tools::logPoisson ( double  obs,
double  pred 
)
staticprivate

Definition at line 544 of file LhoodMM_tools.cxx.

544  {
545 
546  double f = -(obs*TMath::Log(pred)-pred);
547  if (obs > 0) f += obs*TMath::Log(obs)-obs;
548  return f;
549 }

◆ mapLhood()

void CP::LhoodMM_tools::mapLhood ( TMinuit_LHMM lhoodFit,
int  nlep,
double  min,
double  max 
)
private

◆ mergeSubJobs()

StatusCode LhoodMM_tools::mergeSubJobs ( )

Definition at line 1700 of file LhoodMM_tools.cxx.

1700  {
1701 
1702  ATH_MSG_VERBOSE("Merging sub jobs");
1703 
1704  m_alreadyMerged = true;
1706  std::unique_ptr<TFile> fin( new TFile(filename.c_str()));
1707  if (fin == nullptr) {
1708  ATH_MSG_ERROR("Unable to open merged input file " << filename );
1709  return StatusCode::FAILURE;
1710  }
1711  if(m_progressFileDirectory.length()) {
1712  if(!fin->cd(m_progressFileDirectory.c_str())) {
1713  ATH_MSG_ERROR("Unable to find the directory " << m_progressFileDirectory << " inside the file " << filename);
1714  return StatusCode::FAILURE;
1715  }
1716  }
1717 
1718  std::string prefix = (m_progressFileDirectory.length()? "/" + m_progressFileDirectory + "/" : "");
1719 
1720  TTree *t_nlep = (TTree*)fin->Get((prefix + "LhoodMM_progress_nlep").c_str());
1721  if (t_nlep == nullptr) {
1722  ATH_MSG_ERROR("Unable to find LhoodMM_progress_nlep tree in " << filename);
1723  return StatusCode::FAILURE;
1724  }
1725 
1726  int merged_maxnlep, merged_maxnlep_prev = -1;
1727  t_nlep->SetBranchAddress("maxnlep", &merged_maxnlep);
1728 
1729  TTree *t = (TTree*)fin->Get((prefix + "LhoodMM_progress").c_str());
1730  if (t == nullptr) {
1731  ATH_MSG_ERROR("Unable to find LhoodMM_progress tree in " << filename);
1732  return StatusCode::FAILURE;
1733  }
1734 
1735  // check that we are not trying to merge subjobs with inconsistent lepton
1736  // multiplicities
1737  Int_t nentries = (Int_t)t_nlep->GetEntries();
1738  for (Int_t ievt = 0; ievt < nentries; ievt++) {
1739  t_nlep->GetEntry(ievt);
1740  if (ievt > 0 && (merged_maxnlep != merged_maxnlep_prev)) {
1741  ATH_MSG_ERROR("Attempting to merge files with different lepton multiplicities. This is not supported.");
1742  return StatusCode::FAILURE;
1743  }
1744  merged_maxnlep_prev = merged_maxnlep;
1745  }
1746 
1747  m_maxnlep_loose = merged_maxnlep;
1748 
1749  std::unique_ptr<LhoodMMFitInfo> tmpFitInfo(new LhoodMMFitInfo);
1750 
1751  tmpFitInfo->resizeVectors(m_maxnlep_loose);
1753 
1754  LhoodMMFitInfo* fitInfoPtr = tmpFitInfo.get();
1755  t->SetBranchAddress("glb_fitInfo", &fitInfoPtr );
1756 
1757  ATH_MSG_VERBOSE("About to add LhoodMMFitInfos");
1758 
1759  // prepare to merge any histograms
1760 
1761  std::unique_ptr<std::map<TH1*, std::vector< LhoodMMFitInfo > > > tmp_fitInfo_1dhisto_map(new std::map<TH1*, std::vector< LhoodMMFitInfo > >);
1762  auto *tmp_fitInfo_1dhisto_map_ptr = tmp_fitInfo_1dhisto_map.get();
1763  t->SetBranchAddress("fitInfo_1dhisto_map", &tmp_fitInfo_1dhisto_map_ptr);
1764  std::unique_ptr<std::map<TH2*, std::vector< LhoodMMFitInfo > > > tmp_fitInfo_2dhisto_map(new std::map<TH2*, std::vector< LhoodMMFitInfo > >);
1765  auto *tmp_fitInfo_2dhisto_map_ptr = tmp_fitInfo_2dhisto_map.get();
1766  t->SetBranchAddress("fitInfo_2dhisto_map", &tmp_fitInfo_2dhisto_map_ptr);
1767  std::map<TH3*, std::vector< LhoodMMFitInfo > > *tmp_fitInfo_3dhisto_map = new std::map<TH3*, std::vector< LhoodMMFitInfo > >;
1768  t->SetBranchAddress("fitInfo_3dhisto_map", &tmp_fitInfo_3dhisto_map);
1769 
1770  nentries = (Int_t)t->GetEntries();
1771  for (Int_t ievt = 0; ievt < nentries; ievt++) {
1772  t->GetEntry(ievt);
1773  ATH_MSG_VERBOSE("Adding LhoodMMFitInto with " << (*tmpFitInfo).totEvents << " events, with m_maxnlep_loose = " << m_maxnlep_loose );
1774  m_global_fitInfo.add(*tmpFitInfo, m_maxnlep_loose);
1775  for (auto& hm : m_fitInfo_1dhisto_map) {
1776  TH1F* histogram = (TH1F*)hm.first;
1777  std::string hname = histogram->GetName();
1778  for (auto& im: *tmp_fitInfo_1dhisto_map) {
1779  ATH_MSG_VERBOSE("Found a matching histogram");
1780  TH1F* ihistogram = (TH1F*)im.first;
1781  std::string iname = ihistogram->GetName();
1782  if (hname == iname) {
1783  int ncells = histogram->GetNcells();
1784  for (int icell = 0; icell<ncells; icell++) {
1785  hm.second[icell].resizeVectors(m_maxnlep_loose);
1786  hm.second[icell].add(im.second[icell], m_maxnlep_loose);
1787  }
1788  }
1789  }
1790  }
1791  for (auto& hm : m_fitInfo_2dhisto_map) {
1792  TH1F* histogram = (TH1F*)hm.first;
1793  std::string hname = histogram->GetName();
1794  for (auto& im: *tmp_fitInfo_2dhisto_map) {
1795  ATH_MSG_VERBOSE("Found a matching histogram");
1796  TH1F* ihistogram = (TH1F*)im.first;
1797  std::string iname = ihistogram->GetName();
1798  if (hname == iname) {
1799  int ncells = histogram->GetNcells();
1800  for (int icell = 0; icell<ncells; icell++) {
1801  hm.second[icell].resizeVectors(m_maxnlep_loose);
1802  hm.second[icell].add(im.second[icell], m_maxnlep_loose);
1803  }
1804  }
1805  }
1806  }
1807  for(auto& hm : m_fitInfo_3dhisto_map){
1808  TH1F* histogram = (TH1F*)hm.first;
1809  std::string hname = histogram->GetName();
1810  for (auto& im: *tmp_fitInfo_3dhisto_map){
1811  ATH_MSG_VERBOSE("Found a matching histogram");
1812  TH1F* ihistogram = (TH1F*)im.first;
1813  std::string iname = ihistogram->GetName();
1814  if (hname == iname) {
1815  int ncells = histogram->GetNcells();
1816  for (int icell = 0; icell<ncells; icell++) {
1817  hm.second[icell].resizeVectors(m_maxnlep_loose);
1818  hm.second[icell].add(im.second[icell], m_maxnlep_loose);
1819  }
1820  }
1821  }
1822  }
1823 
1824  ATH_MSG_VERBOSE("Added " << ievt);
1825 
1826  }
1827 
1828 
1829  ATH_MSG_VERBOSE("Merged totEvents is " << m_global_fitInfo.totEvents);
1830  for (int ilep = 0; ilep < m_maxnlep_loose; ilep++) {
1831  ATH_MSG_VERBOSE("Merged event count is " << m_global_fitInfo.eventCount[ilep]);
1832  }
1833 
1834  return StatusCode::SUCCESS;
1835 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
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:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101  {
102 
103  return MSG::name( msg().level() );
104  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ nfakes()

double LhoodMM_tools::nfakes ( Double_t *  poserr,
Double_t *  negerr 
)

Definition at line 746 of file LhoodMM_tools.cxx.

746  {
747 
748  if (m_current_fitInfo->totEvents == 0) {
749  *poserr = 0.;
750  *negerr = 0.;
751  return 0.;
752  }
753 
754  m_fitStatus = 0;
755 
757  m_maxnlep = 0;
758 
759  m_requireSS = false;
760  m_requireOS = false;
761 
762  for (int ilep = 0; ilep < s_nLepMax; ilep++) {
763  string error;
764  // possible issue here -- reassigning vector elements?
765  m_fsvec[ilep].reset(new FakeBkgTools::FinalState(0, ilep+1, m_selection, m_process, error));
766  if (error.size() > 0) {
767  ATH_MSG_VERBOSE("Unable to parse selection " << m_selection << " with process " << m_process << " with " << ilep+1 << " leptons. Error is " << error);
768  continue; // unable to parse selection
769  }
770  if (m_fsvec[ilep]->hasSS() ) {
771  m_requireSS = true;
772  }
773  if (m_fsvec[ilep]->hasOS() ) {
774  m_requireOS = true;
775  }
776  m_fsvec[ilep]->setSS(false);
777  m_fsvec[ilep]->setOS(false);
778 
779  // charges will only give the charges of the leptons in the most recently
780  // added event. That's why the tricks with the hasSS, hasOS, setSS, and
781  // setOS functions are played above (so we don't actually have to care
782  // about the values here)
783  auto charges = m_fsvec[ilep]->retrieveCharges(m_particles);
784 
785  for (int icomb = 0; icomb < (0x1 << (ilep+1)); icomb++) {
786  FakeBkgTools::FSBitset tights(icomb);
787  ATH_MSG_VERBOSE("ilep " << ilep << " (0x1 << ilep) " << std::hex << (0x1 << ilep) << " icomb " << std::hex << icomb << std::dec);
788  ATH_MSG_VERBOSE("tights = " << std::hex << tights << std::dec);
789  ATH_MSG_VERBOSE("charges = " << std::hex << charges << std::dec);
790 
791  if (m_fsvec[ilep]->accept_selection(tights, charges)) {
792  int nlep = ilep+1;
793  ATH_MSG_VERBOSE("tights = " << std::hex << tights << std::dec << " nlep = " << nlep);
794  if (nlep > m_maxnlep) m_maxnlep = nlep;
795  if (nlep < m_minnlep) m_minnlep = nlep;
796  }
797  }
798 
799  }
800 
801  //protect against selection strings that don't explicitly require at least
802  //one lepton
803  if (m_minnlep < 1) m_minnlep = 1;
804 
805  ATH_MSG_VERBOSE("m_minnlep, m_maxnlep = " << m_minnlep << " " << m_maxnlep);
806  int minNlep_proc = m_maxnlep;
807  int maxNlep_proc = 0;
808  for (int n=m_minnlep;n<=m_maxnlep;++n) {
809  for(unsigned c=0;c<(1u<<n);++c) // loop on all possible n-particles tight/loose combinations; there are 2^n of them
810  {
811  FakeBkgTools::FSBitset fakes = c;
812  FakeBkgTools::FSBitset reals = 0;
813  FakeBkgTools::FSBitset tights = 0;
814  for (int ibit = 0; ibit < n; ibit++) {
815  reals.set(ibit, ~fakes[ibit]);
816  tights.set(ibit, 1);
817  }
818  if (m_fsvec[n-1]->accept_process(n, reals, tights) ) {
819  if(n < minNlep_proc) minNlep_proc = n; // minNlep set to "number of tight leptons in the combination with the least number fo tight leptons"
820  if (n > maxNlep_proc) {
821  maxNlep_proc = n;
822  }
823  ATH_MSG_VERBOSE("maxNlep_proc = "<< maxNlep_proc);
824  break;
825  }
826  }
827  }
828 
829  m_minnlep = minNlep_proc;
830  m_maxnlep = maxNlep_proc;
831 
832  if(setup() != StatusCode::SUCCESS) return 0.;
833 
834  if (m_maxnlep > m_maxnlep_loose) {
836  }
837 
838  if (m_maxnlep_loose < m_minnlep) {
839  ATH_MSG_WARNING("Selection requires more leptons than are in any event in the sample; returning nfakes = 0 +/- 0 " << m_maxnlep_loose);
840  *poserr = 0.;
841  *negerr = 0.;
842  return 0.;
843  }
844 
845  ATH_MSG_VERBOSE("In nfakes, m_minnlep, m_maxnlep, m_maxnlep_loose = " << m_minnlep << " " << m_maxnlep << " " << m_maxnlep_loose);
846 
847  double nfake_fit, nfake_fitErr;
848 
849  int npar = 0;
850  for (int ilep = m_minnlep; ilep <= m_maxnlep_loose; ilep++) {
851  npar += 0x1 << ilep;
852  }
853 
854  ATH_MSG_VERBOSE("In nfakes, npar = " << npar);
855 
856  std::unique_ptr<TMinuit_LHMM> lhoodFit(new TMinuit_LHMM(npar));
857  lhoodFit->SetPrintLevel(m_printLevel);
858  lhoodFit->SetFCN(fcn_minnlep_maxnlep);
859 
860 
861  Double_t arglist[10];
862  Int_t ierflg = 0;
863 
864  arglist[0] = 0.5;
865  lhoodFit->mnexcm("SET ERR", arglist ,1,ierflg);;
866 
867  m_nfakes_std = 0;
868  m_nfakes_std_err = 0;
869 
870  ATH_MSG_VERBOSE("About to initialize parameters");
871 
872  vector<double> init_pars;
873  init_pars.resize(npar);
874  int index = 0;
875  vector< vector <double> > loc_init_pars;
876  loc_init_pars.resize(m_maxnlep_loose);
877 
878  for (int ilep = m_minnlep; ilep <=m_maxnlep_loose; ilep++) {
879  loc_init_pars[ilep-1].resize(0x1 << ilep);
880  get_init_pars(loc_init_pars[ilep-1], ilep);
881  for (int ipar = 0; ipar < (0x1 << ilep); ipar++) {
882  init_pars[index+ipar] = loc_init_pars[ilep-1][ipar];
883  }
884  index+= 0x1 << ilep;
885  }
886 
887  Double_t step = TMath::Max(loc_init_pars[m_minnlep-1][0]/1000,0.001);
888  ATH_MSG_VERBOSE("parameters initialized OK");
889  ATH_MSG_VERBOSE("m_nfakes_std_err = " << m_nfakes_std_err);
890 
891  m_nfakes_std_err = TMath::Sqrt(m_nfakes_std_err);
892 
893  vector<TString> parameterName;
894  vector<int> nreal_start_indices;
895  nreal_start_indices.resize(m_maxnlep_loose);
896  parameterName.push_back("nfake_tot");
897  TString sreal = "nreal";
898  for (int ilep = m_minnlep; ilep<= m_maxnlep_loose; ilep++) {
899  char tmpchar[20];
900  sprintf(tmpchar, "_%i", ilep);
901  TString tmpstr = sreal;
902  tmpstr.Append(tmpchar);
903  for (unsigned isublep = 0; isublep < m_real_indices[ilep-1].size(); isublep++) {
904  TString locsreal = tmpstr;
905  char tmpchar2[20];
906  sprintf(tmpchar2, "_%u", isublep);
907  locsreal.Append(tmpchar2);
908  parameterName.push_back(locsreal);
909  if (isublep == 0) {
910  nreal_start_indices[ilep-1] = (parameterName.size());
911  ATH_MSG_VERBOSE("nreal_start_indices[" << ilep-1 << "] = " << nreal_start_indices[ilep-1]);
912  }
913  }
914  }
915 
916  TString stheta_tot = "theta_tot";
917  for (int ilep = m_minnlep; ilep<m_maxnlep_loose; ilep++) {
918  char tmpchar[20];
919  sprintf(tmpchar, "_%i", ilep-m_minnlep);
920  TString tmpstr = stheta_tot;
921  tmpstr.Append(tmpchar);
922  parameterName.push_back(tmpstr);
923  }
924 
925  for (int ilep = m_minnlep; ilep <= m_maxnlep_loose; ilep++) {
926  TString stheta = "theta_";
927  char tmpchar[20];
928  sprintf(tmpchar, "%i", ilep);
929  TString tmpstr = stheta;
930  tmpstr.Append(tmpchar);
931  tmpstr.Append("_");
932  ATH_MSG_VERBOSE("How many fake indices?" << m_fake_indices[ilep-1].size());
933  for(int jlep = 0; jlep < (int)m_fake_indices[ilep-1].size() - 1; jlep++) {
934  TString locstheta = tmpstr;
935  char tmpchar2[20];
936  sprintf(tmpchar2, "%i", jlep);
937  locstheta.Append(tmpchar2);
938  parameterName.push_back(locstheta);
939  }
940 
941  }
942 
943  vector<double> theta_tot;
944  ATH_MSG_VERBOSE("m_maxnlep_loose = " << m_maxnlep_loose << " m_minnlep = " << m_minnlep);
945  theta_tot.resize(m_maxnlep_loose-m_minnlep);
946  ATH_MSG_VERBOSE("theta_tot.size() = " << theta_tot.size());
947  ATH_MSG_VERBOSE("m_nfakes_std = " << m_nfakes_std);
948  if (m_nfakes_std > 0.) {
949  double sinterm = 1.;
950  int theta_index = 0;
951  for (int ilep = m_minnlep; ilep < m_maxnlep_loose; ilep++ ){
952  ATH_MSG_VERBOSE("nfakes for nlep = " << ilep << " used to find theta_tot = " << loc_init_pars[ilep-1][0]);
953  theta_tot[theta_index] = TMath::ACos(TMath::Sqrt(TMath::Max(loc_init_pars[ilep-1][0],0.)/(m_nfakes_std))/sinterm);
954  if (TMath::IsNaN( theta_tot[theta_index] ) ) {
955  theta_tot[theta_index] = s_piover4;
956  }
957  sinterm *= TMath::Sin(theta_tot[theta_index]);
958  theta_index++;
959  }
960  } else {
961  int theta_index = 0;
962  for (int ilep = m_minnlep; ilep < m_maxnlep_loose; ilep++ ){
963  theta_tot[theta_index] = s_piover4;
964  theta_index++;
965  }
966  }
967 
968  ATH_MSG_VERBOSE("About to set upper limits");
969  vector<double> upper_limits;
970  upper_limits.resize(npar);
971 
972  upper_limits[0] = TMath::Max(5.*m_maxWeight*m_current_fitInfo->totEvents, 0.01);
973 
974  int real_index = 1;
975  for (int ilep = m_minnlep; ilep <= m_maxnlep_loose; ilep++) {
976  for (unsigned isublep = 0; isublep < m_real_indices[ilep-1].size(); isublep++) {
977  upper_limits[real_index] = 5*m_maxWeight*m_current_fitInfo->eventCount[ilep-1];
978  real_index++;
979  }
980  }
981 
982  for (int ipar = real_index; ipar < npar; ipar++) {
983  upper_limits[ipar] = s_piover2;
984  }
985 
986  //re-organize from "per-lepton" parameters to global parameters
987  vector<double> init_par_values;
988  init_par_values.resize(npar);
989  ATH_MSG_VERBOSE("Setting parameter 0 to " << TMath::Max(m_nfakes_std,0.5));
990  init_par_values[0] = TMath::Max(m_nfakes_std,0.);
991  int init_index = 1;
992  int glob_index = 1;
993  for (int ilep= m_minnlep; ilep <= m_maxnlep_loose; ilep++) {
994  for (unsigned isublep = 0; isublep < m_real_indices[ilep-1].size(); isublep++) {
995  ATH_MSG_VERBOSE("Setting parameter " << glob_index << " to " << init_pars[init_index+isublep]);
996  init_par_values[glob_index] = init_pars[init_index+isublep];
997  glob_index++;
998  }
999  init_index+= pow(2,ilep);
1000  }
1001 
1003  for (int ilep = m_minnlep; ilep <= m_maxnlep_loose; ilep++) {
1004  m_theta_tot_start_index += m_real_indices[ilep-1].size();
1005  }
1006  vector<int> theta_start_indices;
1007  theta_start_indices.resize(m_maxnlep_loose);
1008  theta_start_indices[m_minnlep-1] = m_theta_tot_start_index+m_maxnlep_loose - m_minnlep;
1009  for (int i = m_minnlep; i < m_maxnlep_loose; i++) {
1010  theta_start_indices[i] = theta_start_indices[i-1] + m_fake_indices[i-1].size() - 1;
1011  }
1012 
1013  for (int ilep= m_minnlep; ilep < m_maxnlep_loose; ilep++) {
1014  ATH_MSG_VERBOSE("Setting parameter " << m_theta_tot_start_index+ilep-m_minnlep << " to " << theta_tot[ilep-m_minnlep]);
1015  init_par_values[m_theta_tot_start_index+ilep-m_minnlep] = theta_tot[ilep-m_minnlep];
1016  }
1017 
1018  ATH_MSG_VERBOSE( "all done!");
1019 
1021  index = 1;
1022  for (int ilep= m_minnlep; ilep <= m_maxnlep_loose; ilep++) {
1023  for (int ipar = 0; ipar < (int)m_fake_indices[ilep-1].size() - 1; ipar++) {
1024  ATH_MSG_VERBOSE("Setting parameter " << currpar << " to " << init_pars[index+m_real_indices[ilep-1].size()+ipar]);
1025  init_par_values[currpar] = init_pars[index+m_real_indices[ilep-1].size()+ipar];
1026  currpar++;
1027  }
1028  index+= 0x1 << ilep;
1029  }
1030  int ipar;
1031  for (ipar = 0; ipar < npar; ipar++) {
1032  lhoodFit->mnparm(ipar, parameterName[ipar], init_par_values[ipar], step, 0., upper_limits[ipar], ierflg);
1033  }
1034 
1035  ATH_MSG_VERBOSE("About to fix some parameters");
1036  ATH_MSG_VERBOSE("m_minnlep = " << m_minnlep);
1037  ATH_MSG_VERBOSE("m_maxnlep_loose = " << m_maxnlep_loose);
1038  // account for case where there may be no leptons of a given multiplicity
1039  // (or no fake leptons allowed by the process string) by
1040  // fixing the parameters that are relevant to that multiplicity.
1041  // Also check that at least one lepton multiplicity is valid
1042 
1043  int nGoodLeptonMult = 0;
1044 
1045  for (int ilep = m_minnlep; ilep <= m_maxnlep_loose; ilep++) {
1046  if (m_current_fitInfo->eventCount[ilep-1] == 0 ||
1047  m_fake_indices[ilep-1].size() == 0) {
1048  // start with the nreal parameters
1049  for (unsigned ipar = nreal_start_indices[ilep-1]; ipar < nreal_start_indices[ilep-1] + m_real_indices[ilep-1].size(); ipar++) {
1050  arglist[0] = ipar;
1051  arglist[1] = 0.;
1052  lhoodFit->mnexcm("SET PAR", arglist, 2, ierflg);
1053  lhoodFit->mnexcm("FIX PAR", arglist, 1, ierflg);
1054  }
1055  //now the theta_tot angle associated with this multiplicity
1056  arglist[0] = m_theta_tot_start_index + ilep - m_minnlep +1;
1057  arglist[1] = s_piover2;
1058  lhoodFit->mnexcm("SET PAR", arglist, 2, ierflg);
1059  lhoodFit->mnexcm("FIX PAR", arglist, 1, ierflg);
1060 
1061  //now all the angle parameters for this lepton multiplicity
1062  for (unsigned ipar = theta_start_indices[ilep-1]+1; ipar < theta_start_indices[ilep-1] + m_fake_indices[ilep-1].size() ; ipar++) {
1063  arglist[0] = ipar;
1064  arglist[1] = 0.;
1065  lhoodFit->mnexcm("SET PAR", arglist, 2, ierflg);
1066  lhoodFit->mnexcm("FIX PAR", arglist, 1, ierflg);
1067  }
1068  } else {
1069  nGoodLeptonMult++;
1070  }
1071  index += (0x1 << ilep) - 2;
1072  }
1073 
1074  if (nGoodLeptonMult == 0) {
1075  ATH_MSG_VERBOSE("No possible fake contribution for any lepton multiplicity");
1076  *poserr = 0;
1077  *negerr = 0;
1078  return 0;
1079  }
1080 
1081  arglist[0] = 5000;
1082  arglist[1] = 1.0;
1083  lhoodFit->mnexcm("MIGRAD", arglist ,2,ierflg);
1084  ATH_MSG_VERBOSE("ierflg = " << ierflg);
1085  lhoodFit->mnimpr();
1086 
1087  Double_t amin, edm, errdef;
1088  Int_t nvpar, nparx, icstat;
1089  lhoodFit->mnstat(amin,edm,errdef,nvpar,nparx,icstat);
1090 
1091  lhoodFit->GetParameter(0, nfake_fit, nfake_fitErr);
1092 
1093  Double_t gcc;
1094 
1095  if (poserr && negerr) {
1096  arglist[0] = 500;
1097  arglist[1] = 1.0;
1098  lhoodFit->mnexcm("MINOS", arglist ,2,ierflg);
1099  lhoodFit->mnerrs(0, *poserr, *negerr, nfake_fitErr, gcc);
1100 
1101  // re-retrieve fit values, since MINOS might have found a new minimum
1102  lhoodFit->mnstat(amin,edm,errdef,nvpar,nparx,icstat);
1103  lhoodFit->GetParameter(0, nfake_fit, nfake_fitErr);
1104 
1105  // check that MINOS succeeded. If not, fix it...
1106 
1107  if ( *poserr < 1.e-5) {
1108  *poserr = fixPosErr(nfake_fit, lhoodFit.get());
1109  }
1110  if (*negerr > -1.e-5 ) {
1111  *negerr = fixNegErr(nfake_fit, lhoodFit.get());
1112  }
1113  //resort to parabolic errors if all else fails
1114  if (*negerr > -1.e-5) {
1115  *negerr = -nfake_fitErr;
1116  // prevent negative error from extending below 0
1117  if (nfake_fit + *negerr < 0.) {
1118  *negerr = -nfake_fit;
1119  }
1120  }
1121 
1122  if (*poserr < 1.e-5) {
1123  *poserr = nfake_fitErr;
1124  }
1125 
1126  }
1127 
1128  return nfake_fit;
1129 
1130 }

◆ nfakes_std()

double LhoodMM_tools::nfakes_std ( double *  error)

Definition at line 1231 of file LhoodMM_tools.cxx.

1231  {
1232 
1234  return m_nfakes_std;
1235 }

◆ nfakes_std_perEventWeight()

double LhoodMM_tools::nfakes_std_perEventWeight ( double *  error)

Definition at line 1237 of file LhoodMM_tools.cxx.

1237  {
1238 
1241 }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
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.

◆ perfectFit()

bool CP::LhoodMM_tools::perfectFit ( )
inline

Definition at line 71 of file LhoodMM_tools.h.

71 { return m_perfectFit;}

◆ print() [1/2]

void asg::AsgTool::print ( ) const
virtualinherited

◆ print() [2/2]

virtual void asg::IAsgTool::print ( ) const
pure virtualinherited

◆ printUncertaintyDescription()

void BaseFakeBkgTool::printUncertaintyDescription ( const CP::SystematicVariation systematic) const
finaloverridevirtualinherited

prints a human-readable description of the source of systematic uncertainty specified as argument

Implements CP::IFakeBkgSystDescriptor.

Definition at line 484 of file BaseFakeBkgTool.cxx.

485 {
486  auto info = getUncertaintyDescription(systematic);
487  if(info.length()) ATH_MSG_INFO(info);
488 }

◆ recommendedSystematics()

CP::SystematicSet BaseFakeBkgTool::recommendedSystematics ( ) const
overridevirtualinherited

the list of all systematics this tool recommends to use

Implements CP::IReentrantSystematicsTool.

Definition at line 431 of file BaseFakeBkgTool.cxx.

432 {
433  return affectingSystematics();
434 }

◆ register1DHistogram()

StatusCode LhoodMM_tools::register1DHistogram ( TH1 h1,
const float *  val 
)
overridevirtual

associates a 1D histogram to the tool, to obtain a binned estimate of the fake lepton background the 'val' argument points to a variable corresponding to the X axis of the histogram and that needs to be updated before each call to addEvent() undefined behaviour if the pointers are invalidated during the tool's lifetime

Reimplemented from CP::BaseFakeBkgTool.

Definition at line 159 of file LhoodMM_tools.cxx.

159  {
160 
162 
163  if(sc != StatusCode::SUCCESS) return sc;
164 
165 
166  auto currentMap = m_fitInfo_1dhisto_map.find(h1);
167  if (currentMap == m_fitInfo_1dhisto_map.end() ) {
169  // size all the vectors appropriately
170  int ncells = h1->GetNcells();
171  auto *fitinfovec = &m_fitInfo_1dhisto_map.find(h1)->second;
172  fitinfovec->resize(ncells);
173  ATH_MSG_VERBOSE("Just resized fitinfovec");
174  for (int icell = 0; icell < ncells; icell++) {
175  LhoodMMFitInfo* fitInfo = &(fitinfovec->at(icell));
176  fitInfo->reset();
177  }
178 
179  ATH_MSG_INFO("Registered a 1D histogram "<<h1->GetName());
180  } else {
181  ATH_MSG_ERROR("Error in LhoodMM_tools::register1DHistogram: histogram has already been registered");
182  return StatusCode::FAILURE;
183  }
184  return StatusCode::SUCCESS;
185 }

◆ register2DHistogram()

StatusCode LhoodMM_tools::register2DHistogram ( TH2 h2,
const float *  xval,
const float *  yval 
)
overridevirtual

associates a 2D histogram to the tool, to obtain a binned estimate of the fake lepton background the 'xval' / 'yval' arguments point to variables corresponding to the X/Y axis of the histogram and that need to be updated before each call to addEvent() undefined behaviour if the pointers are invalidated during the tool's lifetime

Reimplemented from CP::BaseFakeBkgTool.

Definition at line 187 of file LhoodMM_tools.cxx.

187  {
188 
190 
191  if(sc != StatusCode::SUCCESS) return sc;
192 
193  auto currentMap = m_fitInfo_2dhisto_map.find(h2);
194  if (currentMap == m_fitInfo_2dhisto_map.end() ) {
196  // size all the vectors appropriately
197  int ncells = h2->GetNcells();
198  auto *fitinfovec = &m_fitInfo_2dhisto_map.find(h2)->second;
199  fitinfovec->resize(ncells);
200  for (int icell = 0; icell < ncells; icell++) {
201  LhoodMMFitInfo* fitInfo = &(fitinfovec->at(icell));
202  fitInfo->reset();
203  }
204  ATH_MSG_INFO("Registered a 2D histogram "<<h2->GetName());
205  } else {
206  ATH_MSG_ERROR("Error in LhoodMM_tools::register2DHistogram: histogram has already been registered");
207  return StatusCode::FAILURE;
208  }
209  return StatusCode::SUCCESS;
210 }

◆ register3DHistogram()

StatusCode LhoodMM_tools::register3DHistogram ( TH3 h3,
const float *  xval,
const float *  yval,
const float *  zval 
)
overridevirtual

associates a 3D histogram to the tool, to obtain a binned estimate of the fake lepton background

the 'xval' / 'yval' / 'zval' arguments point to variables corresponding to the X/Y/Z axis of the histogram and that need to be updated before each call to addEvent() undefined behaviour if the pointers are invalidated during the tool's lifetime

Reimplemented from CP::BaseFakeBkgTool.

Definition at line 212 of file LhoodMM_tools.cxx.

212  {
213 
215 
216  if(sc != StatusCode::SUCCESS) return sc;
217 
218  auto currentMap = m_fitInfo_3dhisto_map.find(h3);
219  if (currentMap == m_fitInfo_3dhisto_map.end() ) {
221  // size all the vectors appropriately
222  int ncells = h3->GetNcells();
223  auto *fitinfovec = &m_fitInfo_3dhisto_map.find(h3)->second;
224  fitinfovec->resize(ncells);
225  for (int icell = 0; icell < ncells; icell++) {
226  LhoodMMFitInfo* fitInfo = &(fitinfovec->at(icell));
227  fitInfo->reset();
228  }
229  ATH_MSG_INFO("Registered a 3D histogram "<<h3->GetName());
230  } else {
231  ATH_MSG_ERROR("Error in LhoodMM_tools::register3DHistogram: histogram has already been registered");
232  return StatusCode::FAILURE;
233  }
234  return StatusCode::SUCCESS;
235 }

◆ renounce()

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> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ reset()

void LhoodMM_tools::reset ( )
protectedvirtual

Definition at line 73 of file LhoodMM_tools.cxx.

73  {
74 
76 
77  m_prevSave = false;
78 
79  m_nfakes_std = 1.;
80  m_nfakes_std_err = 1.;
81 
82  m_maxWeight = 1.;
83 
84  m_printLevel = -1;
85 
87 
89 
90  m_fixNormalization = false;
91 
92  m_coeffs.clear();
93  m_coeffs.resize(s_nLepMax);
94 
95  for (int ilep = 0; ilep < s_nLepMax; ilep++) {
96  m_coeffs[ilep].clear();
97  m_coeffs[ilep].resize((0x1 << (ilep+1)) );
98  for (int ientry = 0; ientry < (0x1 << (ilep+1)); ientry++) {
99  m_coeffs[ilep][ientry].resize((0x1 << (ilep+1)) );
100  for (int jentry = 0; jentry < (0x1 << (ilep+1)); jentry++) {
101  m_coeffs[ilep][ientry][jentry] =0.;
102  }
103  }
104  }
105 
106  m_real_indices.clear();
107  m_real_indices.resize(s_nLepMax);
108  m_fake_indices.clear();
109  m_fake_indices.resize(s_nLepMax);
110 
111  m_maxnlep_loose = 0;
112 
113  m_requireSS = false;
114  m_requireOS = false;
115 
116  m_fsvec.clear();
117  m_fsvec.resize(s_nLepMax);
118 
119  m_OSfrac.clear();
120  m_OSfrac.resize(s_nLepMax);
121 
122  for (int ilep = 0; ilep <s_nLepMax; ilep++) {
123  m_OSfrac[ilep].resize(ilep);
124  }
125 
126  m_doFakeFactor = false;
127 
128  m_nrf_mat_vec.clear();
129  m_MMmatrix_vec.clear();
130  m_nrf_mat_vec.resize(s_nLepMax);
131  m_MMmatrix_vec.resize(s_nLepMax);
132  m_ntlpred_vec.clear();
133  m_ntlpred_vec.resize(s_nLepMax);
134  for (int ilep = 0; ilep < s_nLepMax; ilep++) {
135  m_nrf_mat_vec[ilep] = std::shared_ptr<TMatrixT<double>>(std::make_shared<TMatrixT<double>>(0x1 << (ilep+1),1) );
136  m_MMmatrix_vec[ilep] = std::shared_ptr<TMatrixT<double>>(std::make_shared<TMatrixT<double>> ((0x1 << (ilep+1)),(0x1 << (ilep+1))));
137  m_ntlpred_vec[ilep] = std::shared_ptr<TMatrixT<double>>(std::make_shared< TMatrixT<double>>(0x1 << (ilep+1),1));
138  }
139 
140  m_lastSaveIndex = 0;
141 
142  m_alreadyMerged = false;
143 
144 }

◆ saveProgress()

StatusCode LhoodMM_tools::saveProgress ( TDirectory *  dir)
overridevirtual

Implements CP::IFakeBkgTool.

Definition at line 1667 of file LhoodMM_tools.cxx.

1667  {
1668 
1669  ATH_MSG_VERBOSE("Saving progress");
1670 
1671  if (m_prevSave) {
1672  ATH_MSG_ERROR("Multiple calls to saveProgress are not supported");
1673  return StatusCode::FAILURE;
1674  }
1675 
1676  m_prevSave = true;
1677 
1678  std::unique_ptr<TTree> t(new TTree("LhoodMM_progress", "Stores current info from LhoodMM_toos"));
1679 
1680  std::unique_ptr<TTree> t_nlep(new TTree("LhoodMM_progress_nlep", "Stores minimum and maximum lepton multiplicities"));
1681 
1682  auto fitInfoBranch = t->Branch("glb_fitInfo", &m_global_fitInfo);
1683  ATH_MSG_VERBOSE("Branch split level is " << fitInfoBranch->GetSplitLevel() );
1684  t->Branch("fitInfo_1dhisto_map", &m_fitInfo_1dhisto_map);
1685  t->Branch("fitInfo_2dhisto_map", &m_fitInfo_2dhisto_map);
1686  t->Branch("fitInfo_3dhisto_map", &m_fitInfo_3dhisto_map);
1687 
1688  t_nlep->Branch("maxnlep", &m_maxnlep_loose);
1689 
1690  ATH_MSG_VERBOSE("Filling tree...");
1691  t->Fill();
1692  t_nlep->Fill();
1693  dir->cd();
1694  t->Write();
1695  t_nlep->Write();
1696 
1697  return StatusCode::SUCCESS;
1698 }

◆ set_do_std_perEventWeight()

void CP::LhoodMM_tools::set_do_std_perEventWeight ( bool  val)
inline

Definition at line 65 of file LhoodMM_tools.h.

◆ setFitType()

StatusCode LhoodMM_tools::setFitType ( const std::string &  ft)

Definition at line 146 of file LhoodMM_tools.cxx.

146  {
147  if (ft == "FF") {
148  m_doFakeFactor = true;
149  return StatusCode::SUCCESS;
150  } else if (ft == "MM") {
151  m_doFakeFactor = false;
152  return StatusCode::SUCCESS;
153  } else {
154  ATH_MSG_ERROR("Error in LhoodMM_tools::setFitType: please specify \"MM\" for matrix method or \"FF\" for fake factor method");
155  return StatusCode::FAILURE;
156  }
157 }

◆ setPrintLevel()

void CP::LhoodMM_tools::setPrintLevel ( Int_t  printLevel)
inline

Definition at line 63 of file LhoodMM_tools.h.

63 { m_printLevel = printLevel;}

◆ setup()

StatusCode LhoodMM_tools::setup ( )
private

Definition at line 526 of file LhoodMM_tools.cxx.

526  {
527 
528  m_current_lhoodMM_tool = this;
529 
530  for (int ilep = 0; ilep < m_maxnlep_loose; ilep++) {
531  for (int jlep = 0; jlep < ilep; jlep++) {
532  if (m_current_fitInfo->OSfrac_denom[ilep][jlep] > 0) {
533  m_OSfrac[ilep][jlep] = m_current_fitInfo->OSfrac_num[ilep][jlep]/m_current_fitInfo->OSfrac_denom[ilep][jlep];
534  } else {
535  m_OSfrac[ilep][jlep] = 1.;
536  }
537  }
538  }
539 
540  return StatusCode::SUCCESS;
541 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
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 DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_alreadyMerged

bool CP::LhoodMM_tools::m_alreadyMerged
private

Definition at line 106 of file LhoodMM_tools.h.

◆ m_cachedFinalStates

std::set<FakeBkgTools::FinalState> CP::BaseFakeBkgTool::m_cachedFinalStates
protectedinherited

Definition at line 99 of file BaseFakeBkgTool.h.

◆ m_coeffs

std::vector< std::vector < std::vector < double > > > CP::LhoodMM_tools::m_coeffs
private

Definition at line 112 of file LhoodMM_tools.h.

◆ m_convertWhenMissing

bool CP::BaseFakeBkgTool::m_convertWhenMissing = false
protectedinherited

Definition at line 80 of file BaseFakeBkgTool.h.

◆ m_curr_nlep

int CP::LhoodMM_tools::m_curr_nlep
private

Definition at line 92 of file LhoodMM_tools.h.

◆ m_current_fitInfo

const LhoodMMFitInfo* CP::LhoodMM_tools::m_current_fitInfo
private

Definition at line 85 of file LhoodMM_tools.h.

◆ m_current_lhoodMM_tool

LhoodMM_tools * LhoodMM_tools::m_current_lhoodMM_tool
staticprivate

Definition at line 79 of file LhoodMM_tools.h.

◆ m_database

std::unique_ptr<FakeBkgTools::Database> CP::BaseFakeBkgTool::m_database
protectedinherited

Definition at line 91 of file BaseFakeBkgTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_dilep_SSfrac_denom

double CP::LhoodMM_tools::m_dilep_SSfrac_denom
private

Definition at line 118 of file LhoodMM_tools.h.

◆ m_dilep_SSfrac_num

double CP::LhoodMM_tools::m_dilep_SSfrac_num
private

Definition at line 118 of file LhoodMM_tools.h.

◆ m_do_std_perEventWeight

bool CP::LhoodMM_tools::m_do_std_perEventWeight
private

Definition at line 125 of file LhoodMM_tools.h.

◆ m_doFakeFactor

bool CP::LhoodMM_tools::m_doFakeFactor
private

Definition at line 100 of file LhoodMM_tools.h.

◆ m_energyUnit

std::string CP::BaseFakeBkgTool::m_energyUnit
protectedinherited

property EnergyUnit user can choose between MeV or GeV to indicate the unit of the pT parametrization of efficiencies in the input files

Definition at line 122 of file BaseFakeBkgTool.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_externalWeight

float CP::BaseFakeBkgTool::m_externalWeight
protectedinherited

Definition at line 95 of file BaseFakeBkgTool.h.

◆ m_fake_indices

std::vector<std::vector<int> > CP::LhoodMM_tools::m_fake_indices
private

Definition at line 95 of file LhoodMM_tools.h.

◆ m_fitInfo_1dhisto_map

std::map<TH1*, std::vector< LhoodMMFitInfo > > CP::LhoodMM_tools::m_fitInfo_1dhisto_map
private

Definition at line 114 of file LhoodMM_tools.h.

◆ m_fitInfo_2dhisto_map

std::map<TH2*, std::vector< LhoodMMFitInfo > > CP::LhoodMM_tools::m_fitInfo_2dhisto_map
private

Definition at line 115 of file LhoodMM_tools.h.

◆ m_fitInfo_3dhisto_map

std::map<TH3*, std::vector< LhoodMMFitInfo > > CP::LhoodMM_tools::m_fitInfo_3dhisto_map
private

Definition at line 116 of file LhoodMM_tools.h.

◆ m_fitStatus

Int_t CP::LhoodMM_tools::m_fitStatus
private

Definition at line 127 of file LhoodMM_tools.h.

◆ m_fixNormalization

bool CP::LhoodMM_tools::m_fixNormalization
private

Definition at line 102 of file LhoodMM_tools.h.

◆ m_fsvec

std::vector<std::unique_ptr<FakeBkgTools::FinalState> > CP::LhoodMM_tools::m_fsvec
private

Definition at line 88 of file LhoodMM_tools.h.

◆ m_global_fitInfo

LhoodMMFitInfo CP::LhoodMM_tools::m_global_fitInfo
private

Definition at line 81 of file LhoodMM_tools.h.

◆ m_hasher

std::hash<std::string> CP::BaseFakeBkgTool::m_hasher
protectedinherited

comes from Event passed to addEvent()

Definition at line 97 of file BaseFakeBkgTool.h.

◆ m_initialized

bool CP::BaseFakeBkgTool::m_initialized = false
protectedinherited

Definition at line 78 of file BaseFakeBkgTool.h.

◆ m_inputFiles

std::vector<std::string> CP::BaseFakeBkgTool::m_inputFiles
protectedinherited

property InputFiles

Definition at line 127 of file BaseFakeBkgTool.h.

◆ m_lastSaveIndex

unsigned CP::LhoodMM_tools::m_lastSaveIndex
private

Definition at line 135 of file LhoodMM_tools.h.

◆ m_lockedSystematicVariations

bool CP::BaseFakeBkgTool::m_lockedSystematicVariations = false
protectedinherited

when m_unlimitedSystematicVariations=false, keeps track of prior calls to applySystematicVariation() / addEvent()

Definition at line 173 of file BaseFakeBkgTool.h.

◆ m_maxnlep

int CP::LhoodMM_tools::m_maxnlep
private

Definition at line 93 of file LhoodMM_tools.h.

◆ m_maxnlep_loose

int CP::LhoodMM_tools::m_maxnlep_loose
private

Definition at line 93 of file LhoodMM_tools.h.

◆ m_maxWeight

float CP::LhoodMM_tools::m_maxWeight
private

Definition at line 104 of file LhoodMM_tools.h.

◆ m_minnlep

int CP::LhoodMM_tools::m_minnlep
private

Definition at line 93 of file LhoodMM_tools.h.

◆ m_MMmatrix_vec

std::vector<std::shared_ptr<TMatrixT<double> > > CP::LhoodMM_tools::m_MMmatrix_vec
private

Definition at line 132 of file LhoodMM_tools.h.

◆ m_needEventInfo

bool CP::BaseFakeBkgTool::m_needEventInfo = true
protectedinherited

Definition at line 79 of file BaseFakeBkgTool.h.

◆ m_needToResize

bool CP::LhoodMM_tools::m_needToResize
private

Definition at line 98 of file LhoodMM_tools.h.

◆ m_nfakes_std

double CP::LhoodMM_tools::m_nfakes_std
private

Definition at line 121 of file LhoodMM_tools.h.

◆ m_nfakes_std_err

double CP::LhoodMM_tools::m_nfakes_std_err
private

Definition at line 121 of file LhoodMM_tools.h.

◆ m_nfakes_std_err_perEventWeight

double CP::LhoodMM_tools::m_nfakes_std_err_perEventWeight
private

Definition at line 123 of file LhoodMM_tools.h.

◆ m_nfakes_std_perEventWeight

double CP::LhoodMM_tools::m_nfakes_std_perEventWeight
private

Definition at line 123 of file LhoodMM_tools.h.

◆ m_nrf_mat_vec

std::vector<std::shared_ptr<TMatrixT<double> > > CP::LhoodMM_tools::m_nrf_mat_vec
private

Definition at line 131 of file LhoodMM_tools.h.

◆ m_ntlpred_vec

std::vector<std::shared_ptr<TMatrixT<double> > > CP::LhoodMM_tools::m_ntlpred_vec
private

Definition at line 133 of file LhoodMM_tools.h.

◆ m_OSfrac

std::vector< std::vector < double > > CP::LhoodMM_tools::m_OSfrac
private

Definition at line 119 of file LhoodMM_tools.h.

◆ m_particles

std::vector<FakeBkgTools::ParticleData> CP::BaseFakeBkgTool::m_particles
protectedinherited

Definition at line 85 of file BaseFakeBkgTool.h.

◆ m_perfectFit

bool CP::LhoodMM_tools::m_perfectFit
private

Definition at line 83 of file LhoodMM_tools.h.

◆ m_prevSave

bool CP::LhoodMM_tools::m_prevSave
private

Definition at line 82 of file LhoodMM_tools.h.

◆ m_printLevel

Int_t CP::LhoodMM_tools::m_printLevel
private

Definition at line 129 of file LhoodMM_tools.h.

◆ m_process

std::string CP::BaseFakeBkgTool::m_process = defaultProcess()
protectedinherited

'process' settings used to compute the total yield / fill histograms

Definition at line 118 of file BaseFakeBkgTool.h.

◆ m_progressFileDirectory

std::string CP::BaseFakeBkgTool::m_progressFileDirectory
protectedinherited

property ProgressFileDirectory

Definition at line 139 of file BaseFakeBkgTool.h.

◆ m_progressFileName

std::string CP::BaseFakeBkgTool::m_progressFileName
protectedinherited

property ProgressFileName

Definition at line 136 of file BaseFakeBkgTool.h.

◆ m_real_indices

std::vector<std::vector<int> > CP::LhoodMM_tools::m_real_indices
private

Definition at line 95 of file LhoodMM_tools.h.

◆ m_requireOS

bool CP::LhoodMM_tools::m_requireOS
private

Definition at line 96 of file LhoodMM_tools.h.

◆ m_requireSS

bool CP::LhoodMM_tools::m_requireSS
private

Definition at line 96 of file LhoodMM_tools.h.

◆ m_selectedUncertainties

UncertaintyList* CP::BaseFakeBkgTool::m_selectedUncertainties = nullptr
protectedinherited

Pointer to a value of the 'm_systSetDict' map it must be invalidated each time the map is updated in principle only applySystematicVariation() needs to do that.


Definition at line 161 of file BaseFakeBkgTool.h.

◆ m_selection

std::string CP::BaseFakeBkgTool::m_selection = defaultSelection()
protectedinherited

'selection' settings used to compute the total yield / fill histograms

Definition at line 115 of file BaseFakeBkgTool.h.

◆ m_systSetDict

std::unordered_map<CP::SystematicSet, UncertaintyList> CP::BaseFakeBkgTool::m_systSetDict
protectedinherited

List of uncertainties in internal format, associated with a particular SystematicSet the m_selectedUncertainties pointer must be invalidated each time this map is updated in principle only applySystematicVariation() needs to do that.


Definition at line 166 of file BaseFakeBkgTool.h.

◆ m_theta_tot_start_index

int CP::LhoodMM_tools::m_theta_tot_start_index
private

Definition at line 94 of file LhoodMM_tools.h.

◆ m_tightAccessor

CP::ISelectionReadAccessor* CP::BaseFakeBkgTool::m_tightAccessor = nullptr
protectedinherited

this can't be a unique_ptr as this can cause issues with the dictionary in some particular circumstances

Definition at line 133 of file BaseFakeBkgTool.h.

◆ m_tightDecoNameAndType

std::string CP::BaseFakeBkgTool::m_tightDecoNameAndType
protectedinherited

property TightDecoration

Definition at line 130 of file BaseFakeBkgTool.h.

◆ m_unlimitedSystematicVariations

bool CP::BaseFakeBkgTool::m_unlimitedSystematicVariations = true
protectedinherited

used to prevent multiple calls to applySystematicVariation() when unsupported set to true in a particular tool's constructor to disable the possibility of calling applySystematicVariation() more than once / after the first call to addEvent()

Definition at line 170 of file BaseFakeBkgTool.h.

◆ m_useDB

bool CP::BaseFakeBkgTool::m_useDB = true
protectedinherited

Definition at line 124 of file BaseFakeBkgTool.h.

◆ m_values_1dhisto_map

std::map<TH1*, const float*> CP::BaseFakeBkgTool::m_values_1dhisto_map
protectedinherited

Definition at line 108 of file BaseFakeBkgTool.h.

◆ m_values_2dhisto_map

std::map<TH2*, std::pair<const float*, const float*> > CP::BaseFakeBkgTool::m_values_2dhisto_map
protectedinherited

Definition at line 109 of file BaseFakeBkgTool.h.

◆ m_values_3dhisto_map

std::map<TH3*, std::tuple<const float*, const float*, const float*> > CP::BaseFakeBkgTool::m_values_3dhisto_map
protectedinherited

Definition at line 110 of file BaseFakeBkgTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ s_maxRank

const int CP::LhoodMM_tools::s_maxRank = 64
inlinestaticprivate

Definition at line 109 of file LhoodMM_tools.h.

◆ s_nLepMax

const int CP::LhoodMM_tools::s_nLepMax = 6
inlinestaticprivate

Definition at line 108 of file LhoodMM_tools.h.

◆ s_piover2

const double CP::LhoodMM_tools::s_piover2 = 1.57079632679489661923
inlinestaticprivate

Definition at line 138 of file LhoodMM_tools.h.

◆ s_piover4

const double CP::LhoodMM_tools::s_piover4 = 0.785398163397448309616
inlinestaticprivate

Definition at line 139 of file LhoodMM_tools.h.


The documentation for this class was generated from the following files:
grepfile.info
info
Definition: grepfile.py:38
CP::LhoodMM_tools::m_nfakes_std_err_perEventWeight
double m_nfakes_std_err_perEventWeight
Definition: LhoodMM_tools.h:123
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CP::BaseFakeBkgTool::register1DHistogram
virtual StatusCode register1DHistogram(TH1 *h1, const float *val) override
associates a 1D histogram to the tool, to obtain a binned estimate of the fake lepton background the ...
Definition: BaseFakeBkgTool.cxx:240
CP::LhoodMM_tools::s_piover4
static const double s_piover4
Definition: LhoodMM_tools.h:139
CP::LhoodMMFitInfo::totEvents
int totEvents
Definition: LhoodMMFitInfo.h:23
python.changerun.bn
bn
Definition: changerun.py:79
CP::BaseFakeBkgTool::getUncertaintyDescription
virtual std::string getUncertaintyDescription(const CP::SystematicVariation &systematic) const override final
returns a human-readable description of the source of systematic uncertainty specified as argument
Definition: BaseFakeBkgTool.cxx:490
CP::LhoodMM_tools::m_perfectFit
bool m_perfectFit
Definition: LhoodMM_tools.h:83
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
CP::LhoodMMFitInfo::OSfrac_denom
std::vector< std::vector< double > > OSfrac_denom
Definition: LhoodMMFitInfo.h:22
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
CP::LhoodMM_tools::fcn_minnlep_maxnlep
static void fcn_minnlep_maxnlep(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
Definition: LhoodMM_tools.cxx:557
CP::LhoodMM_tools::fillHistograms
StatusCode fillHistograms()
Definition: LhoodMM_tools.cxx:1132
PlotCalibFromCool.ft
ft
Definition: PlotCalibFromCool.py:329
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
CP::LhoodMM_tools::addEventCustom
virtual StatusCode addEventCustom() override
Definition: LhoodMM_tools.cxx:262
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
WriteCellNoiseToCool.icell
icell
Definition: WriteCellNoiseToCool.py:339
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CP::BaseFakeBkgTool::m_inputFiles
std::vector< std::string > m_inputFiles
property InputFiles
Definition: BaseFakeBkgTool.h:127
CP::SystematicVariation::basename
std::string basename() const
description: the base name, i.e.
Definition: SystematicVariation.cxx:312
CP::BaseFakeBkgTool::m_useDB
bool m_useDB
Definition: BaseFakeBkgTool.h:124
FakeBkgTools::Efficiency::multiply
Efficiency & multiply(const Efficiency &rhs, float weight=1.f)
the first version of multiply() takes the product of two Efficiencies, setting the up and down variat...
Definition: FakeBkgInternals.h:222
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CP::LhoodMM_tools::m_real_indices
std::vector< std::vector< int > > m_real_indices
Definition: LhoodMM_tools.h:95
FakeBkgTools::Efficiency
a structure to hold an efficiency together with a variable number of uncertainties
Definition: FakeBkgInternals.h:40
CP::LhoodMM_tools::m_needToResize
bool m_needToResize
Definition: LhoodMM_tools.h:98
CP::BaseFakeBkgTool::identifyCpSystematicVariation
std::pair< uint16_t, float > identifyCpSystematicVariation(const CP::SystematicVariation &systematic) const
Definition: BaseFakeBkgTool.cxx:388
dqt_zlumi_pandas.hname
string hname
Definition: dqt_zlumi_pandas.py:272
CP::SystematicSet::size
size_t size() const
returns: size of the set
Definition: SystematicSet.h:71
LArG4FSStartPointFilterLegacy.line1
line1
Definition: LArG4FSStartPointFilterLegacy.py:58
index
Definition: index.py:1
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
hist_file_dump.d
d
Definition: hist_file_dump.py:137
FakeBkgTools::Database::GenericError
This propagates an error message.
Definition: Database.h:136
CP::LhoodMM_tools::fixNegErr
double fixNegErr(double n_fake_fit, TMinuit_LHMM *lhoodFit)
Definition: LhoodMM_tools.cxx:1581
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
CP::LhoodMM_tools::logPoisson
static double logPoisson(double obs, double pred)
Definition: LhoodMM_tools.cxx:544
CP::SystematicVariation::name
const std::string & name() const
description: the full systematics name, for use in strings, etc.
Definition: SystematicVariation.cxx:303
CP::BaseFakeBkgTool::m_lockedSystematicVariations
bool m_lockedSystematicVariations
when m_unlimitedSystematicVariations=false, keeps track of prior calls to applySystematicVariation() ...
Definition: BaseFakeBkgTool.h:173
CP::LhoodMMFitInfo::add
void add(LhoodMMFitInfo &rhs, int nLepMax)
Definition: LhoodMMFitInfo.cxx:35
CP::LhoodMM_tools::m_alreadyMerged
bool m_alreadyMerged
Definition: LhoodMM_tools.h:106
CP::LhoodMM_tools::m_nrf_mat_vec
std::vector< std::shared_ptr< TMatrixT< double > > > m_nrf_mat_vec
Definition: LhoodMM_tools.h:131
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
python.atlas_oh.im
im
Definition: atlas_oh.py:167
CP::BaseFakeBkgTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: BaseFakeBkgTool.cxx:63
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
LhoodMMEvent::isTight
bool isTight(unsigned ilep) const
Definition: LhoodMMEvent.cxx:101
athena.value
value
Definition: athena.py:122
python.sizes.txt
string txt
Definition: sizes.py:141
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
FakeBkgTools::ParticleData
Definition: FakeBkgInternals.h:85
CP::BaseFakeBkgTool::m_database
std::unique_ptr< FakeBkgTools::Database > m_database
Definition: BaseFakeBkgTool.h:91
CP::LhoodMM_tools::m_fsvec
std::vector< std::unique_ptr< FakeBkgTools::FinalState > > m_fsvec
Definition: LhoodMM_tools.h:88
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
CP::LhoodMM_tools::m_ntlpred_vec
std::vector< std::shared_ptr< TMatrixT< double > > > m_ntlpred_vec
Definition: LhoodMM_tools.h:133
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
CP::SystematicVariation
Definition: SystematicVariation.h:47
CP::LhoodMMFitInfo::resizeVectors
void resizeVectors(unsigned nlep)
Definition: LhoodMMFitInfo.cxx:73
PlotPulseshapeFromCool.np
np
Definition: PlotPulseshapeFromCool.py:64
FakeBkgTools::Client::MATRIX_METHOD
@ MATRIX_METHOD
read_hist_ntuple.h1
h1
Definition: read_hist_ntuple.py:21
x
#define x
CP::LhoodMM_tools::m_requireSS
bool m_requireSS
Definition: LhoodMM_tools.h:96
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
CP::LhoodMM_tools::nfakes
double nfakes(Double_t *poserr, Double_t *negerr)
Definition: LhoodMM_tools.cxx:746
CP::BaseFakeBkgTool::BaseFakeBkgTool
BaseFakeBkgTool(const std::string &toolname)
Definition: BaseFakeBkgTool.cxx:29
CP::LhoodMM_tools::m_requireOS
bool m_requireOS
Definition: LhoodMM_tools.h:96
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
CP::LhoodMM_tools::m_fitInfo_1dhisto_map
std::map< TH1 *, std::vector< LhoodMMFitInfo > > m_fitInfo_1dhisto_map
Definition: LhoodMM_tools.h:114
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
PrepareReferenceFile.regex
regex
Definition: PrepareReferenceFile.py:43
CP::LhoodMMFitInfo::eventCount
std::vector< double > eventCount
Definition: LhoodMMFitInfo.h:24
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
CP::BaseFakeBkgTool::register3DHistogram
virtual StatusCode register3DHistogram(TH3 *h3, const float *xval, const float *yval, const float *zval) override
associates a 3D histogram to the tool, to obtain a binned estimate of the fake lepton background
Definition: BaseFakeBkgTool.cxx:300
ASG_MSG_VERBOSE
#define ASG_MSG_VERBOSE(x)
Definition: LhoodMM_tools.cxx:554
CP::LhoodMM_tools::m_printLevel
Int_t m_printLevel
Definition: LhoodMM_tools.h:129
PlotCalibFromCool.nentries
nentries
Definition: PlotCalibFromCool.py:798
CP::BaseFakeBkgTool::m_cachedFinalStates
std::set< FakeBkgTools::FinalState > m_cachedFinalStates
Definition: BaseFakeBkgTool.h:99
CP::LhoodMM_tools::m_minnlep
int m_minnlep
Definition: LhoodMM_tools.h:93
python.getCurrentFolderTag.fn
fn
Definition: getCurrentFolderTag.py:65
AthCommonDataStore
Definition: AthCommonDataStore.h:52
CP::BaseFakeBkgTool::UncertaintyList::extraVariation
void extraVariation(uint16_t extra_UID, float extra_sigma)
Definition: BaseFakeBkgTool.h:148
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CP::LhoodMM_tools::m_coeffs
std::vector< std::vector< std::vector< double > > > m_coeffs
Definition: LhoodMM_tools.h:112
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:193
Monitored::detail::getAxis
constexpr auto getAxis(H *hist)
Helper to get corresponding TAxis selected by Monitored::Axis.
Definition: HistogramFillerUtils.h:40
CP::LhoodMM_tools::setup
StatusCode setup()
Definition: LhoodMM_tools.cxx:526
lumiFormat.i
int i
Definition: lumiFormat.py:92
CP::BaseFakeBkgTool::m_initialized
bool m_initialized
Definition: BaseFakeBkgTool.h:78
h
CP::LhoodMMFitInfo::OSfrac_num
std::vector< std::vector< double > > OSfrac_num
Definition: LhoodMMFitInfo.h:21
beamspotman.n
n
Definition: beamspotman.py:731
LhoodMMEvent::realEffObj
const FakeBkgTools::Efficiency & realEffObj(unsigned ilep) const
Definition: LhoodMMEvent.cxx:82
CP::LhoodMM_tools::get_analytic
void get_analytic(std::vector< double > &nrf, const int nlep)
Definition: LhoodMM_tools.cxx:1333
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector< double >
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CP::LhoodMM_tools::m_MMmatrix_vec
std::vector< std::shared_ptr< TMatrixT< double > > > m_MMmatrix_vec
Definition: LhoodMM_tools.h:132
CP::LhoodMM_tools::m_maxWeight
float m_maxWeight
Definition: LhoodMM_tools.h:104
CP::LhoodMMFitInfo::event_sumw2
std::vector< std::vector< double > > event_sumw2
Definition: LhoodMMFitInfo.h:20
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
CP::LhoodMM_tools::m_global_fitInfo
LhoodMMFitInfo m_global_fitInfo
Definition: LhoodMM_tools.h:81
CP::BaseFakeBkgTool::m_progressFileDirectory
std::string m_progressFileDirectory
property ProgressFileDirectory
Definition: BaseFakeBkgTool.h:139
top::nominal
@ nominal
Definition: ScaleFactorRetriever.h:29
CP::LhoodMMFitInfo::event_cat
std::vector< std::vector< double > > event_cat
Definition: LhoodMMFitInfo.h:19
CP::LhoodMM_tools::mergeSubJobs
StatusCode mergeSubJobs()
Definition: LhoodMM_tools.cxx:1700
CP::LhoodMM_tools::fcn_nlep
static void fcn_nlep(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
Definition: LhoodMM_tools.cxx:643
TH3
Definition: rootspy.cxx:440
FakeBkgTools::Database::XmlError
This propagates an error message + the reference to the faulty piece of XML when an exception is rais...
Definition: Database.h:124
CalibCoolCompareRT.up
up
Definition: CalibCoolCompareRT.py:109
CP::BaseFakeBkgTool::m_systSetDict
std::unordered_map< CP::SystematicSet, UncertaintyList > m_systSetDict
List of uncertainties in internal format, associated with a particular SystematicSet the m_selectedUn...
Definition: BaseFakeBkgTool.h:166
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
CP::LhoodMM_tools::get_init_pars
void get_init_pars(std::vector< double > &init_pars, int nlep)
Definition: LhoodMM_tools.cxx:1243
plotting.yearwise_efficiency.yval
float yval
Definition: yearwise_efficiency.py:43
CP::BaseFakeBkgTool::m_hasher
std::hash< std::string > m_hasher
comes from Event passed to addEvent()
Definition: BaseFakeBkgTool.h:97
python.xAODType.dummy
dummy
Definition: xAODType.py:4
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
add
bool add(const std::string &hname, TKey *tobj)
Definition: fastadd.cxx:55
MSG::name
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition: MsgLevel.cxx:19
CP::LhoodMM_tools::m_fitStatus
Int_t m_fitStatus
Definition: LhoodMM_tools.h:127
CP::BaseFakeBkgTool::m_process
std::string m_process
'process' settings used to compute the total yield / fill histograms
Definition: BaseFakeBkgTool.h:118
CP::BaseFakeBkgTool::register2DHistogram
virtual StatusCode register2DHistogram(TH2 *h2, const float *xval, const float *yval) override
associates a 2D histogram to the tool, to obtain a binned estimate of the fake lepton background the ...
Definition: BaseFakeBkgTool.cxx:270
CP::LhoodMM_tools::m_maxnlep_loose
int m_maxnlep_loose
Definition: LhoodMM_tools.h:93
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
CP::BaseFakeBkgTool::m_unlimitedSystematicVariations
bool m_unlimitedSystematicVariations
used to prevent multiple calls to applySystematicVariation() when unsupported set to true in a partic...
Definition: BaseFakeBkgTool.h:170
CP::LhoodMM_tools::m_prevSave
bool m_prevSave
Definition: LhoodMM_tools.h:82
CP::LhoodMM_tools::m_fitInfo_2dhisto_map
std::map< TH2 *, std::vector< LhoodMMFitInfo > > m_fitInfo_2dhisto_map
Definition: LhoodMM_tools.h:115
CP::LhoodMMFitInfo::coeffs_num
std::vector< std::vector< std::vector< FakeBkgTools::Efficiency > > > coeffs_num
Definition: LhoodMMFitInfo.h:17
LhoodMMEvent::charge
int charge(unsigned ilep) const
Definition: LhoodMMEvent.cxx:110
plotting.yearwise_efficiency.xval
float xval
Definition: yearwise_efficiency.py:42
imax
int imax(int i, int j)
Definition: TileLaserTimingTool.cxx:33
beamspotman.stat
stat
Definition: beamspotman.py:266
CP::LhoodMM_tools::m_doFakeFactor
bool m_doFakeFactor
Definition: LhoodMM_tools.h:100
CP::BaseFakeBkgTool::m_values_1dhisto_map
std::map< TH1 *, const float * > m_values_1dhisto_map
Definition: BaseFakeBkgTool.h:108
CP::BaseFakeBkgTool::getListOfEfficienciesAffectedBy
std::string getListOfEfficienciesAffectedBy(uint16_t uid) const
Definition: BaseFakeBkgTool.cxx:356
beamspotman.dir
string dir
Definition: beamspotman.py:623
FakeBkgTools::Efficiency::setToConst
Efficiency & setToConst(float value=1.f)
setToConst() sets the nominal and all varied values to the same constant
Definition: FakeBkgInternals.h:252
min
#define min(a, b)
Definition: cfImp.cxx:40
CP::LhoodMMFitInfo
Definition: LhoodMMFitInfo.h:13
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
CP::LhoodMM_tools::m_lastSaveIndex
unsigned m_lastSaveIndex
Definition: LhoodMM_tools.h:135
CP::LhoodMM_tools::m_fixNormalization
bool m_fixNormalization
Definition: LhoodMM_tools.h:102
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
CP::BaseFakeBkgTool::m_needEventInfo
bool m_needEventInfo
Definition: BaseFakeBkgTool.h:79
CP::SystematicSet::insert
void insert(const SystematicVariation &systematic)
description: insert a systematic into the set
Definition: SystematicSet.cxx:88
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
LhoodMMEvent
Definition: LhoodMMEvent.h:11
CP::BaseFakeBkgTool::m_tightAccessor
CP::ISelectionReadAccessor * m_tightAccessor
this can't be a unique_ptr as this can cause issues with the dictionary in some particular circumstan...
Definition: BaseFakeBkgTool.h:133
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
charge
double charge(const T &p)
Definition: AtlasPID.h:494
FakeBkgTools::maxParticles
constexpr uint8_t maxParticles()
Definition: FakeBkgInternals.h:93
CP::ISelectionReadAccessor::getBool
virtual bool getBool(const SG::AuxElement &element, const CP::SystematicSet *sys=nullptr) const =0
get the selection decoration
CP::BaseFakeBkgTool::m_externalWeight
float m_externalWeight
Definition: BaseFakeBkgTool.h:95
CP::LhoodMM_tools::m_fitInfo_3dhisto_map
std::map< TH3 *, std::vector< LhoodMMFitInfo > > m_fitInfo_3dhisto_map
Definition: LhoodMM_tools.h:116
CP::BaseFakeBkgTool::m_particles
std::vector< FakeBkgTools::ParticleData > m_particles
Definition: BaseFakeBkgTool.h:85
python.AtlRunQueryLib.rsq
rsq
Definition: AtlRunQueryLib.py:380
CP::LhoodMM_tools::s_maxRank
static const int s_maxRank
Definition: LhoodMM_tools.h:109
xAOD::Electron_v1
Definition: Electron_v1.h:34
CP::BaseFakeBkgTool::m_selectedUncertainties
UncertaintyList * m_selectedUncertainties
Pointer to a value of the 'm_systSetDict' map it must be invalidated each time the map is updated in ...
Definition: BaseFakeBkgTool.h:161
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
Muon
struct TBPatternUnitContext Muon
CP::BaseFakeBkgTool::addEventCustom
virtual StatusCode addEventCustom()=0
FakeBkgTools::FinalState
Definition: FakeBkgInternals.h:98
FakeBkgTools::Efficiency::subFromOne
Efficiency & subFromOne()
subFromOne() sets nominal and varied values to 1 - previous value.
Definition: FakeBkgInternals.h:265
PathResolverFindDataFile
std::string PathResolverFindDataFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:379
compileRPVLLRates.nf
nf
Definition: compileRPVLLRates.py:89
CP::LhoodMM_tools::m_current_lhoodMM_tool
static LhoodMM_tools * m_current_lhoodMM_tool
Definition: LhoodMM_tools.h:79
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
a
TList * a
Definition: liststreamerinfos.cxx:10
y
#define y
h
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CP::LhoodMM_tools::m_maxnlep
int m_maxnlep
Definition: LhoodMM_tools.h:93
CP::LhoodMMFitInfo::reset
void reset()
Definition: LhoodMMFitInfo.cxx:17
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
CP::LhoodMM_tools::incrementMatrices
StatusCode incrementMatrices(const LhoodMMEvent &mmevt)
Definition: LhoodMM_tools.cxx:324
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
python.TriggerHandler.verbose
verbose
Definition: TriggerHandler.py:297
CP::BaseFakeBkgTool::affectingSystematics
virtual CP::SystematicSet affectingSystematics() const override
the list of all systematics this tool can be affected by
Definition: BaseFakeBkgTool.cxx:409
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
CP::LhoodMM_tools::s_nLepMax
static const int s_nLepMax
Definition: LhoodMM_tools.h:108
Herwig7_QED_EvtGen_ll.fs
dictionary fs
Definition: Herwig7_QED_EvtGen_ll.py:17
CP::LhoodMM_tools::fillHisto_internal
StatusCode fillHisto_internal(const std::vector< LhoodMMFitInfo > &fitInfo_vec, TH1 *h)
Definition: LhoodMM_tools.cxx:1159
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
CP::LhoodMM_tools
Definition: LhoodMM_tools.h:29
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
CP::LhoodMM_tools::reset
virtual void reset()
Definition: LhoodMM_tools.cxx:73
CP::BaseFakeBkgTool::m_selection
std::string m_selection
'selection' settings used to compute the total yield / fill histograms
Definition: BaseFakeBkgTool.h:115
CP::LhoodMM_tools::fixPosErr
double fixPosErr(double n_fake_fit, TMinuit_LHMM *lhoodFit)
Definition: LhoodMM_tools.cxx:1490
LArCellBinning.step
step
Definition: LArCellBinning.py:158
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
compute_lumi.fin
fin
Definition: compute_lumi.py:19
xAODType::Tau
@ Tau
The object is a tau (jet)
Definition: ObjectType.h:49
LArG4FSStartPointFilterLegacy.line2
line2
Definition: LArG4FSStartPointFilterLegacy.py:59
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
merge.status
status
Definition: merge.py:17
xAOD::JetConstituentVector::iterator
Definition: JetConstituentVector.h:121
CP::BaseFakeBkgTool::m_values_2dhisto_map
std::map< TH2 *, std::pair< const float *, const float * > > m_values_2dhisto_map
Definition: BaseFakeBkgTool.h:109
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
CP::LhoodMM_tools::incrementOneMatrixSet
StatusCode incrementOneMatrixSet(LhoodMMFitInfo &fitInfo, const LhoodMMEvent &mmevt)
Definition: LhoodMM_tools.cxx:415
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
CP::LhoodMM_tools::m_theta_tot_start_index
int m_theta_tot_start_index
Definition: LhoodMM_tools.h:94
CP::LhoodMM_tools::m_fake_indices
std::vector< std::vector< int > > m_fake_indices
Definition: LhoodMM_tools.h:95
LhoodMMEvent::weight
float weight() const
Definition: LhoodMMEvent.h:28
CP::LhoodMM_tools::m_OSfrac
std::vector< std::vector< double > > m_OSfrac
Definition: LhoodMM_tools.h:119
get_generator_info.error
error
Definition: get_generator_info.py:40
LhoodMMEvent::nlep
unsigned nlep() const
Definition: LhoodMMEvent.h:19
FakeBkgTools::FSBitset
std::bitset< maxCombinations()> FSBitset
Definition: FakeBkgInternals.h:95
CP::LhoodMM_tools::m_nfakes_std_perEventWeight
double m_nfakes_std_perEventWeight
Definition: LhoodMM_tools.h:123
SG::DataProxy
Definition: DataProxy.h:44
error
Definition: IImpactPoint3dEstimator.h:70
CP::BaseFakeBkgTool::m_values_3dhisto_map
std::map< TH3 *, std::tuple< const float *, const float *, const float * > > m_values_3dhisto_map
Definition: BaseFakeBkgTool.h:110
CP::BaseFakeBkgTool::m_progressFileName
std::string m_progressFileName
property ProgressFileName
Definition: BaseFakeBkgTool.h:136
CP::LhoodMM_tools::m_current_fitInfo
const LhoodMMFitInfo * m_current_fitInfo
Definition: LhoodMM_tools.h:85
python.compressB64.c
def c
Definition: compressB64.py:93
CP::LhoodMM_tools::m_do_std_perEventWeight
bool m_do_std_perEventWeight
Definition: LhoodMM_tools.h:125
CP::LhoodMM_tools::s_piover2
static const double s_piover2
Definition: LhoodMM_tools.h:138
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
CP::LhoodMM_tools::m_nfakes_std
double m_nfakes_std
Definition: LhoodMM_tools.h:121
LhoodMMEvent::fakeEffObj
const FakeBkgTools::Efficiency & fakeEffObj(unsigned ilep) const
Definition: LhoodMMEvent.cxx:91
TMinuit_LHMM
Definition: TMinuit_LHMM.h:12
CP::SystematicSet::filterForAffectingSystematics
static StatusCode filterForAffectingSystematics(const SystematicSet &systConfig, const SystematicSet &affectingSystematics, SystematicSet &filteredSystematics)
description: filter the systematics for the affected systematics returns: success guarantee: strong f...
Definition: SystematicSet.cxx:213
histogram
std::string histogram
Definition: chains.cxx:52
FakeBkgTools::Efficiency::uncertainties
std::map< uint16_t, FakeBkgTools::Uncertainty > uncertainties
Definition: FakeBkgInternals.h:43
fitman.k
k
Definition: fitman.py:528
CP::LhoodMM_tools::m_nfakes_std_err
double m_nfakes_std_err
Definition: LhoodMM_tools.h:121
CP::SystematicVariation::parameter
float parameter() const
description: the numeric parameter contained in the subvariation(), or 0 if the subvariation can't be...
Definition: SystematicVariation.cxx:340
PlotCalibFromCool.vals
vals
Definition: PlotCalibFromCool.py:474
CP::LhoodMMFitInfo::normterms
std::vector< std::vector< FakeBkgTools::Efficiency > > normterms
Definition: LhoodMMFitInfo.h:18