Skip to content

Commit

Permalink
Merge pull request #52 from dglazier/pass2
Browse files Browse the repository at this point in the history
Pass2
  • Loading branch information
dglazier authored Feb 20, 2023
2 parents 86d9692 + 064ce15 commit e472564
Show file tree
Hide file tree
Showing 17 changed files with 456 additions and 77 deletions.
4 changes: 2 additions & 2 deletions Clas12Banks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
34 changes: 34 additions & 0 deletions Clas12Banks/calextras.cpp
Original file line number Diff line number Diff line change
@@ -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");

}


}
192 changes: 192 additions & 0 deletions Clas12Banks/calextras.h
Original file line number Diff line number Diff line change
@@ -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 <memory>


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<clas12::calextras>;

}//namespace clas12

#endif /* UTILS_H */
34 changes: 34 additions & 0 deletions Clas12Banks/calorimeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()<<std::endl;
auto sch=getSchema();

if(useItem("layer"))_layer_order = sch.getEntryOrder("layer");
if(useItem("energy"))_energy_order = sch.getEntryOrder("energy");
if(useItem("path"))_path_order = sch.getEntryOrder("path");
if(useItem("time"))_time_order = sch.getEntryOrder("time");
if(useItem("x"))_x_order = sch.getEntryOrder("x");
if(useItem("y"))_y_order = sch.getEntryOrder("y");
if(useItem("z"))_z_order = sch.getEntryOrder("z");
if(useItem("status"))_status_order = sch.getEntryOrder("status");
if(useItem("sector"))_sector_order = sch.getEntryOrder("sector");
if(useItem("chi2"))_chi2_order = sch.getEntryOrder("chi2");
if(useItem("du"))_du_order = sch.getEntryOrder("du");
if(useItem("dv"))_dv_order = sch.getEntryOrder("dv");
if(useItem("dw"))_dw_order = sch.getEntryOrder("dw");
if(useItem("hx"))_hx_order = sch.getEntryOrder("hx");
if(useItem("hy"))_hy_order = sch.getEntryOrder("hy");
if(useItem("hz"))_hz_order = sch.getEntryOrder("hz");
if(useItem("lu"))_lu_order = sch.getEntryOrder("lu");
if(useItem("lv"))_lv_order = sch.getEntryOrder("lv");
if(useItem("lw"))_lw_order = sch.getEntryOrder("lw");
if(useItem("m2u"))_m2u_order = sch.getEntryOrder("m2u");
if(useItem("m2v"))_m2v_order = sch.getEntryOrder("m2v");
if(useItem("m2w"))_m2w_order = sch.getEntryOrder("m2w");
if(useItem("m3u"))_m3u_order = sch.getEntryOrder("m3u");
if(useItem("m3v"))_m3v_order = sch.getEntryOrder("m3v");
if(useItem("m3w"))_m3w_order = sch.getEntryOrder("m3w");
}

calorimeter::calorimeter(hipo::schema __schema): clas12::particle_detector(__schema) {

auto sch=getSchema();
Expand Down
68 changes: 62 additions & 6 deletions Clas12Banks/calorimeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define CLAS12_CALORIMETER_H

#include "particle_detector.h"
#include "calextras.h"
#include <memory>


Expand All @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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:

Expand Down Expand Up @@ -163,7 +218,8 @@ namespace clas12 {
int _m3w_order=-1;
int _status_order=-1;


calextra_uptr _extras;

}; //class calorimeter

using cal_ptr=clas12::calorimeter*;
Expand Down
Loading

0 comments on commit e472564

Please sign in to comment.