12#include <framework/logging/Logger.h>
17#include <unordered_map>
47 SectorMapComparer(
const std::string& SMFileFirst,
const std::string& SMFileSecond);
59 void plot(
bool logScale =
true, TString pdfFileName =
"",
bool drawLegend =
true);
67 void plotSectorStats(
bool logScale =
true, TString pdfFileName =
"",
bool drawLegend =
true);
70 void compareMaps(TString setup,
bool unmatchedEntries =
false);
75 std::cout << std::endl;
77 std::cout << std::endl;
87 B2INFO(
"Following files will be compared:");
88 B2INFO(
"=================================");
102 uint
countConnections(
const std::unordered_map<uint, uint>& map,
int layer = -1,
int ladder = -1,
int sensor = -1,
109 std::string
getHash(
long l1,
long l2,
long l3);
115 void findTrees(TDirectory* aDir, std::vector<std::string>& listOfTrees);
122 void setLeafAddresses(TTree* t, std::unordered_map<std::string, double>& filterVals,
123 std::unordered_map<std::string, uint>& SecIDVals);
137 void compareTrees(TTree* t_first, TTree* t_second,
bool unmatchedEntries =
false);
A root tool that compares two Sectormaps (local root files) and produces some statistics output.
std::string m_SMFileName_first
name of the file containing the first sectormap
void findTrees(TDirectory *aDir, std::vector< std::string > &listOfTrees)
helper function that returns a list of names for all trees contained in the TDirectory including sub-...
std::unordered_map< uint, uint > m_map_N3HitCombs_matched
count the number of 3Hit connections for each sector, only if sector combination was "matched" (Note:...
std::unordered_map< uint, uint > m_map_N3HitCombs
count the number of 3Hit connections for each sector, can be used to do some statistics
void compareMaps(TString setup, bool unmatchedEntries=false)
runs the comparison for all filters (and only the filters) in the sectormap files
std::string getHash(long l1, long l2, long l3)
I was too lacy to implement a proper hash function, so I convert the three numbers into a string and ...
std::string m_setupsBranchName
name of the branch in the setups tree that holds the names of the setups
std::string m_SMFileName_second
name of the file containing the second sectormap
std::unordered_map< std::string, TH1F > m_histo_map_second
histograms for the second sector map
void fillSectorToTreeIndexMap(TTree *tree, std::unordered_map< std::string, long > &map)
fills a map that maps sector combinations in the tree to string which is a hash combining the three (...
void clearMaps()
helper that clears all the maps used
std::unordered_map< uint, uint > m_map_N2HitCombs
count the number of 2Hit connections for each sector,
void showSetups()
lists all setups of sectormaps included in the two files
void showFiles()
lists the names of the files which are used
std::unordered_map< std::string, TH1F > m_histo_map_range_second
histograms that store the range of that filter (max - min)
void plot(bool logScale=true, TString pdfFileName="", bool drawLegend=true)
will create lots of Canvases!!!
std::unordered_map< std::string, TH1F > m_histo_map_diff
histograms that store differences between the two sector maps
std::unordered_map< std::string, TH1F > m_histo_map_range_first
histograms that store the range of that filter (max - min)
std::unordered_map< std::string, TH1F > m_histo_map_first
histograms for the first sector map
void setLeafAddresses(TTree *t, std::unordered_map< std::string, double > &filterVals, std::unordered_map< std::string, uint > &SecIDVals)
automatically sets the TLeaf addresses for a tree.
SectorMapComparer()=delete
dont use this constructor
void compareTrees(TTree *t_first, TTree *t_second, bool unmatchedEntries=false)
makes the comparison of two trees, and fills histograms and certain maps
uint countConnections(const std::unordered_map< uint, uint > &map, int layer=-1, int ladder=-1, int sensor=-1, int sector=-1)
counts all connections for given layer, ladder, sensor, sector.
std::unordered_map< uint, uint > m_map_N2HitCombs_matched
count the number of 2Hit connections for each sector, only if sector combination was "matched" (Note:...
std::string m_setupsTreeName
name of the tree all the setups are stored
bool m_isCompared
remember if CompareMaps already has been run, to give warnings if functions are called that need Comp...
~SectorMapComparer()=default
default destructor
void plotSectorStats(bool logScale=true, TString pdfFileName="", bool drawLegend=true)
Will create canvases showing statistics.
Abstract base class for different kinds of events.