24 bool isDummyVal(
float x)
27 const float dummyVal = -999;
28 return std::abs(
x - dummyVal) <
epsilon;
32 class DummyValError :
public std::exception
51 "Match electrons by shared track");
53 "Match electrons by cluster proximity");
55 "Cluster matching delta eta");
57 "Cluster matching delta phi");
72 ATH_MSG_ERROR(
"You must enable at least one: UseTrackMatch or UseClusterMatch");
73 return StatusCode::FAILURE;
90 return StatusCode::SUCCESS;
105 if(&cont1.getXAODObject() != &cont2.getXAODObject()) {
106 ATH_MSG_ERROR(
"This tool expects both electron containers to be the " <<
108 return StatusCode::FAILURE;
115 return StatusCode::SUCCESS;
132 for(
const auto el1 : electrons) {
134 for(
const auto el2 : electrons) {
135 if(el1 == el2)
continue;
144 catch(
const DummyValError& e) {
145 ATH_MSG_ERROR(
"Cluster 2nd sampling eta/phi values are -999. " <<
146 "It seems you are missing the neccesary variables to "
147 "do the requested electron-electron cluster matching");
148 return StatusCode::FAILURE;
153 return StatusCode::SUCCESS;
166 auto trk1 = el1(acc.m_trackAcc);
167 auto trk2 = el2(acc.m_trackAcc);
168 if(trk1.size() > 0 && trk2.size() > 0 && trk1[0] == trk2[0])
174 auto clus1 = el1(acc.m_caloClusterAcc)[0].value();
175 auto clus2 = el2(acc.m_caloClusterAcc)[0].value();
179 const unsigned layer = 2;
180 const float eta1 = clus1(acc.m_etaBEAcc.value(), layer);
181 const float eta2 = clus2(acc.m_etaBEAcc.value(), layer);
182 const float phi1 = clus1(acc.m_phiBEAcc.value(), layer);
183 const float phi2 = clus2(acc.m_phiBEAcc.value(), layer);
186 if(isDummyVal(eta1) || isDummyVal(eta2) ||
187 isDummyVal(phi1) || isDummyVal(phi2)) {
188 throw DummyValError();
191 const float dEta = eta1 - eta2;
192 const float dPhi =
deltaPhi(phi1, phi2);
224 if(el1(acc.m_ptAcc) < el2(acc.m_ptAcc))
return true;
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define ATH_CHECK
Evaluate an expression and check for errors.
DataVector adapter that acts like it holds const pointers.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ObjectId< ContainerId::particle1 > Particle1Id
ObjectId< ContainerId::eventContext > EventContextId
ObjectRange< ContainerId::particle2 > Particle2Range
ObjectRange< ContainerId::particle1 > Particle1Range
const uint16_t AuthorElectron
Object Reconstructed by standard cluster-based algorithm.
const uint16_t AuthorAmbiguous
Object Reconstructed by standard cluster-based algorithm.
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
static constexpr bool isXAOD
Whether this is the xAOD mode.