 |
ATLAS Offline Software
|
Go to the documentation of this file.
19 #include "fastjet/ClusterSequence.hh"
20 #include "fastjet/ClusterSequenceArea.hh"
21 #include <fastjet/AreaDefinition.hh>
53 ATH_MSG_ERROR(
"JetForwardPFlowJvtTool needs to have its input jet container configured!");
54 return StatusCode::FAILURE;
88 #ifndef XAOD_STANDALONE
94 return StatusCode::SUCCESS;
98 std::vector<TVector2> pileupMomenta;
104 if(pileupMomenta.empty()) {
105 ATH_MSG_DEBUG(
"pileupMomenta is empty, this can happen for events with no PU vertices."
106 <<
" fJVT won't be computed for this event and will be set to 0 instead." );
108 fjvtHandle(*jetF) = 1;
109 fjvtRawHandle(*jetF) = 0;
111 return StatusCode::SUCCESS;
115 fjvtHandle(*jetF) = 1;
116 fjvtRawHandle(*jetF) = 0;
119 double fjvt =
getFJVT(jetF,pileupMomenta);
121 fjvtRawHandle(*jetF) = fjvt;
124 return StatusCode::SUCCESS;
130 for (
const TVector2&
pu : pileupMomenta) {
131 double projection =
pu*fjet/fjet.Mod();
132 if (projection<fjvt) fjvt = projection;
134 return -1*fjvt/fjet.Mod();
138 int pvind,
int vertices)
const {
139 std::vector<TVector2> pileupMomenta;
141 const std::size_t pv_index = (pvind==-1) ?
getPV() : std::size_t(pvind);
147 if(vx->index()==(
size_t)pv_index)
continue;
150 jname += vx->index();
154 ATH_MSG_WARNING(
" Some issue appeared while building the pflow pileup jets for vertex "
155 << vx->index() <<
" (vxType = " << vx->vertexType()<<
" )!" );
156 return pileupMomenta;
176 pileupMomenta.push_back(vertex_met);
177 if(vertices!=-1 &&
int(vx->index())==vertices)
break;
179 return pileupMomenta;
184 char jet_nnjvtpass=
false;
186 jet_nnjvtpass = passJvtHandle(*pjet);
187 if (pjet->p4().DeltaR(
jet->p4())<0.3 && jet_nnjvtpass &&
isCentralJet(pjet) )
return true;
196 std::vector<fastjet::PseudoJet> input_pfo;
197 std::set<int> charged_pfo;
202 ATH_MSG_ERROR(
"Could not retrieve the TrackVertexAssociation: "
213 if (!orHandle(*fe))
continue;
215 if (fe->isCharged()) {
220 if (vx.
index()!=pv_index
225 charged_pfo.insert(fe->index());
227 else if (std::abs(fe->eta())<
m_neutMaxRap && !fe->isCharged() && fe->e()>0)
239 if (!orHandle(*pfo))
continue;
241 if (pfo->isCharged()) {
242 if (vx.
index()==pv_index && std::abs((vx.
z()-pfo->track(0)->z0())*
sin(pfo->track(0)->theta()))>
m_dzCut)
244 if (vx.
index()!=pv_index
249 charged_pfo.insert(pfo->index());
251 else if (std::abs(pfo->eta())<
m_neutMaxRap && !pfo->isCharged() && pfo->eEM()>0)
258 std::shared_ptr<xAOD::JetContainer> vertjets = std::make_shared<xAOD::JetContainer>();
259 std::shared_ptr<xAOD::JetAuxContainer> vertjetsAux = std::make_shared<xAOD::JetAuxContainer>();
261 vertjets->setStore(vertjetsAux.get());
266 std::vector<int> seeds;
268 if (!evtInfoHandle.isValid())
276 fastjet::AreaDefinition area_def(fastjet::active_area_explicit_ghosts,
277 fastjet::GhostedAreaSpec(fastjet::SelectorAbsRapMax(
m_maxRap)));
278 area_def = area_def.with_fixed_seed(seeds);
279 fastjet::ClusterSequenceArea clust_pfo(input_pfo,jet_def,area_def);
280 std::vector<fastjet::PseudoJet> inclusive_jets = sorted_by_pt(clust_pfo.inclusive_jets(5000.));
282 for (
size_t i = 0;
i < inclusive_jets.size();
i++) {
285 inclusive_jets[
i].
eta(),
286 inclusive_jets[
i].
phi(),
287 inclusive_jets[
i].
m());
289 inclusive_jets[
i].area_4vector().
eta(),
290 inclusive_jets[
i].area_4vector().
phi(),
291 inclusive_jets[
i].area_4vector().
m());
293 jet->setJetP4(tempjetp4);
294 jet->setJetP4(
"JetConstitScaleMomentum",tempjetp4);
295 jet->setJetP4(
"JetPileupScaleMomentum",tempjetp4);
296 jet->setAttribute(
"ActiveArea4vec",newArea);
297 jet->setAttribute(
"DetectorEta",
jet->eta());
298 std::vector<fastjet::PseudoJet> constituents = inclusive_jets[
i].constituents();
299 float chargedpart = 0;
300 for (
size_t j = 0; j < constituents.size(); j++) {
301 if (charged_pfo.count(constituents[j].user_index())>=1) {
302 chargedpart += constituents[j].perp();
309 if((
m_pfoJES->modify(*vertjets)).isFailure()){
320 TLorentzVector pfo_p4;
323 if( (
m_wpfotool->fillWeight(*pfo,pweight)).isSuccess() ){
325 pfo_p4= TLorentzVector(pfo->
p4().Px()*pweight,pfo->
p4().Py()*pweight,pfo->
p4().Pz()*pweight,pfo->
e()*pweight);
330 fastjet::PseudoJet psj(pfo_p4);
333 psj.set_user_index(pfo->
index());
335 psj.set_user_index(-1);
342 TLorentzVector fe_p4;
345 if( (
m_wpfotool->fillWeight(*fe,pweight)).isSuccess() ){
347 fe_p4= TLorentzVector(fe->
p4().Px()*pweight,fe->
p4().Py()*pweight,fe->
p4().Pz()*pweight,fe->
e()*pweight);
352 fastjet::PseudoJet psj(fe_p4);
355 psj.set_user_index(fe->
index());
357 psj.set_user_index(-1);
386 ATH_MSG_DEBUG(
"Successfully retrieved primary vertex container");
391 if(vxContHandle->empty() ){
393 }
else if(vxContHandle->size() != 1 ){
394 ATH_MSG_WARNING(
"Couldn't identify the hard-scatter primary vertex (no vertex with \"vx->vertexType()==xAOD::VxType::PriVtx\" in the container)! ");
408 for(
const xAOD::Jet *tjet : *truthJets) {
409 if (tjet->p4().DeltaR(
jet->p4())<0.3 && tjet->pt()>10
e3) ishs =
true;
410 if (tjet->p4().DeltaR(
jet->p4())<0.6) ispu =
false;
412 isHSHandle(*
jet)=ishs;
413 isPUHandle(*
jet)=ispu;
415 return StatusCode::SUCCESS;
std::shared_ptr< xAOD::JetAuxContainer > jetAuxCont
Scalar phi() const
phi method
Scalar perp() const
perp method - perpenticular length
Scalar eta() const
pseudorapidity method
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
const std::string & key() const
Return the StoreGate ID for the referenced object.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
virtual double e() const
The total energy of the particle.
std::shared_ptr< xAOD::JetContainer > jetCont
Handle class for reading a decoration on an object.
::StatusCode StatusCode
StatusCode definition for legacy code.
Handle class for adding a decoration to an object.
void seedsFromEventInfo(const xAOD::EventInfo *ei, std::vector< int > &seeds)
Fill seeds vector from run & event number. This functio is separated from the class so it's easier to...
virtual FourMom_t p4() const
The full 4-momentum of the particle.
float z() const
Returns the z position.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
size_t index() const
Return the index of this element within its container.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const xAOD::Vertex * associatedVertex(const xAOD::TrackParticle *trk) const
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Class describing a particle flow object.
virtual double e() const override
The total energy of the particle.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
virtual FourMom_t p4() const override
The full 4-momentum of the particle.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Class describing a Vertex.
#define ATH_MSG_WARNING(x)
Class describing a TrackParticle.
TLorentzVector GetVertexCorrectedEMFourVec(const xAOD::Vertex &vertexToCorrectTo) const
Correct EM scale 4-vector to point at a vertex.
TLorentzVector getVertexCorrectedFourVec(const xAOD::FlowElement &fe, const xAOD::Vertex &vertexToCorrectTo)
Jet_v1 Jet
Definition of the current "jet version".
A detector object made of other lower level object(s)