16 ISvcLocator* pSvcLocator ) :
23 void split(
const std::string&
src,
char delim, std::vector<std::string>&
result) {
24 std::istringstream
i(
src);
26 while ( getline(
i, element, delim) ) {
30 std::string
trim(
const std::string&
str) {
31 size_t firstNonSpace =
str.find_first_not_of(
' ');
32 size_t lastNonSpace =
str.find_last_not_of(
' ');
33 return str.substr( firstNonSpace, lastNonSpace-firstNonSpace+1 );
44 typedef std::vector<std::string> Split_t;
47 if (
line[0] ==
'#' )
continue;
57 split( prop,
':', keyval );
58 if ( keyval.size() != 2 ) {
59 ATH_MSG_ERROR(
"Pnput format error, property specification invalid, should be a:b " << prop );
60 return StatusCode::FAILURE;
62 object.push_back( std::make_pair(
trim ( keyval[0] ), std::stof(keyval[1]) ) );
64 if (
object.
size() != 0 )
65 event.push_back(
object);
70 if (
m_data.size() == 0 ) {
72 return StatusCode::FAILURE;
74 return StatusCode::SUCCESS;
79 return StatusCode::SUCCESS;
86 const EventContext& context = Gaudi::Hive::currentContext();
87 const size_t eventNo = context.evt() %
m_data.size();
90 auto output = std::make_unique<xAOD::TrigCompositeContainer>();
91 auto aux = std::make_unique<xAOD::TrigCompositeAuxContainer>();
92 output->setStore( aux.get() );
96 ATH_MSG_DEBUG(
"Input " <<
m_input.key() <<
" has "<<inputHandle->size() <<
" elements, scanning it");
97 for (
auto i: *inputHandle.cptr() ) {
98 auto featureInfo = TrigCompositeUtils::findLink<TrigRoiDescriptorCollection>(
i,
"initialRoI" );
99 auto roiLink = featureInfo.link;
100 CHECK( roiLink.isValid() );
101 if ( roiLink.isValid() ) {
102 auto roiPtr(roiLink.cptr());
104 bool foundObject =
false;
106 if (
objects.size() > output->size()) {
108 for (
const auto &
object:
objects){
109 auto eta =
object[0].second;
110 auto phi =
object[1].second;
112 if (std::abs( eta - (*roiPtr)->eta()) <0.01 && std::abs(phi - (*roiPtr)->phi())< 0.01){
116 output->push_back( xobj );
118 xobj->setObjectLink(
"initialRoI", roiLink );
119 for (
const auto& prop :
object ) {
120 xobj->setDetail( prop.first, prop.second );
126 ATH_MSG_ERROR(
"No reco object found in eta and phi range: this might be an error");
130 ATH_MSG_DEBUG(
"No reco object created for this RoI because it's not found in the event");
138 ATH_MSG_DEBUG(
"Reconstructed "<<output->size() <<
" objects");
141 CHECK( handle.record( std::move(output), std::move(aux) ) );
143 return StatusCode::SUCCESS;