ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
7#include <math.h>
8
10
12
15
16using namespace std;
17using namespace LVL1;
18
19EMTauInputProvider::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
30
31StatusCode
33
34 CHECK(m_emTauLocation.initialize());
35
36 if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
37
38 return StatusCode::SUCCESS;
39}
40
41StatusCode
43
51
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
103void
104EMTauInputProvider::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
#define M_PI
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
bool overflow() const
Return overflow flag.
void tobs(std::vector< CPTopoTOB > &tobs) const
Fill a vector of TOBs.
A level 1 calorimeter trigger conversion service: returns the Coordinate represented by a RoI word.
CP TOB data for L1Topo.
Definition CPTopoTOB.h:19
CoordinateRange class declaration.
double phi() const
return phi
double eta() const
return eta
SG::ReadHandleKey< DataVector< LVL1::CPCMXTopoData > > m_emTauLocation
EMTAU ROI SG key.
virtual StatusCode initialize()
virtual StatusCode fillTopoInputEvent(TCS::TopoInputEvent &) const
EMTauInputProvider(const std::string &type, const std::string &name, const IInterface *parent)
void CalculateCoordinates(int32_t roiWord, double &eta, double &phi) const
calculates eta and phi from roiWord
ToolHandle< GenericMonitoringTool > m_monTool
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode addTau(const ClusterTOB &tau)
StatusCode addCluster(const ClusterTOB &cluster)
void setOverflowFromEmtauInput(bool v)
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
STL namespace.