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

Reconstructs Tile digitized pulses (ie, computes amplitude and time) for the QIE front-end. More...

#include <TileRawChannelBuilderQIEFilter.h>

Inheritance diagram for TileRawChannelBuilderQIEFilter:
Collaboration diagram for TileRawChannelBuilderQIEFilter:

Public Member Functions

 TileRawChannelBuilderQIEFilter (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor.
 ~TileRawChannelBuilderQIEFilter ()
 Destructor.
virtual StatusCode initialize () override
 Initialize method.
virtual TileRawChannel * rawChannel (const TileDigits *digits, const EventContext &ctx) override
 Builder virtual method to be implemented by subclasses.
virtual StatusCode finalize ()
virtual StatusCode createContainer (const EventContext &ctx)
 Create container in SG with name given by parameter (m_rawChannelContainerKey).
virtual StatusCode commitContainer (const EventContext &ctx)
 Commit RawChannelContiner in SG and make const.
void initLog (const EventContext &ctx)
void endLog ()
StatusCode build (const TileDigitsCollection *collection, const EventContext &ctx)
void resetDrawer ()
void resetOverflows (void)
Overflows_t & getOverflowedChannels (void)
std::string getTileRawChannelContainerID (void)
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool InterfaceID.
static double correctAmp (double phase, bool of2=true)
 Amplitude correction factor according to the time when using weights for tau=0 without iterations.
static double correctTime (double phase, bool of2=true)
 Time correction factor.
static int CorruptedData (int ros, int drawer, int channel, int gain, const std::vector< float > &digits, float &dmin, float &dmax, float ADCmaxMinusEps, float ADCmaskValueMinusEps)
static const char * BadPatternName (float ped)

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Protected Attributes

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

Static Protected Attributes

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

Private Types

typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t

Private Member Functions

float filter (int ros, int drawer, int channel, float &amplitude, float &time)
 < Applies OF algorithm
int findMaxDigitPosition ()
 Finds maximum digit position in the pulse.
float compute (int ros, int drawer, int channel, float &amplitude, float &time)
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< int > m_pedestalMode {this, "PedestalMode", 17, "Pedestal mode to use"}
 pedestal mode to use
int m_nSignal {}
 internal counters
int m_nConst {}
 internal counters
int m_nSamples {}
 number of samples in the data
std::vector< float > m_digits
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

Reconstructs Tile digitized pulses (ie, computes amplitude and time) for the QIE front-end.

Definition at line 41 of file TileRawChannelBuilderQIEFilter.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 376 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TileRawChannelBuilderQIEFilter()

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

Constructor.

Definition at line 53 of file TileRawChannelBuilderQIEFilter.cxx.

55 :
56 TileRawChannelBuilder(type, name, parent)
57{
58 //declare interfaces
59 declareInterface < TileRawChannelBuilder > (this);
60 declareInterface < TileRawChannelBuilderQIEFilter > (this);
61
62 m_rawChannelContainerKey = "TileRawChannelQIE";
63}
SG::WriteHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
TileRawChannelBuilder(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.

◆ ~TileRawChannelBuilderQIEFilter()

TileRawChannelBuilderQIEFilter::~TileRawChannelBuilderQIEFilter ( )
default

Destructor.

Member Function Documentation

◆ BadPatternName()

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

Definition at line 424 of file TileRawChannelBuilder.cxx.

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

◆ build()

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

Definition at line 458 of file TileRawChannelBuilder.cxx.

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

◆ commitContainer()

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

Commit RawChannelContiner in SG and make const.

Definition at line 510 of file TileRawChannelBuilder.cxx.

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

◆ compute()

float TileRawChannelBuilderQIEFilter::compute ( int ros,
int drawer,
int channel,
float & amplitude,
float & time )
private

Definition at line 193 of file TileRawChannelBuilderQIEFilter.cxx.

193 {
194
195 ATH_MSG_VERBOSE("compute();" << " ros=" << ros << " drawer=" << drawer << " channel=" << channel);
196
197 float chi2 = -999.; //the chi2 is not calculated by default
198 float fraction_mean = 0;
199
200 amplitude = 0.;
201 time = 0.; //TODO: Time needs to be implemented using the QIE TDC
202
203 //TODO: These numbers may be placed in a database
204 const float avg_fraction = 0.18;
205 const float Q_1pe = 17.; //charge per a photo-electron in fC
206
207 // With pileup suppression
208 double prob_cut_off = 0.005;
209
210 if (m_digits[2] > 0) //check if there is pileup in the preceding BC.
211 amplitude = m_digits[3] - avg_fraction * m_digits[2] / (1. - avg_fraction);
212
213 if (amplitude < 0)
214 amplitude = 0;
215
216 if (m_digits[4] > 0) {
217 amplitude += m_digits[4];
218 fraction_mean = m_digits[4] / amplitude;
219
220 if (fraction_mean > avg_fraction) { // Pileup is suspected in the 2nd integration window
221 int n = (int) (amplitude / Q_1pe);
222 int k = (int) (m_digits[4] / Q_1pe);
223
224 //Here we calculate the binomial coefficient; n>=k
225 // n!/(k! (n-k!))
226 double binom_coeff = 1.;
227
228 for (int j = n; j > 0; j--) {
229 if (j > k)
230 binom_coeff = binom_coeff * (double) j;
231
232 if (j < (n - k + 1))
233 binom_coeff = binom_coeff / (double) j;
234 }
235
236 //binomial probability
237 double prob = binom_coeff * pow(avg_fraction, k) * pow(1. - avg_fraction, n - k);
238
239 if (prob < prob_cut_off) { //likely there is too much pileup in the 2nd integration window.
240 amplitude -= m_digits[4];
241 amplitude *= 1. / (1. - avg_fraction);
242 }
243 }
244
245 }
246
247 bool goodEnergy = (fabs(amplitude) > 1.0e-04);
248 if (goodEnergy) {
249 if (msgLvl(MSG::VERBOSE)) {
250 msg(MSG::VERBOSE) << "QIEFilterEne=" << amplitude << endmsg;
251 msg(MSG::VERBOSE) << "QIEFilterTimee=" << time << endmsg;
252 }
253 } else {
254 if (msgLvl(MSG::VERBOSE)) {
255 msg(MSG::VERBOSE) << "QIEFilterEne=" << amplitude << " ... assuming 0.0" << endmsg;
256 msg(MSG::VERBOSE) << "QIEFilterTime=" << time << " ... assuming 0.0" << endmsg;
257 }
258 }
259
260 if (fabs(chi2) > 1.0e-04 || goodEnergy) {
261 if (msgLvl(MSG::VERBOSE)) {
262 msg(MSG::VERBOSE) << "QIEFilterTime=" << time << endmsg;
263 msg(MSG::VERBOSE) << "QIEFilterChi2=" << chi2 << endmsg;
264 }
265 } else {
266 if (msgLvl(MSG::VERBOSE)) {
267 msg(MSG::VERBOSE) << "QIEFilterTime=" << time << endmsg;
268 msg(MSG::VERBOSE) << "QIEFilterChi2=" << chi2 << " ... assuming 0.0" << endmsg;
269 }
270 }
271
272 return chi2;
273}
double chi2(TH1 *h0, TH1 *h1)
time(flags, cells_name, *args, **kw)
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
constexpr int pow(int x)
Definition conifer.h:27
MsgStream & msg
Definition testRead.cxx:32

◆ correctAmp()

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

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

Definition at line 612 of file TileRawChannelBuilder.cxx.

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

◆ correctTime()

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

Time correction factor.

Definition at line 671 of file TileRawChannelBuilder.cxx.

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

◆ CorruptedData()

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

Definition at line 689 of file TileRawChannelBuilder.cxx.

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

◆ createContainer()

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

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

Definition at line 199 of file TileRawChannelBuilder.cxx.

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

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ endLog()

void TileRawChannelBuilder::endLog ( )
inherited

Definition at line 605 of file TileRawChannelBuilder.cxx.

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

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ fill_drawer_errors()

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

Definition at line 266 of file TileRawChannelBuilder.cxx.

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

◆ filter()

float TileRawChannelBuilderQIEFilter::filter ( int ros,
int drawer,
int channel,
float & amplitude,
float & time )
private

< Applies OF algorithm

Definition at line 162 of file TileRawChannelBuilderQIEFilter.cxx.

162 {
163
164 ATH_MSG_VERBOSE("filter()");
165
166 amplitude = 0.;
167 time = 0.;
168 float chi2 = -1.;
169
170 auto minMaxDigits = std::minmax_element(m_digits.begin(), m_digits.end());
171 float minDigit = *minMaxDigits.first;
172 float maxDigit = *minMaxDigits.second;
173
174 if (maxDigit - minDigit < 0.01) { // constant value in all samples // TODO: the cut-off needs to be adjusted for the charge difference
175
176 //pedestal = minDigit;
177 chi2 = 0.;
178 ATH_MSG_VERBOSE("CASE NO SIGNAL: maxdig-mindig = " << maxDigit << "-" << minDigit << " = " << maxDigit - minDigit);
179
180 m_nConst++;
181
182 } else {
183
184 chi2 = compute(ros, drawer, channel, amplitude, time);
185 m_nSignal++;
186
187 }
188
189 return chi2;
190}
float compute(int ros, int drawer, int channel, float &amplitude, float &time)

◆ finalize()

StatusCode TileRawChannelBuilder::finalize ( )
virtualinherited

◆ findMaxDigitPosition()

int TileRawChannelBuilderQIEFilter::findMaxDigitPosition ( )
private

Finds maximum digit position in the pulse.

Computes A,time,ped using OF. If iterations are required, the Iterator method is used

Definition at line 136 of file TileRawChannelBuilderQIEFilter.cxx.

136 {
137
138 ATH_MSG_VERBOSE(" findMaxDigitPosition()");
139
140 int iMaxDigit = 0;
141 float maxDigit = 0.;
142
143 for (unsigned int i = 0; i < m_digits.size(); i++) {
144 if (maxDigit < m_digits[i]) {
145 maxDigit = m_digits[i];
146 iMaxDigit = i;
147 }
148 }
149
150 if (msgLvl(MSG::VERBOSE)) {
151 for (unsigned int i = 0; i < m_digits.size(); i++) {
152 msg(MSG::VERBOSE) << " " << m_digits[i];
153 }
154
155 msg(MSG::VERBOSE) << "; Max: digit[" << iMaxDigit << "]=" << maxDigit << endmsg;
156
157 }
158
159 return iMaxDigit;
160}

◆ getOverflowedChannels()

Overflows_t & TileRawChannelBuilder::getOverflowedChannels ( void )
inherited

Definition at line 37 of file TileRawChannelBuilder.cxx.

37 {
38 return m_overflows;
39}

◆ getTileRawChannelContainerID()

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

Definition at line 41 of file TileRawChannelBuilder.cxx.

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

◆ initialize()

StatusCode TileRawChannelBuilderQIEFilter::initialize ( )
overridevirtual

Initialize method.

Reimplemented from TileRawChannelBuilder.

Definition at line 67 of file TileRawChannelBuilderQIEFilter.cxx.

67 {
68
69 ATH_MSG_INFO("initialize()");
70
71 m_rChType = TileFragHash::OptFilterOffline; // type for offline Opt Filter
72
73 // init in superclass
75
76 m_nSamples = m_tileInfo->NdigitSamples();
77
78 if (m_nSamples != 7) { // && (m_pedestalMode == 71 || m_pedestalMode == 7621)) {
79 ATH_MSG_ERROR("Incompatable pedestal mode [" << m_pedestalMode.value() << "] and number of samples [" << m_nSamples << "]");
80 return StatusCode::FAILURE;
81 }
82
83 return StatusCode::SUCCESS;
84}
#define CHECK(...)
Evaluate an expression and check for errors.
Gaudi::Property< int > m_pedestalMode
pedestal mode to use
int m_nSamples
number of samples in the data
virtual StatusCode initialize()
Initializer.

◆ initLog()

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

Definition at line 212 of file TileRawChannelBuilder.cxx.

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

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & TileRawChannelBuilderQIEFilter::interfaceID ( )
static

AlgTool InterfaceID.

Definition at line 47 of file TileRawChannelBuilderQIEFilter.cxx.

47 {
49}
static const InterfaceID IID_ITileRawChannelBuilderQIEFilter("TileRawChannelBuilderQIEFilter", 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.

◆ rawChannel()

TileRawChannel * TileRawChannelBuilderQIEFilter::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 86 of file TileRawChannelBuilderQIEFilter.cxx.

87{
89
90 float pedestal = 10.; // A non-zero default is used to avoid the data quality cuts.
91 float energy = 0.;
92 float time = 0.;
93 float chi2 = 0.;
94 m_digits = digits->samples(); //the 7 samples; currently charge is expected. It the future these will be digitized
95 const HWIdentifier adcId = digits->adc_HWID();
96 int gain = m_tileHWID->adc(adcId); //this is set to 1 for QIE FEB by default
97
98 ATH_MSG_VERBOSE("Building Raw Channel, with QIEFilter, HWID:" << m_tileHWID->to_string(adcId) << " gain=" << gain);
99
100 int ros = m_tileHWID->ros(adcId);
101 int drawer = m_tileHWID->drawer(adcId);
102 int channel = m_tileHWID->channel(adcId);
103 chi2 = filter(ros, drawer, channel, energy, time);
104
105 if (msgLvl(MSG::VERBOSE)) {
106 msg(MSG::VERBOSE) << "Creating QIEFilter RawChannel" << " a=" << energy << " t=" << time
107 << " q=" << chi2 << endmsg;
108
109 msg(MSG::VERBOSE) << "digits:";
110 for (unsigned int i = 0; i < m_digits.size(); ++i)
111 msg(MSG::VERBOSE) << " " << m_digits[i];
112 msg(MSG::VERBOSE) << " " << endmsg;
113 }
114
115 // return new TileRawChannel
116 // TileRawChannel *rawCh = new TileRawChannel(adcId,OptFilterEne,OptFilterTime,OptFilterChi2,OptFilterPed);
117 DataPool<TileRawChannel> tileRchPool(m_dataPoollSize);
118 TileRawChannel *rawCh = tileRchPool.nextElementPtr();
119 rawCh->assign (adcId,
120 energy,
121 time,
122 chi2,
123 pedestal);
124
125 if (TileID::HIGHGAIN == gain) {
126 ++m_nChH;
127 m_RChSumH += energy;
128 } else {
129 ++m_nChL;
130 m_RChSumL += energy;
131 }
132
133 return rawCh;
134}
float filter(int ros, int drawer, int channel, float &amplitude, float &time)
< Applies OF algorithm
Gaudi::Property< int > m_dataPoollSize
void assign(const HWIdentifier &id, float amplitude, float time, float quality, float ped=0.0)

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 368 of file AthCommonDataStore.h.

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

◆ renounceArray()

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

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ resetDrawer()

void TileRawChannelBuilder::resetDrawer ( )
inherited

Definition at line 28 of file TileRawChannelBuilder.cxx.

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

◆ resetOverflows()

void TileRawChannelBuilder::resetOverflows ( void )
inherited

Definition at line 33 of file TileRawChannelBuilder.cxx.

33 {
34 m_overflows.clear();
35}

◆ sysInitialize()

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

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ sysStart()

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

Handle START transition.

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

◆ updateVHKA()

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

Definition at line 298 of file AthCommonDataStore.h.

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

Member Data Documentation

◆ m_ADCmaskValueMinusEps

float TileRawChannelBuilder::m_ADCmaskValueMinusEps {0.f}
protectedinherited

indicates channels which were masked in background dataset

Definition at line 225 of file TileRawChannelBuilder.h.

225{0.f};

◆ m_ADCmaxMinusEps

float TileRawChannelBuilder::m_ADCmaxMinusEps {0.f}
protectedinherited

Definition at line 224 of file TileRawChannelBuilder.h.

224{0.f};

◆ m_ampMinThresh

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

Definition at line 152 of file TileRawChannelBuilder.h.

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

◆ m_badDrawer

bool TileRawChannelBuilder::m_badDrawer {false}
protectedinherited

Definition at line 213 of file TileRawChannelBuilder.h.

213{false};

◆ m_bsflags

unsigned int TileRawChannelBuilder::m_bsflags {0}
protectedinherited

Definition at line 138 of file TileRawChannelBuilder.h.

138{0};

◆ m_cabling

const TileCablingService* TileRawChannelBuilder::m_cabling {nullptr}
protectedinherited

TileCabling instance.

Definition at line 185 of file TileRawChannelBuilder.h.

185{nullptr};

◆ m_cablingSvc

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

Name of Tile cabling service.

Definition at line 182 of file TileRawChannelBuilder.h.

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

◆ m_calibrateEnergy

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

Definition at line 142 of file TileRawChannelBuilder.h.

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

◆ m_capdaq

double TileRawChannelBuilder::m_capdaq {100.}
protectedinherited

Definition at line 196 of file TileRawChannelBuilder.h.

196{100.}; // Capacitor

◆ m_chCounter

unsigned int TileRawChannelBuilder::m_chCounter {0}
protectedinherited

Definition at line 199 of file TileRawChannelBuilder.h.

199{0};

◆ m_cischan

int TileRawChannelBuilder::m_cischan {-1}
protectedinherited

Definition at line 195 of file TileRawChannelBuilder.h.

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

◆ m_correctTime

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

Definition at line 145 of file TileRawChannelBuilder.h.

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

◆ m_dataPoollSize

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

Definition at line 207 of file TileRawChannelBuilder.h.

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

◆ m_demoFragIDs

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

Definition at line 187 of file TileRawChannelBuilder.h.

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

◆ m_detStore

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

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_digits

std::vector<float> TileRawChannelBuilderQIEFilter::m_digits
private

Definition at line 73 of file TileRawChannelBuilderQIEFilter.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_error

int TileRawChannelBuilder::m_error[MAX_CHANNELS]
protectedinherited

Definition at line 211 of file TileRawChannelBuilder.h.

◆ m_evtCounter

unsigned int TileRawChannelBuilder::m_evtCounter {0}
protectedinherited

Definition at line 198 of file TileRawChannelBuilder.h.

198{0};

◆ m_evtStore

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

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_f_ADCmax

float TileRawChannelBuilder::m_f_ADCmax {0.f}
protectedinherited

Definition at line 221 of file TileRawChannelBuilder.h.

221{0.f};

◆ m_f_ADCmaxPlus1

float TileRawChannelBuilder::m_f_ADCmaxPlus1 {0.f}
protectedinherited

Definition at line 223 of file TileRawChannelBuilder.h.

223{0.f};

◆ m_firstSample

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

Definition at line 140 of file TileRawChannelBuilder.h.

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

◆ m_i_ADCmax

int TileRawChannelBuilder::m_i_ADCmax {0}
protectedinherited

Definition at line 220 of file TileRawChannelBuilder.h.

220{0};

◆ m_i_ADCmaxPlus1

int TileRawChannelBuilder::m_i_ADCmaxPlus1 {0}
protectedinherited

Definition at line 222 of file TileRawChannelBuilder.h.

222{0};

◆ m_idocis

bool TileRawChannelBuilder::m_idocis {false}
protectedinherited

Definition at line 194 of file TileRawChannelBuilder.h.

194{false}; // CIS fitting

◆ m_idolas

bool TileRawChannelBuilder::m_idolas {false}
protectedinherited

Definition at line 192 of file TileRawChannelBuilder.h.

192{false}; // Laser fitting

◆ m_idoped

bool TileRawChannelBuilder::m_idoped {false}
protectedinherited

Definition at line 193 of file TileRawChannelBuilder.h.

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

◆ m_idophys

bool TileRawChannelBuilder::m_idophys {false}
protectedinherited

Definition at line 191 of file TileRawChannelBuilder.h.

191{false}; // Phys fitting

◆ m_infoName

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

Definition at line 218 of file TileRawChannelBuilder.h.

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

◆ m_lastDrawer

int TileRawChannelBuilder::m_lastDrawer {-1}
protectedinherited

Definition at line 212 of file TileRawChannelBuilder.h.

212{-1};

◆ m_nChH

int TileRawChannelBuilder::m_nChH {0}
protectedinherited

Definition at line 202 of file TileRawChannelBuilder.h.

202{0};

◆ m_nChL

int TileRawChannelBuilder::m_nChL {0}
protectedinherited

Definition at line 201 of file TileRawChannelBuilder.h.

201{0};

◆ m_nConst

int TileRawChannelBuilderQIEFilter::m_nConst {}
private

internal counters

Definition at line 69 of file TileRawChannelBuilderQIEFilter.h.

69{};

◆ m_noiseFilterTools

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

Definition at line 166 of file TileRawChannelBuilder.h.

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

◆ m_notUpgradeCabling

bool TileRawChannelBuilder::m_notUpgradeCabling {true}
protectedinherited

Definition at line 215 of file TileRawChannelBuilder.h.

215{true};

◆ m_nSamples

int TileRawChannelBuilderQIEFilter::m_nSamples {}
private

number of samples in the data

Definition at line 71 of file TileRawChannelBuilderQIEFilter.h.

71{};

◆ m_nSignal

int TileRawChannelBuilderQIEFilter::m_nSignal {}
private

internal counters

Definition at line 68 of file TileRawChannelBuilderQIEFilter.h.

68{};

◆ m_overflows

Overflows_t TileRawChannelBuilder::m_overflows
protectedinherited

Definition at line 206 of file TileRawChannelBuilder.h.

◆ m_pedestalMode

Gaudi::Property<int> TileRawChannelBuilderQIEFilter::m_pedestalMode {this, "PedestalMode", 17, "Pedestal mode to use"}
private

pedestal mode to use

Definition at line 67 of file TileRawChannelBuilderQIEFilter.h.

67{this, "PedestalMode", 17, "Pedestal mode to use"};

◆ m_rawChannelCnt

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

Definition at line 133 of file TileRawChannelBuilder.h.

◆ m_rawChannelContainerKey

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

Definition at line 129 of file TileRawChannelBuilder.h.

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

◆ m_RChSumH

double TileRawChannelBuilder::m_RChSumH {0.}
protectedinherited

Definition at line 204 of file TileRawChannelBuilder.h.

204{0.};

◆ m_RChSumL

double TileRawChannelBuilder::m_RChSumL {0.}
protectedinherited

Definition at line 203 of file TileRawChannelBuilder.h.

203{0.};

◆ m_rChType

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

Definition at line 136 of file TileRawChannelBuilder.h.

◆ m_rChUnit

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

◆ m_runType

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

Definition at line 160 of file TileRawChannelBuilder.h.

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

◆ m_tileHWID

const TileHWID* TileRawChannelBuilder::m_tileHWID {nullptr}
protectedinherited

Definition at line 164 of file TileRawChannelBuilder.h.

164{nullptr};

◆ m_tileID

const TileID* TileRawChannelBuilder::m_tileID {nullptr}
protectedinherited

Definition at line 163 of file TileRawChannelBuilder.h.

163{nullptr};

◆ m_tileIdTransforms

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

Definition at line 175 of file TileRawChannelBuilder.h.

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

◆ m_tileInfo

const TileInfo* TileRawChannelBuilder::m_tileInfo {nullptr}
protectedinherited

Definition at line 219 of file TileRawChannelBuilder.h.

219{nullptr};

◆ m_tileToolEmscale

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

Definition at line 169 of file TileRawChannelBuilder.h.

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

◆ m_tileToolTiming

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

Definition at line 172 of file TileRawChannelBuilder.h.

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

◆ m_timeMaxThresh

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

Definition at line 156 of file TileRawChannelBuilder.h.

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

◆ m_timeMinThresh

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

Definition at line 154 of file TileRawChannelBuilder.h.

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

◆ m_trigType

int TileRawChannelBuilder::m_trigType {0}
protectedinherited

Definition at line 190 of file TileRawChannelBuilder.h.

190{0};

◆ m_useDSP

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

Definition at line 149 of file TileRawChannelBuilder.h.

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

◆ m_varHandleArraysDeclared

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

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 386 of file AthCommonDataStore.h.

◆ MAX_CHANNELS

const int TileRawChannelBuilder::MAX_CHANNELS = 48
staticprotectedinherited

Definition at line 209 of file TileRawChannelBuilder.h.

◆ MAX_DMUS

const int TileRawChannelBuilder::MAX_DMUS = 16
staticprotectedinherited

Definition at line 210 of file TileRawChannelBuilder.h.


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