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 TileRawChannelrawChannel (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_tgetOverflowedChannels (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< TileDQstatusm_DQstatusKey
SG::ReadHandleKey< TileRawChannelContainerm_DSPContainerKey {this, "DSPContainer", "", "DSP Container key"}
SG::WriteHandleKey< TileRawChannelContainerm_rawChannelContainerKey
std::unique_ptr< TileMutableRawChannelContainerm_rawChannelCnt
TileFragHash::TYPE m_rChType
TileRawChannelUnit::UNIT m_rChUnit
unsigned int m_bsflags
int m_firstSample
bool m_calibrateEnergy
bool m_correctTime
bool m_useDSP
float m_ampMinThresh
 correct amplitude if it's above amplitude threshold (in ADC counts)
float m_timeMinThresh
 correct amplitude is time is above time min threshold
float m_timeMaxThresh
 correct amplitude is time is below time max threshold
int m_runType
const TileIDm_tileID
const TileHWIDm_tileHWID
ToolHandleArray< ITileRawChannelToolm_noiseFilterTools
ToolHandle< TileCondToolEmscalem_tileToolEmscale
ToolHandle< TileCondToolTimingm_tileToolTiming
ToolHandle< TileCondIdTransformsm_tileIdTransforms
ServiceHandle< TileCablingSvcm_cablingSvc
 Name of Tile cabling service.
const TileCablingServicem_cabling
 TileCabling instance.
Gaudi::Property< std::vector< int > > m_demoFragIDs
int m_trigType
bool m_idophys
bool m_idolas
bool m_idoped
bool m_idocis
int m_cischan
double m_capdaq
unsigned int m_evtCounter
unsigned int m_chCounter
int m_nChL
int m_nChH
double m_RChSumL
double m_RChSumH
Overflows_t m_overflows
int m_dataPoollSize
int m_error [MAX_CHANNELS]
int m_lastDrawer = -1
bool m_badDrawer = false
bool m_notUpgradeCabling
std::string m_infoName
const TileInfom_tileInfo
int m_i_ADCmax
float m_f_ADCmax
int m_i_ADCmaxPlus1
float m_f_ADCmaxPlus1
float m_ADCmaxMinusEps
float m_ADCmaskValueMinusEps
 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< StoreGateSvcStoreGateSvc_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
int m_frameLength
int m_channelNoiseRMS
int m_maxIterate
int m_extraSamplesLeft
int m_extraSamplesRight
double m_saturatedSample
double m_saturatedSampleError
double m_zeroSampleError
double m_noiseThresholdRMS
double m_maxTimeFromPeak
double m_noiseLow
double m_noiseHigh
const TilePulseShapesStructm_pulseShapes
bool m_disableNegativeAmp
int m_specialDemoShape
ToolHandle< TileCondToolNoiseSamplem_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 388 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
58 //declare properties
59 declareProperty("FrameLength",m_frameLength = 9);
60 declareProperty("MaxIterate",m_maxIterate = 9);
61 declareProperty("NoiseLowGain",m_noiseLow = 0.6);
62 declareProperty("NoiseHighGain",m_noiseHigh = 1.5);
63 declareProperty("RMSChannelNoise",m_channelNoiseRMS = 3);
64 declareProperty("ExtraSamplesLeft",m_extraSamplesLeft=0); // increase window on left side
65 declareProperty("ExtraSamplesRight",m_extraSamplesRight=0); // increase window on right side
66 declareProperty("SaturatedSample",m_saturatedSample = -1.0);
67 declareProperty("SaturatedSampleError",m_saturatedSampleError = 6.0);
68 declareProperty("ZeroSampleError",m_zeroSampleError = 100.0);
69 declareProperty("NoiseThresholdRMS",m_noiseThresholdRMS = 3.0);
70 declareProperty("MaxTimeFromPeak",m_maxTimeFromPeak = 250.0);
71
72 declareProperty("DisableNegativeAmp",m_disableNegativeAmp = false);
73
74 declareProperty("SpecialDemoShape",m_specialDemoShape = -1); // if >=0 - pulse shape for Demo is stored in non-default structures
75}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
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 80 of file TileRawChannelBuilderFitFilter.cxx.

80 {
81}

Member Function Documentation

◆ BadPatternName()

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

Definition at line 458 of file TileRawChannelBuilder.cxx.

458 {
459 static const char * const errname[26] = {
460 "-10 - good signal",
461 "-9 - underflow",
462 "-8 - overflow",
463 "-7 - underflow and overflow",
464 "-6 - constant signal",
465 "-5 - disconnected channel",
466 "-4 - half a drawer masked",
467 "-3 - bad DQ status",
468 "-2 - underflow in all samples",
469 "-1 - overflow in all samples",
470 "0 - unknown error",
471 "1 - jump from zero to saturation",
472 "2 - samples with zeros",
473 "3 - at least two saturated. others - close to pedestal",
474 "4 - two distinct levels with at least 2 samples each",
475 "5 - pedestal with jump up in one sample",
476 "6 - pedestal with jump down in one sample",
477 "7 - signal with jump up in one sample",
478 "8 - signal with jump down in one sample",
479 "9 - base line above threshold in low gain",
480 "10 - jump down in first sample in low gain",
481 "11 - jump down in last sample in low gain",
482 "12 - jump up in one sample above const",
483 "13 - jump down in one sample below const",
484 "14 - unrecoverable timing jump",
485 "15 - unknown error"
486 };
487
488 return errname[std::min(25, std::max(0, int((ped + 500) * 1e-4)))];
489}

◆ build()

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

Definition at line 492 of file TileRawChannelBuilder.cxx.

493{
494
495 int frag = coll->identify();
496
497 // make sure that error array is up-to-date
498 if (frag != m_lastDrawer && m_notUpgradeCabling) {
499 fill_drawer_errors(ctx, coll);
500 }
501
502 // Iterate over all digits in this collection
503 TileDigitsCollection::const_iterator digitItr = coll->begin();
504 TileDigitsCollection::const_iterator lastDigit = coll->end();
505
506 for (; digitItr != lastDigit; ++digitItr) {
507
508 TileRawChannel* rch = rawChannel((*digitItr), ctx);
509
511
512 int err = m_error[m_tileHWID->channel(rch->adc_HWID())];
513
514 if (err) {
515 if (err == -8 || err == -7) m_overflows.push_back(std::make_pair(rch, (*digitItr)));
516 float ped = rch->pedestal() + 100000 + 10000 * err;
517 rch->setPedestal(ped);
518 if (msgLvl(MSG::VERBOSE) && !m_badDrawer) {
519 if (err < -5) {
520 msg(MSG::VERBOSE) << "BadCh " << m_tileHWID->to_string(rch->adc_HWID())
521 << " warning = " << BadPatternName(ped) << endmsg;
522 } else {
523 msg(MSG::VERBOSE) << "BadCh " << m_tileHWID->to_string(rch->adc_HWID())
524 << " error = " << BadPatternName(ped) << endmsg;
525 }
526 }
527 }
528
529 }
530
531 ATH_CHECK( m_rawChannelCnt->push_back (rch) );
532 }
533
534 IdentifierHash hash = m_rawChannelCnt->hashFunc().hash(coll->identify());
535 TileRawChannelCollection* rawChannelCollection = m_rawChannelCnt->indexFindPtr(hash);
536 rawChannelCollection->setLvl1Id(coll->getLvl1Id());
537 rawChannelCollection->setLvl1Type(coll->getLvl1Type());
538 rawChannelCollection->setDetEvType(coll->getDetEvType());
539 rawChannelCollection->setRODBCID(coll->getRODBCID());
540
541 return StatusCode::SUCCESS;
542}
#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:838
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 544 of file TileRawChannelBuilder.cxx.

545{
546
547 const TileDQstatus* DQstatus = SG::makeHandle (m_DQstatusKey, ctx).get();
548
549 ToolHandleArray<ITileRawChannelTool>::iterator itrTool = m_noiseFilterTools.begin();
550 ToolHandleArray<ITileRawChannelTool>::iterator endTool = m_noiseFilterTools.end();
551
552 if ( m_useDSP && !m_DSPContainerKey.key().empty() &&
553 (DQstatus->incompleteDigits() || m_chCounter<12288) && itrTool!=endTool )
554 {
555 const TileRawChannelContainer * dspCnt = SG::makeHandle (m_DSPContainerKey, ctx).get();
556 ATH_MSG_DEBUG( "Incomplete container - use noise filter corrections from DSP container" );
557
558 uint32_t bsFlags = dspCnt->get_bsflags();
559 std::vector<IdentifierHash> hashes = m_rawChannelCnt->GetAllCurrentHashes();
560 std::vector<IdentifierHash> dspHashes = dspCnt->GetAllCurrentHashes();
561 if (bsFlags == 0) {
562 ATH_MSG_WARNING("Problem in applying noise corrections: DSP container ("
563 << m_DSPContainerKey.key() << ") seems to be emtpy!");
564 } else if (hashes != dspHashes) {
565 ATH_MSG_ERROR( " Error in applying noise corrections; "
566 "hash vectors do not match.");
567 } else {
568 // Go through all TileRawChannelCollections
569 for (IdentifierHash hash : hashes) {
570 TileRawChannelCollection* coll = m_rawChannelCnt->indexFindPtr (hash);
571 const TileRawChannelCollection* dcoll = dspCnt->indexFindPtr (hash);
572
573 if (coll->identify() != dcoll->identify()) {
574
575 ATH_MSG_ERROR( " Error in applying noise corrections " << MSG::hex
576 << " collection IDs 0x" << coll->identify() << " and 0x" << dcoll->identify()
577 << " do not match " << MSG::dec );
578 break;
579 }
580
581 // iterate over all channels in a collection
584
585 for (TileRawChannel* rch : *coll) {
586 HWIdentifier adc_id = rch->adc_HWID();
587 while (dspItr != dspLast && adc_id != (*dspItr)->adc_HWID()) {
588 ++dspItr;
589 }
590 if (dspItr != dspLast) {
591 float corr = (*dspItr)->pedestal();
592 ATH_MSG_VERBOSE( "Ch "<<m_tileHWID->to_string(adc_id)
593 <<" amp " << rch->amplitude() << " ped " << rch->pedestal()
594 << " corr " << corr );
595 if (corr<10000.) {
596 rch->setAmplitude (rch->amplitude() - corr); // just baseline shift
597 rch->setPedestal (rch->pedestal() + corr); // just baseline shift
598 } else {
599 float ped = rch->pedestal();
600 if (corr > ped) {
601 rch->setPedestal (fmod(ped,10000.) + int(corr)/10000 * 10000); // changing error status
602 ATH_MSG_VERBOSE( "New error status in ped "<<rch->pedestal());
603 }
604 }
605 } else {
606 ATH_MSG_WARNING(" Problem in applying noise corrections "
607 << " can not find channel in DSP container with HWID "
608 << m_tileHWID->to_string(adc_id) );
609 dspItr = dcoll->begin();
610 }
611 }
612 }
613 }
614
615 } else {
616
617 for (ToolHandle<ITileRawChannelTool>& noiseFilterTool : m_noiseFilterTools) {
618 if (noiseFilterTool->process(*m_rawChannelCnt.get(), ctx).isFailure()) {
619 ATH_MSG_ERROR( " Error status returned from noise filter " );
620 } else {
621 ATH_MSG_DEBUG( "Noise filter applied to the container" );
622 }
623 }
624
625 }
626
627 ATH_MSG_DEBUG( " nCh=" << m_chCounter
628 << " nChH/L=" << m_nChH << "/" << m_nChL
629 << " RChSumH/L=" << m_RChSumH << "/" << m_RChSumL );
630
631 SG::WriteHandle<TileRawChannelContainer> rawChannelsContainer(m_rawChannelContainerKey, ctx);
632 ATH_CHECK( rawChannelsContainer.record(std::move(m_rawChannelCnt)) );
633
634 endLog();
635
636 return StatusCode::SUCCESS;
637}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(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).
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 646 of file TileRawChannelBuilder.cxx.

646 {
647
648 double corr = 1.0;
649 if (of2) {
650 // estimation from Belen for rel 14.0.0
651 /*double a,b,c;
652 if(fabs(phase)<5.){
653 a=0.137; b=0.0877; c=0.0865;
654 }else{
655 a=0.565; b=0.116; c=0.0751;
656 }
657 corr=(1+(a+b*phase+c*phase*phase)/100.);
658 */
659
660 // estimation from Vakhtang for rel 14.4.0
661 /*double k = (phase < 0.0 ? 0.0009400 : 0.0010160);
662 corr = (1.0 + k * phase * phase);
663 */
664
665 // Parabolic correction from Tigran
666 double a1,a2,b,c;
667 a1 = phase < 0.0 ? 0.000940774 : 0.00102111;
668 a2 = phase < 0.0 ? 0.000759051 : 0.000689625;
669 b = phase < 0.0 ? -2.0 * 7.0 * (a1 - a2) : 2.0 * 12.5 * (a1 - a2);
670 c = phase < 0.0 ? 1.0 - 7.0 * 7.0 * (a1-a2) : 1.0 - 12.5 * 12.5 * (a1-a2);
671 if (phase < 12.5 && phase > -7.0) corr = a1 * phase * phase + 1.0;
672 else corr = phase * ( a2 * phase + b) + c;
673
674
675 } else {
676 /*double a,b,c;
677 if(phase<0){
678 a=1.0002942; b=0.0003528; c=0.0005241;
679 }else{
680 a=1.0001841; b=-0.0004182; c=0.0006167;
681 }
682 corr = a + phase * ( b + c * phase);
683 */
684
685 /*double k = (phase < 0.0 ? 0.0005241 : 0.0006167);
686 corr = (1.0 + k * phase * phase);
687 */
688
689 // 4th degree polynomial correction from Tigran
690 double k1 = (phase < 0.0 ? -0.0000326707:0.000380336);
691 double k2 = (phase < 0.0 ? -0.000560962:-0.000670487);
692 double k3 = (phase < 0.0 ? -0.00000807869:0.00000501773);
693 double k4 = (phase < 0.0 ? -0.000000145008:0.0000000584647);
694
695 corr = 1.0 / (1.0 + (k1 + (k2 + (k3 + k4 *phase)*phase)*phase)*phase);
696
697
698 }
699
700 return corr;
701}

◆ correctTime()

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

Time correction factor.

Definition at line 705 of file TileRawChannelBuilder.cxx.

705 {
706
707 double correction = 0.0;
708
709 if (of2) {
710 if(phase < 0) {
711 correction = (-0.00695743 + (0.0020673 - (0.0002976 + 0.00000361305 * phase) * phase) * phase) * phase;
712 } else {
713 correction = (0.0130013 + (0.00128769 + (-0.000550218 + 0.00000755344 * phase) * phase) * phase) * phase;
714 }
715 }
716 // OF1 does not need correction
717
718 return correction;
719}
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 723 of file TileRawChannelBuilder.cxx.

724 {
725 bool eb = (ros > 2);
726 bool ebsp = ((ros == 3 && drawer == 14) || (ros == 4 && drawer == 17));
727 bool empty = ((eb && ((channel > 23 && channel < 30) || channel > 41)) || (ebsp && channel < 3));
728 bool not_gap = !(empty || (eb && (channel == 0 || channel == 1 || channel == 12 || channel == 13))
729 || (ebsp && (channel == 18 || channel == 19)));
730
731 const float epsilon = 4.1; // allow +/- 2 counts fluctuations around const value
732 const float delta[4] = { 29.9, 29.9, 49.9, 99.9 }; // jump levels between constLG, constHG, non-constLG, non-constHG
733 const float level1 = 99.9; // jump from this level to m_i_ADCmax is bad
734 const float level2 = 149.9; // base line at this level in low gain is bad
735 const float narrowLevel[2] = { 29.9, 49.9 }; // minimal amplitude for narrow pulses
736 const float delt = std::min(std::min(std::min(delta[0], delta[1]), std::min(delta[2], delta[3])),
737 std::min(narrowLevel[0], narrowLevel[1]));
738 const float secondMaxLevel = 0.3;
739
740 int error = 0;
741
742 unsigned int nSamp = digits.size();
743 if (nSamp) {
744 dmin = dmax = digits[0];
745 unsigned int pmin = 0;
746 unsigned int pmax = 0;
747 unsigned int nzero = (dmin < 0.01) ? 1 : 0;
748 unsigned int nover = (dmax > ADCmaxMinusEps) ? 1 : 0;
749
750 for (unsigned int i = 1; i < nSamp; ++i) {
751 float dig = digits[i];
752 if (dig > dmax) {
753 dmax = dig;
754 pmax = i;
755 } else if (dig < dmin) {
756 dmin = dig;
757 pmin = i;
758 }
759 if (dig < 0.01) ++nzero;
760 else if (dig > ADCmaxMinusEps) ++nover;
761 }
762
763 float dmaxmin = dmax - dmin;
764 //std::cout << " ros " << ros << " drawer " << drawer << " channel " << channel << " not_gap " << not_gap << " nzero " << nzero << " nover " << nover << std::endl;
765
766 if (dmin > ADCmaxMinusEps) { // overflow in all samples
767 error = (dmin > ADCmaskValueMinusEps) ? -3 : -1; // dmin=m_tileInfo->ADCmaskValue() - masking in overlay job (set in TileDigitsMaker)
768
769 } else if (dmax < 0.01) { // underflow in all samples
770 error = (empty) ? -5 : -2; // set different type of errors for exsiting and non-existing channels
771
772 } else if (dmaxmin < 0.01) { // constant value in all samples
773 error = -6;
774
775 } else if (nzero && nover) { // jump from zero to saturation
776 error = 1;
777
778 } else if ((nzero && (not_gap || empty)) || nzero > 1) { // one sample at zero in normal channel
779 error = 2; // or 2 samples at zero in gap/crack/MBTS
780
781 } else if (gain == 0 && dmin > level2) { // baseline above threshold in low gain is bad
782 error = 9;
783
784 } else if (dmaxmin > delt) { // check that max-min is above minimal allowed jump
785
786 float abovemin = dmax;
787 float belowmax = dmin;
788 unsigned int nmin = 0;
789 unsigned int nmax = 0;
790 for (unsigned int i = 0; i < nSamp; ++i) {
791 float smp = digits[i];
792 if (smp - dmin < epsilon) {
793 ++nmin;
794 }
795 if (dmax - smp < epsilon) {
796 ++nmax;
797 }
798 if (smp < abovemin && smp > dmin) {
799 abovemin = smp;
800 }
801 if (smp > belowmax && smp < dmax) {
802 belowmax = smp;
803 }
804 }
805 // more than two different values - shift index by 2, i.e. use thresholds for non-const levels
806 int gainInd = (abovemin != dmax || belowmax != dmin) ? gain + 2 : gain;
807 bool big_jump = (dmaxmin > delta[gainInd]);
808 bool max_in_middle = (pmax > 0 && pmax < nSamp - 1);
809 bool min_in_middle = (pmin > 0 && pmin < nSamp - 1);
810
811 if (nover > 1 && belowmax < level1) { // at least two saturated. others - close to pedestal
812 error = 3;
813 } else if (nmax + nmin == nSamp && big_jump) {
814 if (nmax > 1 && nmin > 1) { // at least 2 samples at two distinct levels
815 error = 4;
816 } else if (nmax == 1) {
817 if (max_in_middle) { // jump up in one sample, but not at the edge
818 error = 5;
819 }
820 } else if (nmin == 1) { // jump down in one sample
821 error = 6;
822 }
823 }
824 if (error == 0 && dmaxmin > narrowLevel[gain]) {
825 float secondMax = dmaxmin * secondMaxLevel;
826 float dminPlus = dmin + secondMax;
827 float dmaxMinus = dmax - secondMax;
828 if (not_gap) { // jumps above two (or one) neighbour samples
829 if (max_in_middle && std::max(digits[pmax - 1], digits[pmax + 1]) < dminPlus) {
830 error = 7; // jump up in one sample in the middle, which is much higher than two neighbours
831 } else if (min_in_middle && std::min(digits[pmin - 1], digits[pmin + 1]) > dmaxMinus) {
832 error = 8; // jump down in one sample, which is much lower than two neighbours
833 } else if (big_jump && gain == 0) { // check first and last sample only in low gain
834 if (pmin == 0 && digits[1] > dmax - secondMax) {
835 error = 10; // jump down in first sample. which is much lower than next one
836 } else if (pmin == nSamp - 1 && digits[pmin - 1] > dmax - secondMax) {
837 error = 11; // jump down in last sample. which is much lower than previous one
838 }
839 }
840 }
841 if (!error && big_jump) { // jumps above all samples
842 if ((max_in_middle || gain == 0) && nmax == 1 && belowmax < dminPlus) {
843 error = 12; // jump up in one sample in the middle, which is much higher than all others
844 } else if ((min_in_middle || gain == 0) && nmin == 1 && abovemin > dmaxMinus) {
845 error = 13; // jump down in one sample, which is much lower than all others (
846 }
847 }
848 }
849 }
850
851 } else {
852 dmin = dmax = 0.0;
853 }
854
855 return error;
856}
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 233 of file TileRawChannelBuilder.cxx.

233 {
234 initLog(ctx);
235
236 // create TRC container
237 m_rawChannelCnt = std::make_unique<TileMutableRawChannelContainer>(true, m_rChType, m_rChUnit, SG::VIEW_ELEMENTS);
238 ATH_CHECK( m_rawChannelCnt->status() );
239 m_rawChannelCnt->set_bsflags(m_bsflags);
240
241 ATH_MSG_DEBUG( "Created TileRawChannelContainer '" << m_rawChannelContainerKey.key() << "'" );
242
243 return StatusCode::SUCCESS;
244}
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 }

◆ 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 639 of file TileRawChannelBuilder.cxx.

639 {
640 m_chCounter = 0;
641 m_nChL = m_nChH = 0;
642 m_RChSumL = m_RChSumH = 0.0;
643
644}

◆ 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 300 of file TileRawChannelBuilder.cxx.

302{
303 const TileDQstatus* DQstatus = SG::makeHandle (m_DQstatusKey, ctx).get();
304
305 int frag = coll->identify();
306 int ros = (frag >> 8);
307 int drawer = (frag & 0xff);
308
309 m_lastDrawer = frag;
310
311 memset(m_error, 0, sizeof(m_error));
312 int dmuerr[MAX_DMUS] = {0};
313 int nch = 0;
314 bool bigain = DQstatus->isBiGain();
315 if (!bigain) { // in bigain runs we don't have DQ status fragment
316 for (int ch = 0; ch < MAX_CHANNELS; ch += 3) {
317 if (!DQstatus->isAdcDQgood(ros, drawer, ch, 0)) {
318 m_error[ch + 2] = m_error[ch + 1] = m_error[ch] = -3;
319 dmuerr[ch / 3] = 3;
320 nch += 3;
321 }
322 }
323 }
324 if (nch == MAX_CHANNELS) { // all bad - nothing to do
325 m_badDrawer = true;
326 ATH_MSG_VERBOSE( "Drawer 0x" << MSG::hex << frag << MSG::dec
327 << " is bad - skipping bad patterns check " );
328 return;
329 } else {
330 m_badDrawer = false;
331 ATH_MSG_VERBOSE( "Drawer 0x" << MSG::hex << frag << MSG::dec
332 << " looking for bad patterns in digits" );
333 }
334
335 float mindig, maxdig;
336 int nchbad[2] = { 0, 0 };
337
338 // Iterate over all digits in this collection
339 TileDigitsCollection::const_iterator digitItr = coll->begin();
340 TileDigitsCollection::const_iterator lastDigit = coll->end();
341
342 for (; digitItr != lastDigit; ++digitItr) {
343 const TileDigits * pDigits = (*digitItr);
344 HWIdentifier adcId = pDigits->adc_HWID();
345 int channel = m_tileHWID->channel(adcId);
346 int gain = m_tileHWID->adc(adcId);
347
348 if (m_error[channel]) {
349 ATH_MSG_VERBOSE( "BadCh " << ros
350 << "/" << drawer
351 << "/" << channel
352 << "/" << gain << " BAD DQ STATUS ");
353
354 } else {
355
356 int err = CorruptedData(ros, drawer, channel, gain, pDigits->samples(), mindig, maxdig, m_ADCmaxMinusEps, m_ADCmaskValueMinusEps);
357
358 if (err) {
359
361 if (err > -5) {
362 ++dmuerr[channel / 3];
363 ++nchbad[channel / 24];
364 }
365
366 if (msgLvl(MSG::VERBOSE)) {
367
368 msg(MSG::VERBOSE) << "BadCh " << ros
369 << "/" << drawer
370 << "/" << channel
371 << "/" << gain;
372 if (err < -5) msg(MSG::VERBOSE) << " Warning " << err;
373 else msg(MSG::VERBOSE) << " Error " << err;
374 if (mindig > m_ADCmaskValueMinusEps) msg(MSG::VERBOSE) << " BADDQ";
375 if (maxdig > m_ADCmaxMinusEps) msg(MSG::VERBOSE) << " Overflow";
376 if (mindig < 0.1) msg(MSG::VERBOSE) << " Underflow";
377 if (err < 0) msg(MSG::VERBOSE) << " Const";
378
379 msg(MSG::VERBOSE) << " samp=";
380 std::vector<float> digits = pDigits->samples();
381 for (unsigned int i = 0; i < digits.size(); ++i) {
382 msg(MSG::VERBOSE) << " " << digits[i];
383 }
384 msg(MSG::VERBOSE) << endmsg;
385 }
386
387 } else {
388 if (mindig < 0.01) err += 1;
389 if (maxdig > m_ADCmaxMinusEps) err += 2;
390 if (err) m_error[channel] = err - 10;
391 }
392 }
393 }
394
395 // check if we want to mask half a drawer
396 // in this case set error = -4 for channels which were good before
397
398 int ndmubad[2] = { 0, 0 };
399 int dmu = 0;
400 for (; dmu < MAX_DMUS / 2; ++dmu) { // first half
401 if (dmuerr[dmu] > 1)
402 ++ndmubad[0]; // count DMUs with at least two bad channels
403 }
404 for (; dmu < MAX_DMUS; ++dmu) { // second half
405 if (dmuerr[dmu] > 1)
406 ++ndmubad[1]; // count DMUs with at least two bad channels
407 }
408
409 int ndmulimit[2] = { 3, 3 }; // max number of bad DMUs when half-drawer is not yet masked
410 // if 4 DMUs will be bad - mask whole half-drawer
411 if (frag > 0x2ff) { // if extended barrel
412 if (frag == 0x30e || frag == 0x411)
413 ndmulimit[0] = 4; // in EB special one DMU is always bad (missing)
414 ndmulimit[1] = 5; // in second half of EB 4 DMUs ara always bad (missing)
415 // only if 7 DMUs are bad, mask whole half-drawer
416 }
417
418 bool printall = true;
419 for (int p = 0; p < 2; ++p) {
420 if (ndmubad[p] > ndmulimit[p] && nchbad[p] > 0) {
421 if (msgLvl(MSG::VERBOSE)) {
422 msg(MSG::VERBOSE) << "Drawer 0x" << MSG::hex << frag << MSG::dec
423 << " masking whole " << ((p) ? "second" : "first")
424 << " half" << endmsg;
425 if (printall) {
426 msg(MSG::VERBOSE) << "nDMuErr ";
427 for (int d = 0; d < MAX_DMUS; ++d) {
428 msg(MSG::VERBOSE) << " " << dmuerr[d];
429 }
430 msg(MSG::VERBOSE) << " total " << ndmubad[p] << " errors" << endmsg;
431
432 msg(MSG::VERBOSE) << "ChErr ";
433 int ch = 0;
434 while (ch < MAX_CHANNELS-2) {
435 msg(MSG::VERBOSE) << " " << m_error[ch++];
436 msg(MSG::VERBOSE) << " " << m_error[ch++];
437 msg(MSG::VERBOSE) << " " << m_error[ch++];
438 msg(MSG::VERBOSE) << " ";
439 }
440
441 msg(MSG::VERBOSE) << " total " << nchbad[p]
442 << " bad patterns" << endmsg;
443 printall = false;
444 }
445 }
446 int ch = (p) ? MAX_CHANNELS / 2 : 0;
447 int chmax = (p) ? MAX_CHANNELS : MAX_CHANNELS / 2;
448 for (; ch < chmax; ++ch) {
449 if (m_error[ch] == 0 || m_error[ch] < -5) { // channel was good before
450 m_error[ch] = -4;
451 }
452 }
453 }
454 }
455
456}
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 205 of file TileRawChannelBuilderFitFilter.cxx.

205 {
206
207 ATH_MSG_DEBUG( "Finalizing" );
208 return StatusCode::SUCCESS;
209}

◆ getOverflowedChannels()

Overflows_t & TileRawChannelBuilder::getOverflowedChannels ( void )
inherited

Definition at line 38 of file TileRawChannelBuilder.cxx.

38 {
39 return m_overflows;
40}

◆ getTileRawChannelContainerID()

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

Definition at line 42 of file TileRawChannelBuilder.cxx.

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

◆ initialize()

StatusCode TileRawChannelBuilderFitFilter::initialize ( )
overridevirtual

Initializer.

Reimplemented from TileRawChannelBuilder.

Definition at line 86 of file TileRawChannelBuilderFitFilter.cxx.

86 {
87
88 ATH_MSG_INFO( "TileRawChannelBuilderFitFilter::initialize()" );
89
91
92 // init in superclass
94 ATH_CHECK( m_tileToolNoiseSample.retrieve() );
95
96 if (m_bestPhase) {
97 //=== get TileToolTiming
98 // TileToolTiming can be disabled in the TileRawChannelBuilder
99 if (!m_tileToolTiming.isEnabled()) {
100 m_tileToolTiming.enable();
101 }
102 ATH_CHECK( m_tileToolTiming.retrieve() );
103 }
104
105 // Get number of samples from TileInfo - ignore jobOptions settings
106 m_frameLength = m_tileInfo->NdigitSamples();
107 ATH_MSG_DEBUG( "NSamples = " << m_frameLength );
108
109 // Get pulse shapes from TileInfo
110 m_pulseShapes = m_tileInfo->getPulseShapes();
111
112 // Determine peak sample position
113 // peak sample position defines t=0
114 // m_iPeak0 = (int) (m_frameLength) / 2 + (m_frameLength % 2) - 1;
115 m_iPeak0 = (int) m_tileInfo->ItrigSample();
116
117 // Min and max time are now calculated based on m_framelength - i.e. on the
118 // number of 25 ns samples read out. Don't forget t=0 corresponds to
119 // m_ipeak0-th sample
122 // maximal jump during one iteration
125
126 ATH_MSG_DEBUG( " ipeak0=" << m_iPeak0
127 << " min_time=" << m_minTime
128 << " max_time=" << m_maxTime
129 << " min_tau=" << m_minTau
130 << " max_tau=" << m_maxTau );
131
132 if ( !m_demoFragIDs.empty() ) {
133 switch (m_specialDemoShape) {
134 case 1:
135 ATH_MSG_DEBUG( "Demonstrator channels use pulse shape from physics structures"); break;
136 case 2:
137 ATH_MSG_DEBUG( "Demonstrator channels use pulse shape from laser structures"); break;
138 case 3:
139 ATH_MSG_DEBUG( "Demonstrator channels use pulse shape from laser(for 100pF) and physics(for 5.2pF) structures"); break;
140 case 8:
141 ATH_MSG_DEBUG( "Demonstrator channels use pulse shape from cis structures"); break;
142 default:
143 ATH_MSG_DEBUG( "Demonstrator channels use the same pulse shape as legacy"); break;
144 }
145 }
146
147 // Speedup for physics processing (max_iter=1):
148 // read initial pulse shapes into arrays
149 m_fnParameters[0] = 0.0;
150 m_fnParameters[1] = 0.0;
151 m_fnParameters[2] = 1.0;
152 m_t0Fit = 0.0;
153
154 m_gPhysLo.reserve(m_frameLength);
155 m_dgPhysLo.reserve(m_frameLength);
156 m_gPhysHi.reserve(m_frameLength);
157 m_dgPhysHi.reserve(m_frameLength);
158
159 double rsamp;
160 for (int isamp = 0; isamp < m_frameLength; ++isamp) {
161 rsamp = (isamp) * 1.0;
162 m_gPhysLo.push_back(scaledPulse(rsamp, &(m_pulseShapes->m_tlphys), &(m_pulseShapes->m_ylphys)));
163 m_dgPhysLo.push_back(pulse(rsamp, &(m_pulseShapes->m_tdlphys), &(m_pulseShapes->m_ydlphys)));
164 m_gPhysHi.push_back(scaledPulse(rsamp, &(m_pulseShapes->m_thphys), &(m_pulseShapes->m_yhphys)));
165 m_dgPhysHi.push_back(pulse(rsamp, &(m_pulseShapes->m_tdhphys), &(m_pulseShapes->m_ydhphys)));
166 }
167
170 }
171
172 if (msgLvl(MSG::DEBUG)) {
173 switch (m_channelNoiseRMS) {
174 case 1:
175 msg(MSG::DEBUG) << " noise for all channels from noiseOrig array (OBSOLETE!!!) " << endmsg;
176 break;
177 case 2:
178 msg(MSG::DEBUG) << " noise for all channels from noiseNk array (OBSOLETE!!!) " << endmsg;
179 break;
180 case 3:
181 msg(MSG::DEBUG) << " noise for all channels from Conditions DB ";
182 if (m_cabling->getTestBeam()) {
183 const EventContext &ctx = Gaudi::Hive::currentContext();
184 msg(MSG::DEBUG) << " rmsLow(LBA01/0) = " << m_tileToolNoiseSample->getHfn(20, 0, TileID::LOWGAIN, TileRawChannelUnit::ADCcounts, ctx)
185 << " rmsHi(LBA01/0) = " << m_tileToolNoiseSample->getHfn(20, 0, TileID::HIGHGAIN, TileRawChannelUnit::ADCcounts, ctx)
186 << endmsg;
187 } else {
188 msg(MSG::DEBUG) << endmsg;
189 }
190 break;
191 default:
192 msg(MSG::DEBUG) << " common noise for all channels (OBSOLETE): " << endmsg;
193 msg(MSG::DEBUG) << " rmsLow = " << m_noiseLow
194 << " rmsHi = " << m_noiseHigh << endmsg;
195 break;
196 }
197 }
198
199 // TileInfo
201
202 return StatusCode::SUCCESS;
203}
#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 246 of file TileRawChannelBuilder.cxx.

246 {
247
248 const TileDQstatus* DQstatus = SG::makeHandle (m_DQstatusKey, ctx).get();
249
250 // update only if there is new event
251 if (m_evtCounter != ctx.evt()) {
252
253 m_evtCounter = ctx.evt();
254 if (m_runType != 0) m_trigType = m_runType;
255 else m_trigType = DQstatus->trigType();
256
257 if (0 == m_trigType) {
258 m_idophys = (DQstatus->calibMode() == 0);
259 m_idolas = false;
260 m_idoped = false;
261 m_idocis = (DQstatus->calibMode() == 1);
262 } else {
263 m_idophys = (m_trigType <= 1);
264 m_idolas = ((m_trigType == 2) || (m_trigType == 3));
265 m_idoped = ((m_trigType == 4) || (m_trigType == 5));
266 m_idocis = ((m_trigType == 8) || (m_trigType == 9));
267 }
268
269 const unsigned int *cispar = DQstatus->cispar();
270 if (0 == cispar[7]) { // if capdaq not set, it can't be CIS event
271 if (m_idocis) { // cis flag was set incorrectly, change to ped
272 m_idoped = true;
273 m_idocis = false;
274 }
275 m_capdaq = 0.0;
276 } else {
277 m_capdaq = (cispar[7] < 10) ? 5.2 : 100.0;
278 }
279 m_cischan = cispar[8] - 1; // channel where CIS is fired (-1 = all channels)
280
281 ATH_MSG_DEBUG( "Trig type is " << m_trigType
282 << "; dophys is " << ((m_idophys) ? "true" : "false")
283 << "; dolas is " << ((m_idolas) ? "true" : "false")
284 << "; doped is " << ((m_idoped) ? "true" : "false")
285 << "; docis is " << ((m_idocis) ? "true" : "false")
286 << "; capacitor is " << m_capdaq
287 << "; cis chan is " << m_cischan );
288 }
289}
int trigType() const
Trigger type.
uint32_t calibMode() const
Calibration mode.
const uint32_t * cispar() const
CIS parameters.

◆ 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 1573 of file TileRawChannelBuilderFitFilter.cxx.

1574 {
1575
1576 int size1 = xvec->size() - 1;
1577 if (size1 < 1) return 0.0;
1578
1579 const double delta = 1.e-6;
1580
1581 double xpmin = xvec->at(0);
1582 double xpmax = xvec->at(size1);
1583
1584 double xp = (x - m_iPeak0) * DTIME - m_t0Fit - m_fnParameters[0];
1585
1586 double val = 0.0;
1587 double tdiv = (xpmax - xpmin) / size1;
1588
1589 if (xp < xpmin + delta) {
1590 if (zeroOutside && xp < xpmin - delta)
1591 val = 0.0;
1592 else
1593 val = yvec->at(0);
1594#ifdef EXTRAPOLATE_TO_ZERO
1595 if (xp < xpmin - delta && val != 0.0) {
1596 double newval = val + ((yvec->at(1) - val) / tdiv) * (xp - xpmin);
1597 if (val * newval < 0.0) {
1598 val = 0.0;
1599 } else if (fabs(newval) < fabs(val)) {
1600 val = newval;
1601 }
1602 }
1603#endif
1604 } else if (xp > xpmax - delta) {
1605 if (zeroOutside && xp > xpmax + delta)
1606 val = 0.0;
1607 else
1608 val = yvec->at(size1);
1609#ifdef EXTRAPOLATE_TO_ZERO
1610 if (xp > xpmax + delta && val != 0.0) {
1611 double newval = val + ((yvec->at(size1 - 1) - val) / tdiv) * (xp - xpmax);
1612 if (val * newval < 0.0) {
1613 val = 0.0;
1614 } else if (fabs(newval) < fabs(val)) {
1615 val = newval;
1616 }
1617 }
1618#endif
1619 } else {
1620 int j = (int) ((xp - xpmin) / tdiv);
1621 val = yvec->at(j) + ((yvec->at(j + 1) - yvec->at(j)) / tdiv) * (xp - xvec->at(j));
1622 }
1623
1624 return val;
1625}

◆ 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 285 of file TileRawChannelBuilderFitFilter.cxx.

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

◆ 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 211 of file TileRawChannelBuilderFitFilter.cxx.

211 {
212
213
214 ++m_chCounter;
215
216 const HWIdentifier adcId = digits->adc_HWID();
217
218 ATH_MSG_VERBOSE( "Running FitFilter for TileRawChannel with HWID "
219 << m_tileHWID->to_string(adcId) );
220
221 // tmp variables for filtering
222 double amplitude = 0.0;
223 double chi2 = 0.0;
224 double time = 0.0;
225 double pedestal = 0.0;
226
227 // use fit filter
228 pulseFit(digits, amplitude, time, pedestal, chi2, ctx);
229
230 unsigned int drawerIdx(0), channel(0), adc(0);
231 m_tileIdTransforms->getIndices(adcId, drawerIdx, channel, adc);
232
233 // fit filter calib
234 // note that when called from TileROD_Decoder, m_calibrateEnergy is set
235 // from TileROD_Decoder...
236 if (m_calibrateEnergy) {
237 amplitude = m_tileToolEmscale->doCalibCis(drawerIdx, channel, adc, amplitude);
238 }
239
240 ATH_MSG_VERBOSE( "Creating RawChannel"
241 << " a=" << amplitude
242 << " t=" << time
243 << " q=" << chi2
244 << " ped=" << pedestal );
245
246
247 // return new TileRawChannel
248 // TileRawChannel *rawCh = new TileRawChannel(adcId,amplitude,time,chi2,pedestal);
249
250 DataPool<TileRawChannel> tileRchPool(m_dataPoollSize);
251 TileRawChannel *rawCh = tileRchPool.nextElementPtr();
252 rawCh->assign (adcId,
253 amplitude,
254 time,
255 chi2,
256 pedestal);
257
258 if (m_correctTime && ((chi2 > 0) || m_bestPhase)) {
259 time -= m_tileToolTiming->getSignalPhase(drawerIdx, channel, adc);
260 rawCh->insertTime(time);
261 ATH_MSG_VERBOSE( "Correcting time, new time=" << rawCh->time() );
262 }
263
264 int gain = m_tileHWID->adc(adcId);
265 if (TileID::HIGHGAIN == gain) {
266 ++m_nChH;
267 m_RChSumH += amplitude;
268 } else {
269 ++m_nChL;
270 m_RChSumL += amplitude;
271 }
272
273 /*
274 ATH_MSG_ALWAYS("TileRawChannel Id: " << m_tileHWID->to_string(adcId)
275 << " => amp/ped/time: " << rawCh->amplitude() << "/" << rawCh->pedestal() << "/" << rawCh->time());
276 */
277 return rawCh;
278}
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.
ToolHandle< TileCondIdTransforms > m_tileIdTransforms
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
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 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ resetDrawer()

void TileRawChannelBuilder::resetDrawer ( )
inherited

Definition at line 29 of file TileRawChannelBuilder.cxx.

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

◆ resetOverflows()

void TileRawChannelBuilder::resetOverflows ( void )
inherited

Definition at line 34 of file TileRawChannelBuilder.cxx.

34 {
35 m_overflows.clear();
36}

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

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_ADCmaskValueMinusEps

float TileRawChannelBuilder::m_ADCmaskValueMinusEps
protectedinherited

indicates channels which were masked in background dataset

Definition at line 222 of file TileRawChannelBuilder.h.

◆ m_ADCmaxMinusEps

float TileRawChannelBuilder::m_ADCmaxMinusEps
protectedinherited

Definition at line 221 of file TileRawChannelBuilder.h.

◆ m_ampMinThresh

float TileRawChannelBuilder::m_ampMinThresh
protectedinherited

correct amplitude if it's above amplitude threshold (in ADC counts)

Definition at line 152 of file TileRawChannelBuilder.h.

◆ m_badDrawer

bool TileRawChannelBuilder::m_badDrawer = false
protectedinherited

Definition at line 210 of file TileRawChannelBuilder.h.

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

Definition at line 138 of file TileRawChannelBuilder.h.

◆ m_cabling

const TileCablingService* TileRawChannelBuilder::m_cabling
protectedinherited

TileCabling instance.

Definition at line 182 of file TileRawChannelBuilder.h.

◆ 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 179 of file TileRawChannelBuilder.h.

179 { this,
180 "TileCablingSvc", "TileCablingSvc", "The Tile cabling service"};

◆ m_calibrateEnergy

bool TileRawChannelBuilder::m_calibrateEnergy
protectedinherited

Definition at line 142 of file TileRawChannelBuilder.h.

◆ m_capdaq

double TileRawChannelBuilder::m_capdaq
protectedinherited

Definition at line 193 of file TileRawChannelBuilder.h.

◆ m_channelNoiseRMS

int TileRawChannelBuilderFitFilter::m_channelNoiseRMS
private

Definition at line 92 of file TileRawChannelBuilderFitFilter.h.

◆ m_chCounter

unsigned int TileRawChannelBuilder::m_chCounter
protectedinherited

Definition at line 196 of file TileRawChannelBuilder.h.

◆ m_cischan

int TileRawChannelBuilder::m_cischan
protectedinherited

Definition at line 192 of file TileRawChannelBuilder.h.

◆ m_correctTime

bool TileRawChannelBuilder::m_correctTime
protectedinherited

Definition at line 145 of file TileRawChannelBuilder.h.

◆ m_dataPoollSize

int TileRawChannelBuilder::m_dataPoollSize
protectedinherited

Definition at line 204 of file TileRawChannelBuilder.h.

◆ 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 184 of file TileRawChannelBuilder.h.

184 {this,
185 "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 393 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

bool TileRawChannelBuilderFitFilter::m_disableNegativeAmp
private

Definition at line 108 of file TileRawChannelBuilderFitFilter.h.

◆ 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 208 of file TileRawChannelBuilder.h.

◆ m_evtCounter

unsigned int TileRawChannelBuilder::m_evtCounter
protectedinherited

Definition at line 195 of file TileRawChannelBuilder.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extraSamplesLeft

int TileRawChannelBuilderFitFilter::m_extraSamplesLeft
private

Definition at line 94 of file TileRawChannelBuilderFitFilter.h.

◆ m_extraSamplesRight

int TileRawChannelBuilderFitFilter::m_extraSamplesRight
private

Definition at line 95 of file TileRawChannelBuilderFitFilter.h.

◆ m_f_ADCmax

float TileRawChannelBuilder::m_f_ADCmax
protectedinherited

Definition at line 218 of file TileRawChannelBuilder.h.

◆ m_f_ADCmaxPlus1

float TileRawChannelBuilder::m_f_ADCmaxPlus1
protectedinherited

Definition at line 220 of file TileRawChannelBuilder.h.

◆ m_firstSample

int TileRawChannelBuilder::m_firstSample
protectedinherited

Definition at line 140 of file TileRawChannelBuilder.h.

◆ m_fnParameters

double TileRawChannelBuilderFitFilter::m_fnParameters[3] {}
private

Definition at line 76 of file TileRawChannelBuilderFitFilter.h.

76{};

◆ m_frameLength

int TileRawChannelBuilderFitFilter::m_frameLength
private

Definition at line 91 of file TileRawChannelBuilderFitFilter.h.

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

Definition at line 217 of file TileRawChannelBuilder.h.

◆ m_i_ADCmaxPlus1

int TileRawChannelBuilder::m_i_ADCmaxPlus1
protectedinherited

Definition at line 219 of file TileRawChannelBuilder.h.

◆ m_idocis

bool TileRawChannelBuilder::m_idocis
protectedinherited

Definition at line 191 of file TileRawChannelBuilder.h.

◆ m_idolas

bool TileRawChannelBuilder::m_idolas
protectedinherited

Definition at line 189 of file TileRawChannelBuilder.h.

◆ m_idoped

bool TileRawChannelBuilder::m_idoped
protectedinherited

Definition at line 190 of file TileRawChannelBuilder.h.

◆ m_idophys

bool TileRawChannelBuilder::m_idophys
protectedinherited

Definition at line 188 of file TileRawChannelBuilder.h.

◆ m_infoName

std::string TileRawChannelBuilder::m_infoName
protectedinherited

Definition at line 215 of file TileRawChannelBuilder.h.

◆ 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 209 of file TileRawChannelBuilder.h.

◆ m_maxIterate

int TileRawChannelBuilderFitFilter::m_maxIterate
private

Definition at line 93 of file TileRawChannelBuilderFitFilter.h.

◆ 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

double TileRawChannelBuilderFitFilter::m_maxTimeFromPeak
private

Definition at line 100 of file TileRawChannelBuilderFitFilter.h.

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

Definition at line 199 of file TileRawChannelBuilder.h.

◆ m_nChL

int TileRawChannelBuilder::m_nChL
protectedinherited

Definition at line 198 of file TileRawChannelBuilder.h.

◆ m_noiseFilterTools

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

Definition at line 163 of file TileRawChannelBuilder.h.

163 {this,
164 "NoiseFilterTools", {}, "Tile noise filter tools"};

◆ m_noiseHigh

double TileRawChannelBuilderFitFilter::m_noiseHigh
private

Definition at line 103 of file TileRawChannelBuilderFitFilter.h.

◆ m_noiseLow

double TileRawChannelBuilderFitFilter::m_noiseLow
private

Definition at line 102 of file TileRawChannelBuilderFitFilter.h.

◆ m_noiseThresholdRMS

double TileRawChannelBuilderFitFilter::m_noiseThresholdRMS
private

Definition at line 99 of file TileRawChannelBuilderFitFilter.h.

◆ m_notUpgradeCabling

bool TileRawChannelBuilder::m_notUpgradeCabling
protectedinherited

Definition at line 212 of file TileRawChannelBuilder.h.

◆ m_overflows

Overflows_t TileRawChannelBuilder::m_overflows
protectedinherited

Definition at line 203 of file TileRawChannelBuilder.h.

◆ m_pulseShapes

const TilePulseShapesStruct* TileRawChannelBuilderFitFilter::m_pulseShapes
private

Definition at line 106 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
protectedinherited

Definition at line 201 of file TileRawChannelBuilder.h.

◆ m_RChSumL

double TileRawChannelBuilder::m_RChSumL
protectedinherited

Definition at line 200 of file TileRawChannelBuilder.h.

◆ m_rChType

TileFragHash::TYPE TileRawChannelBuilder::m_rChType
protectedinherited

Definition at line 136 of file TileRawChannelBuilder.h.

◆ m_rChUnit

TileRawChannelUnit::UNIT TileRawChannelBuilder::m_rChUnit
protectedinherited

Definition at line 137 of file TileRawChannelBuilder.h.

◆ m_runType

int TileRawChannelBuilder::m_runType
protectedinherited

Definition at line 157 of file TileRawChannelBuilder.h.

◆ m_saturatedSample

double TileRawChannelBuilderFitFilter::m_saturatedSample
private

Definition at line 96 of file TileRawChannelBuilderFitFilter.h.

◆ m_saturatedSampleError

double TileRawChannelBuilderFitFilter::m_saturatedSampleError
private

Definition at line 97 of file TileRawChannelBuilderFitFilter.h.

◆ m_specialDemoShape

int TileRawChannelBuilderFitFilter::m_specialDemoShape
private

Definition at line 109 of file TileRawChannelBuilderFitFilter.h.

◆ m_t0Fit

double TileRawChannelBuilderFitFilter::m_t0Fit
private

Definition at line 73 of file TileRawChannelBuilderFitFilter.h.

◆ m_tileHWID

const TileHWID* TileRawChannelBuilder::m_tileHWID
protectedinherited

Definition at line 161 of file TileRawChannelBuilder.h.

◆ m_tileID

const TileID* TileRawChannelBuilder::m_tileID
protectedinherited

Definition at line 160 of file TileRawChannelBuilder.h.

◆ 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 172 of file TileRawChannelBuilder.h.

172 {this,
173 "TileCondIdTransforms", "TileCondIdTransforms",
174 "Tile tool to tranlate hardware identifier to the drawerIdx, channel, and adc"};

◆ m_tileInfo

const TileInfo* TileRawChannelBuilder::m_tileInfo
protectedinherited

Definition at line 216 of file TileRawChannelBuilder.h.

◆ m_tileToolEmscale

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

Definition at line 166 of file TileRawChannelBuilder.h.

166 {this,
167 "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 111 of file TileRawChannelBuilderFitFilter.h.

111 {this,
112 "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 169 of file TileRawChannelBuilder.h.

169 {this,
170 "TileCondToolTiming", "TileCondToolTiming", "Tile timing tool"};

◆ m_timeMaxThresh

float TileRawChannelBuilder::m_timeMaxThresh
protectedinherited

correct amplitude is time is below time max threshold

Definition at line 154 of file TileRawChannelBuilder.h.

◆ m_timeMinThresh

float TileRawChannelBuilder::m_timeMinThresh
protectedinherited

correct amplitude is time is above time min threshold

Definition at line 153 of file TileRawChannelBuilder.h.

◆ m_trigType

int TileRawChannelBuilder::m_trigType
protectedinherited

Definition at line 187 of file TileRawChannelBuilder.h.

◆ m_useDSP

bool TileRawChannelBuilder::m_useDSP
protectedinherited

Definition at line 149 of file TileRawChannelBuilder.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_zeroSampleError

double TileRawChannelBuilderFitFilter::m_zeroSampleError
private

Definition at line 98 of file TileRawChannelBuilderFitFilter.h.

◆ MAX_CHANNELS

const int TileRawChannelBuilder::MAX_CHANNELS = 48
staticprotectedinherited

Definition at line 206 of file TileRawChannelBuilder.h.

◆ MAX_DMUS

const int TileRawChannelBuilder::MAX_DMUS = 16
staticprotectedinherited

Definition at line 207 of file TileRawChannelBuilder.h.


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