Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:08

0001 #include <iostream>
0002 #include <map>
0003 #include "TROOT.h"
0004 #include "TColor.h"
0005 #include <cassert>
0006 #include <cstdlib>
0007 #include "TString.h"
0008 
0009 using namespace std;
0010 
0011 static const map<TString, Style_t> stylemap{{"kSolid", kSolid},
0012                                             {"kDashed", kDashed},
0013                                             {"kDotted", kDotted},
0014                                             {"kDashDotted", kDashDotted},
0015                                             {"kFullSquare", kFullSquare},
0016                                             {"kFullCircle", kFullCircle},
0017                                             {"kFullTriangleDown", kFullTriangleDown}};
0018 
0019 Style_t StyleParser(TString input) {
0020   // 1) remove all space
0021   input.ReplaceAll(" ", "");
0022 
0023   // 2) if number, then just return it
0024   if (input.IsDec())
0025     return input.Atoi();
0026 
0027   // 3) if the first char is not a k, then crash
0028   assert(input(0) == 'k');
0029 
0030   return stylemap.at(input);
0031 }