34 return StatusCode::SUCCESS;
47 ATH_MSG_WARNING(
"Invalid primary vertex found, will not continue applying the GSC.");
48 return StatusCode::FAILURE;
50 int PVindex = HSvertex->
index();
59 std::vector<float> samplingFrac =
jet->getAttribute<std::vector<float> >(
"EnergyPerSampling");
61 float detectorEta =
jet->getAttribute<
float>(
"DetectorEta");
63 float trackWIDTHPVX = 0;
67 trackWIDTHPVX = TrackWidthPt1000Acc(*jet).at(PVindex);
68 ATH_MSG_DEBUG(
"trackWIDTHPVX found set to: " << trackWIDTHPVX);
70 jc.
setValue(
"trackWIDTH", trackWIDTHPVX);
76 nTrkPVX = NumTrkPt1000Acc(*jet).at(PVindex);
81 float ChargedFraction = 0;
85 ChargedFraction = SumPtChargedPFOPt500Acc(*jet).at(PVindex)/jetconstitP4.Pt();
86 ATH_MSG_DEBUG(
"ChargedFraction found set to: " << ChargedFraction);
88 jc.
setValue(
"ChargedFraction", ChargedFraction);
90 float EM3 = (samplingFrac[3]+samplingFrac[7])/jetconstitP4.e();
94 float Tile0 = (samplingFrac[12]+samplingFrac[18])/jetconstitP4.e();
98 double N90Constituents = 0;
102 N90Constituents = N90ConstituentsAcc(*
jet);
103 ATH_MSG_DEBUG(
"N90Constituents found set to: " << N90Constituents);
105 jc.
setValue(
"N90Constituents", N90Constituents);
107 double caloWIDTH = 0;
111 caloWIDTH = WidthAcc(*
jet);
114 jc.
setValue(
"caloWIDTH", caloWIDTH);
116 float TG3 = (samplingFrac[17])/jetconstitP4.e();
124 Nsegments = GhostMuonSegmentCountAcc(*
jet);
127 jc.
setValue(
"Nsegments", Nsegments);
129 float getGSCCorrection = 1.0;
130 int etabin = std::abs(detectorEta)/0.1;
133 jet->setJetP4(startingP4);
144 jet->setJetP4( startingP4*getGSCCorrection );
146 jet->setJetP4( startingP4*getGSCCorrection );
148 jet->setJetP4( startingP4*getGSCCorrection );
150 jet->setJetP4( startingP4*getGSCCorrection );
154 jet->setJetP4( startingP4*getGSCCorrection );
161 jet->setJetP4( startingP4*getGSCCorrection );
168 return StatusCode::SUCCESS;
172 if (jc.
getValue<
float>(
"ChargedFraction")<=0)
return 1;
175 return ChargedFractionResponse;
179 if (jc.
getValue<
float>(
"Tile0")<0)
return 1;
182 return Tile0Response;
186 if (jc.
getValue<
float>(
"EM3")<=0)
return 1;
195 ATH_MSG_WARNING(
"Please check that the punch through eta binning is properly set in your config file");
201 ATH_MSG_WARNING(
"There was a problem determining the eta bin to use for the punch through correction.");
206 if(PunchThroughResponse>1)
return 1;
207 return PunchThroughResponse;
211 if (jc.
getValue<
int>(
"nTrk")<=0)
return 1;
218 if (jc.
getValue<
float>(
"trackWIDTH")<=0)
return 1;
222 return trackWIDTHResponse;
228 ATH_MSG_VERBOSE(
"GSCCalibStep " << name() <<
" Found HS vertex at index: "<< vertex->index());
232 if (vertices.
size()==1) {
233 ATH_MSG_VERBOSE(
"GSCCalibStep " << name() <<
" Found no HS vertex, return dummy");
235 return vertices.
back();
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
const T * back() const
Access the last element in the collection as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
float getPunchThroughResponse(const xAOD::Jet &jet, const JetHelper::JetContext &jc, double eta_det) const
Gaudi::Property< std::vector< double > > m_punchThroughEtaBins
ToolHandleArray< JetHelper::IVarTool > m_histTool_ChargedFraction
virtual StatusCode calibrate(xAOD::JetContainer &) const override
Apply calibration to a jet container.
ToolHandleArray< JetHelper::IVarTool > m_histTool_trackWIDTH
float getNTrkResponse(const xAOD::Jet &jet, const JetHelper::JetContext &jc, uint etabin) const
Gaudi::Property< std::string > m_jetInScale
ToolHandleArray< JetHelper::IVarTool > m_histTool_EM3
float getTile0Response(const xAOD::Jet &jet, const JetHelper::JetContext &jc, uint etabin) const
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer_key
Gaudi::Property< std::string > m_jetOutScale
const xAOD::Vertex * findHSVertex(const xAOD::VertexContainer &vertices) const
Retrieve hard scatter vertex for its index. Return nullptr if one cannot be found.
float getEM3Response(const xAOD::Jet &jet, const JetHelper::JetContext &jc, uint etabin) const
ToolHandleArray< JetHelper::IVarTool > m_histTool_Tile0
float getTrackWIDTHResponse(const xAOD::Jet &jet, const JetHelper::JetContext &jc, uint etabin) const
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
ToolHandleArray< JetHelper::IVarTool > m_histTool_PunchThrough
ToolHandleArray< JetHelper::IVarTool > m_histTool_nTrk
float getChargedFractionResponse(const xAOD::Jet &jet, const JetHelper::JetContext &jc, uint etabin) const
Functions for retrieving the correction factors.
Gaudi::Property< float > m_punchThroughMinPt
Gaudi::Property< bool > m_applyPunchThrough
Properties for the punch-through correction:
GSCCalibStep(const std::string &name="GSCCalibStep")
Constructor with parameters:
Class JetContext Designed to read AOD information related to the event, N vertices,...
bool setValue(const std::string &name, const T value, bool allowOverwrite=false)
void getValue(const std::string &name, T &value) const
size_t index() const
Return the index of this element within its container.
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
VxType::VertexType vertexType() const
The type of the vertex.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
Jet_v1 Jet
Definition of the current "jet version".
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
JetContainer_v1 JetContainer
Definition of the current "jet container version".
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.