|
ATLAS Offline Software
|
Go to the documentation of this file.
7 #include "AthLinks/ElementLink.h"
55 float pt = accPt(*
this);
63 float eta = accEta(*
this);
70 float phi = accPhi(*
this);
77 float M = accM(*
this);
84 float pt = accPt(*
this);
110 accPt(*
this) =
vec.Pt();
113 accEta(*
this) =
vec.Eta();
116 accPhi(*
this) =
vec.Phi();
119 accM(*
this) =
vec.M();
156 p4EM.SetPtEtaPhiM(accPt(*
this), accEta(*
this), accPhi(*
this), accM(*
this));
170 return GenVecFourMom_t(accPt(*
this), accEta(*
this), accPhi(*
this), accM(*
this));
175 accPt(*
this) =
p4EM.Pt();
178 accEta(*
this) =
p4EM.Eta();
181 accPhi(*
this) =
p4EM.Phi();
184 accM(*
this) =
p4EM.M();
209 float pt = accPt(*
this);
228 float M = accM(*
this);
238 float pt = accPt(*
this);
240 if (
pt < 0.0)
return -
p4EM().E();
241 else return p4EM().E();
252 return (fabs(this->
charge())>1
e-6);
259 this->setAttribute<uint16_t>(AttributeType, uint16_variable);
265 isValid = attribute<uint16_t>(AttributeType,internalAttribute);
277 const static int maxIntSize = 1000000000;
278 int internalAttribute = maxIntSize;
279 if (
dummy < 0) internalAttribute *= -1;
280 if (dummy < maxIntSize && dummy > -maxIntSize) internalAttribute =
static_cast<int>(
dummy);
281 setAttribute<int>(AttributeType, internalAttribute);
284 float internalAttribute = anAttribute;
292 int internalAttribute;
293 isValid = attribute<int>(AttributeType,internalAttribute);
295 else anAttribute = 0.0;
301 if( ! p_acc ) {
return false ;}
305 anAttribute =( *p_acc )( *this );
313 switch (AttributeType) {
373 float internalAttribute =
static_cast<float>(anAttribute);
374 setAttribute<float>(AttributeType, internalAttribute);
379 float internalAttribute;
380 bool isValid = attribute<float>(AttributeType,internalAttribute);
381 if (
isValid) anAttribute =
static_cast<double>(internalAttribute);
388 float internalAttribute =
static_cast<float>(anAttribute);
389 setAttribute<float>(AttributeType, internalAttribute);
393 template<>
bool PFO_v1::attribute(
const std::string& AttributeType,
double& anAttribute)
const {
395 float internalAttribute;
396 bool isValid = attribute<float>(AttributeType,internalAttribute);
397 if (
isValid) anAttribute =
static_cast<float>(internalAttribute);
406 double myMoment = -99.0;
409 bool gotMoment = theCluster->
retrieveMoment( momentType, myMoment);
412 else if (gotMoment) {
413 theMoment =
static_cast<float>(myMoment);
426 if (!haveGotAttributeInMap)
return false;
428 bool isRetrieved = this->
attribute(myAttribute, theMoment);
538 acc(*
this) = theVertexLink;
539 acc(*this).toPersistent();
562 std::vector<ElementLink<xAOD::IParticleContainer> > theLinks(1,theParticle);
567 std::vector<ElementLink<xAOD::IParticleContainer> > theLinks(1,theParticle);
573 if (!p_acc)
return false;
577 std::vector<ElementLink<IParticleContainer> > storedContainer = (*p_acc)(*this);
578 storedContainer.push_back(theParticle);
579 (*p_acc)(*this) = storedContainer;
588 std::vector<ElementLink<IParticleContainer> > storedContainer = acc(*
this);
594 storedContainer.push_back(newLink);
596 acc(*
this) = storedContainer;
603 if (!p_acc)
return false;
605 (*p_acc)(*this) = theParticles;
613 if (!p_acc)
return false;
617 const std::vector<ElementLink<IParticleContainer> >& theLinks = (*p_acc)(*this);
618 std::vector<ElementLink<IParticleContainer> >::const_iterator firstLink = theLinks.begin();
619 for (; firstLink != theLinks.end(); ++firstLink) {
620 if ( (*firstLink).isValid()) theParticles.push_back(**firstLink);
621 else theParticles.push_back(
nullptr);
633 std::vector<ElementLink<IParticleContainer> > storedContainer;
634 std::vector<ElementLink<IParticleContainer> >::const_iterator firstParticle = theParticles.begin();
635 for (; firstParticle != theParticles.end(); ++firstParticle){
638 storedContainer.push_back( myLink );
642 acc(*
this) = storedContainer;
647 if (!acc.isAvailable(*
this))
return false;
649 const std::vector<ElementLink<IParticleContainer> >& theLinks = acc(*
this);
650 std::vector<ElementLink<IParticleContainer> >::const_iterator firstLink = theLinks.begin();
651 for (; firstLink != theLinks.end(); ++firstLink) {
652 if ( (*firstLink).isValid()) theParticles.push_back(**firstLink);
653 else theParticles.push_back(
nullptr);
661 if (!p_acc)
return 0;
664 const std::vector<ElementLink<IParticleContainer> >& theLinks = (*p_acc)(*this);
665 return theLinks.size();
672 if (!p_acc)
return nullptr;
673 else if (!p_acc->
isAvailable(*
this)) {
return nullptr;}
675 const std::vector<ElementLink<IParticleContainer> >& theLinks = (*p_acc)(*this);
676 if(
index<theLinks.size()) {
680 if (
nullptr == theParticle)
return nullptr;
694 if (!p_acc)
return nullptr;
695 else if (!p_acc->
isAvailable(*
this)) {
return nullptr;}
697 const std::vector<ElementLink<IParticleContainer> >& theLinks = (*p_acc)(*this);
698 if(
index<theLinks.size()) {
702 if (
nullptr == theParticle)
return nullptr;
714 if (!acc.isAvailable(*
this))
return nullptr;
717 if (tempVertexLink.
isValid())
return *acc(*
this);
723 TVector3 theVertexVector(vertexToCorrectTo.
x(), vertexToCorrectTo.
y(), vertexToCorrectTo.
z());
729 TLorentzVector theNewVector(0.0,0.0,0.0,0.0);
730 theNewVector.SetPtEtaPhiM(this->
pt(), this->
eta(), this->
phi(), this->
m());
738 TVector3 theVertexVector(vertexToCorrectTo.
x(), vertexToCorrectTo.
y(), vertexToCorrectTo.
z());
744 TLorentzVector theNewVector(0.0,0.0,0.0,0.0);
745 theNewVector.SetPtEtaPhiM(this->
ptEM(), this->
etaEM(), this->
phiEM(), this->
mEM());
754 float clusterEta = theFourVector.Eta();
757 float radius = centerMag/cosh(clusterEta);
759 float EtaVertexCorrection = 0.0, PhiVertexCorrection = 0.0;
760 float clusterPhi = theFourVector.Phi();
763 EtaVertexCorrection = (-vertexToCorrectTo.Z()/cosh(clusterEta) + (vertexToCorrectTo.X()*
cos(clusterPhi) + vertexToCorrectTo.Y()*
sin(clusterPhi))*tanh(clusterEta))/
radius;
764 PhiVertexCorrection = (vertexToCorrectTo.X()*
sin(clusterPhi) - vertexToCorrectTo.Y()*
cos(clusterPhi))/
radius;
767 float etaVertexCorrected = clusterEta + EtaVertexCorrection;
768 float p = std::sqrt(theFourVector.E()*theFourVector.E()-theFourVector.M()*theFourVector.M());
769 float ptVertexCorrected =
p/cosh(etaVertexCorrected);
770 theFourVector.SetPtEtaPhiM(ptVertexCorrected, etaVertexCorrected, clusterPhi + PhiVertexCorrection, theFourVector.M());
784 std::vector<ElementLink<IParticleContainer> >& theClusterLinks = accClusters(*
this);
785 std::vector< ElementLink< IParticleContainer > >
::iterator firstClus = theClusterLinks.begin();
786 std::vector< ElementLink< IParticleContainer > >
::iterator lastClus = theClusterLinks.end();
787 for (; firstClus != lastClus; ++firstClus) firstClus->toPersistent();
796 std::vector<ElementLink<IParticleContainer> >& theTrackLinks = accTracks(*
this);
797 std::vector< ElementLink< IParticleContainer > >
::iterator firstTrack = theTrackLinks.begin();
798 std::vector< ElementLink< IParticleContainer > >
::iterator lastTrack = theTrackLinks.end();
799 for (; firstTrack != lastTrack; ++firstTrack) firstTrack->toPersistent();
809 std::vector<ElementLink<IParticleContainer> >& theShotLinks = accShots(*
this);
810 std::vector< ElementLink< IParticleContainer > >
::iterator firstShot = theShotLinks.begin();
811 std::vector< ElementLink< IParticleContainer > >
::iterator lastShot = theShotLinks.end();
812 for (; firstShot != lastShot; ++firstShot) firstShot->toPersistent();
@ SECOND_R
Second Moment in .
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
@ eflowRec_LAYERENERGY_EME1
float x() const
Returns the x position.
@ eflowRec_LAYERENERGY_HEC1
PFOLeptonType
This enum is used to label the lepton type of the neutral PFO.
@ ENG_FRAC_CORE
Energy fraction of the sum of the hottest cells in each sampling.
@ eflowRec_LAYERENERGY_EMB3
bool getClusterMomentFromPFO(float &theMoment, xAOD::CaloCluster::MomentType momentType) const
Gives access to cluster moments direct from the PFO - getClusterMoment calls this,...
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > GenVecFourMom_t
Base 4 Momentum type (GenVector version)
virtual double pt() const
The transverse momentum ( ) of the particle.
void convertLink(ElementLink< IParticleContainer > &IParticleLink, const ElementLink< T > &templateLink)
Convert a generic link to an IParticleLink - perhaps this will go in a dedicated helper tool?
@ EM_PROBABILITY
Classification probability to be em-like.
@ eflowRec_CELL_SIGNIFICANCE
Helper class to provide type-safe access to aux data.
static const SG::AuxElement::Accessor< std::vector< ElementLink< IParticleContainer > > > * getAccessor(PFODetails::PFOParticleType type)
GenVecFourMom_t genvecP4() const
The full 4-momentum of the particle : GenVector version.
@ eflowRec_LAYERENERGY_TileGap2
static const SG::AuxElement::Accessor< T > * constAccessor(xAOD::PFODetails::PFOAttributes variable)
@ eflowRec_LAYERENERGY_HEC0
const TrackParticle * track(unsigned int index) const
Retrieve a const pointer to a Rec::TrackParticle.
@ eflowRec_LAYERENERGY_MINIFCAL3
void setP4EM(const FourMom_t &p4EM)
set EM scale 4-vector
virtual double phiEM() const
get EM scale phi
bool attribute(PFODetails::PFOAttributes AttributeType, T &anAttribute) const
get a PFO Variable via enum
@ AVG_LAR_Q
Sum(E_cell_LAr^2 Q_cell_LAr)/Sum(E_cell_LAr^2)
virtual double eta() const
The pseudorapidity ( ) of the particle.
@ eflowRec_LAYERENERGY_EM3
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.
@ eflowRec_LAYERENERGY_FCAL2
@ CENTER_LAMBDA
Shower depth at Cluster Centroid.
@ eflowRec_EM_PROBABILITY
PFOParticleType
This enum is used to label the associated particles to the PFO object.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
@ eflowRec_LAYERENERGY_EM
std::vector< size_t > vec
@ eflowRec_LAYERENERGY_HEC2
Helper class to provide constant type-safe access to aux data.
bool addClusterLink(const ElementLink< xAOD::CaloClusterContainer > &theCluster)
Add a cluster constituent appends to existing container.
@ eflowRec_LAYERENERGY_FCAL1
@ eflowRec_LAYERENERGY_TileBar0
setRcore setEtHad setFside pt
@ eflowRec_LAYERENERGY_TileExt1
bool associatedParticles(PFODetails::PFOParticleType ParticleType, std::vector< const IParticle * > &theParticles) const
get a vector of PFO constituent particle types via enum
@ ENG_FRAC_MAX
Energy fraction of hottest cell.
bool setAssociatedParticleLinks(PFODetails::PFOParticleType ParticleType, const std::vector< ElementLink< IParticleContainer > > &theParticles)
Set a vector of PFO constituent particle types via enum - overwrite is allowed.
Class providing the definition of the 4-vector interface.
@ eflowRec_LAYERENERGY_EMB2
bool isValid() const
Test to see if the link can be dereferenced.
TLorentzVector GetVertexCorrectedFourVec(const xAOD::Vertex &vertexToCorrectTo) const
Correct 4-vector to point at a vertex.
static const int s_floatCompressionFactor
this defines the factor to compress floats by
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
virtual double ptEM() const
get EM scale pt
@ eflowRec_LAYERENERGY_PreSamplerB
FourMom_t p4EM() const
get EM scale 4-vector
@ SECOND_LAMBDA
Second Moment in .
bool getAttributeName_FromClusterMoment(xAOD::PFODetails::PFOAttributes &myAttribute, xAOD::CaloCluster::MomentType &momentType) const
Map from cluster moment name onto PFOAttribute name.
TLorentzVector FourMom_t
Definition of the 4-momentum type.
MomentType
Enums to identify different moments.
bool setClusterLink(const ElementLink< xAOD::CaloClusterContainer > &theCluster)
Set a cluster constituent - does NOT append to existing container
@ eflowRec_LAYERENERGY_Tile0
TrackParticle_v1 TrackParticle
Reference the current persistent version:
virtual Type::ObjectType type() const
The type of the object as a simple enumeration.
size_t index() const
Return the index of this element within its container.
virtual double e() const
The total energy of the particle.
bool setVertexLink(const ElementLink< xAOD::VertexContainer > &theVertexLink)
Set a vertex link.
Description of a calorimeter cluster.
@ eflowRec_LAYERENERGY_TileBar2
unsigned int nCaloCluster() const
Find out how many CaloCluster are linked.
@ eflowRec_LAYERENERGY_MINIFCAL1
@ eflowRec_LAYERENERGY_MINIFCAL2
bool setTrackLink(const ElementLink< xAOD::TrackParticleContainer > &theTrack)
Set a track constituent - does NOT append to existing container
@ eflowRec_LAYERENERGY_HEC
@ CELL_SIG_SAMPLING
CaloSample of the cell with the largest |E|/sig.
@ ENG_CALIB_TOT
Calibration Hit energy inside the cluster.
@ ENG_CALIB_FRAC_EM
Calibration Hit energy inside the cluster caused by e/gamma/pi0.
@ ISOLATION
Energy weighted fraction of non-clustered perimeter cells.
@ eflowRec_LAYERENERGY_TileGap3
@ ENG_CALIB_FRAC_REST
Calibration Hit energy inside the cluster caused by other particles.
@ eflowRec_LAYERENERGY_EME2
virtual FourMom_t p4() const
The full 4-momentum of the particle.
@ ParticleFlow
The object is a particle-flow object.
@ eflowRec_LAYERENERGY_TileGap1
virtual double phi() const
The azimuthal angle ( ) of the particle.
@ eflowRec_LAYERENERGY_PreSamplerE
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
@ eflowRec_LAYERENERGY_TileBar1
GenVecFourMom_t genvecP4EM() const
get EM scale 4-vector
float z() const
Returns the z position.
virtual double mEM() const
get EM scale mass
@ FIRST_ENG_DENS
First Moment in E/V.
@ ENG_BAD_CELLS
Total em-scale energy of bad cells in this cluster.
bool isCharged() const
is a charged PFO
ElementLink implementation for ROOT usage.
bool setElement(ElementType element)
Set to point to an element.
virtual double eEM() const
get EM scale energy
Class describing a particle flow object.
bool setStorableObject(BaseConstReference data, bool replace=false, IProxyDict *sg=0)
Set link to point to a new container (storable).
@ eflowRec_LAYERENERGY_MINIFCAL0
PFO_v1()
Default constructor.
BaseConstReference getStorableObjectRef() const
Return a reference to the currently-referenced container object.
@ eflowRec_FIRST_ENG_DENS
@ eflowRec_LAYERENERGY_EMB1
bool addAssociatedParticleLink(PFODetails::PFOParticleType ParticleType, const ElementLink< IParticleContainer > &theParticle)
Add an IParticle constituent via enum - appends to existing container.
void makePrivateStore()
Create a new (empty) private store for this object.
@ AVG_TILE_Q
Sum(E_cell_Tile^2 Q_cell_Tile)/Sum(E_cell_Tile^2)
virtual double etaEM() const
get EM scale eta
virtual double m() const
The invariant mass of the particle.
bool setAssociatedParticleLink(PFODetails::PFOParticleType ParticleType, const ElementLink< IParticleContainer > &theParticle)
Set an IParticle constituent via enum - does NOT append to existing container.
void VertexCorrectTheFourVector(const TVector3 &vertexToCorrectTo, TLorentzVector &theFourVector) const
This does the vertex correction of neutral PFO.
void setP4(const FourMom_t &vec)
set the 4-vec
const xAOD::Vertex * vertex() const
Retrieve a const pointer to the xAOD::Vertex a charged PFO is associated to.
@ eflowRec_ENG_CALIB_FRAC_HAD
bool getClusterMoment(float &theMoment, xAOD::CaloCluster::MomentType momentType) const
Accessor for cluster moments.
@ eflowRec_CELL_SIG_SAMPLING
bool isCharged(const T &p)
Class describing a Vertex.
@ SIGNIFICANCE
Cluster significance.
@ eflowRec_LAYERENERGY_HEC3
bool isAvailableWritable(ELT &e) const
Test to see if this variable exists in the store and is writable.
@ eflowRec_LAYERENERGY_EME3
float y() const
Returns the y position.
bool isJetETMissFloatForCompression(xAOD::PFODetails::PFOAttributes AttributeType) const
Performs a check as to whether a variable should be compressed.
@ eflowRec_ENG_CALIB_FRAC_REST
@ LATERAL
Normalized lateral moment.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
bool toPersistent()
Dummy function provinding the offline interface.
const CaloCluster * cluster(unsigned int index) const
Retrieve a const pointer to a CaloCluster.
@ DELTA_ALPHA
Angular shower axis deviation ( ) from IP-to-Center.
@ ENG_CALIB_FRAC_HAD
Calibration Hit energy inside the cluster caused by charged pi+ and pi-.
@ CELL_SIGNIFICANCE
Cell significance = E/sig of the cell with the largest |E|/sig.
Class describing a TrackParticle.
@ eflowRec_LAYERENERGY_FCAL0
virtual double rapidity() const
The true rapidity (y) of the particle.
ObjectType
Type of objects that have a representation in the xAOD EDM.
@ eflowRec_ENG_CALIB_FRAC_EM
void setAttribute(PFODetails::PFOAttributes AttributeType, const T &anAttribute)
Set a PFO Variable via enum - overwrite is allowed.
@ LONGITUDINAL
Normalized longitudinal moment.
TLorentzVector GetVertexCorrectedEMFourVec(const xAOD::Vertex &vertexToCorrectTo) const
Correct EM scale 4-vector to point at a vertex.
setBGCode setTAP setLVL2ErrorBits bool
void toPersistent()
prepare all links for persistification
@ N_BAD_CELLS
number of bad cells
float centerMag() const
get CenterMag moment needed for vertex correction
@ eflowRec_LAYERENERGY_TileExt2
@ ENG_POS
Total positive Energy of this cluster.
@ eflowRec_LAYERENERGY_TileExt0
@ BADLARQ_FRAC
Energy fraction of LAr cells with quality larger than a given cut.