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

#include <LArPhysWaveHECTool.h>

Inheritance diagram for LArPhysWaveHECTool:
Collaboration diagram for LArPhysWaveHECTool:

Public Member Functions

 LArPhysWaveHECTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~LArPhysWaveHECTool ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
StatusCode makeLArPhysWaveHEC (LArWFParams &wfParams, LArCaliWave &caliWave, LArPhysWave &predLArPhysWave, const LArPhysWave &LArIdealPhysWave, float &MphysMcali, const HWIdentifier &chid, const int gain, int &LArPhysWaveFlag)
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

void predict_phys_HEC (LArWFParams &wfParams, LArCaliWave &caliWave, LArPhysWave &predLArPhysWave, float &MphysMcali, const HWIdentifier &chid, const int gain)
TF1 * CaliWave2PhysWaveHEC (TProfile *pcal, Double_t *par, double *parCL, TF1 *&deriv, Bool_t uset0, Bool_t norm, int adc, Double_t *xmax, bool gsl_flag)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

const LArPhysWavem_gIdealPhys = nullptr
const LArOnlineID_Basem_onlineHelper = nullptr
bool m_normalizeCali
bool m_timeOriginShift
bool m_subtractBaseline
bool m_isSC
double m_TcalMin
double m_TcalMax
double m_TcalAverage
double m_FstepMin
double m_FstepMax
double m_FstepAverage
double m_Omega0 = 0.0
double m_Taur = 0.0
unsigned m_Tstart = 0U
double m_MinAmp
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 int DEFAULT =-1

Detailed Description

Definition at line 38 of file LArPhysWaveHECTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ LArPhysWaveHECTool()

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

Definition at line 59 of file LArPhysWaveHECTool.cxx.

60 : AthAlgTool(type,name,parent)
61{
62
63 // Declare additional interface
64 declareInterface<LArPhysWaveHECTool>(this);
65
66 declareProperty("NormalizeCali", m_normalizeCali=false) ;//true?
67 declareProperty("TimeOriginShift", m_timeOriginShift=false) ;
68 declareProperty("SubtractBaseline", m_subtractBaseline=true) ;
69 declareProperty("isSC", m_isSC=false) ;
70 declareProperty("TcalMin", m_TcalMin=370) ;
71 declareProperty("TcalMax", m_TcalMax=490) ;
72 declareProperty("TcalAverage", m_TcalAverage=422.2) ;
73 declareProperty("FstepMin", m_FstepMin=0.02) ;
74 declareProperty("FstepMax", m_FstepMax=0.1) ;
75 declareProperty("FstepAverage", m_FstepAverage=0.068) ;
76 declareProperty("MinAmplitude", m_MinAmp=100.);
77}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ ~LArPhysWaveHECTool()

LArPhysWaveHECTool::~LArPhysWaveHECTool ( )
virtual

Definition at line 79 of file LArPhysWaveHECTool.cxx.

79{}

Member Function Documentation

◆ CaliWave2PhysWaveHEC()

TF1 * LArPhysWaveHECTool::CaliWave2PhysWaveHEC ( TProfile * pcal,
Double_t * par,
double * parCL,
TF1 *& deriv,
Bool_t uset0,
Bool_t norm,
int adc,
Double_t * xmax,
bool gsl_flag )
private

Definition at line 662 of file LArPhysWaveHECTool.cxx.

663 {
664
665 TF1 *fitfun{}, *fu{};
666 Int_t i{},nbin{},nbino{},i5bin{},count{} ;
667 Double_t pampl{}, t5{}, mcut{}, rshift{}, rmult{};
668
669// Cables amplitude
670 a = 0.974;
671// Cables poles
672 tau0 = 1.5;
673// New value according to findings on Sept. 2001 run
674 taup = 19.5;
675 tauz = 18.;
676// Should be smaller
677 taus = 0.1;
678// Step amplitude
679
680 al=parCL[1]; // FT: can be exchanged with m_Fstep
681
682 tc=parCL[0]; // FT: can be exchanged with m_Tcal
683
684// Drift time
685// tdr = 440.;
686// New value:
687 tdr = 449.7;
688
689 nbino = nbin = pcal->GetNbinsX();
690 if(nbin>NMAX) nbin = NMAX;
691 if(nbino>NMAX) nbino = NMAX;
692
693 if(norm) {
694 normalize_prof(pcal,&pampl);
695 mcut = 0.05;
696 } else {
697 mcut = 0.05*pcal->GetMaximum();
698 }
699
700 cout<<"mcut: "<<mcut<<endl;
701 i5bin = 0;
702 for(i=1; i<=nbin; ++i) {
703 x[i-1] = pcal->GetBinCenter(i);
704 y[i-1] = pcal->GetBinContent(i);
705 if(i5bin == 0 && y[i-1] > mcut) i5bin = i;
706 };
707 //check access range
708 if (i5bin<2) {
709 printf("\n number of bins too small !\n");
710 return nullptr;
711 }
712 t5 = (mcut-y[i5bin-2])*(x[i5bin-1]-x[i5bin-2])/(y[i5bin-1]-y[i5bin-2]);
713 t5 += x[i5bin-2];
714//
715// t0 is app. 16.8 ns less than t5 (from reference shapes 2002)
716//
717 t0 = t5 - 16.8;
718
719
720 if(fabs((x[1] - x[0]) - (x[3] - x[2])) > 0.000001 ) {
721 cout<< x[0] << " " << x[1] << " " << x[2] << " " << x[3] << endl;
722 printf("\n Nonuniform step !\n");
723 return nullptr;
724 }
725
726 STEP = x[1] - x[0];
727
728
729 if(pref) delete [] pref;
730 pref = new Double_t[nbin];
731
732 count = 0;
733 for(i=0; i<nbin; ++i) {
734 if(x[i] < t0) {pref[i] = 0.; continue;}
735 double AmplPhys = m_gIdealPhys->getSample(count);
736 pref[i] = AmplPhys;
737 ++count;
738 if(count==(int)m_gIdealPhys->getSize()) break;
739 }
740 if(i<nbin) nbin = i+1;
741
742// Try to find the shift and mult. for reference signal
743 if(splin) delete splin;
744 splin = new TSpline3("sp",x,pref,nbin,"b1",0.);
745 fu = new TF1("fu",P,x[15],x[nbin-15],2);
746 fu->SetParName(0,"t0 shift");
747 fu->SetParLimits(0,-15.,15.);
748 fu->SetParName(1,"mult");
749 fu->SetParLimits(1,0.,10000.);
750 fu->SetParameters(5.,5.);
751
752 if( pcal->Fit("fu","RQ0") == 0) {
753 rshift = pcal->GetFunction("fu")->GetParameter(0);
754 rmult = pcal->GetFunction("fu")->GetParameter(1);
755 } else {
756 rshift = 0; rmult= pcal->GetMaximum()/ (* std::max_element(m_gIdealPhys->getWave().begin(), m_gIdealPhys->getWave().end()));
757 }
758
759 delete fu;
760// Read the reference again, shifting and multiplying:
761 count = 0;
762 for(i=0; i<nbin; ++i) {
763 if(x[i] < t0-rshift) {pref[i] = 0.; continue;}
764 double AmplPhys = rmult*m_gIdealPhys->getSample(count);
765 pref[i] = AmplPhys;
766 ++count;
767 if(count==(int)m_gIdealPhys->getSize()) break;
768 }
769 if(i<nbin) nbin = i+1;
770
771 if(uset0){
772 for(i=1; i<=nbin; ++i) x[i-1] -= t0;
773 t0 = 0.;
774 }
775 else {
776 for(i=1; i<=nbin; ++i) x[i-1] += par[0];
777 t0 += par[0];
778 }
779 par[0] = 0;
780 Smooth_new(x, y, pref, nbin);
781 if(splin) delete splin;
782 splin = new TSpline3("sp",x,pref,nbin,"b1",0.);
783
784 // gaus or GSL ?
785
786 if(!gsl_flag)
787 fitfun = new TF1("fitfun",&Tp,x[0],x[nbin-1],3);
788 else
789 fitfun = new TF1("fitfun",&Tp_gsl,x[0],x[nbin-1],3);
790
791 fitfun->SetParName(0,"t0 shift");
792 fitfun->SetParLimits(0,0.,100.);
793 fitfun->SetParName(1,"mult");
794 fitfun->SetParLimits(1,0.,100.);
795 fitfun->SetParName(2,"Taus");
796 fitfun->SetParLimits(2,0.1,10.);
797 fitfun->SetNpx(nbin+1);
798 fitfun->SetParameters(par[0],par[1],par[2]);
799 //std::cout<<"What happens before normalize?"<<std::endl;
800 if(norm) {
801 if(uset0)
802 normalize(fitfun, &pampl, 0., 100., STEP);
803 else
804 normalize(fitfun, &pampl, t0, t0+100., STEP);
805 }
806// Return also the derivative
807 deriv = new TF1("derivfun",&DTp,x[0],x[nbin-1],3);
808 deriv->SetParName(0,"t0 shift");
809 deriv->SetParLimits(0,0.,100.);
810 deriv->SetParName(1,"mult");
811 deriv->SetParLimits(1,0.,100.);
812 deriv->SetParName(2,"Taus");
813 deriv->SetParLimits(2,0.1,10.);
814 deriv->SetNpx(nbin+1);
815 deriv->SetParameters(par[0],par[1],par[2]);
816
817 if(norm) {
818 normalize(deriv, &pampl, t0+par[0], t0+par[0]+100., STEP);
819 }
820
821 return fitfun;
822}
static boost::dynamic_bitset rshift(boost::dynamic_bitset<> const &b, int n)
void Smooth_new(Double_t *x, Double_t *y, Double_t *yref, Int_t ymax)
static Double_t tauz
static TSpline3 * splin
static Double_t taus
const int NMAX
static Double_t DTp(Double_t *t, Double_t *par)
static Double_t Tp_gsl(Double_t *t, Double_t *par)
Double_t normalize(TF1 *func, Double_t *rampl=NULL, Double_t from=0., Double_t to=0., Double_t step=1.)
static Double_t taup
Double_t normalize_prof(TProfile *histo, Double_t *rampl=NULL)
static Double_t a
static Double_t tc
static Double_t tdr
static Double_t * pref
static Double_t al
static Double_t Tp(Double_t *t, Double_t *par)
static Double_t P(Double_t *tt, Double_t *par)
static Double_t t0
static Double_t tau0
#define STEP(f, a, b, c, d, x, t, s)
Definition MD5.cxx:121
#define y
#define x
const LArPhysWave * m_gIdealPhys
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
std::vector< LUCID_Digit_p2 > t5

◆ 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.

◆ 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.

◆ 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 LArPhysWaveHECTool::finalize ( )
inlinevirtual

Definition at line 51 of file LArPhysWaveHECTool.h.

51{return StatusCode::SUCCESS;}

◆ initialize()

StatusCode LArPhysWaveHECTool::initialize ( )
virtual

Definition at line 81 of file LArPhysWaveHECTool.cxx.

82{
83 if ( m_isSC ) {
84 ATH_MSG_DEBUG("==== looking at SuperCells ====");
85 const LArOnline_SuperCellID* ll;
86 ATH_CHECK( detStore()->retrieve(ll, "LArOnline_SuperCellID") );
87 m_onlineHelper = static_cast<const LArOnlineID_Base*>(ll);
88 } else { // m_isSC
89 const LArOnlineID* ll;
90 ATH_CHECK( detStore()->retrieve(ll, "LArOnlineID") );
91 m_onlineHelper = static_cast<const LArOnlineID_Base*>(ll);
92 }
93 return StatusCode::SUCCESS;
94}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
const ServiceHandle< StoreGateSvc > & detStore() const
const LArOnlineID_Base * m_onlineHelper
long long ll
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ 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 & LArPhysWaveHECTool::interfaceID ( )
inlinestatic

Definition at line 43 of file LArPhysWaveHECTool.h.

43{ return IID_LArPhysWaveHECTool; }
static const InterfaceID IID_LArPhysWaveHECTool("LArPhysWaveHECTool", 1, 0)

◆ makeLArPhysWaveHEC()

StatusCode LArPhysWaveHECTool::makeLArPhysWaveHEC ( LArWFParams & wfParams,
LArCaliWave & caliWave,
LArPhysWave & predLArPhysWave,
const LArPhysWave & LArIdealPhysWave,
float & MphysMcali,
const HWIdentifier & chid,
const int gain,
int & LArPhysWaveFlag )

Definition at line 97 of file LArPhysWaveHECTool.cxx.

100 {
101 LArPhysWaveFlag=LArWave::predCali;
103 // set input objects
104 m_Omega0 = 0.;
105 m_Taur = 0.;
106 m_gIdealPhys = &idealPhysWave;
107
108 if(wfParam.fstep()<m_FstepMin || wfParam.fstep()>m_FstepMax){
109 ATH_MSG_INFO (" Fstep="<< wfParam.fstep() << " out of accepted region ("<<m_FstepMin<< ","<<m_FstepMax<<") average used instead : "<<m_FstepAverage);
110 wfParam.setFstep(m_FstepAverage);
111 }
112 if(wfParam.tcal()<m_TcalMin || wfParam.tcal()>m_TcalMax ){
113 ATH_MSG_INFO (" Tcal="<< wfParam.tcal() << "out of accepted region ("<<m_TcalMin<< ","<<m_TcalMax<<") average used instead : "<<m_TcalAverage);
114 wfParam.setTcal(m_TcalAverage);
115 }
116
117
118 ATH_MSG_DEBUG (" Tdrift="<< wfParam.tdrift() <<" Tcal="<<wfParam.tcal()<<" Fstep="<< wfParam.fstep()<<" m_Omega0="<< m_Omega0<<" m_Taur="<<m_Taur<<" LArWaveFlag="
119 << LArWaveFlag <<" LArPhysWaveFlag="<< LArPhysWaveFlag );
120 predict_phys_HEC(wfParam,caliWave,predLArPhysWave, MphysMcali,chid,gain);
121
122
123 return StatusCode::SUCCESS;
124}
#define ATH_MSG_INFO(x)
int Tp4_gsl_err_counter
int LArWaveFlag
int Tp5_gsl_err_counter
void predict_phys_HEC(LArWFParams &wfParams, LArCaliWave &caliWave, LArPhysWave &predLArPhysWave, float &MphysMcali, const HWIdentifier &chid, const int gain)
@ predCali
Definition LArWave.h:129

◆ 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 }

◆ 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.

◆ predict_phys_HEC()

void LArPhysWaveHECTool::predict_phys_HEC ( LArWFParams & wfParams,
LArCaliWave & caliWave,
LArPhysWave & predLArPhysWave,
float & MphysMcali,
const HWIdentifier & chid,
const int gain )
private

Definition at line 126 of file LArPhysWaveHECTool.cxx.

128 {
129
130 // calib. signal at Mother Board :
131 LArWave gCaliMB=caliWave ;//deep-copy and cast to base-class
132 LArWaveHelper wHelper;
133
134
135 // shift gCaliMB to start point and remove baseline
136
137 m_Tstart = wHelper.getStart(gCaliMB) ;
138 double baseline = wHelper.getBaseline(gCaliMB,m_Tstart) ;
139 if ( m_subtractBaseline ) gCaliMB = gCaliMB+ (-baseline);
140 if ( m_timeOriginShift ) gCaliMB = wHelper.translate(gCaliMB,-m_Tstart,baseline) ;
141
142 // normalization of calibration pulse
143 double peak_tmp=gCaliMB.getSample( wHelper.getMax(gCaliMB) ) ;
144 if ( m_normalizeCali ) {
145 double peak = gCaliMB.getSample( wHelper.getMax(gCaliMB) ) ;
146 peak_tmp=peak;
147 ATH_MSG_VERBOSE ( "*** Normalisation \t|-> YES (CaliWave peak = " << peak << ")" );
148 if ( peak <=0 ) {
149 ATH_MSG_WARNING ( "Peak value <=0 , cannot normalize!" );
150 } else {
151 gCaliMB = gCaliMB * (1./peak) ;
152 }
153 } else {
154 ATH_MSG_VERBOSE ( "*** Normalisation \t|-> NO" );
155 }
156
157
158 int FT = m_onlineHelper->feedthrough(chid);
159 int Slot = m_onlineHelper->slot(chid);
160 int Channel = m_onlineHelper->channel(chid);
161 int adc = 128*(Slot-5)+ Channel+1;
162
163 ATH_MSG_VERBOSE ( "*** Physics waveform\t|-> FT=" << FT << " Slot=" << Slot << " Channel=" <<Channel<< " adc=" << adc << " gain=" << gain );
164 ATH_MSG_VERBOSE ( "*** Physics waveform\t|-> m_Tdrift = " << wfParam.tdrift() << " ns " );
165 ATH_MSG_VERBOSE ( "*** Physics waveform\t|-> m_Fstep = " << wfParam.fstep() << " ns " );
166 ATH_MSG_VERBOSE ( "*** Physics waveform\t|-> m_Tcal = " << wfParam.tcal() << " ns " );
167
168
169
171 unsigned int CaliWaveBins = gCaliMB.getSize();
172 double const BinWidth=25.0/24;
173 double const HalfBinWidth=BinWidth/2.0;
174 double par[3]={0.0,1.0,0.10};
175 bool uset0=false, norm=false;
176
177 double const QUAL_REQ=peak_tmp*0.04; //80 ADC units is max allowed deviation of Ampl between two bins
178 double const QUAL_REQ_AMPL=peak_tmp*0.3;
179
180 double DIFF=0,DIFF_AMPL=0;
181 unsigned short int repro_count=0;
182 int idx_bad_time=-1,idx_bad_time_ampl=-1;
183 TF1 *PhysWaveFunc=0;
184 const unsigned short int ITER_MAX = 10;
185 double Ampl_problem=-1, Time_problem=-1, Ampl_problem_ampl=-1, Time_problem_ampl=-1;
186 double CALIWAVE_SHIFT=0;
187 TProfile pcal("pcal","Amplitude vs Time",CaliWaveBins,0-HalfBinWidth,CaliWaveBins*BinWidth-HalfBinWidth);
188 while(( (DIFF>=QUAL_REQ || DIFF_AMPL>=QUAL_REQ_AMPL) && repro_count<ITER_MAX)
189 || repro_count==0){
190
191 // if deviation is above a limit, move the CALIWAVE by 1.0 ADC counts
192 if ( m_normalizeCali || peak_tmp < 1.1) {
193 CALIWAVE_SHIFT=0.0005*repro_count;
194 } else {
195 CALIWAVE_SHIFT=1.0*repro_count;
196 }
197
198 if(repro_count>0){
199 ATH_MSG_INFO ("FT="<<FT<<" Slot="<<Slot<<" Ch="<<Channel<<" Gain="<<gain<<" adc="<<adc);
200 ATH_MSG_INFO (repro_count<<". Iteration of INTEGRATION: CALIWAVE IS MOVED UP by "<<CALIWAVE_SHIFT<<" ADC units");
201 if(DIFF_AMPL>=QUAL_REQ_AMPL)
202 ATH_MSG_INFO ("Problematic DIFF_AMPL bin="<<idx_bad_time_ampl<<" AmplPhysGSL="<<Ampl_problem_ampl<<" Time="<< Time_problem_ampl <<" Deviation="<<DIFF_AMPL<<" ADC units"<<" Peak="<<peak_tmp);
203 if(DIFF>=QUAL_REQ)
204 ATH_MSG_INFO ("Problematic DIFF bin="<<idx_bad_time<<" AmplPhysGSL="<<Ampl_problem<<" Time="<<Time_problem<<" Deviation="<<DIFF<<" ADC units"<< " Peak="<<peak_tmp);
205 }
206
207 pcal.Reset();
208 for(unsigned tbin=1;tbin<=gCaliMB.getSize();++tbin){
209 double AmplCalib = gCaliMB.getSample(tbin-1)+CALIWAVE_SHIFT;
210 double Time = gCaliMB.getTime(tbin-1);
211 pcal.Fill(Time,AmplCalib,1);
212 }
213 bool gslflag=true;
214 Double_t *xmax=0;
215 double parCL[2]={wfParam.tcal(),wfParam.fstep()};
216 TF1 *deriv=0;
217 TF1* pwf=CaliWave2PhysWaveHEC(&pcal, par, parCL, deriv, uset0, norm, adc, xmax,gslflag);
218 if (deriv) delete deriv;
219 if (!pwf) {
220 ATH_MSG_ERROR("Failed to create PhysWaveFunc");
221 return;
222 }
223 PhysWaveFunc= (TF1*)pwf->Clone();
224 DIFF=0;DIFF_AMPL=0;Ampl_problem=-1; Time_problem=-1; Ampl_problem_ampl=-1; Time_problem_ampl=-1;
225
226
227 for(int i=1;i<pcal.GetNbinsX(); ++i){
228 double TimePhys1 = pcal.GetBinCenter(i+1);
229 double TimePhys0 = TimePhys1-BinWidth;
230 double DIFF_TMP = PhysWaveFunc->Eval(TimePhys1)-PhysWaveFunc->Eval(TimePhys0);
231 if(TimePhys1>200 && DIFF<fabs(DIFF_TMP)){
232 DIFF=fabs(DIFF_TMP);
233 idx_bad_time=i;
234 Ampl_problem=PhysWaveFunc->Eval(TimePhys1);
235 Time_problem=TimePhys1;
236 }
237 else if(TimePhys1<=200 && DIFF_AMPL<fabs(DIFF_TMP)){
238 DIFF_AMPL=fabs(DIFF_TMP);
239 idx_bad_time_ampl=i;
240 Ampl_problem_ampl=PhysWaveFunc->Eval(TimePhys1);
241 Time_problem_ampl=TimePhys1;
242 } }
243 repro_count++;
244 }
245
246 if(repro_count>=ITER_MAX && (DIFF>=QUAL_REQ || DIFF_AMPL>=QUAL_REQ_AMPL)){
247 ATH_MSG_WARNING ("FT="<<FT<<" Slot="<<Slot<<" Ch="<<Channel<<" Gain="<<gain<<" #iterations for CALIWAVE increasing reached the limit! LArWaveFlag set to -1" );
248 LArWaveFlag=-1;
249 }
250
251 predLArPhysWave=LArPhysWave(gCaliMB.getSize(),gCaliMB.getDt()); //Assignment per value, but wave is empty at this point
252
253
254 for(unsigned int i=0;i<gCaliMB.getSize(); ++i){
255 const double Time = gCaliMB.getTime(i);
256 if(Time<=t0){
257 predLArPhysWave.setSample(i,PhysWaveFunc->Eval(Time));
258 }
259 else{
260 predLArPhysWave.setSample(i,PhysWaveFunc->Eval(Time)-CALIWAVE_SHIFT);
261 }
262 }
263
265
266 // compute Mphys/Mcal
267 if ( m_normalizeCali ) {
268 // caliwave is normalized to 1 => Mcali = 1
269 MphysMcali = predLArPhysWave.getSample( wHelper.getMax(predLArPhysWave) ) ;
270 std::cout<<"Normalized: MphysMcali="<<MphysMcali<<std::endl;
271 } else {
272 MphysMcali = predLArPhysWave.getSample( wHelper.getMax(predLArPhysWave) ) /
273 gCaliMB.getSample( wHelper.getMax(gCaliMB) ) ;
274 }
275 ATH_MSG_VERBOSE ( "*** Physics waveform\t|-> m_MphysMcali = " << MphysMcali << " adc=" <<adc);
276
277 return ;
278}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
@ baseline
#define DIFF(_name, _a, _b)
TF1 * CaliWave2PhysWaveHEC(TProfile *pcal, Double_t *par, double *parCL, TF1 *&deriv, Bool_t uset0, Bool_t norm, int adc, Double_t *xmax, bool gsl_flag)
LArWave translate(const LArWave &theWave, int nShift, double baseline=0.) const
double getBaseline(const LArWave &theWave, unsigned nBase) const
unsigned int getMax(const LArWave &theWave) const
return index of maximum sample
unsigned getStart(const LArWave &theWave) const
double getTime(const unsigned i) const
time
Definition LArWave.h:172
void setSample(const unsigned i, const double aVal)
set the amplitude for time bin i
Definition LArWave.h:87
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
const double & getDt() const
delta time
Definition LArWave.h:50
double xmax
Definition listroot.cxx:61
Identifier32::value_type Channel

◆ 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 }

◆ 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.

◆ 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

◆ DEFAULT

const int LArPhysWaveHECTool::DEFAULT =-1
staticprivate

Definition at line 68 of file LArPhysWaveHECTool.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_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_FstepAverage

double LArPhysWaveHECTool::m_FstepAverage
private

Definition at line 80 of file LArPhysWaveHECTool.h.

◆ m_FstepMax

double LArPhysWaveHECTool::m_FstepMax
private

Definition at line 80 of file LArPhysWaveHECTool.h.

◆ m_FstepMin

double LArPhysWaveHECTool::m_FstepMin
private

Definition at line 80 of file LArPhysWaveHECTool.h.

◆ m_gIdealPhys

const LArPhysWave* LArPhysWaveHECTool::m_gIdealPhys = nullptr
private

Definition at line 71 of file LArPhysWaveHECTool.h.

◆ m_isSC

bool LArPhysWaveHECTool::m_isSC
private

Definition at line 77 of file LArPhysWaveHECTool.h.

◆ m_MinAmp

double LArPhysWaveHECTool::m_MinAmp
private

Definition at line 86 of file LArPhysWaveHECTool.h.

◆ m_normalizeCali

bool LArPhysWaveHECTool::m_normalizeCali
private

Definition at line 76 of file LArPhysWaveHECTool.h.

◆ m_Omega0

double LArPhysWaveHECTool::m_Omega0 = 0.0
private

Definition at line 84 of file LArPhysWaveHECTool.h.

◆ m_onlineHelper

const LArOnlineID_Base* LArPhysWaveHECTool::m_onlineHelper = nullptr
private

Definition at line 73 of file LArPhysWaveHECTool.h.

◆ m_subtractBaseline

bool LArPhysWaveHECTool::m_subtractBaseline
private

Definition at line 76 of file LArPhysWaveHECTool.h.

◆ m_Taur

double LArPhysWaveHECTool::m_Taur = 0.0
private

Definition at line 84 of file LArPhysWaveHECTool.h.

◆ m_TcalAverage

double LArPhysWaveHECTool::m_TcalAverage
private

Definition at line 79 of file LArPhysWaveHECTool.h.

◆ m_TcalMax

double LArPhysWaveHECTool::m_TcalMax
private

Definition at line 79 of file LArPhysWaveHECTool.h.

◆ m_TcalMin

double LArPhysWaveHECTool::m_TcalMin
private

Definition at line 79 of file LArPhysWaveHECTool.h.

◆ m_timeOriginShift

bool LArPhysWaveHECTool::m_timeOriginShift
private

Definition at line 76 of file LArPhysWaveHECTool.h.

◆ m_Tstart

unsigned LArPhysWaveHECTool::m_Tstart = 0U
private

Definition at line 85 of file LArPhysWaveHECTool.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.


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