 |
Belle II Software
release-05-02-19
|
14 #include <framework/logging/Logger.h>
19 #include <unordered_map>
40 class SectorMapComparer :
public TObject {
49 SectorMapComparer(
const std::string& SMFileFirst,
const std::string& SMFileSecond);
61 void plot(
bool logScale =
true, TString pdfFileName =
"",
bool drawLegend =
true);
69 void plotSectorStats(
bool logScale =
true, TString pdfFileName =
"",
bool drawLegend =
true);
77 std::cout << std::endl;
79 std::cout << std::endl;
89 B2INFO(
"Following files will be compared:");
90 B2INFO(
"=================================");
104 uint
countConnections(
const std::unordered_map<uint, uint>& map,
int layer = -1,
int ladder = -1,
int sensor = -1,
111 std::string
getHash(
long l1,
long l2,
long l3);
117 void findTrees(TDirectory* aDir, std::vector<std::string>& listOfTrees);
124 void setLeafAddresses(TTree* t, std::unordered_map<std::string, double>& filterVals,
125 std::unordered_map<std::string, uint>& SecIDVals);
139 void compareTrees(TTree* t_first, TTree* t_second,
bool unmatchedEntries =
false);
void clearMaps()
helper that clears all the maps used
std::unordered_map< std::string, TH1F > m_histo_map_first
histograms for the first sector map
void compareMaps(TString setup, bool unmatchedEntries=false)
runs the comparison for all filters (and only the filters) in the sectormap files
~SectorMapComparer()=default
default destructor
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::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< std::string, TH1F > m_histo_map_diff
histograms that store differences between the two sector maps
SectorMapComparer()=delete
dont use this constructor
std::unordered_map< std::string, TH1F > m_histo_map_second
histograms for the second sector map
std::unordered_map< uint, uint > m_map_N2HitCombs
count the number of 2Hit connections for each sector,
void plotSectorStats(bool logScale=true, TString pdfFileName="", bool drawLegend=true)
Will create canvases showing statistics.
bool m_isCompared
remember if CompareMaps already has been run, to give warnings if functions are called that need Comp...
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::string m_setupsBranchName
name of the branch in the setups tree that holds the names of the setups
void plot(bool logScale=true, TString pdfFileName="", bool drawLegend=true)
will create lots of Canvases!!!
Abstract base class for different kinds of events.
void showFiles()
lists the names of the files which are used
std::string m_setupsTreeName
name of the tree all the setups are stored
std::unordered_map< std::string, TH1F > m_histo_map_range_first
histograms that store the range of that filter (max - min)
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.
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_SMFileName_second
name of the file containing the second sectormap
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 (...
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.
A root tool that compares two Sectormaps (local root files) and produces some statistics output.
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 showSetups()
lists all setups of sectormaps included in the two files
std::unordered_map< std::string, TH1F > m_histo_map_range_second
histograms that store the range of that filter (max - min)
void compareTrees(TTree *t_first, TTree *t_second, bool unmatchedEntries=false)
makes the comparison of two trees, and fills histograms and certain maps