file src/getAnalysisContainer.cpp

[No description available] More…

Namespaces

Name
Gambit
TODO: see if we can use this one:
Gambit::ColliderBit

Defines

Name
DEBUG_PREFIX

Detailed Description

Author:

Date:

  • 2014 Aug
  • 2015 May
  • 2015 Jul
  • 2018 Jan
  • 2019 Jan, Feb
  • 2017 March
  • 2018 Jan
  • 2018 May
  • 2021 Oct

Initialisation functions for ColliderBit analyses.


Authors (add name and date if you modify):


Macros Documentation

define DEBUG_PREFIX

#define DEBUG_PREFIX "DEBUG: OMP thread " << omp_get_thread_num() << ":  " << __FILE__ << ":" << __LINE__ << ":  "

Source code

//   GAMBIT: Global and Modular BSM Inference Tool
//   *********************************************
///  \file
///
///  Initialisation functions for ColliderBit
///  analyses.
///
///  *********************************************
///
///  Authors (add name and date if you modify):
///
///  \author Abram Krislock
///          (a.m.b.krislock@fys.uio.no)
///
///  \author Aldo Saavedra
///
///  \author Andy Buckley
///
///  \author Chris Rogan
///          (crogan@cern.ch)
///  \date 2014 Aug
///  \date 2015 May
///
///  \author Pat Scott
///          (p.scott@imperial.ac.uk)
///  \date 2015 Jul
///  \date 2018 Jan
///  \date 2019 Jan, Feb
///
///  \author Anders Kvellestad
///          (anders.kvellestad@fys.uio.no)
///  \date   2017 March
///  \date   2018 Jan
///  \date   2018 May
///  \date   2021 Oct
///
///  *********************************************

#include "gambit/ColliderBit/ColliderBit_eventloop.hpp"

// #define COLLIDERBIT_DEBUG
#define DEBUG_PREFIX "DEBUG: OMP thread " << omp_get_thread_num() << ":  " << __FILE__ << ":" << __LINE__ << ":  "

namespace Gambit
{

  namespace ColliderBit
  {

    /// Retrieve an analysis container for a specific detector
    void getAnalysisContainer(AnalysisContainer& result,
                              const str& detname,
                              const MCLoopInfo& RunMC,
                              const xsec_container& TotalCrossSection,
                              int iteration)
    {
      if (RunMC.analyses.empty() or iteration == BASE_INIT) return;

      if (iteration == COLLIDER_INIT)
      {
        result.set_current_collider(RunMC.current_collider());
      }

      if (not RunMC.current_analyses_exist_for(detname)) return;

      if (iteration == COLLIDER_INIT_OMP)
      {
        // Register analysis container
        result.register_thread(detname+"AnalysisContainer");

        // Set current collider
        result.set_current_collider(RunMC.current_collider());

        // Initialize analysis container or reset all the contained analyses
        if (!result.has_analyses())
        {
          try
          {
            result.init(RunMC.current_analyses_for(detname));
          }
          catch (std::runtime_error& e)
          {
            piped_errors.request(LOCAL_INFO, e.what());
          }
        }
        else result.reset();
      }

      if (iteration == COLLIDER_FINALIZE)
      {
        result.collect_and_add_signal();
        int ntot = RunMC.current_event_count();
        double xs = TotalCrossSection.xsec();
        double xs_per_event = 0;
        if (xs >= 0 && ntot > 0)
        {
          xs_per_event = xs / ntot;
        }
        #ifdef COLLIDERBIT_DEBUG
          cout << DEBUG_PREFIX << "getAnalysisContainer: "
               << "ntot = " << ntot << ",  "
               << "xs = " << xs << ",  "
               << "xs_per_event = " << xs_per_event << endl;
        #endif
        // Scale all analysis results with the total cross-section per event
        result.scale(xs_per_event);
      }

    }

    /// Retrieve a container for analyses with a given experiment
    void getATLASAnalysisContainer(AnalysisContainer& result)
    {
      using namespace Pipes::getATLASAnalysisContainer;

      xsec_container Totalxsec = *Dep::TotalCrossSection;

      getAnalysisContainer(result, "ATLAS", *Dep::RunMC, Totalxsec, *Loop::iteration);

      if (*Loop::iteration == COLLIDER_INIT_OMP)
      {
        static bool drop_accepted_events_file = runOptions->getValueOrDef<bool>(false, "drop_accepted_events_file");
        result.set_store_accepted_event_IDs(drop_accepted_events_file);
      }
    }

    void getCMSAnalysisContainer(AnalysisContainer& result)
    {
      using namespace Pipes::getCMSAnalysisContainer;

      xsec_container Totalxsec = *Dep::TotalCrossSection;

      getAnalysisContainer(result, "CMS", *Dep::RunMC, Totalxsec, *Loop::iteration);

      if (*Loop::iteration == COLLIDER_INIT_OMP)
      {
        static bool drop_accepted_events_file = runOptions->getValueOrDef<bool>(false, "drop_accepted_events_file");
        result.set_store_accepted_event_IDs(drop_accepted_events_file);
      }
    }

    void getIdentityAnalysisContainer(AnalysisContainer& result)
    {
      using namespace Pipes::getIdentityAnalysisContainer;

      xsec_container Totalxsec = *Dep::TotalCrossSection;

      getAnalysisContainer(result, "Identity", *Dep::RunMC, Totalxsec, *Loop::iteration);

      if (*Loop::iteration == COLLIDER_INIT_OMP)
      {
        static bool drop_accepted_events_file = runOptions->getValueOrDef<bool>(false, "drop_accepted_events_file");
        result.set_store_accepted_event_IDs(drop_accepted_events_file);
      }
    }

  }
}

Updated on 2026-11-03 at 14:50:48 +0000