ATLAS Offline Software
EMTauInputProvider.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "./EMTauInputProvider.h"
6 
7 #include <math.h>
8 
10 
12 
13 #include "L1TopoEvent/ClusterTOB.h"
15 
16 using namespace std;
17 using namespace LVL1;
18 
19 EMTauInputProvider::EMTauInputProvider(const std::string& type, const std::string& name,
20  const IInterface* parent) :
21  base_class(type, name, parent),
22  m_emTauLocation( TrigT1CaloDefs::EmTauTopoTobLocation )
23 {
24  declareInterface<LVL1::IInputTOBConverter>( this );
25  declareProperty( "EmTauROILocation", m_emTauLocation, "Storegate key for the EMTAU info from CMX" );
26 }
27 
29 {}
30 
33 
35 
36  if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
37 
38  return StatusCode::SUCCESS;
39 }
40 
43 
52  // Retrieve EMTAU RoIs (they are built by EMTAUTrigger)
53 
55  if( !emtau.isValid() ) {
56  ATH_MSG_WARNING("No CPCMXTopoDataCollection with SG key '" << m_emTauLocation.key() << "' found in the event. No EM or TAU input for the L1Topo simulation.");
57  return StatusCode::RECOVERABLE;
58  }
59 
60  ATH_MSG_DEBUG("Filling the input event. Number of emtau topo data objects: " << emtau->size());
61  // topoData is read in in reverse in order to obtain the same crate order as in the hardware (3->0, not 0->3)
62  for(auto iTopoData = emtau->rbegin(); iTopoData != emtau->rend(); ++iTopoData) {
63  const CPCMXTopoData *topoData = *iTopoData;
64 
65  // fill the vector of TOBs
66  std::vector< CPTopoTOB > tobs;
67  topoData->tobs(tobs);
68  ATH_MSG_DEBUG("Emtau topo data object has # TOBs: " << tobs.size());
69  for(const CPTopoTOB & tob : tobs ) {
70  ATH_MSG_DEBUG( "EMTAU TOB with cmx = " << tob.cmx() << "[" << (tob.cmx()==0?"EM":"TAU") << "]"
71  << " : e = " << setw(3) << tob.et() << ", isolation " << tob.isolation()
72  << ", eta = " << setw(2) << tob.eta() << ", phi = " << tob.phi()
73  << ", ieta = " << setw(2) << tob.ieta() << ", iphi = " << tob.iphi()
74  << ", word = " << hex << tob.roiWord() << dec
75  );
76 
77  TCS::ClusterTOB cl(tob.et(), tob.isolation(), tob.ieta(), tob.iphi(), tob.cmx()==0 ? TCS::CLUSTER : TCS::TAU, tob.roiWord() );
78  cl.setEtaDouble( tob.eta() );
79  cl.setPhiDouble( tob.phi() );
80 
81  if(tob.cmx()==0) {
82  inputEvent.addCluster( cl );
83  auto mon_hEMEt = Monitored::Scalar("EMTOBEt", cl.Et());
84  auto mon_hEMPhi = Monitored::Scalar("EMTOBPhi", cl.phi());
85  auto mon_hEMEta = Monitored::Scalar("EMTOBEta", cl.eta());
86  Monitored::Group(m_monTool, mon_hEMEt, mon_hEMPhi, mon_hEMEta);
87  } else {
88  inputEvent.addTau( cl );
89  auto mon_hTauEt = Monitored::Scalar("TauTOBEt", cl.Et());
90  auto mon_hTauPhi = Monitored::Scalar("TauTOBPhi", cl.phi());
91  auto mon_hTauEta = Monitored::Scalar("TauTOBEta", cl.eta());
92  Monitored::Group(m_monTool, mon_hTauEt, mon_hTauPhi, mon_hTauEta);
93  }
94  }
95  if(topoData->overflow()){
96  inputEvent.setOverflowFromEmtauInput(true);
97  ATH_MSG_DEBUG("setOverflowFromEmtauInput : true");
98  }
99  }
100  return StatusCode::SUCCESS;
101 }
102 
103 void
104 EMTauInputProvider::CalculateCoordinates(int32_t roiWord, double & eta, double & phi) const {
106  constexpr double TwoPI = 2 * M_PI;
107  CoordinateRange coordRange = get.coordinate( roiWord );
108 
109  eta = coordRange.eta();
110  phi = coordRange.phi();
111  if( phi > M_PI ) phi -= TwoPI;
112 }
113 
LVL1::EMTauInputProvider::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: EMTauInputProvider.h:32
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
EmTauROI_ClassDEF.h
LVL1::Coordinate::phi
double phi() const
return phi
Definition: Coordinate.cxx:50
LVL1::EMTauInputProvider::initialize
virtual StatusCode initialize()
Definition: EMTauInputProvider.cxx:32
TCS::CLUSTER
@ CLUSTER
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Types.h:11
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TCS::TopoInputEvent::setOverflowFromEmtauInput
void setOverflowFromEmtauInput(bool v)
Definition: TopoInputEvent.cxx:223
TCS::TopoInputEvent::addCluster
StatusCode addCluster(const ClusterTOB &cluster)
Definition: TopoInputEvent.cxx:46
CPRoIDecoder.h
M_PI
#define M_PI
Definition: ActiveFraction.h:11
LVL1::EMTauInputProvider::m_emTauLocation
SG::ReadHandleKey< DataVector< LVL1::CPCMXTopoData > > m_emTauLocation
EMTAU ROI SG key.
Definition: EMTauInputProvider.h:34
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
EMTauInputProvider.h
TCS::TAU
@ TAU
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Types.h:18
xAOD::roiWord
roiWord
Definition: TrigMissingET_v1.cxx:36
TCS::TopoInputEvent::addTau
StatusCode addTau(const ClusterTOB &tau)
Definition: TopoInputEvent.cxx:77
LVL1::CPTopoTOB
CP TOB data for L1Topo.
Definition: CPTopoTOB.h:19
TopoInputEvent.h
LVL1::CoordinateRange
CoordinateRange class declaration.
Definition: CoordinateRange.h:36
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TCS::TopoInputEvent
Definition: TopoInputEvent.h:42
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TrigConf::name
Definition: HLTChainList.h:35
LVL1::CPCMXTopoData::overflow
bool overflow() const
Return overflow flag.
Definition: CPCMXTopoData.cxx:130
LVL1::EMTauInputProvider::fillTopoInputEvent
virtual StatusCode fillTopoInputEvent(TCS::TopoInputEvent &) const
Definition: EMTauInputProvider.cxx:42
ClusterTOB.h
LVL1::Coordinate::eta
double eta() const
return eta
Definition: Coordinate.cxx:45
LVL1::CPRoIDecoder
A level 1 calorimeter trigger conversion service: returns the Coordinate represented by a RoI word.
Definition: CPRoIDecoder.h:37
LVL1::TrigT1CaloDefs
Definition: TrigT1CaloDefs.h:24
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
LVL1::CPCMXTopoData::tobs
void tobs(std::vector< CPTopoTOB > &tobs) const
Fill a vector of TOBs.
Definition: CPCMXTopoData.cxx:143
LVL1::EMTauInputProvider::CalculateCoordinates
void CalculateCoordinates(int32_t roiWord, double &eta, double &phi) const
calculates eta and phi from roiWord
Definition: EMTauInputProvider.cxx:104
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
TCS::ClusterTOB
Definition: ClusterTOB.h:13
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
LVL1::EMTauInputProvider::~EMTauInputProvider
virtual ~EMTauInputProvider()
Definition: EMTauInputProvider.cxx:28
LVL1::CPCMXTopoData
Definition: CPCMXTopoData.h:22