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)
void SetJetN (unsigned int jet_n)
void SetStoreAmbiguousJets (bool store_ambiguous_jets)
template<typename T>
PhiWrap (T phi)
 StoreAmbiguousJets.
template<typename T>
bool CheckInsideRegionPhi (T tower_pos, unsigned int iBlock, bool doWithOverlap=false)
template<typename T>
bool CheckInsideRegionEta (T tower_pos, unsigned int iBlock, bool doWithOverlap=false)
void CreateBlocks (const std::vector< WTATrigObj > &all_towers)
unsigned int GetBlockN ()
unsigned int GetJetN ()
bool GetStoreAmbiguousJets ()
template<typename WTAClassType>
void RunParallelWTA (std::unique_ptr< WTAClassType > &AnyWTAClass)
void CheckJetInCore ()
std::vector< WTAJetGetAllJets ()
std::vector< WTATrigObjGetStage1ConstituentListPerBlock (unsigned int iBlock) const
std::vector< WTATrigObjGetStage1SeedSortingPerBlock (unsigned int iBlock) const
std::vector< WTAJetGetStage2ConeSeedsPPerBlock (unsigned int iBlock) const
std::vector< WTAJetGetStage3ConeJetsPerBlock (unsigned int iBlock) const

Private Attributes

unsigned int m_BlockN
bool m_DivideByEta
unsigned int m_JetN
bool m_StoreAmbiguousJets
std::vector< std::vector< WTATrigObj > > m_InputTowersPerBlock
std::vector< std::vector< WTAJet > > m_OutputJetsPerBlock
std::vector< std::vector< WTATrigObj > > m_stage1_constituentListPerBlock
std::vector< std::vector< WTATrigObj > > m_stage1_seedSortingListPerBlock
std::vector< std::vector< WTAJet > > m_stage2_coneSeedsPerBlock
std::vector< std::vector< WTAJet > > m_stage3_coneJetsPerBlock

Detailed Description

Definition at line 15 of file WTAConeParallelHelper.h.

Constructor & Destructor Documentation

◆ WTAConeParallelHelper()

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

Definition at line 17 of file WTAConeParallelHelper.h.

17 :
18 m_BlockN(block_n), m_DivideByEta(false), m_JetN(10), m_StoreAmbiguousJets(true)
19 {}; // Constructor

◆ ~WTAConeParallelHelper()

WTAConeParallelHelper::~WTAConeParallelHelper ( )
inline

Definition at line 20 of file WTAConeParallelHelper.h.

20{}; // Destructor

Member Function Documentation

◆ CheckInsideRegionEta()

template<typename T>
bool WTAConeParallelHelper::CheckInsideRegionEta ( T tower_pos,
unsigned int iBlock,
bool doWithOverlap = false )

Definition at line 114 of file WTAConeParallelHelper.h.

114 {
115 T block_half_width = ETA_LEN / T(m_BlockN *2);
116 T block_center = ETA_MIN + ETA_LEN / T(m_BlockN) * iBlock + block_half_width;
117 if (doWithOverlap) {
118 block_half_width = block_half_width + T(CORE_DIST);
119 }
120 // Compute min and max with potential wrap-around
121 T block_min = block_center - block_half_width;
122 T block_max = block_center + block_half_width;
123 // Check inclusion
124 return (tower_pos >= block_min) && (tower_pos < block_max);
125}
unsigned long long T

◆ CheckInsideRegionPhi()

template<typename T>
bool WTAConeParallelHelper::CheckInsideRegionPhi ( T tower_pos,
unsigned int iBlock,
bool doWithOverlap = false )

Definition at line 128 of file WTAConeParallelHelper.h.

128 {
129 T block_center = PHI_MIN + PHI_LEN / T(m_BlockN) * iBlock;
130 T block_half_width = PHI_LEN / T(m_BlockN *2);
131 if (doWithOverlap) {
132 block_half_width = block_half_width + T(CORE_DIST);
133 }
134
135 // Compute min and max with potential wrap-around
136 T block_min = PhiWrap(block_center - block_half_width);
137 T block_max = PhiWrap(block_center + block_half_width);
138 tower_pos = PhiWrap(tower_pos);
139 // Check inclusion using modular range
140 if (block_min < block_max) {
141 return (tower_pos >= block_min) && (tower_pos < block_max);
142 } else {
143 // The Region wraps around (e.g., from +3.2 to -3.2)
144 return (tower_pos >= block_min) || (tower_pos < block_max);
145 }
146}
T PhiWrap(T phi)
StoreAmbiguousJets.

◆ CheckJetInCore()

void WTAConeParallelHelper::CheckJetInCore ( )
inline

Definition at line 191 of file WTAConeParallelHelper.h.

192{
193 std::vector<WTAJet> all_jets;
194 for(unsigned int iBlock = 0; iBlock < m_BlockN; iBlock++)
195 {
196 unsigned int this_block_jet_n = m_OutputJetsPerBlock.at(iBlock).size();
197 if(this_block_jet_n == 0) continue; // Only run if there are jets in the ith ROI
198
199 if (m_DivideByEta)
200 {
201 for (int j = this_block_jet_n - 1; j >= 0; j--)
202 {
203 WTAJet jet = m_OutputJetsPerBlock.at(iBlock).at(j);
204 eta_t jet_pos = jet.eta();
205 if (!CheckInsideRegionEta(jet_pos, iBlock, false))
206 m_OutputJetsPerBlock.at(iBlock).erase(m_OutputJetsPerBlock.at(iBlock).begin() + j);
207 }
208 }
209 else
210 {
211 for (int j = this_block_jet_n - 1; j >= 0; j--) {
212 WTAJet jet = m_OutputJetsPerBlock.at(iBlock).at(j);
213 phi_t jet_pos = jet.phi();
214 if (!CheckInsideRegionPhi(jet_pos, iBlock, false))
215 m_OutputJetsPerBlock.at(iBlock).erase(m_OutputJetsPerBlock.at(iBlock).begin() + j);
216 }
217 }
218 }
219}
std::vector< std::vector< WTAJet > > m_OutputJetsPerBlock
bool CheckInsideRegionEta(T tower_pos, unsigned int iBlock, bool doWithOverlap=false)
bool CheckInsideRegionPhi(T tower_pos, unsigned int iBlock, bool doWithOverlap=false)
eta_t eta() const
Definition WTAObject.h:33
phi_t phi() const
Definition WTAObject.h:35
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)

◆ CreateBlocks()

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

Definition at line 148 of file WTAConeParallelHelper.h.

149{
150 const unsigned tower_n = all_towers.size();
151 for(unsigned int iBlock = 0; iBlock < m_BlockN; iBlock++)
152 {
153 if(m_DivideByEta)
154 {
155 for(unsigned int iTower = 0; iTower < tower_n; iTower++)
156 {
157 eta_t tower_pos = all_towers.at(iBlock).eta(); // Get tower's eta position
158 if(CheckInsideRegionEta(tower_pos, iBlock, true))
159 m_InputTowersPerBlock.at(iBlock).push_back(all_towers.at(iTower));
160 }
161 }
162 else
163 {
164 for(unsigned int iTower = 0; iTower < tower_n; iTower++)
165 {
166 phi_t tower_pos = PhiWrap(all_towers.at(iTower).phi()); // Get tower's phi position
167 if(CheckInsideRegionPhi(tower_pos, iBlock, true))
168 m_InputTowersPerBlock.at(iBlock).push_back(all_towers.at(iTower));
169 }
170 }
171 }
172}
std::vector< std::vector< WTATrigObj > > m_InputTowersPerBlock

◆ GetAllJets()

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

Definition at line 221 of file WTAConeParallelHelper.h.

222{
223 std::vector<WTAJet> all_jets;
224 for(unsigned int i = 0; i < m_BlockN; i++)
225 {
226 all_jets.insert(all_jets.end(), m_OutputJetsPerBlock.at(i).begin(), m_OutputJetsPerBlock.at(i).end());
227 }
228 SortByPt(all_jets); // Maximum 40 jets here
230 std::vector<pt_t> duplicated_pt_list;
231 unsigned int cnt = 0;
232 for(unsigned int i = 0; i < all_jets.size() - 1; i++){
233 pt_t i_pt = all_jets.at(i).pt();
234
235 if(std::find(duplicated_pt_list.begin(), duplicated_pt_list.end(),i_pt)!= duplicated_pt_list.end()) continue; // Skip counted pt_t
236 for(unsigned int j = i + 1; j < all_jets.size(); j++){
237 pt_t j_pt = all_jets.at(j).pt();
238 if(i_pt == j_pt){
239 cnt++;
240 if(std::find(duplicated_pt_list.begin(), duplicated_pt_list.end(),i_pt)!= duplicated_pt_list.end())duplicated_pt_list.push_back(i_pt);
241 }
242 }
243 }
244 m_JetN += cnt;
245 }
246 if(all_jets.size() > m_JetN)all_jets.resize(m_JetN); // Do finial truncation
247 return all_jets;
248}
static void SortByPt(std::vector< T > &list)
Definition WTAObject.h:16

◆ GetBlockN()

unsigned int WTAConeParallelHelper::GetBlockN ( )
inline

Definition at line 44 of file WTAConeParallelHelper.h.

44{return m_BlockN;};

◆ GetJetN()

unsigned int WTAConeParallelHelper::GetJetN ( )
inline

Definition at line 45 of file WTAConeParallelHelper.h.

45{return m_JetN;};

◆ GetStage1ConstituentListPerBlock()

std::vector< WTATrigObj > WTAConeParallelHelper::GetStage1ConstituentListPerBlock ( unsigned int iBlock) const
inline

Definition at line 53 of file WTAConeParallelHelper.h.

53 {
54 return m_stage1_constituentListPerBlock.at(iBlock);
55 }
std::vector< std::vector< WTATrigObj > > m_stage1_constituentListPerBlock

◆ GetStage1SeedSortingPerBlock()

std::vector< WTATrigObj > WTAConeParallelHelper::GetStage1SeedSortingPerBlock ( unsigned int iBlock) const
inline

Definition at line 56 of file WTAConeParallelHelper.h.

56 {
57 return m_stage1_seedSortingListPerBlock.at(iBlock);
58 }
std::vector< std::vector< WTATrigObj > > m_stage1_seedSortingListPerBlock

◆ GetStage2ConeSeedsPPerBlock()

std::vector< WTAJet > WTAConeParallelHelper::GetStage2ConeSeedsPPerBlock ( unsigned int iBlock) const
inline

Definition at line 59 of file WTAConeParallelHelper.h.

59 {
60 return m_stage2_coneSeedsPerBlock.at(iBlock);
61 }
std::vector< std::vector< WTAJet > > m_stage2_coneSeedsPerBlock

◆ GetStage3ConeJetsPerBlock()

std::vector< WTAJet > WTAConeParallelHelper::GetStage3ConeJetsPerBlock ( unsigned int iBlock) const
inline

Definition at line 62 of file WTAConeParallelHelper.h.

62 {
63 return m_stage3_coneJetsPerBlock.at(iBlock);
64 }
std::vector< std::vector< WTAJet > > m_stage3_coneJetsPerBlock

◆ GetStoreAmbiguousJets()

bool WTAConeParallelHelper::GetStoreAmbiguousJets ( )
inline

Definition at line 46 of file WTAConeParallelHelper.h.

46{return m_StoreAmbiguousJets;};

◆ PhiWrap()

template<typename T>
T WTAConeParallelHelper::PhiWrap ( T phi)
inline

StoreAmbiguousJets.

Definition at line 101 of file WTAConeParallelHelper.h.

101 {
102#ifdef FLOATING_POINT_SIMULATION
103 while(phi >= PHI_MAX)phi -= 2*PI;
104 while(phi < PHI_MIN)phi += 2*PI;
105 return phi;
106#else
107 T wrapped = phi % PHI_LEN;
108 if (wrapped < 0) wrapped = wrapped + PHI_LEN;
109 return wrapped;
110#endif
111}
Scalar phi() const
phi method
const float PI

◆ RunParallelWTA()

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

Definition at line 175 of file WTAConeParallelHelper.h.

176{
177 for(unsigned int i = 0; i < m_BlockN; i++)
178 {
179 MyWTAMakerClass->InitiateInputs(m_InputTowersPerBlock.at(i));
180 m_stage1_constituentListPerBlock.push_back(MyWTAMakerClass->GetConstituentList());
181 m_stage1_seedSortingListPerBlock.push_back(MyWTAMakerClass->GetSeedSortingList());
182 MyWTAMakerClass->SeedCleaning();
183 m_stage2_coneSeedsPerBlock.push_back(MyWTAMakerClass->GetSeedList());
184 MyWTAMakerClass->MergeConstsToSeeds();
185 MyWTAMakerClass->CreateERingInfo();
186 m_stage3_coneJetsPerBlock.push_back(MyWTAMakerClass->GetSeedList());
187 m_OutputJetsPerBlock.at(i) = MyWTAMakerClass->GetSeedList(); // Define the ith vector, not push_back
188 }
189}

◆ SetBlockN()

void WTAConeParallelHelper::SetBlockN ( unsigned int block_n)
inline

Definition at line 84 of file WTAConeParallelHelper.h.

85{
86 m_BlockN = block_n;
88 for(unsigned int i = 0; i < m_BlockN; i++)
89 {
90 m_InputTowersPerBlock.emplace_back();
91 m_OutputJetsPerBlock.emplace_back();
92 }
93
98}

◆ SetDivideByEta()

void WTAConeParallelHelper::SetDivideByEta ( bool divide_by_eta)
inline

Definition at line 23 of file WTAConeParallelHelper.h.

23{m_DivideByEta = divide_by_eta;}

◆ SetJetN()

void WTAConeParallelHelper::SetJetN ( unsigned int jet_n)
inline

Definition at line 24 of file WTAConeParallelHelper.h.

24{m_JetN = jet_n;}

◆ SetStoreAmbiguousJets()

void WTAConeParallelHelper::SetStoreAmbiguousJets ( bool store_ambiguous_jets)
inline

Definition at line 25 of file WTAConeParallelHelper.h.

25{m_StoreAmbiguousJets = store_ambiguous_jets;}

Member Data Documentation

◆ m_BlockN

unsigned int WTAConeParallelHelper::m_BlockN
private

Definition at line 67 of file WTAConeParallelHelper.h.

◆ m_DivideByEta

bool WTAConeParallelHelper::m_DivideByEta
private

Definition at line 68 of file WTAConeParallelHelper.h.

◆ m_InputTowersPerBlock

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

Definition at line 74 of file WTAConeParallelHelper.h.

◆ m_JetN

unsigned int WTAConeParallelHelper::m_JetN
private

Definition at line 71 of file WTAConeParallelHelper.h.

◆ m_OutputJetsPerBlock

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

Definition at line 75 of file WTAConeParallelHelper.h.

◆ m_stage1_constituentListPerBlock

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

Definition at line 78 of file WTAConeParallelHelper.h.

◆ m_stage1_seedSortingListPerBlock

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

Definition at line 79 of file WTAConeParallelHelper.h.

◆ m_stage2_coneSeedsPerBlock

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

Definition at line 80 of file WTAConeParallelHelper.h.

◆ m_stage3_coneJetsPerBlock

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

Definition at line 81 of file WTAConeParallelHelper.h.

◆ m_StoreAmbiguousJets

bool WTAConeParallelHelper::m_StoreAmbiguousJets
private

Definition at line 72 of file WTAConeParallelHelper.h.


The documentation for this class was generated from the following file: