Commit 15f6f2ac authored by Jacob Julian Kempster's avatar Jacob Julian Kempster Committed by Frank Winklmeier
Browse files

L1Calo Bitwise Offline Software EDM

parent ac6c952e
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "xAODTrigger/versions/JetRoIContainer_v1.h" #include "xAODTrigger/versions/JetRoIContainer_v1.h"
#include "xAODTrigger/versions/JetRoIContainer_v2.h" #include "xAODTrigger/versions/JetRoIContainer_v2.h"
#include "xAODTrigger/versions/MuonRoIContainer_v1.h" #include "xAODTrigger/versions/MuonRoIContainer_v1.h"
#include "xAODTrigger/versions/eFexEMRoIContainer_v1.h"
#include "xAODTrigger/versions/TrigCompositeContainer_v1.h" #include "xAODTrigger/versions/TrigCompositeContainer_v1.h"
#include "xAODTrigger/versions/BunchConfContainer_v1.h" #include "xAODTrigger/versions/BunchConfContainer_v1.h"
...@@ -30,6 +31,7 @@ ADD_NS_DV_PROXY( xAOD, EmTauRoIContainer_v2 ); ...@@ -30,6 +31,7 @@ ADD_NS_DV_PROXY( xAOD, EmTauRoIContainer_v2 );
ADD_NS_DV_PROXY( xAOD, JetRoIContainer_v1 ); ADD_NS_DV_PROXY( xAOD, JetRoIContainer_v1 );
ADD_NS_DV_PROXY( xAOD, JetRoIContainer_v2 ); ADD_NS_DV_PROXY( xAOD, JetRoIContainer_v2 );
ADD_NS_DV_PROXY( xAOD, MuonRoIContainer_v1 ); ADD_NS_DV_PROXY( xAOD, MuonRoIContainer_v1 );
ADD_NS_DV_PROXY( xAOD, eFexEMRoIContainer_v1 );
ADD_NS_DV_PROXY( xAOD, TrigCompositeContainer_v1 ); ADD_NS_DV_PROXY( xAOD, TrigCompositeContainer_v1 );
ADD_NS_DV_PROXY( xAOD, BunchConfContainer_v1 ); ADD_NS_DV_PROXY( xAOD, BunchConfContainer_v1 );
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// $Id: eFexEMRoIAuxContainer_v1.cxx 2019-07-01 13:04:25Z watsona $
// Local include(s):
#include "xAODTrigger/versions/eFexEMRoIAuxContainer_v1.h"
namespace xAOD {
eFexEMRoIAuxContainer_v1::eFexEMRoIAuxContainer_v1()
: AuxContainerBase() {
AUX_VARIABLE( word0);
AUX_VARIABLE( word1);
AUX_VARIABLE( eFexNumber);
AUX_VARIABLE( retaEnv);
AUX_VARIABLE( retaCore);
AUX_VARIABLE( rhadHad);
AUX_VARIABLE( rhadEM);
AUX_VARIABLE( wstotNumerator);
AUX_VARIABLE( wstotDenominator);
AUX_VARIABLE( et);
AUX_VARIABLE( eta);
AUX_VARIABLE( phi);
AUX_VARIABLE( isTOB);
AUX_VARIABLE( thrPattern);
}
} // namespace xAOD
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// System include(s):
#include <stdexcept>
// xAOD include(s):
#include "xAODCore/AuxStoreAccessorMacros.h"
// Local include(s):
#include "xAODTrigger/versions/eFexEMRoI_v1.h"
namespace xAOD {
/// Constants used in converting to ATLAS units
const float eFexEMRoI_v1::s_tobEtScale = 100.;
const float eFexEMRoI_v1::s_xTobEtScale = 25.;
const float eFexEMRoI_v1::s_towerEtaWidth = 0.1;
const float eFexEMRoI_v1::s_minEta = -2.5;
eFexEMRoI_v1::eFexEMRoI_v1()
: SG::AuxElement() {
}
void eFexEMRoI_v1::initialize( uint8_t eFexNumber, uint32_t word0, uint32_t word1 ) {
setWord0( word0 );
setWord1( word1 );
seteFexNumber( eFexNumber );
setTobEt( etTOB() );
setEta( etaIndex() );
setPhi( phiIndex() );
/** If the object is a TOB then the isTOB should be true.
For xTOB default is false, but should be set if a matching TOB is found */
if (type() == TOB) setIsTOB(1);
else setIsTOB(0);
return;
}
/// Raw data words
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint32_t, Word0,
setWord0 )
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint32_t, Word1,
setWord1 )
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint8_t, eFexNumber,
seteFexNumber )
/// Only calculable externally
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint16_t, RetaCore,
setRetaCore )
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint16_t, RetaEnv,
setRetaEnv )
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint16_t, RhadEM,
setRhadEM )
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint16_t, RhadHad,
setRhadHad )
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint16_t, WstotNumerator,
setWstotNumerator )
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint16_t, WstotDenominator,
setWstotDenominator )
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint32_t, thrPattern,
setThrPattern )
/// Should be set for xTOB if there is a matching TOB
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, char, isTOB,
setIsTOB )
/// Extracted from data words, stored for convenience
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint16_t, tobEt,
setTobEt )
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint8_t, iEta,
setEta )
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint8_t, iPhi,
setPhi )
/// Methods to decode data from the TOB/RoI and return to the user
/// TOB or xTOB?
eFexEMRoI_v1::ObjectType eFexEMRoI_v1::type() const {
if (Word1() == 0) return TOB;
else return xTOB;
}
/// Hardware coordinate elements
unsigned int eFexEMRoI_v1::fpga() const {
return (Word0() >> s_fpgaBit) & s_fpgaMask;
}
unsigned int eFexEMRoI_v1::fpgaEta() const {
return (Word0() >> s_etaBit) & s_etaMask;
}
unsigned int eFexEMRoI_v1::fpgaPhi() const {
return (Word0() >> s_phiBit) & s_phiMask;
}
unsigned int eFexEMRoI_v1::UpNotDown() const {
return (Word0() >> s_updownBit) & s_updownMask;
}
unsigned int eFexEMRoI_v1::seed() const {
return (Word0() >> s_seedBit) & s_seedMask;
}
unsigned int eFexEMRoI_v1::seedMax() const {
return (Word0() >> s_maxBit) & s_maxMask;
}
/// Raw ET on TOB scale (100 MeV/count)
unsigned int eFexEMRoI_v1::etTOB() const {
// Data content = TOB
if (Word1() == 0) {
return (Word0() >> s_etBit) & s_etMask;
}
// Data Content = xTOB. Need to remove lower bits and cap range
else {
unsigned int etWord = (etXTOB() >> s_etBitXTOB);
if (etWord > s_etMask) etWord = s_etMask;
return etWord;
}
}
/// Full precision ET (25 MeV/count, only available if object is an xTOB
unsigned int eFexEMRoI_v1::etXTOB() const {
/// If the object is not an xTOB return 0 as high-precision ET unavailable
if (Word1() == 0) {
//return etTOB()*s_tobEtScale/s_xTobEtScale;
return 0;
}
else {
return (Word1() >> s_etBit) & s_etFullMask;
}
}
/// Results of the 3 jet discriminant algorithms
unsigned int eFexEMRoI_v1::RetaThresholds() const {
return (Word0() >> s_veto1Bit) & s_veto1Mask;
}
unsigned int eFexEMRoI_v1::RhadThresholds() const {
return (Word0() >> s_veto2Bit) & s_veto2Mask;
}
unsigned int eFexEMRoI_v1::WstotThresholds() const {
return (Word0() >> s_veto3Bit) & s_veto3Mask;
}
unsigned int eFexEMRoI_v1::bcn4() const {
return (Word1() >> s_bcn4Bit) & s_bcn4Mask;
}
/// Return single 32-bit TOB word from an xTOB
uint32_t eFexEMRoI_v1::tobWord() const {
// Do something sensible if called for a TOB
if (Word1() == 0) return Word0();
// When called for xTOB
else {
uint32_t word = Word0() + etTOB();
return word;
}
}
/// Methods that require combining results or applying scales
/// ET on TOB scale
float eFexEMRoI_v1::et() const {
return tobEt()*s_tobEtScale;
}
/// Floating point coordinates
float eFexEMRoI_v1::eta() const {
return (s_minEta + iEta()*s_towerEtaWidth + (seed()+0.5)*s_towerEtaWidth/4);
}
float eFexEMRoI_v1::phi() const {
float value = iPhi() * M_PI/32. + M_PI/64.;
if (value > M_PI) value = value - 2.*M_PI;
return value;
}
/// Jet discriminant values.
/// Note that these are for convenience & intelligibility, but these should
/// not be used for bitwise-accurate menu studies
float eFexEMRoI_v1::Reta() const {
float sum = RetaCore() + RetaEnv();
if (sum > 0) return (1. - RetaCore()/sum);
else return -1.;
}
float eFexEMRoI_v1::Rhad() const {
float sum = RhadEM() + RhadHad();
if (sum > 0) return (RhadHad()/sum);
else return -1.;
}
float eFexEMRoI_v1::Wstot() const {
if (WstotDenominator() > 0) return (WstotNumerator()/WstotDenominator());
else return -1.;
}
/// Methods that decode the eFEX number
/// Return phi index in the range 0-63
int eFexEMRoI_v1::phiIndex() const {
/// Get the eFEX index in phi (1-8, unfortunately)
unsigned int eFEX = (eFexNumber() >> s_eFexPhiBit) & s_eFexPhiMask;
/// Find global phi index (0-63) for this window in this eFEX (the -1 is to correct for the eFEX phi index)
unsigned int index = s_eFexPhiWidth*eFEX + s_eFexPhiOffset + fpgaPhi() -1;
if (index >= s_numPhi) index -= s_numPhi;
return index;
}
/// Return an eta index in the range 0-49
/// Note that this may not be the final format!
/// And you need to combine with the seed() value to get full eta precision
int eFexEMRoI_v1::etaIndex() const {
/// Get the eFEX number
uint8_t eFEX = (eFexNumber() >> s_eFexEtaBit) & s_eFexEtaMask;
/// FPGA min eta
uint8_t index = 99; /// Define a default value in case of invalid eFEX number
switch (eFEX) {
case eFexC: index = s_EtaCOffset + fpga()*s_fpgaEtaWidth + (fpga() > 0 ? 1 : 0);
break;
case eFexB: index = s_EtaBOffset + fpga()*s_fpgaEtaWidth;
break;
case eFexA: index = s_EtaAOffset + fpga()*s_fpgaEtaWidth;
break;
}
/// Add eta location within the FPGA & return value
return index + fpgaEta();
}
} // namespace xAOD
...@@ -30,4 +30,5 @@ ...@@ -30,4 +30,5 @@
#include "xAODTrigger/TrigPassBitsAuxContainer.h" #include "xAODTrigger/TrigPassBitsAuxContainer.h"
#include "xAODTrigger/RoiDescriptorStore.h" #include "xAODTrigger/RoiDescriptorStore.h"
#include "xAODTrigger/RoiDescriptorStoreAuxInfo.h" #include "xAODTrigger/RoiDescriptorStoreAuxInfo.h"
#include "xAODTrigger/eFexEMRoIContainer.h"
#include "xAODTrigger/eFexEMRoIAuxContainer.h"
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// $Id: eFexEMRoI.h Alan Watson $
#ifndef XAODEFEXEMROI_H
#define XAODEFEXEMROI_H
// Local include(s):
#include "xAODTrigger/versions/eFexEMRoI_v1.h"
// Namespace holding all the xAOD EDM classes
namespace xAOD{
/// Define the latest version of the eFexEMRoI class
typedef eFexEMRoI_v1 eFexEMRoI;
}
#include "xAODCore/CLASS_DEF.h"
CLASS_DEF( xAOD::eFexEMRoI , 58699861 , 1 )
#endif
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// $Id: eFexEMRoIAuxContainer.h 2019-07-01 13:04:25Z watsona $
#ifndef XAODTRIGGER_EFEXEMROIAUXCONTAINER_H
#define XAODTRIGGER_EFEXEMROIAUXCONTAINER_H
// Local include(s):
#include "xAODTrigger/versions/eFexEMRoIAuxContainer_v1.h"
namespace xAOD{
typedef eFexEMRoIAuxContainer_v1 eFexEMRoIAuxContainer;
}
// Set up a CLID for the class:
#include "xAODCore/CLASS_DEF.h"
CLASS_DEF( xAOD::eFexEMRoIAuxContainer , 1081052998 , 1 )
#endif // XAODTRIGGER_EFEXEMROIAUXCONTAINER_H
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// $Id: eFexEMRoIContainer.h 2019-07-01 13:04:25Z watsona $
#ifndef XAODTRIGGER_EFEXEMROICONTAINER_H
#define XAODTRIGGER_EFEXEMROICONTAINER_H
// Local include(s):
#include "xAODTrigger/eFexEMRoI.h"
#include "xAODTrigger/versions/eFexEMRoIContainer_v1.h"
namespace xAOD{
typedef eFexEMRoIContainer_v1 eFexEMRoIContainer;
}
// Set up a CLID for the container:
#include "xAODCore/CLASS_DEF.h"
CLASS_DEF( xAOD::eFexEMRoIContainer , 1176191655 , 1 )
#endif // XAODTRIGGER_EMTAUROICONTAINER_H
...@@ -114,6 +114,19 @@ ...@@ -114,6 +114,19 @@
targetClass="DataLink<xAOD::EnergySumRoI_v2>" targetClass="DataLink<xAOD::EnergySumRoI_v2>"
source="" target="" /> source="" target="" />
<!-- Phase I L1Calo RoI dictionaries: -->
<!-- RoI interface types -->
<class name="xAOD::eFexEMRoI_v1" />
<class name="xAOD::eFexEMRoIContainer_v1"
id="89FFBED7-9DDF-4FC4-B099-2B4F827BD098" />
<typedef name="xAOD::eFexEMRoI" />
<typedef name="xAOD::eFexEMRoIContainer" />
<!-- RoI auxilliary types -->
<class name="xAOD::eFexEMRoIAuxContainer_v1"
id="6A1D7149-7476-4F23-8896-D88CB3BF6846" />
<typedef name="xAOD::eFexEMRoIAuxContainer" />
<!-- xAOD::TriggerMenu interface type(s). --> <!-- xAOD::TriggerMenu interface type(s). -->
<class name="xAOD::TriggerMenu_v1" /> <class name="xAOD::TriggerMenu_v1" />
<class name="xAOD::TriggerMenuContainer_v1" <class name="xAOD::TriggerMenuContainer_v1"
......
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: eFexEMRoIAuxContainer_v1.h 631149 2014-11-26 12:26:18Z krasznaa $
#ifndef XAODTRIGGER_VERSIONS_EFEXEMROIAUXCONTAINER_V1_H
#define XAODTRIGGER_VERSIONS_EFEXEMROIAUXCONTAINER_V1_H
// System include(s):
extern "C" {
# include <stdint.h>
}
#include <vector>
#include <string>
// EDM include(s):
#include "xAODCore/AuxContainerBase.h"
namespace xAOD {
/// Auxiliary store for the LVL1 eFEX EM TOB/RoI container
///
/// This auxiliary container can describe the properties of a container
/// of LVL1 EM RoIs.
///
/// @author Alan Watson <Alan.Watson@cern.ch>
///
/// $Revision: 1 $
/// $Date: 2019-07-01 13:04:25 +0100 (Mon, 01 Jul 2019) $
///
class eFexEMRoIAuxContainer_v1 : public AuxContainerBase {
public:
/// Default constuctor
eFexEMRoIAuxContainer_v1();
private:
std::vector< uint32_t > word0;
std::vector< uint32_t > word1;
std::vector< uint8_t > eFexNumber;
std::vector< uint16_t > retaEnv;
std::vector< uint16_t > retaCore;
std::vector< uint16_t > rhadHad;
std::vector< uint16_t > rhadEM;
std::vector< uint16_t > wstotNumerator;
std::vector< uint16_t > wstotDenominator;
std::vector< uint16_t > et;
std::vector< uint8_t > eta;
std::vector< uint8_t > phi;
std::vector< char > isTOB;
std::vector< uint32_t > thrPattern;
}; // class eFexEMRoIAuxContainer_v1
} // namespace xAOD
// Declare the inheritance of the container:
#include "xAODCore/BaseInfo.h"
SG_BASE( xAOD::eFexEMRoIAuxContainer_v1, xAOD::AuxContainerBase );
#endif // XAODTRIGGER_VERSIONS_eFexEMRoIAuxContainer_V1_H
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// $Id: eFexEMRoIContainer_v1.cxx 2019-07-01 13:04:25Z watsona $
#ifndef XAODTRIGGER_VERSIONS_EFEXEMROICONTAINER_V1_H
#define XAODTRIGGER_VERSIONS_EFEXEMROICONTAINER_V1_H
// Core include(s):
#include "AthContainers/DataVector.h"
// Local include(s):
#include "xAODTrigger/versions/eFexEMRoI_v1.h"
namespace xAOD {
/// Declare the em/tau RoI container type
typedef DataVector< xAOD::eFexEMRoI_v1 > eFexEMRoIContainer_v1;
}
#endif // XAODTRIGGER_VERSIONS_EFEXEMROICONTAINER_V1_H
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// $Id: eFexEMRoI_v1.h 1 2019-06-30 12:15:18 watsona $
#ifndef XAODTRIGGER_VERSIONS_EFEXEMROI_V1_H
#define XAODTRIGGER_VERSIONS_EFEXEMROI_V1_H
// System include(s):
extern "C" {
# include <stdint.h>
}
#include <vector>
#include <string>
// xAOD include(s):
#include "AthContainers/AuxElement.h"
namespace xAOD {
/// Class describing a LVL1 eFEX EM region of interest
///
/// This class describes the properties of an EM Trigger Object (TOB)
/// or Region of Interest (RoI) in the xAOD format.
///
/// @author Alan Watson <Alan.Watson@cern.ch>
///
/// $Revision: 1 $
/// $Date: 2019-06-30 12:15:18 +0100 (Sun, 30 Jun 2019) $
///
class eFexEMRoI_v1 : public SG::AuxElement {
public:
/// Default constructor
eFexEMRoI_v1();
/// Initialise the object with its most important properties
void initialize( uint8_t eFexNumber, uint32_t Word0, uint32_t Word1 = 0 );
/// Object types
enum ObjectType {
xTOB = 0, ///< This object is an xTOB (2*32 bit words)
TOB = 1 ///< This object is a TOB (1*32 bit word)
};
/// The "raw" 32-bit words describing the e/gamma candidate
uint32_t Word0() const;
uint32_t Word1() const;
/// Set the "raw" 32-bit words describing the e/gamma candidate
void setWord0( uint32_t value );
void setWord1( uint32_t value );
/// The eFEX number
uint8_t eFexNumber() const;
/// Set the eFEX number
void seteFexNumber( uint8_t value );
/// TOB ET (decoded from TOB, stored for convenience)
uint16_t tobEt() const; /// getter for integer ET on TOB scale (100 MeV/count)
void setTobEt( uint16_t value); /// setter for the above
float et() const; /// floating point value (MeV, TOB scale)
/// Eta Coordinates (decoded from TOB, stored for convenience)
uint8_t iEta() const; /// getter for integer eta index (0-49)
void setEta( uint8_t value); /// setter for the above
unsigned int seed() const; /// Seed supercell index within central tower (0 -> 3)
float eta() const; /// Floating point, full precision (0.025)
/// Phi coordinates
uint8_t iPhi() const; /// Getter for integer phi index (0-63)
void setPhi( uint8_t value); /// Setter for the above
float phi() const; /// Floating point, ATLAS phi convention (-pi -> pi)
/// Jet Discriminants
/// Derived floating point values (not used in actual algorithm)
float Reta() const;
float Rhad() const;
float Wstot() const;
/// Actual values used in algorithm (setters and getters)
uint16_t RetaCore() const;
uint16_t RetaEnv() const;
uint16_t RhadEM() const;
uint16_t RhadHad() const;
uint16_t WstotNumerator() const;
uint16_t WstotDenominator() const;
void setRetaCore( uint16_t value);
void setRetaEnv( uint16_t value);
void setRhadEM( uint16_t value);
void setRhadHad( uint16_t value);
void setWstotNumerator( uint16_t value);
void setWstotDenominator( uint16_t value);
/// Is this one a TOB (or xTOB partner of a TOB)?
char isTOB() const;
void setIsTOB( char value);
/// Pattern of thresholds passed
uint32_t thrPattern() const;
void setThrPattern( uint32_t value);
/// Return TOB word corresponding to this TOB or xTOB
uint32_t tobWord() const;
/// Data decoded from the TOB/RoI word and eFEX number