Skip to content

Commit

Permalink
Get Fano factor from Garfield
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajmz committed Apr 30, 2024
1 parent df38ee6 commit 07838cc
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions inc/TRestDetectorGas.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ class TRestDetectorGas : public TRestDetectorDriftVolume {
return fGasComponentFraction[n];
}

/// Returns the gas fano factor
Double_t GetGasFanoFactor();

/// Return pointer to Garfield::MediumGas for gas properties
inline MediumMagboltz* GetGasMedium() const { return fGasMedium; };

Expand Down
35 changes: 35 additions & 0 deletions src/TRestDetectorGas.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,41 @@ void TRestDetectorGas::GetGasWorkFunction() {
#endif
}

//Get the fano factor from Garfield::MediumMagboltz
//User need to have installed the last version of
//Garfield to this to work

Double_t TRestDetectorGas::GetGasFanoFactor(){
#if defined USE_Garfield
if(fStatus != RESTGAS_GASFILE_LOADED){
RESTDebug << "-- Error : " << __PRETTY_FUNCTION__ << RESTendl;
RESTDebug << "-- Error : Gas file was not loaded!" << RESTendl;
return 0;
}

RESTInfo << "Calling Garfield directly." << RESTendl;
Double_t F;
F = fGasMedium->GetFanoFactor();

if (F == 0.){
std::cout << "Fano Factor is 0! This REST is not compiled with the last "
"version of Garfield"
<< std::endl;
std::cout << "To use Garfield Fano factors, please compile REST "
" with the latest Garfield version!"
<< std::endl;
}
return F;
#else
std::cout << "This REST is not compiled with garfield, Do not use Fano "
"Factor from TRestDetectorGas!"
<< std::endl;
std::cout << "Please define the Fano factor in each process!" << std::endl;
return 0;
#endif

}

/////////////////////////////////////////////
/// \brief Loads the gas parameters that define the gas calculation
/// and properties.
Expand Down

0 comments on commit 07838cc

Please sign in to comment.