14#include "AthLinks/ElementLink.h"
40#if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS))
43 this->
addCellLink(std::make_unique<CaloClusterCellLink>(*links));
47 accCellLinks(*this).reset();
64#if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS))
67 this->
addCellLink(std::make_unique<CaloClusterCellLink>(*links));
71 accCellLinks(*this).reset();
93 static const std::array< const Accessor< std::vector< float > >*, 8 > allAcc = {
94 { &etaAcc, &phiAcc, &eAcc, &emaxAcc, &phimaxAcc, &etamaxAcc, &etasizeAcc,
96 for(
const auto *
a : allAcc ) {
97 if(
a->isAvailable( *
this ) ) {
98 if (!(*
a)(*this).empty()) {
99 if (clearSamplingVars){
103 std::cerr <<
"CaloCluster_v1 ERROR Attempt update sampling "
104 <<
"pattern while sampling variables are already set!"
143 if( std::abs( theM ) < 0.00001 ) {
146 p = std::sqrt( theE * theE - theM * theM );
153 double aEta = std::abs(
eta(s) );
157 const double sinTh = 1.0 / std::cosh( aEta );
281 return accBCL(*
this);
286 accRawE(*
this)=value;
291 accRawEta(*
this)=value;
296 accRawPhi(*
this)=value;
301 accRawM(*
this)=value;
308 accCalE(*
this)=value;
313 accCalEta(*
this)=value;
318 accCalPhi(*
this)=value;
323 accCalM(*
this)=value;
330 accAltE(*
this)=value;
335 accAltEta(*
this)=value;
340 accAltPhi(*
this)=value;
345 accAltM(*
this)=value;
490 return Type::CaloCluster;
500 std::vector<float>&
vec=
acc(*
this);
502 if (idx==CaloSampling::Unknown) {
503 std::cout <<
"ERROR: Sampling #" << sampling <<
" is not part of this cluster!" << std::endl;
652 static const std::array< const Accessor< std::vector< float > >*, 8 > allAcc = {
653 { &etaAcc, &phiAcc, &eAcc, &emaxAcc, &phimaxAcc, &etamaxAcc,
654 &etasizeAcc, &phisizeAcc } };
655 for (
const auto *
a : allAcc) {
656 if (
a->isAvailableWritable(*
this)) {
670 if( !
acc->isAvailable( *
this ) ) {
674 value = ( *acc )( *this );
680 if (
acc !=
nullptr ) { (*acc)(*this) = value; }
686 if (
acc !=
nullptr ) { (*acc)(*this) =
values; }
692 if (
acc ==
nullptr || !
acc->isAvailable(*
this) ) {
return false; }
719 size_t idx((
size_t)samp);
720 if ( idx >= (*
acc)(*this).size() ) { (*acc)(*this).resize(idx+1,0); }
729 if (
acc !=
nullptr &&
acc->isAvailable(*
this) ) {
730 size_t idx((
size_t)samp);
731 return ( idx < (*
acc)(*this).size() )
743 std::vector<int> ncells;
749 unsigned int size = 0;
761 }
else if(clustersize==
SW_7_11){
771 unsigned int size = 0;
784 }
else if(clustersize==
SW_7_11){
795#if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS))
803 const size_t idx=cccl->
size()-1;
807 accCellLinks(*
this)=el;
812 const EventContext& ctx)
819 const size_t idx = cccl->
size() - 1;
821 accCellLinks(
"CellLink");
824 accCellLinks(*
this) = el;
865#if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS))
867 accCellLinks(
"CellLink" );
869 accCellLinks( *this ).toPersistent();
875 accSisterCluster( *this ).toPersistent();
899 return accSisterCluster(*
this);
905 accSisterCluster(*
this)=sister;
919#if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS))
const boost::regex ref(r_ef)
#define AUXSTORE_PRIMITIVE_GETTER(CL, TYPE, NAME)
Macro creating the reader function for a primitive auxiliary property.
#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of primitive auxiliary properties.
CaloPhiRange class declaration.
std::vector< size_t > vec
static const Attributes_t empty
Data object for each calorimeter readout cell.
Container class for CaloCellLink.
Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink,...
CaloClusterCellLink::iterator removeCell(iterator cellItr)
Method to remove a cell.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
ElementLink implementation for ROOT usage.
bool isAvailableWritable(ELT &e) const
Test to see if this variable exists in the store and is writable.
void makePrivateStore()
Create a new (empty) private store for this object.
AuxElement & operator=(const AuxElement &other)
Assignment.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
Description of a calorimeter cluster.
float phiBE(const unsigned layer) const
Get the phi in one layer of the EM Calo.
void setRawEta(flt_t)
Set for signal state UNCALIBRATED.
ClusterSize clusterSize() const
Get cluster size.
void setAltPhi(flt_t)
Set for signal state ALTCALIBRATED.
const CaloCluster_v1 * getSisterCluster() const
Get a pointer to a 'sister' cluster (eg the non-calibrated counterpart)
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
CaloRecoStatus m_recoStatus
Reco status (transient only)
void setRawPhi(flt_t)
Set for signal state UNCALIBRATED.
void setSecondTime(flt_t stime)
Set second moment of cell timing distribution.
bool setPhi(const CaloSample sampling, const float phi)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
ncells_store_t::value_type setUpperCount(ncells_store_t::value_type cdata, UNSIGNED cupper)
State
enum of possible signal states.
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > GenVecFourMom_t
Base 4 Momentum type for calo.
unsigned m_samplingPattern
bit-pattern describing the calo samplings contributing to this cluster
unsigned sampVarIdx(const CaloSample) const
virtual double pt() const
The transverse momentum ( ) of the particle (negative for negative-energy clusters)
bool setSisterClusterLink(const ElementLink< CaloClusterContainer_v1 > &sister)
Set a link to a 'sister' cluster (eg the non-calibrated counterpart)
flt_t calPhi() const
Get in signal state CALIBRATED.
float phiSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
double m_secondTime
Second cell time moment (transient only)
float etasize(const CaloSample sampling) const
Returns cluster size in for a given sampling.
flt_t rawM() const
Get mass in signal state UNCALIBRATED.
void setAltM(flt_t)
Set mass for singal state ALTCALIBRATED.
bool setEtasize(const CaloSample sampling, const float etaSize)
Set the cluster size in for a given sampling.
std::unique_ptr< CaloClusterCellLink > m_cellLinks
Unique ptr to cell links.
float energy_max(const CaloSample sampling) const
Retrieve maximum cell energy in given sampling.
int numberCellsInSampling(const CaloSample samp, bool isInnerWheel=false) const
Returns number of cells in given sampling.
void addCellLink(CaloClusterCellLink *CCCL)
bool setSignalState(const State s)
Switch signal state.
CaloCluster_v1()
Default constructor.
virtual Type::ObjectType type() const
The type of the object as a simple enumeration.
virtual double m() const
The invariant mass of the particle.
void setRawE(flt_t)
Set Energy for signal state UNCALIBRATED.
void setCalPhi(flt_t)
Set for signal state CALIBRATED.
void setRawM(flt_t)
Set mass for singal state UNCALIBRATED.
uint8_t ncells_t
Type for number-of-cells-in-sampling counter.
virtual double eta() const
The pseudorapidity ( ) of the particle.
flt_t altPhi() const
Get in signal state ALTCALIBRATED.
flt_t rawPhi() const
Get in signal state UNCALIBRATED.
bool setPhisize(const CaloSample sampling, const float phiSize)
Set the cluster size in for a given sampling.
int numberCells() const
Return total number of cells in cluster.
void setAltEta(flt_t)
Set for signal state ALTCALIBRATED.
size_t size() const
size method (forwarded from CaloClusterCellLink obj)
bool setSamplVarFromAcc(const Accessor< std::vector< float > > &acc, const CaloSample sampling, const float value)
flt_t rawEta() const
Get in signal state UNCALIBRATED.
unsigned int getClusterEtaSize() const
Get eta size from cluster size.
UNSIGNED extractUpperCount(ncells_store_t::value_type cdata) const
extract upper cell count from data
virtual double e() const
The total energy of the particle.
void insertMoment(MomentType type, double value)
virtual ~CaloCluster_v1()
Destructor.
flt_t altE() const
Get Energy in signal state ALTCALIBRATED.
void setCalEta(flt_t)
Set for signal state CALIBRATED.
void setClusterSize(const ClusterSize)
Get cluster size.
CCTYPE adjustToRange(UNSIGNED count) const
< reduce value range to min and max counts
bool setPhimax(const CaloSample sampling, const float phiMax)
Set the phi of the cell with the highest energy in a particular sampling.
bool setEta(const CaloSample sampling, const float eta)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
bool setEmax(const CaloSample sampling, const float eMax)
Set the Energy of the cell with the highest energy in a particular sampling.
bool getNumberCellsInSampling(CDATA &cdata) const
Get number of cells for all sampling layer.
std::vector< uint16_t > ncells_store_t
Store type for number-of-cells-in-sampling counter.
float eSample(const CaloSample sampling) const
flt_t calEta() const
Get in signal state CALIBRATED.
ClusterSize
Enumeration to identify different cluster sizes.
flt_t secondTime() const
Access second moment of cell timing distribution.
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
bool setEnergy(const CaloSample sampling, const float e)
Set energy for a given sampling. Returns false if the sample isn't part of the cluster.
virtual double phi() const
The azimuthal angle ( ) of the particle.
void setSamplingPattern(const unsigned sp, const bool clearSamplingVars=false)
Set sampling pattern (one bit per sampling.
void toPersistent()
Function preparing the object to be persistified.
CaloCluster_v1 & operator=(const xAOD::CaloCluster_v1 &other)
Assignment operator.
float etamax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
CaloClusterCellLink * getOwnCellLinks()
Get a pointer to the owned CaloClusterCellLink object (non-const version)
void setAltE(flt_t)
Set Energy for signal state ALTCALIBRATED.
float getSamplVarFromAcc(const Accessor< std::vector< float > > &acc, const CaloSample sampling, const float errorvalue=CaloClusterDetails::defaultErrorValue) const
GenVecFourMom_t genvecP4() const
The full 4-momentum of the particle : GenVector type.
MomentType
Enums to identify different moments.
@ NCELL_SAMPLING
Number of cells in sampling layer.
@ SECOND_TIME
Second moment of cell time distribution in cluster.
float etaSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
virtual double rapidity() const
The true rapidity (y) of the particle.
void setNumberCellsInSampling(CaloSampling::CaloSample samp, int ncells, bool isInnerWheel=false)
Set the number of cells in a sampling layer.
float phimax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
const ElementLink< xAOD::CaloClusterContainer_v1 > & getSisterClusterLink() const
Get a link to a 'sister' cluster (eg the non-calibrated counterpart)
ncells_store_t::value_type setLowerCount(ncells_store_t::value_type cdata, UNSIGNED clower)
flt_t calE() const
Geet Energy in signal state CALIBRATED.
UNSIGNED extractLowerCount(ncells_store_t::value_type cdata) const
extract lower cell count from data
bool setEtamax(const CaloSample sampling, const float etaMax)
Set the eta of the cell with the highest energy in a particular sampling.
void clearSamplingData()
Clear the sampling data.
void setCalE(flt_t)
Set Energy for signal state CALIBRATED.
bool removeCell(const CaloCell *ptr)
Method to remove a cell to the cluster (slow!) (Beware: Kinematics not updated!)
State m_signalState
Current signal state.
void setCalM(flt_t)
Set mass for singal state CALIBRATED.
virtual FourMom_t p4() const
The full 4-momentum of the particle.
flt_t altEta() const
Get in signal state ALTCALIBRATED.
IParticle::FourMom_t FourMom_t
Definition of the 4-momentum type.
bool setLink(CaloClusterCellLinkContainer *CCCL, IProxyDict *sg=nullptr)
Set up an ElementLink to a CaloClusterCellLink object.
CaloSampling::CaloSample CaloSample
flt_t altM() const
Get mass in signal state ALTCALIBRATED.
unsigned nSamples() const
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
float phisize(const CaloSample sampling) const
Returns cluster size in for a given sampling.
void setBadChannelList(const CaloClusterBadChannelList &bcl)
const CaloClusterBadChannelList & badChannelList() const
flt_t calM() const
Get mass in signal state CALIBRATED.
unsigned int getClusterPhiSize() const
Get phi size from cluster size.
unsigned samplingPattern() const
Access to sampling pattern (one bit per sampling) (Method may be removed later)
void setM(flt_t)
Set Mass for the current signal state.
SG::Accessor< T, ALLOC > Accessor
std::string stime()
return the current data and time
float getSamplVar(const CaloSample sampling, const std::uint32_t samplingPattern, const std::span< const float > vec, const float errorvalue=defaultErrorValue)
float phiBE(const unsigned sample, const std::uint32_t samplingPattern, const std::span< const float > e_sampl, const std::span< const float > phi_sampl)
float etaBE(const unsigned sample, const std::uint32_t samplingPattern, const std::span< const float > e_sampl, const std::span< const float > eta_sampl)
Get the eta in one layer of the EM Calo.
float energyBE(const unsigned sample, const std::uint32_t samplingPattern, const std::span< const float > e_sampl)
Get the energy in one layer of the EM Calo.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
std::vector< CaloClusterBadChannelData > CaloClusterBadChannelList
const SG::AuxElement::Accessor< xAOD::CaloCluster_v1::ncells_store_t > * momentContainerAccessorV1(xAOD::CaloCluster_v1::MomentType moment)
Helper function for managing cluster moment Accessor objects.
const SG::AuxElement::Accessor< float > * momentAccessorV1(xAOD::CaloCluster_v1::MomentType moment)
Helper function for managing cluster moment Accessor objects.
static AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(EmTauRoI_v1, uint32_t, roiWord, setRoIWord) uint32_t EmTauRoI_v1 const SG::AuxElement::Accessor< std::vector< float > > values("thrValues")
This is a convenience function for accessing the threshold pattern part of the RoI.
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.