![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
35 #include "Gaudi/Property.h"
37 #include "CLHEP/Matrix/Matrix.h"
42 static const InterfaceID IID_ITileRawChannelBuilderOpt2Filter(
"TileRawChannelBuilderOpt2Filter", 1, 0);
46 return IID_ITileRawChannelBuilderOpt2Filter;
50 #define TILE_Opt2FilterBUILDERVERBOSE false
53 const std::string&
name,
const IInterface *
parent)
60 , m_t0SamplePosition(0)
63 declareInterface< TileRawChannelBuilder >(
this );
64 declareInterface< TileRawChannelBuilderOpt2Filter >(
this);
140 <<
"] and number of samples [" <<
m_nSamples <<
"]" );
141 return StatusCode::FAILURE;
166 return StatusCode::SUCCESS;
188 return StatusCode::SUCCESS;
196 double pedestal = 0.;
207 <<
" gain=" <<
gain );
225 <<
" ped=" << pedestal
278 for (
unsigned int i = 0;
i <
m_digits.size();
i++) {
287 for (
unsigned int i = 0;
i <
m_digits.size();
i++) {
341 ,
int &
gain,
double &pedestal,
double &litude,
double &
time,
const EventContext &ctx) {
350 float minDigit = *minMaxDigits.first;
351 float maxDigit = *minMaxDigits.second;
353 if (maxDigit - minDigit < 0.01) {
357 ATH_MSG_VERBOSE(
"CASE NO SIGNAL: maxdig-mindig = " << maxDigit <<
"-" << minDigit
358 <<
" = " << maxDigit - minDigit );
375 <<
" drawerIdx " << drawerIdx
379 double ofcPhase(
phase);
391 <<
" new amplitude is " << amplitude );
415 int digits_size_1 =
m_digits.size() - 1;
423 <<
" OptFilterDigits[0]-OptFilterDigits[ digits_size_1]="
436 <<
" OptFilterDigits[0]-OptFilterDigits[digits_size_1]="
442 for (
int i = 0;
i <= digits_size_1;
i++)
447 amplitude = -amplitude;
456 <<
" OptFilterDigits[0]-OptFilterDigits[digits_size_1]="
468 <<
" drawerIdx " << drawerIdx
483 <<
" new amplitude is " << amplitude );
506 double &pedestal,
double &litude,
double &
time,
double &
chi2,
const EventContext &ctx) {
511 double savePhase = 0.0;
539 <<
" END ITER=" << nIterations
540 <<
" new phase=" <<
phase
542 <<
" Amp=" << amplitude );
550 <<
" Phase=" << savePhase
551 <<
" Absolute Time=" <<
time );
558 double &pedestal,
double &litude,
double &
time,
double&
phase,
const EventContext &ctx) {
564 <<
" gain=" <<
gain );
566 int i = 0, digits_size =
m_digits.size();
587 for (
i = 0;
i < digits_size; ++
i) {
596 short a_int[99],
ascale = 0,
calib = 0, calib_offset = 0;
597 short b_int[99], bscale = 0;
600 int dspEnergy = 0, dspTime = 0;
607 ofc2int(digits_size,
b, b_int, bscale);
616 for (
i = 0;
i < digits_size; ++
i) {
624 for (
i = 0;
i < digits_size; ++
i) {
632 for (
i = 0;
i < digits_size; ++
i) {
642 size_t OptInd = abs(e2Dsp);
643 if (OptInd >= (
sizeof(
lookup) /
sizeof(
short))) OptInd = 0;
648 dspTime = (((dspTime + 0x100) >> 9) * lut +
round) >>
scale;
650 time = dspTime / 16.0;
656 dspEnergy = (dspEnergy * calib_offset + (1 << (
calib - 15 - 1))) >> (
calib - 15);
658 double goffset = (
gain == 0) ? 512 : 2048;
659 dspEnergy = (
int) (dspEnergy + goffset);
660 amplitude = (dspEnergy - goffset) / 16.;
663 bool goodEnergy = (fabs(amplitude) > 1.0e-04);
673 <<
" ... assuming 0.0" <<
endmsg;
675 <<
" ... assuming 0.0" <<
endmsg;
677 time = amplitude = 0.0;
690 for (
i = 0;
i < digits_size; ++
i) {
698 if (fabs(
chi2) > 1.0
e-04 || goodEnergy) {
709 <<
" ... assuming 0.0" <<
endmsg;
720 numberBits = numberBits - 1;
723 double max = -10000.;
725 for (
int i = 0;
i < nDigits;
i++) {
727 if (fabs(w_off[
i]) >
max)
max = fabs(w_off[
i]);
737 for (
int i = 0;
i < nDigits;
i++)
double m_minTime
min allowed time = -25*(m_nSamples-1)/2
TileRawChannelBuilderOpt2Filter(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
bool m_correctTimeNI
If true, resulting time is corrected when using method without iteration.
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
const unsigned short lookup[2401]
double compute(int ros, int drawer, int channel, int gain, double &pedestal, double &litude, double &time, double &phase, const EventContext &ctx)
int NdigitSamples() const
Returns the number of sammples (digits) per event.
float m_ampMinThresh
correct amplitude if it's above amplitude threshold (in ADC counts)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
int m_nSignal
internal counters
const TileHWID * m_tileHWID
float round(const float toRound, const unsigned int decimals)
int m_pedestalMode
pedestal mode to use
virtual StatusCode initialize()
Initializer.
bool msgLvl(const MSG::Level lvl) const
virtual StatusCode initialize()
Initialize method.
ToolHandle< ITileCondToolOfc > m_tileCondToolOfc
#define ATH_MSG_VERBOSE(x)
HWIdentifier adc_HWID(void) const
bool m_minus1Iter
bool variable for whether to apply -1 iteration (initial phase guess)
ToolHandle< TileCondToolTiming > m_tileToolTiming
float time(int ind=0) const
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
int channel(const HWIdentifier &id) const
extract channel field from HW identifier
double m_timeForConvergence
minimum time difference to quit iteration procedure
ToolHandle< TileCondToolNoiseSample > m_tileToolNoiseSample
Applies OF algorithm.
void ofc2int(int nDigits, double *w_off, short *w_int, short &scale)
void assign(const HWIdentifier &id, float amplitude, float time, float quality, float ped=0.0)
int ros(const HWIdentifier &id) const
extract ros field from HW identifier
bool m_of2
bool variable for OF method: true=> OF2; false=> OF1
setScaleOne setStatusOne saturated
TileFragHash::TYPE m_rChType
int adc(const HWIdentifier &id) const
extract adc field from HW identifier
int ItrigSample() const
The sample at which the pulse should ideally peak.
void ascale(TH1F *h, double s_)
SG::WriteHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
::StatusCode StatusCode
StatusCode definition for legacy code.
double chi2(TH1 *h0, TH1 *h1)
double filter(int ros, int drawer, int channel, int &gain, double &pedestal, double &litude, double &time, const EventContext &ctx)
pointer nextElementPtr()
obtain the next available element in pool by pointer pool is resized if its limit has been reached On...
const std::vector< float > & samples() const
int iterate(int ros, int drawer, int channel, int gain, double &pedestal, double &litude, double &time, double &chi2, const EventContext &ctx)
Computes A,time,ped using OF.
const TileInfo * m_tileInfo
float getPedestal(int ros, int drawer, int channel, int gain, const EventContext &ctx)
Apply the number of iterations needed for reconstruction by calling the Filter method.
virtual TileRawChannel * rawChannel(const TileDigits *digits, const EventContext &ctx)
Builder virtual method to be implemented by subclasses.
static double correctAmp(double phase, bool of2=true)
Amplitude correction factor according to the time when using weights for tau=0 without iterations.
Helpers for checking error return status codes and reporting errors.
void insertTime(float time)
float m_timeMaxThresh
correct amplitude is time is below time max threshold
int m_nCenter
internal counters
double m_maxTime
max allowed time = 25*(m_nSamples-1)/2
int m_nConst
internal counters
static double correctTime(double phase, bool of2=true)
Time correction factor.
int m_maxIterations
maximum number of iteration to perform
bool m_confTB
use testbeam configuration
int drawer(const HWIdentifier &id) const
extract drawer field from HW identifier
def time(flags, cells_name, *args, **kw)
std::vector< float > m_digits
a typed memory pool that saves time spent allocation small object. This is typically used by containe...
bool m_correctAmplitude
If true, resulting amplitude is corrected when using weights for tau=0 without iteration.
int m_t0SamplePosition
position of peak sample = (m_nSamples-1)/2
~TileRawChannelBuilderOpt2Filter()
Destructor.
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
std::string to_string(const HWIdentifier &id, int level=0) const
extract all fields from HW identifier HWIdentifier get_all_fields ( const HWIdentifier & id,...
float m_timeMinThresh
correct amplitude is time is above time min threshold
int m_nSamples
number of samples in the data
int findMaxDigitPosition()
Finds maximum digit position in the pulse.
int m_nNegative
internal counters
virtual StatusCode finalize()
Finalize method.