Skip to content

Commit

Permalink
Merge pull request #53 from dglazier/master
Browse files Browse the repository at this point in the history
Pass 2
  • Loading branch information
dglazier committed Mar 7, 2023
2 parents e472564 + 0b6b708 commit fdc263f
Show file tree
Hide file tree
Showing 34 changed files with 1,050 additions and 225 deletions.
5 changes: 2 additions & 3 deletions Clas12Banks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@


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 utracker.cpp traj.cpp forwardtagger.cpp cherenkov.cpp rich.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_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 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)
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 utracker.h traj.h forwardtagger.h cherenkov.h rich.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
4 changes: 4 additions & 0 deletions Clas12Banks/Clas12LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@
#pragma link C++ class clas12::vertdoca+;
#pragma link C++ class clas12::particle_detector+;
#pragma link C++ class clas12::scintillator+;
#pragma link C++ class clas12::utracker+;
#pragma link C++ class clas12::tracker+;
#pragma link C++ class clas12::traj+;
#pragma link C++ class clas12::forwardtagger+;
#pragma link C++ class clas12::cherenkov+;
#pragma link C++ class clas12::rich+;
#pragma link C++ class clas12::richring+;
#pragma link C++ class clas12::calorimeter+;
#pragma link C++ class clas12::covmatrix+;
#pragma link C++ class clas12::region_particle+;
#pragma link C++ class clas12::region_ft+;
#pragma link C++ class clas12::region_fdet+;
#pragma link C++ class clas12::region_cdet+;
#pragma link C++ class clas12::region_band+;
#pragma link C++ class clas12::clas12writer+;
#pragma link C++ class clas12::clas12reader+;
#pragma link C++ class clas12::rcdb_reader+;
Expand Down
1 change: 0 additions & 1 deletion Clas12Banks/calorimeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace clas12 {
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");
Expand Down
13 changes: 13 additions & 0 deletions Clas12Banks/ccdb_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace clas12 {

setRun(runNb);


#ifdef CLAS_CCDB

ccdb::CalibrationGenerator gen;
Expand Down Expand Up @@ -112,6 +113,11 @@ namespace clas12 {
tableEntry.second.clear(); //empty the vector (required for GetCalib)
_calib->GetCalib(tableEntry.second, nameWithRun(tableEntry.first) );
}
//Hack as the collaboration did not want to store
//the photon energy for FD in the case the neutral was
//PIDed as a photon
getSamplingFactionPars();

#endif


Expand All @@ -124,4 +130,11 @@ namespace clas12 {
return temp;
}

void ccdb_reader::getSamplingFactionPars(){
auto& ccdbPhSF = requestTableDoubles("/calibration/eb/photon_sf");
_sfPa=ccdbPhSF[0][3]; //0.250
_sfPb=ccdbPhSF[0][4]; //1.029
_sfPc=ccdbPhSF[0][5]; //-0.015
_sfPd=ccdbPhSF[0][6]; // 0.00012
}
}
19 changes: 18 additions & 1 deletion Clas12Banks/ccdb_reader.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef CCDB_READER_H
#define CCDB_READER_H

#include "region_particle.h"
#ifdef CLAS_CCDB
#include "CCDB/CalibrationGenerator.h"
#include "CCDB/Calibration.h"
Expand Down Expand Up @@ -29,7 +30,17 @@ namespace clas12 {
void setRun(int nb){_runNb=nb; _srunNb=std::to_string(nb);}
std::string nameWithRun(const std::string& tableName);


void getSamplingFactionPars();

double getFDPhotonEnergy(region_particle* p){
if(p->getRegion()!=FD) return 0.;
auto edep = p->getDetEnergy();
return edep/getMeanSF(edep);
}
double getMeanSF(float Edep){
return _sfPa*(_sfPb+(_sfPc/Edep)+(_sfPd/(Edep*Edep)));
}

private:

ccdb_reader()=default;
Expand All @@ -54,6 +65,12 @@ namespace clas12 {

std::vector< TableRecord_t > _localTable;

// Photon Sampling Fraction Parameters
double _sfPa={0};
double _sfPb={0};
double _sfPc={0};
double _sfPd={0};

#ifdef CLAS_CCDB

std::unique_ptr<ccdb::Calibration> _calib ={nullptr};
Expand Down
Loading

0 comments on commit fdc263f

Please sign in to comment.