ATLAS Offline Software
Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | List of all members
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. More...
 
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. More...
 
virtual double adcCountToFemtoCoulomb (const float adcCounts, const float slope) const override final
 given one CSC ADC sample value, convert that to charge in femtoCoulomb More...
 
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 More...
 
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. More...
 
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. More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
virtual int stripStatusBit (uint32_t stripHashId) const override final
 return status bit More...
 
virtual bool stripT0phase (uint32_t stripHashId) const override final
 return T0phase related to 5 ASM. More...
 
virtual double stripT0base (uint32_t stripHashId) const override final
 return T0base related to 5 ASM. More...
 
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 More...
 
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. More...
 
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. More...
 
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 11 of file CscCalibTool.cxx.

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

◆ ~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 332 of file CscCalibTool.cxx.

333 {
334 
335  double charge = adc * slope;
336  ATH_MSG_VERBOSE ( "Using CscCalibTool::adcCountToFemtoCoulomb - adc = "
337  << adc << " charge(fC) = " << charge );
338  return charge;
339 }

◆ 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 502 of file CscCalibTool.cxx.

503 {
504  ATH_MSG_VERBOSE ( "The strip hash id is " << stripHashId );
505 
509  float pedestal = m_pedestal;
510  float slope = getPSlope(stripHashId);
511 
512  if ( m_readFromDatabase ) {
514  const CscCondDbData* readCdo{*readHandle};
515  if(!readCdo->readChannelPed(stripHashId, pedestal).isSuccess()){
516  ATH_MSG_DEBUG ( " failed to access CSC conditions database - pedestal - "
517  << "strip hash id = " << stripHashId );
518  pedestal = m_pedestal;
519  }
520  }
521  ATH_MSG_VERBOSE ( "Pedestal is " << pedestal << " For strip hash id " << stripHashId );
522 
523  // allowed negative adc values for bipolar fit
524  float adc = adcValue-pedestal;
525  return this->adcCountToFemtoCoulomb( adc, slope );
526 
527 }

◆ 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 138 of file CscCalibTool.cxx.

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

◆ 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 529 of file CscCalibTool.cxx.

530 {
531  ATH_MSG_VERBOSE ( "The strip hash id is " << stripHashId );
532 
536  float pedestal = m_pedestal;
537  float slope = getPSlope(stripHashId);
538  if ( m_readFromDatabase ) {
540  const CscCondDbData* readCdo{*readHandle};
541  if(!readCdo->readChannelPed(stripHashId, pedestal).isSuccess()){
542  ATH_MSG_DEBUG ( "failed to access CSC Conditions database - pedestal - "
543  << "strip hash id = " << stripHashId );
544  pedestal = m_pedestal;
545  }
546  }
547  ATH_MSG_VERBOSE ( "Pedestal is " << pedestal << " For strip hash id " << stripHashId );
548 
549  // allowed negative adc values for bipolar fit
550  float adc = adcValue-pedestal;
551  return this->adcCountToNumberOfElectrons( adc, slope );
552 }

◆ 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 554 of file CscCalibTool.cxx.

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

◆ addBipfunc()

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

Definition at line 643 of file CscCalibTool.cxx.

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

◆ 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 126 of file CscCalibTool.cxx.

127 {
128 
129  //ATH_MSG_VERBOSE ( "Using CscCalibTool::femtoCoulombToADCCount" );
130 
131  float slope = getPSlope(stripHashId);
132 
133  int adcValue = int ( func(femtoCoulombs,slope) );
134  return adcValue;
135 }

◆ 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 364 of file CscCalibTool.cxx.

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

◆ 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 341 of file CscCalibTool.cxx.

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

◆ func_prime()

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

Definition at line 355 of file CscCalibTool.cxx.

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

◆ getLatency()

double CscCalibTool::getLatency ( ) const
finaloverridevirtual

Definition at line 693 of file CscCalibTool.cxx.

693 {return m_latency;}

◆ getNumberOfIntegration()

double CscCalibTool::getNumberOfIntegration ( ) const
finaloverridevirtual

Definition at line 696 of file CscCalibTool.cxx.

696 {return m_integrationNumber;}

◆ getNumberOfIntegration2()

double CscCalibTool::getNumberOfIntegration2 ( ) const
finaloverridevirtual

Definition at line 697 of file CscCalibTool.cxx.

697 {return m_integrationNumber2;}

◆ getPSlope()

float CscCalibTool::getPSlope ( uint32_t  stripHashId) const
private

Definition at line 92 of file CscCalibTool.cxx.

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

◆ getSamplesFromBipolarFunc()

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

Definition at line 617 of file CscCalibTool.cxx.

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

◆ getSamplingTime()

double CscCalibTool::getSamplingTime ( ) const
finaloverridevirtual

Definition at line 692 of file CscCalibTool.cxx.

692 {return m_samplingTime;}

◆ getSignalWidth()

double CscCalibTool::getSignalWidth ( ) const
finaloverridevirtual

Definition at line 695 of file CscCalibTool.cxx.

695 {return m_signalWidth;}

◆ getTimeOffset()

double CscCalibTool::getTimeOffset ( ) const
finaloverridevirtual

Definition at line 694 of file CscCalibTool.cxx.

694 {return m_timeOffset;}

◆ getZ0()

double CscCalibTool::getZ0 ( ) const
finaloverridevirtual

ROOT version of bipolar function.

Definition at line 591 of file CscCalibTool.cxx.

591  {
593  double z0 = 0.5*( (sum+2)
594  -std::sqrt(std::pow(sum+2,2)
596  );
597  return z0;
598 }

◆ initialize()

StatusCode CscCalibTool::initialize ( )
finaloverridevirtual

Definition at line 63 of file CscCalibTool.cxx.

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

◆ 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 254 of file CscCalibTool.cxx.

255 {
256 
257  ATH_MSG_VERBOSE ( "The strip hash id is " << stripHashId );
258 
259  unsigned int status = stripStatusBit(stripHashId);
260  bool is_good = !( (status & 0x1) || ((status >> 1) & 0x1) ); // test for hot/dead channel
261  return is_good;
262 }

◆ 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 112 of file CscCalibTool.cxx.

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

◆ signal()

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

Definition at line 600 of file CscCalibTool.cxx.

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

◆ signal_amplitude()

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

Definition at line 607 of file CscCalibTool.cxx.

607  {
608  double z0 = getZ0();
609  double norm = signal(z0);
610  if (samplingTime <= driftTime) return 0.;
611  Double_t z = (samplingTime-driftTime)/m_signalWidth;
612  return signal(z)/norm;
613 }

◆ 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 201 of file CscCalibTool.cxx.

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

◆ 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 146 of file CscCalibTool.cxx.

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

◆ 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 227 of file CscCalibTool.cxx.

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

◆ 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 173 of file CscCalibTool.cxx.

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

◆ stripStatusBit()

int CscCalibTool::stripStatusBit ( uint32_t  stripHashId) const
finaloverridevirtual

return status bit

Definition at line 265 of file CscCalibTool.cxx.

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

◆ 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 307 of file CscCalibTool.cxx.

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

◆ 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 283 of file CscCalibTool.cxx.

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

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.

◆ m_messageCnt_t0phase

std::atomic_int CscCalibTool::m_messageCnt_t0phase {}
mutable

Definition at line 132 of file CscCalibTool.h.

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

◆ 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:
CscCalibTool::m_readFromDatabase
bool m_readFromDatabase
Definition: CscCalibTool.h:148
PlotCalibFromCool.norm
norm
Definition: PlotCalibFromCool.py:100
get_generator_info.result
result
Definition: get_generator_info.py:21
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
max
#define max(a, b)
Definition: cfImp.cxx:41
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CscCalibTool::m_timeOffset
double m_timeOffset
Definition: CscCalibTool.h:164
dualbipfunc
Double_t dualbipfunc(const Double_t *x, const Double_t *par)
Definition: CscCalibTool.cxx:59
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
CscCalibTool::m_use2Samples
bool m_use2Samples
Definition: CscCalibTool.h:171
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
x
#define x
CscCalibTool::stripStatusBit
virtual int stripStatusBit(uint32_t stripHashId) const override final
return status bit
Definition: CscCalibTool.cxx:265
CscCalibTool::func
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...
Definition: CscCalibTool.cxx:341
CscCalibTool::signal
virtual double signal(const double z) const override final
Definition: CscCalibTool.cxx:600
TRT::Hit::driftTime
@ driftTime
Definition: HitInfo.h:43
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
CscCalibTool::adcCountToNumberOfElectrons
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
Definition: CscCalibTool.cxx:138
lumiFormat.i
int i
Definition: lumiFormat.py:92
z
#define z
CscCalibTool::m_integrationNumber2
double m_integrationNumber2
Definition: CscCalibTool.h:160
beamspotman.n
n
Definition: beamspotman.py:731
CscCalibTool::getZ0
virtual double getZ0() const override final
ROOT version of bipolar function.
Definition: CscCalibTool.cxx:591
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
01SubmitToGrid.samples
samples
Definition: 01SubmitToGrid.py:58
CscCalibTool::m_messageCnt_t0phase
std::atomic_int m_messageCnt_t0phase
Definition: CscCalibTool.h:132
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
CscCalibTool::m_slope
float m_slope
Definition: CscCalibTool.h:151
CscCalibTool::m_slopeFromDatabase
bool m_slopeFromDatabase
Definition: CscCalibTool.h:149
CscCalibTool::m_signalWidth
double m_signalWidth
Definition: CscCalibTool.h:163
CscCalibTool::getPSlope
float getPSlope(uint32_t stripHashId) const
Definition: CscCalibTool.cxx:92
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
CscCalibTool::m_nSamples
unsigned int m_nSamples
Definition: CscCalibTool.h:168
charge
double charge(const T &p)
Definition: AtlasPID.h:494
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
TMVAToMVAUtils::convert
std::unique_ptr< MVAUtils::BDT > convert(TMVA::MethodBDT *bdt, bool isRegression=true, bool useYesNoLeaf=false)
Definition: TMVAToMVAUtils.h:114
CscCalibTool::m_noise
float m_noise
Definition: CscCalibTool.h:152
CscCalibTool::m_readKey
SG::ReadCondHandleKey< CscCondDbData > m_readKey
Definition: CscCalibTool.h:146
a
TList * a
Definition: liststreamerinfos.cxx:10
CscCalibTool::m_latency
double m_latency
Definition: CscCalibTool.h:166
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CscCalibTool::m_samplingTime
double m_samplingTime
Definition: CscCalibTool.h:162
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
CscCalibTool::m_onlineHLT
bool m_onlineHLT
Definition: CscCalibTool.h:170
CscCalibTool::m_integrationNumber
double m_integrationNumber
ROOT version of bipolar function.
Definition: CscCalibTool.h:159
beamspotnt.rms
rms
Definition: bin/beamspotnt.py:1266
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
merge.status
status
Definition: merge.py:17
CscCalibTool::adcCountToFemtoCoulomb
virtual double adcCountToFemtoCoulomb(const float adcCounts, const float slope) const override final
given one CSC ADC sample value, convert that to charge in femtoCoulomb
Definition: CscCalibTool.cxx:332
bipfunc
Double_t bipfunc(const Double_t *x, const Double_t *par)
Definition: CscCalibTool.cxx:36
CscCalibTool::m_messageCnt_t0base
std::atomic_int m_messageCnt_t0base
Definition: CscCalibTool.h:131
test_AnalysisBaseEventLoopJob.aa
aa
Definition: test_AnalysisBaseEventLoopJob.py:37
python.compressB64.c
def c
Definition: compressB64.py:93
CscCalibTool::m_pedestal
float m_pedestal
Definition: CscCalibTool.h:153
WriteCellNoiseToCool.noise
noise
Definition: WriteCellNoiseToCool.py:380
CscCondDbData
Definition: CscCondDbData.h:24