|
ATLAS Offline Software
|
#include <CDIReader.h>
Definition at line 39 of file CDIReader.h.
◆ Data
◆ JetColl
◆ Labels
◆ Meta
◆ WPoint
◆ CDIReader()
Analysis::CDIReader::CDIReader |
( |
const std::string & |
cdipath, |
|
|
bool |
verbose = false |
|
) |
| |
normal constructor.
The second argument, if true, will attempt to retrieve a 'recommended' set of uncertainties to be excluded from EV decomposition
Definition at line 15 of file CDIReader.cxx.
18 m_CDIFile->GetObject(
"VersionInfo/BuildNumber",
s);
20 std::cout <<
" CDI file build number: " <<
s->GetName() << std::endl;
22 TList* taggerkeys =
m_CDIFile->GetListOfKeys();
23 for (
const auto tagger : *taggerkeys){
24 const char* taggername = tagger->GetName();
25 if(strcmp(taggername,
"VersionInfo") != 0){
27 TDirectoryFile* taggerDir = (TDirectoryFile*)
m_CDIFile->Get(taggername);
◆ ~CDIReader()
Analysis::CDIReader::~CDIReader |
( |
| ) |
|
|
default |
◆ checkConfig()
bool Analysis::CDIReader::checkConfig |
( |
const std::string & |
tagger, |
|
|
const std::string & |
jetcoll, |
|
|
const std::string & |
wp, |
|
|
bool |
verbose = false |
|
) |
| |
Definition at line 192 of file CDIReader.cxx.
196 bool configured =
false;
208 if(
tag.first == tagger)
break;
220 if(wpoint.first ==
wp)
break;
222 if (
verbose) std::cout <<
" Your configuration looks good! Available labels are : " << std::endl;
232 if (
verbose) std::cout <<
"Couldn't find \"" <<
wp <<
"\" for " << tagger <<
" / " <<
jetcoll <<
" in this CDI file!" << std::endl;
233 if (
verbose) std::cout <<
"Here are your options :" << std::endl;
237 if (
verbose) std::cout <<
"Couldn't find \"" <<
jetcoll <<
"\" under " << tagger <<
" in this CDI file!" << std::endl;
238 if (
verbose) std::cout <<
"Here are your options :" << std::endl;
242 if (
verbose) std::cout <<
"Couldn't find \"" << tagger <<
"\" in this CDI file" << std::endl;
243 if (
verbose) std::cout <<
"Here are your options :" << std::endl;
253 std::ofstream
output(filepath);
254 output << std::setw(4) << json_metadata << std::endl;
◆ crawlCDI()
void Analysis::CDIReader::crawlCDI |
( |
TDirectoryFile * |
parentDir, |
|
|
int |
depth = 0 , |
|
|
const std::string & |
metamap = "" |
|
) |
| |
|
private |
Definition at line 35 of file CDIReader.cxx.
36 TList*
keys = parentDir->GetListOfKeys();
41 TList* labelkeys = parentDir->GetListOfKeys();
44 std::set<std::string> DSID_set;
45 std::set<std::string> systematics_set;
48 std::string taggername =
path.at(0);
49 std::string jetcollname =
path.at(1);
50 std::string workingpointname =
path.at(2);
55 for(
const auto label : *labelkeys){
56 std::string labelname =
label->GetName();
57 if(labelname ==
"cutvalue" || labelname ==
"fraction" || labelname ==
"fraction_tau" )
continue;
59 theseLabels.push_back(labelname);
62 TDirectoryFile*
flavourDir = (TDirectoryFile*)parentDir->Get(labelname.c_str());
66 for(
const auto CDHistCont : *DSIDkeys){
67 std::string DSIDname = CDHistCont->GetName();
68 DSID_set.insert(DSIDname);
70 if(DSIDname ==
"default_SF"){
72 std::string
dir = taggername +
"/" + jetcollname +
"/" + workingpointname +
"/" + labelname +
"/default_SF";
76 std::cout <<
"No default_SF CalibrationDataHistogramContainer?" << std::endl;
79 for(std::string
s : uncertainties){
80 systematics_set.insert(
s);
84 std::string flav_spec_unc_name = labelname +
"_syst";
85 theseData[flav_spec_unc_name] = uncertainties;
89 std::cout <<
"No flavour directory?" << std::endl;
93 std::sort(theseLabels.begin(), theseLabels.end());
94 theseData[
"labels"] = theseLabels;
96 Labels theseDSIDs(DSID_set.size());
97 std::copy(DSID_set.begin(), DSID_set.end(), theseDSIDs.begin());
98 theseData[
"DSIDs"] = theseDSIDs;
100 Labels theseSystematics(systematics_set.size());
101 std::copy(systematics_set.begin(), systematics_set.end(), theseSystematics.begin());
102 theseData[
"systematics"] = theseSystematics;
107 for(
const auto coll: *
keys){
108 std::string collname = coll->GetName();
111 TDirectoryFile* collDir = (TDirectoryFile*)parentDir->Get(collname.c_str());
112 if(collDir && collname !=
"VersionInfo"){
113 std::string nextmap = metamap +
";" + collname;
116 std::cout <<
"No collection directory?" << std::endl;
◆ getDSIDs()
std::vector< std::string > Analysis::CDIReader::getDSIDs |
( |
const std::string & |
tagger = "" , |
|
|
const std::string & |
jetcollection = "" , |
|
|
const std::string & |
workingpoint = "" |
|
) |
| |
Definition at line 262 of file CDIReader.cxx.
264 std::cout <<
" CDIReader :: You need to validate your configuration before working with (flavour) labels!" << std::endl;
267 if (tagger.empty() || jetcollection.empty() || workingpoint.empty()){
274 std::cout <<
" The tagger [" << tagger <<
"] doesn't exist in this CDI file!" << std::endl;
277 std::cout <<
" The jet collection [" << jetcollection <<
"] doesn't exist in " << tagger <<
" this CDI file!" << std::endl;
280 std::cout <<
" The working point [" << workingpoint <<
"] doesn't exist in " << tagger <<
"/" << jetcollection <<
" this CDI file!" << std::endl;
282 for (
const std::string&
DSID :
m_metadata[tagger][jetcollection][workingpoint][
"DSIDs"]){
283 DSIDs.push_back(
DSID);
◆ getJetCollections()
std::vector< std::string > Analysis::CDIReader::getJetCollections |
( |
const std::string & |
tagger | ) |
|
Definition at line 311 of file CDIReader.cxx.
317 std::cout <<
" The tagger [" << tagger <<
"] doesn't exist in this CDI file!" << std::endl;
321 jetcolls.push_back(
jet.first);
◆ getLabels()
std::vector< std::string > Analysis::CDIReader::getLabels |
( |
const std::string & |
tagger = "" , |
|
|
const std::string & |
jetcollection = "" , |
|
|
const std::string & |
workingpoint = "" |
|
) |
| |
Definition at line 289 of file CDIReader.cxx.
291 std::cout <<
" CDIReader :: You need to validate your configuration before working with (flavour) labels!" << std::endl;
294 if (tagger.empty() || jetcollection.empty() || workingpoint.empty()){
298 std::cout <<
" The tagger [" << tagger <<
"] doesn't exist in this CDI file!" << std::endl;
300 std::cout <<
" The jet collection [" << jetcollection <<
"] doesn't exist in " << tagger <<
" this CDI file!" << std::endl;
302 std::cout <<
" The working point [" << workingpoint <<
"] doesn't exist in " << tagger <<
"/" << jetcollection <<
" this CDI file!" << std::endl;
304 for (std::string
label :
m_metadata[tagger][jetcollection][workingpoint][
"labels"]){
◆ getTaggers()
std::vector< std::string > Analysis::CDIReader::getTaggers |
( |
| ) |
|
◆ getWorkingPoints()
std::vector< std::string > Analysis::CDIReader::getWorkingPoints |
( |
const std::string & |
tagger, |
|
|
const std::string & |
jetcollection |
|
) |
| |
Definition at line 328 of file CDIReader.cxx.
330 if (tagger.empty() || jetcollection.empty()){
334 std::cout <<
" The tagger [" << tagger <<
"] doesn't exist in this CDI file!" << std::endl;
336 std::cout <<
" The jet collection [" << jetcollection <<
"] doesn't exist in " << tagger <<
" this CDI file!" << std::endl;
338 for(
const auto&
wp :
m_metadata[tagger][jetcollection]){
339 wps.push_back(
wp.first);
◆ isWPdirectory()
bool Analysis::CDIReader::isWPdirectory |
( |
TList * |
list | ) |
|
|
inlineprivate |
Definition at line 143 of file CDIReader.h.
146 const char* labelname =
label->GetName();
147 if(strcmp(labelname,
"B") == 0 || strcmp(labelname,
"C") == 0
148 || strcmp(labelname,
"Light") == 0 || strcmp(labelname,
"T") == 0
149 || strcmp(labelname,
"Z_BB") == 0 || strcmp(labelname,
"QCD_BB") == 0
150 || strcmp(labelname,
"Top_BX") == 0)
return true;
◆ printDSIDs()
void Analysis::CDIReader::printDSIDs |
( |
| ) |
|
|
inline |
Definition at line 81 of file CDIReader.h.
83 std::cout <<
"number of DSIDs: " << DSIDs.size() << std::endl;
84 for(
const std::string&
el : DSIDs){
85 std::cout <<
el <<
", ";
86 } std::cout << std::endl;
◆ printJetCollections()
void Analysis::CDIReader::printJetCollections |
( |
| ) |
|
|
inline |
Definition at line 60 of file CDIReader.h.
61 std::cout <<
"number of jet collections: " <<
m_jetcollections.size() << std::endl;
63 std::cout <<
el <<
", ";
64 } std::cout << std::endl;
◆ printLabels()
void Analysis::CDIReader::printLabels |
( |
| ) |
|
|
inline |
Definition at line 74 of file CDIReader.h.
75 std::cout <<
"number of labels: " <<
m_labels.size() << std::endl;
77 std::cout <<
el <<
", ";
78 } std::cout << std::endl;
◆ printMetadata()
void Analysis::CDIReader::printMetadata |
( |
int |
tagger = -1 , |
|
|
int |
jetcoll = -1 , |
|
|
int |
wpoint = -1 , |
|
|
int |
label = -1 |
|
) |
| |
|
private |
Definition at line 125 of file CDIReader.cxx.
144 int current_tagger = (tagger < 0) ? -1 : 0;
145 int current_jetcoll = (
jetcoll < 0) ? -1 : 0;
146 int current_wpoint = (wpoint < 0) ? -1 : 0;
147 int current_label = (
label < 0) ? -1 : 0;
150 if(current_tagger != -1) current_tagger += 1;
151 if(tagger != current_tagger || tagger == 0)
continue;
153 std::cout <<
"| " <<
tag << std::endl;
155 for (
const auto& [
jet, wps] :
jets){
156 if(current_jetcoll != -1) current_jetcoll += 1;
159 std::cout <<
"|\\__ " <<
jet << std::endl;
161 int num_wps = wps.size();
163 for(
const auto& [
wp,
labels] : wps){
164 if(current_wpoint != -1) current_wpoint += 1;
165 if(wpoint != current_wpoint || wpoint == 0)
continue;
167 if(num_wp_seen != num_wps){
168 std::cout <<
"| |\\__" <<
wp << std::endl;
170 std::cout <<
"| \\__" <<
wp << std::endl;
175 for(
const std::string&
l :
d[
"labels"]){
176 if(current_label != -1) current_label += 1;
177 if(
label != current_label ||
label == 0)
continue;
178 if(num_wp_seen != num_wps && label_index == 0){
179 std::cout <<
"| | \\___" <<
" (" << label_index <<
") " <<
l << std::endl;
180 }
else if(label_index != 0 && num_wp_seen != num_wps) {
181 std::cout <<
"| | \\___" <<
" (" << label_index <<
") " <<
l << std::endl;
183 std::cout <<
"| \\___" <<
" (" << label_index <<
") " <<
l << std::endl;
◆ printTaggers()
void Analysis::CDIReader::printTaggers |
( |
| ) |
|
|
inline |
Definition at line 53 of file CDIReader.h.
54 std::cout <<
"number of taggers: " <<
m_taggers.size() << std::endl;
56 std::cout <<
el <<
", ";
57 } std::cout << std::endl;
◆ printWorkingPoints()
void Analysis::CDIReader::printWorkingPoints |
( |
| ) |
|
|
inline |
Definition at line 67 of file CDIReader.h.
68 std::cout <<
"number of working points: " <<
m_workingpoints.size() << std::endl;
70 std::cout <<
el <<
", ";
71 } std::cout << std::endl;
◆ record_metadata()
void Analysis::CDIReader::record_metadata |
( |
const std::string & |
datum, |
|
|
int |
depth = 0 |
|
) |
| |
|
inlineprivate |
Definition at line 113 of file CDIReader.h.
128 std::cout <<
" record_metadata :: depth is " <<
depth << std::endl;
◆ record_metadata_map()
void Analysis::CDIReader::record_metadata_map |
( |
const Data & |
data, |
|
|
const std::string & |
path |
|
) |
| |
|
inlineprivate |
Definition at line 132 of file CDIReader.h.
134 int size = metamap_path.size();
136 m_metadata[metamap_path.at(0)][metamap_path.at(1)][metamap_path.at(2)] =
data;
138 std::cout <<
" record_metadata_map :: the directory structure doesn't match what we expect!" << std::endl;
◆ split()
std::vector<std::string> Analysis::CDIReader::split |
( |
const std::string & |
str, |
|
|
char |
token = ';' |
|
) |
| |
|
inlineprivate |
Definition at line 167 of file CDIReader.h.
168 std::vector<std::string>
result;
169 if (
str.size() > 0) {
170 std::string::size_type
end;
177 }
while (
end != std::string::npos);
◆ trim()
std::string Analysis::CDIReader::trim |
( |
const std::string & |
str, |
|
|
const std::string & |
whitespace = " \t" |
|
) |
| |
|
inlineprivate |
Definition at line 156 of file CDIReader.h.
157 const auto strBegin =
str.find_first_not_of(whitespace);
158 if (strBegin == std::string::npos){
161 const auto strEnd =
str.find_last_not_of(whitespace);
162 const auto strRange = strEnd - strBegin + 1;
163 return str.substr(strBegin, strRange);
◆ m_CDIFile
std::unique_ptr<TFile> Analysis::CDIReader::m_CDIFile |
|
private |
◆ m_cdipath
std::string Analysis::CDIReader::m_cdipath = "" |
|
private |
◆ m_DSIDs
std::set<std::string> Analysis::CDIReader::m_DSIDs {} |
|
private |
◆ m_initialized
bool Analysis::CDIReader::m_initialized = false |
|
private |
flag whether the initialization has been carried out
Definition at line 100 of file CDIReader.h.
◆ m_jetcollections
std::set<std::string> Analysis::CDIReader::m_jetcollections {} |
|
private |
◆ m_label_vec
Labels Analysis::CDIReader::m_label_vec |
|
private |
◆ m_labels
std::set<std::string> Analysis::CDIReader::m_labels {} |
|
private |
◆ m_metadata
Meta Analysis::CDIReader::m_metadata |
|
private |
◆ m_taggers
std::set<std::string> Analysis::CDIReader::m_taggers {} |
|
private |
◆ m_use_json
bool Analysis::CDIReader::m_use_json = false |
|
private |
◆ m_workingpoints
std::set<std::string> Analysis::CDIReader::m_workingpoints {} |
|
private |
The documentation for this class was generated from the following files:
char data[hepevt_bytes_allocation_ATLAS]
std::set< std::string > m_taggers
@ depth
pointing depth of the shower as calculated in egammaqgcld
path
python interpreter configuration --------------------------------------—
std::set< std::string > m_jetcollections
bool isWPdirectory(TList *list)
std::vector< std::string > Labels
Labels getDSIDs(const std::string &tagger="", const std::string &jetcollection="", const std::string &workingpoint="")
std::set< std::string > m_DSIDs
std::vector< std::string > split(const std::string &str, char token=';')
std::vector< std::string > listUncertainties() const
retrieve the list of "uncertainties" accessible to this object.
void crawlCDI(TDirectoryFile *parentDir, int depth=0, const std::string &metamap="")
std::unique_ptr< TFile > m_CDIFile
std::set< std::string > m_workingpoints
std::string trim(const std::string &str, const std::string &whitespace=" \t")
void printMetadata(int tagger=-1, int jetcoll=-1, int wpoint=-1, int label=-1)
bool m_initialized
flag whether the initialization has been carried out
void record_metadata(const std::string &datum, int depth=0)
std::map< std::string, Labels > Data
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
void record_metadata_map(const Data &data, const std::string &path)
std::set< std::string > m_labels