|
ATLAS Offline Software
|
Go to the documentation of this file.
14 #include "AthLinks/ElementLink.h"
34 m_samplingPattern(
other.samplingPattern()),
36 m_recoStatus(
other.m_recoStatus),
37 m_secondTime(
other.m_secondTime) {
40 #if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS))
47 accCellLinks(*this).reset();
49 #endif // not defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS)
64 #if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS))
71 accCellLinks(*this).reset();
73 #endif // not defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS)
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;
495 const std::vector<float>&
vec=acc(*
this);
507 std::vector<float>&
vec=acc(*
this);
510 std::cout <<
"ERROR: Sampling #" << sampling <<
" is not part of this cluster!" << std::endl;
631 if (
sample>3)
return -999;
645 if (
sample>3) {
return -999;}
648 const bool haveBarrel=this->
hasSampling(barrelSample);
649 const bool haveEndcap=this->
hasSampling(endcapSample);
650 if (haveBarrel && haveEndcap) {
652 float eBarrel=
eSample(barrelSample);
653 float eEndcap=
eSample(endcapSample);
657 float eSum=eBarrel + eEndcap;
660 if ((eBarrel > 0 && eEndcap > 0) || (eBarrel < 0 && eEndcap < 0))
661 return (eBarrel * etaBarrel + eEndcap * etaEndcap) / eSum;
662 else if (eBarrel > 0)
667 return (0.5 * (etaBarrel + etaEndcap));
681 if (
sample>3) {
return -999;}
684 const bool haveBarrel=this->
hasSampling(barrelSample);
685 const bool haveEndcap=this->
hasSampling(endcapSample);
686 if (haveBarrel && haveEndcap) {
688 float eBarrel=
eSample(barrelSample);
689 float eEndcap=
eSample(endcapSample);
690 float eSum=eBarrel+eEndcap;
694 if ((eBarrel > 0 && eEndcap > 0) || (eBarrel < 0 && eEndcap < 0)) {
697 }
else if (eBarrel > 0)
728 static const std::array< const Accessor< std::vector< float > >*, 8 > allAcc = {
729 { &etaAcc, &phiAcc, &eAcc, &emaxAcc, &phimaxAcc, &etamaxAcc,
730 &etasizeAcc, &phisizeAcc } };
731 for (
const auto *
a : allAcc) {
732 if (
a->isAvailableWritable(*
this)) {
746 if( ! acc->isAvailable( *
this ) ) {
750 value = ( *acc )( *this );
756 if ( acc !=
nullptr ) { (*acc)(*this) =
value; }
762 if ( acc !=
nullptr ) { (*acc)(*this) = values; }
768 if ( acc ==
nullptr || !acc->isAvailable(*
this) ) {
return false; }
770 values = (*acc)(*this);
793 ncells_t nc(adjustToRange<int,ncells_t>(ncells));
795 size_t idx((
size_t)samp);
796 if (
idx >= (*acc)(*this).size() ) { (*acc)(*this).resize(
idx+1,0); }
798 (*acc)(*this)[
idx] = isInnerWheel ? setUpperCount<ncells_t>((*acc)(*
this)[
idx],
nc) : setLowerCount<ncells_t>((*acc)(*
this)[
idx],
nc);
805 if ( acc !=
nullptr && acc->isAvailable(*
this) ) {
806 size_t idx((
size_t)samp);
807 return (
idx < (*acc)(*this).size() )
809 ? extractUpperCount<int>((*acc)(*
this)[
idx])
810 : extractLowerCount<int>((*acc)(*
this)[
idx])
819 std::vector<int> ncells;
820 return getNumberCellsInSampling<std::vector<int> >(ncells) ?
std::accumulate(ncells.begin(),ncells.end(),0) : 0;
825 unsigned int size = 0;
837 }
else if(clustersize==
SW_7_11){
847 unsigned int size = 0;
860 }
else if(clustersize==
SW_7_11){
871 #if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS))
879 const size_t idx=cccl->
size()-1;
883 accCellLinks(*
this)=
el;
888 const EventContext& ctx)
895 const size_t idx = cccl->
size() - 1;
897 accCellLinks(
"CellLink");
900 accCellLinks(*
this) =
el;
934 #endif // not defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS)
941 #if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS))
943 accCellLinks(
"CellLink" );
945 accCellLinks( *this ).toPersistent();
947 #endif // not defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS)
951 accSisterCluster( *this ).toPersistent();
975 return accSisterCluster(*
this);
981 accSisterCluster(*
this)=sister;
995 #if !(defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS))
1001 #endif // not defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS)
float phimax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
virtual double phi() const
The azimuthal angle ( ) of the particle.
unsigned nSamples() const
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
double m_secondTime
Second cell time moment (transient only)
Container class for CaloCellLink.
bool setPhisize(const CaloSample sampling, const float phiSize)
Set the cluster size in for a given sampling.
ClusterSize
Enumeration to identify different cluster sizes.
const SG::AuxElement::Accessor< float > * momentAccessorV1(xAOD::CaloCluster_v1::MomentType moment)
Helper function for managing cluster moment Accessor objects.
flt_t rawEta() const
Get in signal state UNCALIBRATED.
void setRawM(flt_t)
Set mass for singal state UNCALIBRATED.
int numberCells() const
Return total number of cells in cluster.
CaloSampling::CaloSample CaloSample
Helper class to provide type-safe access to aux data.
State m_signalState
Current signal state.
flt_t calE() const
Geet Energy in signal state CALIBRATED.
void setAltM(flt_t)
Set mass for singal state ALTCALIBRATED.
flt_t secondTime() const
Access second moment of cell timing distribution.
void clearSamplingData()
Clear the sampling data.
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
flt_t calEta() const
Get in signal state CALIBRATED.
State
enum of possible signal states.
void setAltEta(flt_t)
Set for signal state ALTCALIBRATED.
CaloRecoStatus m_recoStatus
Reco status (transient only)
virtual double m() const
The invariant mass of the particle.
void insertMoment(MomentType type, double value)
float etasize(const CaloSample sampling) const
Returns cluster size in for a given sampling.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
bool setLink(CaloClusterCellLinkContainer *CCCL, IProxyDict *sg=nullptr)
Set up an ElementLink to a CaloClusterCellLink object.
float phiBE(const unsigned layer) const
Get the phi in one layer of the EM Calo.
std::vector< size_t > vec
void setCalEta(flt_t)
Set for signal state CALIBRATED.
std::string stime()
return the current data and time
void setSamplingPattern(const unsigned sp, const bool clearSamplingVars=false)
Set sampling pattern (one bit per sampling.
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.
bool const RAWDATA *ch2 const
Class providing the definition of the 4-vector interface.
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > GenVecFourMom_t
Base 4 Momentum type for calo.
float etamax(const CaloSample sampling) const
Retrieve of cell with maximum energy in given sampling.
uint8_t ncells_t
Type for number-of-cells-in-sampling counter.
flt_t calM() const
Get mass in signal state CALIBRATED.
bool setEmax(const CaloSample sampling, const float eMax)
Set the Energy of the cell with the highest energy in a particular sampling.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
MomentType
Enums to identify different moments.
@ NCELL_SAMPLING
Number of cells in sampling layer.
float etaSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
void setSecondTime(flt_t stime)
Set second moment of cell timing distribution.
Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink,...
ClusterSize clusterSize() const
Get cluster size.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
bool setPhimax(const CaloSample sampling, const float phiMax)
Set the phi of the cell with the highest energy in a particular sampling.
CaloCluster_v1()
Default constructor.
Description of a calorimeter cluster.
std::vector< CaloClusterBadChannelData > CaloClusterBadChannelList
void setCalPhi(flt_t)
Set for signal state CALIBRATED.
void setRawE(flt_t)
Set Energy for signal state UNCALIBRATED.
bool removeCell(const CaloCell *ptr)
Method to remove a cell to the cluster (slow!) (Beware: Kinematics not updated!)
GenVecFourMom_t genvecP4() const
The full 4-momentum of the particle : GenVector type.
void setCalM(flt_t)
Set mass for singal state CALIBRATED.
unsigned int getClusterEtaSize() const
Get eta size from cluster size.
virtual double eta() const
The pseudorapidity ( ) of the particle.
float energy_max(const CaloSample sampling) const
Retrieve maximum cell energy in given sampling.
const ElementLink< xAOD::CaloClusterContainer_v1 > & getSisterClusterLink() const
Get a link to a 'sister' cluster (eg the non-calibrated counterpart)
std::vector< uint16_t > ncells_store_t
Store type for number-of-cells-in-sampling counter.
unsigned m_samplingPattern
bit-pattern describing the calo samplings contributing to this cluster
const CaloCluster_v1 * getSisterCluster() const
Get a pointer to a 'sister' cluster (eg the non-calibrated counterpart)
bool setSignalState(const State s)
Switch signal state.
size_t size() const
size method (forwarded from CaloClusterCellLink obj)
void setAltE(flt_t)
Set Energy for signal state ALTCALIBRATED.
void setRawEta(flt_t)
Set for signal state UNCALIBRATED.
CaloPhiRange class declaration.
flt_t calPhi() const
Get in signal state CALIBRATED.
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
CaloClusterCellLink::iterator removeCell(iterator cellItr)
Method to remove a cell.
float phiSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
bool setSisterClusterLink(const ElementLink< CaloClusterContainer_v1 > &sister)
Set a link to a 'sister' cluster (eg the non-calibrated counterpart)
std::unique_ptr< CaloClusterCellLink > m_cellLinks
Unique ptr to cell links.
unsigned int getClusterPhiSize() const
Get phi size from cluster size.
static double fix(double phi)
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
bool setSamplVarFromAcc(const Accessor< std::vector< float > > &acc, const CaloSample sampling, const float value)
virtual FourMom_t p4() const
The full 4-momentum of the particle.
flt_t rawM() const
Get mass in signal state UNCALIBRATED.
virtual double pt() const
The transverse momentum ( ) of the particle (negative for negative-energy clusters)
virtual ~CaloCluster_v1()
Destructor.
IParticle::FourMom_t FourMom_t
Definition of the 4-momentum type.
unsigned sampVarIdx(const CaloSample) const
const CaloClusterBadChannelList & badChannelList() const
flt_t altE() const
Get Energy in signal state ALTCALIBRATED.
void setNumberCellsInSampling(CaloSampling::CaloSample samp, int ncells, bool isInnerWheel=false)
Set the number of cells in a sampling layer.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
void makePrivateStore()
Create a new (empty) private store for this object.
void setCalE(flt_t)
Set Energy for signal state CALIBRATED.
AuxElement & operator=(const AuxElement &other)
Assignment.
flt_t altPhi() const
Get in signal state ALTCALIBRATED.
float eSample(const CaloSample sampling) const
CaloCluster_v1 & operator=(const xAOD::CaloCluster_v1 &other)
Assignment operator.
void addCellLink(CaloClusterCellLink *CCCL)
Data object for each calorimeter readout cell.
void setClusterSize(const ClusterSize)
Get cluster size.
flt_t rawPhi() const
Get in signal state UNCALIBRATED.
const boost::regex ref(r_ef)
bool isAvailableWritable(ELT &e) const
Test to see if this variable exists in the store and is writable.
CaloClusterCellLink * getOwnCellLinks()
Get a pointer to the owned CaloClusterCellLink object (non-const version)
#define AUXSTORE_PRIMITIVE_GETTER(CL, TYPE, NAME)
Macro creating the reader function for a primitive auxiliary property.
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
bool setPhi(const CaloSample sampling, const float phi)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
float phisize(const CaloSample sampling) const
Returns cluster size in for a given sampling.
void toPersistent()
Function preparing the object to be persistified.
flt_t altEta() const
Get in signal state ALTCALIBRATED.
bool setEtamax(const CaloSample sampling, const float etaMax)
Set the eta of the cell with the highest energy in a particular sampling.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
@ SECOND_TIME
Second moment of cell time distribution in cluster.
bool setEtasize(const CaloSample sampling, const float etaSize)
Set the cluster size in for a given 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.
virtual Type::ObjectType type() const
The type of the object as a simple enumeration.
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
ObjectType
Type of objects that have a representation in the xAOD EDM.
void setAltPhi(flt_t)
Set for signal state ALTCALIBRATED.
flt_t altM() const
Get mass in signal state ALTCALIBRATED.
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
size_type size() const noexcept
Returns the number of elements in the collection.
float getSamplVarFromAcc(const Accessor< std::vector< float > > &acc, const CaloSample sampling, const float errorvalue=-999) const
virtual double rapidity() const
The true rapidity (y) of the particle.
virtual double e() const
The total energy of the particle.
const SG::AuxElement::Accessor< xAOD::CaloCluster_v1::ncells_store_t > * momentContainerAccessorV1(xAOD::CaloCluster_v1::MomentType moment)
Helper function for managing cluster moment Accessor objects.
void setM(flt_t)
Set Mass for the current signal state.
void setRawPhi(flt_t)
Set for signal state UNCALIBRATED.
static double diff(double phi1, double phi2)
simple phi1 - phi2 calculation, but result is fixed to respect range.
int numberCellsInSampling(const CaloSample samp, bool isInnerWheel=false) const
Returns number of cells in given sampling.