GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TSortingDiagnostics.h
Go to the documentation of this file.
1#ifndef TSORTINGDIAGNOSTICS_H
2#define TSORTINGDIAGNOSTICS_H
3
4/** \addtogroup Sorting
5 * @{
6 */
7
8////////////////////////////////////////////////////////////////////////////////
9///
10/// \class TSortingDiagnostics
11///
12/// This class gathers various diagnostics calculated during the sorting from
13/// a raw file to a fragment tree and analysis tree and provides convenient
14/// methods of printing and/or visualizing them.
15///
16////////////////////////////////////////////////////////////////////////////////
17
18#include <iostream>
19#include <iomanip>
20#include <string>
21#include <vector>
22#include <unordered_map>
23
24#include "TObject.h"
25#include "TH1F.h"
26
27#include "TSortingDiagnostics.h"
28#include "TPPG.h"
29#include "TFragment.h"
30
31class TSortingDiagnostics : public TSingleton<TSortingDiagnostics> {
32public:
33 friend class TSingleton<TSortingDiagnostics>;
34
36 //TSortingDiagnostics(const TSortingDiagnostics&);
37 //TSortingDiagnostics(TSortingDiagnostics&&);
38 //TSortingDiagnostics& operator=(const TSortingDiagnostics&);
39 //TSortingDiagnostics& operator=(TSortingDiagnostics&&);
40 //~TSortingDiagnostics();
41
42private:
43 // analysis tree diagnostics
44 std::unordered_map<int64_t, std::pair<int64_t, int64_t>> fFragmentsOutOfOrder;
45 std::unordered_map<double, std::pair<double, double>> fFragmentsOutOfTimeOrder;
46 std::vector<Long_t> fPreviousTimeStamps; ///< timestamps of previous fragments, saved every 'BuildWindow' entries
47 std::vector<double> fPreviousTimes; ///< times of previous fragments, saved every 'BuildWindow' entries
48 int64_t fMaxEntryDiff{0};
49 std::unordered_map<UInt_t, int64_t> fMissingChannels; ///< counts of missing channels
50 std::unordered_map<TClass*, int64_t> fMissingDetectorClasses; ///< counts of missing detector classes
51
52 std::unordered_map<TClass*, std::pair<int64_t, int64_t>> fHitsRemoved; ///< removed hits and total hits per detector class
53
54public:
55 //"setter" functions
56 void OutOfTimeOrder(double newFragTime, double oldFragTime, int64_t newEntry);
57 void OutOfOrder(int64_t newFragTS, int64_t oldFragTS, int64_t newEntry);
58 void AddTime(double val) { fPreviousTimes.push_back(val); }
59 void AddTimeStamp(Long_t val) { fPreviousTimeStamps.push_back(val); }
60 void MissingChannel(const UInt_t& address);
62 void RemovedHits(TClass* detClass, int64_t removed, int64_t total);
63
64 // getter functions
65 size_t NumberOfFragmentsOutOfOrder() const { return fFragmentsOutOfOrder.size(); }
66 std::unordered_map<int64_t, std::pair<int64_t, int64_t>> FragmentsOutOfOrder() { return fFragmentsOutOfOrder; }
68 std::unordered_map<double, std::pair<double, double>> FragmentsOutOfTimeOrder() { return fFragmentsOutOfTimeOrder; }
69 int64_t MaxEntryDiff() const { return fMaxEntryDiff; }
70
71 // other functions
72 void WriteToFile(const char*) const;
73
74 void Copy(TObject&) const override;
75 void Clear(Option_t* opt = "all") override;
76 void Print(Option_t* opt = "") const override;
77 void Draw(Option_t* opt = "") override;
78
79 /// \cond CLASSIMP
80 ClassDefOverride(TSortingDiagnostics, 4) // NOLINT(readability-else-after-return)
81 /// \endcond
82};
83/*! @} */
84#endif
void OutOfTimeOrder(double newFragTime, double oldFragTime, int64_t newEntry)
std::unordered_map< double, std::pair< double, double > > FragmentsOutOfTimeOrder()
void Copy(TObject &) const override
std::unordered_map< UInt_t, int64_t > fMissingChannels
counts of missing channels
void RemovedHits(TClass *detClass, int64_t removed, int64_t total)
void Draw(Option_t *opt="") override
void Clear(Option_t *opt="all") override
std::vector< double > fPreviousTimes
times of previous fragments, saved every 'BuildWindow' entries
void AddTime(double val)
std::unordered_map< TClass *, int64_t > fMissingDetectorClasses
counts of missing detector classes
std::unordered_map< int64_t, std::pair< int64_t, int64_t > > fFragmentsOutOfOrder
void AddTimeStamp(Long_t val)
void MissingChannel(const UInt_t &address)
int64_t MaxEntryDiff() const
std::unordered_map< double, std::pair< double, double > > fFragmentsOutOfTimeOrder
void OutOfOrder(int64_t newFragTS, int64_t oldFragTS, int64_t newEntry)
void Print(Option_t *opt="") const override
void WriteToFile(const char *) const
std::unordered_map< int64_t, std::pair< int64_t, int64_t > > FragmentsOutOfOrder()
size_t NumberOfFragmentsOutOfOrder() const
std::unordered_map< TClass *, std::pair< int64_t, int64_t > > fHitsRemoved
removed hits and total hits per detector class
size_t NumberOfFragmentsOutOfTimeOrder() const
void AddDetectorClass(TChannel *)
std::vector< Long_t > fPreviousTimeStamps
timestamps of previous fragments, saved every 'BuildWindow' entries