CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ESRecHitAnalyticAlgo Class Reference

#include <ESRecHitAnalyticAlgo.h>

Public Member Functions

 ESRecHitAnalyticAlgo ()
 
double * EvalAmplitude (const ESDataFrame &digi, double ped) const
 
EcalRecHit reconstruct (const ESDataFrame &digi) const
 
void setAngleCorrectionFactors (const ESAngleCorrectionFactors *ang)
 
void setChannelStatus (const ESChannelStatus *status)
 
void setESGain (const double &value)
 
void setIntercalibConstants (const ESIntercalibConstants *mips)
 
void setMIPGeV (const double &value)
 
void setPedestals (const ESPedestals *peds)
 
void setRatioCuts (const ESRecHitRatioCuts *ratioCuts)
 
 ~ESRecHitAnalyticAlgo ()
 

Private Attributes

const ESAngleCorrectionFactorsang_
 
const ESChannelStatuschannelStatus_
 
double gain_
 
double MIPGeV_
 
const ESIntercalibConstantsmips_
 
const ESPedestalspeds_
 
const ESRecHitRatioCutsratioCuts_
 

Detailed Description

Definition at line 12 of file ESRecHitAnalyticAlgo.h.

Constructor & Destructor Documentation

◆ ESRecHitAnalyticAlgo()

ESRecHitAnalyticAlgo::ESRecHitAnalyticAlgo ( )

Definition at line 7 of file ESRecHitAnalyticAlgo.cc.

7 {}

◆ ~ESRecHitAnalyticAlgo()

ESRecHitAnalyticAlgo::~ESRecHitAnalyticAlgo ( )

Definition at line 9 of file ESRecHitAnalyticAlgo.cc.

9 {}

Member Function Documentation

◆ EvalAmplitude()

double * ESRecHitAnalyticAlgo::EvalAmplitude ( const ESDataFrame digi,
double  ped 
) const

Definition at line 11 of file ESRecHitAnalyticAlgo.cc.

11  {
12  double* fitresults = new double[3]{};
13  double adc[3]{};
14 
15  for (int i = 0; i < digi.size(); i++)
16  adc[i] = digi.sample(i).adc() - ped;
17 
18  double status = 0;
19  if (adc[0] > 20)
20  status = 14;
21  if (adc[1] < 0 || adc[2] < 0)
22  status = 10;
23  if (adc[0] > adc[1] && adc[0] > adc[2])
24  status = 8;
25  if (adc[2] > adc[1] && adc[2] > adc[0])
26  status = 9;
27  double r12 = (adc[1] != 0) ? adc[0] / adc[1] : 99999;
28  double r23 = (adc[2] != 0) ? adc[1] / adc[2] : 99999;
29  if (r12 > ratioCuts_->getR12High())
30  status = 5;
31  if (r23 > ratioCuts_->getR23High())
32  status = 6;
33  if (r23 < ratioCuts_->getR23Low())
34  status = 7;
35 
36  if (int(status) == 0) {
37  double A1 = adc[1];
38  double A2 = adc[2];
39 
40  // t0 from analytical formula:
41  double n = 1.798;
42  double w = 0.07291;
43  double DeltaT = 25.;
44  double aaa = log(A2 / A1) / n;
45  double bbb = w / n * DeltaT;
46  double ccc = exp(aaa + bbb);
47 
48  //double t0 = (2.-ccc)/(ccc-1) * DeltaT + 5;
49  double t0 = (2. - ccc) / (1. - ccc) * DeltaT - 5;
50 
51  // A from analytical formula:
52  double t1 = 20.;
53  //double t2 = 45.;
54  double A_1 = pow(w / n * (t1), n) * exp(n - w * (t1));
55  //double A_2 = pow(w/n*(t2),n) * exp(n-w*(t2));
56  double AA1 = A1 / A_1;
57  //double AA2 = A2 / A_2;
58 
59  fitresults[0] = AA1;
60  fitresults[1] = t0;
61 
62  if (adc[1] > 2800 && adc[2] > 2800)
63  status = 11;
64  else if (adc[1] > 2800)
65  status = 12;
66  else if (adc[2] > 2800)
67  status = 13;
68 
69  } else {
70  fitresults[0] = 0;
71  fitresults[1] = -999;
72  }
73 
74  fitresults[2] = status;
75 
76  return fitresults;
77 }

References ecalMGPA::adc(), ESSample::adc(), JetChargeProducer_cfi::exp, ESRecHitRatioCuts::getR12High(), ESRecHitRatioCuts::getR23High(), mps_fire::i, dqm-mbProfile::log, dqmiodumpmetadata::n, funct::pow(), ratioCuts_, ESDataFrame::sample(), ESDataFrame::size(), mps_update::status, FrontierCondition_GT_autoExpress_cfi::t0, RandomServiceHelper::t1, and w.

Referenced by reconstruct().

◆ reconstruct()

EcalRecHit ESRecHitAnalyticAlgo::reconstruct ( const ESDataFrame digi) const

Definition at line 79 of file ESRecHitAnalyticAlgo.cc.

79  {
80  ESPedestals::const_iterator it_ped = peds_->find(digi.id());
81 
84 
86 
87  double* results;
88 
89  results = EvalAmplitude(digi, it_ped->getMean());
90 
91  double energy = results[0];
92  double t0 = results[1];
93  int status = (int)results[2];
94  delete[] results;
95 
96  double mipCalib = (fabs(cos(*it_ang)) != 0.) ? (*it_mip) / fabs(cos(*it_ang)) : 0.;
97  energy *= (mipCalib != 0.) ? MIPGeV_ / mipCalib : 0.;
98 
99  LogDebug("ESRecHitAnalyticAlgo") << "ESRecHitAnalyticAlgo : reconstructed energy " << energy << " T0 " << t0;
100 
101  EcalRecHit rechit(digi.id(), energy, t0);
102 
103  if (it_status->getStatusCode() == 1) {
105  } else {
106  if (status == 0)
107  rechit.setFlag(EcalRecHit::kESGood);
108  else if (status == 5)
109  rechit.setFlag(EcalRecHit::kESBadRatioFor12);
110  else if (status == 6)
111  rechit.setFlag(EcalRecHit::kESBadRatioFor23Upper);
112  else if (status == 7)
113  rechit.setFlag(EcalRecHit::kESBadRatioFor23Lower);
114  else if (status == 8)
115  rechit.setFlag(EcalRecHit::kESTS1Largest);
116  else if (status == 9)
117  rechit.setFlag(EcalRecHit::kESTS3Largest);
118  else if (status == 10)
119  rechit.setFlag(EcalRecHit::kESTS3Negative);
120  else if (status == 11)
121  rechit.setFlag(EcalRecHit::kESSaturated);
122  else if (status == 12)
123  rechit.setFlag(EcalRecHit::kESTS2Saturated);
124  else if (status == 13)
125  rechit.setFlag(EcalRecHit::kESTS3Saturated);
126  else if (status == 14)
127  rechit.setFlag(EcalRecHit::kESTS13Sigmas);
128  }
129 
130  return rechit;
131 }

References ang_, channelStatus_, funct::cos(), HCALHighEnergyHPDFilter_cfi::energy, EvalAmplitude(), ESCondObjectContainer< T >::find(), ESCondObjectContainer< T >::getMap(), ESDataFrame::id(), createfilelist::int, EcalRecHit::kESBadRatioFor12, EcalRecHit::kESBadRatioFor23Lower, EcalRecHit::kESBadRatioFor23Upper, EcalRecHit::kESDead, EcalRecHit::kESGood, EcalRecHit::kESSaturated, EcalRecHit::kESTS13Sigmas, EcalRecHit::kESTS1Largest, EcalRecHit::kESTS2Saturated, EcalRecHit::kESTS3Largest, EcalRecHit::kESTS3Negative, EcalRecHit::kESTS3Saturated, LogDebug, MIPGeV_, mips_, peds_, bookConverter::results, EcalRecHit::setFlag(), mps_update::status, and FrontierCondition_GT_autoExpress_cfi::t0.

Referenced by ESRecHitWorker::run().

◆ setAngleCorrectionFactors()

void ESRecHitAnalyticAlgo::setAngleCorrectionFactors ( const ESAngleCorrectionFactors ang)
inline

Definition at line 23 of file ESRecHitAnalyticAlgo.h.

23 { ang_ = ang; }

References ang_.

Referenced by ESRecHitWorker::set().

◆ setChannelStatus()

void ESRecHitAnalyticAlgo::setChannelStatus ( const ESChannelStatus status)
inline

Definition at line 21 of file ESRecHitAnalyticAlgo.h.

References channelStatus_, and mps_update::status.

Referenced by ESRecHitWorker::set().

◆ setESGain()

void ESRecHitAnalyticAlgo::setESGain ( const double &  value)
inline

Definition at line 17 of file ESRecHitAnalyticAlgo.h.

17 { gain_ = value; }

References gain_, and relativeConstraints::value.

Referenced by ESRecHitWorker::set().

◆ setIntercalibConstants()

void ESRecHitAnalyticAlgo::setIntercalibConstants ( const ESIntercalibConstants mips)
inline

Definition at line 20 of file ESRecHitAnalyticAlgo.h.

20 { mips_ = mips; }

References mips_.

Referenced by ESRecHitWorker::set().

◆ setMIPGeV()

void ESRecHitAnalyticAlgo::setMIPGeV ( const double &  value)
inline

Definition at line 18 of file ESRecHitAnalyticAlgo.h.

18 { MIPGeV_ = value; }

References MIPGeV_, and relativeConstraints::value.

Referenced by ESRecHitWorker::set().

◆ setPedestals()

void ESRecHitAnalyticAlgo::setPedestals ( const ESPedestals peds)
inline

Definition at line 19 of file ESRecHitAnalyticAlgo.h.

19 { peds_ = peds; }

References peds_.

Referenced by ESRecHitWorker::set().

◆ setRatioCuts()

void ESRecHitAnalyticAlgo::setRatioCuts ( const ESRecHitRatioCuts ratioCuts)
inline

Definition at line 22 of file ESRecHitAnalyticAlgo.h.

22 { ratioCuts_ = ratioCuts; }

References ratioCuts_.

Referenced by ESRecHitWorker::set().

Member Data Documentation

◆ ang_

const ESAngleCorrectionFactors* ESRecHitAnalyticAlgo::ang_
private

Definition at line 33 of file ESRecHitAnalyticAlgo.h.

Referenced by reconstruct(), and setAngleCorrectionFactors().

◆ channelStatus_

const ESChannelStatus* ESRecHitAnalyticAlgo::channelStatus_
private

Definition at line 31 of file ESRecHitAnalyticAlgo.h.

Referenced by reconstruct(), and setChannelStatus().

◆ gain_

double ESRecHitAnalyticAlgo::gain_
private

Definition at line 28 of file ESRecHitAnalyticAlgo.h.

Referenced by setESGain().

◆ MIPGeV_

double ESRecHitAnalyticAlgo::MIPGeV_
private

Definition at line 34 of file ESRecHitAnalyticAlgo.h.

Referenced by reconstruct(), and setMIPGeV().

◆ mips_

const ESIntercalibConstants* ESRecHitAnalyticAlgo::mips_
private

Definition at line 30 of file ESRecHitAnalyticAlgo.h.

Referenced by reconstruct(), and setIntercalibConstants().

◆ peds_

const ESPedestals* ESRecHitAnalyticAlgo::peds_
private

Definition at line 29 of file ESRecHitAnalyticAlgo.h.

Referenced by reconstruct(), and setPedestals().

◆ ratioCuts_

const ESRecHitRatioCuts* ESRecHitAnalyticAlgo::ratioCuts_
private

Definition at line 32 of file ESRecHitAnalyticAlgo.h.

Referenced by EvalAmplitude(), and setRatioCuts().

ecalMGPA::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:11
EcalRecHit
Definition: EcalRecHit.h:15
mps_fire.i
i
Definition: mps_fire.py:355
EcalRecHit::kESBadRatioFor23Lower
Definition: EcalRecHit.h:52
ESRecHitAnalyticAlgo::mips_
const ESIntercalibConstants * mips_
Definition: ESRecHitAnalyticAlgo.h:30
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
ESSample::adc
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:16
mps_update.status
status
Definition: mps_update.py:69
ESCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: ESCondObjectContainer.h:33
ESDataFrame::size
int size() const
Definition: ESDataFrame.h:21
EcalRecHit::kESTS3Saturated
Definition: EcalRecHit.h:58
bookConverter.results
results
Definition: bookConverter.py:144
ESRecHitRatioCuts::getR12High
float getR12High() const
Definition: ESRecHitRatioCuts.h:19
ESRecHitAnalyticAlgo::gain_
double gain_
Definition: ESRecHitAnalyticAlgo.h:28
ESDataFrame::sample
const ESSample & sample(int i) const
Definition: ESDataFrame.h:24
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
ESRecHitAnalyticAlgo::MIPGeV_
double MIPGeV_
Definition: ESRecHitAnalyticAlgo.h:34
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
FrontierCondition_GT_autoExpress_cfi.t0
t0
Definition: FrontierCondition_GT_autoExpress_cfi.py:148
w
const double w
Definition: UKUtility.cc:23
ESCondObjectContainer< ESPedestal >::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: ESCondObjectContainer.h:17
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
EcalRecHit::kESSaturated
Definition: EcalRecHit.h:56
EcalRecHit::kESTS1Largest
Definition: EcalRecHit.h:53
EcalRecHit::kESTS3Negative
Definition: EcalRecHit.h:55
EcalRecHit::kESTS13Sigmas
Definition: EcalRecHit.h:59
createfilelist.int
int
Definition: createfilelist.py:10
ESRecHitAnalyticAlgo::peds_
const ESPedestals * peds_
Definition: ESRecHitAnalyticAlgo.h:29
EcalRecHit::kESBadRatioFor12
Definition: EcalRecHit.h:50
ESCondObjectContainer::getMap
const self & getMap() const
Definition: ESCondObjectContainer.h:41
ESRecHitRatioCuts::getR23High
float getR23High() const
Definition: ESRecHitRatioCuts.h:21
ESRecHitAnalyticAlgo::EvalAmplitude
double * EvalAmplitude(const ESDataFrame &digi, double ped) const
Definition: ESRecHitAnalyticAlgo.cc:11
relativeConstraints.value
value
Definition: relativeConstraints.py:53
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
ESRecHitAnalyticAlgo::ratioCuts_
const ESRecHitRatioCuts * ratioCuts_
Definition: ESRecHitAnalyticAlgo.h:32
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
EcalRecHit::setFlag
void setFlag(int flag)
set the flags (from Flags or ESFlags)
Definition: EcalRecHit.h:183
ESRecHitAnalyticAlgo::channelStatus_
const ESChannelStatus * channelStatus_
Definition: ESRecHitAnalyticAlgo.h:31
EcalRecHit::kESTS2Saturated
Definition: EcalRecHit.h:57
EcalRecHit::kESBadRatioFor23Upper
Definition: EcalRecHit.h:51
EcalRecHit::kESDead
Definition: EcalRecHit.h:46
EcalRecHit::kESGood
Definition: EcalRecHit.h:45
ESDataFrame::id
const ESDetId & id() const
Definition: ESDataFrame.h:19
EcalRecHit::kESTS3Largest
Definition: EcalRecHit.h:54
ESRecHitAnalyticAlgo::ang_
const ESAngleCorrectionFactors * ang_
Definition: ESRecHitAnalyticAlgo.h:33