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

Go to the source code of this file.

Functions

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

Function Documentation

◆ parse()

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

Definition at line 1179 of file egammaLayerRecalibTool.cxx.

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