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 32 of file WTAConeParallelHelper.h.

Constructor & Destructor Documentation

◆ WTAConeParallelHelper()

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

Definition at line 34 of file WTAConeParallelHelper.h.

34  :
35  m_BlockN(block_n), m_DivideByEta(false)
36  {SetBlockN(m_BlockN);}; // Constructor

◆ ~WTAConeParallelHelper()

WTAConeParallelHelper::~WTAConeParallelHelper ( )
inline

Definition at line 37 of file WTAConeParallelHelper.h.

37 {}; // Destructor

Member Function Documentation

◆ CheckInsideRegion()

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

Definition at line 79 of file WTAConeParallelHelper.h.

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

◆ CheckJetInCore()

void WTAConeParallelHelper::CheckJetInCore ( )
inline

Definition at line 143 of file WTAConeParallelHelper.h.

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

◆ CreateBlocks()

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

Definition at line 102 of file WTAConeParallelHelper.h.

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

◆ GetAllJets()

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

Definition at line 172 of file WTAConeParallelHelper.h.

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

◆ GetBlockN()

unsigned int WTAConeParallelHelper::GetBlockN ( )
inline

Definition at line 44 of file WTAConeParallelHelper.h.

44 {return m_BlockN;};

◆ PhiWrap()

IntOrFloat WTAConeParallelHelper::PhiWrap ( IntOrFloat  phi)
inline

Definition at line 71 of file WTAConeParallelHelper.h.

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

◆ RunParallelWTA()

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

Definition at line 132 of file WTAConeParallelHelper.h.

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

◆ SetBlockN()

void WTAConeParallelHelper::SetBlockN ( unsigned int  block_n)
inline

Definition at line 58 of file WTAConeParallelHelper.h.

59 {
60  m_BlockN = block_n;
62  for(unsigned int i = 0; i < m_BlockN; i++)
63  {
64  std::vector<WTATrigObj> tmp_tower_vec;
65  std::vector<WTAJet> tmp_jet_vec;
66  m_InputTowersPerBlock.push_back(tmp_tower_vec);
67  m_OutputJetsPerBlock.push_back(tmp_jet_vec);
68  }
69 }

◆ SetDivideByEta()

void WTAConeParallelHelper::SetDivideByEta ( bool  divide_by_eta)
inline

Definition at line 40 of file WTAConeParallelHelper.h.

40 {m_DivideByEta = divide_by_eta;}

Member Data Documentation

◆ m_BlockN

unsigned int WTAConeParallelHelper::m_BlockN
private

Definition at line 51 of file WTAConeParallelHelper.h.

◆ m_DivideByEta

bool WTAConeParallelHelper::m_DivideByEta
private

Definition at line 52 of file WTAConeParallelHelper.h.

◆ m_InputTowersPerBlock

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

Definition at line 53 of file WTAConeParallelHelper.h.

◆ m_OutputJetsPerBlock

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

Definition at line 54 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:53
lumiFormat.i
int i
Definition: lumiFormat.py:85
WTAConeParallelHelper::m_BlockN
unsigned int m_BlockN
Definition: WTAConeParallelHelper.h:51
WTAJet
Definition: WTAObject.h:104
WTAConeParallelHelper::m_OutputJetsPerBlock
std::vector< std::vector< WTAJet > > m_OutputJetsPerBlock
Definition: WTAConeParallelHelper.h:54
Trk::inside
@ inside
Definition: PropDirection.h:29
WTAConeParallelHelper::PhiWrap
IntOrFloat PhiWrap(IntOrFloat phi)
Definition: WTAConeParallelHelper.h:71
WTATrigObj::eta
IntOrFloat eta() const
Definition: WTAObject.h:40
WTAConeParallelHelper::CheckInsideRegion
bool CheckInsideRegion(const WTATrigObj &tower, IntOrFloat min, IntOrFloat max)
Definition: WTAConeParallelHelper.h:79
WTAConeParallelHelper::SetBlockN
void SetBlockN(unsigned int block_n)
Definition: WTAConeParallelHelper.h:58
WTAConeParallelHelper::m_DivideByEta
bool m_DivideByEta
Definition: WTAConeParallelHelper.h:52
python.LArMinBiasAlgConfig.float
float
Definition: LArMinBiasAlgConfig.py:65