clas12root
Loading...
Searching...
No Matches
covmatrix.h
Go to the documentation of this file.
1/*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6
7/*
8 * File: covmatrix.h
9 * Author: dglazier
10 *
11 * Created on April 27, 2017, 10:01 AM
12 */
13
14#ifndef CLAS12_COVMATRIX_H
15#define CLAS12_COVMATRIX_H
16
17#include <hipo4/bank.h>
18#include <vector>
19#include <map>
20#include <memory>
21
22namespace clas12 {
23
24 using CovMatrix =std::vector<std::vector<float > >;
25 using IndMatrix =std::vector<std::vector<int > >;
26
27 class covmatrix : public hipo::bank {
28
29
30 public:
31
32 //covmatrix() { }
33 //vmatrix(const char *bankName, hipo::reader &r) : hipo::bank(bankName,r){
34 //
35 covmatrix(hipo::schema __schema);
36
37
38 //get the pindex = corresponding particle index
39 int getPindex(int index) { return getInt(_pindex_order,index);}
40 int getPindex() { return getInt(_pindex_order,_index);}
41 int getIndex() const {return _index;}
42 int getIndex(int pindex);
43 void setIndex(int ind) const{_index=ind;}
44 void setEntry(int ind) const{_index=ind;}
45 void setBankEntry(int ind){_index=ind;}
46
47 const CovMatrix* matrix();
48 float getC11() const noexcept{ return getFloat(_morder[0][0],_index);}
49 float getC12() const noexcept{ return getFloat(_morder[0][1],_index);}
50 float getC13() const noexcept{ return getFloat(_morder[0][2],_index);}
51 float getC14() const noexcept{ return getFloat(_morder[0][3],_index);}
52 float getC15() const noexcept{ return getFloat(_morder[0][4],_index);}
53 float getC22() const noexcept{ return getFloat(_morder[1][1],_index);}
54 float getC23() const noexcept{ return getFloat(_morder[1][2],_index);}
55 float getC24() const noexcept{ return getFloat(_morder[1][3],_index);}
56 float getC25() const noexcept{ return getFloat(_morder[1][4],_index);}
57 float getC33() const noexcept{ return getFloat(_morder[2][2],_index);}
58 float getC34() const noexcept{ return getFloat(_morder[2][3],_index);}
59 float getC35() const noexcept{ return getFloat(_morder[2][4],_index);}
60 float getC44() const noexcept{ return getFloat(_morder[3][3],_index);}
61 float getC45() const noexcept{ return getFloat(_morder[3][4],_index);}
62 float getC55() const noexcept{ return getFloat(_morder[4][4],_index);}
63
69
70 void notify() final{
71 bank::notify();
72 scanIndex();
73 }
74 void scanIndex();
75 void print();
76
77 private :
78
79 CovMatrix _matrix={5,std::vector<float>(5,0)};
80 IndMatrix _morder={5,std::vector<int>(5,-1)};
81 int _pindex_order=-1;
82 mutable int _index=-1;
83 //std::map<int,int> _rmap;
84 std::vector<int> _rvec;
85 };
86
88 using covmat_uptr=std::unique_ptr<clas12::covmatrix>;
89}
90
91#endif /* UTILS_H */
Definition covmatrix.h:27
void setEntry(int ind) const
Definition covmatrix.h:44
float getC55() const noexcept
Definition covmatrix.h:62
float getC13() const noexcept
Definition covmatrix.h:50
int getIndex() const
Definition covmatrix.h:41
int getPindex()
Definition covmatrix.h:40
float getC12() const noexcept
Definition covmatrix.h:49
float getC44() const noexcept
Definition covmatrix.h:60
void scanIndex()
Definition covmatrix.cpp:32
const CovMatrix * matrix()
Definition covmatrix.cpp:53
float getC15() const noexcept
Definition covmatrix.h:52
int getPindex(int index)
Definition covmatrix.h:39
void notify() final
Definition covmatrix.h:70
void print()
Definition covmatrix.cpp:67
float getC33() const noexcept
Definition covmatrix.h:57
covmatrix(hipo::schema __schema)
Definition covmatrix.cpp:14
void setBankEntry(int ind)
Definition covmatrix.h:45
float getC22() const noexcept
Definition covmatrix.h:53
float getC14() const noexcept
Definition covmatrix.h:51
void setIndex(int ind) const
Definition covmatrix.h:43
float getC24() const noexcept
Definition covmatrix.h:55
float getC45() const noexcept
Definition covmatrix.h:61
float getC34() const noexcept
Definition covmatrix.h:58
float getC23() const noexcept
Definition covmatrix.h:54
float getC25() const noexcept
Definition covmatrix.h:56
float getC35() const noexcept
Definition covmatrix.h:59
float getC11() const noexcept
Definition covmatrix.h:48
Definition calextras.cpp:10
std::vector< std::vector< float > > CovMatrix
Definition covmatrix.h:24
clas12::covmatrix * covmat_ptr
Definition covmatrix.h:87
std::unique_ptr< clas12::covmatrix > covmat_uptr
Definition covmatrix.h:88
std::vector< std::vector< int > > IndMatrix
Definition covmatrix.h:25