ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
WTAConeParallelHelper Class Reference

#include <WTAConeParallelHelper.h>

Collaboration diagram for WTAConeParallelHelper:

Public Member Functions

 WTAConeParallelHelper (unsigned int block_n=1)
 
 ~WTAConeParallelHelper ()
 
void SetBlockN (unsigned int block_n)
 
void SetDivideByEta (bool divide_by_eta)
 
IntOrFloat PhiWrap (IntOrFloat phi)
 
bool CheckInsideRegion (const WTATrigObj &tower, IntOrFloat min, IntOrFloat max)
 
void CreateBlocks (const std::vector< WTATrigObj > &all_towers)
 
unsigned int GetBlockN ()
 
template<typename WTAClassType >
void RunParallelWTA (std::unique_ptr< WTAClassType > &AnyWTAClass)
 
void CheckJetInCore ()
 
std::vector< WTAJetGetAllJets ()
 

Private Attributes

unsigned int m_BlockN
 
bool m_DivideByEta
 
std::vector< std::vector< WTATrigObj > > m_InputTowersPerBlock
 
std::vector< std::vector< WTAJet > > m_OutputJetsPerBlock
 

Detailed Description

Definition at line 36 of file WTAConeParallelHelper.h.

Constructor & Destructor Documentation

◆ WTAConeParallelHelper()

WTAConeParallelHelper::WTAConeParallelHelper ( unsigned int  block_n = 1)
inline

Definition at line 38 of file WTAConeParallelHelper.h.

38  :
39  m_BlockN(block_n), m_DivideByEta(false)
40  {SetBlockN(m_BlockN);}; // Constructor

◆ ~WTAConeParallelHelper()

WTAConeParallelHelper::~WTAConeParallelHelper ( )
inline

Definition at line 41 of file WTAConeParallelHelper.h.

41 {}; // Destructor

Member Function Documentation

◆ CheckInsideRegion()

bool WTAConeParallelHelper::CheckInsideRegion ( const WTATrigObj tower,
IntOrFloat  min,
IntOrFloat  max 
)
inline

Definition at line 81 of file WTAConeParallelHelper.h.

82 {
83  bool inside = false;
84  if(m_DivideByEta)
85  {
86  IntOrFloat this_eta = tower.eta();
87  inside = (this_eta >= min) && (this_eta < max);
88  }
89  else
90  { // Watchout for the PhiWrapping
91  IntOrFloat this_phi = PhiWrap(tower.phi());
92  IntOrFloat min_wrap = PhiWrap(min);
93  IntOrFloat max_wrap = PhiWrap(max);
94  if(min_wrap <= max_wrap){
95  inside = (this_phi >= min_wrap) && (this_phi < max_wrap);
96  }
97  else{ // E.g) Block0 has min = -PI - 0.8, max = PI + 0.8
98  inside = !((this_phi >= max_wrap) && (this_phi < min_wrap));
99  }
100  }
101  return inside;
102 }

◆ CheckJetInCore()

void WTAConeParallelHelper::CheckJetInCore ( )
inline

Definition at line 145 of file WTAConeParallelHelper.h.

146 {
147  IntOrFloat BlockLow = -99;
148  IntOrFloat BlockHigh = -99;
149  std::vector<WTAJet> all_jets;
150  for(unsigned int i = 0; i < m_BlockN; i++)
151  {
152  if(m_DivideByEta)
153  {
154  BlockLow = ETA_MIN + i * (float)(ETA_LEN / m_BlockN);
155  BlockHigh = ETA_MAX - (m_BlockN - 1 - i) * (float)(ETA_LEN / m_BlockN);
156  }
157  else
158  { // Remember, Cores should be equivalent with linspace(4, PHI_MIN, PHI_MAX)
159  BlockLow = PHI_MIN + i * (float)(PHI_LEN / m_BlockN);
160  BlockHigh = PHI_MAX - (m_BlockN - 1 - i) * (float)(PHI_LEN / m_BlockN);
161  }
162  unsigned int this_block_jet_n = m_OutputJetsPerBlock.at(i).size();
163  if(this_block_jet_n) // Only run if there are jets in the ith ROI
164  {
165  for(int j = this_block_jet_n - 1; j >= 0; j--) // Because we are erasing, read from right to left
166  {
167  WTAJet jet = m_OutputJetsPerBlock.at(i).at(j);
168  if(!CheckInsideRegion(jet, BlockLow, BlockHigh))m_OutputJetsPerBlock.at(i).erase(m_OutputJetsPerBlock.at(i).begin() + j);
169  }
170  }
171  }
172 }

◆ CreateBlocks()

void WTAConeParallelHelper::CreateBlocks ( const std::vector< WTATrigObj > &  all_towers)
inline

Definition at line 104 of file WTAConeParallelHelper.h.

105 {
106  IntOrFloat BlockLow = -99;
107  IntOrFloat BlockHigh = -99;
108  const unsigned tower_n = all_towers.size();
109  for(unsigned int i = 0; i < m_BlockN; i++)
110  {
111  if(m_DivideByEta)
112  {
113  BlockLow = ETA_MIN - CORE_DIST + i * (float)(ETA_LEN / m_BlockN);
114  BlockHigh = ETA_MAX + CORE_DIST - (m_BlockN - 1 - i) * (float)(ETA_LEN / m_BlockN);
115  }
116  else
117  {
118  BlockLow = PHI_MIN - CORE_DIST + i * (float)(PHI_LEN / m_BlockN);
119  BlockHigh = PHI_MAX + CORE_DIST - (m_BlockN - 1 - i) * (float)(PHI_LEN / m_BlockN);
120  }
121  for(unsigned int t = 0; t < tower_n; t++)
122  {
123  if(CheckInsideRegion(all_towers.at(t), BlockLow, BlockHigh))
124  {
125  m_InputTowersPerBlock.at(i).push_back(all_towers.at(t));
126  }
127  }
128  }
129 }

◆ GetAllJets()

std::vector< WTAJet > WTAConeParallelHelper::GetAllJets ( )
inline

Definition at line 174 of file WTAConeParallelHelper.h.

175 {
176  std::vector<WTAJet> all_jets;
177  for(unsigned int i = 0; i < m_BlockN; i++)
178  {
179  all_jets.insert(all_jets.end(), m_OutputJetsPerBlock.at(i).begin(), m_OutputJetsPerBlock.at(i).end());
180  }
181  SortByPt(all_jets);
182  return all_jets;
183 }

◆ GetBlockN()

unsigned int WTAConeParallelHelper::GetBlockN ( )
inline

Definition at line 48 of file WTAConeParallelHelper.h.

48 {return m_BlockN;};

◆ PhiWrap()

IntOrFloat WTAConeParallelHelper::PhiWrap ( IntOrFloat  phi)
inline

Definition at line 73 of file WTAConeParallelHelper.h.

74 {
75  while(phi >= PHI_MAX)phi -= 2*PI;
76  while(phi < PHI_MIN)phi += 2*PI;
77  return phi;
78 }

◆ RunParallelWTA()

template<typename WTAClassType >
void WTAConeParallelHelper::RunParallelWTA ( std::unique_ptr< WTAClassType > &  AnyWTAClass)
inline

Definition at line 134 of file WTAConeParallelHelper.h.

135 {
136  for(unsigned int i = 0; i < m_BlockN; i++)
137  {
138  MyWTAMakerClass->InitiateInputs(m_InputTowersPerBlock.at(i));
139  MyWTAMakerClass->SeedCleaning();
140  MyWTAMakerClass->MergeConstsToSeeds();
141  m_OutputJetsPerBlock.at(i) = MyWTAMakerClass->GetSeedList(); // Define the ith vector, not push_back
142  }
143 }

◆ SetBlockN()

void WTAConeParallelHelper::SetBlockN ( unsigned int  block_n)
inline

Definition at line 62 of file WTAConeParallelHelper.h.

63 {
64  m_BlockN = block_n;
66  for(unsigned int i = 0; i < m_BlockN; i++)
67  {
68  m_InputTowersPerBlock.emplace_back();
69  m_OutputJetsPerBlock.emplace_back();
70  }
71 }

◆ SetDivideByEta()

void WTAConeParallelHelper::SetDivideByEta ( bool  divide_by_eta)
inline

Definition at line 44 of file WTAConeParallelHelper.h.

44 {m_DivideByEta = divide_by_eta;}

Member Data Documentation

◆ m_BlockN

unsigned int WTAConeParallelHelper::m_BlockN
private

Definition at line 55 of file WTAConeParallelHelper.h.

◆ m_DivideByEta

bool WTAConeParallelHelper::m_DivideByEta
private

Definition at line 56 of file WTAConeParallelHelper.h.

◆ m_InputTowersPerBlock

std::vector<std::vector<WTATrigObj> > WTAConeParallelHelper::m_InputTowersPerBlock
private

Definition at line 57 of file WTAConeParallelHelper.h.

◆ m_OutputJetsPerBlock

std::vector<std::vector<WTAJet> > WTAConeParallelHelper::m_OutputJetsPerBlock
private

Definition at line 58 of file WTAConeParallelHelper.h.


The documentation for this class was generated from the following file:
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
WTATrigObj::phi
IntOrFloat phi() const
Definition: WTAObject.h:42
PI
const float PI
Definition: test_isolaitonTool.cxx:61
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
WTAConeParallelHelper::m_InputTowersPerBlock
std::vector< std::vector< WTATrigObj > > m_InputTowersPerBlock
Definition: WTAConeParallelHelper.h:57
lumiFormat.i
int i
Definition: lumiFormat.py:85
WTAConeParallelHelper::m_BlockN
unsigned int m_BlockN
Definition: WTAConeParallelHelper.h:55
WTAJet
Definition: WTAObject.h:104
WTAConeParallelHelper::m_OutputJetsPerBlock
std::vector< std::vector< WTAJet > > m_OutputJetsPerBlock
Definition: WTAConeParallelHelper.h:58
Trk::inside
@ inside
Definition: PropDirection.h:29
WTAConeParallelHelper::PhiWrap
IntOrFloat PhiWrap(IntOrFloat phi)
Definition: WTAConeParallelHelper.h:73
WTATrigObj::eta
IntOrFloat eta() const
Definition: WTAObject.h:40
WTAConeParallelHelper::CheckInsideRegion
bool CheckInsideRegion(const WTATrigObj &tower, IntOrFloat min, IntOrFloat max)
Definition: WTAConeParallelHelper.h:81
WTAConeParallelHelper::SetBlockN
void SetBlockN(unsigned int block_n)
Definition: WTAConeParallelHelper.h:62
WTAConeParallelHelper::m_DivideByEta
bool m_DivideByEta
Definition: WTAConeParallelHelper.h:56
python.LArMinBiasAlgConfig.float
float
Definition: LArMinBiasAlgConfig.py:65