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

#include <CscCalibTool.h>

Inheritance diagram for CscCalibTool:
Collaboration diagram for CscCalibTool:

Public Member Functions

 CscCalibTool (const std::string &, const std::string &, const IInterface *)
virtual ~CscCalibTool ()=default
virtual StatusCode initialize () override final
virtual int femtoCoulombToADCCount (uint32_t stripHashId, const double femtoCoulombs) const override final
 given a charge on the CSC strip, convert that to ADC counts this is needed in the digitization for example where it is the charges on the strips that are simulated first and converter to AOD samples in a subsequent step.
virtual int numberOfElectronsToADCCount (uint32_t stripHashId, const int numberOfElecEquiv) const override final
 Here the charge on the CSC strip is given in number of equivalent electrons; conversion to ADC counts.
virtual double adcCountToFemtoCoulomb (const float adcCounts, const float slope) const override final
 given one CSC ADC sample value, convert that to charge in femtoCoulomb
virtual double adcCountToFemtoCoulomb (uint32_t stripHashId, const float adcCounts) const override final
virtual double adcCountToNumberOfElectrons (const float adcValue, const float slope) const override final
 given one CSC ADC sample value, convert that to charge in number of equivalent electrons
virtual double adcCountToNumberOfElectrons (uint32_t stripHashId, const float adcValue) const override final
virtual bool adcToCharge (const std::vector< uint16_t > &samples, uint32_t stripHashId, std::vector< float > &charges) const override final
 Conversion of ADC value to charge - Here the charges is returned in numbers of equivalent electrons.
virtual bool findCharge (const float samplingTime, const unsigned int samplingPhase, const std::vector< float > &samples, double &charge, double &time) const override final
 Given sampling values for a CSC strip, find the corresponding charge by fitting the time samples.
virtual double stripNoise (uint32_t stripHashId, const bool convert=true) const override final
 return the noise(sigma) on the readout strip in ADC counts or Number of Electrons number of electrons by default: convert=true
virtual double stripRMS (uint32_t stripHashId, const bool convert=true) const override final
 return the RMS on the readout strip in ADC counts or Number of Electrons number of electrons by default: convert=true
virtual double stripF001 (uint32_t stripHashId, const bool convert=true) const override final
 return the F001 on the readout strip in ADC counts or Number of Electrons number of electrons by default: convert=true
virtual double stripPedestal (uint32_t stripHashId, const bool convert=true) const override final
 return the pedestal on the readout strip in ADC counts or Number of Electrons
virtual bool isGood (uint32_t stripHashId) const override final
 return the status of this strip, good channel, dead channel, noisy channel - it will return true for strip that working fine, false is returned for dead/noisy channels
virtual int stripStatusBit (uint32_t stripHashId) const override final
 return status bit
virtual bool stripT0phase (uint32_t stripHashId) const override final
 return T0phase related to 5 ASM.
virtual double stripT0base (uint32_t stripHashId) const override final
 return T0base related to 5 ASM.
virtual double func (const double x, const float slope) const override final
 these function used in the AOD <-> conversion; may not be needed once we integrate the calibration service
virtual double func_prime (const double x, const float slope) const override final
virtual double signal (const double z) const override final
virtual double signal_amplitude (const double driftTime, const double samplingTime) const override final
virtual double getZ0 () const override final
 ROOT version of bipolar function.
virtual double getSamplingTime () const override final
virtual double getTimeOffset () const override final
virtual double getSignalWidth () const override final
virtual double getNumberOfIntegration () const override final
virtual double getNumberOfIntegration2 () const override final
virtual std::pair< double, double > addBipfunc (const double driftTime0, const double stripCharge0, const double driftTime1, const double stripCharge1) const override final
virtual std::vector< float > getSamplesFromBipolarFunc (const double driftTime0, const double stripCharge0) const override final
virtual double getLatency () const override final

Public Attributes

std::atomic_int m_messageCnt_t0base {}
std::atomic_int m_messageCnt_t0phase {}

Protected Attributes

SG::ReadCondHandleKey< CscCondDbDatam_readKey {this, "ReadKey", "CscCondDbData", "Key of CscCondDbData"}
bool m_readFromDatabase
bool m_slopeFromDatabase
float m_slope
float m_noise
float m_pedestal
double m_integrationNumber
 ROOT version of bipolar function.
double m_integrationNumber2
double m_samplingTime
double m_signalWidth
double m_timeOffset
double m_latency
unsigned int m_nSamples
bool m_onlineHLT
bool m_use2Samples

Private Member Functions

float getPSlope (uint32_t stripHashId) const

Detailed Description

Definition at line 36 of file CscCalibTool.h.

Constructor & Destructor Documentation

◆ CscCalibTool()

CscCalibTool::CscCalibTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 10 of file CscCalibTool.cxx.

12 : base_class(t,n,p)
13{
14 declareProperty( "Slope", m_slope = 0.19 );
15 declareProperty( "Noise", m_noise = 3.5 );
16 declareProperty( "Pedestal", m_pedestal = 2048.0 );
17 declareProperty( "ReadFromDatabase", m_readFromDatabase = true);
18 declareProperty( "integrationNumber", m_integrationNumber = 12.0);
19 declareProperty( "integrationNumber2", m_integrationNumber2 = 11.66);
20 declareProperty( "samplingTime", m_samplingTime = 50. ); //ns
21 declareProperty( "signalWidth", m_signalWidth = 14.40922); // 50/3.47ns
22 declareProperty( "SlopeFromDatabase", m_slopeFromDatabase=false);
23 declareProperty( "timeOffset", m_timeOffset = 46.825 );
24
25 declareProperty( "IsOnline" , m_onlineHLT = true); // This will be fed from jO
26
27 // new latency starting from 2010...
28 declareProperty( "Latency", m_latency = 100 ); // ns.....
29 declareProperty( "NSamples", m_nSamples = 4); // number of samples
30
31 declareProperty( "Use2Samples", m_use2Samples = false); // force 2 sample
32}
unsigned int m_nSamples
bool m_slopeFromDatabase
double m_integrationNumber2
double m_integrationNumber
ROOT version of bipolar function.
double m_signalWidth
bool m_readFromDatabase
double m_samplingTime
double m_timeOffset

◆ ~CscCalibTool()

virtual CscCalibTool::~CscCalibTool ( )
virtualdefault

Member Function Documentation

◆ adcCountToFemtoCoulomb() [1/2]

double CscCalibTool::adcCountToFemtoCoulomb ( const float adcCounts,
const float slope ) const
finaloverridevirtual

given one CSC ADC sample value, convert that to charge in femtoCoulomb

Definition at line 331 of file CscCalibTool.cxx.

332{
333
334 double charge = adc * slope;
335 ATH_MSG_VERBOSE ( "Using CscCalibTool::adcCountToFemtoCoulomb - adc = "
336 << adc << " charge(fC) = " << charge );
337 return charge;
338}
#define ATH_MSG_VERBOSE(x)
double charge(const T &p)
Definition AtlasPID.h:997

◆ adcCountToFemtoCoulomb() [2/2]

double CscCalibTool::adcCountToFemtoCoulomb ( uint32_t stripHashId,
const float adcCounts ) const
finaloverridevirtual

the strip hash id will be used to access the data base

subtract the pedestal

Definition at line 501 of file CscCalibTool.cxx.

502{
503 ATH_MSG_VERBOSE ( "The strip hash id is " << stripHashId );
504
506
508 float pedestal = m_pedestal;
509 float slope = getPSlope(stripHashId);
510
511 if ( m_readFromDatabase ) {
512 SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey};
513 const CscCondDbData* readCdo{*readHandle};
514 if(!readCdo->readChannelPed(stripHashId, pedestal).isSuccess()){
515 ATH_MSG_DEBUG ( " failed to access CSC conditions database - pedestal - "
516 << "strip hash id = " << stripHashId );
517 pedestal = m_pedestal;
518 }
519 }
520 ATH_MSG_VERBOSE ( "Pedestal is " << pedestal << " For strip hash id " << stripHashId );
521
522 // allowed negative adc values for bipolar fit
523 float adc = adcValue-pedestal;
524 return this->adcCountToFemtoCoulomb( adc, slope );
525
526}
#define ATH_MSG_DEBUG(x)
SG::ReadCondHandleKey< CscCondDbData > m_readKey
virtual double adcCountToFemtoCoulomb(const float adcCounts, const float slope) const override final
given one CSC ADC sample value, convert that to charge in femtoCoulomb
float getPSlope(uint32_t stripHashId) const
StatusCode readChannelPed(IdentifierHash, float &) const

◆ adcCountToNumberOfElectrons() [1/2]

double CscCalibTool::adcCountToNumberOfElectrons ( const float adcValue,
const float slope ) const
finaloverridevirtual

given one CSC ADC sample value, convert that to charge in number of equivalent electrons

conversion from ADC value to number of equivalent electrons

Definition at line 137 of file CscCalibTool.cxx.

138{
139 double conversionFactor = 1.602e-4; // 1 ee in femtoCoulomb
140 double femtoCoulombs = this->adcCountToFemtoCoulomb(adcValue, slope);
141 return (femtoCoulombs/conversionFactor);
142}

◆ adcCountToNumberOfElectrons() [2/2]

double CscCalibTool::adcCountToNumberOfElectrons ( uint32_t stripHashId,
const float adcValue ) const
finaloverridevirtual

the strip hash id will be used to access the data base

subtract the pedestal

Definition at line 528 of file CscCalibTool.cxx.

529{
530 ATH_MSG_VERBOSE ( "The strip hash id is " << stripHashId );
531
533
535 float pedestal = m_pedestal;
536 float slope = getPSlope(stripHashId);
537 if ( m_readFromDatabase ) {
538 SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey};
539 const CscCondDbData* readCdo{*readHandle};
540 if(!readCdo->readChannelPed(stripHashId, pedestal).isSuccess()){
541 ATH_MSG_DEBUG ( "failed to access CSC Conditions database - pedestal - "
542 << "strip hash id = " << stripHashId );
543 pedestal = m_pedestal;
544 }
545 }
546 ATH_MSG_VERBOSE ( "Pedestal is " << pedestal << " For strip hash id " << stripHashId );
547
548 // allowed negative adc values for bipolar fit
549 float adc = adcValue-pedestal;
550 return this->adcCountToNumberOfElectrons( adc, slope );
551}
virtual double adcCountToNumberOfElectrons(const float adcValue, const float slope) const override final
given one CSC ADC sample value, convert that to charge in number of equivalent electrons

◆ adcToCharge()

bool CscCalibTool::adcToCharge ( const std::vector< uint16_t > & samples,
uint32_t stripHashId,
std::vector< float > & charges ) const
finaloverridevirtual

Conversion of ADC value to charge - Here the charges is returned in numbers of equivalent electrons.

subtract the pedestal

Definition at line 553 of file CscCalibTool.cxx.

554 {
555 ATH_MSG_VERBOSE ( "The strip hash id is " << stripHashId );
556
557 charges.clear();
558
560 float pedestal = m_pedestal;
561 float slope = getPSlope(stripHashId);
562 if ( m_readFromDatabase ) {
563 SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey};
564 const CscCondDbData* readCdo{*readHandle};
565 if(!readCdo->readChannelPed(stripHashId, pedestal).isSuccess()){
566 ATH_MSG_DEBUG ( "failed to access CSC Conditions database - pedestal - "
567 << "strip hash id = " << stripHashId );
568 pedestal = m_pedestal;
569 }
570 }
571 ATH_MSG_VERBOSE ( "Pedestal is " << pedestal << " For strip hash id " << stripHashId );
572
573 unsigned max = samples.size();
574 if ( max == 0 ) return false;
575 for (unsigned int i=0; i<max; i++) {
576 // if ( samples[i] > pedestal ) {
577 float adc = samples[i]-pedestal;
578 float charge = static_cast<float> ( this->adcCountToNumberOfElectrons( adc, slope ) );
579 charges.push_back( charge );
580 // } else charges.push_back( 0.0 );
581 }
582 return true;
583}
#define max(a, b)
Definition cfImp.cxx:41

◆ addBipfunc()

std::pair< double, double > CscCalibTool::addBipfunc ( const double driftTime0,
const double stripCharge0,
const double driftTime1,
const double stripCharge1 ) const
finaloverridevirtual

Definition at line 642 of file CscCalibTool.cxx.

645 {
646
647 std::pair<double,double> result;
648 // To get a nomalization constant...
649 result.first =driftTime0;
650 result.second = stripCharge0;
651
652 if ( (stripCharge0==0.0 && stripCharge1==0.0)||
653 (stripCharge0>0.0 && stripCharge1==0.0))
654 return result;
655
656 if (stripCharge0==0.0 && stripCharge1>0.0) {
657 result.first =driftTime1;
658 result.second = stripCharge1;
659 return result;
660 }
661
662 std::unique_ptr<TF1> addedfunc = std::make_unique<TF1>("addedfunc", dualbipfunc, 0, 500, 10, 1, TF1::EAddToList::kNo);
663 addedfunc->SetParameters(stripCharge0, driftTime0,
665 stripCharge1, driftTime1,
667 result.second =addedfunc->GetMaximum(); // ==>stripCharges of added bipolars
668 float tmax =addedfunc->GetX(result.second);
669 result.first = tmax - getZ0()*m_signalWidth;
670
671 if (stripCharge0>0.0 && stripCharge1>0.0) return result;
672
673 float bipmin = addedfunc->GetMinimum(); // ==>stripCharges of added bipolars
674 float tmin = addedfunc->GetX(bipmin);
675 if (tmin<tmax) {
676 result.first = tmin-getZ0()*m_signalWidth;
677 result.second = bipmin;
678 }
679
680 // To check out conversion is correct...
681 ATH_MSG_VERBOSE ( "(" << driftTime0 << ":" << int(stripCharge0) << ")"
682 << "+(" << driftTime1 << ":" << int(stripCharge1) << ")"
683 << " ==> " << result.first << ":" << int(result.second)
684 << " e- which was " << int(stripCharge0+stripCharge1) );
685
686
687
688 return result;
689}
Double_t dualbipfunc(const Double_t *x, const Double_t *par)
virtual double getZ0() const override final
ROOT version of bipolar function.

◆ femtoCoulombToADCCount()

int CscCalibTool::femtoCoulombToADCCount ( uint32_t stripHashId,
const double femtoCoulombs ) const
finaloverridevirtual

given a charge on the CSC strip, convert that to ADC counts this is needed in the digitization for example where it is the charges on the strips that are simulated first and converter to AOD samples in a subsequent step.

Definition at line 125 of file CscCalibTool.cxx.

126{
127
128 //ATH_MSG_VERBOSE ( "Using CscCalibTool::femtoCoulombToADCCount" );
129
130 float slope = getPSlope(stripHashId);
131
132 int adcValue = int ( func(femtoCoulombs,slope) );
133 return adcValue;
134}
virtual double func(const double x, const float slope) const override final
these function used in the AOD <-> conversion; may not be needed once we integrate the calibration se...

◆ findCharge()

bool CscCalibTool::findCharge ( const float samplingTime,
const unsigned int samplingPhase,
const std::vector< float > & samples,
double & charge,
double & time ) const
finaloverridevirtual

Given sampling values for a CSC strip, find the corresponding charge by fitting the time samples.

By default, a parabolic fit is done. The charge and the time are returned. The time is calculated with respect to the time of the first sample.

find the maximum

all the samples are zeros

now the parabolic interpolation

a==0: 3 points on a line, no parabola possible

a>0: convex parabola isn't useful for peak finding

if the time offset is out of range

successful interpolation

Find the peaking time: this is no longer assuming a 4-time sample system The peaking time is the time of the largest sample. This is corrected by the timeOffset interpolation, which should range from -0.5 to 0.5.

Todo
find out if a larger range can be used, such as +-1.0

Multiply by sampling time to convert to nanoseconds. Finally subtract 25ns if the sampling phase is 1.

Definition at line 363 of file CscCalibTool.cxx.

364 {
365
366 time = 0.0;
367 charge = 0.0;
368
369 int numberOfSamplings = samples.size();
370 // no samples given
371 if (numberOfSamplings==0) return false;
372
373 // MS: The case of only 2 samples:
374 if ((numberOfSamplings==2) || m_use2Samples) { // no parabola possible
375 int i = numberOfSamplings/2-1;
376 charge = 0.5*(samples[i]+samples[i+1]); // 1+2 for 4 samples, 0+1 for 2
377
378 double asym = 0.;
379 if (std::abs(samples[i]+samples[i+1])>0.0001) asym = (samples[i+1]-samples[i])/(samples[i]+samples[i+1]);
380 /********************* No charge correction now.
381 // charge correction:
382 double chargecor = 77.85 + 1.415*asym - 44.97*asym*asym; // in percent
383 charge = charge / chargecor * 100.0;
384 *******************/
385
386 // time = i+0.5; // midpoint beween the 2 samples: no interpolation
387 // time *= samplingTime;
388 time = 76 + 47.85*asym + 6.629*asym*asym; // in ns, for 50ns sampling
389 if ( samplingPhase == 1 ) time -= 25;
390 return true;
391 }
392
394 float max = -4096000;
395 int maxIndex = -1;
396
397 if ( numberOfSamplings >10) { // for x5 data
398 maxIndex = 2;
399 max = samples[maxIndex];
400 }
401
402 for (int i=0; i<numberOfSamplings; i++) {
403 if ( numberOfSamplings >10 && (i<2 || i>6) ) continue; // for x5 data
404 if (samples[i] > max) {
405 max = samples[i];
406 maxIndex = i;
407 }
408 }
409
411 // if (max == -4096000) return false; //not possible
412
413
415
416 double a{}, b{}, c{};
417
418 int midIndex = maxIndex;
419 if (maxIndex == 0) { // peaks on the first sample
420 a = samples[maxIndex];
421 b = samples[maxIndex+1];
422 c = samples[maxIndex+2];
423 midIndex +=1;
424 } else if (maxIndex == numberOfSamplings-1) { // last sample but it won't happen if third and 4th samples are same...
425 a = samples[maxIndex-2];
426 b = samples[maxIndex-1];
427 c = samples[maxIndex];
428 midIndex -=1;
429 } else if (maxIndex > 0){ // normal case
430 a = samples[maxIndex-1];
431 b = samples[maxIndex];
432 c = samples[maxIndex+1];
433 }
434
435 //#D!!!!! Need to carefully check the case of 250 * 23898.136 * 28535.650 * 33587.949 * 33587.949 *
436
437 double aa = 0.5*(c+a-2*b); // p2 (coeff for x^2)
438 double bb = 0.5*(c-a);
439
440
443 if ( aa >= 0 ) {
444 time = midIndex;
445 time *= samplingTime;
446 if ( samplingPhase == 1 ) time -= 25; // works for both 20MHz and 40MHz
447 // time =0.0;
448 charge = max;
449
450 if (maxIndex ==0 || maxIndex ==1)
451 time -= 1000;
452 else if (maxIndex ==2 || maxIndex ==3)
453 time += 1000;
454
455 ATH_MSG_VERBOSE("WP aa is positive");
456 return false;
457 }
458
459 double timeOffset = -0.5*bb/aa;
460
461 ATH_MSG_VERBOSE("WP " << timeOffset);
463 if ( ( maxIndex == 0 && timeOffset < -2.0 )
464 || ( maxIndex == 3 && timeOffset > 2.0) ) {
465 time = midIndex;
466 time *= samplingTime;
467 if ( samplingPhase == 1 ) time -= 25; // works for both 20MHz and 40MHz
468 // time =0.0;
469 charge = max;
470
471 if (maxIndex ==0 || maxIndex ==1)
472 time -= 1000;
473 else if (maxIndex ==2 || maxIndex ==3)
474 time += 1000;
475
476 ATH_MSG_VERBOSE("time is out of range");
477
478 return true;
479 }
480
482 charge = aa*timeOffset*timeOffset + bb*timeOffset + b;
483 time = timeOffset;
484
494 time += midIndex;
495 time *= samplingTime;
496 if ( samplingPhase == 1 ) time -= 25;
497
498 return true;
499}
static Double_t a
time(flags, cells_name, *args, **kw)

◆ func()

double CscCalibTool::func ( const double x,
const float slope ) const
finaloverridevirtual

these function used in the AOD <-> conversion; may not be needed once we integrate the calibration service

Definition at line 340 of file CscCalibTool.cxx.

341{
342 int val = 0;
343 if ( slope != 0 ) val = int ( (x / slope) + 0.5);
344 // else
345 // ATH_MSG_WARNING ( "CscCalibTool::femtoCoulombToADC - slope = 0" );
346 // if ( val < 0 ) {
347 // ATH_MSG_WARNING ( "CscCalibTool::femtoCoulombToADC - ADC cannot be < 0 - " << val );
348 //val = 0;
349 // }
350
351 return (1.0*val);
352}
#define x

◆ func_prime()

double CscCalibTool::func_prime ( const double x,
const float slope ) const
finaloverridevirtual

Definition at line 354 of file CscCalibTool.cxx.

355{
356 double val = slope;
357 if ( slope == 0.0 )
358 ATH_MSG_WARNING ( "CscCalibTool - slope = 0 for x = " << x );
359 return val;
360}
#define ATH_MSG_WARNING(x)

◆ getLatency()

double CscCalibTool::getLatency ( ) const
finaloverridevirtual

Definition at line 692 of file CscCalibTool.cxx.

692{return m_latency;}

◆ getNumberOfIntegration()

double CscCalibTool::getNumberOfIntegration ( ) const
finaloverridevirtual

Definition at line 695 of file CscCalibTool.cxx.

695{return m_integrationNumber;}

◆ getNumberOfIntegration2()

double CscCalibTool::getNumberOfIntegration2 ( ) const
finaloverridevirtual

Definition at line 696 of file CscCalibTool.cxx.

696{return m_integrationNumber2;}

◆ getPSlope()

float CscCalibTool::getPSlope ( uint32_t stripHashId) const
private

Definition at line 91 of file CscCalibTool.cxx.

91 {
92
93
94 float slope = m_slope;
96 SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey};
97 const CscCondDbData* readCdo{*readHandle};
98 if(!readCdo->readChannelPSlope(stripHashId, slope).isSuccess()){
99 ATH_MSG_WARNING ( " failed to access CSC conditions database - slope - "
100 << "strip hash id = " << stripHashId );
101 }
102 }
103 ATH_MSG_DEBUG ( "The slope is " << slope << " for strip hash = " << stripHashId );
104
105 return slope;
106
107}
StatusCode readChannelPSlope(IdentifierHash, float &) const

◆ getSamplesFromBipolarFunc()

std::vector< float > CscCalibTool::getSamplesFromBipolarFunc ( const double driftTime0,
const double stripCharge0 ) const
finaloverridevirtual

Definition at line 616 of file CscCalibTool.cxx.

616 {
617
618 std::vector<float> result;
619 if ( stripCharge0==0.0 ) {
620 result.push_back(0.0);
621 result.push_back(0.0);
622 result.push_back(0.0);
623 result.push_back(0.0);
624 return result;
625 }
626
627 std::unique_ptr<TF1> bipolarFunc = std::make_unique<TF1>("bipolarFunc", bipfunc, -500, 500, 5, 1, TF1::EAddToList::kNo);
628 bipolarFunc->SetParameters(stripCharge0, driftTime0,
630
631
632 for (unsigned int i=0; i<m_nSamples; ++i) {
633
634 float sampleCharge = bipolarFunc->Eval(m_latency + i*m_samplingTime);
635 result.push_back( sampleCharge );
636
637 }
638 return result;
639}
Double_t bipfunc(const Double_t *x, const Double_t *par)

◆ getSamplingTime()

double CscCalibTool::getSamplingTime ( ) const
finaloverridevirtual

Definition at line 691 of file CscCalibTool.cxx.

691{return m_samplingTime;}

◆ getSignalWidth()

double CscCalibTool::getSignalWidth ( ) const
finaloverridevirtual

Definition at line 694 of file CscCalibTool.cxx.

694{return m_signalWidth;}

◆ getTimeOffset()

double CscCalibTool::getTimeOffset ( ) const
finaloverridevirtual

Definition at line 693 of file CscCalibTool.cxx.

693{return m_timeOffset;}

◆ getZ0()

double CscCalibTool::getZ0 ( ) const
finaloverridevirtual

ROOT version of bipolar function.

Definition at line 590 of file CscCalibTool.cxx.

590 {
592 double z0 = 0.5*( (sum+2)
593 -std::sqrt(std::pow(sum+2,2)
595 );
596 return z0;
597}

◆ initialize()

StatusCode CscCalibTool::initialize ( )
finaloverridevirtual

Definition at line 62 of file CscCalibTool.cxx.

62 {
63
64 ATH_MSG_DEBUG ( "Initializing Initializing CscCalibTool");
65
66 ATH_MSG_DEBUG ( "Default slope (if DB is not available) =" << m_slope );
67 ATH_MSG_DEBUG ( "Default noise (if DB is not available) =" << m_noise );
68 ATH_MSG_DEBUG ( "Default pedestal (if DB is not available) =" << m_pedestal );
69 ATH_MSG_DEBUG ( "Calib Constants are from DB ? =" << m_readFromDatabase );
70 ATH_MSG_DEBUG ( "Slope Constants are from DB ? =" << m_slopeFromDatabase );
71 ATH_MSG_DEBUG ( "Bipolar function integrationNumber(N_1) =" << m_integrationNumber);
72 ATH_MSG_DEBUG ( "Bipolar function integrationNumber(N_2) =" << m_integrationNumber2);
73 ATH_MSG_DEBUG ( "SamplingTime =" << m_samplingTime);
74 ATH_MSG_DEBUG ( "Signalwidth =" << m_signalWidth);
75 ATH_MSG_DEBUG ( "timeOffset (digitization) =" << m_timeOffset);
76 ATH_MSG_DEBUG ( "Is OnlineAccess (HLT) ?? =" << m_onlineHLT);
77 ATH_MSG_DEBUG ( "Force the use of the 2 sample charge? =" << m_use2Samples);
78
79 if (m_onlineHLT) {
80 ATH_MSG_DEBUG( "T0BaseFolder and T0PhaseFolder are not loaded!!! HLT COOLDB does not have it!!");
81 }
82
83 ATH_CHECK(m_readKey.initialize());
84
87
88 return StatusCode::SUCCESS;
89}
#define ATH_CHECK
Evaluate an expression and check for errors.
std::atomic_int m_messageCnt_t0base
std::atomic_int m_messageCnt_t0phase

◆ isGood()

bool CscCalibTool::isGood ( uint32_t stripHashId) const
finaloverridevirtual

return the status of this strip, good channel, dead channel, noisy channel - it will return true for strip that working fine, false is returned for dead/noisy channels

return the status of this strip, good channel, dead channel, noisy channel -
it will return true for strip that working fine, false is returned for dead/noisy channels

Definition at line 253 of file CscCalibTool.cxx.

254{
255
256 ATH_MSG_VERBOSE ( "The strip hash id is " << stripHashId );
257
258 unsigned int status = stripStatusBit(stripHashId);
259 bool is_good = !( (status & 0x1) || ((status >> 1) & 0x1) ); // test for hot/dead channel
260 return is_good;
261}
virtual int stripStatusBit(uint32_t stripHashId) const override final
return status bit
status
Definition merge.py:16

◆ numberOfElectronsToADCCount()

int CscCalibTool::numberOfElectronsToADCCount ( uint32_t stripHashId,
const int numberOfElecEquiv ) const
finaloverridevirtual

Here the charge on the CSC strip is given in number of equivalent electrons; conversion to ADC counts.

Definition at line 111 of file CscCalibTool.cxx.

112{
113
114 //ATH_MSG_VERBOSE ( "Using CscCalibTool::numberOfElectronsToADCCount" );
115
116 double conversionFactor = 1.602e-4; // 1 ee in femtoCoulomb
117 double femtoCoulombs = conversionFactor*numberOfElecEquiv;
118
119 float slope = getPSlope(stripHashId);
120
121 int adcValue = int ( func(femtoCoulombs,slope) );
122 return adcValue;
123}

◆ signal()

double CscCalibTool::signal ( const double z) const
finaloverridevirtual

Definition at line 599 of file CscCalibTool.cxx.

599 {
600 double amplitude = (1.0 - z / (1 + m_integrationNumber2))
601 * std::pow(z, 1.0 * m_integrationNumber)
602 * std::exp(-z);
603 return amplitude;
604}
#define z

◆ signal_amplitude()

double CscCalibTool::signal_amplitude ( const double driftTime,
const double samplingTime ) const
finaloverridevirtual

Definition at line 606 of file CscCalibTool.cxx.

606 {
607 double z0 = getZ0();
608 double norm = signal(z0);
609 if (samplingTime <= driftTime) return 0.;
610 Double_t z = (samplingTime-driftTime)/m_signalWidth;
611 return signal(z)/norm;
612}
virtual double signal(const double z) const override final
@ driftTime
Definition HitInfo.h:43

◆ stripF001()

double CscCalibTool::stripF001 ( uint32_t stripHashId,
const bool convert = true ) const
finaloverridevirtual

return the F001 on the readout strip in ADC counts or Number of Electrons number of electrons by default: convert=true

return the F001 on the readout strip in ADC count or Number of Electrons

ADC counts initialized with m_noise...

Definition at line 200 of file CscCalibTool.cxx.

201{
202 ATH_MSG_VERBOSE ( "The strip hash id is " << stripHashId );
203
204 float f001 = m_noise+m_pedestal;
205 if ( m_readFromDatabase ) {
206 SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey};
207 const CscCondDbData* readCdo{*readHandle};
208 if(!readCdo->readChannelF001(stripHashId, f001).isSuccess()){
209 ATH_MSG_DEBUG ( " failed to access CSC conditions database - f001 - "
210 << "strip hash id = " << stripHashId );
211 f001 = 3.251*m_noise+m_pedestal;
212 }
213 }
214
215 ATH_MSG_VERBOSE ( "The F001 is " << f001 << " for strip hash = " << stripHashId );
216
217 if ( convert ) {
218 float slope = getPSlope(stripHashId);
219 return this->adcCountToNumberOfElectrons( f001, slope );
220 } else {
221 return f001;
222 }
223}
StatusCode readChannelF001(IdentifierHash, float &) const

◆ stripNoise()

double CscCalibTool::stripNoise ( uint32_t stripHashId,
const bool convert = true ) const
finaloverridevirtual

return the noise(sigma) on the readout strip in ADC counts or Number of Electrons number of electrons by default: convert=true

return the noise on the readout strip in ADC count or Number of Electrons

ADC counts

Definition at line 145 of file CscCalibTool.cxx.

146{
147 ATH_MSG_VERBOSE ( "The strip hash id is " << stripHashId );
148
149 float noise = m_noise;
150 if ( m_readFromDatabase ) {
151 SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey};
152 const CscCondDbData* readCdo{*readHandle};
153 if(!readCdo->readChannelNoise(stripHashId, noise).isSuccess()){
154 ATH_MSG_DEBUG ( " failed to access CSC conditions database - noise - "
155 << "strip hash id = " << stripHashId );
156 noise = m_noise;
157 }
158 }
159
160 ATH_MSG_VERBOSE ( "The noise is " << noise << " for strip hash = " << stripHashId );
161
162 if ( convert ) {
163 float slope = getPSlope(stripHashId);
164 return this->adcCountToNumberOfElectrons( noise, slope );
165 } else {
166 return noise;
167 }
168}
StatusCode readChannelNoise(IdentifierHash, float &) const

◆ stripPedestal()

double CscCalibTool::stripPedestal ( uint32_t stripHashId,
const bool convert = true ) const
finaloverridevirtual

return the pedestal on the readout strip in ADC counts or Number of Electrons

return the pedestal on the readout strip in ADC counts or number of electrons

  • number of electrons by default: convert=true

Definition at line 226 of file CscCalibTool.cxx.

227{
228 ATH_MSG_VERBOSE ( "The strip hash id is " << stripHashId );
229
230 float pedestal = m_pedestal;
231 if ( m_readFromDatabase ) {
232 SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey};
233 const CscCondDbData* readCdo{*readHandle};
234 if(!readCdo->readChannelPed(stripHashId, pedestal).isSuccess()){
235 ATH_MSG_DEBUG ( " failed to access CSC conditions database - pedestal - "
236 << "strip hash id = " << stripHashId );
237 pedestal = m_pedestal;
238 }
239 }
240 ATH_MSG_VERBOSE ( "The pedestal is " << pedestal << " for strip hash = " << stripHashId );
241
242 if ( convert ) {
243 float slope = getPSlope(stripHashId);
244 return this->adcCountToNumberOfElectrons( pedestal, slope );
245 } else {
246 return pedestal;
247 }
248}

◆ stripRMS()

double CscCalibTool::stripRMS ( uint32_t stripHashId,
const bool convert = true ) const
finaloverridevirtual

return the RMS on the readout strip in ADC counts or Number of Electrons number of electrons by default: convert=true

return the rms on the readout strip in ADC count or Number of Electrons

ADC counts initialized with m_noise...

Definition at line 172 of file CscCalibTool.cxx.

173{
174 ATH_MSG_VERBOSE ( "The strip hash id is " << stripHashId );
175
176 float rms = m_noise;
177 if ( m_readFromDatabase ) {
178 SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey};
179 const CscCondDbData* readCdo{*readHandle};
180 if(!readCdo->readChannelRMS(stripHashId, rms).isSuccess()){
181 ATH_MSG_DEBUG ( " failed to access CSC conditions database - rms - "
182 << "strip hash id = " << stripHashId );
183 rms = m_noise;
184 }
185 }
186
187 ATH_MSG_VERBOSE ( "The RMS is " << rms << " for strip hash = " << stripHashId );
188
189 if ( convert ) {
190 float slope = getPSlope(stripHashId);
191 return this->adcCountToNumberOfElectrons( rms, slope );
192 } else {
193 return rms;
194 }
195
196}
StatusCode readChannelRMS(IdentifierHash, float &) const

◆ stripStatusBit()

int CscCalibTool::stripStatusBit ( uint32_t stripHashId) const
finaloverridevirtual

return status bit

Definition at line 264 of file CscCalibTool.cxx.

264 {
265
266 int status = 0;
267 if ( m_readFromDatabase ) {
268 SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey};
269 const CscCondDbData* readCdo{*readHandle};
270 if(!readCdo->readChannelStatus(stripHashId, status).isSuccess())
271 ATH_MSG_WARNING ( " failed to access CSC conditions database - status - "
272 << "strip hash id = " << stripHashId );
273 else
274 ATH_MSG_VERBOSE("The status word is " << std::hex << status <<
275 " for strip hash = " << std::dec << stripHashId);
276 }
277 return status;
278}
StatusCode readChannelStatus(IdentifierHash, int &) const

◆ stripT0base()

double CscCalibTool::stripT0base ( uint32_t stripHashId) const
finaloverridevirtual

return T0base related to 5 ASM.

For convenience, we use stripHashId to get it

Definition at line 306 of file CscCalibTool.cxx.

306 {
307
308 float t0base = 0.0;
309 if (! m_onlineHLT ) {
310 if ( m_readFromDatabase ) {
311 SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey};
312 const CscCondDbData* readCdo{*readHandle};
313 if(!readCdo->readChannelT0Base(stripHashId, t0base).isSuccess()){
314
315 if (m_messageCnt_t0base < 3) {
316 ATH_MSG_WARNING ( " failed to access CSC conditions database - t0base - "
317 << "strip hash id = " << stripHashId );
318 ATH_MSG_WARNING ( " This WARNING Message can be temporarily until COOL DB is filled");
320 }
321 } else {
322 ATH_MSG_VERBOSE ( "The t0base is " << t0base << " for stripHashId " << stripHashId );
323 }
324 }
325 }
326 return t0base;
327}
StatusCode readChannelT0Base(IdentifierHash, float &) const

◆ stripT0phase()

bool CscCalibTool::stripT0phase ( uint32_t stripHashId) const
finaloverridevirtual

return T0phase related to 5 ASM.

For convenience, we use stripHashId to get it

Definition at line 282 of file CscCalibTool.cxx.

282 {
283
284 bool t0phase = 0;
285
286 if (! m_onlineHLT ) {
287 if ( m_readFromDatabase ) {
288 SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey};
289 const CscCondDbData* readCdo{*readHandle};
290 if(!readCdo->readChannelT0Phase(stripHashId, t0phase).isSuccess()){
291 if (m_messageCnt_t0phase < 3) {
292 ATH_MSG_WARNING ( " failed to access CSC conditions database - t0phase - "
293 << "strip hash id = " << stripHashId );
294 ATH_MSG_WARNING ( " This WARNING Message can be temporarily until COOL DB is filled");
296 }
297 } else {
298 ATH_MSG_VERBOSE ( "The t0phase is " << t0phase << " for stripHashId " << stripHashId );
299 }
300 }
301 }
302 return t0phase;
303}
StatusCode readChannelT0Phase(IdentifierHash, bool &) const

Member Data Documentation

◆ m_integrationNumber

double CscCalibTool::m_integrationNumber
protected

ROOT version of bipolar function.

Definition at line 159 of file CscCalibTool.h.

◆ m_integrationNumber2

double CscCalibTool::m_integrationNumber2
protected

Definition at line 160 of file CscCalibTool.h.

◆ m_latency

double CscCalibTool::m_latency
protected

Definition at line 166 of file CscCalibTool.h.

◆ m_messageCnt_t0base

std::atomic_int CscCalibTool::m_messageCnt_t0base {}
mutable

Definition at line 131 of file CscCalibTool.h.

131{};

◆ m_messageCnt_t0phase

std::atomic_int CscCalibTool::m_messageCnt_t0phase {}
mutable

Definition at line 132 of file CscCalibTool.h.

132{};

◆ m_noise

float CscCalibTool::m_noise
protected

Definition at line 152 of file CscCalibTool.h.

◆ m_nSamples

unsigned int CscCalibTool::m_nSamples
protected

Definition at line 168 of file CscCalibTool.h.

◆ m_onlineHLT

bool CscCalibTool::m_onlineHLT
protected

Definition at line 170 of file CscCalibTool.h.

◆ m_pedestal

float CscCalibTool::m_pedestal
protected

Definition at line 153 of file CscCalibTool.h.

◆ m_readFromDatabase

bool CscCalibTool::m_readFromDatabase
protected

Definition at line 148 of file CscCalibTool.h.

◆ m_readKey

SG::ReadCondHandleKey<CscCondDbData> CscCalibTool::m_readKey {this, "ReadKey", "CscCondDbData", "Key of CscCondDbData"}
protected

Definition at line 146 of file CscCalibTool.h.

146{this, "ReadKey", "CscCondDbData", "Key of CscCondDbData"};

◆ m_samplingTime

double CscCalibTool::m_samplingTime
protected

Definition at line 162 of file CscCalibTool.h.

◆ m_signalWidth

double CscCalibTool::m_signalWidth
protected

Definition at line 163 of file CscCalibTool.h.

◆ m_slope

float CscCalibTool::m_slope
protected

Definition at line 151 of file CscCalibTool.h.

◆ m_slopeFromDatabase

bool CscCalibTool::m_slopeFromDatabase
protected

Definition at line 149 of file CscCalibTool.h.

◆ m_timeOffset

double CscCalibTool::m_timeOffset
protected

Definition at line 164 of file CscCalibTool.h.

◆ m_use2Samples

bool CscCalibTool::m_use2Samples
protected

Definition at line 171 of file CscCalibTool.h.


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