ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Gep::ModAntikTJetMaker Class Reference

#include <ModAntikTJetMaker.h>

Inheritance diagram for Gep::ModAntikTJetMaker:
Collaboration diagram for Gep::ModAntikTJetMaker:

Public Member Functions

 ModAntikTJetMaker (const std::string &alg="ModAntikT", int nIter=10000, float jetR=0.4)
 
virtual std::vector< Gep::JetmakeJets (const std::vector< Gep::Cluster > &clusters) const override
 
virtual std::string toString () const override
 
void setName (const std::string &jetAlg)
 
void setNIter (int nIter)
 
void setJetR (float jetR)
 

Private Attributes

std::string m_jetAlg
 
int m_nIter
 
float m_jetR
 

Detailed Description

Definition at line 14 of file ModAntikTJetMaker.h.

Constructor & Destructor Documentation

◆ ModAntikTJetMaker()

Gep::ModAntikTJetMaker::ModAntikTJetMaker ( const std::string &  alg = "ModAntikT",
int  nIter = 10000,
float  jetR = 0.4 
)
inline

Definition at line 19 of file ModAntikTJetMaker.h.

19  :
20  m_jetAlg{alg},
21  m_nIter{nIter},
22  m_jetR{jetR} {}

Member Function Documentation

◆ makeJets()

std::vector< Gep::Jet > Gep::ModAntikTJetMaker::makeJets ( const std::vector< Gep::Cluster > &  clusters) const
overridevirtual

Implements Gep::IJetMaker.

Definition at line 10 of file ModAntikTJetMaker.cxx.

10  {
11 
12  std::vector<Gep::Cluster> constituents = clusters;
13 
14  std::vector<Gep::Jet> v_jets;
15 
16  const unsigned int n_constituents = constituents.size();
17  std::vector< std::vector<int> > v_constitutents_in_jet_indices(n_constituents, std::vector<int>() );
18  // initialize vector of constituents with it's own index
19  for(unsigned int i = 0; i < n_constituents; i++){ v_constitutents_in_jet_indices.at(i).push_back(i); }
20 
21  int niter = 0;
22 
23  //Iterate over clusters
24  while(!constituents.empty() && niter < m_nIter){
25 
26  const unsigned int n_clusters = constituents.size();
27 
28  //create factorized separation list
29  std::vector< std::vector< float > > DeltaR2(n_clusters, std::vector< float >(n_clusters, 0.0));
30  std::vector< float > InvPt2 (n_clusters, 0.0);
31  for (unsigned int i = 0; i < n_clusters; i++){
32  InvPt2[i] = 1/constituents.at(i).vec.Perp2();
33  DeltaR2[i][i] = 1.0;
34  for(unsigned int j = i+1; j < n_clusters; j++){
35  float deltaEta = constituents.at(i).vec.Eta() - constituents.at(j).vec.Eta();
36  float deltaPhi = constituents.at(i).vec.DeltaPhi(constituents.at(j).vec);
37  DeltaR2[i][j] = (deltaEta*deltaEta + deltaPhi*deltaPhi)/(m_jetR*m_jetR);
38  DeltaR2[j][i] = (deltaEta*deltaEta + deltaPhi*deltaPhi)/(m_jetR*m_jetR);
39  }
40  }
41 
42 
43  // indices of minimum DeltaR in i-th row (aka j in d_ij)
44  std::vector< int > minDeltaR2_indices(n_clusters, 0.0);
45  for (unsigned int i = 0; i < n_clusters; i++ ) {
46  minDeltaR2_indices[i] = std::distance( DeltaR2[i].begin(), std::min_element(std::begin(DeltaR2[i]), std::end(DeltaR2[i])) );
47  }
48 
49  //d_ij vector of with minDeltaR2_indices_ij
50  std::vector< float > InvPt2DeltaR2(n_clusters, 0.0);
51  for (unsigned int i = 0; i < n_clusters; i++ ) InvPt2DeltaR2[i] = InvPt2[i]*DeltaR2[i][minDeltaR2_indices[i]];
52 
53  // index of minimum d_ij (aka i in d_ij)
54  int minInvPt2DeltaR2_index = std::distance(InvPt2DeltaR2.begin() , std::min_element(std::begin(InvPt2DeltaR2), std::end(InvPt2DeltaR2)) );
55 
56  // if d_ij < diB, merge j into i, otherwise i is jet
57  if (InvPt2DeltaR2[minInvPt2DeltaR2_index] < InvPt2[minInvPt2DeltaR2_index]){
58  //This is the WTA pt merging scheme
59  // only momentum components are modified
60  TVector3 momentum_vector(constituents.at(minInvPt2DeltaR2_index).vec.Px() + constituents.at(minDeltaR2_indices[minInvPt2DeltaR2_index]).vec.Px(),
61  constituents.at(minInvPt2DeltaR2_index).vec.Py() + constituents.at(minDeltaR2_indices[minInvPt2DeltaR2_index]).vec.Py(),
62  constituents.at(minInvPt2DeltaR2_index).vec.Pz() + constituents.at(minDeltaR2_indices[minInvPt2DeltaR2_index]).vec.Pz());
63 
64  //px, py and pz are recalculated from pt, eta and phi, leaving eta and phi unchanged
65  constituents.at(minInvPt2DeltaR2_index).vec.SetPtEtaPhiE(momentum_vector.Pt(),
66  constituents.at(minInvPt2DeltaR2_index).vec.Eta(),
67  constituents.at(minInvPt2DeltaR2_index).vec.Phi(),
68  momentum_vector.Mag() );
69 
70  // add indices in j to lilst of constituents of subjet i
71  v_constitutents_in_jet_indices.at(minInvPt2DeltaR2_index).insert( v_constitutents_in_jet_indices.at(minInvPt2DeltaR2_index).end(),
72  v_constitutents_in_jet_indices.at(minDeltaR2_indices[minInvPt2DeltaR2_index]).begin(),
73  v_constitutents_in_jet_indices.at(minDeltaR2_indices[minInvPt2DeltaR2_index]).end() );
74 
75  constituents.erase(constituents.begin() + minDeltaR2_indices[minInvPt2DeltaR2_index]);
76  v_constitutents_in_jet_indices.erase(v_constitutents_in_jet_indices.begin() + minDeltaR2_indices[minInvPt2DeltaR2_index]);
77  } else {
78 
79  //create custom jet based on constituents.at(minInvPt2DeltaR2_index)
80  Gep::Jet jet;
81  jet.vec.SetXYZT(constituents.at(minInvPt2DeltaR2_index).vec.Px(), constituents.at(minInvPt2DeltaR2_index).vec.Py(),
82  constituents.at(minInvPt2DeltaR2_index).vec.Pz(), constituents.at(minInvPt2DeltaR2_index).vec.E());
83  jet.constituentsIndices.insert( jet.constituentsIndices.end(),
84  v_constitutents_in_jet_indices.at( minInvPt2DeltaR2_index).begin(),
85  v_constitutents_in_jet_indices.at( minInvPt2DeltaR2_index).end());
86 
87  v_jets.push_back(jet);
88 
89  constituents.erase(constituents.begin() + minInvPt2DeltaR2_index);
90  v_constitutents_in_jet_indices.erase(v_constitutents_in_jet_indices.begin() + minDeltaR2_indices[minInvPt2DeltaR2_index]);
91 
92  }
93 
94  niter++;
95  }
96 
97  return v_jets;
98 }

◆ setJetR()

void Gep::ModAntikTJetMaker::setJetR ( float  jetR)
inline

Definition at line 30 of file ModAntikTJetMaker.h.

30 { m_jetR = jetR;}

◆ setName()

void Gep::ModAntikTJetMaker::setName ( const std::string &  jetAlg)
inline

Definition at line 27 of file ModAntikTJetMaker.h.

27 { m_jetAlg = jetAlg;}

◆ setNIter()

void Gep::ModAntikTJetMaker::setNIter ( int  nIter)
inline

Definition at line 29 of file ModAntikTJetMaker.h.

29 { m_nIter = nIter;}

◆ toString()

std::string Gep::ModAntikTJetMaker::toString ( ) const
overridevirtual

Implements Gep::IJetMaker.

Definition at line 101 of file ModAntikTJetMaker.cxx.

101  {
102 
103  std::stringstream ss;
104  ss << "ModAntikTJetMaker. iterations: " << m_nIter
105  << " rad: " << m_jetR;
106  return ss.str();
107 }

Member Data Documentation

◆ m_jetAlg

std::string Gep::ModAntikTJetMaker::m_jetAlg
private

Definition at line 35 of file ModAntikTJetMaker.h.

◆ m_jetR

float Gep::ModAntikTJetMaker::m_jetR
private

Definition at line 39 of file ModAntikTJetMaker.h.

◆ m_nIter

int Gep::ModAntikTJetMaker::m_nIter
private

Definition at line 38 of file ModAntikTJetMaker.h.


The documentation for this class was generated from the following files:
SGout2dot.alg
alg
Definition: SGout2dot.py:243
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
Gep::ModAntikTJetMaker::m_jetR
float m_jetR
Definition: ModAntikTJetMaker.h:39
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
P4Helpers::deltaEta
double deltaEta(const I4Momentum &p1, const I4Momentum &p2)
Computes efficiently .
Definition: P4Helpers.h:66
lumiFormat.i
int i
Definition: lumiFormat.py:85
Gep::Jet
Definition: Trigger/TrigT1/TrigGepPerf/src/Jet.h:12
Gep::ModAntikTJetMaker::m_nIter
int m_nIter
Definition: ModAntikTJetMaker.h:38
Gep::ModAntikTJetMaker::m_jetAlg
std::string m_jetAlg
Definition: ModAntikTJetMaker.h:35
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54