47 return StatusCode::SUCCESS;
59 static const SG::AuxElement::ConstAccessor<int> pvIndexAccessor(
"PVIndex");
62 if(pvIndexAccessor.isAvailable(*eventInfo)){
63 PVindex = pvIndexAccessor(*eventInfo);
72 ATH_MSG_WARNING(
"Invalid primary vertex found, will not continue applying the GSC.");
73 return StatusCode::FAILURE;
75 PVindex = HSvertex->index();
94 float trackWIDTHPVX = 0;
98 trackWIDTHPVX = TrackWidthPt1000Acc(*jet).at(PVindex);
99 ATH_MSG_DEBUG(
"trackWIDTHPVX found set to: " << trackWIDTHPVX);
101 jc.
setValue(
"trackWIDTH", trackWIDTHPVX);
108 nTrkPVX = NumTrkPt1000Acc(*jet).at(PVindex);
115 float ChargedFraction = 0;
119 ChargedFraction = SumPtChargedPFOPt500Acc(*jet).at(PVindex)/jetconstitP4.Pt();
120 ATH_MSG_DEBUG(
"ChargedFraction found set to: " << ChargedFraction);
122 jc.
setValue(
"ChargedFraction", ChargedFraction);
124 std::vector<float> samplingFrac =
jet->getAttribute<std::vector<float> >(
"EnergyPerSampling");
126 float EM3 = (samplingFrac[3]+samplingFrac[7])/jetconstitP4.e();
130 float Tile0 = (samplingFrac[12]+samplingFrac[18])/jetconstitP4.e();
139 Nsegments = GhostMuonSegmentCountAcc(*
jet);
142 jc.
setValue(
"Nsegments", Nsegments);
144 float getGSCCorrection = 1.0;
147 float detectorEta =
jet->getAttribute<
float>(
"DetectorEta");
148 int etabin = std::abs(detectorEta)/0.1;
151 jet->setJetP4(startingP4);
163 jet->setJetP4( startingP4*getGSCCorrection );
167 jet->setJetP4( startingP4*getGSCCorrection );
171 jet->setJetP4( startingP4*getGSCCorrection );
175 jet->setJetP4( startingP4*getGSCCorrection );
179 jet->setJetP4( startingP4*getGSCCorrection );
182 jet->setJetP4( startingP4*getGSCCorrection );
189 jet->setJetP4( startingP4*getGSCCorrection );
195 return StatusCode::SUCCESS;
199 if (jc.
getValue<
float>(
"ChargedFraction")<=0)
return 1;
202 return ChargedFractionResponse;
206 if (jc.
getValue<
float>(
"Tile0")<0)
return 1;
209 return Tile0Response;
213 if (jc.
getValue<
float>(
"EM3")<=0)
return 1;
222 ATH_MSG_WARNING(
"Please check that the punch through eta binning is properly set in your config file");
228 ATH_MSG_WARNING(
"There was a problem determining the eta bin to use for the punch through correction.");
233 if(PunchThroughResponse>1)
return 1;
234 return PunchThroughResponse;
238 if (jc.
getValue<
int>(
"nTrk")<=0)
return 1;
245 if (jc.
getValue<
float>(
"trackWIDTH")<=0)
return 1;
249 return trackWIDTHResponse;
255 ATH_MSG_VERBOSE(
"GSCCalibStep " << name() <<
" Found HS vertex at index: "<< vertex->index());
259 if (vertices.
size()==1) {
260 ATH_MSG_VERBOSE(
"GSCCalibStep " << name() <<
" Found no HS vertex, return dummy");
262 return vertices.
back();
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(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< bool > m_applyEM3
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).
Gaudi::Property< bool > m_applyTile0
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
Gaudi::Property< bool > m_applyNtrk
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
Gaudi::Property< bool > m_applyTrackWidth
Gaudi::Property< bool > m_applyChargedFraction
Booleans to apply calibration steps:
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,...
void getValue(std::string_view name, T &value) const
bool setValue(std::string_view name, const T value, bool allowOverwrite=false)
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.