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,14 +27,15 @@ 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{ - 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 +50,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); @@ -133,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: @@ -163,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/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; } 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/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{ 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 diff --git a/Clas12Banks/region_particle.cpp b/Clas12Banks/region_particle.cpp index d86e62d..0557fea 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() { _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=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); } - float region_particle::getPhi() const{ + double region_particle::getPhi() { _parts->setEntry(_pentry); - float x=_parts->getPx(); - float y=_parts->getPy(); + double x=getPx(); + double y=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()-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()-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..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,21 +118,39 @@ 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() ; + 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(); + 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: diff --git a/Clas12Banks/traj.cpp b/Clas12Banks/traj.cpp index 2e29f75..e73bc31 100644 --- a/Clas12Banks/traj.cpp +++ b/Clas12Banks/traj.cpp @@ -20,6 +20,7 @@ namespace clas12 { _y_order = __schema.getEntryOrder("y"); _z_order = __schema.getEntryOrder("z"); _layer_order = __schema.getEntryOrder("layer"); + _edge_order = __schema.getEntryOrder("edge"); } diff --git a/Clas12Banks/traj.h b/Clas12Banks/traj.h index b4a4c4f..d96baaf 100644 --- a/Clas12Banks/traj.h +++ b/Clas12Banks/traj.h @@ -64,22 +64,15 @@ namespace clas12 { if(_index>-1)return getFloat(_z_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: @@ -87,12 +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 _edge_order=-1; 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}; };