ATLAS Offline Software
Loading...
Searching...
No Matches
TrigMissingETCnvTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6// System include(s):
7#include <vector>
8
9// EDM include(s):
14
15// Local include(s):
17
18namespace xAODMaker {
19
21 const std::string& name,
22 const IInterface* parent )
23 : AthAlgTool( type, name, parent ) {
24
25 // Declare the interface(s) provided by the tool:
26 declareInterface< ITrigMissingETCnvTool >( this );
27 }
28
37 StatusCode
39 xAOD::TrigMissingETContainer* xaod ) const {
40
41 // A small sanity check. The output container should really be empty...
42 if( !xaod->empty() ) {
43 ATH_MSG_WARNING( "The output xAOD container is not empty (size=="
44 << xaod->size() << ")" );
45 }
46
47 TrigMissingETContainer::const_iterator aod_itr = aod->begin();
48 TrigMissingETContainer::const_iterator aod_end = aod->end();
49 for( ; aod_itr != aod_end; ++aod_itr ) {
50
51 // Create a (single) output xAOD object.
52 auto *xMET = new xAOD::TrigMissingET();
53 xaod->push_back(xMET);
54
55 // Transfer the simple items
56 xMET->setEx( ( *aod_itr )->ex() );
57 xMET->setEy( ( *aod_itr )->ey() );
58 xMET->setEz( ( *aod_itr )->ez() );
59 xMET->setSumEt( ( *aod_itr )->sumEt() );
60 xMET->setSumE( ( *aod_itr )->sumE() );
61 xMET->setFlag( ( *aod_itr )->getFlag() );
62 xMET->setRoiWord( ( *aod_itr )->RoIword() );
63 // ...
64
65 // Get the list of components
66 unsigned int nComp ( ( *aod_itr )->getNumOfComponents());
67 std::vector< std::string > componentNames;
68 for (unsigned int i = 0; i < nComp; i++) {
69 componentNames.push_back( ( *aod_itr )->getNameOfComponent( i ) );
70 }
71 xMET->defineComponents( componentNames );
72 for (unsigned int i = 0; i < nComp; i++) {
73 xMET->setExComponent( i, ( *aod_itr )->getExComponent( i ) );
74 xMET->setEyComponent( i, ( *aod_itr )->getEyComponent( i ) );
75 xMET->setEzComponent( i, ( *aod_itr )->getEzComponent( i ) );
76 xMET->setSumEtComponent( i, ( *aod_itr )->getSumEtComponent( i ) );
77 xMET->setSumEComponent( i, ( *aod_itr )->getSumEComponent( i ) );
78 xMET->setCalib0Component( i, ( *aod_itr )->getComponentCalib0( i ) );
79 xMET->setCalib1Component( i, ( *aod_itr )->getComponentCalib1( i ) );
80 xMET->setSumOfSignsComponent( i, ( *aod_itr )->getSumOfSigns( i ) );
81 xMET->setUsedChannelsComponent( i, ( *aod_itr )->getUsedChannels( i ) );
82 xMET->setStatusComponent( i, ( *aod_itr )->getStatus( i ) );
83 }
84
85 }
86
87 // Return gracefully:
88 return StatusCode::SUCCESS;
89 }
90
91} // namespace xAODMaker
#define ATH_MSG_WARNING(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
TrigMissingETCnvTool(const std::string &type, const std::string &name, const IInterface *parent)
Regular AlgTool constructor.
virtual StatusCode convert(const TrigMissingETContainer *aod, xAOD::TrigMissingETContainer *xaod) const override
Function that fills an existing xAOD::TrigMissingETContainer.
void setEx(float s)
Set the x component of the missing energy.
TrigMissingETContainer_v1 TrigMissingETContainer
DataVector of TrigMissingET - the current version.
TrigMissingET_v1 TrigMissingET
Define the most recent version of the TrigMissingET class.