clas12root
Loading...
Searching...
No Matches
particle.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: particle.h
9 * Author: gavalian
10 *
11 * Created on April 27, 2017, 10:01 AM
12 */
13
14#ifndef PARTICLE_H
15#define PARTICLE_H
16
17#include <hipo4/bank.h>
18#include <hipo4/dictionary.h>
19#include "ftbparticle.h"
20#include <cmath>
21#include <memory>
22
23namespace clas12 {
24
25 class particle : public hipo::bank {
26
27 private:
28 ftbpar_ptr _ftbpar; //FT based bank
29
30 int _pid_order{-1};
31 int _px_order{-1};
32 int _py_order{-1};
33 int _pz_order{-1};
34 int _vx_order{-1};
35 int _vy_order{-1};
36 int _vz_order{-1};
37 int _vt_order{-1};
38 int _beta_order{-1};
39 int _ch_order{-1};
40 int _st_order{-1};
41 int _chi2pid_order{-1};
42
43 mutable short _entry={0};
44
45 public:
46
47 particle() = default;
48
49
50 particle(hipo::schema __schema);
51 particle(hipo::schema __schema,ftbpar_ptr ftbpar);
52
53 ~particle() override = default;
54
55
56 int getPid(int index) const noexcept{ return getInt(_pid_order,index);}
57 float getPx(int index) const noexcept{ return getFloat(_px_order,index);}
58 float getPy(int index) const noexcept{ return getFloat(_py_order,index);}
59 float getPz(int index) const noexcept{ return getFloat(_pz_order,index);}
60 float getVx(int index) const noexcept{ return getFloat(_vx_order,index);}
61 float getVy(int index) const noexcept{ return getFloat(_vy_order,index);}
62 float getVz(int index) const noexcept{ return getFloat(_vz_order,index);}
63 float getVt(int index) const noexcept{ return getFloat(_vt_order,index);}
64 float getBeta(int index) const noexcept{ return getFloat(_beta_order,index);}
65 float getChi2Pid(int index) const noexcept{ return getFloat(_chi2pid_order,index);}
66 int getCharge(int index) const noexcept{ return getByte(_ch_order,index);}
67 int getStatus(int index) const noexcept{ return getShort(_st_order,index);}
68
69 int getPid() const noexcept{ return getInt(_pid_order,_entry);}
70 float getPx() const noexcept{ return getFloat(_px_order,_entry);}
71 float getPy() const noexcept{ return getFloat(_py_order,_entry);}
72 float getPz() const noexcept{ return getFloat(_pz_order,_entry);}
73 float getVx() const noexcept{ return getFloat(_vx_order,_entry);}
74 float getVy() const noexcept{ return getFloat(_vy_order,_entry);}
75 float getVz() const noexcept{ return getFloat(_vz_order,_entry);}
76 float getVt() const noexcept{ return getFloat(_vt_order,_entry);}
77 float getBeta() const noexcept{ return getFloat(_beta_order,_entry);}
78 float getChi2Pid() const noexcept{ return getFloat(_chi2pid_order,_entry);}
79 int getCharge() const noexcept{ return getByte(_ch_order,_entry);}
80 int getStatus() const noexcept{ return getShort(_st_order,_entry);}
81
82 int getFTBPid() const noexcept{ return _ftbpar->getPid();}
83 float getFTBVt() const noexcept{ return _ftbpar->getVt();}
84 float getFTBBeta() const noexcept{ return _ftbpar->getBeta();}
85 float getFTBChi2Pid() const noexcept{ return _ftbpar->getChi2Pid();}
86 int getFTBStatus() const noexcept{ return _ftbpar->getStatus();}
87 float getFTBPx() const noexcept{ return _ftbpar->getPx();}
88 float getFTBPy() const noexcept{ return _ftbpar->getPy();}
89 float getFTBPz() const noexcept{ return _ftbpar->getPz();}
90
91 float getP() const noexcept{
92 auto x= getFloat(_px_order,_entry);
93 auto y= getFloat(_py_order,_entry);
94 auto z= getFloat(_pz_order,_entry);
95 return sqrt(x*x+y*y+z*z);
96 }
97 float getFTBP() const noexcept{
98 auto x= getFTBPx();
99 auto y= getFTBPy();
100 auto z= getFTBPz();
101 return sqrt(x*x+y*y+z*z);
102 }
103
104 void setEntry(short i) const { _entry=i;if(_ftbpar)_ftbpar->setEntry(i);}
105 void setBankEntry(short i){ _entry=i;} //faster for BankHist
106 short getEntry() const noexcept{return _entry;}
112 void notify() final {
113 bank::notify();
114 //printf("particle class is read again\n");
115 }
116 };
117
119 using par_uptr=std::unique_ptr<clas12::particle>;
120
121}
122
123#endif /* UTILS_H */
Definition particle.h:25
float getPz(int index) const noexcept
Definition particle.h:59
float getFTBPz() const noexcept
Definition particle.h:89
float getPy(int index) const noexcept
Definition particle.h:58
float getBeta(int index) const noexcept
Definition particle.h:64
int getCharge(int index) const noexcept
Definition particle.h:66
float getVx(int index) const noexcept
Definition particle.h:60
particle()=default
float getFTBPy() const noexcept
Definition particle.h:88
void setBankEntry(short i)
Definition particle.h:105
float getP() const noexcept
Definition particle.h:91
float getFTBVt() const noexcept
Definition particle.h:83
float getVz(int index) const noexcept
Definition particle.h:62
void notify() final
Definition particle.h:112
short getEntry() const noexcept
Definition particle.h:106
~particle() override=default
float getPx() const noexcept
Definition particle.h:70
int getCharge() const noexcept
Definition particle.h:79
void setEntry(short i) const
Definition particle.h:104
float getVz() const noexcept
Definition particle.h:75
float getBeta() const noexcept
Definition particle.h:77
float getPy() const noexcept
Definition particle.h:71
float getVy(int index) const noexcept
Definition particle.h:61
int getPid(int index) const noexcept
Definition particle.h:56
float getPx(int index) const noexcept
Definition particle.h:57
float getVy() const noexcept
Definition particle.h:74
float getFTBP() const noexcept
Definition particle.h:97
float getPz() const noexcept
Definition particle.h:72
float getVt(int index) const noexcept
Definition particle.h:63
int getFTBPid() const noexcept
Definition particle.h:82
int getStatus() const noexcept
Definition particle.h:80
int getFTBStatus() const noexcept
Definition particle.h:86
float getFTBChi2Pid() const noexcept
Definition particle.h:85
int getPid() const noexcept
Definition particle.h:69
float getFTBPx() const noexcept
Definition particle.h:87
int getStatus(int index) const noexcept
Definition particle.h:67
float getVt() const noexcept
Definition particle.h:76
float getVx() const noexcept
Definition particle.h:73
float getFTBBeta() const noexcept
Definition particle.h:84
float getChi2Pid(int index) const noexcept
Definition particle.h:65
float getChi2Pid() const noexcept
Definition particle.h:78
Definition calextras.cpp:10
clas12::particle * par_ptr
Definition particle.h:118
clas12::ftbparticle * ftbpar_ptr
Definition ftbparticle.h:87
std::unique_ptr< clas12::particle > par_uptr
Definition particle.h:119