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

#include <TileRawChannelBuilderFitFilter.h>

Inheritance diagram for TileRawChannelBuilderFitFilter:
Collaboration diagram for TileRawChannelBuilderFitFilter:

Public Member Functions

 TileRawChannelBuilderFitFilter (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor.
 ~TileRawChannelBuilderFitFilter ()
 Destructor.
virtual StatusCode initialize () override
 Initializer.
virtual StatusCode finalize () override
virtual TileRawChannel * rawChannel (const TileDigits *digits, const EventContext &ctx) override
 Builder virtual method to be implemented by subclasses.
virtual StatusCode createContainer (const EventContext &ctx)
 Create container in SG with name given by parameter (m_rawChannelContainerKey).
virtual StatusCode commitContainer (const EventContext &ctx)
 Commit RawChannelContiner in SG and make const.
void initLog (const EventContext &ctx)
void endLog ()
StatusCode build (const TileDigitsCollection *collection, const EventContext &ctx)
void resetDrawer ()
void resetOverflows (void)
Overflows_t & getOverflowedChannels (void)
std::string getTileRawChannelContainerID (void)
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 ()
 AlgTool InterfaceID.
static double correctAmp (double phase, bool of2=true)
 Amplitude correction factor according to the time when using weights for tau=0 without iterations.
static double correctTime (double phase, bool of2=true)
 Time correction factor.
static int CorruptedData (int ros, int drawer, int channel, int gain, const std::vector< float > &digits, float &dmin, float &dmax, float ADCmaxMinusEps, float ADCmaskValueMinusEps)
static const char * BadPatternName (float ped)

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.

Protected Attributes

SG::ReadHandleKey< TileDQstatus > m_DQstatusKey
SG::ReadHandleKey< TileRawChannelContainer > m_DSPContainerKey {this, "DSPContainer", "", "DSP Container key"}
SG::WriteHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
std::unique_ptr< TileMutableRawChannelContainer > m_rawChannelCnt
TileFragHash::TYPE m_rChType {TileFragHash::Default}
TileRawChannelUnit::UNIT m_rChUnit {TileRawChannelUnit::ADCcounts}
unsigned int m_bsflags {0}
Gaudi::Property< int > m_firstSample {this, "FirstSample", 0, "First sample to start with the analysis"}
Gaudi::Property< bool > m_calibrateEnergy {this, "calibrateEnergy", false, "Calibrate energy"}
Gaudi::Property< bool > m_correctTime {this, "correctTime", false, "Correct time"}
Gaudi::Property< bool > m_useDSP {this, "UseDSPCorrection", true, "Use DSP noise correction for incomplete containers"}
Gaudi::Property< float > m_ampMinThresh
Gaudi::Property< float > m_timeMinThresh
Gaudi::Property< float > m_timeMaxThresh
Gaudi::Property< int > m_runType {this, "RunType", 0, "Run type used to override value of trigType in event"}
const TileID * m_tileID {nullptr}
const TileHWID * m_tileHWID {nullptr}
ToolHandleArray< ITileRawChannelTool > m_noiseFilterTools
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
ToolHandle< TileCondToolTiming > m_tileToolTiming
ToolHandle< TileCondIdTransforms > m_tileIdTransforms
ServiceHandle< TileCablingSvc > m_cablingSvc
 Name of Tile cabling service.
const TileCablingService * m_cabling {nullptr}
 TileCabling instance.
Gaudi::Property< std::vector< int > > m_demoFragIDs
int m_trigType {0}
bool m_idophys {false}
bool m_idolas {false}
bool m_idoped {false}
bool m_idocis {false}
int m_cischan {-1}
double m_capdaq {100.}
unsigned int m_evtCounter {0}
unsigned int m_chCounter {0}
int m_nChL {0}
int m_nChH {0}
double m_RChSumL {0.}
double m_RChSumH {0.}
Overflows_t m_overflows
Gaudi::Property< int > m_dataPoollSize {this, "DataPoolSize", -1, "Data pool size"}
int m_error [MAX_CHANNELS]
int m_lastDrawer {-1}
bool m_badDrawer {false}
bool m_notUpgradeCabling {true}
Gaudi::Property< std::string > m_infoName {this, "TileInfoName", "TileInfo", "Name of TileInfo object"}
const TileInfo * m_tileInfo {nullptr}
int m_i_ADCmax {0}
float m_f_ADCmax {0.f}
int m_i_ADCmaxPlus1 {0}
float m_f_ADCmaxPlus1 {0.f}
float m_ADCmaxMinusEps {0.f}
float m_ADCmaskValueMinusEps {0.f}
 indicates channels which were masked in background dataset

Static Protected Attributes

static const int MAX_CHANNELS = 48
static const int MAX_DMUS = 16

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

void pulseFit (const TileDigits *digit, double &amplitude, double &time, double &pedestal, double &chi2, const EventContext &ctx)
 Calculate energy, time and chi2 for one channel using fitted pulse shape.
double pulse (double x, const std::vector< double > *xvec, const std::vector< double > *yvec, bool zeroOutside=false) const
 pulse interpolation
double scaledPulse (double x, const std::vector< double > *xvec, const std::vector< double > *yvec) const
double derivative (double x, const std::vector< double > *xvec, const std::vector< double > *yvec) const
void fill_drawer_errors (const EventContext &ctx, const TileDigitsCollection *collection)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

Gaudi::Property< bool > m_bestPhase {this, "BestPhase", false, "Use best phase from DB"}
std::vector< double > m_dummy
double m_t0Fit
double m_fnParameters [3] {}
int m_iPeak0
double m_minTime
double m_maxTime
double m_minTau
double m_maxTau
std::vector< double > m_gPhysLo
std::vector< double > m_dgPhysLo
std::vector< double > m_gPhysHi
std::vector< double > m_dgPhysHi
Gaudi::Property< int > m_frameLength {this, "FrameLength", 9, "Frame length (number of samples)"}
Gaudi::Property< int > m_channelNoiseRMS {this, "RMSChannelNoise", 3, "Which channel noise RMS to use"}
Gaudi::Property< int > m_maxIterate {this, "MaxIterate", 9, "Maximum number of fit iterations"}
Gaudi::Property< int > m_extraSamplesLeft {this, "ExtraSamplesLeft", 0, "Increase window on left side"}
Gaudi::Property< int > m_extraSamplesRight {this, "ExtraSamplesRight", 0, "Increase window on right side"}
Gaudi::Property< double > m_saturatedSample {this, "SaturatedSample", -1.0, "Defines the saturated sample"}
Gaudi::Property< double > m_saturatedSampleError
Gaudi::Property< double > m_zeroSampleError
Gaudi::Property< double > m_noiseThresholdRMS
Gaudi::Property< double > m_maxTimeFromPeak
Gaudi::Property< double > m_noiseLow {this, "NoiseLowGain", 0.6, "Default low gain noise"}
Gaudi::Property< double > m_noiseHigh {this, "NoiseHighGain", 1.5, "Default high gain noise"}
const TilePulseShapesStruct * m_pulseShapes
Gaudi::Property< bool > m_disableNegativeAmp {this, "DisableNegativeAmp", false, "Disable negative amplitude"}
Gaudi::Property< int > m_specialDemoShape
ToolHandle< TileCondToolNoiseSample > m_tileToolNoiseSample
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

Detailed Description

Definition at line 32 of file TileRawChannelBuilderFitFilter.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TileRawChannelBuilderFitFilter()

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

Constructor.

Definition at line 41 of file TileRawChannelBuilderFitFilter.cxx.

43 : TileRawChannelBuilder(type, name, parent)
44 , m_t0Fit(0.0)
45 , m_iPeak0(0)
46 , m_minTime(0.0)
47 , m_maxTime(0.0)
48 , m_minTau(0)
49 , m_maxTau(0.0)
50 , m_pulseShapes(0)
51{
52 //declare interfaces
53 declareInterface< TileRawChannelBuilder >( this );
54 declareInterface< TileRawChannelBuilderFitFilter >(this);
55
56 m_rawChannelContainerKey = "TileRawChannelFit";
57}
const TilePulseShapesStruct * m_pulseShapes
SG::WriteHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
TileRawChannelBuilder(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.

◆ ~TileRawChannelBuilderFitFilter()

TileRawChannelBuilderFitFilter::~TileRawChannelBuilderFitFilter ( )

Destructor.

Definition at line 62 of file TileRawChannelBuilderFitFilter.cxx.

62 {
63}

Member Function Documentation

◆ BadPatternName()

const char * TileRawChannelBuilder::BadPatternName ( float ped)
staticinherited

Definition at line 424 of file TileRawChannelBuilder.cxx.

424 {
425 static const char * const errname[26] = {
426 "-10 - good signal",
427 "-9 - underflow",
428 "-8 - overflow",
429 "-7 - underflow and overflow",
430 "-6 - constant signal",
431 "-5 - disconnected channel",
432 "-4 - half a drawer masked",
433 "-3 - bad DQ status",
434 "-2 - underflow in all samples",
435 "-1 - overflow in all samples",
436 "0 - unknown error",
437 "1 - jump from zero to saturation",
438 "2 - samples with zeros",
439 "3 - at least two saturated. others - close to pedestal",
440 "4 - two distinct levels with at least 2 samples each",
441 "5 - pedestal with jump up in one sample",
442 "6 - pedestal with jump down in one sample",
443 "7 - signal with jump up in one sample",
444 "8 - signal with jump down in one sample",
445 "9 - base line above threshold in low gain",
446 "10 - jump down in first sample in low gain",
447 "11 - jump down in last sample in low gain",
448 "12 - jump up in one sample above const",
449 "13 - jump down in one sample below const",
450 "14 - unrecoverable timing jump",
451 "15 - unknown error"
452 };
453
454 return errname[std::min(25, std::max(0, int((ped + 500) * 1e-4)))];
455}

◆ build()

StatusCode TileRawChannelBuilder::build ( const TileDigitsCollection * collection,
const EventContext & ctx )
inherited

Definition at line 458 of file TileRawChannelBuilder.cxx.

459{
460
461 int frag = coll->identify();
462
463 // make sure that error array is up-to-date
464 if (frag != m_lastDrawer && m_notUpgradeCabling) {
465 fill_drawer_errors(ctx, coll);
466 }
467
468 // Iterate over all digits in this collection
469 TileDigitsCollection::const_iterator digitItr = coll->begin();
470 TileDigitsCollection::const_iterator lastDigit = coll->end();
471
472 for (; digitItr != lastDigit; ++digitItr) {
473
474 TileRawChannel* rch = rawChannel((*digitItr), ctx);
475
477
478 int err = m_error[m_tileHWID->channel(rch->adc_HWID())];
479
480 if (err) {
481 if (err == -8 || err == -7) m_overflows.push_back(std::make_pair(rch, (*digitItr)));
482 float ped = rch->pedestal() + 100000 + 10000 * err;
483 rch->setPedestal(ped);
484 if (msgLvl(MSG::VERBOSE) && !m_badDrawer) {
485 if (err < -5) {
486 msg(MSG::VERBOSE) << "BadCh " << m_tileHWID->to_string(rch->adc_HWID())
487 << " warning = " << BadPatternName(ped) << endmsg;
488 } else {
489 msg(MSG::VERBOSE) << "BadCh " << m_tileHWID->to_string(rch->adc_HWID())
490 << " error = " << BadPatternName(ped) << endmsg;
491 }
492 }
493 }
494
495 }
496
497 ATH_CHECK( m_rawChannelCnt->push_back (rch) );
498 }
499
500 IdentifierHash hash = m_rawChannelCnt->hashFunc().hash(coll->identify());
501 TileRawChannelCollection* rawChannelCollection = m_rawChannelCnt->indexFindPtr(hash);
502 rawChannelCollection->setLvl1Id(coll->getLvl1Id());
503 rawChannelCollection->setLvl1Type(coll->getLvl1Type());
504 rawChannelCollection->setDetEvType(coll->getDetEvType());
505 rawChannelCollection->setRODBCID(coll->getRODBCID());
506
507 return StatusCode::SUCCESS;
508}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition DataVector.h:861
static const char * BadPatternName(float ped)
std::unique_ptr< TileMutableRawChannelContainer > m_rawChannelCnt
void fill_drawer_errors(const EventContext &ctx, const TileDigitsCollection *collection)
virtual TileRawChannel * rawChannel(const TileDigits *digits, const EventContext &ctx)
Builder virtual method to be implemented by subclasses.
float pedestal(void) const
void setPedestal(float ped)
void setLvl1Type(uint32_t lvl1Type)
Setter for level1 type from ROD header.
void setLvl1Id(uint32_t lvl1Id)
Setter for level1 id from ROD header.
void setRODBCID(uint32_t rodBCID)
Setter for BCID from ROD header.
void setDetEvType(uint32_t detEvType)
Setter for detector event type from ROD header.
HWIdentifier adc_HWID(void) const
Definition TileRawData.h:53

◆ commitContainer()

StatusCode TileRawChannelBuilder::commitContainer ( const EventContext & ctx)
virtualinherited

Commit RawChannelContiner in SG and make const.

Definition at line 510 of file TileRawChannelBuilder.cxx.

511{
512
513 const TileDQstatus* DQstatus = SG::makeHandle (m_DQstatusKey, ctx).get();
514
515 ToolHandleArray<ITileRawChannelTool>::iterator itrTool = m_noiseFilterTools.begin();
516 ToolHandleArray<ITileRawChannelTool>::iterator endTool = m_noiseFilterTools.end();
517
518 if ( m_useDSP && !m_DSPContainerKey.key().empty() &&
519 (DQstatus->incompleteDigits() || m_chCounter<12288) && itrTool!=endTool )
520 {
521 const TileRawChannelContainer * dspCnt = SG::makeHandle (m_DSPContainerKey, ctx).get();
522 ATH_MSG_DEBUG( "Incomplete container - use noise filter corrections from DSP container" );
523
524 uint32_t bsFlags = dspCnt->get_bsflags();
525 std::vector<IdentifierHash> hashes = m_rawChannelCnt->GetAllCurrentHashes();
526 std::vector<IdentifierHash> dspHashes = dspCnt->GetAllCurrentHashes();
527 if (bsFlags == 0) {
528 ATH_MSG_WARNING("Problem in applying noise corrections: DSP container ("
529 << m_DSPContainerKey.key() << ") seems to be emtpy!");
530 } else if (hashes != dspHashes) {
531 ATH_MSG_ERROR( " Error in applying noise corrections; "
532 "hash vectors do not match.");
533 } else {
534 // Go through all TileRawChannelCollections
535 for (IdentifierHash hash : hashes) {
536 TileRawChannelCollection* coll = m_rawChannelCnt->indexFindPtr (hash);
537 const TileRawChannelCollection* dcoll = dspCnt->indexFindPtr (hash);
538
539 if (coll->identify() != dcoll->identify()) {
540
541 ATH_MSG_ERROR( " Error in applying noise corrections " << MSG::hex
542 << " collection IDs 0x" << coll->identify() << " and 0x" << dcoll->identify()
543 << " do not match " << MSG::dec );
544 break;
545 }
546
547 // iterate over all channels in a collection
550
551 for (TileRawChannel* rch : *coll) {
552 HWIdentifier adc_id = rch->adc_HWID();
553 while (dspItr != dspLast && adc_id != (*dspItr)->adc_HWID()) {
554 ++dspItr;
555 }
556 if (dspItr != dspLast) {
557 float corr = (*dspItr)->pedestal();
558 ATH_MSG_VERBOSE( "Ch "<<m_tileHWID->to_string(adc_id)
559 <<" amp " << rch->amplitude() << " ped " << rch->pedestal()
560 << " corr " << corr );
561 if (corr<10000.) {
562 rch->setAmplitude (rch->amplitude() - corr); // just baseline shift
563 rch->setPedestal (rch->pedestal() + corr); // just baseline shift
564 } else {
565 float ped = rch->pedestal();
566 if (corr > ped) {
567 rch->setPedestal (fmod(ped,10000.) + int(corr)/10000 * 10000); // changing error status
568 ATH_MSG_VERBOSE( "New error status in ped "<<rch->pedestal());
569 }
570 }
571 } else {
572 ATH_MSG_WARNING(" Problem in applying noise corrections "
573 << " can not find channel in DSP container with HWID "
574 << m_tileHWID->to_string(adc_id) );
575 dspItr = dcoll->begin();
576 }
577 }
578 }
579 }
580
581 } else {
582
583 for (ToolHandle<ITileRawChannelTool>& noiseFilterTool : m_noiseFilterTools) {
584 if (noiseFilterTool->process(*m_rawChannelCnt.get(), ctx).isFailure()) {
585 ATH_MSG_ERROR( " Error status returned from noise filter " );
586 } else {
587 ATH_MSG_DEBUG( "Noise filter applied to the container" );
588 }
589 }
590
591 }
592
593 ATH_MSG_DEBUG( " nCh=" << m_chCounter
594 << " nChH/L=" << m_nChH << "/" << m_nChL
595 << " RChSumH/L=" << m_RChSumH << "/" << m_RChSumL );
596
597 SG::WriteHandle<TileRawChannelContainer> rawChannelsContainer(m_rawChannelContainerKey, ctx);
598 ATH_CHECK( rawChannelsContainer.record(std::move(m_rawChannelCnt)) );
599
600 endLog();
601
602 return StatusCode::SUCCESS;
603}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current TileRawChannelContainer
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
virtual std::vector< IdentifierHash > GetAllCurrentHashes() const override final
Returns a collection of all hashes availiable in this IDC.
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
bool incompleteDigits() const
A few extra items (from TileBeamInfoProvider).
Gaudi::Property< bool > m_useDSP
SG::ReadHandleKey< TileDQstatus > m_DQstatusKey
SG::ReadHandleKey< TileRawChannelContainer > m_DSPContainerKey
ToolHandleArray< ITileRawChannelTool > m_noiseFilterTools
uint32_t get_bsflags() const
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
setEventNumber uint32_t

◆ correctAmp()

double TileRawChannelBuilder::correctAmp ( double phase,
bool of2 = true )
staticinherited

Amplitude correction factor according to the time when using weights for tau=0 without iterations.

Definition at line 612 of file TileRawChannelBuilder.cxx.

612 {
613
614 double corr = 1.0;
615 if (of2) {
616 // estimation from Belen for rel 14.0.0
617 /*double a,b,c;
618 if(fabs(phase)<5.){
619 a=0.137; b=0.0877; c=0.0865;
620 }else{
621 a=0.565; b=0.116; c=0.0751;
622 }
623 corr=(1+(a+b*phase+c*phase*phase)/100.);
624 */
625
626 // estimation from Vakhtang for rel 14.4.0
627 /*double k = (phase < 0.0 ? 0.0009400 : 0.0010160);
628 corr = (1.0 + k * phase * phase);
629 */
630
631 // Parabolic correction from Tigran
632 double a1,a2,b,c;
633 a1 = phase < 0.0 ? 0.000940774 : 0.00102111;
634 a2 = phase < 0.0 ? 0.000759051 : 0.000689625;
635 b = phase < 0.0 ? -2.0 * 7.0 * (a1 - a2) : 2.0 * 12.5 * (a1 - a2);
636 c = phase < 0.0 ? 1.0 - 7.0 * 7.0 * (a1-a2) : 1.0 - 12.5 * 12.5 * (a1-a2);
637 if (phase < 12.5 && phase > -7.0) corr = a1 * phase * phase + 1.0;
638 else corr = phase * ( a2 * phase + b) + c;
639
640
641 } else {
642 /*double a,b,c;
643 if(phase<0){
644 a=1.0002942; b=0.0003528; c=0.0005241;
645 }else{
646 a=1.0001841; b=-0.0004182; c=0.0006167;
647 }
648 corr = a + phase * ( b + c * phase);
649 */
650
651 /*double k = (phase < 0.0 ? 0.0005241 : 0.0006167);
652 corr = (1.0 + k * phase * phase);
653 */
654
655 // 4th degree polynomial correction from Tigran
656 double k1 = (phase < 0.0 ? -0.0000326707:0.000380336);
657 double k2 = (phase < 0.0 ? -0.000560962:-0.000670487);
658 double k3 = (phase < 0.0 ? -0.00000807869:0.00000501773);
659 double k4 = (phase < 0.0 ? -0.000000145008:0.0000000584647);
660
661 corr = 1.0 / (1.0 + (k1 + (k2 + (k3 + k4 *phase)*phase)*phase)*phase);
662
663
664 }
665
666 return corr;
667}

◆ correctTime()

double TileRawChannelBuilder::correctTime ( double phase,
bool of2 = true )
staticinherited

Time correction factor.

Definition at line 671 of file TileRawChannelBuilder.cxx.

671 {
672
673 double correction = 0.0;
674
675 if (of2) {
676 if(phase < 0) {
677 correction = (-0.00695743 + (0.0020673 - (0.0002976 + 0.00000361305 * phase) * phase) * phase) * phase;
678 } else {
679 correction = (0.0130013 + (0.00128769 + (-0.000550218 + 0.00000755344 * phase) * phase) * phase) * phase;
680 }
681 }
682 // OF1 does not need correction
683
684 return correction;
685}
correction(mu, runmode, campaign, run=None)
Definition zlumi_mc_cf.py:4

◆ CorruptedData()

int TileRawChannelBuilder::CorruptedData ( int ros,
int drawer,
int channel,
int gain,
const std::vector< float > & digits,
float & dmin,
float & dmax,
float ADCmaxMinusEps,
float ADCmaskValueMinusEps )
staticinherited

Definition at line 689 of file TileRawChannelBuilder.cxx.

690 {
691 bool eb = (ros > 2);
692 bool ebsp = ((ros == 3 && drawer == 14) || (ros == 4 && drawer == 17));
693 bool empty = ((eb && ((channel > 23 && channel < 30) || channel > 41)) || (ebsp && channel < 3));
694 bool not_gap = !(empty || (eb && (channel == 0 || channel == 1 || channel == 12 || channel == 13))
695 || (ebsp && (channel == 18 || channel == 19)));
696
697 const float epsilon = 4.1; // allow +/- 2 counts fluctuations around const value
698 const float delta[4] = { 29.9, 29.9, 49.9, 99.9 }; // jump levels between constLG, constHG, non-constLG, non-constHG
699 const float level1 = 99.9; // jump from this level to m_i_ADCmax is bad
700 const float level2 = 149.9; // base line at this level in low gain is bad
701 const float narrowLevel[2] = { 29.9, 49.9 }; // minimal amplitude for narrow pulses
702 const float delt = std::min(std::min(std::min(delta[0], delta[1]), std::min(delta[2], delta[3])),
703 std::min(narrowLevel[0], narrowLevel[1]));
704 const float secondMaxLevel = 0.3;
705
706 int error = 0;
707
708 unsigned int nSamp = digits.size();
709 if (nSamp) {
710 dmin = dmax = digits[0];
711 unsigned int pmin = 0;
712 unsigned int pmax = 0;
713 unsigned int nzero = (dmin < 0.01) ? 1 : 0;
714 unsigned int nover = (dmax > ADCmaxMinusEps) ? 1 : 0;
715
716 for (unsigned int i = 1; i < nSamp; ++i) {
717 float dig = digits[i];
718 if (dig > dmax) {
719 dmax = dig;
720 pmax = i;
721 } else if (dig < dmin) {
722 dmin = dig;
723 pmin = i;
724 }
725 if (dig < 0.01) ++nzero;
726 else if (dig > ADCmaxMinusEps) ++nover;
727 }
728
729 float dmaxmin = dmax - dmin;
730 //std::cout << " ros " << ros << " drawer " << drawer << " channel " << channel << " not_gap " << not_gap << " nzero " << nzero << " nover " << nover << std::endl;
731
732 if (dmin > ADCmaxMinusEps) { // overflow in all samples
733 error = (dmin > ADCmaskValueMinusEps) ? -3 : -1; // dmin=m_tileInfo->ADCmaskValue() - masking in overlay job (set in TileDigitsMaker)
734
735 } else if (dmax < 0.01) { // underflow in all samples
736 error = (empty) ? -5 : -2; // set different type of errors for exsiting and non-existing channels
737
738 } else if (dmaxmin < 0.01) { // constant value in all samples
739 error = -6;
740
741 } else if (nzero && nover) { // jump from zero to saturation
742 error = 1;
743
744 } else if ((nzero && (not_gap || empty)) || nzero > 1) { // one sample at zero in normal channel
745 error = 2; // or 2 samples at zero in gap/crack/MBTS
746
747 } else if (gain == 0 && dmin > level2) { // baseline above threshold in low gain is bad
748 error = 9;
749
750 } else if (dmaxmin > delt) { // check that max-min is above minimal allowed jump
751
752 float abovemin = dmax;
753 float belowmax = dmin;
754 unsigned int nmin = 0;
755 unsigned int nmax = 0;
756 for (unsigned int i = 0; i < nSamp; ++i) {
757 float smp = digits[i];
758 if (smp - dmin < epsilon) {
759 ++nmin;
760 }
761 if (dmax - smp < epsilon) {
762 ++nmax;
763 }
764 if (smp < abovemin && smp > dmin) {
765 abovemin = smp;
766 }
767 if (smp > belowmax && smp < dmax) {
768 belowmax = smp;
769 }
770 }
771 // more than two different values - shift index by 2, i.e. use thresholds for non-const levels
772 int gainInd = (abovemin != dmax || belowmax != dmin) ? gain + 2 : gain;
773 bool big_jump = (dmaxmin > delta[gainInd]);
774 bool max_in_middle = (pmax > 0 && pmax < nSamp - 1);
775 bool min_in_middle = (pmin > 0 && pmin < nSamp - 1);
776
777 if (nover > 1 && belowmax < level1) { // at least two saturated. others - close to pedestal
778 error = 3;
779 } else if (nmax + nmin == nSamp && big_jump) {
780 if (nmax > 1 && nmin > 1) { // at least 2 samples at two distinct levels
781 error = 4;
782 } else if (nmax == 1) {
783 if (max_in_middle) { // jump up in one sample, but not at the edge
784 error = 5;
785 }
786 } else if (nmin == 1) { // jump down in one sample
787 error = 6;
788 }
789 }
790 if (error == 0 && dmaxmin > narrowLevel[gain]) {
791 float secondMax = dmaxmin * secondMaxLevel;
792 float dminPlus = dmin + secondMax;
793 float dmaxMinus = dmax - secondMax;
794 if (not_gap) { // jumps above two (or one) neighbour samples
795 if (max_in_middle && std::max(digits[pmax - 1], digits[pmax + 1]) < dminPlus) {
796 error = 7; // jump up in one sample in the middle, which is much higher than two neighbours
797 } else if (min_in_middle && std::min(digits[pmin - 1], digits[pmin + 1]) > dmaxMinus) {
798 error = 8; // jump down in one sample, which is much lower than two neighbours
799 } else if (big_jump && gain == 0) { // check first and last sample only in low gain
800 if (pmin == 0 && digits[1] > dmax - secondMax) {
801 error = 10; // jump down in first sample. which is much lower than next one
802 } else if (pmin == nSamp - 1 && digits[pmin - 1] > dmax - secondMax) {
803 error = 11; // jump down in last sample. which is much lower than previous one
804 }
805 }
806 }
807 if (!error && big_jump) { // jumps above all samples
808 if ((max_in_middle || gain == 0) && nmax == 1 && belowmax < dminPlus) {
809 error = 12; // jump up in one sample in the middle, which is much higher than all others
810 } else if ((min_in_middle || gain == 0) && nmin == 1 && abovemin > dmaxMinus) {
811 error = 13; // jump down in one sample, which is much lower than all others (
812 }
813 }
814 }
815 }
816
817 } else {
818 dmin = dmax = 0.0;
819 }
820
821 return error;
822}
const int nmax(200)
static const Attributes_t empty

◆ createContainer()

StatusCode TileRawChannelBuilder::createContainer ( const EventContext & ctx)
virtualinherited

Create container in SG with name given by parameter (m_rawChannelContainerKey).

Definition at line 199 of file TileRawChannelBuilder.cxx.

199 {
200 initLog(ctx);
201
202 // create TRC container
203 m_rawChannelCnt = std::make_unique<TileMutableRawChannelContainer>(true, m_rChType, m_rChUnit, SG::VIEW_ELEMENTS);
204 ATH_CHECK( m_rawChannelCnt->status() );
205 m_rawChannelCnt->set_bsflags(m_bsflags);
206
207 ATH_MSG_DEBUG( "Created TileRawChannelContainer '" << m_rawChannelContainerKey.key() << "'" );
208
209 return StatusCode::SUCCESS;
210}
TileRawChannelUnit::UNIT m_rChUnit
void initLog(const EventContext &ctx)
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts

◆ 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 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

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

◆ derivative()

double TileRawChannelBuilderFitFilter::derivative ( double x,
const std::vector< double > * xvec,
const std::vector< double > * yvec ) const
inlineprivate

Definition at line 66 of file TileRawChannelBuilderFitFilter.h.

66 {
67 return pulse(x, xvec, yvec, true);
68 }
#define x
double pulse(double x, const std::vector< double > *xvec, const std::vector< double > *yvec, bool zeroOutside=false) const
pulse interpolation

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

◆ endLog()

void TileRawChannelBuilder::endLog ( )
inherited

Definition at line 605 of file TileRawChannelBuilder.cxx.

605 {
606 m_chCounter = 0;
607 m_nChL = m_nChH = 0;
608 m_RChSumL = m_RChSumH = 0.0;
609
610}

◆ 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

◆ fill_drawer_errors()

void TileRawChannelBuilder::fill_drawer_errors ( const EventContext & ctx,
const TileDigitsCollection * collection )
privateinherited

Definition at line 266 of file TileRawChannelBuilder.cxx.

268{
269 const TileDQstatus* DQstatus = SG::makeHandle (m_DQstatusKey, ctx).get();
270
271 int frag = coll->identify();
272 int ros = (frag >> 8);
273 int drawer = (frag & 0xff);
274
275 m_lastDrawer = frag;
276
277 memset(m_error, 0, sizeof(m_error));
278 int dmuerr[MAX_DMUS] = {0};
279 int nch = 0;
280 bool bigain = DQstatus->isBiGain();
281 if (!bigain) { // in bigain runs we don't have DQ status fragment
282 for (int ch = 0; ch < MAX_CHANNELS; ch += 3) {
283 if (!DQstatus->isAdcDQgood(ros, drawer, ch, 0)) {
284 m_error[ch + 2] = m_error[ch + 1] = m_error[ch] = -3;
285 dmuerr[ch / 3] = 3;
286 nch += 3;
287 }
288 }
289 }
290 if (nch == MAX_CHANNELS) { // all bad - nothing to do
291 m_badDrawer = true;
292 ATH_MSG_VERBOSE( "Drawer 0x" << MSG::hex << frag << MSG::dec
293 << " is bad - skipping bad patterns check " );
294 return;
295 } else {
296 m_badDrawer = false;
297 ATH_MSG_VERBOSE( "Drawer 0x" << MSG::hex << frag << MSG::dec
298 << " looking for bad patterns in digits" );
299 }
300
301 float mindig, maxdig;
302 int nchbad[2] = { 0, 0 };
303
304 // Iterate over all digits in this collection
305 TileDigitsCollection::const_iterator digitItr = coll->begin();
306 TileDigitsCollection::const_iterator lastDigit = coll->end();
307
308 for (; digitItr != lastDigit; ++digitItr) {
309 const TileDigits * pDigits = (*digitItr);
310 HWIdentifier adcId = pDigits->adc_HWID();
311 int channel = m_tileHWID->channel(adcId);
312 int gain = m_tileHWID->adc(adcId);
313
314 if (m_error[channel]) {
315 ATH_MSG_VERBOSE( "BadCh " << ros
316 << "/" << drawer
317 << "/" << channel
318 << "/" << gain << " BAD DQ STATUS ");
319
320 } else {
321
322 int err = CorruptedData(ros, drawer, channel, gain, pDigits->samples(), mindig, maxdig, m_ADCmaxMinusEps, m_ADCmaskValueMinusEps);
323
324 if (err) {
325
327 if (err > -5) {
328 ++dmuerr[channel / 3];
329 ++nchbad[channel / 24];
330 }
331
332 if (msgLvl(MSG::VERBOSE)) {
333
334 msg(MSG::VERBOSE) << "BadCh " << ros
335 << "/" << drawer
336 << "/" << channel
337 << "/" << gain;
338 if (err < -5) msg(MSG::VERBOSE) << " Warning " << err;
339 else msg(MSG::VERBOSE) << " Error " << err;
340 if (mindig > m_ADCmaskValueMinusEps) msg(MSG::VERBOSE) << " BADDQ";
341 if (maxdig > m_ADCmaxMinusEps) msg(MSG::VERBOSE) << " Overflow";
342 if (mindig < 0.1) msg(MSG::VERBOSE) << " Underflow";
343 if (err < 0) msg(MSG::VERBOSE) << " Const";
344
345 msg(MSG::VERBOSE) << " samp=";
346 std::vector<float> digits = pDigits->samples();
347 for (unsigned int i = 0; i < digits.size(); ++i) {
348 msg(MSG::VERBOSE) << " " << digits[i];
349 }
350 msg(MSG::VERBOSE) << endmsg;
351 }
352
353 } else {
354 if (mindig < 0.01) err += 1;
355 if (maxdig > m_ADCmaxMinusEps) err += 2;
356 if (err) m_error[channel] = err - 10;
357 }
358 }
359 }
360
361 // check if we want to mask half a drawer
362 // in this case set error = -4 for channels which were good before
363
364 int ndmubad[2] = { 0, 0 };
365 int dmu = 0;
366 for (; dmu < MAX_DMUS / 2; ++dmu) { // first half
367 if (dmuerr[dmu] > 1)
368 ++ndmubad[0]; // count DMUs with at least two bad channels
369 }
370 for (; dmu < MAX_DMUS; ++dmu) { // second half
371 if (dmuerr[dmu] > 1)
372 ++ndmubad[1]; // count DMUs with at least two bad channels
373 }
374
375 int ndmulimit[2] = { 3, 3 }; // max number of bad DMUs when half-drawer is not yet masked
376 // if 4 DMUs will be bad - mask whole half-drawer
377 if (frag > 0x2ff) { // if extended barrel
378 if (frag == 0x30e || frag == 0x411)
379 ndmulimit[0] = 4; // in EB special one DMU is always bad (missing)
380 ndmulimit[1] = 5; // in second half of EB 4 DMUs ara always bad (missing)
381 // only if 7 DMUs are bad, mask whole half-drawer
382 }
383
384 bool printall = true;
385 for (int p = 0; p < 2; ++p) {
386 if (ndmubad[p] > ndmulimit[p] && nchbad[p] > 0) {
387 if (msgLvl(MSG::VERBOSE)) {
388 msg(MSG::VERBOSE) << "Drawer 0x" << MSG::hex << frag << MSG::dec
389 << " masking whole " << ((p) ? "second" : "first")
390 << " half" << endmsg;
391 if (printall) {
392 msg(MSG::VERBOSE) << "nDMuErr ";
393 for (int d = 0; d < MAX_DMUS; ++d) {
394 msg(MSG::VERBOSE) << " " << dmuerr[d];
395 }
396 msg(MSG::VERBOSE) << " total " << ndmubad[p] << " errors" << endmsg;
397
398 msg(MSG::VERBOSE) << "ChErr ";
399 int ch = 0;
400 while (ch < MAX_CHANNELS-2) {
401 msg(MSG::VERBOSE) << " " << m_error[ch++];
402 msg(MSG::VERBOSE) << " " << m_error[ch++];
403 msg(MSG::VERBOSE) << " " << m_error[ch++];
404 msg(MSG::VERBOSE) << " ";
405 }
406
407 msg(MSG::VERBOSE) << " total " << nchbad[p]
408 << " bad patterns" << endmsg;
409 printall = false;
410 }
411 }
412 int ch = (p) ? MAX_CHANNELS / 2 : 0;
413 int chmax = (p) ? MAX_CHANNELS : MAX_CHANNELS / 2;
414 for (; ch < chmax; ++ch) {
415 if (m_error[ch] == 0 || m_error[ch] < -5) { // channel was good before
416 m_error[ch] = -4;
417 }
418 }
419 }
420 }
421
422}
bool isAdcDQgood(int partition, int drawer, int ch, int gain) const
returns status of single ADC returns False if there are any errors
bool isBiGain() const
returns gain mode of run
const std::vector< float > & samples() const
Definition TileDigits.h:58
float m_ADCmaskValueMinusEps
indicates channels which were masked in background dataset
static int CorruptedData(int ros, int drawer, int channel, int gain, const std::vector< float > &digits, float &dmin, float &dmax, float ADCmaxMinusEps, float ADCmaskValueMinusEps)

◆ finalize()

StatusCode TileRawChannelBuilderFitFilter::finalize ( )
overridevirtual

Reimplemented from TileRawChannelBuilder.

Definition at line 187 of file TileRawChannelBuilderFitFilter.cxx.

187 {
188
189 ATH_MSG_DEBUG( "Finalizing" );
190 return StatusCode::SUCCESS;
191}

◆ getOverflowedChannels()

Overflows_t & TileRawChannelBuilder::getOverflowedChannels ( void )
inherited

Definition at line 37 of file TileRawChannelBuilder.cxx.

37 {
38 return m_overflows;
39}

◆ getTileRawChannelContainerID()

std::string TileRawChannelBuilder::getTileRawChannelContainerID ( void )
inherited

Definition at line 41 of file TileRawChannelBuilder.cxx.

41 {
42 return m_rawChannelContainerKey.key();
43}

◆ initialize()

StatusCode TileRawChannelBuilderFitFilter::initialize ( )
overridevirtual

Initializer.

Reimplemented from TileRawChannelBuilder.

Definition at line 68 of file TileRawChannelBuilderFitFilter.cxx.

68 {
69
70 ATH_MSG_INFO( "TileRawChannelBuilderFitFilter::initialize()" );
71
73
74 // init in superclass
76 ATH_CHECK( m_tileToolNoiseSample.retrieve() );
77
78 if (m_bestPhase) {
79 //=== get TileToolTiming
80 // TileToolTiming can be disabled in the TileRawChannelBuilder
81 if (!m_tileToolTiming.isEnabled()) {
82 m_tileToolTiming.enable();
83 }
84 ATH_CHECK( m_tileToolTiming.retrieve() );
85 }
86
87 // Get number of samples from TileInfo - ignore jobOptions settings
88 m_frameLength = m_tileInfo->NdigitSamples();
89 ATH_MSG_DEBUG( "NSamples = " << m_frameLength.value() );
90
91 // Get pulse shapes from TileInfo
92 m_pulseShapes = m_tileInfo->getPulseShapes();
93
94 // Determine peak sample position
95 // peak sample position defines t=0
96 // m_iPeak0 = (int) (m_frameLength) / 2 + (m_frameLength % 2) - 1;
97 m_iPeak0 = (int) m_tileInfo->ItrigSample();
98
99 // Min and max time are now calculated based on m_framelength - i.e. on the
100 // number of 25 ns samples read out. Don't forget t=0 corresponds to
101 // m_ipeak0-th sample
104 // maximal jump during one iteration
107
108 ATH_MSG_DEBUG( " ipeak0=" << m_iPeak0
109 << " min_time=" << m_minTime
110 << " max_time=" << m_maxTime
111 << " min_tau=" << m_minTau
112 << " max_tau=" << m_maxTau );
113
114 if ( !m_demoFragIDs.empty() ) {
115 switch (m_specialDemoShape.value()) {
116 case 1:
117 ATH_MSG_DEBUG( "Demonstrator channels use pulse shape from physics structures"); break;
118 case 2:
119 ATH_MSG_DEBUG( "Demonstrator channels use pulse shape from laser structures"); break;
120 case 3:
121 ATH_MSG_DEBUG( "Demonstrator channels use pulse shape from laser(for 100pF) and physics(for 5.2pF) structures"); break;
122 case 8:
123 ATH_MSG_DEBUG( "Demonstrator channels use pulse shape from cis structures"); break;
124 default:
125 ATH_MSG_DEBUG( "Demonstrator channels use the same pulse shape as legacy"); break;
126 }
127 }
128
129 // Speedup for physics processing (max_iter=1):
130 // read initial pulse shapes into arrays
131 m_fnParameters[0] = 0.0;
132 m_fnParameters[1] = 0.0;
133 m_fnParameters[2] = 1.0;
134 m_t0Fit = 0.0;
135
136 m_gPhysLo.reserve(m_frameLength);
137 m_dgPhysLo.reserve(m_frameLength);
138 m_gPhysHi.reserve(m_frameLength);
139 m_dgPhysHi.reserve(m_frameLength);
140
141 double rsamp;
142 for (int isamp = 0; isamp < m_frameLength; ++isamp) {
143 rsamp = (isamp) * 1.0;
144 m_gPhysLo.push_back(scaledPulse(rsamp, &(m_pulseShapes->m_tlphys), &(m_pulseShapes->m_ylphys)));
145 m_dgPhysLo.push_back(pulse(rsamp, &(m_pulseShapes->m_tdlphys), &(m_pulseShapes->m_ydlphys)));
146 m_gPhysHi.push_back(scaledPulse(rsamp, &(m_pulseShapes->m_thphys), &(m_pulseShapes->m_yhphys)));
147 m_dgPhysHi.push_back(pulse(rsamp, &(m_pulseShapes->m_tdhphys), &(m_pulseShapes->m_ydhphys)));
148 }
149
152 }
153
154 if (msgLvl(MSG::DEBUG)) {
155 switch (m_channelNoiseRMS.value()) {
156 case 1:
157 msg(MSG::DEBUG) << " noise for all channels from noiseOrig array (OBSOLETE!!!) " << endmsg;
158 break;
159 case 2:
160 msg(MSG::DEBUG) << " noise for all channels from noiseNk array (OBSOLETE!!!) " << endmsg;
161 break;
162 case 3:
163 msg(MSG::DEBUG) << " noise for all channels from Conditions DB ";
164 if (m_cabling->getTestBeam()) {
165 const EventContext &ctx = Gaudi::Hive::currentContext();
166 msg(MSG::DEBUG) << " rmsLow(LBA01/0) = " << m_tileToolNoiseSample->getHfn(20, 0, TileID::LOWGAIN, TileRawChannelUnit::ADCcounts, ctx)
167 << " rmsHi(LBA01/0) = " << m_tileToolNoiseSample->getHfn(20, 0, TileID::HIGHGAIN, TileRawChannelUnit::ADCcounts, ctx)
168 << endmsg;
169 } else {
170 msg(MSG::DEBUG) << endmsg;
171 }
172 break;
173 default:
174 msg(MSG::DEBUG) << " common noise for all channels (OBSOLETE): " << endmsg;
175 msg(MSG::DEBUG) << " rmsLow = " << m_noiseLow.value()
176 << " rmsHi = " << m_noiseHigh.value() << endmsg;
177 break;
178 }
179 }
180
181 // TileInfo
183
184 return StatusCode::SUCCESS;
185}
#define ATH_MSG_INFO(x,...)
double scaledPulse(double x, const std::vector< double > *xvec, const std::vector< double > *yvec) const
ToolHandle< TileCondToolNoiseSample > m_tileToolNoiseSample
ToolHandle< TileCondToolTiming > m_tileToolTiming
const TileCablingService * m_cabling
TileCabling instance.
virtual StatusCode initialize()
Initializer.
Gaudi::Property< std::vector< int > > m_demoFragIDs
MsgStream & msg
Definition testRead.cxx:32

◆ initLog()

void TileRawChannelBuilder::initLog ( const EventContext & ctx)
inherited

Definition at line 212 of file TileRawChannelBuilder.cxx.

212 {
213
214 const TileDQstatus* DQstatus = SG::makeHandle (m_DQstatusKey, ctx).get();
215
216 // update only if there is new event
217 if (m_evtCounter != ctx.evt()) {
218
219 m_evtCounter = ctx.evt();
220 if (m_runType != 0) m_trigType = m_runType;
221 else m_trigType = DQstatus->trigType();
222
223 if (0 == m_trigType) {
224 m_idophys = (DQstatus->calibMode() == 0);
225 m_idolas = false;
226 m_idoped = false;
227 m_idocis = (DQstatus->calibMode() == 1);
228 } else {
229 m_idophys = (m_trigType <= 1);
230 m_idolas = ((m_trigType == 2) || (m_trigType == 3));
231 m_idoped = ((m_trigType == 4) || (m_trigType == 5));
232 m_idocis = ((m_trigType == 8) || (m_trigType == 9));
233 }
234
235 const unsigned int *cispar = DQstatus->cispar();
236 if (0 == cispar[7]) { // if capdaq not set, it can't be CIS event
237 if (m_idocis) { // cis flag was set incorrectly, change to ped
238 m_idoped = true;
239 m_idocis = false;
240 }
241 m_capdaq = 0.0;
242 } else {
243 m_capdaq = (cispar[7] < 10) ? 5.2 : 100.0;
244 }
245 m_cischan = cispar[8] - 1; // channel where CIS is fired (-1 = all channels)
246
247 ATH_MSG_DEBUG( "Trig type is " << m_trigType
248 << "; dophys is " << ((m_idophys) ? "true" : "false")
249 << "; dolas is " << ((m_idolas) ? "true" : "false")
250 << "; doped is " << ((m_idoped) ? "true" : "false")
251 << "; docis is " << ((m_idocis) ? "true" : "false")
252 << "; capacitor is " << m_capdaq
253 << "; cis chan is " << m_cischan );
254 }
255}
int trigType() const
Trigger type.
uint32_t calibMode() const
Calibration mode.
const uint32_t * cispar() const
CIS parameters.
Gaudi::Property< int > m_runType

◆ 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 & TileRawChannelBuilderFitFilter::interfaceID ( )
static

AlgTool InterfaceID.

Definition at line 33 of file TileRawChannelBuilderFitFilter.cxx.

33 {
35 //return TileRawChannelBuilder::interfaceID();
36}
static const InterfaceID IID_ITileRawChannelBuilderFitFilter("TileRawChannelBuilderFitFilter", 1, 0)

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

◆ pulse()

double TileRawChannelBuilderFitFilter::pulse ( double x,
const std::vector< double > * xvec,
const std::vector< double > * yvec,
bool zeroOutside = false ) const
private

pulse interpolation

Definition at line 1559 of file TileRawChannelBuilderFitFilter.cxx.

1560 {
1561
1562 int size1 = xvec->size() - 1;
1563 if (size1 < 1) return 0.0;
1564
1565 const double delta = 1.e-6;
1566
1567 double xpmin = xvec->at(0);
1568 double xpmax = xvec->at(size1);
1569
1570 double xp = (x - m_iPeak0) * DTIME - m_t0Fit - m_fnParameters[0];
1571
1572 double val = 0.0;
1573 double tdiv = (xpmax - xpmin) / size1;
1574
1575 if (xp < xpmin + delta) {
1576 if (zeroOutside && xp < xpmin - delta)
1577 val = 0.0;
1578 else
1579 val = yvec->at(0);
1580#ifdef EXTRAPOLATE_TO_ZERO
1581 if (xp < xpmin - delta && val != 0.0) {
1582 double newval = val + ((yvec->at(1) - val) / tdiv) * (xp - xpmin);
1583 if (val * newval < 0.0) {
1584 val = 0.0;
1585 } else if (fabs(newval) < fabs(val)) {
1586 val = newval;
1587 }
1588 }
1589#endif
1590 } else if (xp > xpmax - delta) {
1591 if (zeroOutside && xp > xpmax + delta)
1592 val = 0.0;
1593 else
1594 val = yvec->at(size1);
1595#ifdef EXTRAPOLATE_TO_ZERO
1596 if (xp > xpmax + delta && val != 0.0) {
1597 double newval = val + ((yvec->at(size1 - 1) - val) / tdiv) * (xp - xpmax);
1598 if (val * newval < 0.0) {
1599 val = 0.0;
1600 } else if (fabs(newval) < fabs(val)) {
1601 val = newval;
1602 }
1603 }
1604#endif
1605 } else {
1606 int j = (int) ((xp - xpmin) / tdiv);
1607 val = yvec->at(j) + ((yvec->at(j + 1) - yvec->at(j)) / tdiv) * (xp - xvec->at(j));
1608 }
1609
1610 return val;
1611}
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)

◆ pulseFit()

void TileRawChannelBuilderFitFilter::pulseFit ( const TileDigits * digit,
double & amplitude,
double & time,
double & pedestal,
double & chi2,
const EventContext & ctx )
private

Calculate energy, time and chi2 for one channel using fitted pulse shape.

Method uses HFITV.

Parameters
samplesTileDigits

Definition at line 267 of file TileRawChannelBuilderFitFilter.cxx.

268 {
269
270 amplitude = 0.0;
271 time = 0.0;
272 pedestal = 0.0;
273 chi2 = MAX_CHI2;
274
275 const HWIdentifier adcId = digit->adc_HWID();
276 int ros = m_tileHWID->ros(adcId);
277 int channel = m_tileHWID->channel(adcId);
278 int igain = m_tileHWID->adc(adcId);
279
280 int drawer = m_tileHWID->drawer(adcId);
281 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
282
283 bool demo = (m_specialDemoShape > 0) && std::binary_search(m_demoFragIDs.begin(), m_demoFragIDs.end(), (ros << 8) | drawer);
284
285 // Estimate channel noise
286 double rms = 0.0;
287 int noise_channel = (ros < 3) ? channel : channel + 48;
288
289 if (igain == 0) {
290 switch (m_channelNoiseRMS.value()) {
291 case 3:
292 rms = m_tileToolNoiseSample->getHfn(drawerIdx, channel, igain, TileRawChannelUnit::ADCcounts, ctx);
293 if (rms > 0.0) break;
294 /* FALLTHROUGH */
295 case 2:
296 rms = m_pulseShapes->m_noiseNkLo[noise_channel];
297 if (rms > 0.0) break;
298 /* FALLTHROUGH */
299 case 1:
300 rms = m_pulseShapes->m_noiseOrigLo[noise_channel];
301 if (rms > 0.0) break;
302 /* FALLTHROUGH */
303 default:
304 rms = m_noiseLow;
305 }
306 } else if (igain == 1) {
307 switch (m_channelNoiseRMS.value()) {
308 case 3:
309 rms = m_tileToolNoiseSample->getHfn(drawerIdx, channel, igain, TileRawChannelUnit::ADCcounts, ctx);
310 if (rms > 0.0) break;
311 /* FALLTHROUGH */
312 case 2:
313 rms = m_pulseShapes->m_noiseNkHi[noise_channel];
314 if (rms > 0.0) break;
315 /* FALLTHROUGH */
316 case 1:
317 rms = m_pulseShapes->m_noiseOrigHi[noise_channel];
318 if (rms > 0.0) break;
319 /* FALLTHROUGH */
320 default:
322 }
323 } else {
324 // neither low nor hi-gain, (e.g. adder data)
325 chi2 = -1.0;
326 return;
327 }
328
329 ATH_MSG_VERBOSE( "PulseFit:"
330 << " ROS=" << ros
331 << " Channel=" << channel
332 << " gain=" << igain
333 << " RMS=" << rms
334 << " RMSChNoise=" << m_channelNoiseRMS.value() );
335
336 // First sample to fit, number of samples to fit
337 int ifit1 = 0;
338 int nfit = std::min(m_frameLength.value(), digit->NtimeSamples());
339
340 int ipeakMax = m_iPeak0;
341 int ipeakMin = m_iPeak0;
342
343 ATH_MSG_VERBOSE( "ipeak0=" << m_iPeak0
344 << " ifit1=" << ifit1
345 << " ifit2=" << ifit1 + nfit - 1
346 << " nfit=" << nfit
347 << " idolas=" << m_idolas
348 << " idocis=" << m_idocis
349 << " CISchan=" << m_cischan
350 << " capdaq=" << m_capdaq
351 << " demoCh=" << ((demo)?"true":"false") );
352
353 std::vector<float> samples = digit->samples();
354 samples.erase(samples.begin(),samples.begin()+m_firstSample);
355 samples.resize(m_frameLength);
356 double maxsamp = 0.0;
357 double minsamp = m_saturatedSample;
358
359 double xvec[MAX_SAMPLES], yvec0[MAX_SAMPLES];
360 double yvec[MAX_SAMPLES], eyvec[MAX_SAMPLES];
361
362 bool no_signal = true;
363 pedestal = samples[0];
364 const double delta = 1.e-6;
365
366 for (int isamp = 0; isamp < nfit; ++isamp) {
367 int j = isamp + ifit1;
368 xvec[isamp] = j;
369 yvec0[isamp] = samples[j];
370 if (no_signal) no_signal = (fabs(samples[j] - pedestal) < delta);
371
372 // Check for saturated or zero samples and de-weight accordingly
373 if ((yvec0[isamp] < m_saturatedSample) && (yvec0[isamp] > 0)) {
374 eyvec[isamp] = rms;
375 } else {
376 if (yvec0[isamp] >= m_saturatedSample) {
377 eyvec[isamp] = m_saturatedSampleError * rms;
378 ATH_MSG_VERBOSE( "Saturated ADC value yvec0[" << isamp << "]=" << yvec0[isamp]
379 << " (MAX=" << m_saturatedSample.value() << " ) RMS=" << eyvec[isamp] );
380
381 } else { // must be yvec0[isamp]==0
382 eyvec[isamp] = m_zeroSampleError * rms;
383 ATH_MSG_VERBOSE( "Zero ADC value yvec0[" << isamp << "]=" << yvec0[isamp]
384 << " RMS=" << eyvec[isamp] );
385 }
386 }
387
388 if (yvec0[isamp] > maxsamp) {
389 // initial time guess based on
390 // sample with maximum value
391 maxsamp = yvec0[isamp];
392 ipeakMax = j;
393 }
394 if (yvec0[isamp] < minsamp) {
395 minsamp = yvec0[isamp];
396 ipeakMin = j;
397 }
398 ATH_MSG_VERBOSE( "isamp=" << isamp
399 << ", xvec=" << xvec[isamp]
400 << ", yvec0=" << yvec0[isamp]
401 << ", eyvec=" << eyvec[isamp] );
402 }
403
404 if (no_signal) {
405 ATH_MSG_VERBOSE( "No signal detected" );
406 return;
407 }
408
409 // Make an initial guess about pedestal
410 double pedg = (yvec0[0] + yvec0[nfit - 1]) / 2.0;
411
412 // Position of max sample compared to nominal peak position
413 int delta_peak = 0;
414 // Time offset in pulse functions
415 m_t0Fit = 0.0;
416 // Flag for fixed time in fit
417 bool fixedTime = (m_maxIterate < 0);
418
419 if (!fixedTime) {
420 if (m_disableNegativeAmp) { // try to reproduce Opt Filter behaviour
421 // take first sample as pedestal - like it is done in Opt Filter method
422 pedg = yvec0[0];
423 if (maxsamp - pedg > m_noiseThresholdRMS * rms) {
424 delta_peak = ipeakMax - m_iPeak0; // Adjust initial phase guess,
425 m_t0Fit = (delta_peak) * DTIME; // positive amplitude
426 } else {
427 fixedTime = true; // no signal above noise
428 m_t0Fit = 0.0; // fit with fixed time
429 }
430 } else {
431 if (maxsamp - pedg > m_noiseThresholdRMS * rms) {
432 delta_peak = ipeakMax - m_iPeak0; // Adjust initial phase guess,
433 m_t0Fit = (delta_peak) * DTIME; // positive amplitude
434 } else if (pedg - minsamp > m_noiseThresholdRMS * rms) {
435 delta_peak = ipeakMin - m_iPeak0; // Adjust initial phase guess,
436 m_t0Fit = (delta_peak) * DTIME; // negative amplitude
437 } else {
438 fixedTime = true; // no signal above noise
439 m_t0Fit = 0.0; // fit with fixed time
440 }
441 }
442 }
443
444 double expectedTime = 0.;
445 if (fixedTime && m_bestPhase) {
446 expectedTime = m_tileToolTiming->getSignalPhase(drawerIdx, channel, igain);
447 delta_peak = std::round(expectedTime / DTIME); // Adjust initial phase guess
448 m_t0Fit = expectedTime;
449 }
450
451 ATH_MSG_VERBOSE ( " initial value of"
452 << " t0fit=" << m_t0Fit
453 << " ipeakMax=" << ipeakMax
454 << " ipeakMin=" << ipeakMin
455 << " fixedTime=" << ((fixedTime) ? "true" : "false") );
456
457 const std::vector<double>* tpulse = &m_dummy;
458 const std::vector<double>* ypulse = &m_dummy;
459 const std::vector<double>* tdpulse = &m_dummy;
460 const std::vector<double>* dpulse = &m_dummy;
461 const std::vector<double>* tleak = &m_dummy;
462 const std::vector<double>* yleak = &m_dummy;
463 const std::vector<double>* tdleak = &m_dummy;
464 const std::vector<double>* dleak = &m_dummy;
465
466
467 bool docis = m_idocis;
468 bool dolas = m_idolas;
469 if (demo) { // special treatment for Demo drawers - select different pulse shape
470 dolas = ((m_specialDemoShape == 2) || (m_specialDemoShape == 3 && m_capdaq > 10));
471 docis = (m_specialDemoShape == 8);
472 }
473
474 if (docis && ((m_cischan == -1) || (channel == m_cischan) || demo)) { // CIS pulse
475 if (igain == 0) { // low gain
476 if (m_capdaq > 10) { // 100 pF capacitor
477 tpulse = &(m_pulseShapes->m_tlcis);
478 ypulse = &(m_pulseShapes->m_ylcis);
479 tdpulse = &(m_pulseShapes->m_tdlcis);
480 dpulse = &(m_pulseShapes->m_ydlcis);
481 tleak = &(m_pulseShapes->m_tleaklo);
482 yleak = &(m_pulseShapes->m_leaklo);
483 tdleak = &(m_pulseShapes->m_tdleaklo);
484 dleak = &(m_pulseShapes->m_dleaklo);
485 } else { // 5.2 pF capacitor
486 tpulse = &(m_pulseShapes->m_tslcis);
487 ypulse = &(m_pulseShapes->m_yslcis);
488 tdpulse = &(m_pulseShapes->m_tdslcis);
489 dpulse = &(m_pulseShapes->m_ydslcis);
490 tleak = &(m_pulseShapes->m_tsleaklo);
491 yleak = &(m_pulseShapes->m_sleaklo);
492 tdleak = &(m_pulseShapes->m_tdsleaklo);
493 dleak = &(m_pulseShapes->m_dsleaklo);
494 }
495 } else { // igain==1 => high-gain
496 if (m_capdaq > 10) { // 100 pF capacitor
497 tpulse = &(m_pulseShapes->m_thcis);
498 ypulse = &(m_pulseShapes->m_yhcis);
499 tdpulse = &(m_pulseShapes->m_tdhcis);
500 dpulse = &(m_pulseShapes->m_ydhcis);
501 tleak = &(m_pulseShapes->m_tleakhi);
502 yleak = &(m_pulseShapes->m_leakhi);
503 tdleak = &(m_pulseShapes->m_tdleakhi);
504 dleak = &(m_pulseShapes->m_dleakhi);
505 } else { // 5.2 pF capacitor
506 tpulse = &(m_pulseShapes->m_tshcis);
507 ypulse = &(m_pulseShapes->m_yshcis);
508 tdpulse = &(m_pulseShapes->m_tdshcis);
509 dpulse = &(m_pulseShapes->m_ydshcis);
510 tleak = &(m_pulseShapes->m_tsleakhi);
511 yleak = &(m_pulseShapes->m_sleakhi);
512 tdleak = &(m_pulseShapes->m_tdsleakhi);
513 dleak = &(m_pulseShapes->m_dsleakhi);
514 }
515 }
516 } else {
517 if (dolas) { // laser pulse
518 if (igain == 0) { // low gain
519 tpulse = &(m_pulseShapes->m_tllas);
520 ypulse = &(m_pulseShapes->m_yllas);
521 tdpulse = &(m_pulseShapes->m_tdllas);
522 dpulse = &(m_pulseShapes->m_ydllas);
523 } else { // igain==1 => high-gain
524 tpulse = &(m_pulseShapes->m_thlas);
525 ypulse = &(m_pulseShapes->m_yhlas);
526 tdpulse = &(m_pulseShapes->m_tdhlas);
527 dpulse = &(m_pulseShapes->m_ydhlas);
528 }
529 } else { // physics pulse
530 if (igain == 0) { // low gain
531 tpulse = &(m_pulseShapes->m_tlphys);
532 ypulse = &(m_pulseShapes->m_ylphys);
533 tdpulse = &(m_pulseShapes->m_tdlphys);
534 dpulse = &(m_pulseShapes->m_ydlphys);
535 } else { // igain==1 => high-gain
536 tpulse = &(m_pulseShapes->m_thphys);
537 ypulse = &(m_pulseShapes->m_yhphys);
538 tdpulse = &(m_pulseShapes->m_tdhphys);
539 dpulse = &(m_pulseShapes->m_ydhphys);
540 }
541 }
542 }
543
544 if (demo) {
545 docis = false; // never fit demo channels as CIS with signal and leakage pulses
546 dolas = (m_idocis || m_idolas); // use laser option, i.e. just single pulse without leakage pulse
547 }
548
549 // Variables used for iterative fitting
550 double gval, gpval, sy, syg, sygp, sg, sgp, sgg, sgpgp, sggp, serr, err2;
551 double dgg0, dgg, dggp, dgpgp, dyg, dygp, dg, dc, xd;
552 double sllp, sylp, slplp, dleakage, leakage;
553 double fixtau = 0.0, fixped = 0.0, fixampl = 0.0, fixchi2 = MAX_CHI2;
554 double leaktau = 0.0, leakped = 0.0, leakampl = 0.0, leakchi2 = MAX_CHI2;
555 double cistau = 0.0, cisped = 0.0, cisampl = 0.0, cisatau = 0.0, cischi2 = MAX_CHI2;
556 double tau, ped, ampl, atau = 0.0, tempChi2 = MAX_CHI2, oldchi2 = MAX_CHI2 / 2;
557
558 // number of iterations
559 int niter = 0;
560 do {
561 ++niter;
562 ATH_MSG_VERBOSE ( "niter=" << niter << " maxIterate=" << m_maxIterate.value() );
563
564 if (tempChi2 < oldchi2) oldchi2 = tempChi2; // best chi2 up to now
565
566 // parameters for pulse shape functions
567 // 0. phase
568 m_fnParameters[0] = 0.0;
569 // 1. pedestal
570 m_fnParameters[1] = 0.0;
571 // 2. amplitude
572 m_fnParameters[2] = 1.0;
573
574 // CIS events linear fit
575 if (docis && ((m_cischan == -1) || (channel == m_cischan))) {
576 ATH_MSG_VERBOSE ( "Fit time with leakage" );
577 // CIS Part (A): fit for time using leakage pulse
578 sllp = 0.0;
579 sylp = 0.0;
580 slplp = 0.0;
581 for (int isamp = 0; isamp < nfit; ++isamp) {
582 ATH_MSG_VERBOSE ( "Lo gain leakage xvec[" << isamp << "]=" << xvec[isamp] );
583
584 leakage = pulse(xvec[isamp], tleak, yleak);
585 dleakage = derivative(xvec[isamp], tdleak, dleak);
586
587 // Samples with pedestal subtracted
588 yvec[isamp] = yvec0[isamp] - pedg;
589
590 ATH_MSG_VERBOSE( " yvec[" << isamp << "]=" << yvec[isamp]
591 << " yvec0[" << isamp << "]=" << yvec0[isamp]
592 << " pedg=" << pedg);
593
594 sllp += leakage * dleakage;
595 sylp += yvec[isamp] * dleakage;
596 slplp += dleakage * dleakage;
597 }
598 // Also allow for fixed-time fit to CIS events
599 if (fabs(slplp) > EPS_DG && !fixedTime) {
600 leaktau = (sllp - sylp) / slplp;
601 // Also have to check the range for leaktau
602 if (leaktau > m_maxTau)
603 leaktau = m_maxTau;
604 else if (leaktau < m_minTau) leaktau = m_minTau;
605 } else {
606 leaktau = 0.0;
607 }
608
609 ATH_MSG_VERBOSE( " sllp=" << sllp
610 << " sylp=" << sylp
611 << " slplp=" << slplp
612 << " leaktau=" << leaktau);
613
614 // CIS Part (B): using phase determined in part (A),
615 // subtract leakage pedestal and fit for amplitude, pedestal
616 m_fnParameters[0] = leaktau;
617 sy = 0.0;
618 sg = 0.0;
619 syg = 0.0;
620 sgg = 0.0;
621 serr = 0.0;
622 for (int isamp = 0; isamp < nfit; ++isamp) {
623 leakage = pulse(xvec[isamp], tleak, yleak);
624 gval = scaledPulse(xvec[isamp], tpulse, ypulse);
625 yvec[isamp] = yvec0[isamp] - leakage;
626
627 ATH_MSG_VERBOSE ( " yvec[" << isamp << "]=" << yvec[isamp]
628 << " yvec0[" << isamp << "]=" << yvec0[isamp]
629 << " leakage=" << leakage );
630
631 err2 = eyvec[isamp] * eyvec[isamp];
632 sy += yvec[isamp] / err2;
633 sg += gval / err2;
634 syg += yvec[isamp] * gval / err2;
635 sgg += gval * gval / err2;
636 serr += 1.0 / err2;
637 }
638
639 dgg0 = sg * sg - serr * sgg;
640 if (fabs(dgg0) > EPS_DG) {
641 leakampl = (sy * sg - serr * syg) / dgg0;
642 leakped = (syg * sg - sy * sgg) / dgg0;
643 } else {
644 leakampl = 0.0;
645 leakped = sy / serr;
646 }
647
648 // Determine Chi2 for corresponding function for CIS leakage + pulse
649 ATH_MSG_VERBOSE ( " Determine Chi2 for CIS leakage + pulse" );
650
651 leakchi2 = 0.0;
652 m_fnParameters[0] = leaktau;
653 m_fnParameters[1] = leakped;
654 m_fnParameters[2] = leakampl;
655
656 for (int isamp = 0; isamp < nfit; ++isamp) {
657 gval = scaledPulse(xvec[isamp], tpulse, ypulse);
658 leakage = pulse(xvec[isamp], tleak, yleak);
659 xd = yvec0[isamp] - (gval + leakage);
660 leakchi2 = leakchi2 + (xd * xd) / (eyvec[isamp] * eyvec[isamp]);
661
662 ATH_MSG_VERBOSE ( " isamp=" << isamp
663 << " yvec0[" << isamp << "]=" << yvec0[isamp]
664 << " gval=" << gval
665 << ", leakage=" << leakage
666 << ", xd=" << xd );
667 }
668
669 leakchi2 = leakchi2/(nfit-3.0);
670
671 ATH_MSG_VERBOSE ( " leaktau=" << leaktau
672 << " leakped=" << leakped
673 << " leakampl=" << leakampl
674 << " leakchi2=" << leakchi2 );
675
676 // CIS Part C: Least-squares fit with 3 parameters for pulse+leakage
677 if (!fixedTime) {
678 m_fnParameters[0] = 0.0;
679 m_fnParameters[1] = 0.0;
680 m_fnParameters[2] = 0.0;
681
682 for (int isamp = 0; isamp < nfit; ++isamp) {
683 leakage = pulse(xvec[isamp], tleak, yleak);
684
685 // Subtract leakage from samples
686 yvec[isamp] = yvec0[isamp] - leakage;
687
688 ATH_MSG_VERBOSE ( " isamp=" << isamp
689 << " yvec0[" << isamp << "]=" << yvec0[isamp]
690 << " leakage=" << leakage
691 << " yvec[" << isamp << "]=" << yvec[isamp] );
692 }
693
694 m_fnParameters[0] = 0.0;
695 m_fnParameters[1] = 0.0;
696 m_fnParameters[2] = 1.0;
697 sy = 0.0;
698 sg = 0.0;
699 sgp = 0.0;
700 syg = 0.0;
701 sygp = 0.0;
702 sgg = 0.0;
703 sggp = 0.0;
704 sgpgp = 0.0;
705 serr = 0.0;
706
707 for (int isamp = 0; isamp < nfit; ++isamp) {
708 gval = scaledPulse(xvec[isamp], tpulse, ypulse);
709 gpval = derivative(xvec[isamp], tdpulse, dpulse);
710 err2 = eyvec[isamp] * eyvec[isamp];
711 sy += yvec[isamp] / err2;
712 sg += gval / err2;
713 sgp += gpval / err2;
714 syg += yvec[isamp] * gval / err2;
715 sygp += yvec[isamp] * gpval / err2;
716 sgg += gval * gval / err2;
717 sggp += gval * gpval / err2;
718 sgpgp += gpval * gpval / err2;
719 serr += 1.0 / err2;
720 }
721
722 dgg = sgg - sg * sg / serr;
723 dggp = sggp - sg * sgp / serr;
724 dgpgp = sgpgp - sgp * sgp / serr;
725 dyg = syg - sy * sg / serr;
726 dygp = sygp - sy * sgp / serr;
727 dg = dgg * dgpgp - dggp * dggp;
728
729 if (fabs(dg) > EPS_DG) {
730 cisampl = (dyg * dgpgp - dygp * dggp) / dg;
731 cisatau = (dyg * dggp - dygp * dgg) / dg;
732 cisped = (sy
733 - (dyg * dgpgp * sg - dygp * dggp * sg + dyg * dggp * sgp - dygp * dgg * sgp) / dg)
734 / serr;
735
736 if (fabs(cisampl) > EPS_DG) {
737 cistau = cisatau / cisampl;
738 if (cistau > m_maxTau)
739 cistau = m_maxTau;
740 else if (cistau < m_minTau) cistau = m_minTau;
741 } else {
742 cistau = 0.0;
743 }
744 } else {
745 cisampl = 0.0;
746 cisatau = 0.0;
747 cistau = 0.0;
748 cisped = sy / serr;
749 }
750
751 if (msgLvl(MSG::VERBOSE)) {
752 msg(MSG::VERBOSE) << " sy=" << sy
753 << " sg=" << sg
754 << " sgp=" << sgp
755 << " syg=" << syg
756 << " sygp=" << sygp
757 << " sgg=" << sgg
758 << " sggp=" << sggp
759 << " sgpgp=" << sgpgp << endmsg;
760
761 msg(MSG::VERBOSE) << " dgg=" << dgg
762 << " dggp=" << dggp
763 << " sgpgp=" << sgpgp
764 << " dyg=" << dyg
765 << " dygp=" << dygp
766 << " dg=" << dg << endmsg;
767
768 msg(MSG::VERBOSE) << " cistau=" << cistau
769 << " cisped=" << cisped
770 << " cisampl=" << cisampl << endmsg;
771 }
772
773 // Determine Chi2 for pulse shape + leakage fit CIS Part C
774 cischi2 = 0.0;
775 m_fnParameters[0] = cistau;
776 m_fnParameters[1] = cisped;
777 m_fnParameters[2] = cisampl;
778
779 for (int isamp = 0; isamp < nfit; ++isamp) {
780 gval = scaledPulse(xvec[isamp], tpulse, ypulse);
781 leakage = pulse(xvec[isamp], tleak, yleak);
782 // Subtract leakage from samples
783 yvec[isamp] = yvec0[isamp] - leakage;
784 xd = yvec[isamp] - gval;
785 cischi2 = cischi2 + (xd * xd) / (eyvec[isamp] * eyvec[isamp]);
786
787 ATH_MSG_VERBOSE ( " yvec0[" << isamp << "]=" << yvec0[isamp]
788 << " yvec[" << isamp << "]=" << yvec[isamp]
789 << " leakage=" << leakage
790 << " gval=" << gval
791 << " xd=" << xd );
792 }
793
794 cischi2 = cischi2 / (nfit - 3.0);
795
796 ATH_MSG_VERBOSE ( " cischi2=" << cischi2 );
797 }
798
799 // Determine which set of parameters to use from CIS fit methods based on minimum chi2
800 if ((cischi2 < leakchi2) && !fixedTime) {
801 tau = cistau;
802 ped = cisped;
803 ampl = cisampl;
804 tempChi2 = cischi2;
805 } else {
806 tau = leaktau;
807 ped = leakped;
808 ampl = leakampl;
809 tempChi2 = leakchi2;
810 }
811 // End of fit for CIS events
812 } else {
813 // Physics and laser events
814
815 if (niter == 1) {
816 /* For first iteration, also calculate 2-Parameter Fit for pedestal and amplitude
817 */
818 double t0fit_old = m_t0Fit;
819 m_t0Fit = expectedTime;
820
821 sy = 0.0;
822 sg = 0.0;
823 sgg = 0.0;
824 syg = 0.0;
825 serr = 0.0;
826
827 for (int isamp = 0; isamp < nfit; ++isamp) {
828 if (!dolas) {
829 // Use initial values for speeding up the physics events
830 int jsamp = (int) xvec[isamp] - delta_peak;
831 if (jsamp < 0)
832 jsamp = 0;
833 else if (jsamp >= nfit) jsamp = nfit - 1;
834
835 if (igain == 0) {
836 gval = m_gPhysLo[jsamp];
837 } else {
838 gval = m_gPhysHi[jsamp];
839 }
840 } else {
841 gval = scaledPulse(xvec[isamp], tpulse, ypulse);
842 }
843 err2 = eyvec[isamp] * eyvec[isamp];
844 sy += yvec0[isamp] / err2;
845 sg += gval / err2;
846 syg += yvec0[isamp] * gval / err2;
847 sgg += gval * gval / err2;
848 serr += 1.0 / err2;
849 }
850
851 fixtau = 0.0;
852 dgg0 = sg * sg - serr * sgg;
853 if (fabs(dgg0) > EPS_DG) {
854 fixampl = (sy * sg - serr * syg) / dgg0;
855 fixped = (syg * sg - sy * sgg) / dgg0;
856 ATH_MSG_VERBOSE ( " 2-par fit: fixampl = " << fixampl
857 << " fixped = " << fixped );
858 } else {
859 fixampl = 0.0;
860 fixped = sy / serr;
861 ATH_MSG_VERBOSE ( " 2-par fit: small dgg0 = " << dgg0
862 << ", fixampl = " << fixampl
863 << " fixped = " << fixped );
864 }
865
866 m_fnParameters[0] = fixtau; /* 2-Par fit Calculate chi2 for physics events */
867 m_fnParameters[1] = fixped;
868 m_fnParameters[2] = fixampl;
869 fixchi2 = 0.0;
870 for (int isamp = 0; isamp < nfit; ++isamp) {
871 dc = yvec0[isamp] - scaledPulse(xvec[isamp], tpulse, ypulse);
872 fixchi2 = fixchi2 + (dc * dc) / (eyvec[isamp] * eyvec[isamp]);
873 ATH_MSG_VERBOSE ( " isamp= " << isamp
874 << " yvec0[" << isamp << "]= " << yvec0[isamp]
875 << " eyvec[" << isamp << "]= " << eyvec[isamp]
876 << " fixchi2= " << fixchi2 );
877 }
878 fixchi2 = fixchi2 / (nfit - 2.0);
879 ATH_MSG_VERBOSE ( " fixchi2/(nfit-2.0)=" << fixchi2
880 << " nfit=" << nfit );
881
882 m_t0Fit = t0fit_old;
883
884 // restore initial parameters for pulse shape functions - to be used in 3-par fit
885 m_fnParameters[0] = 0.0;
886 m_fnParameters[1] = 0.0;
887 m_fnParameters[2] = 1.0;
888 } /* end of 2-par fit in first iteration */
889
890 if (fixedTime) {
891 m_t0Fit = expectedTime;
892 tau = fixtau;
893 ped = fixped;
894 ampl = fixampl;
895 tempChi2 = oldchi2 = -fabs(fixchi2);
896 } else {
897
898 sy = 0.0;
899 sg = 0.0;
900 sgp = 0.0;
901 syg = 0.0;
902 sygp = 0.0;
903 sgg = 0.0;
904 sggp = 0.0;
905 sgpgp = 0.0;
906 serr = 0.0;
907
908 for (int isamp = 0; isamp < nfit; ++isamp) {
909 if ((niter == 1) && (!dolas)) {
910 // Use initial function values stored in array for niter=1 physics
911 // XXX: double->int
912 int jsamp = (int) xvec[isamp] - delta_peak;
913 if (jsamp < 0)
914 jsamp = 0;
915 else if (jsamp >= nfit) jsamp = nfit - 1;
916
917 if (igain == 0) { // igain ==0 => low-gain
918 gval = m_gPhysLo[jsamp];
919 gpval = m_dgPhysLo[jsamp];
920 } else { // must be igain==1 => high-gain
921 gval = m_gPhysHi[jsamp];
922 gpval = m_dgPhysHi[jsamp];
923 }
924 } else {
925 // Use the respective function values
926 gval = scaledPulse(xvec[isamp], tpulse, ypulse);
927 gpval = derivative(xvec[isamp], tdpulse, dpulse);
928 }
929
930 err2 = eyvec[isamp] * eyvec[isamp];
931 sy += yvec0[isamp] / err2;
932 sg += gval / err2;
933 sgp += gpval / err2;
934 syg += yvec0[isamp] * gval / err2;
935 sygp += yvec0[isamp] * gpval / err2;
936 sgg += gval * gval / err2;
937 sggp += gval * gpval / err2;
938 sgpgp += gpval * gpval / err2;
939 serr += 1.0 / err2;
940
941 ATH_MSG_VERBOSE ( " isamp=" << isamp
942 << " gval=" << gval
943 << " sg=" << sg
944 << " gpval=" << gpval
945 << " sgp=" << sgp );
946 }
947
948 dgg = sgg - sg * sg / serr;
949 dggp = sggp - sg * sgp / serr;
950 dgpgp = sgpgp - sgp * sgp / serr;
951 dyg = syg - sy * sg / serr;
952 dygp = sygp - sy * sgp / serr;
953 dg = dgg * dgpgp - dggp * dggp;
954
955 // Fit for time, pedestal, and amplitude
956 if (fabs(dg) > EPS_DG) {
957 // Amplitude : ampl
958 ampl = (dyg * dgpgp - dygp * dggp) / dg;
959 // and Amplitude * time: atau
960 atau = (dyg * dggp - dygp * dgg) / dg;
961 // Pedestal
962 ped = (sy - ((dyg * dgpgp - dygp * dggp) * sg + (dyg * dggp - dygp * dgg) * sgp) / dg)
963 / serr;
964
965 if (fabs(ampl) > EPS_DG) {
966 // Time
967 tau = atau / ampl;
968 if (tau > m_maxTau)
969 tau = m_maxTau;
970 else if (tau < m_minTau) tau = m_minTau;
971 } else {
972 tau = 0.0;
973 }
974 } else {
975 ampl = 0.0;
976 atau = 0.0;
977 tau = 0.0;
978 ped = sy / serr;
979 }
980
981 if (msgLvl(MSG::VERBOSE)) {
982 msg(MSG::VERBOSE) << " ped=" << ped << endmsg;
983 msg(MSG::VERBOSE) << " sy=" << sy
984 << " sg=" << sg
985 << " sgp=" << sgp << endmsg;
986
987 msg(MSG::VERBOSE) << " syg=" << syg
988 << " sygp=" << sygp
989 << " sgg=" << sgg << endmsg;
990
991 msg(MSG::VERBOSE) << " sggp=" << sggp
992 << " sgpgp=" << sgpgp << endmsg;
993
994 msg(MSG::VERBOSE) << " ampl = (dyg*dgpgp - dygp*dggp)= " << ampl << endmsg;
995
996 msg(MSG::VERBOSE) << " dyg=" << dyg
997 << " dgpgp=" << dgpgp
998 << " dyg*dgpgp=" << (dyg * dgpgp) << endmsg;
999
1000 msg(MSG::VERBOSE) << " dygp=" << dygp
1001 << " dggp=" << dggp
1002 << " dygp*dggp=" << (dygp * dggp) << endmsg;
1003
1004 msg(MSG::VERBOSE) << " dyg=" << dyg
1005 << " dggp=" << dggp
1006 << " dyg*dggp=" << (dyg * dggp) << endmsg;
1007
1008 msg(MSG::VERBOSE) << " dygp=" << dygp
1009 << " dgg=" << dgg
1010 << " dygp*dgg=" << (dygp * dgg) << endmsg;
1011
1012 msg(MSG::VERBOSE) << " dg=" << dg
1013 << " atau=" << atau
1014 << " tau=" << tau << endmsg;
1015 }
1016
1017 m_fnParameters[0] = tau;
1018 m_fnParameters[1] = ped;
1019 m_fnParameters[2] = ampl;
1020
1021 tempChi2 = 0;
1022 // Calculate chi2 for physics and laser events
1023 for (int isamp = 0; isamp < nfit; ++isamp) {
1024 dc = yvec0[isamp] - scaledPulse(xvec[isamp], tpulse, ypulse);
1025 tempChi2 = tempChi2 + (dc * dc) / (eyvec[isamp] * eyvec[isamp]);
1026 ATH_MSG_VERBOSE ( " isamp=" << isamp
1027 << " yvec0[" << isamp << "]=" << yvec0[isamp]
1028 << " eyvec[" << isamp << "]=" << eyvec[isamp]
1029 << " dc=" << dc
1030 << " chi2=" << tempChi2 );
1031 }
1032
1033 tempChi2 = tempChi2 / (nfit - 3.0);
1034 ATH_MSG_VERBOSE ( " chi2/(nfit-3.0)=" << tempChi2
1035 << " nfit=" << nfit );
1036 } // end if fixedTime
1037 } // end of physics and laser specific part
1038
1039 if (msgLvl(MSG::VERBOSE))
1040 msg(MSG::VERBOSE) << " t0fit: " << m_t0Fit << ((tau < 0.0) ? " - " : " + ") << fabs(tau);
1041
1042 // avoid infinite loop at the boundary
1043 if (fabs(m_t0Fit - m_maxTime) < 0.001 && tau >= 0.0) { // trying to go outside max boundary second time
1044 m_t0Fit = fixtau + (m_minTime - fixtau) * niter / m_maxIterate; // jump to negative time
1045 if (msgLvl(MSG::VERBOSE))
1046 msg(MSG::VERBOSE) << " jumping to " << m_t0Fit << endmsg;
1047 tempChi2 = MAX_CHI2;
1048 } else if (fabs(m_t0Fit - m_minTime) < 0.001 && tau <= 0.0) { // trying to go outside min boundary second time
1049 m_t0Fit = fixtau + (m_maxTime - fixtau) * niter / m_maxIterate; // jump to positive time
1050 if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << " jumping to " << m_t0Fit << endmsg;
1051 tempChi2 = MAX_CHI2;
1052 } else {
1053
1054 // Iteration with parameter for time
1055 m_t0Fit += tau;
1056 if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << " = " << m_t0Fit << endmsg;
1057
1058 // Check if total time does not exceed the limits:
1059 if (m_t0Fit > m_maxTime) {
1061 tempChi2 = MAX_CHI2;
1062 } else if (m_t0Fit < m_minTime) {
1064 tempChi2 = MAX_CHI2;
1065 }
1066 }
1067
1068 // save values of the best iteration
1069 if (tempChi2 < chi2) {
1070 time = m_t0Fit;
1071 pedestal = ped;
1072 amplitude = ampl;
1073 chi2 = tempChi2;
1074 }
1075
1076 if (!fixedTime && tempChi2 < MAX_CHI2 && fabs(tau) < EPS_DG) { // too small tau
1077 if (m_t0Fit > fixtau)
1078 m_t0Fit = fixtau + (m_minTime - fixtau) * niter / m_maxIterate; // jump to negative time
1079 else
1080 m_t0Fit = fixtau + (m_maxTime - fixtau) * niter / m_maxIterate; // jump to positive time
1081
1082 ATH_MSG_VERBOSE( " too small tau - jump to " << m_t0Fit);
1083 }
1084
1085 ATH_MSG_VERBOSE ( " iter=" << niter
1086 << " t0fit=" << m_t0Fit
1087 << " phase=" << tau
1088 << " ped=" << ped
1089 << " ampl=" << ampl
1090 << " chi2=" << tempChi2 );
1091
1092 } while (fabs(tempChi2 - oldchi2) > DELTA_CHI2 && (niter < m_maxIterate));
1093
1094// NGO never use the 2par fit result if non-pedestal event was detected!
1095// if ((fabs(fixchi2) <= fabs(p_chi2))
1096// && !(docis && ((m_cischan == -1) || (channel == m_cischan)))) {
1097// /* results from 2-par fit */
1098// p_time = fixtau;
1099// p_pedestal = fixped;
1100// p_amplitude = fixampl;
1101// p_chi2 = -fabs(fixchi2);
1102// }
1103
1104// TD: fit converged, now one extra iteration, leaving out the samples that
1105// are more then m_MaxTimeFromPeak ns from the peak. We want to avoid to
1106// extrapolate the pulse shape beyond the region where it is known.
1107
1108// Do it only in case when at least last sample is beyond m_MaxTimeFromPeak:
1109 if ((nfit - 1 - m_iPeak0) * DTIME > time + m_maxTimeFromPeak) {
1110
1111 ATH_MSG_VERBOSE ( "Result before last iteration:"
1112 << " Time=" << time
1113 << " Ped=" << pedestal
1114 << " Amplitude=" << amplitude
1115 << " Chi2=" << chi2 );
1116
1117 m_t0Fit = time;
1118 int nfit_real;
1119
1120 // parameters for pulse shape functions
1121 // 0. phase
1122 m_fnParameters[0] = 0.0;
1123 // 1. pedestal
1124 m_fnParameters[1] = 0.0;
1125 // 2. amplitude
1126 m_fnParameters[2] = 1.0;
1127
1128 // CIS events linear fit
1129 if (docis && ((m_cischan == -1) || (channel == m_cischan))) {
1130 if (!fixedTime) {
1131 ATH_MSG_VERBOSE ( "Fit time with leakage" );
1132 // CIS Part (A): fit for time using leakage pulse
1133 sllp = 0.0;
1134 sylp = 0.0;
1135 slplp = 0.0;
1136 for (int isamp = 0; (isamp < nfit) && (DTIME * (isamp - m_iPeak0) - m_t0Fit < m_maxTimeFromPeak); ++isamp) {
1137
1138 ATH_MSG_VERBOSE ( "Lo gain leakage xvec[" << isamp << "]=" << xvec[isamp] );
1139
1140 leakage = pulse(xvec[isamp], tleak, yleak);
1141 dleakage = derivative(xvec[isamp], tdleak, dleak);
1142
1143 // Samples with pedestal subtracted
1144 yvec[isamp] = yvec0[isamp] - pedg;
1145
1146 ATH_MSG_VERBOSE ( " yvec[" << isamp << "]=" << yvec[isamp]
1147 << " yvec0[" << isamp << "]=" << yvec0[isamp]
1148 << " pedg=" << pedg );
1149
1150 sllp += leakage * dleakage;
1151 sylp += yvec[isamp] * dleakage;
1152 slplp += dleakage * dleakage;
1153 }
1154 // Also allow for fixed-time fit to CIS events
1155 if (fabs(slplp) > EPS_DG && !fixedTime) {
1156 leaktau = (sllp - sylp) / slplp;
1157 // Also have to check the range for leaktau
1158 if (leaktau > m_maxTau)
1159 leaktau = m_maxTau;
1160 else if (leaktau < m_minTau) leaktau = m_minTau;
1161 } else {
1162 leaktau = 0.0;
1163 }
1164
1165 ATH_MSG_VERBOSE ( " sllp=" << sllp
1166 << " sylp=" << sylp
1167 << " slplp=" << slplp
1168 << " leaktau=" << leaktau );
1169
1170 // CIS Part (B): using phase determined in part (A),
1171 // subtract leakage pedestal and fit for amplitude, pedestal
1172 m_fnParameters[0] = leaktau;
1173 sy = 0.0;
1174 sg = 0.0;
1175 syg = 0.0;
1176 sgg = 0.0;
1177 serr = 0.0;
1178
1179 for (int isamp = 0;
1180 (isamp < nfit) && (DTIME * (isamp - m_iPeak0) - m_t0Fit < m_maxTimeFromPeak); ++isamp) {
1181
1182 leakage = pulse(xvec[isamp], tleak, yleak);
1183 gval = scaledPulse(xvec[isamp], tpulse, ypulse);
1184 yvec[isamp] = yvec0[isamp] - leakage;
1185
1186 ATH_MSG_VERBOSE ( " yvec[" << isamp << "]=" << yvec[isamp]
1187 << " yvec0[" << isamp << "]=" << yvec0[isamp]
1188 << " leakage=" << leakage );
1189
1190 err2 = eyvec[isamp] * eyvec[isamp];
1191 sy += yvec[isamp] / err2;
1192 sg += gval / err2;
1193 syg += yvec[isamp] * gval / err2;
1194 sgg += gval * gval / err2;
1195 serr += 1.0 / err2;
1196 }
1197
1198 dgg0 = sg * sg - serr * sgg;
1199 if (fabs(dgg0) > EPS_DG) {
1200 leakampl = (sy * sg - serr * syg) / dgg0;
1201 leakped = (syg * sg - sy * sgg) / dgg0;
1202 } else {
1203 leakampl = 0.0;
1204 if (serr == 0.)[[unlikely]]{
1205 ATH_MSG_ERROR("TileRawChannelBuilderFitFilter::pulseFit: serr is zero.");
1206 return;
1207 }
1208 leakped = sy / serr;
1209 }
1210
1211 // Determine Chi2 for corresponding function for CIS leakage + pulse
1212 ATH_MSG_VERBOSE ( " Determine Chi2 for CIS leakage + pulse" );
1213
1214 leakchi2 = 0.0;
1215 nfit_real = 0;
1216 m_fnParameters[0] = leaktau;
1217 m_fnParameters[1] = leakped;
1218 m_fnParameters[2] = leakampl;
1219
1220 for (int isamp = 0;
1221 (isamp < nfit) && (DTIME * (isamp - m_iPeak0) - m_t0Fit < m_maxTimeFromPeak); ++isamp) {
1222
1223 ++nfit_real;
1224 gval = scaledPulse(xvec[isamp], tpulse, ypulse);
1225 leakage = pulse(xvec[isamp], tleak, yleak);
1226 xd = yvec0[isamp] - (gval + leakage);
1227 leakchi2 = leakchi2 + (xd * xd) / (eyvec[isamp] * eyvec[isamp]);
1228
1229 ATH_MSG_VERBOSE ( " isamp=" << isamp
1230 << " yvec0[" << isamp << "]=" << yvec0[isamp]
1231 << " gval=" << gval
1232 << ", leakage=" << leakage
1233 << ", xd=" << xd );
1234 }
1235
1236 leakchi2 = leakchi2 / (nfit_real - 3.0);
1237
1238 ATH_MSG_VERBOSE ( " leaktau=" << leaktau
1239 << " leakped=" << leakped
1240 << " leakampl=" << leakampl
1241 << " leakchi2=" << leakchi2 );
1242
1243 // CIS Part C: Least-squares fit with 3 parameters for pulse+leakage
1244 m_fnParameters[0] = 0.0;
1245 m_fnParameters[1] = 0.0;
1246 m_fnParameters[2] = 0.0;
1247
1248 for (int isamp = 0;
1249 (isamp < nfit) && (DTIME * (isamp - m_iPeak0) - m_t0Fit < m_maxTimeFromPeak); ++isamp) {
1250
1251 leakage = pulse(xvec[isamp], tleak, yleak);
1252
1253 // Subtract leakage from samples
1254 yvec[isamp] = yvec0[isamp] - leakage;
1255
1256 ATH_MSG_VERBOSE ( " isamp=" << isamp
1257 << " yvec0[" << isamp << "]=" << yvec0[isamp]
1258 << " leakage=" << leakage
1259 << " yvec[" << isamp << "]=" << yvec[isamp] );
1260 }
1261
1262 m_fnParameters[0] = 0.0;
1263 m_fnParameters[1] = 0.0;
1264 m_fnParameters[2] = 1.0;
1265 sy = 0.0;
1266 sg = 0.0;
1267 sgp = 0.0;
1268 syg = 0.0;
1269 sygp = 0.0;
1270 sgg = 0.0;
1271 sggp = 0.0;
1272 sgpgp = 0.0;
1273 serr = 0.0;
1274
1275 for (int isamp = 0;
1276 (isamp < nfit) && (DTIME * (isamp - m_iPeak0) - m_t0Fit < m_maxTimeFromPeak); ++isamp) {
1277
1278 gval = scaledPulse(xvec[isamp], tpulse, ypulse);
1279 gpval = derivative(xvec[isamp], tdpulse, dpulse);
1280 err2 = eyvec[isamp] * eyvec[isamp];
1281 sy += yvec[isamp] / err2;
1282 sg += gval / err2;
1283 sgp += gpval / err2;
1284 syg += yvec[isamp] * gval / err2;
1285 sygp += yvec[isamp] * gpval / err2;
1286 sgg += gval * gval / err2;
1287 sggp += gval * gpval / err2;
1288 sgpgp += gpval * gpval / err2;
1289 serr += 1.0 / err2;
1290 }
1291
1292 if (serr == 0) serr = 1;
1293 dgg = sgg - sg * sg / serr;
1294 dggp = sggp - sg * sgp / serr;
1295 dgpgp = sgpgp - sgp * sgp / serr;
1296 dyg = syg - sy * sg / serr;
1297 dygp = sygp - sy * sgp / serr;
1298 dg = dgg * dgpgp - dggp * dggp;
1299
1300 if (fabs(dg) > EPS_DG) {
1301 cisampl = (dyg * dgpgp - dygp * dggp) / dg;
1302 cisatau = (dyg * dggp - dygp * dgg) / dg;
1303 cisped = (sy
1304 - (dyg * dgpgp * sg - dygp * dggp * sg + dyg * dggp * sgp - dygp * dgg * sgp) / dg)
1305 / serr;
1306
1307 if (fabs(cisampl) > EPS_DG) {
1308 cistau = cisatau / cisampl;
1309 if (cistau > m_maxTau)
1310 cistau = m_maxTau;
1311 else if (cistau < m_minTau) cistau = m_minTau;
1312 } else {
1313 cistau = 0.0;
1314 }
1315 } else {
1316 cisampl = 0.0;
1317 cisatau = 0.0;
1318 cistau = 0.0;
1319 cisped = sy / serr;
1320 }
1321
1322 if (msgLvl(MSG::VERBOSE)) {
1323 msg(MSG::VERBOSE) << " sy=" << sy
1324 << " sg=" << sg
1325 << " sgp=" << sgp
1326 << " syg=" << syg
1327 << " sygp=" << sygp
1328 << " sgg=" << sgg
1329 << " sggp=" << sggp
1330 << " sgpgp=" << sgpgp << endmsg;
1331
1332 msg(MSG::VERBOSE) << " dgg=" << dgg
1333 << " dggp=" << dggp
1334 << " sgpgp=" << sgpgp
1335 << " dyg=" << dyg
1336 << " dygp=" << dygp
1337 << " dg=" << dg << endmsg;
1338
1339 msg(MSG::VERBOSE) << " cistau=" << cistau
1340 << " cisped=" << cisped
1341 << " cisampl=" << cisampl << endmsg;
1342 }
1343
1344 // Determine Chi2 for pulse shape + leakage fit CIS
1345 cischi2 = 0.0;
1346 nfit_real = 0;
1347 m_fnParameters[0] = cistau;
1348 m_fnParameters[1] = cisped;
1349 m_fnParameters[2] = cisampl;
1350
1351 for (int isamp = 0;
1352 (isamp < nfit) && (DTIME * (isamp - m_iPeak0) - m_t0Fit < m_maxTimeFromPeak); ++isamp) {
1353
1354 ++nfit_real;
1355 gval = scaledPulse(xvec[isamp], tpulse, ypulse);
1356 leakage = pulse(xvec[isamp], tleak, yleak);
1357 // Subtract leakage from samples
1358 yvec[isamp] = yvec0[isamp] - leakage;
1359 xd = yvec[isamp] - gval;
1360 cischi2 = cischi2 + (xd * xd) / (eyvec[isamp] * eyvec[isamp]);
1361
1362 ATH_MSG_VERBOSE ( " yvec0[" << isamp << "]=" << yvec0[isamp]
1363 << " yvec[" << isamp << "]=" << yvec[isamp]
1364 << " leakage=" << leakage
1365 << " gval=" << gval
1366 << " xd=" << xd );
1367 }
1368
1369 cischi2=cischi2/(nfit_real-3.0);
1370
1371 ATH_MSG_VERBOSE ( " cischi2=" << cischi2 );
1372
1373 // Determine which set of parameters to use from CIS fit methods based on minimum chi2
1374 if ((cischi2 < leakchi2) && !fixedTime) {
1375 tau = cistau;
1376 ped = cisped;
1377 ampl = cisampl;
1378 tempChi2 = cischi2;
1379 } else {
1380 tau = leaktau;
1381 ped = leakped;
1382 ampl = leakampl;
1383 tempChi2 = leakchi2;
1384 }
1385 // End of fit for CIS events
1386 }
1387 } else { // Physics and laser events
1388 if (!fixedTime) {
1389
1390 // restore initial parameters for pulse shape functions - to be used in 3-par fit
1391 m_fnParameters[0] = 0.0;
1392 m_fnParameters[1] = 0.0;
1393 m_fnParameters[2] = 1.0;
1394
1395 sy = 0.0;
1396 sg = 0.0;
1397 sgp = 0.0;
1398 syg = 0.0;
1399 sygp = 0.0;
1400 sgg = 0.0;
1401 sggp = 0.0;
1402 sgpgp = 0.0;
1403 serr = 0.0;
1404
1405 for (int isamp = 0;
1406 (isamp < nfit) && (DTIME * (isamp - m_iPeak0) - m_t0Fit < m_maxTimeFromPeak); ++isamp) {
1407 // Use the respective function values
1408 gval = scaledPulse(xvec[isamp], tpulse, ypulse);
1409 gpval = derivative(xvec[isamp], tdpulse, dpulse);
1410
1411 err2 = eyvec[isamp] * eyvec[isamp];
1412 sy += yvec0[isamp] / err2;
1413 sg += gval / err2;
1414 sgp += gpval / err2;
1415 syg += yvec0[isamp] * gval / err2;
1416 sygp += yvec0[isamp] * gpval / err2;
1417 sgg += gval * gval / err2;
1418 sggp += gval * gpval / err2;
1419 sgpgp += gpval * gpval / err2;
1420 serr += 1.0 / err2;
1421
1422 ATH_MSG_VERBOSE ( " isamp=" << isamp
1423 << " gval=" << gval
1424 << " sg=" << sg
1425 << " gpval=" << gpval
1426 << " sgp=" << sgp );
1427 }
1428
1429 dgg = sgg - sg * sg / serr;
1430 dggp = sggp - sg * sgp / serr;
1431 dgpgp = sgpgp - sgp * sgp / serr;
1432 dyg = syg - sy * sg / serr;
1433 dygp = sygp - sy * sgp / serr;
1434 dg = dgg * dgpgp - dggp * dggp;
1435
1436 // Fit for time, pedestal, and amplitude
1437 if (fabs(dg) > EPS_DG) {
1438 // Amplitude : ampl
1439 ampl = (dyg * dgpgp - dygp * dggp) / dg;
1440 // and Amplitude * time: atau
1441 atau = (dyg * dggp - dygp * dgg) / dg;
1442 // Pedestal
1443 ped = (sy - ((dyg * dgpgp - dygp * dggp) * sg + (dyg * dggp - dygp * dgg) * sgp) / dg)
1444 / serr;
1445
1446 if (fabs(ampl) > EPS_DG) {
1447 // Time
1448 tau = atau / ampl;
1449 if (tau > m_maxTau)
1450 tau = m_maxTau;
1451 else if (tau < m_minTau) tau = m_minTau;
1452 } else {
1453 tau = 0.0;
1454 }
1455 } else {
1456 ampl = 0.0;
1457 atau = 0.0;
1458 tau = 0.0;
1459 ped = sy / serr;
1460 }
1461
1462 if (msgLvl(MSG::VERBOSE)) {
1463 msg(MSG::VERBOSE) << " ped=" << ped << endmsg;
1464 msg(MSG::VERBOSE) << " sy=" << sy
1465 << " sg=" << sg
1466 << " sgp=" << sgp << endmsg;
1467
1468 msg(MSG::VERBOSE) << " syg=" << syg
1469 << " sygp=" << sygp
1470 << " sgg=" << sgg << endmsg;
1471
1472 msg(MSG::VERBOSE) << " sggp=" << sggp
1473 << " sgpgp=" << sgpgp << endmsg;
1474
1475 msg(MSG::VERBOSE) << " ampl = (dyg*dgpgp - dygp*dggp)= " << ampl << endmsg;
1476 msg(MSG::VERBOSE) << " dyg=" << dyg
1477 << " dgpgp=" << dgpgp
1478 << " dyg*dgpgp=" << (dyg * dgpgp) << endmsg;
1479
1480 msg(MSG::VERBOSE) << " dygp=" << dygp
1481 << " dggp=" << dggp
1482 << " dygp*dggp=" << (dygp * dggp) << endmsg;
1483
1484 msg(MSG::VERBOSE) << " dyg=" << dyg
1485 << " dggp=" << dggp
1486 << " dyg*dggp=" << (dyg * dggp) << endmsg;
1487
1488 msg(MSG::VERBOSE) << " dygp=" << dygp
1489 << " dgg=" << dgg
1490 << " dygp*dgg=" << (dygp * dgg) << endmsg;
1491
1492 msg(MSG::VERBOSE) << " dg=" << dg
1493 << " atau=" << atau
1494 << " tau=" << tau << endmsg;
1495 }
1496
1497 m_fnParameters[0] = tau;
1498 m_fnParameters[1] = ped;
1499 m_fnParameters[2] = ampl;
1500
1501 tempChi2 = 0;
1502 nfit_real = 0;
1503 // Calculate chi2 for physics and laser events
1504 for (int isamp = 0;
1505 (isamp < nfit) && (DTIME * (isamp - m_iPeak0) - m_t0Fit < m_maxTimeFromPeak); ++isamp) {
1506
1507 ++nfit_real;
1508 dc = yvec0[isamp] - scaledPulse(xvec[isamp], tpulse, ypulse);
1509 tempChi2 = tempChi2 + (dc * dc) / (eyvec[isamp] * eyvec[isamp]);
1510 ATH_MSG_VERBOSE ( " isamp=" << isamp
1511 << " yvec0[" << isamp << "]=" << yvec0[isamp]
1512 << " eyvec[" << isamp << "]=" << eyvec[isamp]
1513 << " dc=" << dc
1514 << " chi2=" << tempChi2 );
1515 }
1516
1517 tempChi2 = tempChi2 / (nfit_real - 3.0);
1518 ATH_MSG_VERBOSE ( " chi2/(nfit_real-3.0)=" << tempChi2
1519 << " nfit_real=" << nfit_real );
1520 } // end if fixedTime
1521 } // end of physics and laser specific part
1522
1523 if (msgLvl(MSG::VERBOSE))
1524 msg(MSG::VERBOSE) << " t0fit: " << m_t0Fit << ((tau < 0.0) ? " - " : " + ") << fabs(tau);
1525
1526 // Iteration with parameter for time
1527 m_t0Fit += tau;
1528 if ( msgLvl(MSG::VERBOSE) )
1529 msg(MSG::VERBOSE) << " = " << m_t0Fit << endmsg;
1530
1531 // Check if total time does not exceed the limits:
1532 if (m_t0Fit > m_maxTime) {
1534 tempChi2 = MAX_CHI2;
1535 } else if (m_t0Fit < m_minTime) {
1537 tempChi2 = MAX_CHI2;
1538 }
1539
1540 if (tempChi2 < MAX_CHI2) {
1541 time = m_t0Fit;
1542 pedestal = ped;
1543 amplitude = ampl;
1544 chi2 = tempChi2;
1545 } // otherwise using the previous iteration
1546
1547 } // end if to use extra iteration
1548
1549 ATH_MSG_VERBOSE ( "Result: Time=" << time
1550 << " Ped=" << pedestal
1551 << " Amplitude=" << amplitude
1552 << " Chi2=" << chi2 );
1553}
#define MAX_SAMPLES
#define EPS_DG
#define DELTA_CHI2
#define MAX_CHI2
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
double derivative(double x, const std::vector< double > *xvec, const std::vector< double > *yvec) const
Gaudi::Property< int > m_firstSample
double chi2(TH1 *h0, TH1 *h1)
time(flags, cells_name, *args, **kw)
#define unlikely(x)

◆ rawChannel()

TileRawChannel * TileRawChannelBuilderFitFilter::rawChannel ( const TileDigits * digits,
const EventContext & ctx )
overridevirtual

Builder virtual method to be implemented by subclasses.

Parameters
digitsPointer to TileDigitsContainer

Reimplemented from TileRawChannelBuilder.

Definition at line 193 of file TileRawChannelBuilderFitFilter.cxx.

193 {
194
195
196 ++m_chCounter;
197
198 const HWIdentifier adcId = digits->adc_HWID();
199
200 ATH_MSG_VERBOSE( "Running FitFilter for TileRawChannel with HWID "
201 << m_tileHWID->to_string(adcId) );
202
203 // tmp variables for filtering
204 double amplitude = 0.0;
205 double chi2 = 0.0;
206 double time = 0.0;
207 double pedestal = 0.0;
208
209 // use fit filter
210 pulseFit(digits, amplitude, time, pedestal, chi2, ctx);
211
212 unsigned int drawerIdx(0), channel(0), adc(0);
213 m_tileIdTransforms->getIndices(adcId, drawerIdx, channel, adc);
214
215 // fit filter calib
216 // note that when called from TileROD_Decoder, m_calibrateEnergy is set
217 // from TileROD_Decoder...
218 if (m_calibrateEnergy) {
219 amplitude = m_tileToolEmscale->doCalibCis(drawerIdx, channel, adc, amplitude);
220 }
221
222 ATH_MSG_VERBOSE( "Creating RawChannel"
223 << " a=" << amplitude
224 << " t=" << time
225 << " q=" << chi2
226 << " ped=" << pedestal );
227
228
229 // return new TileRawChannel
230 // TileRawChannel *rawCh = new TileRawChannel(adcId,amplitude,time,chi2,pedestal);
231
232 DataPool<TileRawChannel> tileRchPool(m_dataPoollSize);
233 TileRawChannel *rawCh = tileRchPool.nextElementPtr();
234 rawCh->assign (adcId,
235 amplitude,
236 time,
237 chi2,
238 pedestal);
239
240 if (m_correctTime && ((chi2 > 0) || m_bestPhase)) {
241 time -= m_tileToolTiming->getSignalPhase(drawerIdx, channel, adc);
242 rawCh->insertTime(time);
243 ATH_MSG_VERBOSE( "Correcting time, new time=" << rawCh->time() );
244 }
245
246 int gain = m_tileHWID->adc(adcId);
247 if (TileID::HIGHGAIN == gain) {
248 ++m_nChH;
249 m_RChSumH += amplitude;
250 } else {
251 ++m_nChL;
252 m_RChSumL += amplitude;
253 }
254
255 /*
256 ATH_MSG_ALWAYS("TileRawChannel Id: " << m_tileHWID->to_string(adcId)
257 << " => amp/ped/time: " << rawCh->amplitude() << "/" << rawCh->pedestal() << "/" << rawCh->time());
258 */
259 return rawCh;
260}
void pulseFit(const TileDigits *digit, double &amplitude, double &time, double &pedestal, double &chi2, const EventContext &ctx)
Calculate energy, time and chi2 for one channel using fitted pulse shape.
Gaudi::Property< int > m_dataPoollSize
Gaudi::Property< bool > m_correctTime
ToolHandle< TileCondIdTransforms > m_tileIdTransforms
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
Gaudi::Property< bool > m_calibrateEnergy
void assign(const HWIdentifier &id, float amplitude, float time, float quality, float ped=0.0)
void insertTime(float time)
float time(int ind=0) const

◆ 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 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
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 352 of file AthCommonDataStore.h.

352 {
354 }

◆ resetDrawer()

void TileRawChannelBuilder::resetDrawer ( )
inherited

Definition at line 28 of file TileRawChannelBuilder.cxx.

28 {
29 m_lastDrawer = -1;
30 m_badDrawer = false;
31}

◆ resetOverflows()

void TileRawChannelBuilder::resetOverflows ( void )
inherited

Definition at line 33 of file TileRawChannelBuilder.cxx.

33 {
34 m_overflows.clear();
35}

◆ scaledPulse()

double TileRawChannelBuilderFitFilter::scaledPulse ( double x,
const std::vector< double > * xvec,
const std::vector< double > * yvec ) const
inlineprivate

Definition at line 62 of file TileRawChannelBuilderFitFilter.h.

62 {
63 return m_fnParameters[1] + m_fnParameters[2] * pulse(x, xvec, yvec, false);
64 }

◆ 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 >, and AthCheckedComponent<::AthAlgTool >.

◆ 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 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_ADCmaskValueMinusEps

float TileRawChannelBuilder::m_ADCmaskValueMinusEps {0.f}
protectedinherited

indicates channels which were masked in background dataset

Definition at line 225 of file TileRawChannelBuilder.h.

225{0.f};

◆ m_ADCmaxMinusEps

float TileRawChannelBuilder::m_ADCmaxMinusEps {0.f}
protectedinherited

Definition at line 224 of file TileRawChannelBuilder.h.

224{0.f};

◆ m_ampMinThresh

Gaudi::Property<float> TileRawChannelBuilder::m_ampMinThresh
protectedinherited
Initial value:
{this, "AmpMinForAmpCorrection", 15.0,
"Correct amplitude if it's above amplitude threshold (in ADC counts)"}

Definition at line 152 of file TileRawChannelBuilder.h.

152 {this, "AmpMinForAmpCorrection", 15.0,
153 "Correct amplitude if it's above amplitude threshold (in ADC counts)"};

◆ m_badDrawer

bool TileRawChannelBuilder::m_badDrawer {false}
protectedinherited

Definition at line 213 of file TileRawChannelBuilder.h.

213{false};

◆ m_bestPhase

Gaudi::Property<bool> TileRawChannelBuilderFitFilter::m_bestPhase {this, "BestPhase", false, "Use best phase from DB"}
private

Definition at line 55 of file TileRawChannelBuilderFitFilter.h.

55{this, "BestPhase", false, "Use best phase from DB"};

◆ m_bsflags

unsigned int TileRawChannelBuilder::m_bsflags {0}
protectedinherited

Definition at line 138 of file TileRawChannelBuilder.h.

138{0};

◆ m_cabling

const TileCablingService* TileRawChannelBuilder::m_cabling {nullptr}
protectedinherited

TileCabling instance.

Definition at line 185 of file TileRawChannelBuilder.h.

185{nullptr};

◆ m_cablingSvc

ServiceHandle<TileCablingSvc> TileRawChannelBuilder::m_cablingSvc
protectedinherited
Initial value:
{ this,
"TileCablingSvc", "TileCablingSvc", "The Tile cabling service"}

Name of Tile cabling service.

Definition at line 182 of file TileRawChannelBuilder.h.

182 { this,
183 "TileCablingSvc", "TileCablingSvc", "The Tile cabling service"};

◆ m_calibrateEnergy

Gaudi::Property<bool> TileRawChannelBuilder::m_calibrateEnergy {this, "calibrateEnergy", false, "Calibrate energy"}
protectedinherited

Definition at line 142 of file TileRawChannelBuilder.h.

142{this, "calibrateEnergy", false, "Calibrate energy"};

◆ m_capdaq

double TileRawChannelBuilder::m_capdaq {100.}
protectedinherited

Definition at line 196 of file TileRawChannelBuilder.h.

196{100.}; // Capacitor

◆ m_channelNoiseRMS

Gaudi::Property<int> TileRawChannelBuilderFitFilter::m_channelNoiseRMS {this, "RMSChannelNoise", 3, "Which channel noise RMS to use"}
private

Definition at line 92 of file TileRawChannelBuilderFitFilter.h.

92{this, "RMSChannelNoise", 3, "Which channel noise RMS to use"};

◆ m_chCounter

unsigned int TileRawChannelBuilder::m_chCounter {0}
protectedinherited

Definition at line 199 of file TileRawChannelBuilder.h.

199{0};

◆ m_cischan

int TileRawChannelBuilder::m_cischan {-1}
protectedinherited

Definition at line 195 of file TileRawChannelBuilder.h.

195{-1}; // which channel is fired by CIS

◆ m_correctTime

Gaudi::Property<bool> TileRawChannelBuilder::m_correctTime {this, "correctTime", false, "Correct time"}
protectedinherited

Definition at line 145 of file TileRawChannelBuilder.h.

145{this, "correctTime", false, "Correct time"};

◆ m_dataPoollSize

Gaudi::Property<int> TileRawChannelBuilder::m_dataPoollSize {this, "DataPoolSize", -1, "Data pool size"}
protectedinherited

Definition at line 207 of file TileRawChannelBuilder.h.

207{this, "DataPoolSize", -1, "Data pool size"};

◆ m_demoFragIDs

Gaudi::Property<std::vector<int> > TileRawChannelBuilder::m_demoFragIDs
protectedinherited
Initial value:
{this,
"DemoFragIDs", {}, "List of Tile frag IDs with new electronics (demonstrator)"}

Definition at line 187 of file TileRawChannelBuilder.h.

187 {this,
188 "DemoFragIDs", {}, "List of Tile frag IDs with new electronics (demonstrator)"};

◆ m_detStore

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

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_dgPhysHi

std::vector<double> TileRawChannelBuilderFitFilter::m_dgPhysHi
private

Definition at line 88 of file TileRawChannelBuilderFitFilter.h.

◆ m_dgPhysLo

std::vector<double> TileRawChannelBuilderFitFilter::m_dgPhysLo
private

Definition at line 86 of file TileRawChannelBuilderFitFilter.h.

◆ m_disableNegativeAmp

Gaudi::Property<bool> TileRawChannelBuilderFitFilter::m_disableNegativeAmp {this, "DisableNegativeAmp", false, "Disable negative amplitude"}
private

Definition at line 119 of file TileRawChannelBuilderFitFilter.h.

119{this, "DisableNegativeAmp", false, "Disable negative amplitude"};

◆ m_DQstatusKey

SG::ReadHandleKey<TileDQstatus> TileRawChannelBuilder::m_DQstatusKey
protectedinherited
Initial value:
{this, "TileDQstatus",
"TileDQstatus",
"TileDQstatus key"}

Definition at line 120 of file TileRawChannelBuilder.h.

120 {this, "TileDQstatus",
121 "TileDQstatus",
122 "TileDQstatus key"};

◆ m_DSPContainerKey

SG::ReadHandleKey<TileRawChannelContainer> TileRawChannelBuilder::m_DSPContainerKey {this, "DSPContainer", "", "DSP Container key"}
protectedinherited

Definition at line 125 of file TileRawChannelBuilder.h.

126{this, "DSPContainer", "", "DSP Container key"};

◆ m_dummy

std::vector<double> TileRawChannelBuilderFitFilter::m_dummy
private

Definition at line 70 of file TileRawChannelBuilderFitFilter.h.

◆ m_error

int TileRawChannelBuilder::m_error[MAX_CHANNELS]
protectedinherited

Definition at line 211 of file TileRawChannelBuilder.h.

◆ m_evtCounter

unsigned int TileRawChannelBuilder::m_evtCounter {0}
protectedinherited

Definition at line 198 of file TileRawChannelBuilder.h.

198{0};

◆ m_evtStore

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

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_extraSamplesLeft

Gaudi::Property<int> TileRawChannelBuilderFitFilter::m_extraSamplesLeft {this, "ExtraSamplesLeft", 0, "Increase window on left side"}
private

Definition at line 94 of file TileRawChannelBuilderFitFilter.h.

94{this, "ExtraSamplesLeft", 0, "Increase window on left side"};

◆ m_extraSamplesRight

Gaudi::Property<int> TileRawChannelBuilderFitFilter::m_extraSamplesRight {this, "ExtraSamplesRight", 0, "Increase window on right side"}
private

Definition at line 95 of file TileRawChannelBuilderFitFilter.h.

95{this, "ExtraSamplesRight", 0, "Increase window on right side"};

◆ m_f_ADCmax

float TileRawChannelBuilder::m_f_ADCmax {0.f}
protectedinherited

Definition at line 221 of file TileRawChannelBuilder.h.

221{0.f};

◆ m_f_ADCmaxPlus1

float TileRawChannelBuilder::m_f_ADCmaxPlus1 {0.f}
protectedinherited

Definition at line 223 of file TileRawChannelBuilder.h.

223{0.f};

◆ m_firstSample

Gaudi::Property<int> TileRawChannelBuilder::m_firstSample {this, "FirstSample", 0, "First sample to start with the analysis"}
protectedinherited

Definition at line 140 of file TileRawChannelBuilder.h.

140{this, "FirstSample", 0, "First sample to start with the analysis"};

◆ m_fnParameters

double TileRawChannelBuilderFitFilter::m_fnParameters[3] {}
private

Definition at line 76 of file TileRawChannelBuilderFitFilter.h.

76{};

◆ m_frameLength

Gaudi::Property<int> TileRawChannelBuilderFitFilter::m_frameLength {this, "FrameLength", 9, "Frame length (number of samples)"}
private

Definition at line 91 of file TileRawChannelBuilderFitFilter.h.

91{this, "FrameLength", 9, "Frame length (number of samples)"};

◆ m_gPhysHi

std::vector<double> TileRawChannelBuilderFitFilter::m_gPhysHi
private

Definition at line 87 of file TileRawChannelBuilderFitFilter.h.

◆ m_gPhysLo

std::vector<double> TileRawChannelBuilderFitFilter::m_gPhysLo
private

Definition at line 85 of file TileRawChannelBuilderFitFilter.h.

◆ m_i_ADCmax

int TileRawChannelBuilder::m_i_ADCmax {0}
protectedinherited

Definition at line 220 of file TileRawChannelBuilder.h.

220{0};

◆ m_i_ADCmaxPlus1

int TileRawChannelBuilder::m_i_ADCmaxPlus1 {0}
protectedinherited

Definition at line 222 of file TileRawChannelBuilder.h.

222{0};

◆ m_idocis

bool TileRawChannelBuilder::m_idocis {false}
protectedinherited

Definition at line 194 of file TileRawChannelBuilder.h.

194{false}; // CIS fitting

◆ m_idolas

bool TileRawChannelBuilder::m_idolas {false}
protectedinherited

Definition at line 192 of file TileRawChannelBuilder.h.

192{false}; // Laser fitting

◆ m_idoped

bool TileRawChannelBuilder::m_idoped {false}
protectedinherited

Definition at line 193 of file TileRawChannelBuilder.h.

193{false}; // Ped run, phys fitting

◆ m_idophys

bool TileRawChannelBuilder::m_idophys {false}
protectedinherited

Definition at line 191 of file TileRawChannelBuilder.h.

191{false}; // Phys fitting

◆ m_infoName

Gaudi::Property<std::string> TileRawChannelBuilder::m_infoName {this, "TileInfoName", "TileInfo", "Name of TileInfo object"}
protectedinherited

Definition at line 218 of file TileRawChannelBuilder.h.

218{this, "TileInfoName", "TileInfo", "Name of TileInfo object"};

◆ m_iPeak0

int TileRawChannelBuilderFitFilter::m_iPeak0
private

Definition at line 77 of file TileRawChannelBuilderFitFilter.h.

◆ m_lastDrawer

int TileRawChannelBuilder::m_lastDrawer {-1}
protectedinherited

Definition at line 212 of file TileRawChannelBuilder.h.

212{-1};

◆ m_maxIterate

Gaudi::Property<int> TileRawChannelBuilderFitFilter::m_maxIterate {this, "MaxIterate", 9, "Maximum number of fit iterations"}
private

Definition at line 93 of file TileRawChannelBuilderFitFilter.h.

93{this, "MaxIterate", 9, "Maximum number of fit iterations"};

◆ m_maxTau

double TileRawChannelBuilderFitFilter::m_maxTau
private

Definition at line 82 of file TileRawChannelBuilderFitFilter.h.

◆ m_maxTime

double TileRawChannelBuilderFitFilter::m_maxTime
private

Definition at line 80 of file TileRawChannelBuilderFitFilter.h.

◆ m_maxTimeFromPeak

Gaudi::Property<double> TileRawChannelBuilderFitFilter::m_maxTimeFromPeak
private
Initial value:
{this, "MaxTimeFromPeak", 250.0,
"Max time for fitting the pulse shapes. Samples with t>t0+MaxTimeFromPeak are not fitted"}

Definition at line 108 of file TileRawChannelBuilderFitFilter.h.

108 {this, "MaxTimeFromPeak", 250.0,
109 "Max time for fitting the pulse shapes. Samples with t>t0+MaxTimeFromPeak are not fitted"};

◆ m_minTau

double TileRawChannelBuilderFitFilter::m_minTau
private

Definition at line 81 of file TileRawChannelBuilderFitFilter.h.

◆ m_minTime

double TileRawChannelBuilderFitFilter::m_minTime
private

Definition at line 79 of file TileRawChannelBuilderFitFilter.h.

◆ m_nChH

int TileRawChannelBuilder::m_nChH {0}
protectedinherited

Definition at line 202 of file TileRawChannelBuilder.h.

202{0};

◆ m_nChL

int TileRawChannelBuilder::m_nChL {0}
protectedinherited

Definition at line 201 of file TileRawChannelBuilder.h.

201{0};

◆ m_noiseFilterTools

ToolHandleArray<ITileRawChannelTool> TileRawChannelBuilder::m_noiseFilterTools
protectedinherited
Initial value:
{this,
"NoiseFilterTools", {}, "Tile noise filter tools"}

Definition at line 166 of file TileRawChannelBuilder.h.

166 {this,
167 "NoiseFilterTools", {}, "Tile noise filter tools"};

◆ m_noiseHigh

Gaudi::Property<double> TileRawChannelBuilderFitFilter::m_noiseHigh {this, "NoiseHighGain", 1.5, "Default high gain noise"}
private

Definition at line 114 of file TileRawChannelBuilderFitFilter.h.

114{this, "NoiseHighGain", 1.5, "Default high gain noise"};

◆ m_noiseLow

Gaudi::Property<double> TileRawChannelBuilderFitFilter::m_noiseLow {this, "NoiseLowGain", 0.6, "Default low gain noise"}
private

Definition at line 112 of file TileRawChannelBuilderFitFilter.h.

112{this, "NoiseLowGain", 0.6, "Default low gain noise"};

◆ m_noiseThresholdRMS

Gaudi::Property<double> TileRawChannelBuilderFitFilter::m_noiseThresholdRMS
private
Initial value:
{this, "NoiseThresholdRMS", 3.0,
"For pedestal-like events only 2-parametric fit is applied"}

Definition at line 105 of file TileRawChannelBuilderFitFilter.h.

105 {this, "NoiseThresholdRMS", 3.0,
106 "For pedestal-like events only 2-parametric fit is applied"};

◆ m_notUpgradeCabling

bool TileRawChannelBuilder::m_notUpgradeCabling {true}
protectedinherited

Definition at line 215 of file TileRawChannelBuilder.h.

215{true};

◆ m_overflows

Overflows_t TileRawChannelBuilder::m_overflows
protectedinherited

Definition at line 206 of file TileRawChannelBuilder.h.

◆ m_pulseShapes

const TilePulseShapesStruct* TileRawChannelBuilderFitFilter::m_pulseShapes
private

Definition at line 117 of file TileRawChannelBuilderFitFilter.h.

◆ m_rawChannelCnt

std::unique_ptr<TileMutableRawChannelContainer> TileRawChannelBuilder::m_rawChannelCnt
protectedinherited

Definition at line 133 of file TileRawChannelBuilder.h.

◆ m_rawChannelContainerKey

SG::WriteHandleKey<TileRawChannelContainer> TileRawChannelBuilder::m_rawChannelContainerKey
protectedinherited
Initial value:
{this,"TileRawChannelContainer","TileRawChannelFiltered",
"Output Tile raw channels container key"}

Definition at line 129 of file TileRawChannelBuilder.h.

129 {this,"TileRawChannelContainer","TileRawChannelFiltered",
130 "Output Tile raw channels container key"};

◆ m_RChSumH

double TileRawChannelBuilder::m_RChSumH {0.}
protectedinherited

Definition at line 204 of file TileRawChannelBuilder.h.

204{0.};

◆ m_RChSumL

double TileRawChannelBuilder::m_RChSumL {0.}
protectedinherited

Definition at line 203 of file TileRawChannelBuilder.h.

203{0.};

◆ m_rChType

TileFragHash::TYPE TileRawChannelBuilder::m_rChType {TileFragHash::Default}
protectedinherited

Definition at line 136 of file TileRawChannelBuilder.h.

◆ m_rChUnit

TileRawChannelUnit::UNIT TileRawChannelBuilder::m_rChUnit {TileRawChannelUnit::ADCcounts}
protectedinherited

Definition at line 137 of file TileRawChannelBuilder.h.

◆ m_runType

Gaudi::Property<int> TileRawChannelBuilder::m_runType {this, "RunType", 0, "Run type used to override value of trigType in event"}
protectedinherited

Definition at line 160 of file TileRawChannelBuilder.h.

160{this, "RunType", 0, "Run type used to override value of trigType in event"};

◆ m_saturatedSample

Gaudi::Property<double> TileRawChannelBuilderFitFilter::m_saturatedSample {this, "SaturatedSample", -1.0, "Defines the saturated sample"}
private

Definition at line 97 of file TileRawChannelBuilderFitFilter.h.

97{this, "SaturatedSample", -1.0, "Defines the saturated sample"};

◆ m_saturatedSampleError

Gaudi::Property<double> TileRawChannelBuilderFitFilter::m_saturatedSampleError
private
Initial value:
{this, "SaturatedSampleError", 6.0,
"Error in terms of RMS assigned to the saturated sample"}

Definition at line 99 of file TileRawChannelBuilderFitFilter.h.

99 {this, "SaturatedSampleError", 6.0,
100 "Error in terms of RMS assigned to the saturated sample"};

◆ m_specialDemoShape

Gaudi::Property<int> TileRawChannelBuilderFitFilter::m_specialDemoShape
private
Initial value:
{this, "SpecialDemoShape", -1,
"If >=0 - pulse shape for Demo is stored in non-default structures"}

Definition at line 121 of file TileRawChannelBuilderFitFilter.h.

121 {this, "SpecialDemoShape", -1,
122 "If >=0 - pulse shape for Demo is stored in non-default structures"};

◆ m_t0Fit

double TileRawChannelBuilderFitFilter::m_t0Fit
private

Definition at line 73 of file TileRawChannelBuilderFitFilter.h.

◆ m_tileHWID

const TileHWID* TileRawChannelBuilder::m_tileHWID {nullptr}
protectedinherited

Definition at line 164 of file TileRawChannelBuilder.h.

164{nullptr};

◆ m_tileID

const TileID* TileRawChannelBuilder::m_tileID {nullptr}
protectedinherited

Definition at line 163 of file TileRawChannelBuilder.h.

163{nullptr};

◆ m_tileIdTransforms

ToolHandle<TileCondIdTransforms> TileRawChannelBuilder::m_tileIdTransforms
protectedinherited
Initial value:
{this,
"TileCondIdTransforms", "TileCondIdTransforms",
"Tile tool to tranlate hardware identifier to the drawerIdx, channel, and adc"}

Definition at line 175 of file TileRawChannelBuilder.h.

175 {this,
176 "TileCondIdTransforms", "TileCondIdTransforms",
177 "Tile tool to tranlate hardware identifier to the drawerIdx, channel, and adc"};

◆ m_tileInfo

const TileInfo* TileRawChannelBuilder::m_tileInfo {nullptr}
protectedinherited

Definition at line 219 of file TileRawChannelBuilder.h.

219{nullptr};

◆ m_tileToolEmscale

ToolHandle<TileCondToolEmscale> TileRawChannelBuilder::m_tileToolEmscale
protectedinherited
Initial value:
{this,
"TileCondToolEmscale", "TileCondToolEmscale", "Tile EM scale calibration tool"}

Definition at line 169 of file TileRawChannelBuilder.h.

169 {this,
170 "TileCondToolEmscale", "TileCondToolEmscale", "Tile EM scale calibration tool"};

◆ m_tileToolNoiseSample

ToolHandle<TileCondToolNoiseSample> TileRawChannelBuilderFitFilter::m_tileToolNoiseSample
private
Initial value:
{this,
"TileCondToolNoiseSample", "TileCondToolNoiseSample", "Tile sample noise tool"}

Definition at line 124 of file TileRawChannelBuilderFitFilter.h.

124 {this,
125 "TileCondToolNoiseSample", "TileCondToolNoiseSample", "Tile sample noise tool"};

◆ m_tileToolTiming

ToolHandle<TileCondToolTiming> TileRawChannelBuilder::m_tileToolTiming
protectedinherited
Initial value:
{this,
"TileCondToolTiming", "TileCondToolTiming", "Tile timing tool"}

Definition at line 172 of file TileRawChannelBuilder.h.

172 {this,
173 "TileCondToolTiming", "TileCondToolTiming", "Tile timing tool"};

◆ m_timeMaxThresh

Gaudi::Property<float> TileRawChannelBuilder::m_timeMaxThresh
protectedinherited
Initial value:
{this, "TimeMaxForAmpCorrection", 12.5,
"Correct amplitude if time is below time max threshold"}

Definition at line 156 of file TileRawChannelBuilder.h.

156 {this, "TimeMaxForAmpCorrection", 12.5,
157 "Correct amplitude if time is below time max threshold"};

◆ m_timeMinThresh

Gaudi::Property<float> TileRawChannelBuilder::m_timeMinThresh
protectedinherited
Initial value:
{this, "TimeMinForAmpCorrection", -12.5,
"Correct amplitude if time is above time min threshold"}

Definition at line 154 of file TileRawChannelBuilder.h.

154 {this, "TimeMinForAmpCorrection", -12.5,
155 "Correct amplitude if time is above time min threshold"};

◆ m_trigType

int TileRawChannelBuilder::m_trigType {0}
protectedinherited

Definition at line 190 of file TileRawChannelBuilder.h.

190{0};

◆ m_useDSP

Gaudi::Property<bool> TileRawChannelBuilder::m_useDSP {this, "UseDSPCorrection", true, "Use DSP noise correction for incomplete containers"}
protectedinherited

Definition at line 149 of file TileRawChannelBuilder.h.

149{this, "UseDSPCorrection", true, "Use DSP noise correction for incomplete containers"};

◆ m_varHandleArraysDeclared

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

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 386 of file AthCommonDataStore.h.

◆ m_zeroSampleError

Gaudi::Property<double> TileRawChannelBuilderFitFilter::m_zeroSampleError
private
Initial value:
{this, "ZeroSampleError", 100.0,
"Error in terms of RMS assigned to the zero sample (== 0)"}

Definition at line 102 of file TileRawChannelBuilderFitFilter.h.

102 {this, "ZeroSampleError", 100.0,
103 "Error in terms of RMS assigned to the zero sample (== 0)"};

◆ MAX_CHANNELS

const int TileRawChannelBuilder::MAX_CHANNELS = 48
staticprotectedinherited

Definition at line 209 of file TileRawChannelBuilder.h.

◆ MAX_DMUS

const int TileRawChannelBuilder::MAX_DMUS = 16
staticprotectedinherited

Definition at line 210 of file TileRawChannelBuilder.h.


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