ATLAS Offline Software
Loading...
Searching...
No Matches
egammaLayerRecalibTool.cxx File Reference
#include <TFile.h>
#include <TObjString.h>
#include "PathResolver/PathResolver.h"
#include "egammaLayerRecalibTool/egammaLayerRecalibTool.h"
#include "xAODEgamma/EgammaxAODHelpers.h"
#include <iostream>
#include <stdexcept>
#include <cassert>
#include <map>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <limits>

Go to the source code of this file.

Functions

std::map< std::string, std::string, std::less<> > parse (const std::string &list)

Function Documentation

◆ parse()

std::map< std::string, std::string, std::less<> > parse ( const std::string & list)

Definition at line 1180 of file egammaLayerRecalibTool.cxx.

1181{
1182 std::cout << "list: '" << list << "'" << std::endl;
1183 std::map<std::string, std::string, std::less<>> result;
1184 TIter next(TString(list).Tokenize(","));
1185 while (TObjString* sObj = (TObjString*) next())
1186 {
1187 const TString& item(sObj->GetString());
1188 std::cout << "item: '" << item << "'" << std::endl;
1189 TObjArray* item_list = TString(item).Tokenize(":");
1190 std::string key;
1191 std::string value;
1192 if (item_list->GetEntries() == 1) {
1193 key = "amount";
1194 value = static_cast<TObjString*>(item_list->At(0))->GetString().Data();
1195 }
1196 else if (item_list->GetEntries() == 2) {
1197 key = static_cast<TObjString*>(item_list->At(0))->GetString().Data();
1198 value = static_cast<TObjString*>(item_list->At(1))->GetString().Data();
1199 }
1200 else {
1201 std::cerr << "invalid string " << item << std::endl;
1202 }
1203 if (result.find(key) != result.end()) {
1204 std::cerr << "trying to insert two times key " << key << std::endl;
1205 assert(false);
1206 }
1207 result.insert(std::make_pair(key, value));
1208 }
1209 return result;
1210}
list(name, path='/')
Definition histSizes.py:38