ATLAS Offline Software
Loading...
Searching...
No Matches
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
void SetBlockN(unsigned int block_n)

◆ ~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;
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}
#define min(a, b)
Definition cfImp.cxx:40
#define max(a, b)
Definition cfImp.cxx:41
IntOrFloat PhiWrap(IntOrFloat phi)
IntOrFloat eta() const
Definition WTAObject.h:40
IntOrFloat phi() const
Definition WTAObject.h:42

◆ 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}
std::vector< std::vector< WTAJet > > m_OutputJetsPerBlock
bool CheckInsideRegion(const WTATrigObj &tower, IntOrFloat min, IntOrFloat max)

◆ 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}
std::vector< std::vector< WTATrigObj > > m_InputTowersPerBlock

◆ 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}
static void SortByPt(std::vector< T > &list)
Definition WTAObject.h:23

◆ 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}
Scalar phi() const
phi method
const float PI

◆ 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: