35 return StatusCode::SUCCESS;
47 static const SG::AuxElement::ConstAccessor<int> pvIndexAccessor(
"PVIndex");
50 if(pvIndexAccessor.isAvailable(*eventInfo)){
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 float trackWIDTHPVX = 0;
86 trackWIDTHPVX = TrackWidthPt1000Acc(*jet).at(PVindex);
87 ATH_MSG_DEBUG(
"trackWIDTHPVX found set to: " << trackWIDTHPVX);
89 jc.
setValue(
"trackWIDTH", trackWIDTHPVX);
96 nTrkPVX = NumTrkPt1000Acc(*jet).at(PVindex);
103 float ChargedFraction = 0;
107 ChargedFraction = SumPtChargedPFOPt500Acc(*jet).at(PVindex)/jetconstitP4.Pt();
108 ATH_MSG_DEBUG(
"ChargedFraction found set to: " << ChargedFraction);
110 jc.
setValue(
"ChargedFraction", ChargedFraction);
112 std::vector<float> samplingFrac =
jet->getAttribute<std::vector<float> >(
"EnergyPerSampling");
114 float EM3 = (samplingFrac[3]+samplingFrac[7])/jetconstitP4.e();
118 float Tile0 = (samplingFrac[12]+samplingFrac[18])/jetconstitP4.e();
127 Nsegments = GhostMuonSegmentCountAcc(*
jet);
130 jc.
setValue(
"Nsegments", Nsegments);
132 float getGSCCorrection = 1.0;
135 float detectorEta =
jet->getAttribute<
float>(
"DetectorEta");
136 int etabin = std::abs(detectorEta)/0.1;
139 jet->setJetP4(startingP4);
150 jet->setJetP4( startingP4*getGSCCorrection );
152 jet->setJetP4( startingP4*getGSCCorrection );
154 jet->setJetP4( startingP4*getGSCCorrection );
156 jet->setJetP4( startingP4*getGSCCorrection );
159 jet->setJetP4( startingP4*getGSCCorrection );
166 jet->setJetP4( startingP4*getGSCCorrection );
173 return StatusCode::SUCCESS;
177 if (jc.
getValue<
float>(
"ChargedFraction")<=0)
return 1;
180 return ChargedFractionResponse;
184 if (jc.
getValue<
float>(
"Tile0")<0)
return 1;
187 return Tile0Response;
191 if (jc.
getValue<
float>(
"EM3")<=0)
return 1;
200 ATH_MSG_WARNING(
"Please check that the punch through eta binning is properly set in your config file");
206 ATH_MSG_WARNING(
"There was a problem determining the eta bin to use for the punch through correction.");
211 if(PunchThroughResponse>1)
return 1;
212 return PunchThroughResponse;
216 if (jc.
getValue<
int>(
"nTrk")<=0)
return 1;
223 if (jc.
getValue<
float>(
"trackWIDTH")<=0)
return 1;
227 return trackWIDTHResponse;
233 ATH_MSG_VERBOSE(
"GSCCalibStep " << name() <<
" Found HS vertex at index: "<< vertex->index());
237 if (vertices.
size()==1) {
238 ATH_MSG_VERBOSE(
"GSCCalibStep " << name() <<
" Found no HS vertex, return dummy");
240 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
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.