All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
icarus::crt::CRTTiming Class Reference

#include <CRTTiming.h>

Public Member Functions

 CRTTiming (CRTPreProcessTree &raw)
 
 CRTTiming (CRTRawTree &raw)
 
void TimeOrder ()
 
const map< size_t, size_t > * GetRawToOrderedMap ()
 
const map< size_t, size_t > * GetOrderedToRawMap ()
 
void DumpSortedTimes (size_t nmax)
 
void DumpRawTimes (size_t nmax)
 

Private Attributes

const CRTRawTreefRaw
 
const CRTPreProcessTreefPre
 
map< size_t, size_t > fRawToOrdered
 
map< size_t, size_t > fOrderedToRaw
 
bool fHasSort
 
char fType
 
size_t fNEntries
 

Detailed Description

Definition at line 27 of file CRTTiming.h.

Constructor & Destructor Documentation

CRTTiming::CRTTiming ( CRTPreProcessTree raw)
explicit

Definition at line 10 of file CRTTiming.cc.

10  {
11  fPre = &pre;
12  fRaw = 0;
13  fHasSort = false;
14  fType='p';
16 }
const CRTPreProcessTree * fPre
Definition: CRTTiming.h:40
const CRTRawTree * fRaw
Definition: CRTTiming.h:39
CRTTiming::CRTTiming ( CRTRawTree raw)
explicit

Definition at line 18 of file CRTTiming.cc.

18  {
19  fRaw = &raw;
20  fPre = 0;
21  fHasSort = false;
22  fType = 'r';
24 }
size_t GetNEntries() const
Definition: CRTRawTree.cc:40
const CRTPreProcessTree * fPre
Definition: CRTTiming.h:40
const CRTRawTree * fRaw
Definition: CRTTiming.h:39

Member Function Documentation

void CRTTiming::DumpRawTimes ( size_t  nmax = 0)

Definition at line 75 of file CRTTiming.cc.

75  {
76  for(size_t i=0; i<fNEntries; i++) {
77  if(nmax!=0 && i==nmax) return;
78 
79  if(fType=='p') std::cout << fPre->GetAbsTime(i) << std::endl;
80  if(fType=='r') std::cout << fRaw->GetAbsTime(i) << std::endl;
81 
82  }
83 }
uint64_t GetAbsTime(size_t ientry) const
uint64_t GetAbsTime(size_t ientry) const
Definition: CRTRawTree.cc:44
const CRTPreProcessTree * fPre
Definition: CRTTiming.h:40
const CRTRawTree * fRaw
Definition: CRTTiming.h:39
BEGIN_PROLOG could also be cout
void CRTTiming::DumpSortedTimes ( size_t  nmax = 0)

Definition at line 65 of file CRTTiming.cc.

65  {
66  for(size_t i=0; i<fNEntries; i++) {
67  if(nmax!=0 && i==nmax) return;
68 
69  if(fType=='p') std::cout << fPre->GetAbsTime(fOrderedToRaw[i]) << std::endl;
70  if(fType=='r') std::cout << fRaw->GetAbsTime(fOrderedToRaw[i]) << std::endl;
71 
72  }
73 }
uint64_t GetAbsTime(size_t ientry) const
map< size_t, size_t > fOrderedToRaw
Definition: CRTTiming.h:42
uint64_t GetAbsTime(size_t ientry) const
Definition: CRTRawTree.cc:44
const CRTPreProcessTree * fPre
Definition: CRTTiming.h:40
const CRTRawTree * fRaw
Definition: CRTTiming.h:39
BEGIN_PROLOG could also be cout
const map< size_t, size_t > * CRTTiming::GetOrderedToRawMap ( )

Definition at line 58 of file CRTTiming.cc.

58  {
59 
60  if(!fHasSort) TimeOrder();
61 
62  return &fOrderedToRaw;
63 }
map< size_t, size_t > fOrderedToRaw
Definition: CRTTiming.h:42
const map< size_t, size_t > * CRTTiming::GetRawToOrderedMap ( )

Definition at line 51 of file CRTTiming.cc.

51  {
52 
53  if(!fHasSort) TimeOrder();
54 
55  return &fRawToOrdered;
56 }
map< size_t, size_t > fRawToOrdered
Definition: CRTTiming.h:41
void CRTTiming::TimeOrder ( )

Definition at line 26 of file CRTTiming.cc.

26  {
27 
28  vector<pair<size_t,uint64_t>> pairs;
29 
30  for(size_t ientry=0; ientry<fNEntries; ientry++) {
31  uint64_t t0=0;
32  if(fType=='p') t0 = fPre->GetAbsTime(ientry);
33  if(fType=='r') t0 = fRaw->GetAbsTime(ientry);
34  pairs.push_back(make_pair(ientry,t0));
35  }
36 
37  std::sort(pairs.begin(),pairs.end(),[](pair<size_t,uint64_t> a, pair<size_t,uint64_t> b) {
38  return a.second < b.second;
39  });
40 
41  for(size_t ientry=0; ientry<fNEntries; ientry++) {
42  fRawToOrdered[pairs[ientry].first] = ientry;
43  fOrderedToRaw[ientry] = pairs[ientry].first;
44  }
45 
46  fHasSort = true;
47 
48  return;
49 }
map< size_t, size_t > fRawToOrdered
Definition: CRTTiming.h:41
process_name gaushit a
uint64_t GetAbsTime(size_t ientry) const
map< size_t, size_t > fOrderedToRaw
Definition: CRTTiming.h:42
uint64_t GetAbsTime(size_t ientry) const
Definition: CRTRawTree.cc:44
const CRTPreProcessTree * fPre
Definition: CRTTiming.h:40
const CRTRawTree * fRaw
Definition: CRTTiming.h:39

Member Data Documentation

bool icarus::crt::CRTTiming::fHasSort
private

Definition at line 43 of file CRTTiming.h.

size_t icarus::crt::CRTTiming::fNEntries
private

Definition at line 45 of file CRTTiming.h.

map<size_t,size_t> icarus::crt::CRTTiming::fOrderedToRaw
private

Definition at line 42 of file CRTTiming.h.

const CRTPreProcessTree* icarus::crt::CRTTiming::fPre
private

Definition at line 40 of file CRTTiming.h.

const CRTRawTree* icarus::crt::CRTTiming::fRaw
private

Definition at line 39 of file CRTTiming.h.

map<size_t,size_t> icarus::crt::CRTTiming::fRawToOrdered
private

Definition at line 41 of file CRTTiming.h.

char icarus::crt::CRTTiming::fType
private

Definition at line 44 of file CRTTiming.h.


The documentation for this class was generated from the following files: