ATLAS Offline Software
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):
16 #include "TrigMissingETCnvTool.h"
17 
18 namespace 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 
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 
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
TrigMissingET.h
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
TrigMissingETContainer
Definition: Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingETContainer.h:12
xAODMaker
Definition: StoreGateSvc.h:72
xAODMaker::TrigMissingETCnvTool::convert
virtual StatusCode convert(const TrigMissingETContainer *aod, xAOD::TrigMissingETContainer *xaod) const override
Function that fills an existing xAOD::TrigMissingETContainer.
Definition: TrigMissingETCnvTool.cxx:38
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TrigMissingETContainer.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
xAODMaker::TrigMissingETCnvTool::TrigMissingETCnvTool
TrigMissingETCnvTool(const std::string &type, const std::string &name, const IInterface *parent)
Regular AlgTool constructor.
Definition: TrigMissingETCnvTool.cxx:20
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TrigMissingETContainer.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::TrigMissingET
TrigMissingET_v1 TrigMissingET
Define the most recent version of the TrigMissingET class.
Definition: Event/xAOD/xAODTrigMissingET/xAODTrigMissingET/TrigMissingET.h:12
AthAlgTool
Definition: AthAlgTool.h:26
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
TrigMissingET.h
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
TrigMissingETCnvTool.h