From aefe112a0549b35f82ca1e28c9546c2d99d08b12 Mon Sep 17 00:00:00 2001 From: dglazier Date: Thu, 16 Feb 2023 11:25:17 +0000 Subject: [PATCH 1/9] add getChi2, change getLayer(int) to use getByte --- Clas12Banks/calorimeter.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Clas12Banks/calorimeter.h b/Clas12Banks/calorimeter.h index 05a06d9..c203a5d 100644 --- a/Clas12Banks/calorimeter.h +++ b/Clas12Banks/calorimeter.h @@ -33,7 +33,7 @@ namespace clas12 { ~calorimeter() override=default; int getLayer(int index) const noexcept override{ - if(index>-1)return getInt(_layer_order,index); + if(index>-1)return getByte(_layer_order,index); return 0; } //getter funtions for items in calorimeter bank @@ -48,6 +48,10 @@ namespace clas12 { double getPath() const noexcept{ if(_index>-1)return getFloat(_path_order,_index); return 0; + } + double getChi2() const noexcept{ + if(_index>-1)return getFloat(_chi2_order,_index); + return 0; } int getLayer() const noexcept override{ if(_index>-1)return getByte(_layer_order,_index); From e405e5d57c8cafbe770d2c25a692114ddad48366 Mon Sep 17 00:00:00 2001 From: dglazier Date: Thu, 16 Feb 2023 11:37:00 +0000 Subject: [PATCH 2/9] add getChi2, change getSEctor to use getByte --- Clas12Banks/cherenkov.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Clas12Banks/cherenkov.h b/Clas12Banks/cherenkov.h index 1c4e5cf..a7f977a 100644 --- a/Clas12Banks/cherenkov.h +++ b/Clas12Banks/cherenkov.h @@ -36,7 +36,7 @@ namespace clas12 { if(_index>-1)return getFloat(_time_order,_index); return 0; } - float getNphe() const noexcept{ + double getNphe() const noexcept{ if(_index>-1)return getFloat(_nphe_order,_index); return 0; } @@ -45,14 +45,18 @@ namespace clas12 { return 0; } int getSector() const noexcept{ - if(_index>-1)return getInt(_sector_order,_index); + if(_index>-1)return getByte(_sector_order,_index); return 0; } - double getX() const noexcept{ + double getChi2() const noexcept{ + if(_index>-1)return getFloat(_chi2_order,_index); + return 0; + } + double getX() const noexcept{ if(_index>-1)return getFloat(_x_order,_index); return 0; } - double getY() const noexcept{ + double getY() const noexcept{ if(_index>-1)return getFloat(_y_order,_index); return 0; } @@ -69,7 +73,7 @@ namespace clas12 { return 0; } int getStatus() const noexcept{ - if(_index>-1)return getInt(_status_order,_index); + if(_index>-1)return getShort(_status_order,_index); return 0; } From 7825827b3646e496b168e68c621cacc54256375a Mon Sep 17 00:00:00 2001 From: dglazier Date: Thu, 16 Feb 2023 11:40:07 +0000 Subject: [PATCH 3/9] change getLayer(int) to use getByte --- Clas12Banks/forwardtagger.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Clas12Banks/forwardtagger.h b/Clas12Banks/forwardtagger.h index 8bc50ae..1a12d8e 100644 --- a/Clas12Banks/forwardtagger.h +++ b/Clas12Banks/forwardtagger.h @@ -34,7 +34,7 @@ namespace clas12 { //getter funtions for items in forwardtagger bank int getLayer(int index) const noexcept override{ - if(index>-1)return getInt(_layer_order,index); + if(index>-1)return getByte(_layer_order,index); return 0; } int getLayer() const noexcept override{ @@ -82,7 +82,7 @@ namespace clas12 { return 0; } int getSizeFT() const noexcept{ //watch-out banks::getSize() ! - if(_index>-1)return getInt(_size_order,_index); + if(_index>-1)return getShort(_size_order,_index); return 0; } double getChi2() const noexcept{ From c5bf10392472d3422c95ba39632b98e68c9f22b2 Mon Sep 17 00:00:00 2001 From: dglazier Date: Thu, 16 Feb 2023 13:29:42 +0000 Subject: [PATCH 4/9] add getR to vertdoca --- Clas12Banks/vertdoca.cpp | 3 ++- Clas12Banks/vertdoca.h | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Clas12Banks/vertdoca.cpp b/Clas12Banks/vertdoca.cpp index 3552259..3dfc1b4 100644 --- a/Clas12Banks/vertdoca.cpp +++ b/Clas12Banks/vertdoca.cpp @@ -25,6 +25,7 @@ namespace clas12 { _cx2_order = sch.getEntryOrder("cx2"); _cy2_order = sch.getEntryOrder("cy2"); _cz2_order = sch.getEntryOrder("cz2"); - + _r_order = sch.getEntryOrder("r"); + } } diff --git a/Clas12Banks/vertdoca.h b/Clas12Banks/vertdoca.h index dd72de3..5060d4d 100644 --- a/Clas12Banks/vertdoca.h +++ b/Clas12Banks/vertdoca.h @@ -48,7 +48,8 @@ namespace clas12 { float getCx2(int entry) const noexcept{ return getFloat(_cx2_order,entry); } float getCy2(int entry) const noexcept{ return getFloat(_cy2_order,entry); } float getCz2(int entry) const noexcept{ return getFloat(_cz2_order,entry); } - + float getR(int entry) const noexcept{ return getFloat(_r_order,entry); } + /** * This is virtual method from hipo::bank it will be called @@ -77,7 +78,7 @@ namespace clas12 { private : - int _index1_order{-1}; + int _index1_order{-1}; int _index2_order{-1}; int _x_order{-1}; int _y_order{-1}; @@ -94,6 +95,7 @@ namespace clas12 { int _cx2_order{-1}; int _cy2_order{-1}; int _cz2_order{-1}; + int _r_order{-1}; }; From 83fa234d7d4265fee04490f5843703700414a6f2 Mon Sep 17 00:00:00 2001 From: dglazier Date: Thu, 16 Feb 2023 13:34:05 +0000 Subject: [PATCH 5/9] add getEdge/Path to traj --- Clas12Banks/traj.cpp | 2 ++ Clas12Banks/traj.h | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/Clas12Banks/traj.cpp b/Clas12Banks/traj.cpp index 2e29f75..7a047f8 100644 --- a/Clas12Banks/traj.cpp +++ b/Clas12Banks/traj.cpp @@ -20,6 +20,8 @@ namespace clas12 { _y_order = __schema.getEntryOrder("y"); _z_order = __schema.getEntryOrder("z"); _layer_order = __schema.getEntryOrder("layer"); + _path_order = __schema.getEntryOrder("path"); + _edge_order = __schema.getEntryOrder("edge"); } diff --git a/Clas12Banks/traj.h b/Clas12Banks/traj.h index b4a4c4f..af85266 100644 --- a/Clas12Banks/traj.h +++ b/Clas12Banks/traj.h @@ -64,6 +64,14 @@ namespace clas12 { if(_index>-1)return getFloat(_z_order,_index); return 0; } + double getPath() const noexcept{ + if(_index>-1)return getFloat(_path_order,_index); + return 0; + } + double getEdge() const noexcept{ + if(_index>-1)return getFloat(_edge_order,_index); + return 0; + } /* short getDetID(){ */ /* if(_index>-1)return getShort(_detector_id_order,_index); */ /* return 0; */ @@ -93,6 +101,8 @@ namespace clas12 { int _x_order=-1; int _y_order=-1; int _z_order=-1; + int _path_order=-1; + int _edge_order=-1; From 2e24a762d0ea4fa9c564b847904e1e9c611b8451 Mon Sep 17 00:00:00 2001 From: dglazier Date: Thu, 16 Feb 2023 13:42:53 +0000 Subject: [PATCH 6/9] add getEdge to traj --- Clas12Banks/traj.cpp | 1 - Clas12Banks/traj.h | 38 ++++++++++---------------------------- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/Clas12Banks/traj.cpp b/Clas12Banks/traj.cpp index 7a047f8..e73bc31 100644 --- a/Clas12Banks/traj.cpp +++ b/Clas12Banks/traj.cpp @@ -20,7 +20,6 @@ namespace clas12 { _y_order = __schema.getEntryOrder("y"); _z_order = __schema.getEntryOrder("z"); _layer_order = __schema.getEntryOrder("layer"); - _path_order = __schema.getEntryOrder("path"); _edge_order = __schema.getEntryOrder("edge"); } diff --git a/Clas12Banks/traj.h b/Clas12Banks/traj.h index af85266..d96baaf 100644 --- a/Clas12Banks/traj.h +++ b/Clas12Banks/traj.h @@ -64,30 +64,15 @@ namespace clas12 { if(_index>-1)return getFloat(_z_order,_index); return 0; } - double getPath() const noexcept{ - if(_index>-1)return getFloat(_path_order,_index); - return 0; - } - double getEdge() const noexcept{ - if(_index>-1)return getFloat(_edge_order,_index); - return 0; - } - /* short getDetID(){ */ - /* if(_index>-1)return getShort(_detector_id_order,_index); */ - /* return 0; */ - /* } */ - /* short getTrajIndex(){ */ - /* if(_index>-1)return getShort(_index_order,_index); */ - /* return 0; */ - /* } */ - /* short getPindex(){ */ - /* if(_index>-1)return getShort(_pindex_order,_index); */ - /* return 0; */ - /* } */ - double getPath() const noexcept{ - if(_index>-1)return getFloat(_path_order,_index); - return 0; - } + double getEdge() const noexcept{ + if(_index>-1)return getFloat(_edge_order,_index); + return 0; + } + + double getPath() const noexcept{ + if(_index>-1)return getFloat(_path_order,_index); + return 0; + } private: @@ -95,14 +80,11 @@ namespace clas12 { int _cy_order=-1; int _cz_order=-1; int _layer_order=-1; - //int _index_order=-1; int _path_order=-1; - //int _pindex_order=-1; int _x_order=-1; int _y_order=-1; int _z_order=-1; - int _path_order=-1; - int _edge_order=-1; + int _edge_order=-1; From a8a800a6c4366c7c2fac65eb090a09e7c5a966db Mon Sep 17 00:00:00 2001 From: dglazier Date: Thu, 16 Feb 2023 13:43:37 +0000 Subject: [PATCH 7/9] add getPxyz to ftparticle, getFTPxyz to particle --- Clas12Banks/ftbparticle.cpp | 8 +++++++- Clas12Banks/ftbparticle.h | 11 ++++++++++- Clas12Banks/particle.h | 9 +++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Clas12Banks/ftbparticle.cpp b/Clas12Banks/ftbparticle.cpp index 9a42ad2..54b49ea 100644 --- a/Clas12Banks/ftbparticle.cpp +++ b/Clas12Banks/ftbparticle.cpp @@ -18,6 +18,9 @@ namespace clas12 { _vt_order = sch.getEntryOrder("vt"); _beta_order = sch.getEntryOrder("beta"); _chi2pid_order = sch.getEntryOrder("chi2pid"); + _px_order = sch.getEntryOrder("px"); + _py_order = sch.getEntryOrder("py"); + _pz_order = sch.getEntryOrder("pz"); } @@ -29,7 +32,10 @@ namespace clas12 { _beta_order = sch.getEntryOrder("beta"); _vt_order = sch.getEntryOrder("vt"); _chi2pid_order = sch.getEntryOrder("chi2pid"); - + _px_order = sch.getEntryOrder("px"); + _py_order = sch.getEntryOrder("py"); + _pz_order = sch.getEntryOrder("pz"); + } diff --git a/Clas12Banks/ftbparticle.h b/Clas12Banks/ftbparticle.h index 7c6d94c..163b68c 100644 --- a/Clas12Banks/ftbparticle.h +++ b/Clas12Banks/ftbparticle.h @@ -29,6 +29,9 @@ namespace clas12 { int _beta_order{-1}; int _st_order{-1}; int _chi2pid_order{-1}; + int _px_order{-1}; + int _py_order{-1}; + int _pz_order{-1}; short _entry{0}; @@ -49,6 +52,9 @@ namespace clas12 { float getBeta(int index) const noexcept{ return getFloat(_beta_order,index);} float getChi2Pid(int index) const noexcept{ return getFloat(_chi2pid_order,index);} int getStatus(int index) const noexcept{ return getShort(_st_order,index);} + float getPx(int index) const noexcept{ return getFloat(_px_order,index);} + float getPy(int index) const noexcept{ return getFloat(_py_order,index);} + float getPz(int index) const noexcept{ return getFloat(_pz_order,index);} int getPid() const noexcept{ return _entry==-1?0:getInt(_pid_order,_entry);} float getVt() const noexcept{ return _entry==-1?0:getFloat(_vt_order,_entry);} @@ -56,7 +62,10 @@ namespace clas12 { float getChi2Pid() const noexcept{ return _entry==-1?0:getFloat(_chi2pid_order,_entry);} int getStatus() const noexcept{ return _entry==-1?0:getShort(_st_order,_entry);} - + float getPx() const noexcept{ return getFloat(_px_order,_entry);} + float getPy() const noexcept{ return getFloat(_py_order,_entry);} + float getPz() const noexcept{ return getFloat(_pz_order,_entry);} + void setEntry(short i){ if( igetBeta();} float getFTBChi2Pid() const noexcept{ return _ftbpar->getChi2Pid();} int getFTBStatus() const noexcept{ return _ftbpar->getStatus();} + float getFTBPx() const noexcept{ return _ftbpar->getPx();} + float getFTBPy() const noexcept{ return _ftbpar->getPy();} + float getFTBPz() const noexcept{ return _ftbpar->getPz();} float getP() const noexcept{ auto x= getFloat(_px_order,_entry); @@ -91,6 +94,12 @@ namespace clas12 { auto z= getFloat(_pz_order,_entry); return sqrt(x*x+y*y+z*z); } + float getFTBP() const noexcept{ + auto x= getFTBPx(); + auto y= getFTBPy(); + auto z= getFTBPz(); + return sqrt(x*x+y*y+z*z); + } void setEntry(short i){ _entry=i;if(_ftbpar)_ftbpar->setEntry(i);} void setBankEntry(short i){ _entry=i;} //faster for BankHist From a575b95e515b2289d2665cfd16a5a2e41a89c3f5 Mon Sep 17 00:00:00 2001 From: dglazier Date: Fri, 17 Feb 2023 14:47:56 +0000 Subject: [PATCH 8/9] add caloextras anf FTparticle P etc to region_particle --- Clas12Banks/#calorimeter.h# | 230 ++++++++++++++++++++++++++++++++ Clas12Banks/CMakeLists.txt | 4 +- Clas12Banks/calextras.cpp | 34 +++++ Clas12Banks/calextras.h | 192 ++++++++++++++++++++++++++ Clas12Banks/calorimeter.cpp | 34 +++++ Clas12Banks/calorimeter.h | 62 ++++++++- Clas12Banks/clas12reader.cpp | 27 +++- Clas12Banks/region_particle.cpp | 44 +++--- Clas12Banks/region_particle.h | 27 ++-- 9 files changed, 609 insertions(+), 45 deletions(-) create mode 100644 Clas12Banks/#calorimeter.h# create mode 100644 Clas12Banks/calextras.cpp create mode 100644 Clas12Banks/calextras.h diff --git a/Clas12Banks/#calorimeter.h# b/Clas12Banks/#calorimeter.h# new file mode 100644 index 0000000..7a849b7 --- /dev/null +++ b/Clas12Banks/#calorimeter.h# @@ -0,0 +1,230 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * File: detector.h + * Author: dglazier + * + * Created on April 27, 2017, 10:01 AM + */ + +#ifndef CLAS12_CALORIMETER_H +#define CLAS12_CALORIMETER_H + +#include "particle_detector.h" +#include "calextras.h" +#include + + +namespace clas12 { + + class calorimeter : public particle_detector { + + + public: + + + calorimeter()=default; + + calorimeter(hipo::schema __schema); + calorimeter(hipo::schema __schema,hipo::schema extras); + + ~calorimeter() override=default; + + int getLayer(int index) const noexcept override{ + if(index>-1)return getByte(_layer_order,index); + return 0; + } + //getter funtions for items in calorimeter bank + double getTime() const noexcept{ + if(_index>-1)return getFloat(_time_order,_index); + return 0; + } + double getEnergy() const noexcept{ + if(_index>-1)return getFloat(_energy_order,_index); + return 0; + } + double getPath() const noexcept{ + if(_index>-1)return getFloat(_path_order,_index); + return 0; + } + double getChi2() const noexcept{ + if(_index>-1)return getFloat(_chi2_order,_index); + return 0; + } + int getLayer() const noexcept override{ + if(_index>-1)return getByte(_layer_order,_index); + return 0; + } + int getSector() const noexcept{ + if(_index>-1)return getByte(_sector_order,_index); + return 0; + } + double getX() const noexcept{ + if(_index>-1)return getFloat(_x_order,_index); + return 0; + } + double getY() const noexcept{ + if(_index>-1)return getFloat(_y_order,_index); + return 0; + } + double getZ() const noexcept{ + if(_index>-1)return getFloat(_z_order,_index); + return 0; + } + double getDu() const noexcept{ + if(_index>-1)return getFloat(_du_order,_index); + return 0; + } + double getDv() const noexcept{ + if(_index>-1)return getFloat(_dv_order,_index); + return 0; + } + double getDw() const noexcept{ + if(_index>-1)return getFloat(_dw_order,_index); + return 0; + } + double getHx() const noexcept{ + if(_index>-1)return getFloat(_hx_order,_index); + return 0; + } + double getHy() const noexcept{ + if(_index>-1)return getFloat(_hy_order,_index); + return 0; + } + double getHz() const noexcept{ + if(_index>-1)return getFloat(_hz_order,_index); + return 0; + } + double getLu() const noexcept{ + if(_index>-1)return getFloat(_lu_order,_index); + return 0; + } + double getLv() const noexcept{ + if(_index>-1)return getFloat(_lv_order,_index); + return 0; + } + double getLw() const noexcept{ + if(_index>-1)return getFloat(_lw_order,_index); + return 0; + } + double getM2u() const noexcept{ + if(_index>-1)return getFloat(_m2u_order,_index); + return 0; + } + double getM2v() const noexcept{ + if(_index>-1)return getFloat(_m2v_order,_index); + return 0; + } + double getM2w() const noexcept{ + if(_index>-1)return getFloat(_m2w_order,_index); + return 0; + } + double getM3u() const noexcept{ + if(_index>-1)return getFloat(_m3u_order,_index); + return 0; + } + double getM3v() const noexcept{ + if(_index>-1)return getFloat(_m3v_order,_index); + return 0; + } + double getM3w() const noexcept{ + if(_index>-1)return getFloat(_m3w_order,_index); + return 0; + } + int getStatus() const noexcept{ + if(_index>-1)return getShort(_status_order,_index); + return 0; + } + + //get extras + + int getDbstU() const noexcept{ + return _extras.get()!=nullptr ? _extras->getDbstU(_index):0; + } + int getDbstV() const noexcept{ + return _extras.get()!=nullptr ? _extras->getDbstV(_index):0; + } + int getDbstW() const noexcept{ + return _extras.get()!=nullptr ? _extras->getDbstW(_index):0; + } + double getRawEU() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRawEU(_index):0; + } + double getRawEV() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRawEV(_index):0; + } + double getRawEW() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRawEW(_index):0; + } + double getRecEU() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecEU(_index):0; + } + double getRecEV() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecEV(_index):0; + } + double getRecEW() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecEW(_index):0; + } + double getRecDTU() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecDTU(_index):0; + } + double getRecDTV() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecDTV(_index):0; + } + double getRecDTW() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecDTW(_index):0; + } + double getRecFTU() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecFTU(_index):0; + } + double getRecFTV() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecFTV(_index):0; + } + double getRecFTW() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecFTW(_index):0; + } + calextras* getExtras()const {return _extras.get();} + + + private: + + int _layer_order=-1; + int _energy_order=-1; + int _path_order=-1; + int _time_order=-1; + int _sector_order=-1; + int _x_order=-1; + int _y_order=-1; + int _z_order=-1; + int _chi2_order=-1; + int _du_order=-1; + int _dv_order=-1; + int _dw_order=-1; + int _hx_order=-1; + int _hy_order=-1; + int _hz_order=-1; + int _lu_order=-1; + int _lv_order=-1; + int _lw_order=-1; + int _m2u_order=-1; + int _m2v_order=-1; + int _m2w_order=-1; + int _m3u_order=-1; + int _m3v_order=-1; + int _m3w_order=-1; + int _status_order=-1; + + calextra_uptr _extras; + + }; //class calorimeter + + using cal_ptr=clas12::calorimeter*; + using cal_uptr=std::unique_ptr; + +}//namespace clas12 + +#endif /* UTILS_H */ diff --git a/Clas12Banks/CMakeLists.txt b/Clas12Banks/CMakeLists.txt index ab743d1..d57c1eb 100644 --- a/Clas12Banks/CMakeLists.txt +++ b/Clas12Banks/CMakeLists.txt @@ -1,9 +1,9 @@ -set(CLASS_LIST_CPP helflip.cpp helonline.cpp vertdoca.cpp runconfig.cpp event.cpp ftbevent.cpp particle.cpp ftbparticle.cpp mcparticle.cpp mcevent.cpp mcmatch.cpp scaler.cpp vtp.cpp particle_detector.cpp scintillator.cpp scintextras.cpp tracker.cpp traj.cpp forwardtagger.cpp cherenkov.cpp calorimeter.cpp covmatrix.cpp region_particle.cpp region_ft.cpp region_fdet.cpp region_cdet.cpp region_band.cpp clas12writer.cpp clas12reader.cpp mesonex_trigger.cpp scaler_reader.cpp clas12databases.cpp qadb_reader.cpp ccdb_reader.cpp rcdb_reader.cpp) +set(CLASS_LIST_CPP helflip.cpp helonline.cpp vertdoca.cpp runconfig.cpp event.cpp ftbevent.cpp particle.cpp ftbparticle.cpp mcparticle.cpp mcevent.cpp mcmatch.cpp scaler.cpp vtp.cpp particle_detector.cpp scintillator.cpp scintextras.cpp tracker.cpp traj.cpp forwardtagger.cpp cherenkov.cpp calorimeter.cpp calextras.cpp covmatrix.cpp region_particle.cpp region_ft.cpp region_fdet.cpp region_cdet.cpp region_band.cpp clas12writer.cpp clas12reader.cpp mesonex_trigger.cpp scaler_reader.cpp clas12databases.cpp qadb_reader.cpp ccdb_reader.cpp rcdb_reader.cpp) -set(CLASS_LIST_H helflip.h helonline.h vertdoca.h runconfig.h event.h ftbevent.h particle.h ftbparticle.h mcparticle.h mcevent.h mcmatch.h scaler.h vtp.h particle_detector.h scintillator.h scintextras.h tracker.h traj.h forwardtagger.h cherenkov.h calorimeter.h covmatrix.h region_particle.h region_ft.h region_fdet.h region_cdet.h region_band.h clas12writer.h clas12reader.h mesonex_trigger.h scaler_reader.h clas12databases.h qadb_reader.h ccdb_reader.h rcdb_reader.h) +set(CLASS_LIST_H helflip.h helonline.h vertdoca.h runconfig.h event.h ftbevent.h particle.h ftbparticle.h mcparticle.h mcevent.h mcmatch.h scaler.h vtp.h particle_detector.h scintillator.h scintextras.h tracker.h traj.h forwardtagger.h cherenkov.h calorimeter.h calextras.h covmatrix.h region_particle.h region_ft.h region_fdet.h region_cdet.h region_band.h clas12writer.h clas12reader.h mesonex_trigger.h scaler_reader.h clas12databases.h qadb_reader.h ccdb_reader.h rcdb_reader.h) IF (DEFINED ENV{QADB}) set(CLASS_LIST_CPP ${CLASS_LIST_CPP} jsonFileMerger.cpp) diff --git a/Clas12Banks/calextras.cpp b/Clas12Banks/calextras.cpp new file mode 100644 index 0000000..faaa7db --- /dev/null +++ b/Clas12Banks/calextras.cpp @@ -0,0 +1,34 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +#include "calextras.h" + + +namespace clas12 { + + + calextras::calextras(hipo::schema __schema): hipo::bank(__schema) { + + _dbstU_order = __schema.getEntryOrder("dbstU"); + _dbstV_order = __schema.getEntryOrder("dbstV"); + _dbstW_order = __schema.getEntryOrder("dbstW"); + _rawEU_order = __schema.getEntryOrder("rawEU"); + _rawEV_order = __schema.getEntryOrder("rawEV"); + _rawEW_order = __schema.getEntryOrder("rawEW"); + _recEU_order = __schema.getEntryOrder("recEU"); + _recEV_order = __schema.getEntryOrder("recEV"); + _recEW_order = __schema.getEntryOrder("recEW"); + _recDTU_order = __schema.getEntryOrder("recDTU"); + _recDTV_order = __schema.getEntryOrder("recDTV"); + _recDTW_order = __schema.getEntryOrder("recDTW"); + _recFTU_order = __schema.getEntryOrder("recFTU"); + _recFTV_order = __schema.getEntryOrder("recFTV"); + _recFTW_order = __schema.getEntryOrder("recFTW"); + + } + + +} diff --git a/Clas12Banks/calextras.h b/Clas12Banks/calextras.h new file mode 100644 index 0000000..049e503 --- /dev/null +++ b/Clas12Banks/calextras.h @@ -0,0 +1,192 @@ + +/* + * File: calextras.h + * Author: dglazier + * + * Created on Feb 16, 2023 + */ + +#ifndef CLAS12_CALEXTRAS_H +#define CLAS12_CALEXTRAS_H + +#include "bank.h" +#include + + +namespace clas12 { + + class calorimeter; + + class calextras : public hipo::bank { + + + public: + + + calextras()=default; + + calextras(hipo::schema __schema); + + ~calextras() override=default; + + + int getDbstU() const noexcept{ + if(_index>-1)return getShort(_dbstU_order,_index); + return 0; + } + int getDbstV() const noexcept{ + if(_index>-1)return getShort(_dbstV_order,_index); + return 0; + } + int getDbstW() const noexcept{ + if(_index>-1)return getShort(_dbstW_order,_index); + return 0; + } + + double getRawEU() const noexcept{ + if(_index>-1)return getFloat(_rawEU_order,_index); + return 0.; + } + double getRawEV() const noexcept{ + if(_index>-1)return getFloat(_rawEV_order,_index); + return 0.; + } + double getRawEW() const noexcept{ + if(_index>-1)return getFloat(_rawEW_order,_index); + return 0.; + } + double getRecEU() const noexcept{ + if(_index>-1)return getFloat(_recEU_order,_index); + return 0.; + } + double getRecEV() const noexcept{ + if(_index>-1)return getFloat(_recEV_order,_index); + return 0.; + } + double getRecEW() const noexcept{ + if(_index>-1)return getFloat(_recEW_order,_index); + return 0.; + } + double getRecDTU() const noexcept{ + if(_index>-1)return getFloat(_recDTU_order,_index); + return 0.; + } + double getRecDTV() const noexcept{ + if(_index>-1)return getFloat(_recDTV_order,_index); + return 0.; + } + double getRecDTW() const noexcept{ + if(_index>-1)return getFloat(_recDTW_order,_index); + return 0.; + } + double getRecFTU() const noexcept{ + if(_index>-1)return getFloat(_recFTU_order,_index); + return 0.; + } + double getRecFTV() const noexcept{ + if(_index>-1)return getFloat(_recFTV_order,_index); + return 0.; + } + double getRecFTW() const noexcept{ + if(_index>-1)return getFloat(_recFTW_order,_index); + return 0.; + } + + int getDbstU(int index) const noexcept{ + if(index>-1)return getShort(_dbstU_order,index); + return 0; + } + int getDbstV(int index) const noexcept{ + if(index>-1)return getShort(_dbstV_order,index); + return 0; + } + int getDbstW(int index) const noexcept{ + if(index>-1)return getShort(_dbstW_order,index); + return 0; + } + + double getRawEU(int index) const noexcept{ + if(index>-1)return getFloat(_rawEU_order, index); + return 0.; + } + double getRawEV(int index) const noexcept{ + if(index>-1)return getFloat(_rawEV_order,index); + return 0.; + } + double getRawEW(int index) const noexcept{ + if(index>-1)return getFloat(_rawEW_order,index); + return 0.; + } + double getRecEU(int index) const noexcept{ + if(index>-1)return getFloat(_recEU_order,index); + return 0.; + } + double getRecEV(int index) const noexcept{ + if(index>-1)return getFloat(_recEV_order,index); + return 0.; + } + double getRecEW(int index) const noexcept{ + if(index>-1)return getFloat(_recEW_order,index); + return 0.; + } + double getRecDTU(int index) const noexcept{ + if(index>-1)return getFloat(_recDTU_order,index); + return 0.; + } + double getRecDTV(int index) const noexcept{ + if(index>-1)return getFloat(_recDTV_order,index); + return 0.; + } + double getRecDTW(int index) const noexcept{ + if(index>-1)return getFloat(_recDTW_order,index); + return 0.; + } + double getRecFTU(int index) const noexcept{ + if(index>-1)return getFloat(_recFTU_order,index); + return 0.; + } + double getRecFTV(int index) const noexcept{ + if(index>-1)return getFloat(_recFTV_order,index); + return 0.; + } + double getRecFTW(int index) const noexcept{ + if(index>-1)return getFloat(_recFTW_order,index); + return 0.; + } + + + + void setBankEntry(short i){ _index=i;} //faster for BankHist + + private: + friend calorimeter; + + void setIndex(short i){ _index=i;} + + + int _dbstU_order=-1; + int _dbstV_order=-1; + int _dbstW_order=-1; + int _rawEU_order=-1; + int _rawEV_order=-1; + int _rawEW_order=-1; + int _recEU_order=-1; + int _recEV_order=-1; + int _recEW_order=-1; + int _recDTU_order=-1; + int _recDTV_order=-1; + int _recDTW_order=-1; + int _recFTU_order=-1; + int _recFTV_order=-1; + int _recFTW_order=-1; + + int _index=-1; + + }; //class calextras + + using calextra_ptr=clas12::calextras*; + using calextra_uptr=std::unique_ptr; + +}//namespace clas12 + +#endif /* UTILS_H */ diff --git a/Clas12Banks/calorimeter.cpp b/Clas12Banks/calorimeter.cpp index 19e9732..c76d89b 100644 --- a/Clas12Banks/calorimeter.cpp +++ b/Clas12Banks/calorimeter.cpp @@ -11,6 +11,40 @@ namespace clas12 { + calorimeter::calorimeter(hipo::schema __schema,hipo::schema extras): + clas12::particle_detector(__schema), + _extras{new calextras(extras)} + { + std::cout<<"calorimeter::calorimeter "<< _extras.get()< @@ -26,10 +27,11 @@ namespace clas12 { public: - calorimeter()=default; + calorimeter()=default; - calorimeter(hipo::schema __schema); - + calorimeter(hipo::schema __schema); + calorimeter(hipo::schema __schema,hipo::schema extras); + ~calorimeter() override=default; int getLayer(int index) const noexcept override{ @@ -137,7 +139,56 @@ namespace clas12 { if(_index>-1)return getShort(_status_order,_index); return 0; } - + + //get extras + + int getDbstU() const noexcept{ + return _extras.get()!=nullptr ? _extras->getDbstU(_index):0; + } + int getDbstV() const noexcept{ + return _extras.get()!=nullptr ? _extras->getDbstV(_index):0; + } + int getDbstW() const noexcept{ + return _extras.get()!=nullptr ? _extras->getDbstW(_index):0; + } + double getRawEU() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRawEU(_index):0; + } + double getRawEV() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRawEV(_index):0; + } + double getRawEW() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRawEW(_index):0; + } + double getRecEU() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecEU(_index):0; + } + double getRecEV() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecEV(_index):0; + } + double getRecEW() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecEW(_index):0; + } + double getRecDTU() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecDTU(_index):0; + } + double getRecDTV() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecDTV(_index):0; + } + double getRecDTW() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecDTW(_index):0; + } + double getRecFTU() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecFTU(_index):0; + } + double getRecFTV() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecFTV(_index):0; + } + double getRecFTW() const noexcept{ + return _extras.get()!=nullptr ? _extras->getRecFTW(_index):0; + } + calextras* getExtras()const {return _extras.get();} + private: @@ -167,7 +218,8 @@ namespace clas12 { int _m3w_order=-1; int _status_order=-1; - + calextra_uptr _extras; + }; //class calorimeter using cal_ptr=clas12::calorimeter*; diff --git a/Clas12Banks/clas12reader.cpp b/Clas12Banks/clas12reader.cpp index c257cc7..cba64d2 100644 --- a/Clas12Banks/clas12reader.cpp +++ b/Clas12Banks/clas12reader.cpp @@ -61,34 +61,51 @@ namespace clas12 { //initialise banks pointers if(_factory.hasSchema("RECFT::Particle")) _bftbparts.reset(new ftbparticle{_factory.getSchema("RECFT::Particle")}); + if(_factory.hasSchema("REC::Particle")) _bparts.reset(new particle{_factory.getSchema("REC::Particle"),_bftbparts.get()}); + if(_factory.hasSchema("REC::CovMat")) _bcovmat.reset(new covmatrix{_factory.getSchema("REC::CovMat")}); + if(_factory.hasSchema("RECFT::Event")) _bftbevent.reset(new clas12::ftbevent{_factory.getSchema("RECFT::Event")}); if(_factory.hasSchema("RUN::config")) _brunconfig.reset(new clas12::runconfig{_factory.getSchema("RUN::config")}); + if(_factory.hasSchema("REC::Event")) _bevent.reset(new clas12::event{_factory.getSchema("REC::Event"),_bftbevent.get()}); - if(_factory.hasSchema("REC::Calorimeter")) - _bcal.reset(new calorimeter{_factory.getSchema("REC::Calorimeter")}); + + if(_factory.hasSchema("REC::Calorimeter")){ + if(_factory.hasSchema("REC::CaloExtras")){ + _bcal.reset(new calorimeter{_factory.getSchema("REC::Calorimeter"),_factory.getSchema("REC::CaloExtras")}); + } + else{ + _bcal.reset(new calorimeter{_factory.getSchema("REC::Calorimeter")}); + } + } + if(_factory.hasSchema("REC::Scintillator")){ if(_factory.hasSchema("REC::ScintExtras")){ _bscint.reset(new scintillator{_factory.getSchema("REC::Scintillator"),_factory.getSchema("REC::ScintExtras")}); } - else + else{ _bscint.reset(new scintillator{_factory.getSchema("REC::Scintillator")}); - + } } + if(_factory.hasSchema("REC::Track")) _btrck.reset(new tracker{_factory.getSchema("REC::Track")}); + if(_factory.hasSchema("REC::Traj")) _btraj.reset(new traj{_factory.getSchema("REC::Traj")}); + if(_factory.hasSchema("REC::Cherenkov")) _bcher.reset(new cherenkov{_factory.getSchema("REC::Cherenkov")}); + if(_factory.hasSchema("REC::ForwardTagger")) _bft.reset(new forwardtagger{_factory.getSchema("REC::ForwardTagger")}); + if(_factory.hasSchema("REC::VertDoca")) _bvertdoca.reset(new clas12::vertdoca{_factory.getSchema("REC::VertDoca")}); @@ -99,6 +116,7 @@ namespace clas12 { else _bmcparts.reset( new mcparticle{_factory.getSchema("MC::Lund")}); } + if(_factory.hasSchema("MC::Event")) _bmcevent.reset( new clas12::mcevent{_factory.getSchema("MC::Event")}); @@ -333,6 +351,7 @@ namespace clas12 { if(_bevent.get())_event.getStructure(*_bevent.get()); if(_bftbevent.get())_event.getStructure(*_bftbevent.get()); if(_bcal.get())_event.getStructure(*_bcal.get()); + if(_bcal->getExtras())_event.getStructure(*_bcal->getExtras()); if(_bscint.get())_event.getStructure(*_bscint.get()); if(_bscint->getExtras())_event.getStructure(*_bscint->getExtras()); if(_btrck.get())_event.getStructure(*_btrck.get()); diff --git a/Clas12Banks/region_particle.cpp b/Clas12Banks/region_particle.cpp index d86e62d..b9a3594 100644 --- a/Clas12Banks/region_particle.cpp +++ b/Clas12Banks/region_particle.cpp @@ -57,29 +57,29 @@ namespace clas12 { } - float region_particle::getTheta() const{ + double region_particle::getTheta() const{ _parts->setEntry(_pentry); - float x=_parts->getPx(); - float y=_parts->getPy(); - float z=_parts->getPz(); - return x == 0.0 && y == 0.0 && z == 0.0 ? 0.0 + double x=_parts->getPx(); + double y=_parts->getPy(); + double z=_parts->getPz(); + return x == 0.0 && y == 0.0 && z == 0.0 ? 0.0 : atan2(sqrt(x*x+y*y),z); } - float region_particle::getPhi() const{ + double region_particle::getPhi() const{ _parts->setEntry(_pentry); - float x=_parts->getPx(); - float y=_parts->getPy(); + double x=_parts->getPx(); + double y=_parts->getPy(); return atan2(y,x); } - float region_particle::getCalcMass() { - float p=getP(); - float t=getTime()-_event->getStartTime(); - float d=getPath()/100; + double region_particle::getCalcMass() { + double p=getP(); + double t=getTime()-_event->getStartTime(); + double d=getPath()/100; if(t==0) return 0; if(p==0) return 0; - float mass= p/getBeta()/getGamma(); + double mass= p/getBeta()/getGamma(); return mass; } ////clashes with bank item @@ -91,23 +91,23 @@ namespace clas12 { // float beta= d/t/2.9979246e+08*1E9; // return beta; // } - float region_particle::getGamma() { - float beta=getBeta(); - float gamma= sqrt(1/(1-beta*beta)); + double region_particle::getGamma() { + double beta=getBeta(); + double gamma= sqrt(1/(1-beta*beta)); return gamma; } - float region_particle::getDeltaTime() { + double region_particle::getDeltaTime() { _parts->setEntry(_pentry); - float t=getTime()-_parts->getVt(); - float d=getPath()/100; + double t=getTime()-_parts->getVt(); + double d=getPath()/100; return t-d/getBetaFromP()/2.99792e+08*1E9; } - float region_particle::getBetaFromP() { - float pp=getP(); + double region_particle::getBetaFromP() { + double pp=getP(); auto mass=getPdgMass(); return pp/sqrt(pp*pp+mass*mass); } - float region_particle::getPdgMass() { + double region_particle::getPdgMass() { switch (getPid()) { diff --git a/Clas12Banks/region_particle.h b/Clas12Banks/region_particle.h index 1911f0c..d68315c 100644 --- a/Clas12Banks/region_particle.h +++ b/Clas12Banks/region_particle.h @@ -116,21 +116,24 @@ namespace clas12 { short getIndex()const {return _pentry;} short getRegion() const {return _region;} - float getTheta() const; - float getPhi() const; - float getP(){_parts->setEntry(_pentry);return _parts->getP();} - float getCalcMass(); - //float getBeta(); - float getGamma(); - float getDeltaTime(); - float getBetaFromP(); - float getPdgMass(); + double getTheta() const; + double getPhi() const; + double getP(){ + _parts->setEntry(_pentry); + if(_ftbparts==nullptr) return _parts->getP(); + return _useFTBPid*_ftbparts->getRows()?_parts->getFTBP():_parts->getP(); } + + double getCalcMass(); + double getGamma(); + double getDeltaTime(); + double getBetaFromP(); + double getPdgMass(); void useFTBPid(){if(_ftbparts)_useFTBPid=1;} - float getMCThetaDiff() {return getTheta()-mc()->getTheta();} - float getMCPhiDiff() {return getPhi()-mc()->getPhi();} - float getMCPDiff() {return getP()-mc()->getP();} + double getMCThetaDiff() {return getTheta()-mc()->getTheta();} + double getMCPhiDiff() {return getPhi()-mc()->getPhi();} + double getMCPDiff() {return getP()-mc()->getP();} //if(_parts->getCharge()) protected: From 064ce1504efccdc10865181cad458bee4d423834 Mon Sep 17 00:00:00 2001 From: dglazier Date: Fri, 17 Feb 2023 15:43:15 +0000 Subject: [PATCH 9/9] update region particle getters for new FTB info --- Clas12Banks/#calorimeter.h# | 230 -------------------------------- Clas12Banks/region_particle.cpp | 18 +-- Clas12Banks/region_particle.h | 23 +++- 3 files changed, 29 insertions(+), 242 deletions(-) delete mode 100644 Clas12Banks/#calorimeter.h# diff --git a/Clas12Banks/#calorimeter.h# b/Clas12Banks/#calorimeter.h# deleted file mode 100644 index 7a849b7..0000000 --- a/Clas12Banks/#calorimeter.h# +++ /dev/null @@ -1,230 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -/* - * File: detector.h - * Author: dglazier - * - * Created on April 27, 2017, 10:01 AM - */ - -#ifndef CLAS12_CALORIMETER_H -#define CLAS12_CALORIMETER_H - -#include "particle_detector.h" -#include "calextras.h" -#include - - -namespace clas12 { - - class calorimeter : public particle_detector { - - - public: - - - calorimeter()=default; - - calorimeter(hipo::schema __schema); - calorimeter(hipo::schema __schema,hipo::schema extras); - - ~calorimeter() override=default; - - int getLayer(int index) const noexcept override{ - if(index>-1)return getByte(_layer_order,index); - return 0; - } - //getter funtions for items in calorimeter bank - double getTime() const noexcept{ - if(_index>-1)return getFloat(_time_order,_index); - return 0; - } - double getEnergy() const noexcept{ - if(_index>-1)return getFloat(_energy_order,_index); - return 0; - } - double getPath() const noexcept{ - if(_index>-1)return getFloat(_path_order,_index); - return 0; - } - double getChi2() const noexcept{ - if(_index>-1)return getFloat(_chi2_order,_index); - return 0; - } - int getLayer() const noexcept override{ - if(_index>-1)return getByte(_layer_order,_index); - return 0; - } - int getSector() const noexcept{ - if(_index>-1)return getByte(_sector_order,_index); - return 0; - } - double getX() const noexcept{ - if(_index>-1)return getFloat(_x_order,_index); - return 0; - } - double getY() const noexcept{ - if(_index>-1)return getFloat(_y_order,_index); - return 0; - } - double getZ() const noexcept{ - if(_index>-1)return getFloat(_z_order,_index); - return 0; - } - double getDu() const noexcept{ - if(_index>-1)return getFloat(_du_order,_index); - return 0; - } - double getDv() const noexcept{ - if(_index>-1)return getFloat(_dv_order,_index); - return 0; - } - double getDw() const noexcept{ - if(_index>-1)return getFloat(_dw_order,_index); - return 0; - } - double getHx() const noexcept{ - if(_index>-1)return getFloat(_hx_order,_index); - return 0; - } - double getHy() const noexcept{ - if(_index>-1)return getFloat(_hy_order,_index); - return 0; - } - double getHz() const noexcept{ - if(_index>-1)return getFloat(_hz_order,_index); - return 0; - } - double getLu() const noexcept{ - if(_index>-1)return getFloat(_lu_order,_index); - return 0; - } - double getLv() const noexcept{ - if(_index>-1)return getFloat(_lv_order,_index); - return 0; - } - double getLw() const noexcept{ - if(_index>-1)return getFloat(_lw_order,_index); - return 0; - } - double getM2u() const noexcept{ - if(_index>-1)return getFloat(_m2u_order,_index); - return 0; - } - double getM2v() const noexcept{ - if(_index>-1)return getFloat(_m2v_order,_index); - return 0; - } - double getM2w() const noexcept{ - if(_index>-1)return getFloat(_m2w_order,_index); - return 0; - } - double getM3u() const noexcept{ - if(_index>-1)return getFloat(_m3u_order,_index); - return 0; - } - double getM3v() const noexcept{ - if(_index>-1)return getFloat(_m3v_order,_index); - return 0; - } - double getM3w() const noexcept{ - if(_index>-1)return getFloat(_m3w_order,_index); - return 0; - } - int getStatus() const noexcept{ - if(_index>-1)return getShort(_status_order,_index); - return 0; - } - - //get extras - - int getDbstU() const noexcept{ - return _extras.get()!=nullptr ? _extras->getDbstU(_index):0; - } - int getDbstV() const noexcept{ - return _extras.get()!=nullptr ? _extras->getDbstV(_index):0; - } - int getDbstW() const noexcept{ - return _extras.get()!=nullptr ? _extras->getDbstW(_index):0; - } - double getRawEU() const noexcept{ - return _extras.get()!=nullptr ? _extras->getRawEU(_index):0; - } - double getRawEV() const noexcept{ - return _extras.get()!=nullptr ? _extras->getRawEV(_index):0; - } - double getRawEW() const noexcept{ - return _extras.get()!=nullptr ? _extras->getRawEW(_index):0; - } - double getRecEU() const noexcept{ - return _extras.get()!=nullptr ? _extras->getRecEU(_index):0; - } - double getRecEV() const noexcept{ - return _extras.get()!=nullptr ? _extras->getRecEV(_index):0; - } - double getRecEW() const noexcept{ - return _extras.get()!=nullptr ? _extras->getRecEW(_index):0; - } - double getRecDTU() const noexcept{ - return _extras.get()!=nullptr ? _extras->getRecDTU(_index):0; - } - double getRecDTV() const noexcept{ - return _extras.get()!=nullptr ? _extras->getRecDTV(_index):0; - } - double getRecDTW() const noexcept{ - return _extras.get()!=nullptr ? _extras->getRecDTW(_index):0; - } - double getRecFTU() const noexcept{ - return _extras.get()!=nullptr ? _extras->getRecFTU(_index):0; - } - double getRecFTV() const noexcept{ - return _extras.get()!=nullptr ? _extras->getRecFTV(_index):0; - } - double getRecFTW() const noexcept{ - return _extras.get()!=nullptr ? _extras->getRecFTW(_index):0; - } - calextras* getExtras()const {return _extras.get();} - - - private: - - int _layer_order=-1; - int _energy_order=-1; - int _path_order=-1; - int _time_order=-1; - int _sector_order=-1; - int _x_order=-1; - int _y_order=-1; - int _z_order=-1; - int _chi2_order=-1; - int _du_order=-1; - int _dv_order=-1; - int _dw_order=-1; - int _hx_order=-1; - int _hy_order=-1; - int _hz_order=-1; - int _lu_order=-1; - int _lv_order=-1; - int _lw_order=-1; - int _m2u_order=-1; - int _m2v_order=-1; - int _m2w_order=-1; - int _m3u_order=-1; - int _m3v_order=-1; - int _m3w_order=-1; - int _status_order=-1; - - calextra_uptr _extras; - - }; //class calorimeter - - using cal_ptr=clas12::calorimeter*; - using cal_uptr=std::unique_ptr; - -}//namespace clas12 - -#endif /* UTILS_H */ diff --git a/Clas12Banks/region_particle.cpp b/Clas12Banks/region_particle.cpp index b9a3594..0557fea 100644 --- a/Clas12Banks/region_particle.cpp +++ b/Clas12Banks/region_particle.cpp @@ -57,23 +57,23 @@ namespace clas12 { } - double region_particle::getTheta() const{ + double region_particle::getTheta() { _parts->setEntry(_pentry); - double x=_parts->getPx(); - double y=_parts->getPy(); - double z=_parts->getPz(); + double x=getPx(); + double y=getPy(); + double z=getPz(); return x == 0.0 && y == 0.0 && z == 0.0 ? 0.0 : atan2(sqrt(x*x+y*y),z); } - double region_particle::getPhi() const{ + double region_particle::getPhi() { _parts->setEntry(_pentry); - double x=_parts->getPx(); - double y=_parts->getPy(); + double x=getPx(); + double y=getPy(); return atan2(y,x); } double region_particle::getCalcMass() { double p=getP(); - double t=getTime()-_event->getStartTime(); + double t=getTime()-getStartTime(); double d=getPath()/100; if(t==0) return 0; @@ -98,7 +98,7 @@ namespace clas12 { } double region_particle::getDeltaTime() { _parts->setEntry(_pentry); - double t=getTime()-_parts->getVt(); + double t=getTime()-getVt(); double d=getPath()/100; return t-d/getBetaFromP()/2.99792e+08*1E9; } diff --git a/Clas12Banks/region_particle.h b/Clas12Banks/region_particle.h index d68315c..02909e3 100644 --- a/Clas12Banks/region_particle.h +++ b/Clas12Banks/region_particle.h @@ -74,7 +74,9 @@ namespace clas12 { float getVt(){ _parts->setEntry(_pentry); if(_ftbparts==nullptr) return _parts->getVt(); - return _useFTBPid*_ftbparts->getRows()?_ftbparts->getVt():_parts->getVt(); + auto vt = _useFTBPid*_ftbparts->getRows()?_ftbparts->getVt():_parts->getVt(); + if(vt==-1)return getStartTime(); + else return vt; } int getStatus(){ _parts->setEntry(_pentry); @@ -116,12 +118,27 @@ namespace clas12 { short getIndex()const {return _pentry;} short getRegion() const {return _region;} - double getTheta() const; - double getPhi() const; + double getTheta() ; + double getPhi() ; double getP(){ _parts->setEntry(_pentry); if(_ftbparts==nullptr) return _parts->getP(); return _useFTBPid*_ftbparts->getRows()?_parts->getFTBP():_parts->getP(); } + double getPx(){ + _parts->setEntry(_pentry); + if(_ftbparts==nullptr) return _parts->getPx(); + return _useFTBPid*_ftbparts->getRows()?_parts->getFTBPx():_parts->getPx(); } + double getPy(){ + _parts->setEntry(_pentry); + if(_ftbparts==nullptr) return _parts->getPy(); + return _useFTBPid*_ftbparts->getRows()?_parts->getFTBPy():_parts->getPy(); } + double getPz(){ + _parts->setEntry(_pentry); + if(_ftbparts==nullptr) return _parts->getPz(); + return _useFTBPid*_ftbparts->getRows()?_parts->getFTBPz():_parts->getPz(); } + double getStartTime(){ + if(_ftbparts==nullptr) return _event->getStartTime(); + return _useFTBPid*_event->getFTBStartTime()?_event->getFTBStartTime():_event->getStartTime(); } double getCalcMass(); double getGamma();