35 return StatusCode::SUCCESS;
51 PVindex = pvIndexAccessor(*eventInfo);
60 ATH_MSG_WARNING(
"Invalid primary vertex found, will not continue applying the GSC.");
61 return StatusCode::FAILURE;
63 PVindex = HSvertex->
index();
82 std::vector<float> samplingFrac =
jet->getAttribute<std::vector<float> >(
"EnergyPerSampling");
84 float detectorEta =
jet->getAttribute<
float>(
"DetectorEta");
86 float trackWIDTHPVX = 0;
90 trackWIDTHPVX = TrackWidthPt1000Acc(*jet).at(PVindex);
91 ATH_MSG_DEBUG(
"trackWIDTHPVX found set to: " << trackWIDTHPVX);
93 jc.
setValue(
"trackWIDTH", trackWIDTHPVX);
99 nTrkPVX = NumTrkPt1000Acc(*jet).at(PVindex);
104 float ChargedFraction = 0;
108 ChargedFraction = SumPtChargedPFOPt500Acc(*jet).at(PVindex)/jetconstitP4.Pt();
109 ATH_MSG_DEBUG(
"ChargedFraction found set to: " << ChargedFraction);
111 jc.
setValue(
"ChargedFraction", ChargedFraction);
113 float EM3 = (samplingFrac[3]+samplingFrac[7])/jetconstitP4.e();
117 float Tile0 = (samplingFrac[12]+samplingFrac[18])/jetconstitP4.e();
121 double N90Constituents = 0;
125 N90Constituents = N90ConstituentsAcc(*
jet);
126 ATH_MSG_DEBUG(
"N90Constituents found set to: " << N90Constituents);
128 jc.
setValue(
"N90Constituents", N90Constituents);
130 double caloWIDTH = 0;
134 caloWIDTH = WidthAcc(*
jet);
137 jc.
setValue(
"caloWIDTH", caloWIDTH);
139 float TG3 = (samplingFrac[17])/jetconstitP4.e();
147 Nsegments = GhostMuonSegmentCountAcc(*
jet);
150 jc.
setValue(
"Nsegments", Nsegments);
152 float getGSCCorrection = 1.0;
153 int etabin = std::abs(detectorEta)/0.1;
156 jet->setJetP4(startingP4);
167 jet->setJetP4( startingP4*getGSCCorrection );
169 jet->setJetP4( startingP4*getGSCCorrection );
171 jet->setJetP4( startingP4*getGSCCorrection );
173 jet->setJetP4( startingP4*getGSCCorrection );
177 jet->setJetP4( startingP4*getGSCCorrection );
184 jet->setJetP4( startingP4*getGSCCorrection );
191 return StatusCode::SUCCESS;
195 if (jc.
getValue<
float>(
"ChargedFraction")<=0)
return 1;
198 return ChargedFractionResponse;
202 if (jc.
getValue<
float>(
"Tile0")<0)
return 1;
205 return Tile0Response;
209 if (jc.
getValue<
float>(
"EM3")<=0)
return 1;
218 ATH_MSG_WARNING(
"Please check that the punch through eta binning is properly set in your config file");
224 ATH_MSG_WARNING(
"There was a problem determining the eta bin to use for the punch through correction.");
229 if(PunchThroughResponse>1)
return 1;
230 return PunchThroughResponse;
234 if (jc.
getValue<
int>(
"nTrk")<=0)
return 1;
241 if (jc.
getValue<
float>(
"trackWIDTH")<=0)
return 1;
245 return trackWIDTHResponse;
251 ATH_MSG_VERBOSE(
"GSCCalibStep " << name() <<
" Found HS vertex at index: "<< vertex->index());
255 if (vertices.
size()==1) {
256 ATH_MSG_VERBOSE(
"GSCCalibStep " << name() <<
" Found no HS vertex, return dummy");
258 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.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo_key
EventInfo to retrieve PV index for analyses choosing their own PV (e.g. H to yy)
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
SG::ConstAccessor< T, ALLOC > ConstAccessor
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.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
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.