Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
62 if ( jetAlgo.EqualTo(
"") || calibSeq.EqualTo(
"") ) {
63 ATH_MSG_FATAL(
"JetCalibrationTool::initialize : At least one of your constructor arguments is not set. Did you use the copy constructor?");
64 return StatusCode::FAILURE;
67 if (
m_config.empty() ) {
ATH_MSG_FATAL(
"No configuration file specified.");
return StatusCode::FAILURE; }
73 dir =
"JetCalibTools/";
75 else{
dir.insert(14,calibPath);}
87 if ( calibSeq.Contains(
"JetArea") ) {
91 else {
ATH_MSG_FATAL(
"jetAlgo " << jetAlgo <<
" not recognized.");
return StatusCode::FAILURE; }
99 std::string rhoKey_config =
m_globalConfig->GetValue(
"RhoKey",
"None");
101 bool requireRhoInput =
false;
104 if ( !calibSeq.Contains(
"JetArea") && !calibSeq.Contains(
"Residual") ) {
107 }
else if ( calibSeq.Contains(
"JetArea") ) {
108 if (
m_rhoKey.key().compare(
"auto") == 0 && rhoKey_config.compare(
"None") == 0) {
119 else if(rhoKey_config.compare(
"None") != 0 &&
m_rhoKey.key().compare(
"auto") == 0){
122 requireRhoInput =
true;
123 if ( !calibSeq.Contains(
"Residual") )
m_doResidual =
false;
124 }
else if ( !calibSeq.Contains(
"JetArea") && calibSeq.Contains(
"Residual") ) {
126 ATH_MSG_INFO(
"ApplyOnlyResidual should be true if only Residual pile up correction wants to be applied. Need to specify pile up starting scale in the configuration file.");
132 "HLT_xAOD__JetContainer_a4tcemsubjesISFS");
134 if ( !calibSeq.Contains(
"Origin") )
m_doOrigin =
false;
135 if ( !calibSeq.Contains(
"GSC") && !calibSeq.Contains(
"GNNC"))
m_doGSC =
false;
136 if ( !calibSeq.Contains(
"Bcid") )
m_doBcid =
false;
137 if ( calibSeq.Contains(
"DNN") )
m_doDNNCal =
true;
140 if ( calibSeq.Contains(
"Insitu") && !
m_isData ) {
141 ATH_MSG_FATAL(
"JetCalibrationTool::initialize : calibSeq string contains Insitu with isData set to false. Can't apply in-situ correction to MC!!");
142 return StatusCode::FAILURE;
160 TEnv *globalConfig_insitu =
new TEnv();
161 int status = globalConfig_insitu->ReadFile(fn_insitu ,EEnvLevel(0));
162 if (
status!=0) {
ATH_MSG_FATAL(
"Cannot read config file " << fn_insitu );
return StatusCode::FAILURE; }
180 TEnv *globalInsituCombMass =
new TEnv();
181 int status = globalInsituCombMass->ReadFile(fn_comb ,EEnvLevel(0));
182 if (
status!=0) {
ATH_MSG_FATAL(
"Cannot read config file " << fn_comb );
return StatusCode::FAILURE; }
190 for (
unsigned int i=0;
i<vecCalibSeq.size(); ++
i) {
191 if ( vecCalibSeq[
i].EqualTo(
"Origin") || vecCalibSeq[
i].EqualTo(
"DEV") )
continue;
192 if ( vecCalibSeq[
i].EqualTo(
"Residual") &&
m_doJetArea )
continue;
205 ATH_MSG_ERROR(
"Residual calibration requested but no primary vertex container specified!");
206 return StatusCode::FAILURE;
209 if(
m_jetAlgo.find(
"PFlow")!=std::string::npos) {
210 ATH_MSG_ERROR(
"GSC calibration for PFlow requested but no primary vertex container specified!");
211 return StatusCode::FAILURE;
214 ATH_MSG_ERROR(
"GSC calibration with tracks requested but no primary vertex container specified!");
215 return StatusCode::FAILURE;
223 return StatusCode::SUCCESS;
230 if ( calibration.EqualTo(
"Bcid") ){
231 m_globalConfig->SetValue(
"PileupStartingScale",
"JetBcidScaleMomentum");
232 std::unique_ptr<JetCalibrationStep> bcidCorr = std::make_unique<BcidOffsetCorrection>(this->
name()+
"_Bcid",
m_globalConfig, jetAlgo, calibPath,
m_isData);
235 return StatusCode::SUCCESS;
237 else if ( calibration.EqualTo(
"JetArea") || calibration.EqualTo(
"Residual") ) {
238 std::unique_ptr<JetCalibrationStep> puCorr = std::make_unique<JetPileupCorrection>(this->
name()+
"_Pileup",
m_globalConfig, jetAlgo, calibPath,
243 return StatusCode::SUCCESS;
245 else if ( calibration.EqualTo(
"EtaJES") || calibration.EqualTo(
"AbsoluteEtaJES") ) {
246 std::unique_ptr<JetCalibrationStep> etaJESCorr = std::make_unique<EtaJESCorrection>(this->
name()+
"_EtaJES",
m_globalConfig, jetAlgo, calibPath,
false,
m_devMode);
250 return StatusCode::SUCCESS;
252 else if ( calibration.EqualTo(
"EtaMassJES") ) {
253 std::unique_ptr<JetCalibrationStep> etaJESCorr = std::make_unique<EtaJESCorrection>(this->
name()+
"_EtaMassJES",
m_globalConfig, jetAlgo, calibPath,
true,
m_devMode);
257 return StatusCode::SUCCESS;
259 else if ( calibration.EqualTo(
"GSC") ) {
264 return StatusCode::SUCCESS;
266 else if ( calibration.EqualTo(
"GNNC") ) {
267 std::unique_ptr<JetCalibrationStep> gnnc = std::make_unique<GlobalNNCalibration>(this->
name()+
"_GNNC",
m_globalConfig,jetAlgo,calibPath,
m_devMode);
271 return StatusCode::SUCCESS;
273 else if ( calibration.EqualTo(
"JMS") ) {
274 std::unique_ptr<JetCalibrationStep> jetMassCorr = std::make_unique<JMSCorrection>(this->
name()+
"_JMS",
m_globalConfig, jetAlgo, calibPath,
m_devMode);
275 jetMassCorr->
msg().setLevel( this->
msg().
level() );
278 return StatusCode::SUCCESS;
280 else if ( calibration.EqualTo(
"InsituCombinedMass") ){
283 jetMassCorr->
msg().setLevel( this->
msg().
level() );
287 return StatusCode::SUCCESS;
289 else if ( calibration.EqualTo(
"Insitu") ) {
291 std::unique_ptr<JetCalibrationStep> insituDataCorr = std::make_unique<InsituDataCorrection>(this->
name()+
"_Insitu",
m_globalConfig, jetAlgo, calibPath,
m_devMode);
292 insituDataCorr->
msg().setLevel( this->
msg().
level() );
295 return StatusCode::SUCCESS;
298 ATH_MSG_INFO(
"Initializing Time-Dependent Insitu Corrections");
301 unsigned int firstRun =
static_cast<unsigned int>(
m_runBins.at(
i)+1.5);
305 insituDataCorr->
msg().setLevel( this->
msg().
level() );
309 return StatusCode::SUCCESS;
312 else if ( calibration.EqualTo(
"Smear") ) {
314 ATH_MSG_FATAL(
"Asked for smearing of data, which is not supported. Aborting.");
315 return StatusCode::FAILURE;
317 std::unique_ptr<JetCalibrationStep> jetSmearCorr = std::make_unique<JetSmearingCorrection>(this->
name()+
"_Smear",
m_globalConfig,jetAlgo,calibPath,
m_devMode);
322 return StatusCode::SUCCESS;
324 else if ( calibration.EqualTo(
"LargeRDNN") ) {
325 std::unique_ptr<JetCalibrationStep> largeR_dnn = std::make_unique<GlobalLargeRDNNCalibration>(this->
name()+
"_R10DNN",
m_globalConfig,calibPath,
m_devMode);
329 return StatusCode::SUCCESS;
331 ATH_MSG_FATAL(
"Calibration string not recognized: " << calibration <<
", aborting.");
332 return StatusCode::FAILURE;
341 return StatusCode::SUCCESS;
351 ATH_MSG_FATAL(
" JetCalibrationTool::initializeEvent : The tool was not initialized.");
352 return StatusCode::FAILURE;
370 eventShape = rhRhoKey.
cptr();
373 ATH_MSG_FATAL(
"Could not retrieve the xAOD::EventShape container " <<
m_rhoKey.key() <<
" from the input file");
374 return StatusCode::FAILURE;
378 return StatusCode::FAILURE;
384 ATH_MSG_FATAL(
"Could not retrieve xAOD::EventShape container " <<
m_rhoKey.key() <<
" from the input file");
385 return StatusCode::FAILURE;
398 return StatusCode::FAILURE;
402 return StatusCode::FAILURE;
407 for (
const auto *
jet : *
jets) {
418 static std::atomic<unsigned int> eventInfoWarnings = 0;
421 eventObj = rhEvtInfo.
cptr();
424 if ( eventInfoWarnings < 20 )
425 ATH_MSG_ERROR(
" JetCalibrationTool::initializeEvent : Failed to retrieve event information.");
426 jetEventInfo.
setMu(0);
428 return StatusCode::SUCCESS;
437 return StatusCode::FAILURE;
439 jetEventInfo.
setMu( eventInfoDecor(0) );
450 jetEventInfo.
setPVIndex( PVIndexAccessor(*eventObj) );
456 vertices = rhPV.
cptr();
459 for ( ; vtx_itr != vtx_end; ++vtx_itr ){
481 static const SG::ConstAccessor<int> BCIDGapBeforeTrainMinus12Acc (
"DFCommonJets_BCIDGapBeforeTrainMinus12");
499 vertices = rhPV.
cptr();
501 ATH_MSG_WARNING(
" JetCalibrationTool::initializeEvent : Failed to retrieve primary vertices.");
503 return StatusCode::SUCCESS;
510 eventNPV = std::count_if(vertices->
begin(), vertices->
end(), [](
const xAOD::Vertex* vtx){ return vtx->vertexType() == xAOD::VxType::PileUp || vtx->vertexType() == xAOD::VxType::PriVtx;});
511 jetEventInfo.
setNPV(eventNPV);
517 static std::atomic<unsigned int> vertexIndexWarnings = 0;
518 if (jetEventInfo.
PVIndex() < 0 ||
static_cast<size_t>(jetEventInfo.
PVIndex()) >= vertices->
size())
520 ++vertexIndexWarnings;
521 if (vertexIndexWarnings < 20)
522 ATH_MSG_WARNING(
" JetCalibrationTool::initializeEvent : PV index is out of bounds.");
524 return StatusCode::SUCCESS;
530 static std::atomic<unsigned int> eventInfoWarningsMu = 0;
534 jetEventInfo.
setMu(eventInfoDecor(0));
536 ++eventInfoWarningsMu;
537 if ( eventInfoWarningsMu < 20 )
ATH_MSG_WARNING(
" JetCalibrationTool::initializeEvent : Failed to retrieve event information.");
538 jetEventInfo.
setMu(0);
541 static std::atomic<unsigned int> eventInfoWarningsPV = 0;
545 vertices = rhPV.
cptr();
547 eventNPV = std::count_if(vertices->
begin(), vertices->
end(), [](
const xAOD::Vertex* vtx){ return vtx->vertexType() == xAOD::VxType::PileUp || vtx->vertexType() == xAOD::VxType::PriVtx;});
548 jetEventInfo.
setNPV(eventNPV);
550 ++eventInfoWarningsPV;
551 if ( eventInfoWarningsPV < 20 )
ATH_MSG_WARNING(
" JetCalibrationTool::initializeEvent : Failed to retrieve primary vertices.");
555 return StatusCode::SUCCESS;
562 if ( !
jet.getAttribute<
int>(
"OriginCorrected",
tmp) )
563 jet.setAttribute<
int>(
"OriginCorrected",
false);
564 if ( !
jet.getAttribute<
int>(
"PileupCorrected",
tmp) )
565 jet.setAttribute<
int>(
"PileupCorrected",
false);
570 jet.setAttribute<
float>(
"DetectorEta",jetconstitP4.eta());
575 return StatusCode::SUCCESS;
582 ATH_MSG_ERROR(
"Cannot retrieve the nominal data resolution - smearing was not configured during initialization");
583 return StatusCode::FAILURE;
591 ATH_MSG_ERROR(
"Cannot retrieve the nominal MC resolution - smearing was not configured during initialization");
592 return StatusCode::FAILURE;
def retrieve(aClass, aKey=None)
bool getDensity(EventDensityID id, double &v) const
Get a density variable from the object.
void setBcidDistanceFromFront(Int_t BcidDistanceFromFront)
Const iterator class for DataVector/DataList.
const_pointer_type cptr()
Dereference the pointer.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
bool isPresent() const
Is the referenced container present in SG?
Helper class to provide constant type-safe access to aux data.
void setBcidGapBeforeTrain(Int_t BcidGapBeforeTrain)
#define ATH_MSG_VERBOSE(x)
double resolution[nGasTypes][nParametersResolution]
StrV Vectorize(const TString &str, const TString &sep=" ")
uint32_t runNumber() const
The current event's run number.
virtual StatusCode initialize()=0
void setBcidGapBeforeTrainMinus12(Int_t BcidGapBeforeTrainMinus12)
void setNjet(double nJet)
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Handle class for reading a decoration on an object.
::StatusCode StatusCode
StatusCode definition for legacy code.
MsgStream & msg() const
The standard message stream.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Data class for event shapes.
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
void setPVIndex(int PVindex)
std::string to_string(const DetectorType &type)
Class describing the basic event information.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
Class describing a Vertex.
#define ATH_MSG_WARNING(x)
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
VecD VectorizeD(const TString &str, const TString &sep=" ")
void setRunNumber(UInt_t RunNumber)
Helper class to provide constant type-safe access to aux data.
size_type size() const noexcept
Returns the number of elements in the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.