Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion src/libraries/ECAL/DECALShower_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ void DECALShower_factory::Init()

ENABLE_ENERGY_CORRECTION=true;
app->SetDefaultParameter("ECAL:ENABLE_ENERGY_CORRECTION",ENABLE_ENERGY_CORRECTION);

ENERGY_CORRECTION_TYPE = 1;
app->SetDefaultParameter("ECAL:ENERGY_CORRECTION_TYPE",ENERGY_CORRECTION_TYPE);

}

//------------------
Expand Down Expand Up @@ -72,6 +76,12 @@ void DECALShower_factory::BeginRun(const std::shared_ptr<const JEvent>& event)
E_CORRECTION_PAR1=ecal_E_correction_parms["p1"];
E_CORRECTION_PAR2=ecal_E_correction_parms["p2"];
E_CORRECTION_PAR3=ecal_E_correction_parms["p3"];

jcalib->Get("ECAL/E_correction_parms1",ecal_E_correction_parms);
E_CORRECTION1_PAR1=ecal_E_correction_parms["p1"];
E_CORRECTION1_PAR2=ecal_E_correction_parms["p2"];
E_CORRECTION1_PAR3=ecal_E_correction_parms["p3"];

}

//------------------
Expand All @@ -87,9 +97,14 @@ void DECALShower_factory::Process(const std::shared_ptr<const JEvent>& event)
const DECALCluster *cluster=clusters[i];

double E=cluster->E;

if (ENABLE_ENERGY_CORRECTION){
E=GetCorrectedEnergy(cluster->E);
if(ENERGY_CORRECTION_TYPE == 1)
E=GetCorrectedEnergy(cluster->E);
else if(ENERGY_CORRECTION_TYPE == 2)
E=GetCorrectedEnergy1(cluster->E);
}

if (E>SHOWER_ENERGY_THRESHOLD){
DECALShower *shower=new DECALShower;
shower->nBlocks=cluster->nBlocks;
Expand Down Expand Up @@ -165,6 +180,15 @@ double DECALShower_factory::GetCorrectedEnergy(double Ecluster) const {
+E_CORRECTION_PAR3/Ecluster;
}

// New energy-correction parameterization using the MC shape
// for a 6-count flash-ADC amplitude threshold. (AS, 9/24/26)
double DECALShower_factory::GetCorrectedEnergy1(double Ecluster) const {
return E_CORRECTION1_PAR1*Ecluster + E_CORRECTION1_PAR2*sqrt(Ecluster) +
E_CORRECTION1_PAR3/Ecluster;

}


// Correct the z-position of the shower to account for the shower depth
double DECALShower_factory::GetCorrectedZ(double E) const {
// Crystal material properties
Expand Down
4 changes: 4 additions & 0 deletions src/libraries/ECAL/DECALShower_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class DECALShower_factory:public JFactoryT<DECALShower>{
void Finish() override; ///< Called after last event of last event source has been processed.

double GetCorrectedEnergy(double E) const;
double GetCorrectedEnergy1(double E) const;

double GetCorrectedZ(double E) const;
void GetUV(const DECALCluster *cluster,const DVector3 &showerPos,
const DVector3 &trackPos,double &sumU,double &sumV) const;
Expand All @@ -35,8 +37,10 @@ class DECALShower_factory:public JFactoryT<DECALShower>{
double SHOWER_ENERGY_THRESHOLD,ECAL_C_EFFECTIVE;
double E_VAR1,E_VAR2,E_VAR3,POS_RES1,POS_RES2;
double E_CORRECTION_PAR1,E_CORRECTION_PAR2,E_CORRECTION_PAR3;
double E_CORRECTION1_PAR1,E_CORRECTION1_PAR2,E_CORRECTION1_PAR3,E_CORRECTION1_PAR4;
double E_CORRECTION_PAR4;
bool ENABLE_ENERGY_CORRECTION;
int ENERGY_CORRECTION_TYPE;

const DECALGeometry *dECALGeom=NULL;
double mVertexZ; // assume center of target, so it does not vary event by event
Expand Down
Loading