|
ATLAS Offline Software
|
Go to the documentation of this file.
19 ISvcLocator* pSvcLocator)
30 std::set<xAOD::Iso::IsolationFlavour> runIsoType;
120 return StatusCode::SUCCESS;
128 return StatusCode::SUCCESS;
144 return StatusCode::FAILURE;
146 cellColl = cellcoll.
cptr();
180 return StatusCode::SUCCESS;
194 isoDeco.declare(owningAlg);
195 owningAlg->declare(corrBitsetDeco);
197 for (
auto& coreCor : coreCorDeco) {
198 owningAlg->declare(coreCor.second);
201 for (
auto& noncoreCor : noncoreCorDeco) {
202 noncoreCor.second.declare(owningAlg);
209 isoDeco.setOwner(owningAlg);
210 isoDecoV.setOwner(owningAlg);
211 corrBitsetDeco.setOwner(owningAlg);
218 isoDeco.declare(owningAlg);
219 isoDecoV.declare(owningAlg);
220 owningAlg->declare(corrBitsetDeco);
222 for (
auto& coreCor : coreCorDeco) {
223 owningAlg->declare(coreCor.second);
230 : corrBitsetDeco(
keys.corrBitsetDeco)
232 for (
const auto&
key :
keys.isoDeco) {
235 for (
const auto& coreCor :
keys.coreCorDeco) {
238 for (
const auto& noncoreCor :
keys.noncoreCorDeco) {
242 std::begin(noncoreCor.second), std::end(noncoreCor.second) });
248 : corrBitsetDeco(
keys.corrBitsetDeco)
250 for (
const auto&
key :
keys.isoDeco) {
253 for (
const auto&
key :
keys.isoDecoV) {
256 for (
const auto& coreCor :
keys.coreCorDeco) {
270 std::set<xAOD::Iso::IsolationFlavour>& runIsoType,
271 std::vector<std::pair<xAOD::Iso::IsolationFlavour, CaloIsoHelpKey>>*
273 std::vector<std::pair<xAOD::Iso::IsolationFlavour, TrackIsoHelpKey>>*
275 const std::string& containerName,
276 const std::vector<std::vector<int>>& isoInts,
277 const std::vector<std::vector<int>>& corInts,
278 const std::vector<std::vector<int>>& corIntsExtra,
279 const std::string& customConfig)
282 std::string
prefix = containerName +
".";
284 for (
size_t flavor = 0; flavor < isoInts.size(); flavor++) {
296 for (
size_t type = 0;
type < isoInts[flavor].size();
type++) {
306 oldIsoFlav != isoFlav) {
307 ATH_MSG_FATAL(
"Configuration error: can only have one type of "
308 "isolation in inner vector");
309 return StatusCode::FAILURE;
311 oldIsoFlav = isoFlav;
313 if (!customConfig.empty()) {
314 isoName +=
"_" + customConfig;
319 cisoH.
isoDeco.emplace_back(isoName);
322 tisoH.
isoDeco.emplace_back(isoName);
326 if (!customConfig.empty()) {
327 isoNameV +=
"_" + customConfig;
329 tisoH.
isoDecoV.emplace_back(isoNameV);
332 << isoFlav <<
" not supported.");
333 return StatusCode::FAILURE;
339 ATH_MSG_WARNING(
"The configuration was malformed: an empty inner vector "
340 "was added; ignoring");
359 flavor, isoFlav, cisoH, corInts,
false,
prefix, customConfig));
361 flavor, isoFlav, cisoH, corIntsExtra,
true,
prefix, customConfig));
364 caloIsoMap->push_back(std::make_pair(isoFlav, cisoH));
367 "caloIsoMap was nullptr but the configuration attempted to use it");
368 return StatusCode::FAILURE;
379 flavor, isoFlav, tisoH, corInts,
false,
prefix, customConfig));
381 flavor, isoFlav, tisoH, corIntsExtra,
true,
prefix, customConfig));
384 trackIsoMap->push_back(std::make_pair(isoFlav, tisoH));
387 "trackIsoMap was nullptr but the configuration attempted to use it");
388 return StatusCode::FAILURE;
392 << xAOD::Iso::toCString(isoFlav)
393 <<
" does not exist ! Check your inputs");
395 runIsoType.insert(isoFlav);
397 return StatusCode::SUCCESS;
405 const std::vector<std::vector<int>>& corInts,
407 const std::string&
prefix,
408 const std::string& customConfig)
411 if (!corrsAreExtra) {
412 std::string bitsetName =
414 if (!customConfig.empty()) {
415 bitsetName +=
"_" + customConfig;
425 const auto cor =
static_cast<unsigned int>(corInts[flavor][
corrType]);
432 std::string isoCorName =
prefix;
440 if (!customConfig.empty()) {
441 isoCorName +=
"_" + customConfig;
458 if (!customConfig.empty()) {
459 corName +=
"_" + customConfig;
461 vec.emplace_back(corName);
468 return StatusCode::SUCCESS;
476 const std::vector<std::vector<int>>& corInts,
478 const std::string&
prefix,
479 const std::string& customConfig)
482 if (!corrsAreExtra) {
483 std::string bitsetName =
485 if (!customConfig.empty()) {
486 bitsetName +=
"_" + customConfig;
495 const auto cor =
static_cast<unsigned int>(corInts[flavor][
corrType]);
505 if (!customConfig.empty()) {
506 isoCorName +=
"_" + customConfig;
513 return StatusCode::SUCCESS;
518 const std::vector<std::pair<xAOD::Iso::IsolationFlavour, CaloIsoHelpKey>>&
522 for (
const auto&
pr : caloIsoMap) {
525 const auto&
keys =
pr.second;
531 ATH_MSG_FATAL(
"Have a CaloIsoHelpHandles with no actual isolations; "
532 "something wrong happened");
533 return StatusCode::FAILURE;
538 if (readHandle.isAvailable()){
540 ATH_MSG_DEBUG(
"read (actually a write) handle for " <<
keys.isoDeco[0].key() <<
" already exists. "
541 <<
"Will not recompute." );
542 return StatusCode::SUCCESS;
545 if (!readHandle.isValid()) {
547 <<
keys.isoDeco[0].key());
548 return StatusCode::FAILURE;
551 for (
const auto *
part : *readHandle) {
553 bool successfulCalc =
false;
556 CaloIsoResult, *
part,
keys.isoTypes,
keys.CorrList, cellColl);
565 if (successfulCalc) {
566 for (
unsigned int i = 0;
i <
keys.isoTypes.size();
i++) {
567 float iso = CaloIsoResult.
etcones[
i];
569 <<
" = " << iso / 1
e3);
583 ATH_MSG_FATAL(
"Could not find core correction of required type: "
584 << xAOD::Iso::toCString(coreCorDecoPr.first));
586 return StatusCode::FAILURE;
590 float>::const_iterator
it =
592 if (
it == corIter->second.end()) {
594 << xAOD::Iso::toCString(coreCorDecoPr.first));
596 return StatusCode::FAILURE;
599 << xAOD::Iso::toCString(coreCorDecoPr.first));
600 (coreCorDecoPr.second)(*
part) =
it->second;
609 ATH_MSG_FATAL(
"Could not find noncore correction of required type: "
610 << xAOD::Iso::toCString(noncoreCorDecoPr.first));
612 return StatusCode::FAILURE;
616 << xAOD::Iso::toCString(noncoreCorDecoPr.first));
617 auto& vecHandles = noncoreCorDecoPr.second;
618 for (
size_t i = 0;
i < vecHandles.size();
i++) {
619 (vecHandles[
i])(*
part) = corIter->second[
i];
624 << xAOD::Iso::toCString(flav));
625 return StatusCode::FAILURE;
629 return StatusCode::SUCCESS;
634 const std::vector<std::pair<xAOD::Iso::IsolationFlavour, TrackIsoHelpKey>>&
637 for (
const auto&
pr : trackIsoMap) {
639 const auto&
keys =
pr.second;
645 ATH_MSG_FATAL(
"Have a TrackIsoHelpHandles with no actual isolations; "
646 "something wrong happened");
647 return StatusCode::FAILURE;
652 if (readHandle.isAvailable()){
654 ATH_MSG_DEBUG(
"Decoration for for " <<
keys.isoDeco[0].key() <<
" already exists. "
655 <<
"Will not recompute." );
656 return StatusCode::SUCCESS;
659 if (!readHandle.isValid()) {
661 <<
keys.isoDeco[0].key());
662 return StatusCode::FAILURE;
665 for (
const auto *
part : *readHandle) {
667 bool successfulCalc =
false;
671 ATH_MSG_DEBUG(
"Doing track isolation on an egamma particle");
672 std::unique_ptr<xAOD::Vertex> trigVtx =
nullptr;
673 std::set<const xAOD::TrackParticle*> tracksToExclude;
679 trigVtx = std::make_unique<xAOD::Vertex>();
681 trigVtx->
setZ(
el->trackParticle()->z0() +
el->trackParticle()->vz());
682 ATH_MSG_DEBUG(
"will use a vertex at z = " << trigVtx->
z() <<
" to compute electron track isolation");
692 if (gam && gam->nVertices() > 0) {
695 tracksToExclude.insert(
710 ATH_MSG_DEBUG(
"Not doing track isolation on an egamma particle");
715 if (successfulCalc) {
716 for (
unsigned int i = 0;
i <
keys.isoTypes.size();
i++) {
717 float iso = TrackIsoResult.
ptcones[
i];
720 <<
" = " << iso / 1
e3
721 <<
", var cone = " << isoV / 1
e3);
735 ATH_MSG_FATAL(
"Could not find core correction of required type: "
736 << xAOD::Iso::toCString(coreCorDecoPr.first));
738 return StatusCode::FAILURE;
741 << xAOD::Iso::toCString(coreCorDecoPr.first));
742 (coreCorDecoPr.second)(*
part) = corIter->second;
746 ATH_MSG_FATAL(
"Call to TrackIsolationTool failed for flavor "
747 << xAOD::Iso::toCString(flav));
748 return StatusCode::FAILURE;
752 return StatusCode::SUCCESS;
757 std::vector<std::pair<xAOD::Iso::IsolationFlavour, CaloIsoHelpKey>>&
caloIso)
760 iso.second.declare(
this);
766 std::vector<std::pair<xAOD::Iso::IsolationFlavour, TrackIsoHelpKey>>&
769 for (
auto& iso : trackIso) {
770 iso.second.declare(
this);
Gaudi::Property< bool > m_allTrackRemoval
SG::WriteDecorHandleKeyArray< xAOD::IParticleContainer > isoDeco
The actual isolations.
Gaudi::Property< std::vector< std::vector< int > > > m_elisoInts
Isolation types.
@ topoetcone
Topo-cluster ET-sum.
virtual StatusCode initialize() override final
virtual StatusCode execute(const EventContext &ctx) const override final
Gaudi::Property< std::string > m_customConfigFwd
Gaudi::Property< bool > m_storepileupCorrection
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
@ coreConeSC
core energy (super cluster).
void declareIso(std::vector< std::pair< xAOD::Iso::IsolationFlavour, CaloIsoHelpKey >> &caloIso)
@ coreEnergy
energy stored for this correction
const_pointer_type cptr()
Dereference the pointer.
std::vector< float > ptvarcones_10GeVDivPt
std::vector< std::pair< xAOD::Iso::IsolationFlavour, CaloIsoHelpKey > > m_phCaloIso
Gaudi::Property< std::string > m_customConfigMu
Gaudi::Property< std::vector< std::vector< int > > > m_elcorIntsExtra
CaloIsoHelpKey(IDataHandleHolder *owningAlg)
constructor
IsolationFlavour
Enumeration for different ways of calculating isolation in xAOD files.
std::string toString(const IsoType &iso)
Gaudi::Property< std::vector< std::vector< int > > > m_mucorInts
TrackIsoHelpHandles(const TrackIsoHelpKey &keys)
float round(const float toRound, const unsigned int decimals)
Gaudi::Property< std::string > m_ElectronContainerName
Containers (Is it best to make them as strings? Used by multiple handles)
Iso::IsolationTrackCorrectionBitset trackbitset
std::map< xAOD::Iso::IsolationTrackCorrection, SG::WriteDecorHandleKey< xAOD::IParticleContainer > > coreCorDeco
The corrections.
std::vector< SG::WriteDecorHandle< xAOD::IParticleContainer, float > > isoDeco
Gaudi::Property< std::vector< std::vector< int > > > m_phisoInts
Isolation types (for the alg.
void declare(IDataHandleHolder *owningAlg)
only to be called after placed in the final location, to propagate dependencies
Gaudi::Property< std::string > m_MuonContainerName
std::vector< SG::WriteDecorHandle< xAOD::IParticleContainer, float > > isoDecoV
Gaudi::Property< std::string > m_FwdElectronContainerName
@ etcone
Calorimeter isolation.
std::set< const xAOD::TrackParticle * > getTrackParticles(const xAOD::Egamma *eg, bool useBremAssoc=true, bool allParticles=true)
Return a list of all or only the best TrackParticle associated to the object.
std::vector< size_t > vec
@ neflowisol
neutral eflow
Gaudi::Property< bool > m_isTrigger
is the alg run at trigger level
const std::string & key() const
Return the StoreGate ID for the referenced object.
xAOD::TrackCorrection CorrList
to keep track of the corrections
IsolationCorrectionParameter
std::vector< std::pair< xAOD::Iso::IsolationFlavour, TrackIsoHelpKey > > m_elTrackIso
An algorithm that can be simultaneously executed in multiple threads.
Gaudi::Property< std::vector< std::vector< int > > > m_fecorInts
StatusCode addCaloIsoCorrections(size_t flavor, xAOD::Iso::IsolationFlavour isoFlav, CaloIsoHelpKey &cisoH, const std::vector< std::vector< int >> &corInts, bool corrsAreExtra, const std::string &prefix, const std::string &customConfig)
called by initializeIso
std::vector< xAOD::Iso::IsolationType > isoTypes
the types of isolations to calculate
StatusCode addTrackIsoCorrections(size_t flavor, xAOD::Iso::IsolationFlavour isoFlav, TrackIsoHelpKey &tisoH, const std::vector< std::vector< int >> &corInts, bool corrsAreExtra, const std::string &prefix, const std::string &customConfig)
called by initializeIso
Gaudi::Property< std::vector< std::vector< int > > > m_phcorIntsExtra
virtual ~IsolationBuilder()
Destructor:
SG::WriteDecorHandle< xAOD::IParticleContainer, uint32_t > corrBitsetDeco
SG::WriteDecorHandleKey< xAOD::IParticleContainer > corrBitsetDeco
xAOD::CaloCorrection CorrList
to keep track of the corrections
@ core57cells
core 5x7 cells
Gaudi::Property< std::string > m_customConfigPh
void setZ(float value)
Sets the z position.
SG::ReadHandleKey< CaloCellContainer > m_cellsKey
Cell container.
StatusCode initializeIso(std::set< xAOD::Iso::IsolationFlavour > &runIsoType, std::vector< std::pair< xAOD::Iso::IsolationFlavour, CaloIsoHelpKey >> *caloIsoMap, std::vector< std::pair< xAOD::Iso::IsolationFlavour, TrackIsoHelpKey >> *trackIsoMap, const std::string &containerName, const std::vector< std::vector< int >> &isoInts, const std::vector< std::vector< int >> &corInts, const std::vector< std::vector< int >> &corIntsExtra, const std::string &customConfig)
called by algorithm initialize per object (electron, photon, forward electron, muon)
@ caloIso
Get sum of transvers energy of clusters around jet seed within 0.2 < dR < 0.4
std::map< Iso::IsolationTrackCorrection, float > coreCorrections
::StatusCode StatusCode
StatusCode definition for legacy code.
std::map< Iso::IsolationCaloCorrection, std::map< Iso::IsolationCorrectionParameter, float > > coreCorrections
bool isElectron(const xAOD::Egamma *eg)
is the object an electron (not Fwd)
IsolationType
Overall enumeration for isolation types in xAOD files.
Gaudi::Property< std::vector< std::vector< int > > > m_feisoInts
SG::WriteDecorHandleKeyArray< xAOD::IParticleContainer > isoDecoV
Handle class for adding a decoration to an object.
Gaudi::Property< std::vector< std::vector< int > > > m_phcorInts
std::vector< SG::WriteDecorHandle< xAOD::IParticleContainer, float > > isoDeco
StatusCode executeTrackIso(const std::vector< std::pair< xAOD::Iso::IsolationFlavour, TrackIsoHelpKey >> &trackIsoMap) const
SG::WriteDecorHandleKey< xAOD::IParticleContainer > corrBitsetDeco
std::vector< std::pair< xAOD::Iso::IsolationFlavour, TrackIsoHelpKey > > m_muTrackIso
ToolHandle< xAOD::INeutralEFlowIsolationTool > m_pflowIsolationTool
Tool for neutral pflow isolation calculation.
TrackIsoHelpKey(IDataHandleHolder *owningAlg)
constructor
std::map< xAOD::Iso::IsolationTrackCorrection, SG::WriteDecorHandle< xAOD::IParticleContainer, float > > coreCorDeco
std::map< xAOD::Iso::IsolationCaloCorrection, std::vector< SG::WriteDecorHandle< xAOD::IParticleContainer, float > > > noncoreCorDeco
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
float z() const
Returns the z position.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
IsolationBuilder()
Default constructor:
std::vector< xAOD::Iso::IsolationType > isoTypes
the types of isolations to calculate
std::map< xAOD::Iso::IsolationCaloCorrection, SG::WriteDecorHandleKey< xAOD::IParticleContainer > > coreCorDeco
The corrections (one per flavor)
Gaudi::Property< bool > m_useBremAssoc
Gaudi::Property< std::vector< std::vector< int > > > m_muisoInts
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteDecorHandleKeyArray< xAOD::IParticleContainer > isoDeco
The actual isolations.
Gaudi::Property< std::vector< std::vector< int > > > m_fecorIntsExtra
IsolationFlavour isolationFlavour(IsolationType type)
convert Isolation Type into Isolation Flavour
StatusCode executeCaloIso(const std::vector< std::pair< xAOD::Iso::IsolationFlavour, CaloIsoHelpKey >> &caloIsoMap, const CaloCellContainer *cellColl) const
void declare(IDataHandleHolder *owningAlg)
only to be called after placed in the final location, to propagate dependencies
ToolHandle< xAOD::ITrackIsolationTool > m_trackIsolationTool
Tool for neutral pflow isolation calculation.
ToolHandle< xAOD::ICaloCellIsolationTool > m_cellIsolationTool
Tool for cell isolation calculation.
std::string to_string(const DetectorType &type)
std::vector< float > etcones
@ coreCone
core energy (in dR<0.1).
Gaudi::Property< std::string > m_customConfigEl
const xAOD::TrackParticle * getOriginalTrackParticleFromGSF(const xAOD::TrackParticle *trkPar)
Helper function for getting the "Original" Track Particle (i.e before GSF) via the GSF Track Particle...
void makePrivateStore()
Create a new (empty) private store for this object.
Container class for CaloCell.
std::map< xAOD::Iso::IsolationCaloCorrection, SG::WriteDecorHandleKeyArray< xAOD::IParticleContainer > > noncoreCorDeco
The corrections (one per flavor/type combination)
std::vector< float > ptcones
Gaudi::Property< std::string > m_PhotonContainerName
CaloIsoHelpHandles(const CaloIsoHelpKey &keys)
IsolationCaloCorrection
Enumeration for different ways of correcting isolation in xAOD files.
Class describing a Vertex.
#define ATH_MSG_WARNING(x)
std::vector< std::pair< xAOD::Iso::IsolationFlavour, TrackIsoHelpKey > > m_phTrackIso
std::vector< std::pair< xAOD::Iso::IsolationFlavour, CaloIsoHelpKey > > m_feCaloIso
static bool isCoreCor(xAOD::Iso::IsolationCaloCorrection corr)
std::map< Iso::IsolationCaloCorrection, std::vector< float > > noncoreCorrections
Gaudi::Property< std::vector< std::vector< int > > > m_mucorIntsExtra
virtual StatusCode finalize() override final
std::map< xAOD::Iso::IsolationCaloCorrection, SG::WriteDecorHandle< xAOD::IParticleContainer, float > > coreCorDeco
float coneSize(IsolationConeSize type)
convert Isolation Size into cone size
ToolHandle< xAOD::ICaloTopoClusterIsolationTool > m_topoIsolationTool
Tool for topo isolation calculation.
SG::WriteDecorHandle< xAOD::IParticleContainer, uint32_t > corrBitsetDeco
std::vector< std::pair< xAOD::Iso::IsolationFlavour, CaloIsoHelpKey > > m_elCaloIso
std::vector< std::pair< xAOD::Iso::IsolationFlavour, CaloIsoHelpKey > > m_muCaloIso
Iso::IsolationCaloCorrectionBitset calobitset
Gaudi::Property< std::vector< std::vector< int > > > m_elcorInts
@ pileupCorrection
fully corrected