ATLAS Offline Software
Public Member Functions | Public Attributes | Protected Attributes | List of all members
WTAConeMaker Class Reference

#include <WTAConeMaker.h>

Inheritance diagram for WTAConeMaker:
Collaboration diagram for WTAConeMaker:

Public Member Functions

 WTAConeMaker (bool debug=false, bool verbose=false)
 
virtual ~WTAConeMaker ()=default
 
void ResizeConstituentList ()
 
void ResizeSeedSortingList ()
 
void ResizeSeedList ()
 
void ResizeSeedNConstLists ()
 
void ResizeThisJetConstituents (WTAJet &jet)
 
void ClearLists ()
 
void PrintSeedList ()
 
WTAJet WTATrigObjToWTAJet (const WTATrigObj &obj)
 
WTATrigObj WTAJetToWTATrigObj (const WTAJet &jet)
 
const std::vector< WTATrigObj > & GetConstituentList () const
 
const std::vector< WTATrigObj > & GetSeedSortingList () const
 
const std::vector< WTAJet > & GetSeedList () const
 
std::vector< int > GetAssociateBits (WTATrigObj incoming_seed, int &max_pt_index)
 
std::vector< WTATrigObjLoadInputs (const std::vector< IntOrFloat > &ptVec, const std::vector< IntOrFloat > &etaVec, const std::vector< IntOrFloat > &phiVec, const std::vector< IntOrFloat > &mVec)
 
virtual void FillLists (const std::vector< WTATrigObj > &InputTowers)
 
void InitiateInputs (const std::vector< IntOrFloat > &ptVec, const std::vector< IntOrFloat > &etaVec, const std::vector< IntOrFloat > &phiVec, const std::vector< IntOrFloat > &mVec)
 
void InitiateInputs (const std::vector< WTATrigObj > &InputTowers)
 
void InsertToConstList (WTATrigObj obj)
 
virtual void SeedCleaning ()
 
virtual void MergeConstsToSeeds ()
 
void SetDEBUG ()
 
void SetVERBOSE ()
 
bool GetDEBUG ()
 
bool GetVERBOSE ()
 

Public Attributes

WTAParameters m_WTAConeMakerParameter
 

Protected Attributes

std::vector< WTATrigObjm_ConstituentList
 
std::vector< WTATrigObjm_SeedSortingList
 
std::vector< WTAJetm_SeedList
 
bool m_DEBUG
 
bool m_VERBOSE
 

Detailed Description

Definition at line 54 of file WTAConeMaker.h.

Constructor & Destructor Documentation

◆ WTAConeMaker()

WTAConeMaker::WTAConeMaker ( bool  debug = false,
bool  verbose = false 
)
inline

Definition at line 56 of file WTAConeMaker.h.

56  :
58  {}; // Constructor

◆ ~WTAConeMaker()

virtual WTAConeMaker::~WTAConeMaker ( )
virtualdefault

Member Function Documentation

◆ ClearLists()

void WTAConeMaker::ClearLists ( )
inline

Definition at line 66 of file WTAConeMaker.h.

66 {m_ConstituentList.clear(); m_SeedSortingList.clear(); m_SeedList.clear();};

◆ FillLists()

void WTAConeMaker::FillLists ( const std::vector< WTATrigObj > &  InputTowers)
inlinevirtual

Reimplemented in WTACone2PassMaker.

Definition at line 114 of file WTAConeMaker.h.

115 {
116  m_ConstituentList.clear(); m_SeedSortingList.clear();
117  const unsigned int MaxSeedSortingN = m_WTAConeMakerParameter.GetMaxSeedSortingN();
118  const unsigned int MaxConstN = m_WTAConeMakerParameter.GetMaxConstN();
119  const int MaxTowersToReadPerEvent = m_WTAConeMakerParameter.GetMaxInputTowers();
120  if(m_DEBUG) std::cout << "MaxTowersToReadPerEvent = " << MaxTowersToReadPerEvent << ", Size of event = " << InputTowers.size() << std::endl;
121  int nTowers = 0;
122  for(auto tower: InputTowers)
123  {
124  if(tower.pt() < m_WTAConeMakerParameter.GetConstEtCut())continue; // Skip Et < 2GeV
125  if(tower.pt() >= m_WTAConeMakerParameter.GetSeedEtCut())m_SeedSortingList.push_back(tower); // Harmonize >=
126  else m_ConstituentList.push_back(tower); // Initially, always put soft tower at the back of the m_ConstituentList
127 
128  // We can read only first N towers out of entier event
129  nTowers++;
130  if(nTowers>MaxTowersToReadPerEvent) break;
131  }
132  if(m_SeedSortingList.size() > MaxSeedSortingN)m_SeedSortingList.resize(MaxSeedSortingN);
133  if(m_ConstituentList.size() > MaxConstN)m_ConstituentList.resize(MaxConstN); // Resize lists accordingly
134 }

◆ GetAssociateBits()

std::vector< int > WTAConeMaker::GetAssociateBits ( WTATrigObj  incoming_seed,
int &  max_pt_index 
)
inline

Definition at line 210 of file WTAConeMaker.h.

211 {
212  int jet_N = m_SeedList.size();
213  std::vector<int> associate_bit(jet_N, 0);
214  IntOrFloat MaxPt = tower.pt(); MaxPtIndex = -1;
215  for(int j = 0; j < jet_N; j++)
216  {
217  if(m_VERBOSE)std::cout << "deta, dphi, dR2 = " << tower.d_eta(m_SeedList.at(j)) << " , " << tower.d_phi_MPI_PI(m_SeedList.at(j)) << " , " << tower.dR2(m_SeedList.at(j)) << std::endl;
218  if(tower.IsAssocdR(m_SeedList.at(j), m_WTAConeMakerParameter.GetIso_dR2())) // e.g) dR2 < 0.16, association
219  {
220  associate_bit.at(j) = 1;
221  if(m_SeedList.at(j).pt() > MaxPt)
222  {
223  MaxPtIndex = j;
224  MaxPt = m_SeedList.at(j).pt(); // Update the counter
225  }
226  }
227  } // associate_bit filling done
228  return associate_bit;
229 }

◆ GetConstituentList()

const std::vector<WTATrigObj>& WTAConeMaker::GetConstituentList ( ) const
inline

Definition at line 70 of file WTAConeMaker.h.

70 {return m_ConstituentList;}; // Access these lists whenever we need

◆ GetDEBUG()

bool WTAConeMaker::GetDEBUG ( )
inline

Definition at line 86 of file WTAConeMaker.h.

86 {return m_DEBUG;}; // Printout for debug

◆ GetSeedList()

const std::vector<WTAJet>& WTAConeMaker::GetSeedList ( ) const
inline

Definition at line 72 of file WTAConeMaker.h.

72 {return m_SeedList;};

◆ GetSeedSortingList()

const std::vector<WTATrigObj>& WTAConeMaker::GetSeedSortingList ( ) const
inline

Definition at line 71 of file WTAConeMaker.h.

71 {return m_SeedSortingList;};

◆ GetVERBOSE()

bool WTAConeMaker::GetVERBOSE ( )
inline

Definition at line 87 of file WTAConeMaker.h.

87 {return m_VERBOSE;};

◆ InitiateInputs() [1/2]

void WTAConeMaker::InitiateInputs ( const std::vector< IntOrFloat > &  ptVec,
const std::vector< IntOrFloat > &  etaVec,
const std::vector< IntOrFloat > &  phiVec,
const std::vector< IntOrFloat > &  mVec 
)
inline

Definition at line 136 of file WTAConeMaker.h.

137 {
138  std::vector<WTATrigObj> InputTowers = LoadInputs(ptVec, etaVec, phiVec, mVec);
139  FillLists(InputTowers);
140  if(m_VERBOSE)std::cout << "InputN, ConstN, SeedN = " << InputTowers.size() << " , " << m_ConstituentList.size() << " , " << m_SeedSortingList.size() << std::endl;
141 }

◆ InitiateInputs() [2/2]

void WTAConeMaker::InitiateInputs ( const std::vector< WTATrigObj > &  InputTowers)
inline

Definition at line 143 of file WTAConeMaker.h.

144 {
145  FillLists(InputTowers);
146  if(m_VERBOSE)std::cout << "InputN, ConstN, SeedN = " << InputTowers.size() << " , " << m_ConstituentList.size() << " , " << m_SeedSortingList.size() << std::endl;
147 }

◆ InsertToConstList()

void WTAConeMaker::InsertToConstList ( WTATrigObj  obj)
inline

Definition at line 161 of file WTAConeMaker.h.

162 {
163  if(m_WTAConeMakerParameter.GetAddConstFirst())m_ConstituentList.insert(m_ConstituentList.begin(), obj); // Insert obj at the beginnning
164  else m_ConstituentList.push_back(obj); // Insert obj at the end
165 }

◆ LoadInputs()

std::vector< WTATrigObj > WTAConeMaker::LoadInputs ( const std::vector< IntOrFloat > &  ptVec,
const std::vector< IntOrFloat > &  etaVec,
const std::vector< IntOrFloat > &  phiVec,
const std::vector< IntOrFloat > &  mVec 
)
inline

Definition at line 101 of file WTAConeMaker.h.

102 {
103  std::vector<WTATrigObj> input_towers;
104  unsigned int tower_n = ptVec.size();
105  for(unsigned int t = 0; t < tower_n; t++)
106  {
107  WTATrigObj this_tower(ptVec.at(t), etaVec.at(t), phiVec.at(t), mVec.at(t));
108  input_towers.push_back(this_tower);
109  }
110  return input_towers;
111 
112 }

◆ MergeConstsToSeeds()

void WTAConeMaker::MergeConstsToSeeds ( )
inlinevirtual

Reimplemented in WTACone2PassMaker.

Definition at line 282 of file WTAConeMaker.h.

283 {
284  for(auto constituent: m_ConstituentList)
285  {
286  for(unsigned int j = 0; j < m_SeedList.size(); j++) // Assume Seeds are pT sorted, WTA means more energetic jet eats constituent first
287  {
288  IntOrFloat dR2 = constituent.dR2(m_SeedList.at(j));
289  if(dR2 != 0 && constituent.IsAssocdR(m_SeedList.at(j), m_WTAConeMakerParameter.GetJet_dR2())) // Thistime, the condition is m_Jet_dR2, the usual R2Par, **WARNING: dR2!=0 IS TEMPORARY, NEED TO KNOW TOPOTOWER CREATION
290  {
291  m_SeedList.at(j).MergeConstituent(constituent);
292  ResizeThisJetConstituents(m_SeedList.at(j)); // Check JetConstituent N
293  break; // Break the jet loop, move to the next constituent
294  }
295  }
296  }
297 }

◆ PrintSeedList()

void WTAConeMaker::PrintSeedList ( )
inline

Definition at line 149 of file WTAConeMaker.h.

150 {
151  int AllJetConstN = 0;
152  for(const auto& jet: m_SeedList)
153  {
154  AllJetConstN += jet.GetConstituentCount();
155  std::cout << "Jet pT, eta, phi, constN = " << jet.pt() << " , " << jet.eta() << " , " << jet.phi() << " , " << jet.GetConstituentCount() << std::endl;
156  }
157  std::cout << "PrintSeedList..." << " , SeedN, AllJetConstN, ConstN = " << m_SeedList.size() << " , " << AllJetConstN << " , " << m_ConstituentList.size() << std::endl;
158  std::cout << "+++++++++++++++++++++++++" << std::endl;
159 }

◆ ResizeConstituentList()

void WTAConeMaker::ResizeConstituentList ( )
inline

Definition at line 167 of file WTAConeMaker.h.

168 {
169  const unsigned int MaxConstN = m_WTAConeMakerParameter.GetMaxConstN();
170  while(m_ConstituentList.size() > MaxConstN)m_ConstituentList.pop_back();
171 }

◆ ResizeSeedList()

void WTAConeMaker::ResizeSeedList ( )
inline

Definition at line 188 of file WTAConeMaker.h.

189 {
190  const unsigned int MaxSeedN = m_WTAConeMakerParameter.GetMaxSeedN();
191  while(m_SeedList.size() > MaxSeedN)
192  {
194  m_SeedList.pop_back();
195  }
196 }

◆ ResizeSeedNConstLists()

void WTAConeMaker::ResizeSeedNConstLists ( )
inline

Definition at line 64 of file WTAConeMaker.h.

◆ ResizeSeedSortingList()

void WTAConeMaker::ResizeSeedSortingList ( )
inline

Definition at line 173 of file WTAConeMaker.h.

174 {
175  const unsigned int MaxSeedSortingN = m_WTAConeMakerParameter.GetMaxSeedSortingN();
176  while(m_SeedSortingList.size() > MaxSeedSortingN)m_SeedSortingList.pop_back();
177 }

◆ ResizeThisJetConstituents()

void WTAConeMaker::ResizeThisJetConstituents ( WTAJet jet)
inline

Definition at line 179 of file WTAConeMaker.h.

180 {
181  const unsigned int MaxConstPerJetN = m_WTAConeMakerParameter.GetMaxConstPerJetN();
182  while(jet.GetConstituentCount() > MaxConstPerJetN)
183  {
184  jet.PopOutLastConstituent(); // Erase the last constituent, it is NOT appended to the Const list
185  }
186 }

◆ SeedCleaning()

void WTAConeMaker::SeedCleaning ( )
inlinevirtual

Reimplemented in WTACone2PassMaker.

Definition at line 231 of file WTAConeMaker.h.

232 {
233  m_SeedList.clear();
234  if(m_DEBUG)std::cout << "Baseline Seed Cleaning......" << std::endl;
235  for(auto seed: m_SeedSortingList)
236  {
237  int jet_N = m_SeedList.size();
238  if(jet_N == 0)
239  {
240  m_SeedList.push_back(WTATrigObjToWTAJet(seed)); // Take first seed as jet
241  }
242  else
243  {
244  int MaxPtIndex = -1;
245  std::vector<int> associate_bit = GetAssociateBits(seed, MaxPtIndex); // Associate_bit filling done
246  if(std::find(associate_bit.begin(), associate_bit.end(), 1) != associate_bit.end())
247  { // When there is at least one association
248  if(MaxPtIndex == -1)
249  { // Incoming Seed is the highest et, do the seed cleaning
250  WTAJet IncomingSeedAsJet = WTATrigObjToWTAJet(seed);
251  for(int j = jet_N - 1; j >= 0; j--)
252  { // It's important to read bits from the right, lower et jets first
253  if(associate_bit.at(j) == 1)
254  { // If Incoming seed is the highest, and there is an associated old jth jet, pop out jth jet
255  InsertToConstList(WTAJetToWTATrigObj(m_SeedList.at(j))); // Move jth jet to constituent list
256  m_SeedList.erase(m_SeedList.begin() + j); // Then, erase jth jet
257  }
258  }
259  m_SeedList.push_back(IncomingSeedAsJet); // Add this new incoming seed as Jet, well localized protojet
260  }
261  else
262  { // Incoming Seed is not the highest et, add seed to the ConstituentList
263  InsertToConstList(seed);
264  }
265  } // At least one association loop
266  else
267  { // When there is no association
268  WTAJet IncomingSeedAsJet = WTATrigObjToWTAJet(seed);
269  m_SeedList.push_back(IncomingSeedAsJet); // Add seed to the SeedList
270  }
271  } // Main merging loop
272  SortByPt(m_SeedList); // PtSort the SeedList. This is important for Baseline seed cleaning!
273  ResizeSeedNConstLists(); // Resize SeedList, and ConstList
274  if(m_VERBOSE)PrintSeedList(); // Print SeedList, for debug
275  } // seed loop
276  if(m_DEBUG){
277  PrintSeedList();
278  std::cout << "Baseline Seed Cleaning Done......" << std::endl;
279  }
280 }

◆ SetDEBUG()

void WTAConeMaker::SetDEBUG ( )
inline

Definition at line 84 of file WTAConeMaker.h.

84 {m_DEBUG = true;}; // Printout for debug

◆ SetVERBOSE()

void WTAConeMaker::SetVERBOSE ( )
inline

Definition at line 85 of file WTAConeMaker.h.

85 {m_DEBUG = true; m_VERBOSE = true;};

◆ WTAJetToWTATrigObj()

WTATrigObj WTAConeMaker::WTAJetToWTATrigObj ( const WTAJet jet)
inline

Definition at line 204 of file WTAConeMaker.h.

205 {
206  WTATrigObj thisobj(jet.pt(), jet.eta(), jet.phi(), jet.m());
207  return thisobj;
208 }

◆ WTATrigObjToWTAJet()

WTAJet WTAConeMaker::WTATrigObjToWTAJet ( const WTATrigObj obj)
inline

Definition at line 198 of file WTAConeMaker.h.

199 {
200  WTAJet thisjet(obj.pt(), obj.eta(), obj.phi(), obj.m());
201  return thisjet;
202 }

Member Data Documentation

◆ m_ConstituentList

std::vector<WTATrigObj> WTAConeMaker::m_ConstituentList
protected

Definition at line 92 of file WTAConeMaker.h.

◆ m_DEBUG

bool WTAConeMaker::m_DEBUG
protected

Definition at line 96 of file WTAConeMaker.h.

◆ m_SeedList

std::vector<WTAJet> WTAConeMaker::m_SeedList
protected

Definition at line 94 of file WTAConeMaker.h.

◆ m_SeedSortingList

std::vector<WTATrigObj> WTAConeMaker::m_SeedSortingList
protected

Definition at line 93 of file WTAConeMaker.h.

◆ m_VERBOSE

bool WTAConeMaker::m_VERBOSE
protected

Definition at line 97 of file WTAConeMaker.h.

◆ m_WTAConeMakerParameter

WTAParameters WTAConeMaker::m_WTAConeMakerParameter

Definition at line 89 of file WTAConeMaker.h.


The documentation for this class was generated from the following file:
WTAConeMaker::m_ConstituentList
std::vector< WTATrigObj > m_ConstituentList
Definition: WTAConeMaker.h:92
WTAParameters::GetSeedEtCut
IntOrFloat GetSeedEtCut()
Definition: WTAConeMaker.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
WTAConeMaker::WTAJetToWTATrigObj
WTATrigObj WTAJetToWTATrigObj(const WTAJet &jet)
Definition: WTAConeMaker.h:204
WTAConeMaker::ResizeConstituentList
void ResizeConstituentList()
Definition: WTAConeMaker.h:167
WTAConeMaker::GetAssociateBits
std::vector< int > GetAssociateBits(WTATrigObj incoming_seed, int &max_pt_index)
Definition: WTAConeMaker.h:210
WTAParameters::GetJet_dR2
IntOrFloat GetJet_dR2()
Definition: WTAConeMaker.h:33
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
WTAParameters::GetAddConstFirst
bool GetAddConstFirst()
Definition: WTAConeMaker.h:38
WTAConeMaker::m_WTAConeMakerParameter
WTAParameters m_WTAConeMakerParameter
Definition: WTAConeMaker.h:87
WTAConeMaker::ResizeSeedList
void ResizeSeedList()
Definition: WTAConeMaker.h:188
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
WTAConeMaker::ResizeSeedNConstLists
void ResizeSeedNConstLists()
Definition: WTAConeMaker.h:64
WTAConeMaker::m_DEBUG
bool m_DEBUG
Definition: WTAConeMaker.h:96
WTAConeMaker::PrintSeedList
void PrintSeedList()
Definition: WTAConeMaker.h:149
WTAConeMaker::LoadInputs
std::vector< WTATrigObj > LoadInputs(const std::vector< IntOrFloat > &ptVec, const std::vector< IntOrFloat > &etaVec, const std::vector< IntOrFloat > &phiVec, const std::vector< IntOrFloat > &mVec)
Definition: WTAConeMaker.h:101
WTAParameters::GetIso_dR2
IntOrFloat GetIso_dR2()
Definition: WTAConeMaker.h:32
WTAConeMaker::FillLists
virtual void FillLists(const std::vector< WTATrigObj > &InputTowers)
Definition: WTAConeMaker.h:114
WTAConeMaker::ResizeThisJetConstituents
void ResizeThisJetConstituents(WTAJet &jet)
Definition: WTAConeMaker.h:179
WTAParameters::GetConstEtCut
IntOrFloat GetConstEtCut()
Definition: WTAConeMaker.h:30
WTATrigObj
Definition: WTAObject.h:33
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
WTAJet
Definition: WTAObject.h:104
WTAParameters::GetMaxInputTowers
unsigned int GetMaxInputTowers()
Definition: WTAConeMaker.h:39
WTAConeMaker::m_VERBOSE
bool m_VERBOSE
Definition: WTAConeMaker.h:97
WTAConeMaker::InsertToConstList
void InsertToConstList(WTATrigObj obj)
Definition: WTAConeMaker.h:161
JetFilter_JZX.MaxPt
MaxPt
Definition: JetFilter_JZX.py:25
WTAConeMaker::m_SeedSortingList
std::vector< WTATrigObj > m_SeedSortingList
Definition: WTAConeMaker.h:93
WTAConeMaker::m_SeedList
std::vector< WTAJet > m_SeedList
Definition: WTAConeMaker.h:94
python.TriggerHandler.verbose
verbose
Definition: TriggerHandler.py:296
WTAConeMaker::WTATrigObjToWTAJet
WTAJet WTATrigObjToWTAJet(const WTATrigObj &obj)
Definition: WTAConeMaker.h:198
WTAParameters::GetMaxSeedN
unsigned int GetMaxSeedN()
Definition: WTAConeMaker.h:36
python.PyAthena.obj
obj
Definition: PyAthena.py:132
WTAParameters::GetMaxConstPerJetN
unsigned int GetMaxConstPerJetN()
Definition: WTAConeMaker.h:37
WTAParameters::GetMaxSeedSortingN
unsigned int GetMaxSeedSortingN()
Definition: WTAConeMaker.h:35
WTAParameters::GetMaxConstN
unsigned int GetMaxConstN()
Definition: WTAConeMaker.h:34