gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool
process_code_PID_pair_mapping.cpp
Go to the documentation of this file.
1 // GAMBIT: Global and Modular BSM Inference Tool
2 // *********************************************
18 
21 
22 // #define COLLIDERBIT_DEBUG
23 #define DEBUG_PREFIX "DEBUG: OMP thread " << omp_get_thread_num() << ": "
24 
25 namespace Gambit
26 {
27 
28  namespace ColliderBit
29  {
30 
34  {
36 
37 
38  // Clear the result multimap in the COLLIDER_INIT iteration (thread 0)
39  if (*Loop::iteration == COLLIDER_INIT)
40  {
41  result.clear();
42  }
43 
44  // In the XSEC_CALCULATION iteration (thread 0) we know the active process codes
45  // and can return the relevant subset of the huge multimap above
46  if(*Loop::iteration == XSEC_CALCULATION)
47  {
48 
49  for(int pcode : *Dep::ActiveProcessCodes)
50  {
51  // Get iterator bounds (as a pair) over the multimap entries that match the key pcode.
52  auto mm_range = all_process_codes_to_PID_pairs.equal_range(pcode);
53 
54  // Loop over these elements and construct the smaller result multimap
55  for (auto mm_it = mm_range.first; mm_it != mm_range.second; ++mm_it)
56  {
57  const PID_pair& pids = mm_it->second;
58  result.insert( std::pair<int,PID_pair>(pcode, pids) );
59  }
60  }
61  }
62 
63  }
64 
65 
68  {
69  using namespace Pipes::getActivePIDPairs;
70 
71  if (*Loop::iteration == COLLIDER_INIT)
72  {
73  result.clear();
74  }
75 
76  if (*Loop::iteration == XSEC_CALCULATION)
77  {
78  for (const std::pair<int,PID_pair>& entry : *Dep::ActiveProcessCodeToPIDPairsMap)
79  {
80 
81  PID_pair pid_pair = entry.second;
82 
83  // if (std::find(result.begin(), result.end(), entry.second) == result.end())
84  if (std::find(result.begin(), result.end(), pid_pair) == result.end())
85  {
86  result.push_back( PID_pair(pid_pair) );
87  }
88  }
89 
90  #ifdef COLLIDERBIT_DEBUG
91  for (const PID_pair& pid_pair : result)
92  {
93  cout << DEBUG_PREFIX << "getActivePIDPairs: - active PID pair: [" << pid_pair.pid1() << "," << pid_pair.pid2() << "]" << endl;
94  }
95  #endif
96  }
97  }
98 
99  }
100 }
A big multimap connecting Pythia process codes to the PID numbers for the two final state particles...
Simple class for holding a sorted pair of particle ID (PID) codes.
Definition: PID_pair.hpp:31
std::multimap< int, PID_pair > multimap_int_PID_pair
Declarations common to all ColliderBit event loop functions.
#define DEBUG_PREFIX
void getActivePIDPairs(vec_PID_pair &result)
Get a list of all the PID pairs related to active process codes.
void getActiveProcessCodeToPIDPairsMap(multimap_int_PID_pair &result)
Get a multimap between the active Pythia process codes and the corresponding PID pair for the two fin...
TODO: see if we can use this one:
Definition: Analysis.hpp:33
std::vector< PID_pair > vec_PID_pair