|
ATLAS Offline Software
|
Go to the documentation of this file.
6 #include "CLHEP/Matrix/Matrix.h"
7 #include "CLHEP/Matrix/Vector.h"
8 #include "GaudiKernel/SystemOfUnits.h"
22 const IInterface*
parent) :
35 declareInterface<LArOFPeakRecoTool>(
this);
50 ATH_MSG_WARNING(
"jobOption 'UseShape' set to false. Will work without shape" );
57 ATH_MSG_ERROR(
"Unable to retrieve LArOnlineID from DetectorStore");
58 return StatusCode::FAILURE;
64 ATH_MSG_ERROR(
"Unable to retrieve LArOnlineID from DetectorStore");
65 return StatusCode::FAILURE;
68 return StatusCode::SUCCESS;
77 std::vector<float> newsamples;
78 for(
unsigned int i=0;
i<samples.size();
i++)
80 newsamples.push_back((
float)samples[
i]);
98 const float epsilon=0.001;
108 result.m_delay_final = delayIn;
109 result.m_peakSample_init = npeak;
110 result.m_peakSample_final = npeak;
113 unsigned& kMax =
result.m_peakSample_final;
116 unsigned& delayIdx=
result.m_ofcIndex;
127 const unsigned nSamples=samples.size();
149 const unsigned nOFCPhase=dd_ofc->
nTimeBins(chID,usedGain);
150 float timeOffset = dd_ofc->
timeOffset(chID,usedGain);
160 timeMax=(nOFCPhase-1)*timeBinWidth;
163 timeMax = (nOFCPhase-1)*timeBinWidth;
164 if (timeBinWidth==0.) {
178 const unsigned ofcSize=this_OFC_a.size();
181 if ( ofcSize == 0 || this_OFC_b.size() == 0 ) {
186 if ( this_OFC_a.size() != this_OFC_b.size() ) {
188 ")and b (" << this_OFC_b.size() <<
") are not the same size for channel 0x"
194 if (peak_low<2) peak_low=2;
196 if (peak_high<peak_low) {
198 <<
"Not enough ADC samples (" <<
nSamples <<
") to apply " << ofcSize <<
" OFCs." );
201 if(kMax<peak_low) kMax=peak_low;
202 if(kMax>peak_high) kMax=peak_high;
204 float amplitude_save=0.;
205 float tau_save= 99999.;
206 unsigned int kMax_save=0;
208 unsigned int delayIdx_save=0;
210 unsigned int mynIter = nIter;
233 for (
unsigned k=0 ; (
k<ofcSize);
k++ ) {
235 const float& this_sample = samples[kMax-2+
k];
236 A += this_OFC_a.
at(
k) * this_sample ;
237 At += this_OFC_b.
at(
k) * this_sample ;
252 delay = delayIdx*timeBinWidth;
257 if (samples.size() == ofcSize && nOFCPhase<2) {
258 delay = delayIdx*timeBinWidth;
263 if (std::abs(
result.m_tau) <= (0.5*timeBinWidth)) {
265 delay = delayIdx*timeBinWidth;
269 if (kIter>=mynIter) {
270 delay = delayIdx*timeBinWidth;
272 if (std::abs(tau_save) < std::abs(
result.m_tau)) {
273 result.m_amplitude = amplitude_save;
277 delayIdx = delayIdx_save;
280 if (std::abs(
result.m_tau) <= timeBinWidth)
result.m_converged=
true;
286 if (std::abs(
result.m_tau) <= timeBinWidth) {
287 result.m_converged =
true;
289 amplitude_save =
result.m_amplitude;
292 delay_save = delayIdx*timeBinWidth;
293 delayIdx_save = delayIdx;
298 if(
delay<(-0.5*timeBinWidth)) {
303 if (
delay > timeMax )
delay = timeMax-epsilon;
309 if(
delay>(timeMax+0.5*timeBinWidth) ) {
314 if(
delay > timeMax )
delay = timeMax-epsilon;
317 delay = timeMax-epsilon;
323 if (delayIdx>=nOFCPhase) delayIdx = nOFCPhase-1;
325 this_OFC_a = dd_ofc->
OFC_a(chID,(
int)usedGain,delayIdx);
326 this_OFC_b = dd_ofc->
OFC_b(chID,(
int)usedGain,delayIdx);
345 if( thisShape.size() >= ofcSize ) {
346 for (
unsigned k=0 ;
k<ofcSize ;
k++ ) {
347 const float& this_sample = samples[kMax-2+
k];
359 result.m_nIterPerf = kIter;
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
virtual OFCRef_t OFC_b(const HWIdentifier &id, int gain, int tbin=0) const =0
virtual ShapeRef_t ShapeDer(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
value_type get_compact() const
Get the compact id.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual float timeOffset(const HWIdentifier &CellID, int gain) const =0
value_type at(size_t i) const
Vector indexing with bounds check.
virtual bool isHECchannel(const HWIdentifier id) const =0
::StatusCode StatusCode
StatusCode definition for legacy code.
virtual float timeBinWidth(const HWIdentifier &CellID, int gain) const =0
double delay(std::size_t d)
Helper for the Liquid Argon Calorimeter cell identifiers.
StatusCode initialize(bool used=true)
#define ATH_MSG_WARNING(x)
virtual OFCRef_t OFC_a(const HWIdentifier &id, int gain, int tbin=0) const =0
access to OFCs by online ID, gain, and tbin (!=0 for testbeam)
virtual unsigned nTimeBins(const HWIdentifier &CellID, int gain) const =0
std::string channel_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
constexpr int pow(int base, int exp) noexcept
Proxy for accessing a range of float values like a vector.
virtual ShapeRef_t Shape(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0