![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
8 #include "Gaudi/Property.h"
28 static const InterfaceID IID_ITileRawChannelBuilderFlatFilter
29 (
"TileRawChannelBuilderFlatFilter", 1, 0);
32 return IID_ITileRawChannelBuilderFlatFilter;
36 #define TILE_FLATFILTERBUILDERVERBOSE false
42 const std::string&
name,
const IInterface *
parent)
46 declareInterface< TileRawChannelBuilder >(
this );
47 declareInterface< TileRawChannelBuilderFlatFilter >(
this);
76 ATH_MSG_INFO(
"TileRawChannelBuilderFlatFilter::initialize()" );
83 return StatusCode::SUCCESS;
89 return StatusCode::SUCCESS;
103 double amplitude = 0.0;
109 unsigned int drawerIdx(0),
channel(0),
adc(0);
144 double deltaCut,
double rmsCut,
int &
max,
int &
min,
double &
mean,
double &
rms)
const {
167 if ( ( (
max-
min) >= deltaCut ) &&
168 (
rms >= rmsCut ) ) {
175 ,
int pedStart,
int pedLgt)
const {
181 <<
"->" << (pedStart + pedLgt) );
186 else if (pedLgt < 0) {
192 for (
i = 0;
i < pedLgt; ++
i) {
202 for (
i = 0;
i < pedLgt; ++
i) {
218 int filterLength,
int signalStart,
int signalLength
219 ,
int &tMax,
int &tMaxFrame,
int &adderFrame)
const {
220 int i,
t, minW, maxW, adder, adderWindow;
221 int tm=0, maxAdder=-1;
225 <<
" Signal " << signalStart
226 <<
"->" << (signalStart + signalLength) );
231 maxW = signalStart + signalLength - filterLength + 1;
234 for (
t = minW;
t < maxW; ++
t) {
237 for (
i =
t;
i <
t+filterLength; ++
i) adder += (
int)digits.at(
i);
239 if ( adder > maxAdder ) {
248 adderWindow = maxAdder;
254 for ( ;
t < maxW; ++
t) {
256 for (
i =
t;
i <
t+filterLength; ++
i) adder += (
int)digits.at(
i);
258 if ( adder > maxAdder ) {
265 for (
t = 0;
t < minW; ++
t) {
267 for (
i =
t;
i <
t+filterLength; ++
i)
268 adder += (
int)digits.at(
i);
270 if ( adder > maxAdder ) {
278 adderFrame = maxAdder;
282 <<
" tMaxFrame=" << tMaxFrame
283 <<
" maxAdder=" << maxAdder
284 <<
" adderWindow=" << adderWindow );
291 ,
int signalStart,
int signalLength,
int &tMax,
int &tMaxFrame,
int &sampleFrame)
const {
293 int t, minW, maxW, sampleWindow;
294 int tm = 0, maxSample = -1;
298 <<
"->" << (signalStart + signalLength) );
303 maxW = signalStart + signalLength;
306 for (
t = minW;
t < maxW; ++
t) {
307 if ((
int) digits.at(
t) > maxSample) {
309 maxSample = (
int) digits.at(
t);
316 for (
t = tm + 1;
t < maxW; ++
t)
317 if ((
int) digits.at(
t) != maxSample)
break;
320 if (
t == 2 && tm == minW) ++tm;
321 else tm += (
t - 1) / 2;
325 sampleWindow = maxSample;
331 for ( ;
t < maxW; ++
t) {
332 if ( (
int)digits.at(
t) > maxSample ) {
334 maxSample = (
int)digits.at(
t);
339 for (
t = 0;
t < minW; ++
t) {
340 if ( (
int)digits.at(
t) > maxSample ) {
342 maxSample = (
int)digits.at(
t);
348 sampleFrame = maxSample;
352 <<
" tMaxFrame=" << tMaxFrame
353 <<
" tMax=" << tMax );
360 ,
int peakPos,
double ped,
double &position)
const {
363 double peak, tmax,
A,
B,
C;
367 <<
" Pedestal " <<
ped );
373 peak = digits.at(peakPos);
376 y_1 = (
int) digits.at(peakPos - 1);
377 y0 = (
int) digits.at(peakPos);
378 y1 = (
int) digits.at(peakPos + 1);
387 tmax = peakPos -
B / (
A * 2.);
388 peak =
C -
B *
B / (
A * 4.);
390 else if ( y_1 == y0 && y0 ==
y1 ) {
407 position = tmax * 25.;
416 int filterStart,
int filterLength,
double ped,
double &position)
const {
423 <<
"->" << (filterStart + filterLength)
424 <<
" pedestal=" <<
ped );
428 for (
t = filterStart;
t < filterStart+filterLength; ++
t)
429 sum += (
int)digits.at(
t);
435 position = (filterStart + (filterLength-1)/2.) * 25.;
439 <<
" position=" << position );
446 ,
int signalStart,
int signalLength,
double ped)
const {
448 int t, tmax = signalStart + signalLength;
449 double position,
val,
sig = 0.0,
sum = 0.0;
453 <<
"->" << (signalStart + signalLength)
454 <<
" pedestal=" <<
ped );
458 for (
t = signalStart;
t < tmax; ++
t) {
464 if (
sig > 0.0 &&
sum > 0) {
467 if (position < tmax) position *= 25.0;
481 ,
const int gain,
double& amplitude,
double&
time)
const {
485 double frameMean = 0.0;
486 double frameRMS = 0.0;
488 double pedestal = 0.0;
493 int adderMaxFrame = 0;
497 int tSampleFrame = 0;
498 int sampleMaxFrame = 0;
510 for (
unsigned i = 0;
i <
samples.size();
i++) {
518 , frameMax, frameMin, frameMean, frameRMS);
532 , tAdder , tAdderFrame, adderMaxFrame);
536 , tSampleFrame, sampleMaxFrame);
559 const int gain,
double& amplitude,
double&
time)
const {
561 std::vector<float> dVec;
564 ATH_MSG_VERBOSE(
"TileRawChannelBuilderFlatFilter - Invoked with vector<int>..");
566 dVec.reserve(digits.size());
568 dVec.push_back((
float) digits[
i]);
virtual StatusCode finalize()
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
int getMaxAdder(const std::vector< float > &digits, int filterLength, int signalStart, int signalLength, int &tMax, int &tMaxFrame, int &adderFrame) const
Get position of maximal adder (sum of <filterLength> samples) in whole frame and in signal window (<s...
const TileHWID * m_tileHWID
virtual StatusCode initialize()
Initializer.
bool msgLvl(const MSG::Level lvl) const
double calculatePeak(const std::vector< float > &digits, int peakPos, double ped, double &position) const
#define ATH_MSG_VERBOSE(x)
bool isSignalInFrame(const std::vector< float > &digits, double deltaCut, double rmsCut, int &frameMax, int &frameMin, double &frameMean, double &frameRMS) const
Find min and max sample Calculate mean and RMS of all samples.
HWIdentifier adc_HWID(void) const
ToolHandle< TileCondToolTiming > m_tileToolTiming
float time(int ind=0) const
virtual StatusCode initialize()
Initializer.
void assign(const HWIdentifier &id, float amplitude, float time, float quality, float ped=0.0)
TileFragHash::TYPE m_rChType
int adc(const HWIdentifier &id) const
extract adc field from HW identifier
#define TILE_FLATFILTERBUILDERVERBOSE
SG::WriteHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
::StatusCode StatusCode
StatusCode definition for legacy code.
ToolHandle< TileCondIdTransforms > m_tileIdTransforms
~TileRawChannelBuilderFlatFilter()
Destructor.
#define CHECK(...)
Evaluate an expression and check for errors.
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
void flatFilter(const std::vector< uint32_t > &digits, const int gain, double &litude, double &time) const
Filter given digits using FlatFilter method.
Helpers for checking error return status codes and reporting errors.
void insertTime(float time)
double getTime(const std::vector< float > &digits, int signalStart, int signalLength, double ped) const
Calculate the time of signal in window of <signalLength> starting at <signalStart> Result is sum of t...
double getPedestal(const std::vector< float > &digits, int pedStart, int pedLgt) const
Calculate pedestal as mean of <pedLgt> samples starting from <pedStart>
double calculateFlatFilter(const std::vector< float > &digits, int filterStart, int filterLength, double ped, double &position) const
Calculate energy using flat filter Sum of <filterLength> samples starting at <filterStart> Requires p...
def time(flags, cells_name, *args, **kw)
a typed memory pool that saves time spent allocation small object. This is typically used by containe...
int getMaxSample(const std::vector< float > &digits, int signalStart, int signalLength, int &tMax, int &tMaxFrame, int &sampleFrame) const
TileRawChannelBuilderFlatFilter(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
virtual TileRawChannel * rawChannel(const TileDigits *digits, const EventContext &ctx)
Builder virtual method to be implemented by subclasses.
std::string to_string(const HWIdentifier &id, int level=0) const
extract all fields from HW identifier HWIdentifier get_all_fields ( const HWIdentifier & id,...
static const InterfaceID & interfaceID()
AlgTool InterfaceID.