ATLAS Offline Software
Loading...
Searching...
No Matches
MBTSModuleCnvTool.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// Gaudi/Athena include(s):
7
8// Old EDM Includes:
9//#include "TileEvent/TileCell.h"
12
13//New EDM
15
16// Local include(s):
17#include "MBTSModuleCnvTool.h"
18
19
20namespace xAODMaker {
21
23 const std::string& name,
24 const IInterface* parent )
25 : AthAlgTool( type, name, parent ) {
26
27 // Declare the interface(s) provided by the tool:
28 declareInterface< IMBTSModuleCnvTool >(this);
29 }
30
32 xAOD::MBTSModuleContainer* xaod) const
33 {
34 if (!aod) {
35 ATH_MSG_WARNING("No input MBTSModule Collection passed");
36 return StatusCode::SUCCESS;
37 }
38
39 // Create the xAOD objects:
40 const auto end = aod->end();
41 for(auto itr = aod->begin(); itr != end; ++itr ) {
42 //fill it here
43 xAOD::MBTSModule *xmbtsmod = new xAOD::MBTSModule();
44 xaod->push_back( xmbtsmod );
45
46 xmbtsmod->setE((*itr)->energy());
47 xmbtsmod->setEta((*itr)->eta());
48 xmbtsmod->setPhi((*itr)->phi());
49 xmbtsmod->setTime((*itr)->time());
50 //xmbtsmod->setMbtsQuality((*itr)->quality()); // original
51 xmbtsmod->setMbtsQuality ( ((*itr)->provenance()<<16 ) | (*itr)->quality()); //fix
52 ATH_MSG_DEBUG( "MBTS: quality=" << (*itr)->quality() << " provenance=" << (*itr)->provenance() << " mbtsQuality=" << xmbtsmod->mbtsQuality() );
53 const TileTBID* tileid = nullptr;
54 CHECK( detStore() -> retrieve(tileid) );
55 Identifier id = (*itr)->ID();
56
57 xmbtsmod->setType(tileid->type(id));
58 xmbtsmod->setMbtsModule(tileid->module(id));
59 xmbtsmod->setChannel(tileid->channel(id));
60
61 }
62 // Return gracefully:
63 return StatusCode::SUCCESS;
64 }
65}
66
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
TileContainer< TileCell > TileCellContainer
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
const_iterator begin() const noexcept
Helper class for TileCal offline identifiers of ancillary testbeam detectors and MBTS.
int type(const Identifier &id) const
extract type field from TileTB identifier
int channel(const Identifier &id) const
extract channel field from TileTB identifier
virtual StatusCode convert(const TileCellContainer *aod, xAOD::MBTSModuleContainer *xaod) const override
Function that fills an existing xAOD::MBTSModuleContainer.
MBTSModuleCnvTool(const std::string &type, const std::string &name, const IInterface *parent)
Regular AlgTool constructor.
void setMbtsModule(int val_module)
void setMbtsQuality(int val_quality)
void setEta(float val_eta)
int mbtsQuality() const
void setE(float val_e)
void setTime(float val_time)
void setChannel(int val_channel)
void setPhi(float val_phi)
void setType(int val_type)
MBTSModule_v1 MBTSModule
Definition MBTSModule.h:17
MBTSModuleContainer_v1 MBTSModuleContainer