ATLAS Offline Software
Loading...
Searching...
No Matches
LArWFParamTool Class Reference

#include <LArWFParamTool.h>

Inheritance diagram for LArWFParamTool:
Collaboration diagram for LArWFParamTool:

Classes

struct  omegaScanParams_t
struct  waveRange_t
struct  WaveTiming_t

Public Types

enum  { FailExtract = -999 , DoExtract , DefaultNotSet = 0 }
enum  {
  OK = 0 , TooShort = 1 , NotFilled = 2 , LowStat = 3 ,
  Noisy = 4 , Oscillating = 5
}

Public Member Functions

 LArWFParamTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~LArWFParamTool ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
StatusCode getLArWaveParams (const LArCaliWave &larCaliWave, const HWIdentifier chid, const CaloGain::CaloGain gain, LArWFParams &wfParams, const LArOnOffIdMapping *cabling, std::optional< LArCaliWave > &omegaScan, std::optional< LArCaliWave > &resOscill0, std::optional< LArCaliWave > &resOscill1) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

WaveTiming_t timeExtr (LArWave &gCali) const
double expTail (const LArWave &gCali, const WaveTiming_t &wt) const
StatusCode GetFstep (const LArWave &gCali, LArWFParams &wfParams, const WaveTiming_t &wt) const
double fstepMin (const LArWave &gCali, double fstep, const double Tc, const unsigned Ttail) const
double dFstep (const LArWave &gCali, const double fstep, const double Tc, const unsigned Ttail) const
LArWave dstepRespDfstep (const LArWave &gCali, const double &fstep, const double &Tc) const
StatusCode RTM_Omega0 (const LArWave &gCali, const HWIdentifier chid, LArWFParams &wfParams, const WaveTiming_t &wt, const LArOnOffIdMapping *cabling, std::optional< LArCaliWave > &omegaScan) const
StatusCode RTM_Taur (const LArWave &gCali, LArWFParams &wfParams, const WaveTiming_t &wt) const
double logChi2CosRespShaper (const double omega, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &range) const
double logChi2InjRespRes (const double taur, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &range) const
LArWave cosRespShaper (const LArWave &gCali, const double &fstep, const double &tcal, const double &w, const double &tsh) const
double omega0MinNum (double omegaMin, double omegaMax, const double tol, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &) const
double taurMinNum (const double taurmin, const double taurmax, const double tol, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &) const
double fminbr (double a, double b, const double tol, double(LArWFParamTool::*f)(double, const LArWave &, const LArWFParams &, const waveRange_t &) const, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &range) const
unsigned checkStatus (const LArCaliWave &larCaliWave) const
omegaScanParams_t OmegaScanHelper (const Identifier id, const WaveTiming_t &wt) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Static Private Member Functions

static LArWave stepResp (const LArWave &gCali, const double fstep, const double Tc)
static LArWave stepCorr (const LArWave &gCali, const double &fstep, const double &Tc)
static double dstepCorrDfstep (const double t, const double &fstep, const double &Tc)
static LArWave dstepCorrDfstep (const LArWave &gCali, const double &fstep, const double &Tcal)
static LArWave cosResp (const LArWave &gCali, const double &fstep, const double &tcal, const double &omega)
static LArWave injRespRes (const LArWave &w, const double omega0, const double taur)
static LArWave injCorr (const unsigned N, const double dt, const double omega0, const double taur)
static LArWave cosCorr (const unsigned N, const double dt, const double fstep, const double tcal, const double omega)

Private Attributes

const LArEM_Base_IDm_emId = nullptr
const LArOnlineID_Basem_onlineHelper = nullptr
LArWaveHelper m_wHelper
double m_Tshaper
std::vector< bool > m_cosRespScan
std::vector< double > m_omegamin
std::vector< double > m_omegamax
std::vector< unsigned > m_npoints
std::vector< bool > m_storeResOscill
unsigned int m_NBaseline
bool m_ShiftToStart
bool m_SubtractBaseline
bool m_UseOmegaScanHelper
bool m_isSC
std::vector< int > m_TtailMin
std::vector< int > m_TtailMax
std::vector< int > m_DeltaTtail
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Static Private Attributes

static const double m_DEFAULT = -1
static const double m_TINY =2.22045e-16
static const double m_SQRT_EPSILON =1.49012e-08
static const double m_EPSILON =2.22045e-16

Detailed Description

Definition at line 28 of file LArWFParamTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
FailExtract 
DoExtract 
DefaultNotSet 

Definition at line 33 of file LArWFParamTool.h.

33 {
34 FailExtract = -999 ,
35 DoExtract ,
37 } ;

◆ anonymous enum

anonymous enum
Enumerator
OK 
TooShort 
NotFilled 
LowStat 
Noisy 
Oscillating 

Definition at line 68 of file LArWFParamTool.h.

Constructor & Destructor Documentation

◆ LArWFParamTool()

LArWFParamTool::LArWFParamTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 36 of file LArWFParamTool.cxx.

37 : AthAlgTool(type,name,parent),
38 m_NBaseline(0),
39 m_ShiftToStart(false),
40 m_SubtractBaseline(false),
42{
43
44 // Declare additional interface
45 declareInterface<LArWFParamTool>(this);
46
47 declareProperty("NBaseline", m_NBaseline);
48 declareProperty("ShiftToStart", m_ShiftToStart);
49 declareProperty("SubtractBaseline", m_SubtractBaseline);
50 declareProperty("isSC", m_isSC = false);
51
52 m_DeltaTtail.resize(3);
53 int default_deltattail[3] = { 100, 50, 0 } ;
54 for ( unsigned i=0; i<3; ++i )
55 m_DeltaTtail[i] = default_deltattail[i] ;
56 declareProperty("DeltaTtail", m_DeltaTtail);
57
58 m_TtailMin.resize(4);
59 m_TtailMax.resize(4);
60 int default_ttailmin[4] = { 0, 0, 0, 0 };
61 int default_ttailmax[4] = { 0, 0, 0, 0 };
62 for ( unsigned i=0; i<4; ++i ) {
63 m_TtailMin[i] = default_ttailmin[i];
64 m_TtailMax[i] = default_ttailmax[i];
65 }
66 declareProperty("TtailMin", m_TtailMin);
67 declareProperty("TtailMax", m_TtailMax);
68
69 // flags to force cos resp scan:
70 m_cosRespScan.resize(4) ;
71 bool defaults[4] = { false , true , false , true } ;
72 for ( unsigned i=0 ; i<4 ; ++i )
73 m_cosRespScan[i] = defaults[i] ;
74 declareProperty("CosRespScan", m_cosRespScan ) ;
75
76
77 // omega0 intervals and granularities:
78 //float default_omegamin[4] = { 0.01 , 0.47 , 0.10 , 0.30 } ;
79 //float default_omegamax[4] = { 1.00 , 0.48 , 0.30 , 0.60 } ;
80 //unsigned default_npoints[4] = { 100 , 50 , 100 , 100 } ;
81 float default_omegamin[4] = { 0.01 , 0.10 , 0.10 , 0.10 };
82 float default_omegamax[4] = { 1.00 , 0.33 , 0.20 , 0.33 };
83 unsigned default_npoints[4] = { 100 , 100 , 100 , 100 };
84 m_omegamin.resize(4) ;
85 m_omegamax.resize(4) ;
86 m_npoints.resize(4) ;
87 for ( unsigned i=0 ; i<4 ; ++i ) {
88 m_omegamin[i] = default_omegamin[i] ;
89 m_omegamax[i] = default_omegamax[i] ;
90 m_npoints[i] = default_npoints[i] ;
91 }
92 declareProperty("Omega0Min", m_omegamin);
93 declareProperty("Omega0Max", m_omegamax);
94 declareProperty("NpointScan", m_npoints );
95 declareProperty("UseOmegaScanHelper", m_UseOmegaScanHelper );
96
97 // flags to save residual oscillation
98 m_storeResOscill.resize(4,false) ;
99 declareProperty("StoreResOscill", m_storeResOscill) ;
100
101 declareProperty("TShaper", m_Tshaper=15.) ;
102}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::vector< bool > m_cosRespScan
std::vector< double > m_omegamin
std::vector< int > m_TtailMax
unsigned int m_NBaseline
std::vector< bool > m_storeResOscill
std::vector< int > m_TtailMin
std::vector< unsigned > m_npoints
std::vector< double > m_omegamax
std::vector< int > m_DeltaTtail

◆ ~LArWFParamTool()

LArWFParamTool::~LArWFParamTool ( )
virtualdefault

Member Function Documentation

◆ checkStatus()

unsigned LArWFParamTool::checkStatus ( const LArCaliWave & larCaliWave) const
private

Definition at line 976 of file LArWFParamTool.cxx.

977{
978 // this is supposed to be a quick test on cali waves, to flags those
979 // clearly problematic. but cuts must be tuned, so for the time being
980 // don't call this method!
981
982 //MsgStream log(msgSvc(), name());
983
984 unsigned length ;
985 if ( (length=larCaliWave.getSize()) < 750 ) {
986 ATH_MSG_WARNING( "Calibration wave is too short!" ) ;
987 return TooShort ;
988 }
989
990 const unsigned range = 2 ;
991 unsigned nMax = 0 ;
992 double tremble = 0 ;
993 double maxSample = -9.E+10 ;
994 for ( unsigned i=0 ; i<length ; i++ ) {
995 if ( larCaliWave.getError(i) < 0 || larCaliWave.getTrigger(i) < 0 ) {
996 ATH_MSG_WARNING( "Calibration wave probably not completely filled" ) ;
997 return NotFilled ;
998 }
999 if ( larCaliWave.getTrigger(i) < 50 ) {
1000 ATH_MSG_WARNING( "Calibration wave with low statistics" ) ;
1001 return LowStat ;
1002 }
1003 double thisSample = larCaliWave.getTrigger(i) ;
1004 if ( thisSample > maxSample ) maxSample = thisSample ;
1005 if ( i>=range && i<length-range ) {
1006 bool max = true ;
1007 double loc_tremble = 0 ;
1008 for ( unsigned k=i-range ; k<=i+range ; k++ ) {
1009 double delta = thisSample - larCaliWave.getSample(k) ;
1010 loc_tremble += delta*delta;// pow(delta,2) ;
1011 if ( delta < 0 ) max = false ;
1012 }
1013 if ( max ) nMax ++ ;
1014 tremble += loc_tremble / (2*range) ;
1015 }
1016 }
1017 if ( sqrt(tremble/length)/maxSample > 0.1 ) {
1018 ATH_MSG_WARNING( "Calibration wave is noisy " << sqrt(tremble/length)/maxSample ) ;
1019 return Noisy ;
1020 }
1021 if ( nMax > 1 ) {
1022 ATH_MSG_WARNING( "Calibration wave oscillates" ) ;
1023 return Oscillating ;
1024 }
1025
1026 return OK ;
1027}
#define ATH_MSG_WARNING(x)
double length(const pvec &v)
#define max(a, b)
Definition cfImp.cxx:41
double getError(unsigned i) const
error per time bin
int getTrigger(unsigned i) const
trigger per time bin
size_t getSize() const
number of time samples
Definition LArWave.h:62
const double & getSample(const unsigned int i) const
Amplitude per time bin.
Definition LArWave.h:53

◆ cosCorr()

LArWave LArWFParamTool::cosCorr ( const unsigned N,
const double dt,
const double fstep,
const double tcal,
const double omega )
staticprivate

Definition at line 734 of file LArWFParamTool.cxx.

734 {
735 LArWave w(N,dt);
736 const double C1=(fstep*fstep-fstep*fstep*fstep)/Tc;
737 const double C2=(fstep+omega*omega*Tc*Tc);
738 const double C3=(fstep-1.)*omega*Tc;
739 const double C4=( fstep*fstep+omega*omega*Tc*Tc );
740 for ( unsigned i=0 ; i<N ; i++ ) {
741 const double t=i*dt;
742 //const double p=((fstep*fstep-fstep*fstep*fstep)/Tc*exp(-fstep*t/Tc) - omega*((fstep+omega*omega*Tc*Tc)*sin(omega*t)+(fstep-1.)*omega*Tc*cos(omega*t)) ) / ( fstep*fstep+omega*omega*Tc*Tc ) ;
743 const double p=(C1*exp(-fstep*t/Tc) - omega*(C2*sin(omega*t) + C3*cos(omega*t))) / C4 ;
744 w.setSample(i,p);
745 }
746 return w ;
747}
static Double_t Tc(Double_t t)

◆ cosResp()

LArWave LArWFParamTool::cosResp ( const LArWave & gCali,
const double & fstep,
const double & tcal,
const double & omega )
staticprivate

Definition at line 724 of file LArWFParamTool.cxx.

724 {
725
726 LArWave result=gCali % cosCorr(gCali.getSize(),gCali.getDt(),fstep, tcal, omega);
727 result+=gCali;
728 return result;
729}
static LArWave cosCorr(const unsigned N, const double dt, const double fstep, const double tcal, const double omega)
const double & getDt() const
delta time
Definition LArWave.h:50

◆ cosRespShaper()

LArWave LArWFParamTool::cosRespShaper ( const LArWave & gCali,
const double & fstep,
const double & tcal,
const double & w,
const double & tsh ) const
private

Definition at line 717 of file LArWFParamTool.cxx.

717 {
718 return cosResp(gCali,fstep,tcal, w) * ( pow((1.+ w*w*tsh*tsh),1.5)/(w*tsh));
719}
constexpr int pow(int base, int exp) noexcept
static LArWave cosResp(const LArWave &gCali, const double &fstep, const double &tcal, const double &omega)

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ dFstep()

double LArWFParamTool::dFstep ( const LArWave & gCali,
const double fstep,
const double Tc,
const unsigned Ttail ) const
private

Definition at line 372 of file LArWFParamTool.cxx.

372 {
373 LArWave stepResp1 = stepResp(gCali, fstep, Tc) ;
374 LArWave dstepRespDfstep1 = dstepRespDfstep(gCali,fstep,Tc) ;
375 //LArWaveHelper wHelper;
376 double a,b;
377 if ( m_TtailMin[1]!=0 && m_TtailMax[1]!=0 && m_TtailMin[1]<m_TtailMax[1] ) {
378 b = m_wHelper.getSumRegion( stepResp1 * dstepRespDfstep1,m_TtailMin[1],m_TtailMax[1]);
379 a = m_wHelper.getSumSquareRegion( dstepRespDfstep1,m_TtailMin[1],m_TtailMax[1]);
380 } else {
381 b = m_wHelper.getSumTail( stepResp1 * dstepRespDfstep1,Ttail);
382 a = m_wHelper.getSumSquareTail( dstepRespDfstep1,Ttail);
383 }
384 if (a == 0) return 0;
385 return -b/a ;
386}
static Double_t a
LArWaveHelper m_wHelper
static LArWave stepResp(const LArWave &gCali, const double fstep, const double Tc)
LArWave dstepRespDfstep(const LArWave &gCali, const double &fstep, const double &Tc) const

◆ dstepCorrDfstep() [1/2]

double LArWFParamTool::dstepCorrDfstep ( const double t,
const double & fstep,
const double & Tc )
staticprivate

Definition at line 411 of file LArWFParamTool.cxx.

411 {
412 return (-1./Tc)*(1.+((1.-fstep)/Tc)*t)*exp(-fstep*t/Tc);
413}

◆ dstepCorrDfstep() [2/2]

LArWave LArWFParamTool::dstepCorrDfstep ( const LArWave & gCali,
const double & fstep,
const double & Tcal )
staticprivate

Definition at line 415 of file LArWFParamTool.cxx.

415 {
416 const unsigned N = gCali.getSize() ;
417 const double dt = gCali.getDt() ;
418 LArWave w(N,dt);
419 for ( unsigned i=0 ; i<N ; i++ ) w.setSample(i,dstepCorrDfstep(i*dt,fstep,Tcal)) ;
420 return w ;
421}
static double dstepCorrDfstep(const double t, const double &fstep, const double &Tc)

◆ dstepRespDfstep()

LArWave LArWFParamTool::dstepRespDfstep ( const LArWave & gCali,
const double & fstep,
const double & Tc ) const
private

Definition at line 407 of file LArWFParamTool.cxx.

407 {
408 return gCali % dstepCorrDfstep(gCali,fstep,Tc);
409}

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ expTail()

double LArWFParamTool::expTail ( const LArWave & gCali,
const WaveTiming_t & wt ) const
private

Definition at line 311 of file LArWFParamTool.cxx.

312{
313 unsigned int t1;
314 unsigned int t2;
315 if ( m_TtailMin[0]!=0 && m_TtailMax[0]!=0 && m_TtailMin[0]<m_TtailMax[0] ) {
316 t1 = m_TtailMin[0];
317 t2 = m_TtailMax[0];
318 } else {
319 const unsigned nAfterMin = 150;
320 const unsigned nBeforeEnd = 125;
321 t1 = wt.Tmin + nAfterMin;
322 t2 = gCali.getSize() - nBeforeEnd ; // last points rejected because sometimes are crazy!
323 }
324 ATH_MSG_VERBOSE( "exp-fitting between " << t1 << " and " << t2 ) ;
325
326 double A, rho ;
327 std::vector<double> fitPars = m_wHelper.expfit(gCali,t1,t2,rho) ; // fit to B*exp(A*t) function
328 if (fitPars.size() == 2 ) {
329 A = fitPars[1];
330 //B = fitPars[0];
331 } else {
332 return -1;
333 }
334
335 const double Tcal = -1./A ;
336 if ( Tcal < 0 ) {
337 ATH_MSG_WARNING( "Exponential fit yielded negative Tcal " << Tcal );
338 }
339 ATH_MSG_VERBOSE( "*** Exponential fit\t--> m_Tcal = " << Tcal ) ;
340
341 return Tcal;
342}
#define ATH_MSG_VERBOSE(x)
std::vector< ALFA_RawDataContainer_p1 > t2
std::vector< ALFA_RawDataCollection_p1 > t1

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

virtual StatusCode LArWFParamTool::finalize ( )
inlinevirtual

Definition at line 49 of file LArWFParamTool.h.

49{return StatusCode::SUCCESS;}

◆ fminbr()

double LArWFParamTool::fminbr ( double a,
double b,
const double tol,
double(LArWFParamTool::* )(double, const LArWave &, const LArWFParams &, const waveRange_t &) const,
const LArWave & gCali,
const LArWFParams & wf,
const waveRange_t & range ) const
private

Definition at line 865 of file LArWFParamTool.cxx.

873{
874 double x,v,w; /* Abscissae, descr. see above */
875 double fx; /* f(x) */
876 double fv; /* f(v) */
877 double fw; /* f(w) */
878 const double r = (3.-sqrt(5.0))/2; /* Gold section ratio */
879
880 assert( tol > 0 && b > a );
881
882 v = a + r*(b-a); fv = (this->*f)(v,gCali,wf,waverange); /* First step - always gold section*/
883 x = v; w = v;
884 fx=fv; fw=fv;
885
886 for(;;) /* Main iteration loop */
887 {
888 double range = b-a; /* Range over which the minimum */
889 /* is seeked for */
890 double middle_range = (a+b)/2;
891 double tol_act = /* Actual tolerance */
892 m_SQRT_EPSILON*fabs(x) + tol/3;
893 double new_step; /* Step at this iteration */
894
895 if( fabs(x-middle_range) + range/2 <= 2*tol_act )
896 return x; /* Acceptable approx. is found */
897
898 /* Obtain the gold section step */
899 new_step = r * ( x<middle_range ? b-x : a-x );
900
901
902 /* Decide if the interpolation can be tried */
903 if( fabs(x-w) >= tol_act ) /* If x and w are distinct */
904 { /* interpolatiom may be tried */
905 double p; /* Interpolation step is calcula-*/
906 double q; /* ted as p/q; division operation*/
907 /* is delayed until last moment */
908 double t;
909
910 t = (x-w) * (fx-fv);
911 q = (x-v) * (fx-fw);
912 p = (x-v)*q - (x-w)*t;
913 q = 2*(q-t);
914
915 if( q>(double)0 ) /* q was calculated with the op-*/
916 p = -p; /* posite sign; make q positive */
917 else /* and assign possible minus to */
918 q = -q; /* p */
919
920 if( fabs(p) < fabs(new_step*q) && /* If x+p/q falls in [a,b]*/
921 p > q*(a-x+2*tol_act) && /* not too close to a and */
922 p < q*(b-x-2*tol_act) ) /* b, and isn't too large */
923 new_step = p/q; /* it is accepted */
924 /* If p/q is too large then the */
925 /* gold section procedure can */
926 /* reduce [a,b] range to more */
927 /* extent */
928 }
929
930 if( fabs(new_step) < tol_act ) { /* Adjust the step to be not less*/
931 if( new_step > (double)0 ) /* than tolerance */
932 new_step = tol_act;
933 else
934 new_step = -tol_act;
935 }
936
937 /* Obtain the next approximation to min */
938 { /* and reduce the enveloping range */
939 double t = x + new_step; /* Tentative point for the min */
940 double ft = (this->*f)(t,gCali,wf,waverange);
941 if( ft <= fx )
942 { /* t is a better approximation */
943 if( t < x ) /* Reduce the range so that */
944 b = x; /* t would fall within it */
945 else
946 a = x;
947
948 v = w; w = x; x = t; /* Assign the best approx to x */
949 fv=fw; fw=fx; fx=ft;
950 }
951 else /* x remains the better approx */
952 {
953 if( t < x ) /* Reduce the range enclosing x */
954 a = t;
955 else
956 b = t;
957
958 if( ft <= fw || w==x )
959 {
960 v = w; w = t;
961 fv=fw; fw=ft;
962 }
963 else if( ft<=fv || v==x || v==w )
964 {
965 v = t;
966 fv=ft;
967 }
968 }
969 } /* ----- end-of-block ----- */
970 } /* ===== End of loop ===== */
971}
#define x
static const double m_SQRT_EPSILON
int r
Definition globals.cxx:22

◆ fstepMin()

double LArWFParamTool::fstepMin ( const LArWave & gCali,
double fstep,
const double Tc,
const unsigned Ttail ) const
private

Definition at line 356 of file LArWFParamTool.cxx.

356 {
357 int niter = 0;
358 //double dfstep;
359 while (1) {
360 niter++ ;
361 const double dfstep = dFstep(gCali,fstep,Tc,Ttail) ;
362 fstep += dfstep ;
363 if ( niter > 50 || fstep < 0. ) {
364 fstep = 0.;
365 break;
366 }
367 if ( fabs( dfstep ) <= m_TINY ) break;
368 }
369 return fstep;
370}
double dFstep(const LArWave &gCali, const double fstep, const double Tc, const unsigned Ttail) const
static const double m_TINY

◆ GetFstep()

StatusCode LArWFParamTool::GetFstep ( const LArWave & gCali,
LArWFParams & wfParams,
const WaveTiming_t & wt ) const
private

Definition at line 344 of file LArWFParamTool.cxx.

345{
346 // step response
347 const unsigned Ttail = wt.Tmin + m_DeltaTtail[0];
348 //m_Fstep = 0.; // starting point for iterations
349 const double fstep1=0.0;
350 const double Tcal=wfParams.tcal();
351 wfParams.setFstep(fstepMin(gCali,fstep1,Tcal,Ttail) );
352 //ATH_MSG_VERBOSE( "*** Step response\t--> m_Fstep = " << m_Fstep ) ;
353 return StatusCode::SUCCESS ;
354}
double fstepMin(const LArWave &gCali, double fstep, const double Tc, const unsigned Ttail) const
void setFstep(double fstep)
double tcal() const

◆ getLArWaveParams()

StatusCode LArWFParamTool::getLArWaveParams ( const LArCaliWave & larCaliWave,
const HWIdentifier chid,
const CaloGain::CaloGain gain,
LArWFParams & wfParams,
const LArOnOffIdMapping * cabling,
std::optional< LArCaliWave > & omegaScan,
std::optional< LArCaliWave > & resOscill0,
std::optional< LArCaliWave > & resOscill1 ) const

Definition at line 193 of file LArWFParamTool.cxx.

201{
202
203
204 wfParams.setTshaper(m_Tshaper);
205 LArCaliWave gCali=larCaliWave; //down-cast to LArWave + deep copy (we'll modify the wave)
206
207 // find m_Tstart, m_Tpeak, m_Tcross, m_Tmin, m_Amplitude
208 WaveTiming_t waveTiming=timeExtr(gCali);
209
210 // find m_Tcal
211 if ( wfParams.tcal() == DoExtract ) {
212 const double Tcal = expTail(gCali,waveTiming) ;
213 if ( Tcal < 0 ) {
214 ATH_MSG_WARNING( "Could not extract Tcal for " << m_onlineHelper->channel_name(chid)
215 << " gain=" << (int)gain ) ;
216 wfParams.setTcal(FailExtract);
217 return StatusCode::FAILURE;
218 }
219 else {
220 wfParams.setTcal(Tcal);
221 }
222 ATH_MSG_VERBOSE( "set Tcal = " << wfParams.tcal()) ;
223 }
224
225 // find m_Fstep
226 if ( wfParams.fstep() == DoExtract ) {
227 StatusCode sc = GetFstep(gCali,wfParams,waveTiming);
228 if ( sc.isFailure() ) {
229 ATH_MSG_WARNING( "Could not extract Fstep for " << m_onlineHelper->channel_name(chid)
230 << " gain=" << (int)gain );
231 wfParams.setFstep(FailExtract);
232 return sc ;
233 }
234 } else {
235 ATH_MSG_VERBOSE( "set Fstep = " <<wfParams.fstep() );
236 }
237
238 // find m_Omega0 using RTM
239 if ( wfParams.omega0() == DoExtract ) {
240 StatusCode sc = RTM_Omega0(gCali,chid,wfParams,waveTiming,cabling,omegaScanWave);
241 if ( sc.isFailure() ) {
242 ATH_MSG_WARNING( "Could not extract Omega0 for " << m_onlineHelper->channel_name(chid)
243 << " gain=" << (int)gain );
244 wfParams.setOmega0(FailExtract) ;
245 return sc ;
246 }
247 } else {
248 ATH_MSG_VERBOSE( "set Omega0 = " << wfParams.omega0());
249 }
250
251
252 const Identifier id = cabling->cnvToIdentifier(chid);
253 const unsigned layer=m_emId->sampling(id);
254 if ( m_storeResOscill[ layer ] && resOscill0) {
255 LArWave injres0 = injRespRes(gCali,wfParams.omega0(),0);
256 *resOscill0 = LArCaliWave(injres0.getWave(),gCali.getDt(),gCali.getDAC(), 0x1,LArWave::unknown);
257 }
258
259 // find m_Taur using RTM
260 if ( wfParams.taur() == DoExtract ) {
261 StatusCode sc = RTM_Taur(gCali, wfParams,waveTiming ) ;
262 if ( sc.isFailure() ) {
263 ATH_MSG_WARNING( "Could not extract Taur for ChID=" << chid.get_compact()
264 << " gain=" << (int)gain ) ;
265 wfParams.setTaur(FailExtract);
266 return sc ;
267 }
268 ATH_MSG_VERBOSE( "set Taur = " << wfParams.taur() );
269 }
270
271 wfParams.setFlag( 0 ) ; // this should contain the method used to find parameters and the gain
272
273 if ( m_storeResOscill[ layer ] && resOscill1 && wfParams.omega0() != 0) {
274 LArWave injres1 = injRespRes(gCali,wfParams.omega0(),wfParams.taur());
275 *resOscill1 = LArCaliWave(injres1.getWave(),gCali.getDt(),gCali.getDAC(), 0x1, LArWave::unknown);
276 }
277
278 return( StatusCode::SUCCESS );
279}
static Double_t sc
value_type get_compact() const
Get the compact id.
int getDAC() const
DAC value.
const LArOnlineID_Base * m_onlineHelper
double expTail(const LArWave &gCali, const WaveTiming_t &wt) const
StatusCode GetFstep(const LArWave &gCali, LArWFParams &wfParams, const WaveTiming_t &wt) const
StatusCode RTM_Taur(const LArWave &gCali, LArWFParams &wfParams, const WaveTiming_t &wt) const
const LArEM_Base_ID * m_emId
StatusCode RTM_Omega0(const LArWave &gCali, const HWIdentifier chid, LArWFParams &wfParams, const WaveTiming_t &wt, const LArOnOffIdMapping *cabling, std::optional< LArCaliWave > &omegaScan) const
static LArWave injRespRes(const LArWave &w, const double omega0, const double taur)
WaveTiming_t timeExtr(LArWave &gCali) const
void setTaur(double taur)
double omega0() const
void setTcal(double tcal)
void setOmega0(double omega0)
double fstep() const
void setFlag(unsigned flag)
void setTshaper(double tsh)
double taur() const
@ unknown
Definition LArWave.h:137
const std::vector< double > & getWave() const
Wave parameters.
Definition LArWave.h:167
::StatusCode StatusCode
StatusCode definition for legacy code.
@ layer
Definition HitInfo.h:79

◆ initialize()

StatusCode LArWFParamTool::initialize ( )
virtual

Definition at line 112 of file LArWFParamTool.cxx.

113{
114 std::string layerName[4] = { "PS" , "Strips" , "Middle" , "Back" } ;
115
116 ATH_MSG_INFO( "TShaper set to " << m_Tshaper << " ns" ) ;
117
118 ATH_MSG_INFO( "Step response (Fstep) -> Ttail = Tmin + " << m_DeltaTtail[0] << " steps" ) ;
119
121 ATH_MSG_INFO( "Cosine response (Omega0) -> Ttail = Tmin + " << m_DeltaTtail[1] << " steps" ) ;
122 else
123 ATH_MSG_INFO( "Cosine response (Omega0) -> Will use OmegaScanHelper() to dynamically select settings" );
124
125 ATH_MSG_INFO( "Residual oscillations (Taur) -> Ttail = Tmin + " << m_DeltaTtail[2] << " steps" ) ;
126
127 for ( unsigned layer=0 ; layer<4 ; ++layer ) {
128 ATH_MSG_INFO( "options for Layer " << layer << " (" << layerName[layer] << ")" ) ;
129
130 ATH_MSG_INFO( " perform cos resp scan: " );
131 if ( m_cosRespScan[layer] && !m_UseOmegaScanHelper )
132 ATH_MSG_INFO( "YES (" << m_npoints[layer] << " points)" ) ;
133 if ( !m_cosRespScan[layer] && !m_UseOmegaScanHelper )
134 ATH_MSG_INFO( "NO" ) ;
136 ATH_MSG_INFO( "Will use OmegaScanHelper() to dynamically select settings" ) ;
137
139 ATH_MSG_INFO( " search interval: [ " << m_omegamin[layer] << " ; " << m_omegamax[layer] << " ]" ) ;
140 if ( m_omegamin[layer] >= m_omegamax[layer] ) {
141 ATH_MSG_ERROR( "Omega0Min >= Omega0Max in layer " << layer << " -- exit!" ) ;
142 return StatusCode::FAILURE ;
143 }
144 }
145
146 ATH_MSG_INFO( " store residual oscillation wave:" );
147 if ( m_storeResOscill[layer] ) {
148 ATH_MSG_INFO( "YES" ) ;
149 } else {
150 ATH_MSG_INFO( "NO" ) ;
151 }
152
153 }
154
155
157 if ( m_isSC ) {
158 const LArOnline_SuperCellID* ll;
159 ATH_CHECK(detStore()->retrieve(ll, "LArOnline_SuperCellID"));
160 m_onlineHelper = static_cast<const LArOnlineID_Base*>(ll);
161 ATH_MSG_DEBUG("Found the LArOnlineID helper");
162
163 } else { // m_isSC
164 const LArOnlineID* ll;
165 ATH_CHECK(detStore()->retrieve(ll, "LArOnlineID") );
166 m_onlineHelper = static_cast<const LArOnlineID_Base*>(ll);
167 ATH_MSG_DEBUG(" Found the LArOnlineID helper. ");
168
169 }
170
171
172 const CaloIdManager *caloIdMgr=nullptr;
173 ATH_CHECK( detStore()->retrieve(caloIdMgr));
174 if(!caloIdMgr){
175 ATH_MSG_ERROR( "Could not access CaloIdManager" );
176 return StatusCode::FAILURE;
177 }
178 if ( m_isSC ) {
179 m_emId=caloIdMgr->getEM_SuperCell_ID();
180 } else {
181 m_emId=caloIdMgr->getEM_ID();
182 }
183 if (!m_emId) {
184 ATH_MSG_ERROR( "Could not access lar EM ID helper" );
185 return StatusCode::FAILURE;
186 }
187
188
189 return StatusCode::SUCCESS;
190}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
const ServiceHandle< StoreGateSvc > & detStore() const
const LArEM_SuperCell_ID * getEM_SuperCell_ID(void) const
const LArEM_ID * getEM_ID(void) const
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
long long ll
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ injCorr()

LArWave LArWFParamTool::injCorr ( const unsigned N,
const double dt,
const double omega0,
const double taur )
staticprivate

Definition at line 762 of file LArWFParamTool.cxx.

762 {
763
764 LArWave w(N,dt);
765
766 const double tau0 = 1./omega0;
767 const double Delta = taur*taur - 4*tau0*tau0;
768 if ( Delta > 0 ) {
769 const double sqrtDelta = sqrt(Delta) ;
770 const double taup = 0.5*( taur + sqrtDelta ) ;
771 const double taum = 0.5*( taur - sqrtDelta ) ;
772 for ( unsigned i=0 ; i<N ; i++ ) {
773 const double t=i*dt;
774 w.setSample(i, (exp(-t/taup) - exp(-t/taum) ) / (taup - taum));
775 }
776 //return ( exp(-t/taup) - exp(-t/taum) ) / ( taup - taum ) ;
777 } else if ( Delta < 0 ) {
778 const double T = sqrt(-Delta) ;
779 const double A = 2 * taur / ( (taur*taur) - Delta ) ;
780 const double B = 2 * T / ( (taur*taur) - Delta );
781 for ( unsigned i=0 ; i<N ; i++ ) {
782 const double t=i*dt;
783 w.setSample(i, 2 * exp(-A*t) * sin(B*t) / T);
784 }
785 //return 2 * exp(-A*t) * sin(B*t) / T ;
786 } else { //Delta==0
787 const double tau = 0.5 * taur ;
788 // return exp(-t/tau) * t / pow(tau,2) ;
789 for ( unsigned i=0 ; i<N ; i++ ) {
790 const double t=i*dt;
791 w.setSample(i,exp(-t/tau) * t / (tau*tau)) ;
792 }
793 //return exp(-t/tau) * t / (tau*tau) ;
794 } //end else
795 return w;
796}
static Double_t taup
static Double_t tau0
unsigned long long T

◆ injRespRes()

LArWave LArWFParamTool::injRespRes ( const LArWave & w,
const double omega0,
const double taur )
staticprivate

Definition at line 758 of file LArWFParamTool.cxx.

758 {
759 return w - ( w % injCorr(w.getSize(),w.getDt(),omega0,taur) );
760}
static LArWave injCorr(const unsigned N, const double dt, const double omega0, const double taur)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & LArWFParamTool::interfaceID ( )
inlinestatic

Definition at line 40 of file LArWFParamTool.h.

40{ return IID_LArWFParamTool; }
static const InterfaceID IID_LArWFParamTool("LArWFParamTool", 1, 0)

◆ logChi2CosRespShaper()

double LArWFParamTool::logChi2CosRespShaper ( const double omega,
const LArWave & gCali,
const LArWFParams & wf,
const waveRange_t & range ) const
private

Definition at line 713 of file LArWFParamTool.cxx.

713 {
714 return log(m_wHelper.getSumSquareRegion(cosRespShaper(gCali,wfParams.fstep(),wfParams.tcal(),omega,wfParams.tshaper()),range.min,range.max)) ;
715}
LArWave cosRespShaper(const LArWave &gCali, const double &fstep, const double &tcal, const double &w, const double &tsh) const

◆ logChi2InjRespRes()

double LArWFParamTool::logChi2InjRespRes ( const double taur,
const LArWave & gCali,
const LArWFParams & wf,
const waveRange_t & range ) const
private

Definition at line 754 of file LArWFParamTool.cxx.

754 {
755 return m_wHelper.getSumSquareRegion(injRespRes(gCali,wf.omega0(),taur), range.min, range.max);
756}

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ omega0MinNum()

double LArWFParamTool::omega0MinNum ( double omegaMin,
double omegaMax,
const double tol,
const LArWave & gCali,
const LArWFParams & wf,
const waveRange_t & range ) const
private

Definition at line 798 of file LArWFParamTool.cxx.

798 {
799 return fminbr ( omegaMin, omegaMax, tol, &LArWFParamTool::logChi2CosRespShaper, gCali, wf, range);
800}
double logChi2CosRespShaper(const double omega, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &range) const
double fminbr(double a, double b, const double tol, double(LArWFParamTool::*f)(double, const LArWave &, const LArWFParams &, const waveRange_t &) const, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &range) const

◆ OmegaScanHelper()

LArWFParamTool::omegaScanParams_t LArWFParamTool::OmegaScanHelper ( const Identifier id,
const WaveTiming_t & wt ) const
private

Definition at line 495 of file LArWFParamTool.cxx.

495 {
496
497 omegaScanParams_t ret{};
498
499 // this is a skeleton of the final function: use at your own risk! M.D. & C.G.
500 // EMEC part modified by L. March - 7 April 2011
501
502 const unsigned layer=m_emId->sampling(id);
503
504 ret.range.min = m_TtailMin[2];
505 ret.range.max = m_TtailMax[2];
506 ret.cosRespScan = m_cosRespScan[ (unsigned)layer ] ;
507 ret.omegamin = m_omegamin[ (unsigned)layer ] ;
508 ret.omegamax = m_omegamax[ (unsigned)layer ] ;
509 ret.Npoint = m_npoints[ (unsigned)layer ] ;
510 ret.DeltaOmega = 0.02 ;
511 //DeltaOmega = 0.001 ;
512
513 //if ( m_BarrelEC==0 ) { // Barrel
514 if (m_emId->is_em_barrel(id)) {
515
516 if ( layer==0 ) { // PS
517 ret.range.min = wt.Tstart;
518 ret.range.max = wt.Tcross;
519 ret.cosRespScan = m_cosRespScan[ (unsigned)layer ];
520 ret.omegamin = 0.240;
521 ret.omegamax = 0.330;
522 ret.Npoint = 900;
523 }
524
525 if ( layer==1 ) { // Strips
526 ret.range.min = wt.Tstart;
527 ret.range.max = wt.Tcross;
528 ret.cosRespScan = true;
529 // Strips interval 1
530 //ret.omegamin = 0.150;
531 //ret.omegamax = 0.220;
532 //ret.Npoint = 700;
533 // Strips interval 2
534 ret.omegamin = 0.220;
535 ret.omegamax = 0.310;
536 ret.Npoint = 900;
537 // Strips interval 3
538 //omegamin = 0.310;
539 //omegamax = 0.390;
540 //Npoint = 1400;
541 }
542
543 if ( layer==2 ) { // Middle
544 ret.range.min = wt.Tstart;
545 ret.range.max = wt.Tmin + m_DeltaTtail[1];
546 ret.cosRespScan = false;
547 ret.omegamin = 0.060;
548 ret.omegamax = 0.215;
549 //Npoint = 315;
550 }
551
552 if ( layer==3 ) { // Back
553 ret.range.min = wt.Tstart;
554 ret.range.max = wt.Tcross;
555 ret.cosRespScan = false;
556 ret.omegamin = 0.100;
557 ret.omegamax = 0.700;
558 ret.Npoint = 120;
559 }
560
561 }
562 else {
563 //if ( m_BarrelEC==1 ) { // EndCap
564
565 // use pulse peak to perform cosine response tranformation minimization
566 //ret.range.min = m_Tstart;
567 //ret.range.max = m_Tcross;
568 ret.range.min = 0.;
569 ret.range.max = 0.;
570
571 ret.DeltaOmega = 0.001 ;
572
573 //(*m_log) << MSG::WARNING << " m_Tstart= " << m_Tstart << " m_Tcross=" << m_Tcross ) ;
574
575 const bool IsEMECInnerWheel = m_emId->is_em_endcap_inner(id);//m_onlineHelper->isEMECinHECchannel(m_chID);
576 const int eta=m_emId->eta(id);
577 if ( IsEMECInnerWheel ) { // EMEC Inner Wheel
578
579 if ( layer==1 ) {
580 //omegamin = 0.10 ;
581 //omegamax = 0.20 ;
582 ret.omegamin = 0.12 ;
583 if(eta>=0 && eta<=3)
584 {
585 ret.omegamin = 0.12 ;
586 //omegamax = 0.165 ;
587 ret.omegamax = 0.16 ;
588 ret.Npoint=100;
589 }
590 if(eta>=4 && eta<=6)
591 {
592 ret.omegamin = 0.14 ;
593 ret.omegamax = 0.18 ;
594 ret.Npoint=100;
595 }
596 } else
597 if ( layer == 2 ) { // don't extract Omega0
598 /*
599 cosRespScan = false;
600 omegamin = 0.;
601 omegamax = 0.;
602 Npoint = 0;
603 DeltaOmega = 0.;
604 */
605 ret.cosRespScan = true;
606 ret.omegamin = 0.12;
607 ret.omegamax = 0.35;
608 ret.Npoint = 100;
609 } else { // don't extract Omega0
610 ret.cosRespScan = false;
611 ret.omegamin = 0.;
612 ret.omegamax = 0.;
613 ret.Npoint = 0;
614 ret.DeltaOmega = 0.;
615 }
616
617 } else { // EMEC Outer Whell
618
619 if ( layer==1 ) { // don't extract Omega0
620 ret.cosRespScan = false;
621 ret.omegamin = 0.;
622 ret.omegamax = 0.;
623 ret.Npoint = 0;
624 ret.DeltaOmega = 0.;
625 } else
626 if ( layer == 2 ) {
627 ret.cosRespScan = true;
628 ret.Npoint =100;
629 ret.omegamin=0.1;
630 if(eta==0) {
631 ret.omegamax = 0.140 ;
632 }
633 if(eta==1) {
634 ret.omegamax = 0.135 ;
635 }
636 if(eta==2) {
637 ret.omegamax = 0.15 ;
638 }
639 if(eta==3) {
640 ret.omegamin = 0.10;
641 ret.omegamax = 0.16;
642 }
643 if(eta>=4 && eta<11 ) {
644 ret.omegamin = 0.12 ;
645 ret.omegamax = 0.20 ;
646 }
647 if(eta==11) {
648 ret.omegamin = 0.12 ;
649 ret.omegamax = 0.22 ;
650 }
651 if(eta>=12 && eta<28) {
652 ret.omegamin = 0.12 ;
653 ret.omegamax = 0.24 ;
654 }
655 if(eta>=28 && eta<39) {
656 ret.omegamin = 0.12 ;
657 ret.omegamax = 0.245 ;
658 }
659 if(eta>=39 && eta<43) {
660 //ret.omegamin = 0.12 ;
661 ret.omegamin = 0.24 ;
662 ret.omegamax = 0.32 ;
663 }
664 } else { // don't extract Omega0
665 ret.cosRespScan = false;
666 ret.omegamin = 0.;
667 ret.omegamax = 0.;
668 ret.Npoint = 0;
669 ret.DeltaOmega = 0.;
670 }
671
672 } // end of EMEC Outer Wheel
673
674 } // end of EMEC
675
676 return ret;
677}
Scalar eta() const
pseudorapidity method

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ RTM_Omega0()

StatusCode LArWFParamTool::RTM_Omega0 ( const LArWave & gCali,
const HWIdentifier chid,
LArWFParams & wfParams,
const WaveTiming_t & wt,
const LArOnOffIdMapping * cabling,
std::optional< LArCaliWave > & omegaScan ) const
private

Definition at line 423 of file LArWFParamTool.cxx.

424{
425 /* begin of the COSINE RESPONSE analysis */
426
427 const Identifier id = cabling->cnvToIdentifier(chid);
428 // Define the (raw) minimum research interval (if the Layer card is not set,
429 // uses the wider interval, and default value for the first minimum scan)
430
431 omegaScanParams_t OSParams{};
432
433 // defaults (e.g. to be used in case cosRespScan=true)
434 OSParams.cosRespScan = true ;
435 OSParams.omegamin = 0.01 ;
436 OSParams.omegamax = 1. ;
437 OSParams.Npoint = 100 ;
438 OSParams.DeltaOmega = 0.01 ; // GHz
439 OSParams.range.min=m_TtailMin[2];
440 OSParams.range.max=m_TtailMax[2];
441
442 if ( !m_UseOmegaScanHelper) {
443 const unsigned layer=m_emId->sampling(id);
444 OSParams.cosRespScan = m_cosRespScan[ layer ] ;
445 OSParams.omegamin = m_omegamin[ layer ] ;
446 OSParams.omegamax = m_omegamax[ layer ] ;
447 OSParams.Npoint = m_npoints[ layer ] ;
448 OSParams.DeltaOmega = 0.02 ;
449 //DeltaOmega = 0.001 ;
450 } else {
451 OSParams=OmegaScanHelper(id,wt);
452 }
453
454 waveRange_t range=OSParams.range;
455//if (m_TtailMin[2]==0 || m_TtailMax[2]==0 || m_TtailMin[2]>=m_TtailMax[2]) {
456 if (range.min==0 || range.max==0 || range.min>=range.max) {
457 range.min=wt.Tmin + m_DeltaTtail[1];
458 range.max=gCali.getSize();
459 }
460
461 if ( OSParams.cosRespScan ){
462 // makes a raw scan of the cosresp chi2 logarithm
463 const double dOmega = (OSParams.omegamax-OSParams.omegamin)/OSParams.Npoint;
464 const unsigned vectSize = (unsigned) ceil ( OSParams.omegamax/dOmega );
465 const unsigned indexmin = (unsigned) floor( OSParams.omegamin/dOmega );
466 if (omegaScanWave) omegaScanWave->setSize(vectSize);
467 double chi2min = LAR_MAX_DOUBLE, omega0raw = LAR_MAX_DOUBLE;
468 for (int i=0;i<OSParams.Npoint;i++) {
469 const double omega = OSParams.omegamin+dOmega*i ;
470 const double chi2 = logChi2CosRespShaper(omega, gCali, wfParams, range);
471 if (omegaScanWave) omegaScanWave->setSample(i+indexmin,chi2);
472 if ( chi2 < chi2min ) {
473 chi2min = chi2;
474 omega0raw = omega;
475 }
476 }
477
478 OSParams.omegamin = omega0raw - OSParams.DeltaOmega ;
479 OSParams.omegamax = omega0raw + OSParams.DeltaOmega ;
480 }
481
482 if ( OSParams.omegamin == OSParams.omegamax ) { // skip cosine response calculation
483 wfParams.setOmega0(0.); // this will force no injection point correction in LArPhysWavePredictor
484 ATH_MSG_VERBOSE( "*** Cosine response skipped\t--> m_Omega0 = " << wfParams.omega0() ) ;
485 } else { // numerical (Brent) log(chi2) minimization
486 wfParams.setOmega0(omega0MinNum ( OSParams.omegamin, OSParams.omegamax, m_EPSILON, gCali, wfParams, range) );
487 ATH_MSG_VERBOSE( "*** Cosine response\t--> m_Omega0 = " <<wfParams.omega0() ) ;
488 }
489
490 /* end of the COSINE RESPONSE analysis */
491 return StatusCode::SUCCESS ;
492}
#define LAR_MAX_DOUBLE
static const double m_EPSILON
omegaScanParams_t OmegaScanHelper(const Identifier id, const WaveTiming_t &wt) const
double omega0MinNum(double omegaMin, double omegaMax, const double tol, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &) const
double chi2(TH1 *h0, TH1 *h1)

◆ RTM_Taur()

StatusCode LArWFParamTool::RTM_Taur ( const LArWave & gCali,
LArWFParams & wfParams,
const WaveTiming_t & wt ) const
private

Definition at line 680 of file LArWFParamTool.cxx.

681{
682 /* begin of the INJECTION POINT CORRECTION RESIDUAL OSCILLATION analysis */
683
684 // m_Taur minimum search interval...
685 double taurmin = 0.; // ns
686 //double taurmax = 4.; // ns
687 double taurmax = 100.; // ns
688
689 if ( wf.omega0()==0) {
690 wf.setTaur(0);
691 ATH_MSG_VERBOSE( "*** Injection point skipped\t--> m_Taur = " << wf.taur() ) ;
692 } else {
693 // numerical (Brent) log(chi2) minimization
695 if ( m_TtailMin[3]!=0 && m_TtailMax[3]!=0 && m_TtailMin[3]<m_TtailMax[3]) {
696 range.min=m_TtailMin[3];
697 range.max=m_TtailMax[3];
698 }
699 else {
700 range.min= wt.Tmin + m_DeltaTtail[2];
701 range.max=gCali.getSize();
702 }
703
704 wf.setTaur(taurMinNum ( taurmin, taurmax, m_EPSILON, gCali, wf, range));
705 ATH_MSG_VERBOSE( "*** Injection point\t--> m_Taur = " << wf.taur()) ;
706 }
707
708 /* end of the INJECTION POINT CORRECTION RESIDUAL OSCILLATION analysis */
709
710 return StatusCode::SUCCESS ;
711}
double taurMinNum(const double taurmin, const double taurmax, const double tol, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &) const

◆ stepCorr()

LArWave LArWFParamTool::stepCorr ( const LArWave & gCali,
const double & fstep,
const double & Tc )
staticprivate

Definition at line 395 of file LArWFParamTool.cxx.

395 {
396 const unsigned N = gCali.getSize() ;
397 const double dt = gCali.getDt() ;
398
399 LArWave w(N,dt);
400 const double A=(1.-fstep)/Tc;
401 for ( unsigned i=0 ; i<N ; i++ ) {
402 w.setSample(i,A*exp(-fstep*i*dt/Tc));
403 }
404 return w ;
405}

◆ stepResp()

LArWave LArWFParamTool::stepResp ( const LArWave & gCali,
const double fstep,
const double Tc )
staticprivate

Definition at line 388 of file LArWFParamTool.cxx.

388 {
389 //return m_gCali + m_gCali % stepCorr() ;
390 LArWave result = gCali % stepCorr(gCali, fstep, Tc);
391 result+=gCali;
392 return result;
393}
static LArWave stepCorr(const LArWave &gCali, const double &fstep, const double &Tc)

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ taurMinNum()

double LArWFParamTool::taurMinNum ( const double taurmin,
const double taurmax,
const double tol,
const LArWave & gCali,
const LArWFParams & wf,
const waveRange_t & range ) const
private

Definition at line 807 of file LArWFParamTool.cxx.

807 {
808 return fminbr ( taurmin, taurmax, tol, &LArWFParamTool::logChi2InjRespRes, gCali, wf, range );
809}
double logChi2InjRespRes(const double taur, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &range) const

◆ timeExtr()

LArWFParamTool::WaveTiming_t LArWFParamTool::timeExtr ( LArWave & gCali) const
private

Definition at line 283 of file LArWFParamTool.cxx.

284{
285 WaveTiming_t wt{}; //return object
286
287 wt.Tstart = m_wHelper.getStart(gCali);
288
289 const unsigned NBaseline= m_NBaseline==0 ? wt.Tstart : m_NBaseline ;
290
291 const double baseline = m_wHelper.getBaseline(gCali,NBaseline);
292
293 if ( m_ShiftToStart ) // move the wave to the start
294 gCali = m_wHelper.translate(gCali, -wt.Tstart, baseline);
295
296 if ( m_SubtractBaseline ) // remove the baseline
297 gCali = gCali + (-baseline);
298
299 wt.Tpeak = m_wHelper.getMax(gCali);
300
301 wt.Amplitude = gCali.getSample(wt.Tpeak);
302
303 wt.Tmin = m_wHelper.getMin(gCali);
304
305 wt.Tcross = m_wHelper.getZeroCross(gCali);
306
307 return wt;
308}
@ baseline

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_cosRespScan

std::vector<bool> LArWFParamTool::m_cosRespScan
private

Definition at line 101 of file LArWFParamTool.h.

◆ m_DEFAULT

const double LArWFParamTool::m_DEFAULT = -1
staticprivate

Definition at line 78 of file LArWFParamTool.h.

◆ m_DeltaTtail

std::vector<int> LArWFParamTool::m_DeltaTtail
private

Definition at line 115 of file LArWFParamTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_emId

const LArEM_Base_ID* LArWFParamTool::m_emId = nullptr
private

Definition at line 93 of file LArWFParamTool.h.

◆ m_EPSILON

const double LArWFParamTool::m_EPSILON =2.22045e-16
staticprivate

Definition at line 81 of file LArWFParamTool.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_isSC

bool LArWFParamTool::m_isSC
private

Definition at line 112 of file LArWFParamTool.h.

◆ m_NBaseline

unsigned int LArWFParamTool::m_NBaseline
private

Definition at line 108 of file LArWFParamTool.h.

◆ m_npoints

std::vector<unsigned> LArWFParamTool::m_npoints
private

Definition at line 104 of file LArWFParamTool.h.

◆ m_omegamax

std::vector<double> LArWFParamTool::m_omegamax
private

Definition at line 103 of file LArWFParamTool.h.

◆ m_omegamin

std::vector<double> LArWFParamTool::m_omegamin
private

Definition at line 102 of file LArWFParamTool.h.

◆ m_onlineHelper

const LArOnlineID_Base* LArWFParamTool::m_onlineHelper = nullptr
private

Definition at line 94 of file LArWFParamTool.h.

◆ m_ShiftToStart

bool LArWFParamTool::m_ShiftToStart
private

Definition at line 109 of file LArWFParamTool.h.

◆ m_SQRT_EPSILON

const double LArWFParamTool::m_SQRT_EPSILON =1.49012e-08
staticprivate

Definition at line 80 of file LArWFParamTool.h.

◆ m_storeResOscill

std::vector<bool> LArWFParamTool::m_storeResOscill
private

Definition at line 107 of file LArWFParamTool.h.

◆ m_SubtractBaseline

bool LArWFParamTool::m_SubtractBaseline
private

Definition at line 110 of file LArWFParamTool.h.

◆ m_TINY

const double LArWFParamTool::m_TINY =2.22045e-16
staticprivate

Definition at line 79 of file LArWFParamTool.h.

◆ m_Tshaper

double LArWFParamTool::m_Tshaper
private

Definition at line 99 of file LArWFParamTool.h.

◆ m_TtailMax

std::vector<int> LArWFParamTool::m_TtailMax
private

Definition at line 114 of file LArWFParamTool.h.

◆ m_TtailMin

std::vector<int> LArWFParamTool::m_TtailMin
private

Definition at line 113 of file LArWFParamTool.h.

◆ m_UseOmegaScanHelper

bool LArWFParamTool::m_UseOmegaScanHelper
private

Definition at line 111 of file LArWFParamTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_wHelper

LArWaveHelper LArWFParamTool::m_wHelper
private

Definition at line 96 of file LArWFParamTool.h.


The documentation for this class was generated from the following files: